query
stringlengths
7
5.25k
document
stringlengths
15
1.06M
metadata
dict
negatives
sequencelengths
3
101
negative_scores
sequencelengths
3
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Test an object can be added to a message array for the current request
public function testAddMessageFromObjectForCurrentRequest() { $storage = ['slimFlash' => []]; $flash = new Messages($storage); $user = new \stdClass(); $user->name = 'Scooby Doo'; $user->emailAddress = '[email protected]'; $flash->addMessageNow('user', $user); $messages = $flash->getMessages(); $this->assertInstanceOf(\stdClass::class, $messages['user'][0]); $this->assertArrayHasKey('slimFlash', $storage); $this->assertEmpty($storage['slimFlash']); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testAddMessageFromObjectForNextRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $user = new \\stdClass();\n $user->name = 'Scooby Doo';\n $user->emailAddress = '[email protected]';\n\n $flash->addMessage('user', $user);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertInstanceOf(\\stdClass::class, $storage['slimFlash']['user'][0]);\n }", "public function testAddMessageFromArrayForCurrentRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $formData = [\n 'username' => 'Scooby Doo',\n 'emailAddress' => '[email protected]',\n ];\n\n $flash->addMessageNow('old', $formData);\n\n $messages = $flash->getMessages();\n $this->assertEquals($formData, $messages['old'][0]);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEmpty($storage['slimFlash']);\n }", "public function testAddMessageFromArrayForNextRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $formData = [\n 'username' => 'Scooby Doo',\n 'emailAddress' => '[email protected]',\n ];\n\n $flash->addMessage('old', $formData);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEquals($formData, $storage['slimFlash']['old'][0]);\n }", "public function add_request($request='') {\n $request = JsonParser::decode($request);\n if (is_array($request) === false) {\n $request = array($request);\n }\n $this->__requests[] = $request;\n return (true);\n }", "public function testSetMessagesForNextRequest()\n {\n $storage = [];\n \n $flash = new Messages($storage);\n $flash->addMessage('Test', 'Test');\n $flash->addMessage('Test', 'Test2');\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEquals(['Test', 'Test2'], $storage['slimFlash']['Test']);\n }", "public function testAddMessageFromAnIntegerForCurrentRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $flash->addMessageNow('key', 46);\n $flash->addMessageNow('key', 48);\n\n $messages = $flash->getMessages();\n $this->assertEquals(['46','48'], $messages['key']);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEmpty($storage['slimFlash']);\n }", "public function testAddMessageFromStringForNextRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $flash->addMessage('key', 'value');\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEquals(['value'], $storage['slimFlash']['key']);\n }", "public function testAddMessage()\n {\n $message1 = new Hostingcheck_Message('Foo message');\n $result = new Hostingcheck_Result_Info();\n $result->addMessage($message1);\n $this->assertEquals(array($message1), $result->messages());\n\n $message2 = new Hostingcheck_Message('Bar message');\n $result->addMessage($message2);\n $this->assertEquals(array($message1, $message2), $result->messages());\n\n $this->assertTrue($result->hasMessages());\n }", "public function test_message_can_be_responded_to() {\n\n $response = Message::create('a thoughtful response', $this->user, $this->message);\n $this->assertEquals($this->message, $response->getParentMessage());\n\n $response = Message::findById($response->getId());\n $this->assertEquals($this->message, $response->getParentMessage()->loadDependencies());\n\n }", "public function testAddMessageFromAnIntegerForNextRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $flash->addMessage('key', 46);\n $flash->addMessage('key', 48);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEquals(['46', '48'], $storage['slimFlash']['key']);\n }", "public function testAddMessageFromStringForCurrentRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $flash->addMessageNow('key', 'value');\n\n $messages = $flash->getMessages();\n $this->assertEquals(['value'], $messages['key']);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEmpty($storage['slimFlash']);\n }", "public function testSetMessagesForCurrentRequest()\n {\n $storage = ['slimFlash' => [ 'error' => ['An error']]];\n\n $flash = new Messages($storage);\n $flash->addMessageNow('error', 'Another error');\n $flash->addMessageNow('success', 'A success');\n $flash->addMessageNow('info', 'An info');\n\n $messages = $flash->getMessages();\n $this->assertEquals(['An error', 'Another error'], $messages['error']);\n $this->assertEquals(['A success'], $messages['success']);\n $this->assertEquals(['An info'], $messages['info']);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEmpty([], $storage['slimFlash']);\n }", "public function testMessages() {\n $result = new Hostingcheck_Result_Info();\n $this->assertEquals(array(), $result->messages());\n $this->assertFalse($result->hasMessages());\n\n $messages = array(\n new Hostingcheck_Message('Foo message'),\n new Hostingcheck_Message('Bar Message'),\n );\n $result = new Hostingcheck_Result_Info($messages);\n $this->assertEquals($messages, $result->messages());\n\n $this->assertTrue($result->hasMessages());\n }", "public function testAddWithMultipleMessages()\n {\n Phlash::add(\"info\", \"Please log in to continue\");\n Phlash::add(\"error\", \"There was a problem processing your request\");\n\n $flashMessages = Phlash::get();\n\n $this->assertNotEmpty($flashMessages);\n $this->assertEquals(count($flashMessages), 2);\n $this->assertEquals($flashMessages[0]->id, 0);\n $this->assertEquals($flashMessages[0]->type, \"info\");\n $this->assertEquals($flashMessages[0]->message, \"Please log in to continue\");\n $this->assertEquals($flashMessages[1]->id, 1);\n $this->assertEquals($flashMessages[1]->type, \"error\");\n $this->assertEquals($flashMessages[1]->message, \"There was a problem processing your request\");\n\n Phlash::clear();\n }", "public function testMessages()\n {\n $message = new PrivateMessage();\n $conversation = new Conversation();\n $this->assertEmpty($conversation->getMessages());\n\n $conversation->addMessage($message);\n $this->assertEquals(new ArrayCollection([$message]), $conversation->getMessages());\n\n $conversation->removeMessage($message);\n $this->assertEmpty($conversation->getMessages());\n }", "abstract public function messageObject(BCTObject $to, array $message);", "public function testGetQuickInboxMessages() {\n \t$this->assertInternalType('array',$this->chatModel->getQuickInboxMessages());\n }", "function add($message) { return; }", "public function testPutValidMessage () {\n\n\t\t//create a new message\n\t\t$newMessage = new Message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t\t$newMessage->insert($this->getPDO());\n\n\t\t//run a get request to establish session tokens\n\t\t$this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/');\n\n\t\t//grab the data from guzzle and enforce the status match our expectations\n\t\t$response = $this->guzzle->put('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/' . $newMessage->getMessage(),['headers' => ['X-XRF-TOKEN' => $this->getXsrfToken()], 'json' => $newMessage] );\n\t\t$this->assertSame($response->getStatusCode(), 200);\n\t\t$body = $response->getBpdy();\n\t\t$alertLevel = json_decode($body);\n\t\t$this->assertSame(200, $alertLevel->status);\n\n\t}", "public function testAddingAnElementWillReturnTrue()\n {\n $element1 = new \\stdClass();\n $element1->Name = 'EL 2';\n\n $Collection = new \\MySQLExtractor\\Common\\Collection();\n\n $response = $Collection->add($element1);\n $this->assertTrue($response);\n\n $elements = \\PHPUnit_Framework_Assert::readAttribute($Collection, 'elements');\n $this->assertEquals(array($element1), $elements);\n }", "public function testGetEmptyMessagesFromPrevRequest()\n {\n $storage = [];\n $flash = new Messages($storage);\n\n $this->assertEquals([], $flash->getMessages());\n }", "public function canAddToResult();", "public function testGetMessagesFromPrevRequest()\n {\n $storage = ['slimFlash' => ['Test']];\n $flash = new Messages($storage);\n\n $this->assertEquals(['Test'], $flash->getMessages());\n }", "private function changelog_validate_object () {\n\t\t# set valid objects\n\t\t$objects = array(\n\t\t\t\t\t\t\"ip_addr\",\n\t\t\t\t\t\t\"subnet\",\n\t\t\t\t\t\t\"section\"\n\t\t\t\t\t\t);\n\t\t# check\n\t\treturn in_array($this->object_type, $objects) ? true : false;\n\t}", "public function testPostAuthorizationSubjectBulkadd()\n {\n }", "public function testToJSON() {\n\n\t\t$createMessageRequest = new CreateMessageRequest();\n\n\t\t// Test without the 'application' and 'applicationsGroup' parameters\n\t\ttry {\n\n\t\t\t$createMessageRequest -> toJSON();\n\t\t\t$this -> fail('Must have thrown a PushwooshException !');\n\n\t\t} catch(PushwooshException $pe) {\n\n\t\t\t// Expected\n\n\t\t}\n\n\t\t// Test with both the 'application' and 'applicationsGroup parameters set\n\t\t$createMessageRequest -> setApplication('XXXX-XXXX');\n\t\t$createMessageRequest -> setApplicationsGroup('XXXX-XXXX');\n\n\t\ttry {\n\n\t\t\t$createMessageRequest -> toJSON();\n\t\t\t$this -> fail('Must have thrown a PushwooshException !');\n\n\t\t} catch(PushwooshException $pe) {\n\n\t\t\t// Expected\n\n\t\t}\n\n\t\t// Test without the 'auth' parameter set\n\t\t$createMessageRequest -> setApplicationsGroup(null);\n\n\t\ttry {\n\n\t\t\t$createMessageRequest -> toJSON();\n\t\t\t$this -> fail('Must have thrown a PushwooshException !');\n\n\t\t} catch(PushwooshException $pe) {\n\n\t\t\t// Expected\n\n\t\t}\n\t\t\n\t\t// Test with the 'auth' and 'application' parameters set and no notification\n\t\t$createMessageRequest -> setAuth('XXXX');\n\n\t\t$json = $createMessageRequest -> toJSON();\n\t\t$this -> assertCount(4, $json);\n\t\t$this -> assertTrue(array_key_exists('application', $json));\n\t\t$this -> assertTrue(array_key_exists('applicationsGroup', $json));\n\t\t$this -> assertTrue(array_key_exists('auth', $json));\n\t\t$this -> assertTrue(array_key_exists('notifications', $json));\n\t\t$this -> assertEquals('XXXX-XXXX', $json['application']);\n\t\t$this -> assertNull($json['applicationsGroup']);\n\t\t$this -> assertEquals('XXXX', $json['auth']);\n\t\t$this -> assertCount(0, $json['notifications']);\n\t\t\n\t\t// Test with one notificiation with only a 'content' field\n\t\t$notification = Notification::create();\n\t\t$notification -> setContent('CONTENT');\n\t\t$createMessageRequest -> addNotification($notification);\n\t\t\n\t\t$json = $createMessageRequest -> toJSON();\n\t\t$this -> assertCount(4, $json);\n\t\t$this -> assertTrue(array_key_exists('application', $json));\n\t\t$this -> assertTrue(array_key_exists('applicationsGroup', $json));\n\t\t$this -> assertTrue(array_key_exists('auth', $json));\n\t\t$this -> assertTrue(array_key_exists('notifications', $json));\n\t\t$this -> assertEquals('XXXX-XXXX', $json['application']);\n\t\t$this -> assertNull($json['applicationsGroup']);\n\t\t$this -> assertEquals('XXXX', $json['auth']);\n\t\t$this -> assertCount(1, $json['notifications']);\n\t\t$this -> assertCount(3, $json['notifications'][0]);\n\t\t$this -> assertTrue(array_key_exists('send_date', $json['notifications'][0]));\n\t\t$this -> assertTrue($json['notifications'][0]['ignore_user_timezone']);\n\t\t$this -> assertEquals('CONTENT', $json['notifications'][0]['content']);\n\t\t\n\t\t// Test with one notification having additional data\n\t\t$notification -> setDataParameter('DATA_PARAMETER_1', 'DATA_PARAMETER_1_VALUE');\n\t\t$notification -> setDataParameter('DATA_PARAMETER_2', 'DATA_PARAMETER_2_VALUE');\n\t\t$notification -> setDataParameter('DATA_PARAMETER_3', 'DATA_PARAMETER_3_VALUE');\n\t\t\n\t\t$json = $createMessageRequest -> toJSON();\n\t\t$this -> assertCount(4, $json);\n\t\t$this -> assertTrue(array_key_exists('application', $json));\n\t\t$this -> assertTrue(array_key_exists('applicationsGroup', $json));\n\t\t$this -> assertTrue(array_key_exists('auth', $json));\n\t\t$this -> assertTrue(array_key_exists('notifications', $json));\n\t\t$this -> assertEquals('XXXX-XXXX', $json['application']);\n\t\t$this -> assertNull($json['applicationsGroup']);\n\t\t$this -> assertEquals('XXXX', $json['auth']);\n\t\t$this -> assertCount(1, $json['notifications']);\n\t\t$this -> assertCount(4, $json['notifications'][0]);\n\t\t$this -> assertTrue(array_key_exists('send_date', $json['notifications'][0]));\n\t\t$this -> assertTrue($json['notifications'][0]['ignore_user_timezone']);\n\t\t$this -> assertEquals('CONTENT', $json['notifications'][0]['content']);\n\t\t$this -> assertCount(3, $json['notifications'][0]['data']);\n\t\t$this -> assertEquals('DATA_PARAMETER_1_VALUE', $json['notifications'][0]['data']['DATA_PARAMETER_1']);\n\t\t$this -> assertEquals('DATA_PARAMETER_2_VALUE', $json['notifications'][0]['data']['DATA_PARAMETER_2']);\n\t\t$this -> assertEquals('DATA_PARAMETER_3_VALUE', $json['notifications'][0]['data']['DATA_PARAMETER_3']);\n\n\t\t// Test with one notification hacing additional data and devices\n\t\t$notification -> addDevice('DEVICE_TOKEN_1');\n\t\t$notification -> addDevice('DEVICE_TOKEN_2');\n\t\t$notification -> addDevice('DEVICE_TOKEN_3');\n\n\t\t$json = $createMessageRequest -> toJSON();\n\t\t$this -> assertCount(4, $json);\n\t\t$this -> assertTrue(array_key_exists('application', $json));\n\t\t$this -> assertTrue(array_key_exists('applicationsGroup', $json));\n\t\t$this -> assertTrue(array_key_exists('auth', $json));\n\t\t$this -> assertTrue(array_key_exists('notifications', $json));\n\t\t$this -> assertEquals('XXXX-XXXX', $json['application']);\n\t\t$this -> assertNull($json['applicationsGroup']);\n\t\t$this -> assertEquals('XXXX', $json['auth']);\n\t\t$this -> assertCount(1, $json['notifications']);\n\t\t$this -> assertCount(5, $json['notifications'][0]);\n\t\t$this -> assertTrue(array_key_exists('send_date', $json['notifications'][0]));\n\t\t$this -> assertTrue($json['notifications'][0]['ignore_user_timezone']);\n\t\t$this -> assertEquals('CONTENT', $json['notifications'][0]['content']);\n\t\t$this -> assertCount(3, $json['notifications'][0]['data']);\n\t\t$this -> assertEquals('DATA_PARAMETER_1_VALUE', $json['notifications'][0]['data']['DATA_PARAMETER_1']);\n\t\t$this -> assertEquals('DATA_PARAMETER_2_VALUE', $json['notifications'][0]['data']['DATA_PARAMETER_2']);\n\t\t$this -> assertEquals('DATA_PARAMETER_3_VALUE', $json['notifications'][0]['data']['DATA_PARAMETER_3']);\n\t\t$this -> assertCount(3, $json['notifications'][0]['devices']);\n\t\t$this -> assertEquals('DEVICE_TOKEN_1', $json['notifications'][0]['devices'][0]);\n\t\t$this -> assertEquals('DEVICE_TOKEN_2', $json['notifications'][0]['devices'][1]);\n\t\t$this -> assertEquals('DEVICE_TOKEN_3', $json['notifications'][0]['devices'][2]);\n\n\t}", "public function testNewOrderedQueue_contains() {\n\t\t\t$this->assertFalse($this->oq->contains(new stdClass));\n\t\t}", "function setMessage($message, $type, &$array)\n{\n array_push($array, array(\n 'Message' => $message,\n 'Type' => $type\n ));\n}", "public function canAddFieldsToTCATypeAfterExistingOnes() {}", "public function testPostVoicemailMessages()\n {\n }", "public function hasMsg(){\n return $this->_has(18);\n }", "public function testAddContactMessageFailForIncompleteDetails()\n {\n $request = Request::create('/api/contact/message', 'POST', $this->invalidContactor);\n $response = $this->contactController->addContactMessage($request);\n $this->assertEquals(ResponseMessage::INPUT_ERROR, $response->getData()->message);\n $this->assertObjectHasAttribute('name',$response->getData()->data);\n $this->assertObjectHasAttribute('email',$response->getData()->data);\n $this->assertObjectHasAttribute('message',$response->getData()->data);\n $this->assertDatabaseMissing('contacts', $this->invalidContactor);\n }", "public function test_message_can_be_created() {\n\n $this->assertInstanceOf(Message::class, $this->message);\n $this->assertDatabaseHasMessageWithPublicId($this->message->getPublicId());\n\n }", "public function testAddContactMessageSuccessful()\n {\n $request = Request::create('/api/contact/message', 'POST', $this->validContactor);\n $response = $this->contactController->addContactMessage($request);\n $this->assertEquals(ResponseMessage::CONTACT_SUCCESS, $response->getData()->message);\n $this->assertDatabaseHas('contacts', $this->validContactor);\n }", "public function testGetVoicemailQueueMessages()\n {\n }", "public function testExtraObject()\r\n {\r\n $this->_extraTest($this->extra);\r\n }", "protected function validateObject(&$object) {\n // types of objects that people can create. Will expand later.\n $test_array = [ \"Note\" ];\n // make sure it is an accepted ActivityPub object type\n if (!isset($object['type']) || !in_array($object['type'],$test_array)) return false;\n // require all objects to have a declared attribution\n if (!isset($object['attributedTo'])) return false;\n // there needs to be something actually being posted\n if (!isset($object['content'])) return false;\n \n return true;\n }", "public function canAddFieldsToTCATypeBeforeExistingOnes() {}", "public function testCheckRequest(): void\n {\n $this->assertTrue(method_exists($this->stack, 'checkOrder'));\n }", "function add_message($messages){\n global $messages;\n $messages[] = $messages;\n}", "public function checkSubExtObj() {}", "public function hasMessage(): bool\n {\n return $this->hasJson('message');\n }", "public function testGetFlashArray()\n {\n $expected = array('my_test_flash' => 'flash value', \n 'my_other_flash' => 'flash stuff');\n $this->assertEquals($expected, $this->_req->getFlash());\n }", "public function checkExtObj() {}", "public function checkExtObj() {}", "public function testGetValidMessageByListingId(){\n\t\t//create a new message\n\t\t$newMessage =new message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t\t$newMessage->insert($this->getPDO());\n\n\t\t//grab the data from guzzle\n\t\t$response = $this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/' . $newMessage-getMessage());\n\t\t$this->assertSame($response->getStatusCode(),200);\n\t\t$body = $response->getBody();\n\t\t$alertLevel = json_decode ($body);\n\t\t$this->assertSame(200, $alertLevel->status);\n\t}", "public function testAddToQueue()\n {\n $this->setUpDB(['email']);\n \n $Email = new \\EmailTemplate('test');\n \n // Add the message to queue\n $r = $Email->queue('[email protected]', 'test', 'test');\n \n // get data from DB\n $EmailQueue = new \\EmailQueue();\n $filter = ['too' => '[email protected]'];\n $Collection = $EmailQueue->Get($filter, []);\n \n // asserts\n $this->assertEquals(1, $r);\n $this->assertInstanceOf(\\Collection::class, $Collection);\n $this->assertCount(1, $Collection);\n $Item = $Collection->getItem();\n $this->assertInstanceOf(\\SetterGetter::class, $Item);\n $this->assertEquals('test', $Item->getSubject());\n $this->assertEquals('test', $Item->getBody());\n }", "public function testAddToNewsLetterFailForIncompleteDetails()\n {\n $request = Request::create('/api/contact/subscribe', 'POST', $this->invalidSubscriber);\n $response = $this->contactController->addToNewsletter($request);\n $this->assertEquals(ResponseMessage::INPUT_ERROR, $response->getData()->message);\n $this->assertObjectHasAttribute('name',$response->getData()->data);\n $this->assertObjectHasAttribute('email',$response->getData()->data);\n $this->assertDatabaseMissing('newsletter_subscribers', $this->invalidSubscriber);\n }", "public function testPostValidMessage(){\n\t\t//get the count of the numbers of rows in the database\n\t\t$numRows = $this->getConnection()->getRowCount(\"message\");\n\n\t\t//create a new message to send\n\t\t$newMessage = new Message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\n\t\t//run a get request to establish session tokens\n\t\t$this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/');\n\n\t\t//Grab the Data from guzzle and enforce the status match our expectations\n\t\t$response = $this->guzzle->post('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/', ['headers' => ['X-XRF-TOKEN' => $this->getXsrfToken()], 'json' => $newMessage]);\n\t\t$this->assertSame($response->getStatusCode(), 200);\n\t\t$body = $response->getBody();\n\t\t$alertLevel = jason_decode($body);\n\t\t$this->assertSame(200, $alertLevel->status);\n\n\t\t//ensure a new row was added to the database\n\t\t$this->assertSame($numRows + 1, $this->getConnection()->getRowCount(\"message\"));\n\t}", "public function testToArray(): void\n {\n $file = new FileObject();\n $url = new UrlObject();\n $formParameter = new FormParameterObject();\n\n $body = new RequestBodyObject([\n 'disabled' => false,\n 'file' => $file,\n 'form_parameter' => $formParameter,\n 'mode' => 'file',\n 'raw' => 'test-raw',\n 'url' => $url\n ]);\n\n self::assertEquals([\n 'disabled' => false,\n 'file' => $file,\n 'formdata' => $formParameter,\n 'mode' => 'file',\n 'raw' => 'test-raw',\n 'urlencoded' => $url\n ], $body->toArray());\n }", "protected static function addMessage(stdClass $message) {\n $i = PitSession::get('PitFlash', 'i', 1);\n $msgs = PitSession::get('PitFlash', 'messages', array());\n $msgs[$i] = $message;\n PitSession::set('PitFlash', 'i', $i + 1);\n PitSession::set('PitFlash', 'messages', $msgs);\n }", "function _getAnnouncementsEnabled($request) {\n\t\t// must be implemented by sub-classes\n\t\tassert(false);\n\t}", "function dialogue_is_a_conversation(stdClass $message) {\n if ($message->conversationindex == 1) { // Opener always has index of 1.\n return true;\n }\n return false;\n}", "public function canAddFieldsToAllTCATypesAfterExistingOnes() {}", "public function testPutVoicemailMessage()\n {\n }", "function record_message($message) {\n global $messages;\n array_push($messages, $message);\n}", "function bodyAdd($request){\r\n global $context;\r\n $data= new $this->model;\r\n foreach($data->fields as $key=>$field){\r\n if($field['type']!='One2many' && $field['type']!='Many2many' ){\r\n $data->data[$key]=$request->body[$key];\r\n }\r\n }\r\n\r\n if(!$data->insert()){\r\n if($request->isAjax()) return json_error($data->error);\r\n throw new \\Exception($data->error);\r\n }\r\n if($request->isAjax()) return json_success(\"Save Success !!\".$data->error,$data);\r\n\r\n\r\n redirectTo($context->controller_path.\"/all\");\r\n }", "protected function expectAddEvent()\n {\n $this->eventPublisher->expects($this->once())\n ->method('addEvent')\n ->with(['uuid' => '123']);\n }", "public function testCanAdd()\n {\n self::$apcu = [];\n $this->assertTrue($this->sut->add('myKey','myValue'));\n }", "public function testParticipantsMePut()\n {\n }", "public function canAddFieldsToAllTCATypesBeforeExistingOnes() {}", "public function testGetNewInterRequestObject()\n {\n $value = $this->class->get_new_inter_request_object(array());\n\n $this->assertInstanceOf('Lunr\\Corona\\InterRequest', $value);\n }", "public static function putMessage($personOne, $personTwo, $id)\n{ \n $id = ($id != null?'&id=gt.'.$id:\"\");\n\n $respons = Rest::GET('http://caracal.imada.sdu.dk/app2019/messages?sender=in.(\"'.$personOne.'\",\"'.$personTwo.'\")&receiver=in.(\"'.$personOne.'\",\"'.$personTwo.'\")'.$id.'');\n\n\n \n foreach( json_decode($respons) as $respon)\n { \n \n $body = self::getType($respon->body); \n $timestamp = TimeConverter::convert($respon->stamp); \n\n $message = new Message();\n $message->global_id = $respon->id;\n $message->sender = $respon->sender; \n $message->receiver = $respon->receiver; \n $message->type = $body[0];\n $message->body = $body[1];\n $message->created_at = $timestamp;\n $message->updated_at = $timestamp;\n $message->save(); \n }\n}", "public function isEntityFilled(HistoricSmsList $object);", "public static function shouldReceive()\n {\n }", "public static function shouldReceive()\n {\n }", "public static function shouldReceive()\n {\n }", "public static function shouldReceive()\n {\n }", "public static function checkRequest($request)\n {\n $request = json_decode($request);\n\n $isMessaging = isset($request->activities[0]);\n if ($isMessaging && count($request->activities)) {\n return true;\n }\n return false;\n }", "abstract protected function checkExistingResponse();", "public function testMessages()\n {\n $response = $this->json('GET', '/api/messages');\n $response->assertJsonStructure([\n 'messages'=>[\n 'current_page',\n 'data' => [\n [\n 'uid',\n 'sender',\n 'subject',\n 'message',\n 'time_sent',\n 'archived',\n 'read'\n ]\n ],\n 'first_page_url',\n 'from',\n 'last_page',\n 'last_page_url',\n 'next_page_url',\n 'path',\n 'per_page',\n 'prev_page_url',\n 'to',\n 'total'\n ]\n ]);\n }", "public function testAppending()\n {\n $data = new ArrayObject(\n array(\n 'foo' => 'bar'\n )\n );\n\n $data->append('baz');\n }", "public function addMessage($message);", "public function isMultipleObjectsInRequest(Request $request)\n {\n $keys = array_keys($request->request->all());\n if (is_array($keys) && count($keys) >= 1 && $keys[0] === 0) {\n return true;\n }\n return false;\n }", "public function testPayload() {\n $payload = array(\n \"this\" => \"is\",\n \"the\" => \"payload\",\n );\n $response = new Response();\n $response->setPayload($payload);\n $this->assertEquals($payload, $response->payload());\n }", "public function testCanMakeMessageBasic()\n {\n $opt = new TicketCheckEligibilityOptions([\n 'nrOfRequestedPassengers' => 1,\n 'passengers' => [\n new MPPassenger([\n 'type' => MPPassenger::TYPE_ADULT,\n 'count' => 1\n ])\n ],\n 'flightOptions' => [\n TicketCheckEligibilityOptions::FLIGHTOPT_PUBLISHED,\n ],\n 'ticketNumbers' => [\n '1722300000004'\n ]\n ]);\n\n $msg = new CheckEligibility($opt);\n\n $this->assertCount(1, $msg->numberOfUnit->unitNumberDetail);\n $this->assertEquals(1, $msg->numberOfUnit->unitNumberDetail[0]->numberOfUnits);\n $this->assertEquals(UnitNumberDetail::TYPE_PASS, $msg->numberOfUnit->unitNumberDetail[0]->typeOfUnit);\n\n $this->assertCount(1, $msg->paxReference);\n $this->assertCount(1, $msg->paxReference[0]->ptc);\n $this->assertEquals('ADT', $msg->paxReference[0]->ptc[0]);\n $this->assertCount(1, $msg->paxReference[0]->traveller);\n $this->assertEquals(1, $msg->paxReference[0]->traveller[0]->ref);\n $this->assertNull($msg->paxReference[0]->traveller[0]->infantIndicator);\n\n $this->assertCount(1, $msg->fareOptions->pricingTickInfo->pricingTicketing->priceType);\n $this->assertEquals(\n [\n PricingTicketing::PRICETYPE_PUBLISHEDFARES\n ],\n $msg->fareOptions->pricingTickInfo->pricingTicketing->priceType\n );\n\n $this->assertCount(1, $msg->ticketChangeInfo->ticketNumberDetails->documentDetails);\n $this->assertEquals('1722300000004', $msg->ticketChangeInfo->ticketNumberDetails->documentDetails[0]->number);\n $this->assertEmpty($msg->ticketChangeInfo->ticketRequestedSegments);\n\n $this->assertEmpty($msg->combinationFareFamilies);\n $this->assertNull($msg->customerRef);\n $this->assertEmpty($msg->fareFamilies);\n $this->assertEmpty($msg->feeOption);\n $this->assertEmpty($msg->formOfPaymentByPassenger);\n $this->assertNull($msg->globalOptions);\n $this->assertEmpty($msg->itinerary);\n $this->assertEmpty($msg->officeIdDetails);\n $this->assertEmpty($msg->passengerInfoGrp);\n $this->assertNull($msg->priceToBeat);\n $this->assertEmpty($msg->solutionFamily);\n $this->assertEmpty($msg->taxInfo);\n $this->assertNull($msg->travelFlightInfo);\n }", "protected function add_additional_fields_to_object($response_data, $request)\n {\n }", "abstract protected function processMessage(array $data, array $message) : bool;", "static function hasMessage()\n {\n foreach (self::TYPES as $type)\n {\n if (self::has($type)) return true;\n }\n return false;\n }", "public static function addMessage($message, $type){\n if (in_array($type, self::$typesArray)) {\n $_SESSION['flashMessages'][$type][] = $message;\n return true;\n }\n return false;\n }", "public function isNeedToSendPush($user_id);", "public function needsVerificationMessage ();", "public function addMessageAction(){\n if (!$this->_validateFormKey()) return $this->_redirect('inchoo/tickets');\n\n if ($this->getRequest()->isPost()) {\n $ticketId = $this->getRequest()->getPost('ticket_id');\n $message = Mage::getModel('inchoo_tickets/message');\n\n $message->setTicket_id($ticketId)\n ->setMessage($this->getRequest()->getPost('message'))\n ->setAuthor(true); // true=customer\n\n if ($message->validateMessage()) $message->save();\n }\n\n $this->_redirect(\"inchoo/tickets/view/ticket/$ticketId\");\n }", "public function canAddFieldsToTCATypeAndReplaceExistingOnes() {}", "public function willProcessRequest(array $data) {\n }", "protected function addMessage(Request $request) {\n $message = new Message;\n\n $user = Participant::where([['user_id', Auth::user()->id], ['conversation_id', $request->conversation_id]])->first(['id']);\n if ($user == null)\n return ['saved' => false];\n\n $message->conversation_id = $request->conversation_id;\n $message->participant = $user->id;\n $message->body = $request->body;\n\n if ($message->save()) {\n $conversation = Conversation::find($message->conversation_id);\n $conversation->last_message = $message->created_at;\n $conversation->save();\n $message->conversation = $conversation;\n event(new MessageSent($message));\n return ['saved' => $message];\n }\n return ['saved' => false];\n }", "public function testGetVoicemailGroupMessages()\n {\n }", "public function testGetMessageFromKeyIncludingCurrent()\n {\n $storage = ['slimFlash' => [ 'Test' => ['Test', 'Test2']]];\n $flash = new Messages($storage);\n $flash->addMessageNow('Test', 'Test3');\n\n $messages = $flash->getMessages();\n\n $this->assertEquals(['Test', 'Test2','Test3'], $flash->getMessage('Test'));\n }", "public function testMessageCanHaveChildren()\n {\n // Create our topics for testing\n factory(\\App\\Models\\Topic::class, 3)->create();\n factory(\\App\\Models\\Message::class, 50)->create();\n\n $class = App::make(TopicThreadController::class);\n\n // Retrieve a topic to test against\n $topic = \\App\\Models\\Topic::inRandomOrder()->first();\n\n $messages = $class->show($topic);\n\n foreach ($messages as $message) {\n $this->assertArrayHasKey('children', $message);\n }\n }", "public function test_addMessage() {\n\n }", "public function test_a_channel_consists_of_threads()\n {\n $channel=create('App\\Channel');\n $thread=create('App\\Thread',['channel_id' => $channel->id]);\n\n //dd($channel->threads,$thread);\n $this->assertTrue($channel->threads->contains($thread));\n // $reply= factory('App\\Reply')->create();\n\n // $this->assertInstanceOf('App\\User',$reply->owner);\n }", "function messages( $array ) {\n\t\t$this->messages_list = $array;\n\t\t}", "function testMakeNeatArray() {\r\n\t\t$this->Toolbar->makeNeatArray(array(1,2,3));\r\n\t\t$result = $this->firecake->sentHeaders;\r\n\t\t$this->assertTrue(isset($result['X-Wf-1-1-1-1']));\r\n\t\t$this->assertPattern('/\\[1,2,3\\]/', $result['X-Wf-1-1-1-1']);\r\n\t}", "public function check_meta_is_array($value, $request, $param)\n {\n }", "public function testPatchVoicemailMessage()\n {\n }", "function addMessage( $message )\n {\n if ( isset($message['errorMessage']) )\n {\n $this->messages[] = array_merge($this->empty_message,$message);\n } else if ( isset($message[0]) && isset($message[0]['errorMessage']) ) {\n foreach ( $message as $m )\n {\n $this->messages[] = array_merge($this->empty_message,$m);\n }\n }\n }", "function messages_can_edit($hook_name, $entity_type, $return_value, $parameters) {\n\n\tglobal $messagesendflag;\n\n\tif ($messagesendflag == 1) {\n\t\t$entity = $parameters['entity'];\n\t\tif ($entity->getSubtype() == \"messages\") {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn $return_value;\n}", "public function testExistingOfElementInBag()\n {\n $this->populateBag();\n $this->assertTrue($this->bag->has('var1'));\n $this->assertTrue($this->bag->has('var2'));\n $this->assertTrue($this->bag->has('var3'));\n $this->assertFalse($this->bag->has('var 1'));\n $this->assertFalse($this->bag->has('var'));\n $this->assertFalse($this->bag->has('invalid var'));\n }", "public function testAssertResponseContains(): void\n {\n $this->_response = new Response();\n $this->_response = $this->_response->withStringBody('Some content');\n\n $this->assertResponseContains('content');\n }", "public function testOrderedQueueArrayAccess_for() {\n\t\t\t$o = array();\n\n\t\t\t// add objects...\n\t\t\t$this->oq[] = $o[] = new stdClass;\n\t\t\t$this->oq[] = $o[] = new stdClass;\n\t\t\t$this->oq[] = $o[] = new stdClass;\n\t\t\t$this->oq[] = $o[] = new stdClass;\n\n\t\t\t// assertions\n\t\t\tfor($i=0;$i<4;$i++) $this->assertSame($o[$i], $this->oq[$i]);\n\t\t}" ]
[ "0.6665526", "0.64594567", "0.64529735", "0.6079036", "0.6070254", "0.5973639", "0.5946248", "0.59337026", "0.5880742", "0.58527195", "0.5800147", "0.56900245", "0.5651039", "0.5574166", "0.55355936", "0.5487542", "0.5471896", "0.54697937", "0.5463723", "0.53852826", "0.53809035", "0.5347793", "0.5319941", "0.5313613", "0.529255", "0.5281747", "0.5272432", "0.52552456", "0.5248977", "0.5233652", "0.5214259", "0.5212682", "0.52061325", "0.5195943", "0.51900274", "0.51819414", "0.51756096", "0.5170237", "0.51700366", "0.5160994", "0.5157637", "0.5147219", "0.51439905", "0.5140372", "0.5139281", "0.5130993", "0.5119302", "0.51172733", "0.50997436", "0.5098945", "0.5093115", "0.5083752", "0.5070195", "0.50681317", "0.5062699", "0.5061721", "0.50472367", "0.5047159", "0.5042459", "0.50423855", "0.50401163", "0.503757", "0.50256044", "0.50237453", "0.5021486", "0.5021486", "0.5021486", "0.5021486", "0.5019208", "0.5006794", "0.50015223", "0.50004977", "0.4999839", "0.49952894", "0.4993175", "0.49843237", "0.49811733", "0.4976638", "0.4976235", "0.49662864", "0.49600303", "0.49587727", "0.4950072", "0.4937402", "0.4934817", "0.49233663", "0.49232227", "0.4919718", "0.49156368", "0.49149683", "0.49106154", "0.49080497", "0.49045447", "0.4901738", "0.4898538", "0.48983377", "0.48976356", "0.4891288", "0.4881005", "0.4874657" ]
0.6725215
0
Test a string can be added to a message array for the next request
public function testAddMessageFromAnIntegerForNextRequest() { $storage = ['slimFlash' => []]; $flash = new Messages($storage); $flash->addMessage('key', 46); $flash->addMessage('key', 48); $this->assertArrayHasKey('slimFlash', $storage); $this->assertEquals(['46', '48'], $storage['slimFlash']['key']); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testAddMessageFromStringForNextRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $flash->addMessage('key', 'value');\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEquals(['value'], $storage['slimFlash']['key']);\n }", "public function testAddMessageFromArrayForNextRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $formData = [\n 'username' => 'Scooby Doo',\n 'emailAddress' => '[email protected]',\n ];\n\n $flash->addMessage('old', $formData);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEquals($formData, $storage['slimFlash']['old'][0]);\n }", "public function testAddMessageFromStringForCurrentRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $flash->addMessageNow('key', 'value');\n\n $messages = $flash->getMessages();\n $this->assertEquals(['value'], $messages['key']);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEmpty($storage['slimFlash']);\n }", "public function testSetMessagesForNextRequest()\n {\n $storage = [];\n \n $flash = new Messages($storage);\n $flash->addMessage('Test', 'Test');\n $flash->addMessage('Test', 'Test2');\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEquals(['Test', 'Test2'], $storage['slimFlash']['Test']);\n }", "public function testAddMessageFromArrayForCurrentRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $formData = [\n 'username' => 'Scooby Doo',\n 'emailAddress' => '[email protected]',\n ];\n\n $flash->addMessageNow('old', $formData);\n\n $messages = $flash->getMessages();\n $this->assertEquals($formData, $messages['old'][0]);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEmpty($storage['slimFlash']);\n }", "function check_for_querystrings() {\r\n\t\t\tif ( isset( $_REQUEST['message'] ) ) {\r\n\t\t\t\tUM()->shortcodes()->message_mode = true;\r\n\t\t\t}\r\n\t\t}", "function add($message) { return; }", "public function add_request($request='') {\n $request = JsonParser::decode($request);\n if (is_array($request) === false) {\n $request = array($request);\n }\n $this->__requests[] = $request;\n return (true);\n }", "public function add(string $data): bool {}", "public function testAddMessageFromAnIntegerForCurrentRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $flash->addMessageNow('key', 46);\n $flash->addMessageNow('key', 48);\n\n $messages = $flash->getMessages();\n $this->assertEquals(['46','48'], $messages['key']);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEmpty($storage['slimFlash']);\n }", "public function testGetValidMessageByMessageText(){\n\t\t//create a new message\n\t\t$newMessage =new message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t\t$newMessage->insert($this->getPDO());\n\n\t\t//grab the data from guzzle\n\t\t$response = $this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/' . $newMessage-getMessage());\n\t\t$this->assertSame($response->getStatusCode(),200);\n\t\t$body = $response->getBody();\n\t\t$alertLevel = json_decode ($body);\n\t\t$this->assertSame(200, $alertLevel->status);\n\t}", "public function testAddMessageFromObjectForNextRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $user = new \\stdClass();\n $user->name = 'Scooby Doo';\n $user->emailAddress = '[email protected]';\n\n $flash->addMessage('user', $user);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertInstanceOf(\\stdClass::class, $storage['slimFlash']['user'][0]);\n }", "private function correctRequest($msg){\n return array(\"error\" => false,\"msg\" => $msg);\n }", "public function parseRequest($message);", "function getMsg($param) {\n global $msg;\n $msg = \"\";\n $msgCount = 1;\n for($i = 0; $i < strlen('$str'); $i++) {\n if($str[$i] != \"*\" && $msgCount == $param && $activeMsg) {\n $msg .= $str[$i];\n } else if($str[$i] == \"*\") {\n $msgCount++;\n $activeAuthor = true;\n $activeMsg = false;\n } else if($str[$i] == \":\") {\n $activeAuthor = false;\n $activeMsg = true;\n }\n }\n }", "abstract protected function processMessage(array $data, array $message) : bool;", "public function match($message);", "function add_message($msg, $msg_type = MSG_TYPE_SUCCESS) {\n if (!isset($_SESSION['message']))\n $_SESSION['message'] = [];\n $_SESSION['message'][] = ['type' => $msg_type, 'message' => htmlentities($msg, ENT_QUOTES)];\n}", "public function testAddWithMultipleMessages()\n {\n Phlash::add(\"info\", \"Please log in to continue\");\n Phlash::add(\"error\", \"There was a problem processing your request\");\n\n $flashMessages = Phlash::get();\n\n $this->assertNotEmpty($flashMessages);\n $this->assertEquals(count($flashMessages), 2);\n $this->assertEquals($flashMessages[0]->id, 0);\n $this->assertEquals($flashMessages[0]->type, \"info\");\n $this->assertEquals($flashMessages[0]->message, \"Please log in to continue\");\n $this->assertEquals($flashMessages[1]->id, 1);\n $this->assertEquals($flashMessages[1]->type, \"error\");\n $this->assertEquals($flashMessages[1]->message, \"There was a problem processing your request\");\n\n Phlash::clear();\n }", "function processReqString ($req) {\r\n\r\n\t$question = explode(\"|\", $req);\r\n\tif(sizeof($req) ==0 ) {\r\n\t\techo 'error: The provided string is incorrect';\r\n\t\treturn null;\r\n\t}\r\n\t$arr = array_map(\"splitQuestions\", $question);\r\n\treturn $arr;\r\n\r\n\r\n}", "public static function addMessage($message, $type){\n if (in_array($type, self::$typesArray)) {\n $_SESSION['flashMessages'][$type][] = $message;\n return true;\n }\n return false;\n }", "public function add_message( $string, $error = false ) {\n\t\tif ( $error ) {\n\t\t\t$this->admin_error[] = (string) $string;\n\t\t} else {\n\t\t\t$this->admin_message[] = (string) $string;\n\t\t}\n\t}", "function isValid(&$inMessage = '');", "protected abstract function _message();", "private function checkResponse ($string) {\n if (substr($string, 0, 3) !== '+OK') {\n $this->error = array(\n 'error' => \"Server reported an error: $string\",\n 'errno' => 0,\n 'errstr' => ''\n );\n\n if ($this->do_debug >= 1) {\n $this->displayErrors();\n }\n\n return false;\n } else {\n return true;\n }\n\n }", "function setMessage($message, $type, &$array)\n{\n array_push($array, array(\n 'Message' => $message,\n 'Type' => $type\n ));\n}", "function add_message($messages){\n global $messages;\n $messages[] = $messages;\n}", "function addMessage( $message )\n {\n if ( isset($message['errorMessage']) )\n {\n $this->messages[] = array_merge($this->empty_message,$message);\n } else if ( isset($message[0]) && isset($message[0]['errorMessage']) ) {\n foreach ( $message as $m )\n {\n $this->messages[] = array_merge($this->empty_message,$m);\n }\n }\n }", "function checkSerializedMessage($message, $label, $expectedString)\n{\n if ($message->serializeToJsonString() === $expectedString) {\n print(\"Got expected output for $label: $expectedString\\n\");\n } else {\n print(\"Output of $label does not match expected value.\\n\" .\n \"\\tExpected: $expected\\n\" .\n \"\\tGot: \" . $message->serializeToJsonString() . PHP_EOL);\n }\n}", "public function isSent() {}", "public function testAddString() {\n $head = Head::getInstance();\n $head->add('Invalid head string');\n }", "function imap_test($imap_stream, $string) {\n print \"<tr><td>\".sm_encode_html_special_chars($string).\"</td></tr>\";\n $response = sqimap_run_command_list($imap_stream, trim($string),false, $responses, $message,false);\n array_push($response, $responses . ' ' .$message);\n return $response;\n}", "function get_request_contains($request_url,$search_string) {\n //get the current url\n $string = $search_string;\n $url = $request_url;\n //~ echo $request_url;\n //check for string in url\n $lookup = strpos($url, $string);\n\n\n //If string is found, set the value of found_context\n if($lookup > 1 || $lookup !== false) {\n //~ echo 'is_component request';\n return true;\n }\n\n //If not found, set UNSET the value of found_context\n else {\n //~ echo 'is_not component request';\n return false; \n }\n}", "function array_contains_part_of_string ($string, $array) {\n\tforeach ($array as $value) {\n\t\t//if (strstr($string, $url)) { // mine version\n\t\tif (strpos($string, $value) !== FALSE) { // Yoshi version\n\t\t\treturn true;\n\t\t\tbreak;\n\t\t\t\n\t\t}\n\t}\n return false;\n\t\n}", "function filterRequest($msg){\n if(isset($_GET['type'])){\n $type = $_GET['type'];\n\n // Verify data type\n if($type == 'data'){\n handleDataRequest($msg);\n }else if($type == 'multiple'){\n handleMultipleData($msg);\n }else if($type == 'station'){\n handleStationsRequest($msg);\n }else{\n $msg->message = 'Requested type not existing!';\n $msg->toJson();\n }\n }else{\n $msg->message = 'Type not set!';\n $msg->toJson();\n }\n}", "public function addMessage($message);", "public function testGetInvalidMessageByMessageText(){\n\t\t//create a new message\n\t\t$newMessage =new message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t\t$newMessage->insert($this->getPDO());\n\n\t\t//grab the data from guzzle\n\t\t$response = $this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/' . $newMessage-getMessage());\n\t\t$this->assertSame($response->getStatusCode(),200);\n\t\t$body = $response->getBody();\n\t\t$alertLevel = json_decode ($body);\n\t\t$this->assertSame(200, $alertLevel->status);\n\t}", "public function vxMessageCreateCheck() {\n\t\t$rt = array();\n\t\t\n\t\t$rt['errors'] = 0;\n\t\t\n\t\t$rt['msg_receivers_value'] = '';\n\t\t/* receivers: raw */\n\t\t$rt['msg_receivers_a'] = array();\n\t\t/* receivers: validated */\n\t\t$rt['msg_receivers_v'] = array();\n\t\t/* receivers: validated names */\n\t\t$rt['msg_receivers_n'] = array();\n\t\t/* msg_receivers_error:\n\t\t0 => no error\n\t\t1 => empty\n\t\t2 => not exist\n\t\t999 => unspecific */\n\t\t$rt['msg_receivers_error'] = 0;\n\t\t$rt['msg_receivers_error_msg'] = array(1 => '你忘记写收件人了', 2 => '你写的一位或多位收件人不存在');\n\t\t\n\t\tif (isset($_POST['msg_receivers'])) {\n\t\t\t$rt['msg_receivers_value'] = make_single_safe($_POST['msg_receivers']);\n\t\t\tif (strlen($rt['msg_receivers_value']) > 0) {\n\t\t\t\t$rt['msg_receivers_a'] = explode(',', $rt['msg_receivers_value']);\n\t\t\t\tforeach ($rt['msg_receivers_a'] as $msg_receiver) {\n\t\t\t\t\t$msg_receiver = trim($msg_receiver);\n\t\t\t\t\t$sql = \"SELECT usr_id, usr_nick FROM babel_user WHERE usr_nick = '{$msg_receiver}'\";\n\t\t\t\t\t$rs = mysql_query($sql, $this->db);\n\t\t\t\t\tif (mysql_num_rows($rs) == 1) {\n\t\t\t\t\t\t$User = mysql_fetch_object($rs);\n\t\t\t\t\t\tmysql_free_result($rs);\n\t\t\t\t\t\tif ($User->usr_id != $this->User->usr_id) {\n\t\t\t\t\t\t\tif (!in_array($User->usr_id, $rt['msg_receivers_v'])) {\n\t\t\t\t\t\t\t\t$rt['msg_receivers_v'][] = $User->usr_id;\n\t\t\t\t\t\t\t\t$rt['msg_receivers_n'][] = $User->usr_nick;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmysql_free_result($rs);\n\t\t\t\t\t\t$rt['msg_receivers_error'] = 2;\n\t\t\t\t\t\t$rt['errors']++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ($rt['msg_receivers_error'] == 0) {\n\t\t\t\t\tif (count($rt['msg_receivers_v']) == 0) {\n\t\t\t\t\t\t$rt['msg_receivers_value'] = '';\n\t\t\t\t\t\t$rt['msg_receivers_error'] = 1;\n\t\t\t\t\t\t$rt['errors']++;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$rt['msg_receivers_value'] = implode(',', $rt['msg_receivers_n']);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$rt['msg_receivers_error'] = 1;\n\t\t\t\t$rt['errors']++;\n\t\t\t}\n\t\t} else {\n\t\t\t$rt['msg_receivers_error'] = 1;\n\t\t\t$rt['errors']++;\n\t\t}\n\t\t\n\t\t$rt['msg_body_value'] = '';\n\t\t$rt['msg_body_error'] = 0;\n\t\t$rt['msg_body_error_msg'] = array(1 => '你忘记写消息内容了', 2 => '你写的消息内容超出长度限制了');\n\t\t\n\t\tif (isset($_POST['msg_body'])) {\n\t\t\t$rt['msg_body_value'] = make_multi_safe($_POST['msg_body']);\n\t\t\t$rt['msg_body_length'] = mb_strlen($rt['msg_body_value'], 'UTF-8');\n\t\t\tif ($rt['msg_body_length'] > 0) {\n\t\t\t\tif ($rt['msg_body_length'] > 200) {\n\t\t\t\t\t$rt['msg_body_error'] = 2;\n\t\t\t\t\t$rt['errors']++;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$rt['msg_body_error'] = 1;\n\t\t\t\t$rt['errors']++;\n\t\t\t}\n\t\t} else {\n\t\t\t$rt['msg_body_error'] = 1;\n\t\t\t$rt['errors']++;\n\t\t}\n\t\t\n\t\treturn $rt;\n\t}", "function record_message($message) {\n global $messages;\n array_push($messages, $message);\n}", "public function testGetMessagesFromPrevRequest()\n {\n $storage = ['slimFlash' => ['Test']];\n $flash = new Messages($storage);\n\n $this->assertEquals(['Test'], $flash->getMessages());\n }", "public function needsVerificationMessage ();", "public function setMessage ($msg, $clearPrevious = false) {\n\t\n\t\tif ($msg != \"\") {\n\t\t\n\t\t\t// convert it to an array\n\t\t\tif (!is_array($msg)) {\n\t\t\t\t$msg = array($msg);\n\t\t\t}\n\t\t\t\n\t\t\t// should we reset it first?\n\t\t\tif ($clearPrevious) {\n\t\t\t\t$this->message = \"\";\n\t\t\t}\n\t\t\t\n\t\t\t// loop through elements\n\t\t\tforeach ($msg as $str) {\n\t\t\t\n\t\t\t\tif (is_array($this->message)) {\n\t\t\t\t\t$this->message[] = $str;\n\t\t\t\t} elseif ($this->message != \"\") {\n\t\t\t\t\t$this->message = array($this->message, $str);\n\t\t\t\t} else {\n\t\t\t\t\t$this->message = $str;\n\t\t\t\t}\n\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\treturn true;\n\t\t\n\t\t}\n\t\t\n\t\treturn false;\n\t\n\t}", "public function testPostVoicemailMessages()\n {\n }", "public function messageProvider()\n {\n return [[\"a string\"]];\n }", "public function hasMsg(){\n return $this->_has(18);\n }", "public function testGetMessageFromKeyIncludingCurrent()\n {\n $storage = ['slimFlash' => [ 'Test' => ['Test', 'Test2']]];\n $flash = new Messages($storage);\n $flash->addMessageNow('Test', 'Test3');\n\n $messages = $flash->getMessages();\n\n $this->assertEquals(['Test', 'Test2','Test3'], $flash->getMessage('Test'));\n }", "public function getNextMessage(){\r\n }", "public function hasMultiBytes($str)\n {\n }", "function cis_login_message($msg) {\n\tglobal $cis_login_message;\n\t$cis_login_message[] = $msg;\n}", "public function testPostValidMessage(){\n\t\t//get the count of the numbers of rows in the database\n\t\t$numRows = $this->getConnection()->getRowCount(\"message\");\n\n\t\t//create a new message to send\n\t\t$newMessage = new Message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\n\t\t//run a get request to establish session tokens\n\t\t$this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/');\n\n\t\t//Grab the Data from guzzle and enforce the status match our expectations\n\t\t$response = $this->guzzle->post('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/', ['headers' => ['X-XRF-TOKEN' => $this->getXsrfToken()], 'json' => $newMessage]);\n\t\t$this->assertSame($response->getStatusCode(), 200);\n\t\t$body = $response->getBody();\n\t\t$alertLevel = jason_decode($body);\n\t\t$this->assertSame(200, $alertLevel->status);\n\n\t\t//ensure a new row was added to the database\n\t\t$this->assertSame($numRows + 1, $this->getConnection()->getRowCount(\"message\"));\n\t}", "private function check_message ()\n\t{\t\tif (isset($_SESSION['message']))\n\t\t{\n\t\t\t// Add it as an attribute and erase the stored version\n\t\t\t$this->message = $_SESSION['message'];\n\t\t\tunset($_SESSION['message']);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->message = \"\";\n\t\t}\n\t}", "abstract protected function checkExistingResponse();", "public function hasMessage(): bool\n {\n return $this->hasJson('message');\n }", "public function testValidationByKeynameAddl()\n {\n $init = 'test';\n $str = new \\Pv\\PString($init);\n $str->addValidation('length[1]', 'test1');\n\n $valid = $str->getValidation();\n $this->assertTrue(isset($valid['test1']));\n }", "function addCheckLog($message){\n global $checkLogQ;\n $length = 4;\n // If checkLogQ size is smaller than 4 add the message\n if(count($checkLogQ)<$length){\n $checkLogQ[] = $message;\n }\n // If checkLogQ size is bigger than 4 - Remove the oldest message and add the new one\n else{\n array_shift($checkLogQ);\n $checkLogQ[] = $message;\n }\n }", "public function testAddMessage()\n {\n $message1 = new Hostingcheck_Message('Foo message');\n $result = new Hostingcheck_Result_Info();\n $result->addMessage($message1);\n $this->assertEquals(array($message1), $result->messages());\n\n $message2 = new Hostingcheck_Message('Bar message');\n $result->addMessage($message2);\n $this->assertEquals(array($message1, $message2), $result->messages());\n\n $this->assertTrue($result->hasMessages());\n }", "protected abstract function addString($string);", "public function testGetFlashArray()\n {\n $expected = array('my_test_flash' => 'flash value', \n 'my_other_flash' => 'flash stuff');\n $this->assertEquals($expected, $this->_req->getFlash());\n }", "public function getEventadd($messages = \"\");", "final protected function addLog(string $string) : bool\n {\n $return = call_user_func($this->logger, $string);\n return $return;\n }", "function verifyKey($msg){\n\n // TODO: check if this key is in the database!\n if(isset($_GET['key'])){\n $apiKey = $_GET['key'];\n $userid = $_GET['userid'];\n\n if($apiKey == getApiKey($userid)){\n // Fillter on datatype\n filterRequest($msg);\n }else{\n $msg->message = 'Invalid key!';\n $msg->toJson();\n }\n }else{\n $msg->message = 'Key not set!';\n $msg->toJson();\n }\n}", "private function validate_strings(array &$string_arr) {\n foreach ($string_arr as $string) {\n if (self::getChar($string, 0) !== '-' || \n self::testArgExists($string) === false ||\n self::testSubArg($string) === false) {\n trigger_error(\"Malformed string $string found via\n validate_strings.\");\n }\n }\n }", "function processMessage($message) {\n $message_id = $message['message_id'];\n $chat_id = $message['chat']['id'];\n if (isset($message['text'])) {\n \n $text = $message['text'];//texto recebido na mensagem\n if (strpos($text, \"/start\") === 0) {\n\t\t//envia a mensagem ao usuário\n sendMessage(\"sendMessage\", array('chat_id' => $chat_id, \"text\" => 'Olá, '. $message['from']['first_name'].\n\t\t'! Eu sou um bot que informa a previsao do tempo na sua cidade?', 'reply_markup' => array(\n 'keyboard' => array(array('São Paulo', 'Porto Alegre'),array('Curitiba','Florianópolis')),\n 'one_time_keyboard' => true)));\n } else if ($text === \"São Paulo\") {\n sendMessage(\"sendMessage\", array('chat_id' => $chat_id, \"text\" => getWeather($text)));\n } else if ($text === \"Porto Alegre\") {\n sendMessage(\"sendMessage\", array('chat_id' => $chat_id, \"text\" => getWeather($text)));\n } else if ($text === \"Florianópolis\") {\n sendMessage(\"sendMessage\", array('chat_id' => $chat_id, \"text\" => getWeather($text)));\n } else if ($text === \"Curitiba\") {\n sendMessage(\"sendMessage\", array('chat_id' => $chat_id, \"text\" => getWeather( $text)));\n } else {\n sendMessage(\"sendMessage\", array('chat_id' => $chat_id, \"text\" => 'Desculpe, mas não entendi essa mensagem. :('));\n }\n } else {\n sendMessage(\"sendMessage\", array('chat_id' => $chat_id, \"text\" => 'Desculpe, mas só compreendo mensagens em texto'));\n }\n}", "public function testSetMessagesForCurrentRequest()\n {\n $storage = ['slimFlash' => [ 'error' => ['An error']]];\n\n $flash = new Messages($storage);\n $flash->addMessageNow('error', 'Another error');\n $flash->addMessageNow('success', 'A success');\n $flash->addMessageNow('info', 'An info');\n\n $messages = $flash->getMessages();\n $this->assertEquals(['An error', 'Another error'], $messages['error']);\n $this->assertEquals(['A success'], $messages['success']);\n $this->assertEquals(['An info'], $messages['info']);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEmpty([], $storage['slimFlash']);\n }", "public function test_array_returns_false_when_optional_and_input_string() {\n\t\t$optional = true;\n\n\t\t$result = self::$validator->validate( 'string val', $optional );\n\t\t$this->assertFalse( $result );\n\t}", "function buddyexpressdesk_message($message = null, $register = \"buddyexpressdesk-message-success\", $count = false) {\n\tif (!isset($_SESSION['bdesk_messages'])) {\n\t\t$_SESSION['bdesk_messages'] = array();\n\t}\n\tif (!isset($_SESSION['bdesk_messages'][$register]) && !empty($register)) {\n\t\t$_SESSION['bdesk_messages'][$register][time()] = array();\n\t}\n\tif (!$count) {\n\t\tif (!empty($message) && is_array($message)) {\n\t\t\t$_SESSION['bdesk_messages'][$register][time()] = array_merge($_SESSION['bdesk_messages'][$register], $message);\n\t\t\treturn true;\n\t\t} else if (!empty($message) && is_string($message)) {\n\t\t\t$_SESSION['bdesk_messages'][$register][time()][] = $message;\n\t\t\treturn true;\n\t\t} else if (is_null($message)) {\n\t\t\tif ($register != \"\") {\n\t\t\t\t$returnarray = array();\n\t\t\t\t$returnarray[$register] = $_SESSION['bdesk_messages'][$register][time()];\n\t\t\t\t$_SESSION['bdesk_messages'][$register][time()] = array();\n\t\t\t} else {\n\t\t\t\t$returnarray = $_SESSION['bdesk_messages'];\n\t\t\t\t$_SESSION['bdesk_messages'] = array();\n\t\t\t}\n\t\t\treturn $returnarray;\n\t\t}\n\t} else {\n\t\tif (!empty($register)) {\n\t\t\treturn sizeof($_SESSION['bdesk_messages'][$register][time()]);\n\t\t} else {\n\t\t\t$count = 0;\n\t\t\tforeach ($_SESSION['bdesk_messages'] as $submessages) {\n\t\t\t\t$count += sizeof($submessages);\n\t\t\t}\n\t\t\treturn $count;\n\t\t}\n\t}\n\treturn false; \n}", "function add_success(&$log, $message){\n if(!is_array($log)) return;\n\n $log[] = array(\n \"type\" => \"success\",\n \"message\" => $message\n );\n}", "public function testPutValidMessage () {\n\n\t\t//create a new message\n\t\t$newMessage = new Message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t\t$newMessage->insert($this->getPDO());\n\n\t\t//run a get request to establish session tokens\n\t\t$this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/');\n\n\t\t//grab the data from guzzle and enforce the status match our expectations\n\t\t$response = $this->guzzle->put('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/' . $newMessage->getMessage(),['headers' => ['X-XRF-TOKEN' => $this->getXsrfToken()], 'json' => $newMessage] );\n\t\t$this->assertSame($response->getStatusCode(), 200);\n\t\t$body = $response->getBpdy();\n\t\t$alertLevel = json_decode($body);\n\t\t$this->assertSame(200, $alertLevel->status);\n\n\t}", "abstract public function get_message();", "public function testAddMessageFromObjectForCurrentRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $user = new \\stdClass();\n $user->name = 'Scooby Doo';\n $user->emailAddress = '[email protected]';\n\n $flash->addMessageNow('user', $user);\n\n $messages = $flash->getMessages();\n $this->assertInstanceOf(\\stdClass::class, $messages['user'][0]);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEmpty($storage['slimFlash']);\n }", "function addMessage($txt = \"\"){\t$this->mMessages\t.= $txt;\t}", "private function check_message(){\t\t\tif(isset($_SESSION['message'])){\r\n\t\t\t\t// Add it as an attribute and erase the stored version\r\n\t\t\t\t\r\n\t\t\t\t$this->message = $_SESSION['message'];\r\n\t\t\t\tunset($_SESSION['message']);\r\n\t\t\t}else{\r\n\t\t\t\t$this->message=\"\";\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t\r\n\t\t}", "function is_ok()\n\t{\n\t\t$this->message = $this->sock_read();\n\n\t\tif($this->message == \"\" || preg_match('/^5/',$this->message) )\n\t\t{\n\t\t\treturn 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn 1;\n\t\t}\n\t}", "static function hasMessage()\n {\n foreach (self::TYPES as $type)\n {\n if (self::has($type)) return true;\n }\n return false;\n }", "function messages( $array ) {\n\t\t$this->messages_list = $array;\n\t\t}", "static function assertStringStartsWith($prefix, $string, $message = '')\n {\n try {\n return call_user_func_array('PHPUnit_Framework_Assert::assertStringStartsWith', func_get_args());\n } catch (\\Exception $e) {\n self::callSlack($e, debug_backtrace()[1]);\n }\n }", "public function messagefrom($usercheck)\n {\n \t\n\n }", "public function match(Message $message);", "public function testMessage()\r\n {\r\n\r\n $this->flash->message(\"testMessage\");\r\n $this->assertEquals(\"testMessage\", $_SESSION[\"flash\"][\"messages\"][\"message\"][0]);\r\n\r\n }", "function addString($string_to_add){\n\t\tsettype($string_to_add,\"string\");\n\t\tif(strlen($string_to_add)>0){\n\t\t\t$this->_Items[] = new StringBufferItem($string_to_add);\n\t\t}\n\t}", "public function test_array_returns_false_when_not_optional_and_input_string() {\n\t\t$optional = false;\n\n\t\t$result = self::$validator->validate( 'string val', $optional );\n\t\t$this->assertFalse( $result );\n\t}", "function pms_check_request_args_success_messages() {\r\n\r\n if( !isset($_REQUEST) )\r\n return;\r\n\r\n // If there is a success message in the request add it directly\r\n if( isset( $_REQUEST['pmsscscd'] ) && isset( $_REQUEST['pmsscsmsg'] ) ) {\r\n\r\n $message_code = esc_attr( base64_decode( trim($_REQUEST['pmsscscd']) ) );\r\n $message = esc_attr( base64_decode( trim($_REQUEST['pmsscsmsg']) ) );\r\n\r\n pms_success()->add( $message_code, $message );\r\n\r\n // If there is no message, but the code is present check to see for a gateway action present\r\n // and add messages\r\n } elseif( isset( $_REQUEST['pmsscscd'] ) && !isset( $_REQUEST['pmsscsmsg'] ) ) {\r\n\r\n $message_code = esc_attr( base64_decode( trim($_REQUEST['pmsscscd']) ) );\r\n\r\n if( !isset( $_REQUEST['pms_gateway_payment_action'] ) )\r\n return;\r\n\r\n $payment_action = esc_attr( base64_decode( trim( $_REQUEST['pms_gateway_payment_action'] ) ) );\r\n\r\n if( isset( $_REQUEST['pms_gateway_payment_id'] ) ) {\r\n\r\n $payment_id = esc_attr( base64_decode( trim( $_REQUEST['pms_gateway_payment_id'] ) ) );\r\n $payment = pms_get_payment( $payment_id );\r\n\r\n // If status of the payment is completed add a success message\r\n if( $payment->status == 'completed' ) {\r\n\r\n if( $payment_action == 'upgrade_subscription' )\r\n pms_success()->add( $message_code, apply_filters( 'pms_message_gateway_payment_action', __( 'Congratulations, you have successfully upgraded your subscription.', 'paid-member-subscriptions' ), $payment->status, $payment_action, $payment ) );\r\n\r\n elseif( $payment_action == 'renew_subscription' )\r\n pms_success()->add( $message_code, apply_filters( 'pms_message_gateway_payment_action', __( 'Congratulations, you have successfully renewed your subscription.', 'paid-member-subscriptions' ), $payment->status, $payment_action, $payment ) );\r\n\r\n elseif( $payment_action == 'new_subscription' )\r\n pms_success()->add( $message_code, apply_filters( 'pms_message_gateway_payment_action', __( 'Congratulations, you have successfully subscribed to our website.', 'paid-member-subscriptions' ), $payment->status, $payment_action, $payment ) );\r\n\r\n elseif( $payment_action == 'retry_payment' )\r\n pms_success()->add( $message_code, apply_filters( 'pms_message_gateway_payment_action', __( 'Congratulations, you have successfully subscribed to our website.', 'paid-member-subscriptions' ), $payment->status, $payment_action, $payment ) );\r\n\r\n } elseif( $payment->status == 'pending' ) {\r\n\r\n if( $payment_action == 'upgrade_subscription' )\r\n pms_success()->add( $message_code, apply_filters( 'pms_message_gateway_payment_action', __( 'Thank you for your payment. The upgrade may take a while to be processed.', 'paid-member-subscriptions' ), $payment->status, $payment_action, $payment ) );\r\n\r\n elseif( $payment_action == 'renew_subscription' )\r\n pms_success()->add( $message_code, apply_filters( 'pms_message_gateway_payment_action', __( 'Thank you for your payment. The renew may take a while to be processed.', 'paid-member-subscriptions' ), $payment->status, $payment_action, $payment ) );\r\n\r\n elseif( $payment_action == 'new_subscription' )\r\n pms_success()->add( $message_code, apply_filters( 'pms_message_gateway_payment_action', __( 'Thank you for your payment. The subscription may take a while to get activated.', 'paid-member-subscriptions' ), $payment->status, $payment_action, $payment ) );\r\n\r\n elseif( $payment_action == 'retry_payment' )\r\n pms_success()->add( $message_code, apply_filters( 'pms_message_gateway_payment_action', __( 'Thank you for your payment. The subscription may take a while to get activated.', 'paid-member-subscriptions' ), $payment->status, $payment_action, $payment ) );\r\n\r\n }\r\n\r\n }\r\n\r\n }\r\n\r\n }", "protected function prepareMessage() {\n //Initialize $message\n $message = '';\n //loop through $this->_storage array\n foreach ($this->_storage as $key => $value) {\n // if it has no value, assign 'Not provided' \n $value = (empty($value)) ? 'Not provided' : $value;\n // if an array, expand as comma-separated string \n if (is_array($value)) {\n $value = implode(', ', $value);\n }\n // replace underscores and hyphens in the label with spaces \n $key = str_replace(array('_', '-'), ' ', $key);\n // add label and value to the message body. Uppercase first letter\n $message .=ucfirst($key) . \": $value\\r\\n\\r\\n\";\n }\n // limit line length to 70 characters \n $this->_body = wordwrap($message, 70);\n }", "protected function has($string)\n {\n if (stripos($this->message, $string) !== false) {\n return true;\n }\n return false;\n }", "function CheckError($str)\n{\n\tif (strpos($str, 'myclubapi-error') !== false) \n\t{\n\t\treturn true;\n\t}\n\treturn false;\n}", "static function checkTweetMessage($message) {\n if(strlen($message) <= 140) {\n return true;\n }\n return false;\n }", "public function parseRequest(): bool;", "public function testGetVoicemailQueueMessages()\n {\n }", "function server_parse($socket, $expected_response)\n{\n $server_response = '';\n $counter = 0;\n while (substr($server_response, 3, 1) != ' ') {\n if (!($server_response = fgets($socket, 256))) {\n $counter++;\n if ($counter % 100 == 0) {\n echo json_encode([\"message\" => \"Error fetching response from server $expected_response\"]);\n sleep(1);\n }\n }\n }\n if (!(substr($server_response, 0, 3) == $expected_response)) {\n echo json_encode([\"message\" => 'Unable to send e-mail.\"' . $server_response . '\"' . \" $expected_response\"]);\n }\n}", "function sample_spam_check(&$string, &$name, &$email, &$url, &$ip)\n{\n $words = array('boob', 'titty', 'teenage', 'viagra');\n foreach ( $words as $word )\n {\n if ( stristr($string, $word) )\n return false;\n }\n // This name always means trouble.\n if ( $name == 'Pojo' )\n return false;\n // Block hotmail e-mail addresses\n if ( preg_match('/@hotmail\\.com$/', $email) )\n return false;\n // Check URL for bad words\n foreach ( $words as $word )\n {\n if ( stristr($url, $word) )\n return false;\n }\n // block IPs\n if ( $ip == '127.0.1.1') \n return false;\n \n // Always return true if all checks pass!\n return true;\n}", "public function testGetMessageFromKey()\n {\n $storage = ['slimFlash' => [ 'Test' => ['Test', 'Test2']]];\n $flash = new Messages($storage);\n\n $this->assertEquals(['Test', 'Test2'], $flash->getMessage('Test'));\n }", "function on_message($message){\n\t\t\t$text = strtolower($message['text']);\n\t\t\tif($text == 'play'){\t\t\t\t\n\t\t\t\t$messages = $this->generateQuestion();\n\t\t\t}else{\n\t\t\t\t//--check answer\n\t\t\t\tif($text == $this->session->get('gl_answer')){\n\t\t\t\t\t$this->session->set('gl_answer_count', $this->session->get('gl_answer_count') + 1);\n\t\t\t\t\t$messages[] = 'Correct!';\n\t\t\t\t\t$messages[] = array('type' => 'template',\n\t\t\t\t\t\t\t\t\t\t 'altText' => 'confirm play again',\n\t\t\t\t\t\t\t\t\t\t 'template'=> array(\n\t\t\t\t\t\t\t\t\t\t\t 'type'=> 'confirm',\n\t\t\t\t\t\t\t\t\t\t\t 'text'=> 'Play again?',\n\t\t\t\t\t\t\t\t\t\t\t 'actions'=> array(\n\t\t\t\t\t\t\t\t\t\t\t\t\tarray('type'=> 'message','label'=> 'Yes','text'=> 'play'),\n\t\t\t\t\t\t\t\t\t\t\t\t\tarray('type'=> 'message','label'=> 'No','text'=> 'no')\n\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t}else if($text == 'no'){\n\t\t\t\t\t$messages[] = 'Thanks!';\n\t\t\t\t}else{\n\t\t\t\t\t$messages = array(\n\t\t\t\t\t\t\t\t\t'Wrong!',\n\t\t\t\t\t\t\t\t\t'The answer is \\'' . $this->session->get('gl_answer') . '\\'',\n\t\t\t\t\t\t\t\t\tarray('type' => 'template',\n\t\t\t\t\t\t\t\t\t\t 'altText' => 'confirm play again',\n\t\t\t\t\t\t\t\t\t\t 'template'=> array(\n\t\t\t\t\t\t\t\t\t\t\t 'type'=> 'confirm',\n\t\t\t\t\t\t\t\t\t\t\t 'text'=> 'Play again?',\n\t\t\t\t\t\t\t\t\t\t\t 'actions'=> array(\n\t\t\t\t\t\t\t\t\t\t\t\t\tarray('type'=> 'message','label'=> 'Yes','text'=> 'play'),\n\t\t\t\t\t\t\t\t\t\t\t\t\tarray('type'=> 'message','label'=> 'No','text'=> 'no')\n\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn $messages;\n\t\t}", "public function testGetEmptyMessagesFromPrevRequest()\n {\n $storage = [];\n $flash = new Messages($storage);\n\n $this->assertEquals([], $flash->getMessages());\n }", "private function validPayload()\n {\n return [\n 'name' => 'Chefaa pharmacy',\n 'address' => 'Maadi',\n ];\n }", "public function get_message_strings() {\n foreach($this->messages as $singleMessage) {\n \n }\n }", "function appendErrorMsg($string){\n\t\t$this->error[$this->errorIndex] = $string;\n\t\t$this->errorIndex++;\n\t}", "function processMessageIn($message) {\n\t\t$service = $message->getKeyword();\n\t\t$keyword = $message->getKeyword(2);\n\n\t\tswitch ($keyword) {\n\t\t\tcase \"get\":\n\t\t\t\t$this->addSubscriber($message);\n\t\t\tbreak;\n\t\t\tcase \"yes\":\n\t\t\t\t$this->confirmSubscriber($message);\n\t\t\tbreak;\n\t\t\tcase \"cancel\":\n\t\t\tcase \"quit\":\n\t\t\tcase \"end\":\n\t\t\tcase \"unsubscribe\":\n\t\t\tcase \"stop\":\n\t\t\t\t$this->removeSubscriber($message);\n\t\t\tbreak;\n\t\t\tcase \"#\":\n\t\t\t\t$this->processMessageOut($message, null);\n\t\t\tbreak;\n\t\t\tcase \"#uk\":\n\t\t\t\t$this->processMessageOut($message, \"UK\");\n\t\t\tbreak;\n\t\t\tcase \"#us\":\n\t\t\t\t$this->processMessageOut($message, \"US\");\n\t\t\tbreak;\n\t\t\tcase \"status\":\n\t\t\t\t$this->statusCheck($message, $service);\n\t\t\tbreak;\n\t\t}\n\n\t}", "protected function addMessage(string $message, $type = self::MESSAGE_INFO) {\n\t\t$this->messages[$type][] = $message;\n\t}", "function string_has_params($string) {\n if (strpos($string, $this->parse['before']) !== false) {\n if (strpos($string, $this->parse['after']) !== false) {\n return strpos($string, $this->parse['after']) >\n strpos($string, $this->parse['before']);\n }\n }\n\n return false;\n }", "function messages_send($count = 5){\n\t\tfor($i=0;$i<$count;$i++)\n\t\t{\n\t\t\t$element = vazco_newsletter::queuePop('not_sent');\n\t\t\tif($element!==null)\n\t\t\t{\n\t\t\t\t$result = vazco_newsletter::sendMessage($element[0],$element[1]);\n\t\t\t\tif($result)\n\t\t\t\t\tvazco_newsletter::queuePush($element,'sent');\n\t\t\t\telse\n\t\t\t\t\tvazco_newsletter::queuePush($element,'error');\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}" ]
[ "0.67779756", "0.6181242", "0.60967505", "0.59550196", "0.55518717", "0.55506116", "0.55387914", "0.54971635", "0.5314417", "0.5313701", "0.5247339", "0.5245324", "0.5236326", "0.52271664", "0.5214837", "0.51714796", "0.51436853", "0.51412094", "0.51286983", "0.5112833", "0.5104797", "0.51023173", "0.50869465", "0.50855356", "0.50451064", "0.5042164", "0.50206316", "0.5019159", "0.5011995", "0.5009682", "0.5005703", "0.49999937", "0.49800578", "0.49756652", "0.49634245", "0.49404392", "0.49300882", "0.4922669", "0.49130243", "0.49079263", "0.48919627", "0.48726478", "0.48718128", "0.4865182", "0.4862783", "0.4838038", "0.48231977", "0.4822765", "0.48193622", "0.48141557", "0.48070338", "0.47977796", "0.4792657", "0.47925448", "0.4786905", "0.4771293", "0.47711533", "0.47683027", "0.47666985", "0.47556415", "0.47504947", "0.47502133", "0.4745341", "0.4736473", "0.47331", "0.47329113", "0.47328448", "0.4731605", "0.471995", "0.47193453", "0.47185427", "0.47178903", "0.4717661", "0.47150132", "0.47148353", "0.47133762", "0.4707025", "0.47035474", "0.47014692", "0.46949238", "0.4694696", "0.46820727", "0.4670223", "0.46697488", "0.4659668", "0.46541", "0.46533036", "0.46524596", "0.4649769", "0.46489644", "0.46473223", "0.46469092", "0.46460098", "0.46453482", "0.46411985", "0.46408233", "0.4639278", "0.463832", "0.46335334", "0.46324015" ]
0.5774627
4
Test a string can be added to a message array for the next request
public function testAddMessageFromStringForNextRequest() { $storage = ['slimFlash' => []]; $flash = new Messages($storage); $flash->addMessage('key', 'value'); $this->assertArrayHasKey('slimFlash', $storage); $this->assertEquals(['value'], $storage['slimFlash']['key']); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testAddMessageFromArrayForNextRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $formData = [\n 'username' => 'Scooby Doo',\n 'emailAddress' => '[email protected]',\n ];\n\n $flash->addMessage('old', $formData);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEquals($formData, $storage['slimFlash']['old'][0]);\n }", "public function testAddMessageFromStringForCurrentRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $flash->addMessageNow('key', 'value');\n\n $messages = $flash->getMessages();\n $this->assertEquals(['value'], $messages['key']);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEmpty($storage['slimFlash']);\n }", "public function testSetMessagesForNextRequest()\n {\n $storage = [];\n \n $flash = new Messages($storage);\n $flash->addMessage('Test', 'Test');\n $flash->addMessage('Test', 'Test2');\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEquals(['Test', 'Test2'], $storage['slimFlash']['Test']);\n }", "public function testAddMessageFromAnIntegerForNextRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $flash->addMessage('key', 46);\n $flash->addMessage('key', 48);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEquals(['46', '48'], $storage['slimFlash']['key']);\n }", "public function testAddMessageFromArrayForCurrentRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $formData = [\n 'username' => 'Scooby Doo',\n 'emailAddress' => '[email protected]',\n ];\n\n $flash->addMessageNow('old', $formData);\n\n $messages = $flash->getMessages();\n $this->assertEquals($formData, $messages['old'][0]);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEmpty($storage['slimFlash']);\n }", "function check_for_querystrings() {\r\n\t\t\tif ( isset( $_REQUEST['message'] ) ) {\r\n\t\t\t\tUM()->shortcodes()->message_mode = true;\r\n\t\t\t}\r\n\t\t}", "function add($message) { return; }", "public function add_request($request='') {\n $request = JsonParser::decode($request);\n if (is_array($request) === false) {\n $request = array($request);\n }\n $this->__requests[] = $request;\n return (true);\n }", "public function add(string $data): bool {}", "public function testAddMessageFromAnIntegerForCurrentRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $flash->addMessageNow('key', 46);\n $flash->addMessageNow('key', 48);\n\n $messages = $flash->getMessages();\n $this->assertEquals(['46','48'], $messages['key']);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEmpty($storage['slimFlash']);\n }", "public function testGetValidMessageByMessageText(){\n\t\t//create a new message\n\t\t$newMessage =new message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t\t$newMessage->insert($this->getPDO());\n\n\t\t//grab the data from guzzle\n\t\t$response = $this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/' . $newMessage-getMessage());\n\t\t$this->assertSame($response->getStatusCode(),200);\n\t\t$body = $response->getBody();\n\t\t$alertLevel = json_decode ($body);\n\t\t$this->assertSame(200, $alertLevel->status);\n\t}", "public function testAddMessageFromObjectForNextRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $user = new \\stdClass();\n $user->name = 'Scooby Doo';\n $user->emailAddress = '[email protected]';\n\n $flash->addMessage('user', $user);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertInstanceOf(\\stdClass::class, $storage['slimFlash']['user'][0]);\n }", "private function correctRequest($msg){\n return array(\"error\" => false,\"msg\" => $msg);\n }", "public function parseRequest($message);", "function getMsg($param) {\n global $msg;\n $msg = \"\";\n $msgCount = 1;\n for($i = 0; $i < strlen('$str'); $i++) {\n if($str[$i] != \"*\" && $msgCount == $param && $activeMsg) {\n $msg .= $str[$i];\n } else if($str[$i] == \"*\") {\n $msgCount++;\n $activeAuthor = true;\n $activeMsg = false;\n } else if($str[$i] == \":\") {\n $activeAuthor = false;\n $activeMsg = true;\n }\n }\n }", "abstract protected function processMessage(array $data, array $message) : bool;", "public function match($message);", "function add_message($msg, $msg_type = MSG_TYPE_SUCCESS) {\n if (!isset($_SESSION['message']))\n $_SESSION['message'] = [];\n $_SESSION['message'][] = ['type' => $msg_type, 'message' => htmlentities($msg, ENT_QUOTES)];\n}", "public function testAddWithMultipleMessages()\n {\n Phlash::add(\"info\", \"Please log in to continue\");\n Phlash::add(\"error\", \"There was a problem processing your request\");\n\n $flashMessages = Phlash::get();\n\n $this->assertNotEmpty($flashMessages);\n $this->assertEquals(count($flashMessages), 2);\n $this->assertEquals($flashMessages[0]->id, 0);\n $this->assertEquals($flashMessages[0]->type, \"info\");\n $this->assertEquals($flashMessages[0]->message, \"Please log in to continue\");\n $this->assertEquals($flashMessages[1]->id, 1);\n $this->assertEquals($flashMessages[1]->type, \"error\");\n $this->assertEquals($flashMessages[1]->message, \"There was a problem processing your request\");\n\n Phlash::clear();\n }", "function processReqString ($req) {\r\n\r\n\t$question = explode(\"|\", $req);\r\n\tif(sizeof($req) ==0 ) {\r\n\t\techo 'error: The provided string is incorrect';\r\n\t\treturn null;\r\n\t}\r\n\t$arr = array_map(\"splitQuestions\", $question);\r\n\treturn $arr;\r\n\r\n\r\n}", "public static function addMessage($message, $type){\n if (in_array($type, self::$typesArray)) {\n $_SESSION['flashMessages'][$type][] = $message;\n return true;\n }\n return false;\n }", "public function add_message( $string, $error = false ) {\n\t\tif ( $error ) {\n\t\t\t$this->admin_error[] = (string) $string;\n\t\t} else {\n\t\t\t$this->admin_message[] = (string) $string;\n\t\t}\n\t}", "function isValid(&$inMessage = '');", "protected abstract function _message();", "function setMessage($message, $type, &$array)\n{\n array_push($array, array(\n 'Message' => $message,\n 'Type' => $type\n ));\n}", "private function checkResponse ($string) {\n if (substr($string, 0, 3) !== '+OK') {\n $this->error = array(\n 'error' => \"Server reported an error: $string\",\n 'errno' => 0,\n 'errstr' => ''\n );\n\n if ($this->do_debug >= 1) {\n $this->displayErrors();\n }\n\n return false;\n } else {\n return true;\n }\n\n }", "function add_message($messages){\n global $messages;\n $messages[] = $messages;\n}", "function addMessage( $message )\n {\n if ( isset($message['errorMessage']) )\n {\n $this->messages[] = array_merge($this->empty_message,$message);\n } else if ( isset($message[0]) && isset($message[0]['errorMessage']) ) {\n foreach ( $message as $m )\n {\n $this->messages[] = array_merge($this->empty_message,$m);\n }\n }\n }", "function checkSerializedMessage($message, $label, $expectedString)\n{\n if ($message->serializeToJsonString() === $expectedString) {\n print(\"Got expected output for $label: $expectedString\\n\");\n } else {\n print(\"Output of $label does not match expected value.\\n\" .\n \"\\tExpected: $expected\\n\" .\n \"\\tGot: \" . $message->serializeToJsonString() . PHP_EOL);\n }\n}", "public function isSent() {}", "public function testAddString() {\n $head = Head::getInstance();\n $head->add('Invalid head string');\n }", "function imap_test($imap_stream, $string) {\n print \"<tr><td>\".sm_encode_html_special_chars($string).\"</td></tr>\";\n $response = sqimap_run_command_list($imap_stream, trim($string),false, $responses, $message,false);\n array_push($response, $responses . ' ' .$message);\n return $response;\n}", "function get_request_contains($request_url,$search_string) {\n //get the current url\n $string = $search_string;\n $url = $request_url;\n //~ echo $request_url;\n //check for string in url\n $lookup = strpos($url, $string);\n\n\n //If string is found, set the value of found_context\n if($lookup > 1 || $lookup !== false) {\n //~ echo 'is_component request';\n return true;\n }\n\n //If not found, set UNSET the value of found_context\n else {\n //~ echo 'is_not component request';\n return false; \n }\n}", "function array_contains_part_of_string ($string, $array) {\n\tforeach ($array as $value) {\n\t\t//if (strstr($string, $url)) { // mine version\n\t\tif (strpos($string, $value) !== FALSE) { // Yoshi version\n\t\t\treturn true;\n\t\t\tbreak;\n\t\t\t\n\t\t}\n\t}\n return false;\n\t\n}", "function filterRequest($msg){\n if(isset($_GET['type'])){\n $type = $_GET['type'];\n\n // Verify data type\n if($type == 'data'){\n handleDataRequest($msg);\n }else if($type == 'multiple'){\n handleMultipleData($msg);\n }else if($type == 'station'){\n handleStationsRequest($msg);\n }else{\n $msg->message = 'Requested type not existing!';\n $msg->toJson();\n }\n }else{\n $msg->message = 'Type not set!';\n $msg->toJson();\n }\n}", "public function addMessage($message);", "public function testGetInvalidMessageByMessageText(){\n\t\t//create a new message\n\t\t$newMessage =new message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t\t$newMessage->insert($this->getPDO());\n\n\t\t//grab the data from guzzle\n\t\t$response = $this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/' . $newMessage-getMessage());\n\t\t$this->assertSame($response->getStatusCode(),200);\n\t\t$body = $response->getBody();\n\t\t$alertLevel = json_decode ($body);\n\t\t$this->assertSame(200, $alertLevel->status);\n\t}", "public function vxMessageCreateCheck() {\n\t\t$rt = array();\n\t\t\n\t\t$rt['errors'] = 0;\n\t\t\n\t\t$rt['msg_receivers_value'] = '';\n\t\t/* receivers: raw */\n\t\t$rt['msg_receivers_a'] = array();\n\t\t/* receivers: validated */\n\t\t$rt['msg_receivers_v'] = array();\n\t\t/* receivers: validated names */\n\t\t$rt['msg_receivers_n'] = array();\n\t\t/* msg_receivers_error:\n\t\t0 => no error\n\t\t1 => empty\n\t\t2 => not exist\n\t\t999 => unspecific */\n\t\t$rt['msg_receivers_error'] = 0;\n\t\t$rt['msg_receivers_error_msg'] = array(1 => '你忘记写收件人了', 2 => '你写的一位或多位收件人不存在');\n\t\t\n\t\tif (isset($_POST['msg_receivers'])) {\n\t\t\t$rt['msg_receivers_value'] = make_single_safe($_POST['msg_receivers']);\n\t\t\tif (strlen($rt['msg_receivers_value']) > 0) {\n\t\t\t\t$rt['msg_receivers_a'] = explode(',', $rt['msg_receivers_value']);\n\t\t\t\tforeach ($rt['msg_receivers_a'] as $msg_receiver) {\n\t\t\t\t\t$msg_receiver = trim($msg_receiver);\n\t\t\t\t\t$sql = \"SELECT usr_id, usr_nick FROM babel_user WHERE usr_nick = '{$msg_receiver}'\";\n\t\t\t\t\t$rs = mysql_query($sql, $this->db);\n\t\t\t\t\tif (mysql_num_rows($rs) == 1) {\n\t\t\t\t\t\t$User = mysql_fetch_object($rs);\n\t\t\t\t\t\tmysql_free_result($rs);\n\t\t\t\t\t\tif ($User->usr_id != $this->User->usr_id) {\n\t\t\t\t\t\t\tif (!in_array($User->usr_id, $rt['msg_receivers_v'])) {\n\t\t\t\t\t\t\t\t$rt['msg_receivers_v'][] = $User->usr_id;\n\t\t\t\t\t\t\t\t$rt['msg_receivers_n'][] = $User->usr_nick;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmysql_free_result($rs);\n\t\t\t\t\t\t$rt['msg_receivers_error'] = 2;\n\t\t\t\t\t\t$rt['errors']++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ($rt['msg_receivers_error'] == 0) {\n\t\t\t\t\tif (count($rt['msg_receivers_v']) == 0) {\n\t\t\t\t\t\t$rt['msg_receivers_value'] = '';\n\t\t\t\t\t\t$rt['msg_receivers_error'] = 1;\n\t\t\t\t\t\t$rt['errors']++;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$rt['msg_receivers_value'] = implode(',', $rt['msg_receivers_n']);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$rt['msg_receivers_error'] = 1;\n\t\t\t\t$rt['errors']++;\n\t\t\t}\n\t\t} else {\n\t\t\t$rt['msg_receivers_error'] = 1;\n\t\t\t$rt['errors']++;\n\t\t}\n\t\t\n\t\t$rt['msg_body_value'] = '';\n\t\t$rt['msg_body_error'] = 0;\n\t\t$rt['msg_body_error_msg'] = array(1 => '你忘记写消息内容了', 2 => '你写的消息内容超出长度限制了');\n\t\t\n\t\tif (isset($_POST['msg_body'])) {\n\t\t\t$rt['msg_body_value'] = make_multi_safe($_POST['msg_body']);\n\t\t\t$rt['msg_body_length'] = mb_strlen($rt['msg_body_value'], 'UTF-8');\n\t\t\tif ($rt['msg_body_length'] > 0) {\n\t\t\t\tif ($rt['msg_body_length'] > 200) {\n\t\t\t\t\t$rt['msg_body_error'] = 2;\n\t\t\t\t\t$rt['errors']++;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$rt['msg_body_error'] = 1;\n\t\t\t\t$rt['errors']++;\n\t\t\t}\n\t\t} else {\n\t\t\t$rt['msg_body_error'] = 1;\n\t\t\t$rt['errors']++;\n\t\t}\n\t\t\n\t\treturn $rt;\n\t}", "function record_message($message) {\n global $messages;\n array_push($messages, $message);\n}", "public function testGetMessagesFromPrevRequest()\n {\n $storage = ['slimFlash' => ['Test']];\n $flash = new Messages($storage);\n\n $this->assertEquals(['Test'], $flash->getMessages());\n }", "public function needsVerificationMessage ();", "public function setMessage ($msg, $clearPrevious = false) {\n\t\n\t\tif ($msg != \"\") {\n\t\t\n\t\t\t// convert it to an array\n\t\t\tif (!is_array($msg)) {\n\t\t\t\t$msg = array($msg);\n\t\t\t}\n\t\t\t\n\t\t\t// should we reset it first?\n\t\t\tif ($clearPrevious) {\n\t\t\t\t$this->message = \"\";\n\t\t\t}\n\t\t\t\n\t\t\t// loop through elements\n\t\t\tforeach ($msg as $str) {\n\t\t\t\n\t\t\t\tif (is_array($this->message)) {\n\t\t\t\t\t$this->message[] = $str;\n\t\t\t\t} elseif ($this->message != \"\") {\n\t\t\t\t\t$this->message = array($this->message, $str);\n\t\t\t\t} else {\n\t\t\t\t\t$this->message = $str;\n\t\t\t\t}\n\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\treturn true;\n\t\t\n\t\t}\n\t\t\n\t\treturn false;\n\t\n\t}", "public function testPostVoicemailMessages()\n {\n }", "public function messageProvider()\n {\n return [[\"a string\"]];\n }", "public function hasMsg(){\n return $this->_has(18);\n }", "public function testGetMessageFromKeyIncludingCurrent()\n {\n $storage = ['slimFlash' => [ 'Test' => ['Test', 'Test2']]];\n $flash = new Messages($storage);\n $flash->addMessageNow('Test', 'Test3');\n\n $messages = $flash->getMessages();\n\n $this->assertEquals(['Test', 'Test2','Test3'], $flash->getMessage('Test'));\n }", "public function getNextMessage(){\r\n }", "public function hasMultiBytes($str)\n {\n }", "function cis_login_message($msg) {\n\tglobal $cis_login_message;\n\t$cis_login_message[] = $msg;\n}", "public function testPostValidMessage(){\n\t\t//get the count of the numbers of rows in the database\n\t\t$numRows = $this->getConnection()->getRowCount(\"message\");\n\n\t\t//create a new message to send\n\t\t$newMessage = new Message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\n\t\t//run a get request to establish session tokens\n\t\t$this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/');\n\n\t\t//Grab the Data from guzzle and enforce the status match our expectations\n\t\t$response = $this->guzzle->post('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/', ['headers' => ['X-XRF-TOKEN' => $this->getXsrfToken()], 'json' => $newMessage]);\n\t\t$this->assertSame($response->getStatusCode(), 200);\n\t\t$body = $response->getBody();\n\t\t$alertLevel = jason_decode($body);\n\t\t$this->assertSame(200, $alertLevel->status);\n\n\t\t//ensure a new row was added to the database\n\t\t$this->assertSame($numRows + 1, $this->getConnection()->getRowCount(\"message\"));\n\t}", "private function check_message ()\n\t{\t\tif (isset($_SESSION['message']))\n\t\t{\n\t\t\t// Add it as an attribute and erase the stored version\n\t\t\t$this->message = $_SESSION['message'];\n\t\t\tunset($_SESSION['message']);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->message = \"\";\n\t\t}\n\t}", "abstract protected function checkExistingResponse();", "public function testValidationByKeynameAddl()\n {\n $init = 'test';\n $str = new \\Pv\\PString($init);\n $str->addValidation('length[1]', 'test1');\n\n $valid = $str->getValidation();\n $this->assertTrue(isset($valid['test1']));\n }", "public function hasMessage(): bool\n {\n return $this->hasJson('message');\n }", "function addCheckLog($message){\n global $checkLogQ;\n $length = 4;\n // If checkLogQ size is smaller than 4 add the message\n if(count($checkLogQ)<$length){\n $checkLogQ[] = $message;\n }\n // If checkLogQ size is bigger than 4 - Remove the oldest message and add the new one\n else{\n array_shift($checkLogQ);\n $checkLogQ[] = $message;\n }\n }", "public function testAddMessage()\n {\n $message1 = new Hostingcheck_Message('Foo message');\n $result = new Hostingcheck_Result_Info();\n $result->addMessage($message1);\n $this->assertEquals(array($message1), $result->messages());\n\n $message2 = new Hostingcheck_Message('Bar message');\n $result->addMessage($message2);\n $this->assertEquals(array($message1, $message2), $result->messages());\n\n $this->assertTrue($result->hasMessages());\n }", "protected abstract function addString($string);", "public function getEventadd($messages = \"\");", "public function testGetFlashArray()\n {\n $expected = array('my_test_flash' => 'flash value', \n 'my_other_flash' => 'flash stuff');\n $this->assertEquals($expected, $this->_req->getFlash());\n }", "final protected function addLog(string $string) : bool\n {\n $return = call_user_func($this->logger, $string);\n return $return;\n }", "private function validate_strings(array &$string_arr) {\n foreach ($string_arr as $string) {\n if (self::getChar($string, 0) !== '-' || \n self::testArgExists($string) === false ||\n self::testSubArg($string) === false) {\n trigger_error(\"Malformed string $string found via\n validate_strings.\");\n }\n }\n }", "function verifyKey($msg){\n\n // TODO: check if this key is in the database!\n if(isset($_GET['key'])){\n $apiKey = $_GET['key'];\n $userid = $_GET['userid'];\n\n if($apiKey == getApiKey($userid)){\n // Fillter on datatype\n filterRequest($msg);\n }else{\n $msg->message = 'Invalid key!';\n $msg->toJson();\n }\n }else{\n $msg->message = 'Key not set!';\n $msg->toJson();\n }\n}", "function processMessage($message) {\n $message_id = $message['message_id'];\n $chat_id = $message['chat']['id'];\n if (isset($message['text'])) {\n \n $text = $message['text'];//texto recebido na mensagem\n if (strpos($text, \"/start\") === 0) {\n\t\t//envia a mensagem ao usuário\n sendMessage(\"sendMessage\", array('chat_id' => $chat_id, \"text\" => 'Olá, '. $message['from']['first_name'].\n\t\t'! Eu sou um bot que informa a previsao do tempo na sua cidade?', 'reply_markup' => array(\n 'keyboard' => array(array('São Paulo', 'Porto Alegre'),array('Curitiba','Florianópolis')),\n 'one_time_keyboard' => true)));\n } else if ($text === \"São Paulo\") {\n sendMessage(\"sendMessage\", array('chat_id' => $chat_id, \"text\" => getWeather($text)));\n } else if ($text === \"Porto Alegre\") {\n sendMessage(\"sendMessage\", array('chat_id' => $chat_id, \"text\" => getWeather($text)));\n } else if ($text === \"Florianópolis\") {\n sendMessage(\"sendMessage\", array('chat_id' => $chat_id, \"text\" => getWeather($text)));\n } else if ($text === \"Curitiba\") {\n sendMessage(\"sendMessage\", array('chat_id' => $chat_id, \"text\" => getWeather( $text)));\n } else {\n sendMessage(\"sendMessage\", array('chat_id' => $chat_id, \"text\" => 'Desculpe, mas não entendi essa mensagem. :('));\n }\n } else {\n sendMessage(\"sendMessage\", array('chat_id' => $chat_id, \"text\" => 'Desculpe, mas só compreendo mensagens em texto'));\n }\n}", "public function testSetMessagesForCurrentRequest()\n {\n $storage = ['slimFlash' => [ 'error' => ['An error']]];\n\n $flash = new Messages($storage);\n $flash->addMessageNow('error', 'Another error');\n $flash->addMessageNow('success', 'A success');\n $flash->addMessageNow('info', 'An info');\n\n $messages = $flash->getMessages();\n $this->assertEquals(['An error', 'Another error'], $messages['error']);\n $this->assertEquals(['A success'], $messages['success']);\n $this->assertEquals(['An info'], $messages['info']);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEmpty([], $storage['slimFlash']);\n }", "function add_success(&$log, $message){\n if(!is_array($log)) return;\n\n $log[] = array(\n \"type\" => \"success\",\n \"message\" => $message\n );\n}", "function buddyexpressdesk_message($message = null, $register = \"buddyexpressdesk-message-success\", $count = false) {\n\tif (!isset($_SESSION['bdesk_messages'])) {\n\t\t$_SESSION['bdesk_messages'] = array();\n\t}\n\tif (!isset($_SESSION['bdesk_messages'][$register]) && !empty($register)) {\n\t\t$_SESSION['bdesk_messages'][$register][time()] = array();\n\t}\n\tif (!$count) {\n\t\tif (!empty($message) && is_array($message)) {\n\t\t\t$_SESSION['bdesk_messages'][$register][time()] = array_merge($_SESSION['bdesk_messages'][$register], $message);\n\t\t\treturn true;\n\t\t} else if (!empty($message) && is_string($message)) {\n\t\t\t$_SESSION['bdesk_messages'][$register][time()][] = $message;\n\t\t\treturn true;\n\t\t} else if (is_null($message)) {\n\t\t\tif ($register != \"\") {\n\t\t\t\t$returnarray = array();\n\t\t\t\t$returnarray[$register] = $_SESSION['bdesk_messages'][$register][time()];\n\t\t\t\t$_SESSION['bdesk_messages'][$register][time()] = array();\n\t\t\t} else {\n\t\t\t\t$returnarray = $_SESSION['bdesk_messages'];\n\t\t\t\t$_SESSION['bdesk_messages'] = array();\n\t\t\t}\n\t\t\treturn $returnarray;\n\t\t}\n\t} else {\n\t\tif (!empty($register)) {\n\t\t\treturn sizeof($_SESSION['bdesk_messages'][$register][time()]);\n\t\t} else {\n\t\t\t$count = 0;\n\t\t\tforeach ($_SESSION['bdesk_messages'] as $submessages) {\n\t\t\t\t$count += sizeof($submessages);\n\t\t\t}\n\t\t\treturn $count;\n\t\t}\n\t}\n\treturn false; \n}", "public function test_array_returns_false_when_optional_and_input_string() {\n\t\t$optional = true;\n\n\t\t$result = self::$validator->validate( 'string val', $optional );\n\t\t$this->assertFalse( $result );\n\t}", "public function testPutValidMessage () {\n\n\t\t//create a new message\n\t\t$newMessage = new Message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t\t$newMessage->insert($this->getPDO());\n\n\t\t//run a get request to establish session tokens\n\t\t$this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/');\n\n\t\t//grab the data from guzzle and enforce the status match our expectations\n\t\t$response = $this->guzzle->put('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/' . $newMessage->getMessage(),['headers' => ['X-XRF-TOKEN' => $this->getXsrfToken()], 'json' => $newMessage] );\n\t\t$this->assertSame($response->getStatusCode(), 200);\n\t\t$body = $response->getBpdy();\n\t\t$alertLevel = json_decode($body);\n\t\t$this->assertSame(200, $alertLevel->status);\n\n\t}", "function addMessage($txt = \"\"){\t$this->mMessages\t.= $txt;\t}", "abstract public function get_message();", "public function testAddMessageFromObjectForCurrentRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $user = new \\stdClass();\n $user->name = 'Scooby Doo';\n $user->emailAddress = '[email protected]';\n\n $flash->addMessageNow('user', $user);\n\n $messages = $flash->getMessages();\n $this->assertInstanceOf(\\stdClass::class, $messages['user'][0]);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEmpty($storage['slimFlash']);\n }", "private function check_message(){\t\t\tif(isset($_SESSION['message'])){\r\n\t\t\t\t// Add it as an attribute and erase the stored version\r\n\t\t\t\t\r\n\t\t\t\t$this->message = $_SESSION['message'];\r\n\t\t\t\tunset($_SESSION['message']);\r\n\t\t\t}else{\r\n\t\t\t\t$this->message=\"\";\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t\r\n\t\t}", "function messages( $array ) {\n\t\t$this->messages_list = $array;\n\t\t}", "function is_ok()\n\t{\n\t\t$this->message = $this->sock_read();\n\n\t\tif($this->message == \"\" || preg_match('/^5/',$this->message) )\n\t\t{\n\t\t\treturn 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn 1;\n\t\t}\n\t}", "static function hasMessage()\n {\n foreach (self::TYPES as $type)\n {\n if (self::has($type)) return true;\n }\n return false;\n }", "static function assertStringStartsWith($prefix, $string, $message = '')\n {\n try {\n return call_user_func_array('PHPUnit_Framework_Assert::assertStringStartsWith', func_get_args());\n } catch (\\Exception $e) {\n self::callSlack($e, debug_backtrace()[1]);\n }\n }", "public function messagefrom($usercheck)\n {\n \t\n\n }", "public function match(Message $message);", "public function testMessage()\r\n {\r\n\r\n $this->flash->message(\"testMessage\");\r\n $this->assertEquals(\"testMessage\", $_SESSION[\"flash\"][\"messages\"][\"message\"][0]);\r\n\r\n }", "function addString($string_to_add){\n\t\tsettype($string_to_add,\"string\");\n\t\tif(strlen($string_to_add)>0){\n\t\t\t$this->_Items[] = new StringBufferItem($string_to_add);\n\t\t}\n\t}", "public function test_array_returns_false_when_not_optional_and_input_string() {\n\t\t$optional = false;\n\n\t\t$result = self::$validator->validate( 'string val', $optional );\n\t\t$this->assertFalse( $result );\n\t}", "function pms_check_request_args_success_messages() {\r\n\r\n if( !isset($_REQUEST) )\r\n return;\r\n\r\n // If there is a success message in the request add it directly\r\n if( isset( $_REQUEST['pmsscscd'] ) && isset( $_REQUEST['pmsscsmsg'] ) ) {\r\n\r\n $message_code = esc_attr( base64_decode( trim($_REQUEST['pmsscscd']) ) );\r\n $message = esc_attr( base64_decode( trim($_REQUEST['pmsscsmsg']) ) );\r\n\r\n pms_success()->add( $message_code, $message );\r\n\r\n // If there is no message, but the code is present check to see for a gateway action present\r\n // and add messages\r\n } elseif( isset( $_REQUEST['pmsscscd'] ) && !isset( $_REQUEST['pmsscsmsg'] ) ) {\r\n\r\n $message_code = esc_attr( base64_decode( trim($_REQUEST['pmsscscd']) ) );\r\n\r\n if( !isset( $_REQUEST['pms_gateway_payment_action'] ) )\r\n return;\r\n\r\n $payment_action = esc_attr( base64_decode( trim( $_REQUEST['pms_gateway_payment_action'] ) ) );\r\n\r\n if( isset( $_REQUEST['pms_gateway_payment_id'] ) ) {\r\n\r\n $payment_id = esc_attr( base64_decode( trim( $_REQUEST['pms_gateway_payment_id'] ) ) );\r\n $payment = pms_get_payment( $payment_id );\r\n\r\n // If status of the payment is completed add a success message\r\n if( $payment->status == 'completed' ) {\r\n\r\n if( $payment_action == 'upgrade_subscription' )\r\n pms_success()->add( $message_code, apply_filters( 'pms_message_gateway_payment_action', __( 'Congratulations, you have successfully upgraded your subscription.', 'paid-member-subscriptions' ), $payment->status, $payment_action, $payment ) );\r\n\r\n elseif( $payment_action == 'renew_subscription' )\r\n pms_success()->add( $message_code, apply_filters( 'pms_message_gateway_payment_action', __( 'Congratulations, you have successfully renewed your subscription.', 'paid-member-subscriptions' ), $payment->status, $payment_action, $payment ) );\r\n\r\n elseif( $payment_action == 'new_subscription' )\r\n pms_success()->add( $message_code, apply_filters( 'pms_message_gateway_payment_action', __( 'Congratulations, you have successfully subscribed to our website.', 'paid-member-subscriptions' ), $payment->status, $payment_action, $payment ) );\r\n\r\n elseif( $payment_action == 'retry_payment' )\r\n pms_success()->add( $message_code, apply_filters( 'pms_message_gateway_payment_action', __( 'Congratulations, you have successfully subscribed to our website.', 'paid-member-subscriptions' ), $payment->status, $payment_action, $payment ) );\r\n\r\n } elseif( $payment->status == 'pending' ) {\r\n\r\n if( $payment_action == 'upgrade_subscription' )\r\n pms_success()->add( $message_code, apply_filters( 'pms_message_gateway_payment_action', __( 'Thank you for your payment. The upgrade may take a while to be processed.', 'paid-member-subscriptions' ), $payment->status, $payment_action, $payment ) );\r\n\r\n elseif( $payment_action == 'renew_subscription' )\r\n pms_success()->add( $message_code, apply_filters( 'pms_message_gateway_payment_action', __( 'Thank you for your payment. The renew may take a while to be processed.', 'paid-member-subscriptions' ), $payment->status, $payment_action, $payment ) );\r\n\r\n elseif( $payment_action == 'new_subscription' )\r\n pms_success()->add( $message_code, apply_filters( 'pms_message_gateway_payment_action', __( 'Thank you for your payment. The subscription may take a while to get activated.', 'paid-member-subscriptions' ), $payment->status, $payment_action, $payment ) );\r\n\r\n elseif( $payment_action == 'retry_payment' )\r\n pms_success()->add( $message_code, apply_filters( 'pms_message_gateway_payment_action', __( 'Thank you for your payment. The subscription may take a while to get activated.', 'paid-member-subscriptions' ), $payment->status, $payment_action, $payment ) );\r\n\r\n }\r\n\r\n }\r\n\r\n }\r\n\r\n }", "protected function prepareMessage() {\n //Initialize $message\n $message = '';\n //loop through $this->_storage array\n foreach ($this->_storage as $key => $value) {\n // if it has no value, assign 'Not provided' \n $value = (empty($value)) ? 'Not provided' : $value;\n // if an array, expand as comma-separated string \n if (is_array($value)) {\n $value = implode(', ', $value);\n }\n // replace underscores and hyphens in the label with spaces \n $key = str_replace(array('_', '-'), ' ', $key);\n // add label and value to the message body. Uppercase first letter\n $message .=ucfirst($key) . \": $value\\r\\n\\r\\n\";\n }\n // limit line length to 70 characters \n $this->_body = wordwrap($message, 70);\n }", "protected function has($string)\n {\n if (stripos($this->message, $string) !== false) {\n return true;\n }\n return false;\n }", "function CheckError($str)\n{\n\tif (strpos($str, 'myclubapi-error') !== false) \n\t{\n\t\treturn true;\n\t}\n\treturn false;\n}", "public function testGetVoicemailQueueMessages()\n {\n }", "static function checkTweetMessage($message) {\n if(strlen($message) <= 140) {\n return true;\n }\n return false;\n }", "public function parseRequest(): bool;", "function server_parse($socket, $expected_response)\n{\n $server_response = '';\n $counter = 0;\n while (substr($server_response, 3, 1) != ' ') {\n if (!($server_response = fgets($socket, 256))) {\n $counter++;\n if ($counter % 100 == 0) {\n echo json_encode([\"message\" => \"Error fetching response from server $expected_response\"]);\n sleep(1);\n }\n }\n }\n if (!(substr($server_response, 0, 3) == $expected_response)) {\n echo json_encode([\"message\" => 'Unable to send e-mail.\"' . $server_response . '\"' . \" $expected_response\"]);\n }\n}", "function sample_spam_check(&$string, &$name, &$email, &$url, &$ip)\n{\n $words = array('boob', 'titty', 'teenage', 'viagra');\n foreach ( $words as $word )\n {\n if ( stristr($string, $word) )\n return false;\n }\n // This name always means trouble.\n if ( $name == 'Pojo' )\n return false;\n // Block hotmail e-mail addresses\n if ( preg_match('/@hotmail\\.com$/', $email) )\n return false;\n // Check URL for bad words\n foreach ( $words as $word )\n {\n if ( stristr($url, $word) )\n return false;\n }\n // block IPs\n if ( $ip == '127.0.1.1') \n return false;\n \n // Always return true if all checks pass!\n return true;\n}", "public function testGetMessageFromKey()\n {\n $storage = ['slimFlash' => [ 'Test' => ['Test', 'Test2']]];\n $flash = new Messages($storage);\n\n $this->assertEquals(['Test', 'Test2'], $flash->getMessage('Test'));\n }", "function on_message($message){\n\t\t\t$text = strtolower($message['text']);\n\t\t\tif($text == 'play'){\t\t\t\t\n\t\t\t\t$messages = $this->generateQuestion();\n\t\t\t}else{\n\t\t\t\t//--check answer\n\t\t\t\tif($text == $this->session->get('gl_answer')){\n\t\t\t\t\t$this->session->set('gl_answer_count', $this->session->get('gl_answer_count') + 1);\n\t\t\t\t\t$messages[] = 'Correct!';\n\t\t\t\t\t$messages[] = array('type' => 'template',\n\t\t\t\t\t\t\t\t\t\t 'altText' => 'confirm play again',\n\t\t\t\t\t\t\t\t\t\t 'template'=> array(\n\t\t\t\t\t\t\t\t\t\t\t 'type'=> 'confirm',\n\t\t\t\t\t\t\t\t\t\t\t 'text'=> 'Play again?',\n\t\t\t\t\t\t\t\t\t\t\t 'actions'=> array(\n\t\t\t\t\t\t\t\t\t\t\t\t\tarray('type'=> 'message','label'=> 'Yes','text'=> 'play'),\n\t\t\t\t\t\t\t\t\t\t\t\t\tarray('type'=> 'message','label'=> 'No','text'=> 'no')\n\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t}else if($text == 'no'){\n\t\t\t\t\t$messages[] = 'Thanks!';\n\t\t\t\t}else{\n\t\t\t\t\t$messages = array(\n\t\t\t\t\t\t\t\t\t'Wrong!',\n\t\t\t\t\t\t\t\t\t'The answer is \\'' . $this->session->get('gl_answer') . '\\'',\n\t\t\t\t\t\t\t\t\tarray('type' => 'template',\n\t\t\t\t\t\t\t\t\t\t 'altText' => 'confirm play again',\n\t\t\t\t\t\t\t\t\t\t 'template'=> array(\n\t\t\t\t\t\t\t\t\t\t\t 'type'=> 'confirm',\n\t\t\t\t\t\t\t\t\t\t\t 'text'=> 'Play again?',\n\t\t\t\t\t\t\t\t\t\t\t 'actions'=> array(\n\t\t\t\t\t\t\t\t\t\t\t\t\tarray('type'=> 'message','label'=> 'Yes','text'=> 'play'),\n\t\t\t\t\t\t\t\t\t\t\t\t\tarray('type'=> 'message','label'=> 'No','text'=> 'no')\n\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn $messages;\n\t\t}", "public function testGetEmptyMessagesFromPrevRequest()\n {\n $storage = [];\n $flash = new Messages($storage);\n\n $this->assertEquals([], $flash->getMessages());\n }", "private function validPayload()\n {\n return [\n 'name' => 'Chefaa pharmacy',\n 'address' => 'Maadi',\n ];\n }", "function appendErrorMsg($string){\n\t\t$this->error[$this->errorIndex] = $string;\n\t\t$this->errorIndex++;\n\t}", "public function get_message_strings() {\n foreach($this->messages as $singleMessage) {\n \n }\n }", "protected function addMessage(string $message, $type = self::MESSAGE_INFO) {\n\t\t$this->messages[$type][] = $message;\n\t}", "function processMessageIn($message) {\n\t\t$service = $message->getKeyword();\n\t\t$keyword = $message->getKeyword(2);\n\n\t\tswitch ($keyword) {\n\t\t\tcase \"get\":\n\t\t\t\t$this->addSubscriber($message);\n\t\t\tbreak;\n\t\t\tcase \"yes\":\n\t\t\t\t$this->confirmSubscriber($message);\n\t\t\tbreak;\n\t\t\tcase \"cancel\":\n\t\t\tcase \"quit\":\n\t\t\tcase \"end\":\n\t\t\tcase \"unsubscribe\":\n\t\t\tcase \"stop\":\n\t\t\t\t$this->removeSubscriber($message);\n\t\t\tbreak;\n\t\t\tcase \"#\":\n\t\t\t\t$this->processMessageOut($message, null);\n\t\t\tbreak;\n\t\t\tcase \"#uk\":\n\t\t\t\t$this->processMessageOut($message, \"UK\");\n\t\t\tbreak;\n\t\t\tcase \"#us\":\n\t\t\t\t$this->processMessageOut($message, \"US\");\n\t\t\tbreak;\n\t\t\tcase \"status\":\n\t\t\t\t$this->statusCheck($message, $service);\n\t\t\tbreak;\n\t\t}\n\n\t}", "function messages_send($count = 5){\n\t\tfor($i=0;$i<$count;$i++)\n\t\t{\n\t\t\t$element = vazco_newsletter::queuePop('not_sent');\n\t\t\tif($element!==null)\n\t\t\t{\n\t\t\t\t$result = vazco_newsletter::sendMessage($element[0],$element[1]);\n\t\t\t\tif($result)\n\t\t\t\t\tvazco_newsletter::queuePush($element,'sent');\n\t\t\t\telse\n\t\t\t\t\tvazco_newsletter::queuePush($element,'error');\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}", "function string_has_params($string) {\n if (strpos($string, $this->parse['before']) !== false) {\n if (strpos($string, $this->parse['after']) !== false) {\n return strpos($string, $this->parse['after']) >\n strpos($string, $this->parse['before']);\n }\n }\n\n return false;\n }" ]
[ "0.61833304", "0.6096158", "0.5956236", "0.5775606", "0.5553289", "0.554898", "0.55422175", "0.5498558", "0.5316321", "0.5313713", "0.5247073", "0.5246378", "0.5234187", "0.5225374", "0.5214104", "0.5172235", "0.514323", "0.5142921", "0.51311517", "0.5112149", "0.5106109", "0.510507", "0.50864476", "0.5086214", "0.5045186", "0.50443524", "0.50249296", "0.5021748", "0.5011115", "0.5009767", "0.50068957", "0.5001086", "0.49780732", "0.497547", "0.4960073", "0.49436375", "0.49300042", "0.49231613", "0.49172443", "0.49090147", "0.48929602", "0.48737332", "0.48736015", "0.48654127", "0.4863571", "0.48386148", "0.48253316", "0.48235402", "0.48206326", "0.48152292", "0.48069742", "0.47978446", "0.47935808", "0.47918773", "0.47909594", "0.47739592", "0.4773713", "0.47690427", "0.47690362", "0.4757907", "0.47510272", "0.47491103", "0.47447234", "0.4736471", "0.47355548", "0.4734551", "0.47330955", "0.47322705", "0.47214764", "0.4720331", "0.4719544", "0.47178718", "0.47174627", "0.4716467", "0.47148982", "0.47143725", "0.47070253", "0.47037178", "0.4701804", "0.46976268", "0.4694776", "0.46819726", "0.46708477", "0.46705866", "0.46592227", "0.465538", "0.46546423", "0.46508116", "0.46499944", "0.46499372", "0.46476507", "0.46473613", "0.46471354", "0.46442384", "0.4644166", "0.4641876", "0.46404296", "0.46387437", "0.4634841", "0.46317923" ]
0.6778396
0
Test an array can be added to a message array for the next request
public function testAddMessageFromArrayForNextRequest() { $storage = ['slimFlash' => []]; $flash = new Messages($storage); $formData = [ 'username' => 'Scooby Doo', 'emailAddress' => '[email protected]', ]; $flash->addMessage('old', $formData); $this->assertArrayHasKey('slimFlash', $storage); $this->assertEquals($formData, $storage['slimFlash']['old'][0]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testAddMessageFromArrayForCurrentRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $formData = [\n 'username' => 'Scooby Doo',\n 'emailAddress' => '[email protected]',\n ];\n\n $flash->addMessageNow('old', $formData);\n\n $messages = $flash->getMessages();\n $this->assertEquals($formData, $messages['old'][0]);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEmpty($storage['slimFlash']);\n }", "public function testSetMessagesForNextRequest()\n {\n $storage = [];\n \n $flash = new Messages($storage);\n $flash->addMessage('Test', 'Test');\n $flash->addMessage('Test', 'Test2');\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEquals(['Test', 'Test2'], $storage['slimFlash']['Test']);\n }", "public function testGetFlashArray()\n {\n $expected = array('my_test_flash' => 'flash value', \n 'my_other_flash' => 'flash stuff');\n $this->assertEquals($expected, $this->_req->getFlash());\n }", "public function testAddMessageFromAnIntegerForNextRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $flash->addMessage('key', 46);\n $flash->addMessage('key', 48);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEquals(['46', '48'], $storage['slimFlash']['key']);\n }", "public function testAddMessageFromStringForNextRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $flash->addMessage('key', 'value');\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEquals(['value'], $storage['slimFlash']['key']);\n }", "function messages( $array ) {\n\t\t$this->messages_list = $array;\n\t\t}", "function testMakeNeatArray() {\r\n\t\t$this->Toolbar->makeNeatArray(array(1,2,3));\r\n\t\t$result = $this->firecake->sentHeaders;\r\n\t\t$this->assertTrue(isset($result['X-Wf-1-1-1-1']));\r\n\t\t$this->assertPattern('/\\[1,2,3\\]/', $result['X-Wf-1-1-1-1']);\r\n\t}", "public function add_request($request='') {\n $request = JsonParser::decode($request);\n if (is_array($request) === false) {\n $request = array($request);\n }\n $this->__requests[] = $request;\n return (true);\n }", "public function testGetQuickInboxMessages() {\n \t$this->assertInternalType('array',$this->chatModel->getQuickInboxMessages());\n }", "public function testAddWithMultipleMessages()\n {\n Phlash::add(\"info\", \"Please log in to continue\");\n Phlash::add(\"error\", \"There was a problem processing your request\");\n\n $flashMessages = Phlash::get();\n\n $this->assertNotEmpty($flashMessages);\n $this->assertEquals(count($flashMessages), 2);\n $this->assertEquals($flashMessages[0]->id, 0);\n $this->assertEquals($flashMessages[0]->type, \"info\");\n $this->assertEquals($flashMessages[0]->message, \"Please log in to continue\");\n $this->assertEquals($flashMessages[1]->id, 1);\n $this->assertEquals($flashMessages[1]->type, \"error\");\n $this->assertEquals($flashMessages[1]->message, \"There was a problem processing your request\");\n\n Phlash::clear();\n }", "public function testAddMessageFromObjectForNextRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $user = new \\stdClass();\n $user->name = 'Scooby Doo';\n $user->emailAddress = '[email protected]';\n\n $flash->addMessage('user', $user);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertInstanceOf(\\stdClass::class, $storage['slimFlash']['user'][0]);\n }", "function setMessage($message, $type, &$array)\n{\n array_push($array, array(\n 'Message' => $message,\n 'Type' => $type\n ));\n}", "public function testMessages() {\n $result = new Hostingcheck_Result_Info();\n $this->assertEquals(array(), $result->messages());\n $this->assertFalse($result->hasMessages());\n\n $messages = array(\n new Hostingcheck_Message('Foo message'),\n new Hostingcheck_Message('Bar Message'),\n );\n $result = new Hostingcheck_Result_Info($messages);\n $this->assertEquals($messages, $result->messages());\n\n $this->assertTrue($result->hasMessages());\n }", "public function testGetEmptyMessagesFromPrevRequest()\n {\n $storage = [];\n $flash = new Messages($storage);\n\n $this->assertEquals([], $flash->getMessages());\n }", "abstract protected function processMessage(array $data, array $message) : bool;", "public function check_meta_is_array($value, $request, $param)\n {\n }", "public function testPostAuthorizationSubjectBulkadd()\n {\n }", "public function testAddMessageFromAnIntegerForCurrentRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $flash->addMessageNow('key', 46);\n $flash->addMessageNow('key', 48);\n\n $messages = $flash->getMessages();\n $this->assertEquals(['46','48'], $messages['key']);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEmpty($storage['slimFlash']);\n }", "private static function setArray() {\n\tself::$requests = explode(\"/\", self::$uri);\n if(self::$requests[0] == 'api') {\n array_shift(self::$requests);\n self::$api = True;\n }\n }", "function add_message($messages){\n global $messages;\n $messages[] = $messages;\n}", "public function testGetMessagesFromPrevRequest()\n {\n $storage = ['slimFlash' => ['Test']];\n $flash = new Messages($storage);\n\n $this->assertEquals(['Test'], $flash->getMessages());\n }", "public function testFetchArray()\n {\n $this->todo('stub');\n }", "public function testErrorMessageArray()\n {\n $errorResponse = json_decode('{\n \"error\": {\n \"code\": \"UNPROCESSABLE_ENTITY\",\n \"message\": [\"Bad format\", \"Bad format 2\"],\n \"errors\": []\n }\n }', true);\n\n try {\n Requestor::handleApiError(null, 404, $errorResponse);\n } catch (EasyPostException $error) {\n $this->assertEquals('Bad format, Bad format 2', $error->getMessage());\n }\n }", "function arrayMessage($array){\n $l = \"[\";\n $x = 0;\n while($x < count($array)){\n $l = $l.$array[$x];\n $x++;\n if($x != count($array)){\n $l = $l.\",\";\n }\n }\n $l = $l.\"]\";\n \n $messArray = array('message'=>$l,'mess_type'=>'user_array');\n $json = json_encode($messArray);\n return $json;\n }", "public function test_array_returns_true_when_optional_and_input_array() {\n\t\t$optional = true;\n\n\t\t$result = self::$validator->validate( array('test','test2'), $optional );\n\t\t$this->assertTrue( $result );\n\t}", "public function test_array_returns_true_when_not_optional_and_input_array() {\n\t\t$optional = false;\n\n\t\t$result = self::$validator->validate( array('test','test2'), $optional );\n\t\t$this->assertTrue( $result );\n\t}", "public function testGetSessionArray()\n {\n $expected = array('my_test_session' => 'session value', \n 'my_other_session' => 'session stuff');\n $this->assertEquals($expected, $this->_req->getSession());\n }", "public function testConsumeArray()\n {\n $config = ['plugin' => null, 'controller' => 'Groups', 'action' => 'index'];\n $result = Hash::consume($config, ['controller', 0]);\n\n $this->assertEquals(['controller' => 'Groups', 0 => null], $result);\n $this->assertEquals(['plugin' => null, 'action' => 'index'], $config);\n }", "public function testMagicCall()\n {\n $client = new Client($this->options);\n $emails = $client->emails();\n\n $this->assertTrue(is_array($emails));\n }", "function add_success(&$log, $message){\n if(!is_array($log)) return;\n\n $log[] = array(\n \"type\" => \"success\",\n \"message\" => $message\n );\n}", "function addMessage( $message )\n {\n if ( isset($message['errorMessage']) )\n {\n $this->messages[] = array_merge($this->empty_message,$message);\n } else if ( isset($message[0]) && isset($message[0]['errorMessage']) ) {\n foreach ( $message as $m )\n {\n $this->messages[] = array_merge($this->empty_message,$m);\n }\n }\n }", "public function testSendWithRequestSendMany()\n {\n $service = $this->getStubForTest(file_get_contents(__DIR__ . '/TestAsset/Response/send_many.txt'));\n\n $recipients = array(\n new Request\\Recipient('regl4jtwe8flmf23knfsd', 10000),\n new Request\\Recipient('23dskflsfuo2u4ourjsd', 20000),\n new Request\\Recipient('34tfskdlfcvkdjhvkjwehf', 30000),\n );\n\n $request = new Request\\SendMany();\n\n $request->setRecipients($recipients);\n\n /* @var $response Response\\Send */\n $response = $service->send($request);\n\n $this->assertEquals('Sent To Multiple Recipients', $response->getMessage());\n $this->assertEquals(\n 'f322d01ad784e5deeb25464a5781c3b20971c1863679ca506e702e3e33c18e9c',\n $response->getTxHash()\n );\n\n $this->assertEquals(\n $this->getLastRawRequestExpected(__DIR__ . '/TestAsset/Request/send_many.txt'),\n $this->getLastRawRequest($service),\n 'Requests does not match'\n );\n }", "public function canTransformArrayToResponse()\n {\n $resourceTransformer = new DummyResourceTransformer();\n\n $dummyArray = [\n [\n 'id' => 'test'\n ],\n [\n 'id' => 'super'\n ]\n ];\n\n $transformed = $resourceTransformer->transformToResponse($dummyArray);\n\n $decoded = json_decode($transformed->getContent());\n\n $this->assertEquals(2, count($decoded->data));\n }", "public function testArrayContainsAnElement()\n {\n $fixture = array();\n \n // Add an element to the Array fixture.\n $fixture[] = 'Element';\n \n // Assert that the size of the Array fixture is 1.\n $this->assertEquals(1, sizeof($fixture));\n }", "public function testValidReturnOfUserSentMessages()\n {\n\n $senderuser = User::storeUser([\n 'username' => 'testo',\n 'email' => '[email protected]',\n 'password' => '123456789'\n ]);\n\n $token = auth()->login($senderuser);\n $headers = [$token];\n\n $receiveruser1 = User::storeUser([\n 'username' => 'testoo',\n 'email' => '[email protected]',\n 'password' => '123456789'\n ]);\n\n $receiveruser2 = User::storeUser([\n 'username' => 'testooo',\n 'email' => '[email protected]',\n 'password' => '123456789'\n ]);\n\n\n \n $message1= Message::createDummyMessage($senderuser->username, $receiveruser1->username, 'test_hii1', 'test_subject');\n\n\n $message2= Message::createDummyMessage($senderuser->username, $receiveruser2->username, 'test_hii2', 'test_subject');\n\n\n\n $this->json('GET', 'api/v1/auth/viewUserSentMessages', [], $headers)\n ->assertStatus(200)\n ->assertJson([\n \"success\" => \"true\",\n \"messages\" => [[\n \t\"receiver_name\" => \"testoo\",\n \t \"receiver_photo\" => null,\n \"message_subject\" => 'test_subject',\n \t \"message_content\" => \"test_hii1\",\n \"message_id\" => $message1->message_id,\n \"duration\" => link::duration($message1->message_date)\n\n ],[\n \t\"receiver_name\" => \"testooo\",\n \t \"receiver_photo\" => null,\n \"message_subject\" => 'test_subject',\n \t \"message_content\" => \"test_hii2\",\n \"message_id\" => $message2->message_id,\n \"duration\" => link::duration($message2->message_date)\n\n ]]\n ]);\n\n\n\n $senderuser->delete();\n $receiveruser1->delete();\n $receiveruser2->delete();\n }", "public function willProcessRequest(array $data) {\n }", "public function testSetMessagesForCurrentRequest()\n {\n $storage = ['slimFlash' => [ 'error' => ['An error']]];\n\n $flash = new Messages($storage);\n $flash->addMessageNow('error', 'Another error');\n $flash->addMessageNow('success', 'A success');\n $flash->addMessageNow('info', 'An info');\n\n $messages = $flash->getMessages();\n $this->assertEquals(['An error', 'Another error'], $messages['error']);\n $this->assertEquals(['A success'], $messages['success']);\n $this->assertEquals(['An info'], $messages['info']);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEmpty([], $storage['slimFlash']);\n }", "public function vxMessageCreateCheck() {\n\t\t$rt = array();\n\t\t\n\t\t$rt['errors'] = 0;\n\t\t\n\t\t$rt['msg_receivers_value'] = '';\n\t\t/* receivers: raw */\n\t\t$rt['msg_receivers_a'] = array();\n\t\t/* receivers: validated */\n\t\t$rt['msg_receivers_v'] = array();\n\t\t/* receivers: validated names */\n\t\t$rt['msg_receivers_n'] = array();\n\t\t/* msg_receivers_error:\n\t\t0 => no error\n\t\t1 => empty\n\t\t2 => not exist\n\t\t999 => unspecific */\n\t\t$rt['msg_receivers_error'] = 0;\n\t\t$rt['msg_receivers_error_msg'] = array(1 => '你忘记写收件人了', 2 => '你写的一位或多位收件人不存在');\n\t\t\n\t\tif (isset($_POST['msg_receivers'])) {\n\t\t\t$rt['msg_receivers_value'] = make_single_safe($_POST['msg_receivers']);\n\t\t\tif (strlen($rt['msg_receivers_value']) > 0) {\n\t\t\t\t$rt['msg_receivers_a'] = explode(',', $rt['msg_receivers_value']);\n\t\t\t\tforeach ($rt['msg_receivers_a'] as $msg_receiver) {\n\t\t\t\t\t$msg_receiver = trim($msg_receiver);\n\t\t\t\t\t$sql = \"SELECT usr_id, usr_nick FROM babel_user WHERE usr_nick = '{$msg_receiver}'\";\n\t\t\t\t\t$rs = mysql_query($sql, $this->db);\n\t\t\t\t\tif (mysql_num_rows($rs) == 1) {\n\t\t\t\t\t\t$User = mysql_fetch_object($rs);\n\t\t\t\t\t\tmysql_free_result($rs);\n\t\t\t\t\t\tif ($User->usr_id != $this->User->usr_id) {\n\t\t\t\t\t\t\tif (!in_array($User->usr_id, $rt['msg_receivers_v'])) {\n\t\t\t\t\t\t\t\t$rt['msg_receivers_v'][] = $User->usr_id;\n\t\t\t\t\t\t\t\t$rt['msg_receivers_n'][] = $User->usr_nick;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmysql_free_result($rs);\n\t\t\t\t\t\t$rt['msg_receivers_error'] = 2;\n\t\t\t\t\t\t$rt['errors']++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ($rt['msg_receivers_error'] == 0) {\n\t\t\t\t\tif (count($rt['msg_receivers_v']) == 0) {\n\t\t\t\t\t\t$rt['msg_receivers_value'] = '';\n\t\t\t\t\t\t$rt['msg_receivers_error'] = 1;\n\t\t\t\t\t\t$rt['errors']++;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$rt['msg_receivers_value'] = implode(',', $rt['msg_receivers_n']);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$rt['msg_receivers_error'] = 1;\n\t\t\t\t$rt['errors']++;\n\t\t\t}\n\t\t} else {\n\t\t\t$rt['msg_receivers_error'] = 1;\n\t\t\t$rt['errors']++;\n\t\t}\n\t\t\n\t\t$rt['msg_body_value'] = '';\n\t\t$rt['msg_body_error'] = 0;\n\t\t$rt['msg_body_error_msg'] = array(1 => '你忘记写消息内容了', 2 => '你写的消息内容超出长度限制了');\n\t\t\n\t\tif (isset($_POST['msg_body'])) {\n\t\t\t$rt['msg_body_value'] = make_multi_safe($_POST['msg_body']);\n\t\t\t$rt['msg_body_length'] = mb_strlen($rt['msg_body_value'], 'UTF-8');\n\t\t\tif ($rt['msg_body_length'] > 0) {\n\t\t\t\tif ($rt['msg_body_length'] > 200) {\n\t\t\t\t\t$rt['msg_body_error'] = 2;\n\t\t\t\t\t$rt['errors']++;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$rt['msg_body_error'] = 1;\n\t\t\t\t$rt['errors']++;\n\t\t\t}\n\t\t} else {\n\t\t\t$rt['msg_body_error'] = 1;\n\t\t\t$rt['errors']++;\n\t\t}\n\t\t\n\t\treturn $rt;\n\t}", "public function testInArray() {\n\t\t$array = array(\"a\", \"b\", \"c\");\n\t\t$this->assertTrue(permissionInPermissions($array, \"a\"));\n\t\t$this->assertTrue(permissionInPermissions($array, \"b\"));\n\t\t$this->assertTrue(permissionInPermissions($array, \"c\"));\n\t}", "private function process_array($value) {\n return is_array($value);\n }", "public function testAddMessageFromStringForCurrentRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $flash->addMessageNow('key', 'value');\n\n $messages = $flash->getMessages();\n $this->assertEquals(['value'], $messages['key']);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEmpty($storage['slimFlash']);\n }", "public function testCheckArray() {\n\t\t$iniFile = CAKE . 'Test' . DS . 'test_app' . DS . 'Config'. DS . 'acl.ini.php';\n\n\t\t$Ini = new IniAcl();\n\t\t$Ini->config = $Ini->readConfigFile($iniFile);\n\t\t$Ini->userPath = 'User.username';\n\n\t\t$user = array(\n\t\t\t'User' => array('username' => 'admin')\n\t\t);\n\t\t$this->assertTrue($Ini->check($user, 'posts'));\n\t}", "public static function hasItems(array $message) : bool\n {\n return isset($message['Messages']) ? (empty($message['Messages']) ? false : true) : false;\n }", "function rest_is_array($maybe_array)\n {\n }", "private function is_param_array($param){\n\t\tif(!is_array($param)){\n\t\t\t$this->text(\"Invalid parameter, cannot reply with appropriate message\");\n\t\t\treturn false;\n\t\t}else{\n\t\t\treturn true;\n\t\t}\n\t}", "public function testCanReturnAnArrayOfStatusUpdates()\n {\n $t = M::mock('Example\\FacebookFeedReader');\n $t->shouldReceive('getMessages')\n ->once()\n ->andReturn(array('foo', 'bar', 'baz', 'boo', 'bop'));\n $s = new SocialFeed($t);\n $v = $s->getArray();\n $this->assertCount(5, $v);\n $this->assertEquals($v[0], 'foo');\n $this->assertEquals($v[1], 'bar');\n $this->assertEquals($v[2], 'baz');\n $this->assertEquals($v[3], 'boo');\n $this->assertEquals($v[4], 'bop');\n }", "public function testGetVoicemailQueueMessages()\n {\n }", "public function arr() {\n $customer_msgs = array();\n /* for ($i = 1; $i <= 10; $i++) {\n /* $msgs = array(); */\n /* $msgs[$i] = \"Message \" . $i;\n /* array_push($arrs, $msgs); */\n /* } */\n $customer_msgs['1'] = \"This Email is not Registered\";\n $customer_msgs['2'] = \"Name is required\";\n $customer_msgs['3'] = \"Age is required\";\n $customer_msgs['4'] = \"Breed is required\";\n $customer_msgs['5'] = \"Seassion token was expired.\"; /* token */\n $customer_msgs['6'] = \"Your unique id is missing\";\n $customer_msgs['7'] = \"Image is required\";\n $customer_msgs['8'] = \"Invalid Input\";\n $customer_msgs['9'] = \"Token Expired\";\n $customer_msgs['10'] = \"Owner ID not Found\";\n $customer_msgs['11'] = \"Not a valid token\";\n $customer_msgs['12'] = \"No Dogs Found\";\n $customer_msgs['13'] = \"Driver not Found\";\n $customer_msgs['14'] = 'PayPal unique id is missing.';\n $customer_msgs['15'] = 'Contact numbers are required.';\n $customer_msgs['16'] = 'Your ETA is required.';\n $customer_msgs['17'] = 'No Credit Found';\n $customer_msgs['18'] = 'Successfully Log-Out';\n $customer_msgs['19'] = \"Id of Request is required\";\n $customer_msgs['20'] = \"Already Rated\";\n $customer_msgs['21'] = \"Walk is not completed\";\n $customer_msgs['22'] = \"Walk ID doesnot matches with Dog ID\";\n $customer_msgs['23'] = \"Walk ID Not Found\";\n $customer_msgs['24'] = 'Invalid Phone Number';\n $customer_msgs['25'] = 'Phone number must be required.';\n $customer_msgs['26'] = 'Social Login unique id must be required.';\n $customer_msgs['27'] = 'Email ID already Registred';\n $customer_msgs['28'] = 'Password field is required.';\n $customer_msgs['29'] = 'Email field is required';\n $customer_msgs['30'] = 'Name field is required.';\n $customer_msgs['31'] = 'Last Name field is required.';\n $customer_msgs['32'] = 'Push notification token is required.';\n $customer_msgs['33'] = 'Device type must be android or ios';\n $customer_msgs['34'] = 'Login type is required.';\n $customer_msgs['35'] = 'Login by mismatch';\n $customer_msgs['36'] = 'Invalid Username and Password';\n $customer_msgs['37'] = 'Not a Registered User';\n $customer_msgs['38'] = 'Not a valid social registration User';\n $customer_msgs['39'] = 'Card number\\'s last four digits are missing.';\n $customer_msgs['40'] = 'Unique payment token is missing.';\n $customer_msgs['41'] = 'Could not create client ID';\n $customer_msgs['42'] = 'Unique card ID is missing.';\n $customer_msgs['43'] = 'Card ID and ' . Config::get('app.generic_keywords.User') . ' ID Doesnot matches';\n $customer_msgs['44'] = 'Card not found';\n $customer_msgs['45'] = 'This user does not have a referral code';\n $customer_msgs['46'] = 'No Card Found';\n $customer_msgs['47'] = 'Invalid Old Password';\n $customer_msgs['48'] = 'Old Password must not be blank';\n $customer_msgs['49'] = \"location points are missing\";\n $customer_msgs['50'] = '' . Config::get('app.generic_keywords.User') . 'ID not Found';\n $customer_msgs['51'] = 'Request ID doesnot matches with' . Config::get('app.generic_keywords.User') . ' ID';\n $customer_msgs['52'] = 'Request ID Not Found';\n $customer_msgs['53'] = '' . Config::get('app.generic_keywords.User') . ' ID not Found';\n $customer_msgs['54'] = 'No walker found';\n $customer_msgs['55'] = 'No ' . Config::get('app.generic_keywords.Provider') . ' found matching the service type'; /* remaining from here */\n $customer_msgs['56'] = 'No ' . Config::get('app.generic_keywords.Provider') . ' found';\n $customer_msgs['57'] = 'Selected provider\\'s unique id is missing.';\n $customer_msgs['58'] = 'Your previous Request is Pending.';\n $customer_msgs['59'] = 'Please add card first for payment.';\n $customer_msgs['60'] = 'No ' . Config::get('app.generic_keywords.Provider') . ' found matching the service type for scheduled request.';\n $customer_msgs['61'] = 'Invalid Promo Code';\n $customer_msgs['62'] = 'You can not apply multiple code for single trip.';\n $customer_msgs['63'] = 'Promotional code successfully applied.';\n $customer_msgs['64'] = 'Promotional code is not available';\n $customer_msgs['65'] = 'Promotional code already used.';\n $customer_msgs['66'] = 'Promotion feature is not active on card payment.';\n $customer_msgs['67'] = 'Promotion feature is not active on cash payment.';\n $customer_msgs['68'] = 'Promotion feature is not active.';\n $customer_msgs['69'] = 'You can\\'t apply promotional code without creating request.';\n $customer_msgs['70'] = 'Payment mode is paypal';\n $customer_msgs['71'] = 'No ' . Config::get('app.generic_keywords.Provider') . ' found for the selected service in your area currently';\n $customer_msgs['72'] = 'You are already in debt';\n $customer_msgs['73'] = 'Distance is required.';\n $customer_msgs['74'] = 'Time is required.';\n $customer_msgs['75'] = 'Request ID doesnot matches with ' . Config::get('app.generic_keywords.User') . ' ID';\n $customer_msgs['76'] = 'On going ' . Config::get('app.generic_keywords.Trip') . '.';\n $customer_msgs['77'] = 'No on going ' . Config::get('app.generic_keywords.Trip') . ' found.';\n $customer_msgs['78'] = 'Searching for ' . Config::get('app.generic_keywords.Provider') . 's.';\n $customer_msgs['79'] = 'No ' . Config::get('app.generic_keywords.Provider') . 's are available currently. Please try after sometime.';\n $customer_msgs['80'] = '' . Config::get('app.generic_keywords.Provider') . ' not Confirmed yet';\n $customer_msgs['81'] = 'No ' . Config::get('app.generic_keywords.Provider') . ' found around you.';\n $customer_msgs['82'] = 'Time-Zone is required';\n $customer_msgs['83'] = 'Schedule date and time must be required.';\n $customer_msgs['84'] = \"Sorry, You can't create schedule morethen two week faar from today.\";\n $customer_msgs['85'] = 'update successfully';\n $customer_msgs['86'] = 'Payment mode not updated';\n $customer_msgs['87'] = \"Destination Set Successfully\";\n $customer_msgs['88'] = 'Sorry You can\\'t create event earlier then 14 days.';\n $customer_msgs['89'] = 'Yo have invited maximum members for event.';\n $customer_msgs['90'] = 'Please change braintree as default gateway';\n $customer_msgs['91'] = \"Sorry, You have apready apply the refereel code.\";\n $customer_msgs['92'] = 'Referral process successfully completed.';\n $customer_msgs['93'] = \"Sorry, You can't apply your refereel code.\";\n $customer_msgs['94'] = 'Invalid referral code';\n $customer_msgs['95'] = 'You have skipped for referral process';\n $customer_msgs['96'] = 'No Dog Found';\n $customer_msgs['97'] = 'Payment type must be required.';\n $customer_msgs['98'] = 'Event Unique Id is missing.';\n $customer_msgs['99'] = 'Sorry you can\\'t delte past or ongoing event.';\n $customer_msgs['100'] = 'Event not found.';\n $customer_msgs['101'] = 'Event successfully deleted.';\n /* print_r($customer_msgs); */\n $provider_msgs = array();\n $provider_msgs['1'] = \"This Email is not Registered\";\n $provider_msgs['2'] = 'Password field is required.';\n $provider_msgs['3'] = 'Email field is required';\n $provider_msgs['4'] = 'Name field is required.';\n $provider_msgs['5'] = 'Last Name field is required.';\n $provider_msgs['6'] = 'Image is required';\n $provider_msgs['7'] = 'Push notification token is required.';\n $provider_msgs['8'] = 'Device type must be android or ios';\n $provider_msgs['9'] = 'Login type is required.';\n $provider_msgs['10'] = 'Phone number must be required.';\n $provider_msgs['11'] = 'Social Login unique id must be required.';\n $provider_msgs['12'] = 'Invalid Input';\n $provider_msgs['13'] = 'Invalid Phone Number';\n $provider_msgs['14'] = 'Email ID already Registred';\n $provider_msgs['15'] = 'Login by mismatch';\n $provider_msgs['16'] = 'Invalid Username and Password';\n $provider_msgs['17'] = 'Not a Registered User';\n $provider_msgs['18'] = 'Not a valid social registration User';\n $provider_msgs['19'] = 'Id of Request is required.';\n $provider_msgs['20'] = 'Your unique id is missing.';\n $provider_msgs['21'] = 'Already Rated';\n $provider_msgs['22'] = 'Service ID doesnot matches with ' . Config::get('app.generic_keywords.Provider') . ' ID';\n $provider_msgs['23'] = 'Service ID Not Found';\n $provider_msgs['24'] = 'Token Expired';\n $provider_msgs['25'] = '' . Config::get('app.generic_keywords.Provider') . ' ID not Found';\n $provider_msgs['26'] = 'Not a valid token';\n $provider_msgs['27'] = 'Service Already Started';\n $provider_msgs['28'] = 'location points are missing.';\n $provider_msgs['29'] = 'accept or reject must be required.';\n $provider_msgs['30'] = 'Request ID does not matches' . Config::get('app.generic_keywords.Provider') . ' ID';\n $provider_msgs['31'] = 'Request Canceled.';\n $provider_msgs['32'] = 'Request ID Not Found';\n $provider_msgs['33'] = '' . Config::get('app.generic_keywords.Provider') . ' not yet confirmed';\n $provider_msgs['34'] = 'Service not yet started';\n $provider_msgs['35'] = '' . Config::get('app.generic_keywords.Provider') . ' not yet arrived';\n $provider_msgs['36'] = 'Distance is required.';\n $provider_msgs['37'] = 'Time is required.';\n $provider_msgs['38'] = 'Invalid Old Password';\n $provider_msgs['39'] = 'Old Password must not be blank';\n $provider_msgs['40'] = 'Successfully Log-Out';\n\n\n foreach ($customer_msgs as $key => $value) {\n echo '<string name=\"error_' . $key . '\">' . $value . '</string>';\n }\n echo \"\\n ################################################################################ \\n\";\n foreach ($provider_msgs as $key => $value) {\n echo '<string name=\"error_' . $key . '\">' . $value . '</string>';\n }\n /* $i = 0;\n foreach ($customer_msgs as $customer_msg) {\n\n echo '<string name=\"error_' . $i . '\">' . $customer_msg . '</string>';\n $i++;\n } */\n exit;\n /* $response_array = array('success' => false, 'error' => 'Invalid Input', 'error_code' => 401, 'error_messages_client' => $customer_msgs, 'error_messages_provider' => $provider_msgs);\n $response_code = 200;\n $response = Response::json($response_array, $response_code);\n return $response; */\n }", "public function testToArray(): void\n {\n $file = new FileObject();\n $url = new UrlObject();\n $formParameter = new FormParameterObject();\n\n $body = new RequestBodyObject([\n 'disabled' => false,\n 'file' => $file,\n 'form_parameter' => $formParameter,\n 'mode' => 'file',\n 'raw' => 'test-raw',\n 'url' => $url\n ]);\n\n self::assertEquals([\n 'disabled' => false,\n 'file' => $file,\n 'formdata' => $formParameter,\n 'mode' => 'file',\n 'raw' => 'test-raw',\n 'urlencoded' => $url\n ], $body->toArray());\n }", "public function testMoveMessageNoarray()\n {\n $this->assertSame($this->funcForTestMove(\"noarray\"), \"noarray\");\n }", "public function testAddMessageFromObjectForCurrentRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $user = new \\stdClass();\n $user->name = 'Scooby Doo';\n $user->emailAddress = '[email protected]';\n\n $flash->addMessageNow('user', $user);\n\n $messages = $flash->getMessages();\n $this->assertInstanceOf(\\stdClass::class, $messages['user'][0]);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEmpty($storage['slimFlash']);\n }", "abstract protected function checkExistingResponse();", "public function getMessages(): array;", "public function getMessages(): array;", "public function getMessages(): array;", "public function validArrayForArrayConfigurationProvider() {}", "public function getMessages(): array\n {\n }", "public function hasRepeatedField()\n {\n return count($this->get(self::REPEATED_FIELD)) !== 0;\n }", "function testValidateRepeatedFieldCallsValidateOnEachRepetition() {\n\t\t// arrange\n\t\tglobal $post;\n\t\t$TestRepeatedFields = $this->getMockBuilder('TestRepeatedFields')\n\t\t\t\t\t\t->setMethods( array( 'validate' ) )\n\t\t\t\t\t\t->getMock();\n\t\t$TestRepeatedFields->expects($this->exactly(2))\n\t\t\t\t\t\t ->method('validate');\n\t\t$validated = array();\n\n\t\t//act\n\t\t$TestRepeatedFields->validate_repeated_field( $post->ID, $TestRepeatedFields->fields['fields'], $validated, array() );\n\n\t\t//assert\n\t}", "private function validPayload()\n {\n return [\n 'name' => 'Chefaa pharmacy',\n 'address' => 'Maadi',\n ];\n }", "public function testWarningsIsArrayWithLengthOfTwo(): void\n {\n $this->get_accessible_reflection_property('warnings');\n $value = $this->get_reflection_property_value('warnings');\n\n $this->assertIsArray($value);\n $this->assertEquals(2, count($value));\n }", "public function testPostVoicemailMessages()\n {\n }", "private function correctRequest($msg){\n return array(\"error\" => false,\"msg\" => $msg);\n }", "public function sendMultiple(array $messages);", "public function test_getTransactionParamsArray(){\n $this->assertNull($this->transaction->getTransactionParamsArray());\n\n //Now set an arbitrary param\n $paramsArray = ['test'=>'test'];\n $this->transaction->setParams($paramsArray);\n $this->assertNotNull($this->transaction->getTransactionParamsArray());\n $this->assertSame($paramsArray, $this->transaction->getTransactionParamsArray());\n }", "public static function inArray($value, array $values, $message = '');", "public function testMessages()\n {\n $response = $this->json('GET', '/api/messages');\n $response->assertJsonStructure([\n 'messages'=>[\n 'current_page',\n 'data' => [\n [\n 'uid',\n 'sender',\n 'subject',\n 'message',\n 'time_sent',\n 'archived',\n 'read'\n ]\n ],\n 'first_page_url',\n 'from',\n 'last_page',\n 'last_page_url',\n 'next_page_url',\n 'path',\n 'per_page',\n 'prev_page_url',\n 'to',\n 'total'\n ]\n ]);\n }", "function record_message($message) {\n global $messages;\n array_push($messages, $message);\n}", "public function testAddMessage()\n {\n $message1 = new Hostingcheck_Message('Foo message');\n $result = new Hostingcheck_Result_Info();\n $result->addMessage($message1);\n $this->assertEquals(array($message1), $result->messages());\n\n $message2 = new Hostingcheck_Message('Bar message');\n $result->addMessage($message2);\n $this->assertEquals(array($message1, $message2), $result->messages());\n\n $this->assertTrue($result->hasMessages());\n }", "public function testSendMultiPage()\n {\n $request1 = $this->getExpectedBody(\n [\n ['SKU' => 'test1'],\n ['SKU' => 'test2'],\n ['SKU' => 'test3'],\n ['SKU' => 'test4'],\n ['SKU' => 'test5'],\n ['SKU' => 'test6'],\n ['SKU' => 'test7'],\n ['SKU' => 'test8'],\n ['SKU' => 'test9'],\n ['SKU' => 'test10']\n ],\n []\n );\n\n\n $curl = $this->mockCurl($request1, 200, '', '', 2);\n\n $request2 = $this->getExpectedBody(\n [\n ['SKU' => 'test11'],\n ['SKU' => 'test12']\n ],\n []\n );\n\n $curl->shouldReceive('post')\n ->once()\n ->with('http://127.0.0.1/delta/', $request2);\n\n $this->mockEndpoint();\n\n $this->subject->addData(['SKU' => 'test1']);\n $this->subject->addData(['SKU' => 'test2']);\n $this->subject->addData(['SKU' => 'test3']);\n $this->subject->addData(['SKU' => 'test4']);\n $this->subject->addData(['SKU' => 'test5']);\n $this->subject->addData(['SKU' => 'test6']);\n $this->subject->addData(['SKU' => 'test7']);\n $this->subject->addData(['SKU' => 'test8']);\n $this->subject->addData(['SKU' => 'test9']);\n $this->subject->addData(['SKU' => 'test10']);\n $this->subject->addData(['SKU' => 'test11']);\n $this->subject->addData(['SKU' => 'test12']);\n\n $responses = $this->subject->send();\n\n $this->assertEquals(2, count($responses));\n\n $this->assertEquals(\n [\n 'status' => 200,\n 'body' => ''\n ],\n $responses[0]\n );\n\n $this->assertEquals(\n [\n 'status' => 200,\n 'body' => ''\n ],\n $responses[1]\n );\n }", "public function testReadAllDataAndCompareTheValueFromPreviousTest()\n {\n $store = new Storage(TESTING_STORE);\n\n // let assign our data result into variable\n $items = $store->read();\n\n // mapping msg value from items\n $item_messages = array_map(function (&$val) {\n return $val['msg'];\n }, $items);\n\n // mapping msg value from batch dummy\n $batch_dummy = array_map(function (&$val) {\n return $val['msg'];\n }, $this->batch_dummy);\n\n // here we make a test that count diff values from data between 2 array\n $diff_count = count(array_diff($item_messages, $batch_dummy));\n $this->assertEquals(0, $diff_count);\n }", "public function test_getData_returnsArray_ifDataDoesExist()\n\t{\n\t\t$data = ['foo' => 'bar', 'baz' => 'qux'];\n\t\t\n\t\t$request = new Post('http://example.com');\n\t\t$request->setData($data);\n\t\t\n\t\t$this->assertEquals($data, $request->getData());\n\t\t\n\t\treturn;\n\t}", "public function testToArrayReturnsAllValuesWhenFilled(): void\n {\n $result = DiscordMessage::create()\n ->content('Content')\n ->username('UnitTest')\n ->avatar('https://domain.com/some-avatar.jpg')\n ->tts(false)\n ->toArray();\n\n $this->assertArrayHasKey('content', $result);\n $this->assertArrayHasKey('username', $result);\n $this->assertArrayHasKey('avatar_url', $result);\n $this->assertArrayHasKey('tts', $result);\n }", "function addCheckLog($message){\n global $checkLogQ;\n $length = 4;\n // If checkLogQ size is smaller than 4 add the message\n if(count($checkLogQ)<$length){\n $checkLogQ[] = $message;\n }\n // If checkLogQ size is bigger than 4 - Remove the oldest message and add the new one\n else{\n array_shift($checkLogQ);\n $checkLogQ[] = $message;\n }\n }", "public function testPayload() {\n $payload = array(\n \"this\" => \"is\",\n \"the\" => \"payload\",\n );\n $response = new Response();\n $response->setPayload($payload);\n $this->assertEquals($payload, $response->payload());\n }", "function it_receives_the_expected_response_when_looking_up_all_notifications() {\n $response = $this->listNotifications();\n\n $response->shouldHaveKey('links');\n $response['links']->shouldBeArray();\n\n $response->shouldHaveKey('notifications');\n $response['notifications']->shouldBeArray();\n\n $notifications = $response['notifications'];\n $total_notifications_count = count($notifications->getWrappedObject());\n\n for( $i = 0; $i < $total_notifications_count; $i++ ) {\n\n $notification = $notifications[$i];\n\n $notification->shouldBeArray();\n $notification->shouldHaveKey( 'id' );\n $notification['id']->shouldBeString();\n\n $notification->shouldHaveKey( 'reference' );\n $notification->shouldHaveKey( 'email_address' );\n $notification->shouldHaveKey( 'phone_number' );\n $notification->shouldHaveKey( 'line_1' );\n $notification->shouldHaveKey( 'line_2' );\n $notification->shouldHaveKey( 'line_3' );\n $notification->shouldHaveKey( 'line_4' );\n $notification->shouldHaveKey( 'line_5' );\n $notification->shouldHaveKey( 'line_6' );\n $notification->shouldHaveKey( 'postcode' );\n $notification->shouldHaveKey( 'status' );\n $notification['status']->shouldBeString();\n\n $notification->shouldHaveKey( 'template' );\n $notification['template']->shouldBeArray();\n $notification['template']->shouldHaveKey( 'id' );\n $notification['template']['id']->shouldBeString();\n $notification['template']->shouldHaveKey( 'version' );\n $notification['template']['version']->shouldBeInteger();\n $notification['template']->shouldHaveKey( 'uri' );\n $notification['template']['uri']->shouldBeString();\n\n $notification->shouldHaveKey( 'created_at' );\n $notification->shouldHaveKey( 'sent_at' );\n $notification->shouldHaveKey( 'completed_at' );\n\n $notification->shouldBeArray();\n\n $notification->shouldHaveKey( 'type' );\n $notification['type']->shouldBeString();\n $notification['type']->shouldBeString();\n $notification_type = $notification['type']->getWrappedObject();\n\n if ( $notification_type == \"sms\" ) {\n\n $notification['phone_number']->shouldBeString();\n\n } elseif ( $notification_type == \"email\") {\n\n $notification['email_address']->shouldBeString();\n\n }\n }\n\n }", "public function testPostValidMessage(){\n\t\t//get the count of the numbers of rows in the database\n\t\t$numRows = $this->getConnection()->getRowCount(\"message\");\n\n\t\t//create a new message to send\n\t\t$newMessage = new Message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\n\t\t//run a get request to establish session tokens\n\t\t$this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/');\n\n\t\t//Grab the Data from guzzle and enforce the status match our expectations\n\t\t$response = $this->guzzle->post('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/', ['headers' => ['X-XRF-TOKEN' => $this->getXsrfToken()], 'json' => $newMessage]);\n\t\t$this->assertSame($response->getStatusCode(), 200);\n\t\t$body = $response->getBody();\n\t\t$alertLevel = jason_decode($body);\n\t\t$this->assertSame(200, $alertLevel->status);\n\n\t\t//ensure a new row was added to the database\n\t\t$this->assertSame($numRows + 1, $this->getConnection()->getRowCount(\"message\"));\n\t}", "public function testGetForceArray()\n {\n $json = new JsonArray(['key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3']);\n\n $this->assertEquals(['value1'], $json->get('/key1', true));\n $this->assertEquals([], $json->get('/does-not-exist', true));\n }", "function verificar_estructura($d,$e){\n $ret = [];\n foreach($e as $v){\n if(!array_key_exists($v, $d)) $ret[] = $v;\n }\n if($ret != []){ // si no esta vacio\n response(400, 'faltan los elementos listados en data', \n ['faltantes' => $ret,'enviados' => $d]);\n return false;\n } else return true;\n}", "public function testBasicPreconditionFail2()\n {\n $this->typeSafetyTestClass->iNeedArrays('test', array());\n }", "public function testMessageThreadsV2GetMessages0()\n {\n }", "public function testMessageThreadsV2GetMessages()\n {\n }", "public function testIsArray() {\n\t\t$array = array('one' => 1, 'two' => 2);\n\t\t$result = _::isArray($array);\n\t\t$this->assertTrue($result);\n\n\t\t// test that an object is not an array\n\t\t$object = (object)$array;\n\t\t$result = _::isArray($object);\n\t\t$this->assertFalse($result);\n\t}", "public function testAddToNewsLetterFailForIncompleteDetails()\n {\n $request = Request::create('/api/contact/subscribe', 'POST', $this->invalidSubscriber);\n $response = $this->contactController->addToNewsletter($request);\n $this->assertEquals(ResponseMessage::INPUT_ERROR, $response->getData()->message);\n $this->assertObjectHasAttribute('name',$response->getData()->data);\n $this->assertObjectHasAttribute('email',$response->getData()->data);\n $this->assertDatabaseMissing('newsletter_subscribers', $this->invalidSubscriber);\n }", "public function toMessage(): array;", "private function validateArray($users_array){\n\t\t//Ensure that more than 2 users have been provided\n\t\tif(sizeof($users_array)<2){\n\t\t\techo '[Error] A minimum of 2 secret santa participants is required in order to use this system.';\n\t\t\treturn false;\n\t\t}\n\t\t//Check there are no duplicate emails\n\t\t$tmp_emails = array();\n\t\tforeach($users_array as $u){\n\t\t\tif(in_array($u['email'],$tmp_emails)){\n\t\t\t\techo \"[Error] Users cannot share an email or be in the secret santa more than once.\";\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t$tmp_emails[] = $u['email'];\n\t\t}\n\t\treturn true;\n\t}", "function attrite($request, $data, $is_response = false){\n if (is_array($request))\n {\n foreach ($request as $key => $value)\n {\n if (is_array($value))\n {\n $request[$key] = attrite($value, $data);\n }\n else\n {\n $translated = handleDefaultValue($data, $value);\n if ($is_response && $translated == $value)\n {\n // Raise error -\n throw new InvalidResponseException('Invalid Response Exception.');\n }\n $request[$key] = $translated;\n }\n }\n }\n return $request;\n }", "public function testParsedArray()\n {\n $entity = DataObjectHandler::getInstance()->getObject('testEntity');\n $this->assertCount(3, $entity->getLinkedEntities());\n }", "public function testGetFeedback()\r\n {\r\n try {\r\n $this->assertTrue(\r\n is_array($this->clientHandler->getFeedback())\r\n );\r\n } catch (Services_Apns_Exception $e) {\r\n // Error triggered\r\n $this->assertTrue(false);\r\n }\r\n }", "public function testAddContactMessageFailForIncompleteDetails()\n {\n $request = Request::create('/api/contact/message', 'POST', $this->invalidContactor);\n $response = $this->contactController->addContactMessage($request);\n $this->assertEquals(ResponseMessage::INPUT_ERROR, $response->getData()->message);\n $this->assertObjectHasAttribute('name',$response->getData()->data);\n $this->assertObjectHasAttribute('email',$response->getData()->data);\n $this->assertObjectHasAttribute('message',$response->getData()->data);\n $this->assertDatabaseMissing('contacts', $this->invalidContactor);\n }", "public function valid()\n {\n // don't process more than the max messages\n if ($this->currentKey >= $this->maxMessages) {\n return false;\n }\n // if a payload already exists for the current key, we'll be able to return that\n if (isset($this->messages[$this->currentKey])) {\n return true;\n }\n // if no payload exists for the current key yet, try to get the next one\n $message = $this->api->getNextMessage();\n if ($message) {\n $this->messages[$this->currentKey] = $message;\n return true;\n }\n // if no message exists and no new messages could be received,\n // end the iterable\n return false;\n }", "static function assertArrayHasKey($key, $array, $message = '')\n {\n try {\n return call_user_func_array('PHPUnit_Framework_Assert::assertArrayHasKey', func_get_args());\n } catch (\\Exception $e) {\n self::callSlack($e, debug_backtrace()[1]);\n }\n }", "function testValidRepeatedFieldToCallFunctions() {\n\t\t// arrange\n\t\tglobal $post;\n\t\t$factory = $this->getMockBuilder('TestRepeatedFields')\n\t\t\t\t\t\t->setMethods( array( 'validate_repeated_field', ) )\n\t\t\t\t\t\t->getMock();\n\t\t$factory->expects($this->once())\n\t\t\t\t->method('validate_repeated_field')\n\t\t\t\t->will($this->returnValue(true));\n\t\t$View = $this->getMockBuilder('\\CFPB\\Utils\\MetaBox\\View')\n\t\t\t\t\t\t->setMethods( array( 'process_repeated_field_params', ) )\n\t\t\t\t\t\t->getMock();\n\t\t$View->expects($this->once())\n\t\t\t\t->method('process_repeated_field_params')\n\t\t\t\t->will($this->returnValue(true));\n\t\t$factory->set_view($View);\n\t\t$validate = array();\n\n\t\t// act\n\t\t$factory->validate( $post->ID, $factory->fields['fields'], $validate );\n\n\t\t// assert\n\t\t// Test will fail if validate_fieldset isn't executed once and only once\n\t}", "public function hasMsg(){\n return $this->_has(18);\n }", "private function _setReponseArray() {\n try {\n $this->RESP = array(\n 'MSG' => $this->MSG,\n 'STATUS' => $this->STATUS\n );\n } catch (Exception $ex) {\n throw new Exception('Crud Model : Error in _setReponseArray function - ' . $ex);\n }\n }", "public function testToArrayReturnsOnlyFilledEntries(): void\n {\n $result = DiscordMessage::create()\n ->content('Content')\n ->username('UnitTest')\n ->toArray();\n\n $this->assertArrayHasKey('content', $result);\n $this->assertArrayHasKey('username', $result);\n $this->assertArrayNotHasKey('avatar_url', $result);\n $this->assertArrayNotHasKey('tts', $result);\n }", "public function testToArray()\n {\n $this->todo('stub');\n }", "public function testMessages()\n {\n $message = new PrivateMessage();\n $conversation = new Conversation();\n $this->assertEmpty($conversation->getMessages());\n\n $conversation->addMessage($message);\n $this->assertEquals(new ArrayCollection([$message]), $conversation->getMessages());\n\n $conversation->removeMessage($message);\n $this->assertEmpty($conversation->getMessages());\n }", "public function test_array_returns_true_when_optional_and_input_empty() {\n\t\t$optional = true;\n\n\t\t$result = self::$validator->validate( null, $optional );\n\t\t$this->assertTrue( $result );\n\t}", "public function provideMessageParameters()\n {\n $type = \"application/json\";\n\n $data[] = array('{\"foo\":\"bar\",\"baz\":[1,2,3]}', $type);\n $data[] = array('{\"foo\":\"bar\",\"baz\":[]}', $type);\n\n return $data;\n }" ]
[ "0.6403168", "0.63492715", "0.58963853", "0.58915865", "0.5839632", "0.57873327", "0.5740914", "0.57213295", "0.5686027", "0.5682223", "0.5512867", "0.54614747", "0.54467547", "0.54236424", "0.541326", "0.5396178", "0.5367872", "0.5359742", "0.5339173", "0.532194", "0.5287669", "0.52818596", "0.52470726", "0.5244061", "0.5243271", "0.5226571", "0.5202681", "0.5181268", "0.51742417", "0.5169474", "0.51632637", "0.5154303", "0.5151172", "0.5114212", "0.5108912", "0.5108648", "0.5081791", "0.50726604", "0.50709605", "0.50680214", "0.5066917", "0.5053825", "0.5050405", "0.5046117", "0.5042189", "0.5037744", "0.5031897", "0.50207794", "0.5013964", "0.50082237", "0.4996845", "0.49937716", "0.49917614", "0.49917614", "0.49917614", "0.4991392", "0.4977495", "0.4973969", "0.4970729", "0.4970558", "0.49641177", "0.49621424", "0.49615872", "0.49560994", "0.49549094", "0.49523515", "0.49521583", "0.49494523", "0.49472722", "0.49419683", "0.49386588", "0.49365875", "0.49293834", "0.4926266", "0.49162546", "0.49128327", "0.4911806", "0.49055108", "0.49031124", "0.49002892", "0.48983487", "0.48959604", "0.4893108", "0.4884159", "0.4877747", "0.48777288", "0.48732352", "0.48562667", "0.4855833", "0.48485073", "0.48441032", "0.48391637", "0.4836592", "0.48321795", "0.4829068", "0.4827956", "0.4823123", "0.48229212", "0.4822864", "0.48209912" ]
0.69801843
0
Test an object can be added to a message array for the next request
public function testAddMessageFromObjectForNextRequest() { $storage = ['slimFlash' => []]; $flash = new Messages($storage); $user = new \stdClass(); $user->name = 'Scooby Doo'; $user->emailAddress = '[email protected]'; $flash->addMessage('user', $user); $this->assertArrayHasKey('slimFlash', $storage); $this->assertInstanceOf(\stdClass::class, $storage['slimFlash']['user'][0]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testAddMessageFromArrayForNextRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $formData = [\n 'username' => 'Scooby Doo',\n 'emailAddress' => '[email protected]',\n ];\n\n $flash->addMessage('old', $formData);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEquals($formData, $storage['slimFlash']['old'][0]);\n }", "public function testSetMessagesForNextRequest()\n {\n $storage = [];\n \n $flash = new Messages($storage);\n $flash->addMessage('Test', 'Test');\n $flash->addMessage('Test', 'Test2');\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEquals(['Test', 'Test2'], $storage['slimFlash']['Test']);\n }", "public function testAddMessageFromObjectForCurrentRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $user = new \\stdClass();\n $user->name = 'Scooby Doo';\n $user->emailAddress = '[email protected]';\n\n $flash->addMessageNow('user', $user);\n\n $messages = $flash->getMessages();\n $this->assertInstanceOf(\\stdClass::class, $messages['user'][0]);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEmpty($storage['slimFlash']);\n }", "public function testAddMessageFromAnIntegerForNextRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $flash->addMessage('key', 46);\n $flash->addMessage('key', 48);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEquals(['46', '48'], $storage['slimFlash']['key']);\n }", "public function testAddMessageFromStringForNextRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $flash->addMessage('key', 'value');\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEquals(['value'], $storage['slimFlash']['key']);\n }", "public function testAddMessageFromArrayForCurrentRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $formData = [\n 'username' => 'Scooby Doo',\n 'emailAddress' => '[email protected]',\n ];\n\n $flash->addMessageNow('old', $formData);\n\n $messages = $flash->getMessages();\n $this->assertEquals($formData, $messages['old'][0]);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEmpty($storage['slimFlash']);\n }", "public function testAddMessageFromAnIntegerForCurrentRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $flash->addMessageNow('key', 46);\n $flash->addMessageNow('key', 48);\n\n $messages = $flash->getMessages();\n $this->assertEquals(['46','48'], $messages['key']);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEmpty($storage['slimFlash']);\n }", "public function testAddMessage()\n {\n $message1 = new Hostingcheck_Message('Foo message');\n $result = new Hostingcheck_Result_Info();\n $result->addMessage($message1);\n $this->assertEquals(array($message1), $result->messages());\n\n $message2 = new Hostingcheck_Message('Bar message');\n $result->addMessage($message2);\n $this->assertEquals(array($message1, $message2), $result->messages());\n\n $this->assertTrue($result->hasMessages());\n }", "public function add_request($request='') {\n $request = JsonParser::decode($request);\n if (is_array($request) === false) {\n $request = array($request);\n }\n $this->__requests[] = $request;\n return (true);\n }", "public function test_message_can_be_responded_to() {\n\n $response = Message::create('a thoughtful response', $this->user, $this->message);\n $this->assertEquals($this->message, $response->getParentMessage());\n\n $response = Message::findById($response->getId());\n $this->assertEquals($this->message, $response->getParentMessage()->loadDependencies());\n\n }", "public function testMessages() {\n $result = new Hostingcheck_Result_Info();\n $this->assertEquals(array(), $result->messages());\n $this->assertFalse($result->hasMessages());\n\n $messages = array(\n new Hostingcheck_Message('Foo message'),\n new Hostingcheck_Message('Bar Message'),\n );\n $result = new Hostingcheck_Result_Info($messages);\n $this->assertEquals($messages, $result->messages());\n\n $this->assertTrue($result->hasMessages());\n }", "public function testAddWithMultipleMessages()\n {\n Phlash::add(\"info\", \"Please log in to continue\");\n Phlash::add(\"error\", \"There was a problem processing your request\");\n\n $flashMessages = Phlash::get();\n\n $this->assertNotEmpty($flashMessages);\n $this->assertEquals(count($flashMessages), 2);\n $this->assertEquals($flashMessages[0]->id, 0);\n $this->assertEquals($flashMessages[0]->type, \"info\");\n $this->assertEquals($flashMessages[0]->message, \"Please log in to continue\");\n $this->assertEquals($flashMessages[1]->id, 1);\n $this->assertEquals($flashMessages[1]->type, \"error\");\n $this->assertEquals($flashMessages[1]->message, \"There was a problem processing your request\");\n\n Phlash::clear();\n }", "public function testAddMessageFromStringForCurrentRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $flash->addMessageNow('key', 'value');\n\n $messages = $flash->getMessages();\n $this->assertEquals(['value'], $messages['key']);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEmpty($storage['slimFlash']);\n }", "public function testGetMessagesFromPrevRequest()\n {\n $storage = ['slimFlash' => ['Test']];\n $flash = new Messages($storage);\n\n $this->assertEquals(['Test'], $flash->getMessages());\n }", "public function testGetEmptyMessagesFromPrevRequest()\n {\n $storage = [];\n $flash = new Messages($storage);\n\n $this->assertEquals([], $flash->getMessages());\n }", "public function testPutValidMessage () {\n\n\t\t//create a new message\n\t\t$newMessage = new Message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t\t$newMessage->insert($this->getPDO());\n\n\t\t//run a get request to establish session tokens\n\t\t$this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/');\n\n\t\t//grab the data from guzzle and enforce the status match our expectations\n\t\t$response = $this->guzzle->put('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/' . $newMessage->getMessage(),['headers' => ['X-XRF-TOKEN' => $this->getXsrfToken()], 'json' => $newMessage] );\n\t\t$this->assertSame($response->getStatusCode(), 200);\n\t\t$body = $response->getBpdy();\n\t\t$alertLevel = json_decode($body);\n\t\t$this->assertSame(200, $alertLevel->status);\n\n\t}", "public function testSetMessagesForCurrentRequest()\n {\n $storage = ['slimFlash' => [ 'error' => ['An error']]];\n\n $flash = new Messages($storage);\n $flash->addMessageNow('error', 'Another error');\n $flash->addMessageNow('success', 'A success');\n $flash->addMessageNow('info', 'An info');\n\n $messages = $flash->getMessages();\n $this->assertEquals(['An error', 'Another error'], $messages['error']);\n $this->assertEquals(['A success'], $messages['success']);\n $this->assertEquals(['An info'], $messages['info']);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEmpty([], $storage['slimFlash']);\n }", "abstract protected function checkExistingResponse();", "public static function putMessage($personOne, $personTwo, $id)\n{ \n $id = ($id != null?'&id=gt.'.$id:\"\");\n\n $respons = Rest::GET('http://caracal.imada.sdu.dk/app2019/messages?sender=in.(\"'.$personOne.'\",\"'.$personTwo.'\")&receiver=in.(\"'.$personOne.'\",\"'.$personTwo.'\")'.$id.'');\n\n\n \n foreach( json_decode($respons) as $respon)\n { \n \n $body = self::getType($respon->body); \n $timestamp = TimeConverter::convert($respon->stamp); \n\n $message = new Message();\n $message->global_id = $respon->id;\n $message->sender = $respon->sender; \n $message->receiver = $respon->receiver; \n $message->type = $body[0];\n $message->body = $body[1];\n $message->created_at = $timestamp;\n $message->updated_at = $timestamp;\n $message->save(); \n }\n}", "function add($message) { return; }", "public function testPostAuthorizationSubjectBulkadd()\n {\n }", "public function testMessages()\n {\n $message = new PrivateMessage();\n $conversation = new Conversation();\n $this->assertEmpty($conversation->getMessages());\n\n $conversation->addMessage($message);\n $this->assertEquals(new ArrayCollection([$message]), $conversation->getMessages());\n\n $conversation->removeMessage($message);\n $this->assertEmpty($conversation->getMessages());\n }", "public function testGetQuickInboxMessages() {\n \t$this->assertInternalType('array',$this->chatModel->getQuickInboxMessages());\n }", "public function testPostVoicemailMessages()\n {\n }", "public function testAddToNewsLetterFailForIncompleteDetails()\n {\n $request = Request::create('/api/contact/subscribe', 'POST', $this->invalidSubscriber);\n $response = $this->contactController->addToNewsletter($request);\n $this->assertEquals(ResponseMessage::INPUT_ERROR, $response->getData()->message);\n $this->assertObjectHasAttribute('name',$response->getData()->data);\n $this->assertObjectHasAttribute('email',$response->getData()->data);\n $this->assertDatabaseMissing('newsletter_subscribers', $this->invalidSubscriber);\n }", "public function testGetVoicemailQueueMessages()\n {\n }", "protected static function addMessage(stdClass $message) {\n $i = PitSession::get('PitFlash', 'i', 1);\n $msgs = PitSession::get('PitFlash', 'messages', array());\n $msgs[$i] = $message;\n PitSession::set('PitFlash', 'i', $i + 1);\n PitSession::set('PitFlash', 'messages', $msgs);\n }", "public function testAddContactMessageFailForIncompleteDetails()\n {\n $request = Request::create('/api/contact/message', 'POST', $this->invalidContactor);\n $response = $this->contactController->addContactMessage($request);\n $this->assertEquals(ResponseMessage::INPUT_ERROR, $response->getData()->message);\n $this->assertObjectHasAttribute('name',$response->getData()->data);\n $this->assertObjectHasAttribute('email',$response->getData()->data);\n $this->assertObjectHasAttribute('message',$response->getData()->data);\n $this->assertDatabaseMissing('contacts', $this->invalidContactor);\n }", "public function testPayload() {\n $payload = array(\n \"this\" => \"is\",\n \"the\" => \"payload\",\n );\n $response = new Response();\n $response->setPayload($payload);\n $this->assertEquals($payload, $response->payload());\n }", "public function testToJSON() {\n\n\t\t$createMessageRequest = new CreateMessageRequest();\n\n\t\t// Test without the 'application' and 'applicationsGroup' parameters\n\t\ttry {\n\n\t\t\t$createMessageRequest -> toJSON();\n\t\t\t$this -> fail('Must have thrown a PushwooshException !');\n\n\t\t} catch(PushwooshException $pe) {\n\n\t\t\t// Expected\n\n\t\t}\n\n\t\t// Test with both the 'application' and 'applicationsGroup parameters set\n\t\t$createMessageRequest -> setApplication('XXXX-XXXX');\n\t\t$createMessageRequest -> setApplicationsGroup('XXXX-XXXX');\n\n\t\ttry {\n\n\t\t\t$createMessageRequest -> toJSON();\n\t\t\t$this -> fail('Must have thrown a PushwooshException !');\n\n\t\t} catch(PushwooshException $pe) {\n\n\t\t\t// Expected\n\n\t\t}\n\n\t\t// Test without the 'auth' parameter set\n\t\t$createMessageRequest -> setApplicationsGroup(null);\n\n\t\ttry {\n\n\t\t\t$createMessageRequest -> toJSON();\n\t\t\t$this -> fail('Must have thrown a PushwooshException !');\n\n\t\t} catch(PushwooshException $pe) {\n\n\t\t\t// Expected\n\n\t\t}\n\t\t\n\t\t// Test with the 'auth' and 'application' parameters set and no notification\n\t\t$createMessageRequest -> setAuth('XXXX');\n\n\t\t$json = $createMessageRequest -> toJSON();\n\t\t$this -> assertCount(4, $json);\n\t\t$this -> assertTrue(array_key_exists('application', $json));\n\t\t$this -> assertTrue(array_key_exists('applicationsGroup', $json));\n\t\t$this -> assertTrue(array_key_exists('auth', $json));\n\t\t$this -> assertTrue(array_key_exists('notifications', $json));\n\t\t$this -> assertEquals('XXXX-XXXX', $json['application']);\n\t\t$this -> assertNull($json['applicationsGroup']);\n\t\t$this -> assertEquals('XXXX', $json['auth']);\n\t\t$this -> assertCount(0, $json['notifications']);\n\t\t\n\t\t// Test with one notificiation with only a 'content' field\n\t\t$notification = Notification::create();\n\t\t$notification -> setContent('CONTENT');\n\t\t$createMessageRequest -> addNotification($notification);\n\t\t\n\t\t$json = $createMessageRequest -> toJSON();\n\t\t$this -> assertCount(4, $json);\n\t\t$this -> assertTrue(array_key_exists('application', $json));\n\t\t$this -> assertTrue(array_key_exists('applicationsGroup', $json));\n\t\t$this -> assertTrue(array_key_exists('auth', $json));\n\t\t$this -> assertTrue(array_key_exists('notifications', $json));\n\t\t$this -> assertEquals('XXXX-XXXX', $json['application']);\n\t\t$this -> assertNull($json['applicationsGroup']);\n\t\t$this -> assertEquals('XXXX', $json['auth']);\n\t\t$this -> assertCount(1, $json['notifications']);\n\t\t$this -> assertCount(3, $json['notifications'][0]);\n\t\t$this -> assertTrue(array_key_exists('send_date', $json['notifications'][0]));\n\t\t$this -> assertTrue($json['notifications'][0]['ignore_user_timezone']);\n\t\t$this -> assertEquals('CONTENT', $json['notifications'][0]['content']);\n\t\t\n\t\t// Test with one notification having additional data\n\t\t$notification -> setDataParameter('DATA_PARAMETER_1', 'DATA_PARAMETER_1_VALUE');\n\t\t$notification -> setDataParameter('DATA_PARAMETER_2', 'DATA_PARAMETER_2_VALUE');\n\t\t$notification -> setDataParameter('DATA_PARAMETER_3', 'DATA_PARAMETER_3_VALUE');\n\t\t\n\t\t$json = $createMessageRequest -> toJSON();\n\t\t$this -> assertCount(4, $json);\n\t\t$this -> assertTrue(array_key_exists('application', $json));\n\t\t$this -> assertTrue(array_key_exists('applicationsGroup', $json));\n\t\t$this -> assertTrue(array_key_exists('auth', $json));\n\t\t$this -> assertTrue(array_key_exists('notifications', $json));\n\t\t$this -> assertEquals('XXXX-XXXX', $json['application']);\n\t\t$this -> assertNull($json['applicationsGroup']);\n\t\t$this -> assertEquals('XXXX', $json['auth']);\n\t\t$this -> assertCount(1, $json['notifications']);\n\t\t$this -> assertCount(4, $json['notifications'][0]);\n\t\t$this -> assertTrue(array_key_exists('send_date', $json['notifications'][0]));\n\t\t$this -> assertTrue($json['notifications'][0]['ignore_user_timezone']);\n\t\t$this -> assertEquals('CONTENT', $json['notifications'][0]['content']);\n\t\t$this -> assertCount(3, $json['notifications'][0]['data']);\n\t\t$this -> assertEquals('DATA_PARAMETER_1_VALUE', $json['notifications'][0]['data']['DATA_PARAMETER_1']);\n\t\t$this -> assertEquals('DATA_PARAMETER_2_VALUE', $json['notifications'][0]['data']['DATA_PARAMETER_2']);\n\t\t$this -> assertEquals('DATA_PARAMETER_3_VALUE', $json['notifications'][0]['data']['DATA_PARAMETER_3']);\n\n\t\t// Test with one notification hacing additional data and devices\n\t\t$notification -> addDevice('DEVICE_TOKEN_1');\n\t\t$notification -> addDevice('DEVICE_TOKEN_2');\n\t\t$notification -> addDevice('DEVICE_TOKEN_3');\n\n\t\t$json = $createMessageRequest -> toJSON();\n\t\t$this -> assertCount(4, $json);\n\t\t$this -> assertTrue(array_key_exists('application', $json));\n\t\t$this -> assertTrue(array_key_exists('applicationsGroup', $json));\n\t\t$this -> assertTrue(array_key_exists('auth', $json));\n\t\t$this -> assertTrue(array_key_exists('notifications', $json));\n\t\t$this -> assertEquals('XXXX-XXXX', $json['application']);\n\t\t$this -> assertNull($json['applicationsGroup']);\n\t\t$this -> assertEquals('XXXX', $json['auth']);\n\t\t$this -> assertCount(1, $json['notifications']);\n\t\t$this -> assertCount(5, $json['notifications'][0]);\n\t\t$this -> assertTrue(array_key_exists('send_date', $json['notifications'][0]));\n\t\t$this -> assertTrue($json['notifications'][0]['ignore_user_timezone']);\n\t\t$this -> assertEquals('CONTENT', $json['notifications'][0]['content']);\n\t\t$this -> assertCount(3, $json['notifications'][0]['data']);\n\t\t$this -> assertEquals('DATA_PARAMETER_1_VALUE', $json['notifications'][0]['data']['DATA_PARAMETER_1']);\n\t\t$this -> assertEquals('DATA_PARAMETER_2_VALUE', $json['notifications'][0]['data']['DATA_PARAMETER_2']);\n\t\t$this -> assertEquals('DATA_PARAMETER_3_VALUE', $json['notifications'][0]['data']['DATA_PARAMETER_3']);\n\t\t$this -> assertCount(3, $json['notifications'][0]['devices']);\n\t\t$this -> assertEquals('DEVICE_TOKEN_1', $json['notifications'][0]['devices'][0]);\n\t\t$this -> assertEquals('DEVICE_TOKEN_2', $json['notifications'][0]['devices'][1]);\n\t\t$this -> assertEquals('DEVICE_TOKEN_3', $json['notifications'][0]['devices'][2]);\n\n\t}", "abstract public function messageObject(BCTObject $to, array $message);", "public function testPostValidMessage(){\n\t\t//get the count of the numbers of rows in the database\n\t\t$numRows = $this->getConnection()->getRowCount(\"message\");\n\n\t\t//create a new message to send\n\t\t$newMessage = new Message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\n\t\t//run a get request to establish session tokens\n\t\t$this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/');\n\n\t\t//Grab the Data from guzzle and enforce the status match our expectations\n\t\t$response = $this->guzzle->post('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/', ['headers' => ['X-XRF-TOKEN' => $this->getXsrfToken()], 'json' => $newMessage]);\n\t\t$this->assertSame($response->getStatusCode(), 200);\n\t\t$body = $response->getBody();\n\t\t$alertLevel = jason_decode($body);\n\t\t$this->assertSame(200, $alertLevel->status);\n\n\t\t//ensure a new row was added to the database\n\t\t$this->assertSame($numRows + 1, $this->getConnection()->getRowCount(\"message\"));\n\t}", "public function testGetFlashArray()\n {\n $expected = array('my_test_flash' => 'flash value', \n 'my_other_flash' => 'flash stuff');\n $this->assertEquals($expected, $this->_req->getFlash());\n }", "public function testAddingAnElementWillReturnTrue()\n {\n $element1 = new \\stdClass();\n $element1->Name = 'EL 2';\n\n $Collection = new \\MySQLExtractor\\Common\\Collection();\n\n $response = $Collection->add($element1);\n $this->assertTrue($response);\n\n $elements = \\PHPUnit_Framework_Assert::readAttribute($Collection, 'elements');\n $this->assertEquals(array($element1), $elements);\n }", "public function testGetValidMessageByListingId(){\n\t\t//create a new message\n\t\t$newMessage =new message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t\t$newMessage->insert($this->getPDO());\n\n\t\t//grab the data from guzzle\n\t\t$response = $this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/' . $newMessage-getMessage());\n\t\t$this->assertSame($response->getStatusCode(),200);\n\t\t$body = $response->getBody();\n\t\t$alertLevel = json_decode ($body);\n\t\t$this->assertSame(200, $alertLevel->status);\n\t}", "public function testExtraObject()\r\n {\r\n $this->_extraTest($this->extra);\r\n }", "public function testMessages()\n {\n $response = $this->json('GET', '/api/messages');\n $response->assertJsonStructure([\n 'messages'=>[\n 'current_page',\n 'data' => [\n [\n 'uid',\n 'sender',\n 'subject',\n 'message',\n 'time_sent',\n 'archived',\n 'read'\n ]\n ],\n 'first_page_url',\n 'from',\n 'last_page',\n 'last_page_url',\n 'next_page_url',\n 'path',\n 'per_page',\n 'prev_page_url',\n 'to',\n 'total'\n ]\n ]);\n }", "public function testGetMessageRequiredParams()\n {\n // Configure HTTP basic authorization: basicAuth\n $config = Configuration::getDefaultConfiguration()\n ->setUsername('YOUR_USERNAME')\n ->setPassword('YOUR_PASSWORD');\n\n $expected_code = 200;\n // Create a mock response\n $expected = new \\Karix\\Model\\MessageListResponse();\n // Create a mock handler\n $mock = new \\GuzzleHttp\\Handler\\MockHandler([\n new \\GuzzleHttp\\Psr7\\Response($expected_code, [], $expected),\n ]);\n $handler = \\GuzzleHttp\\HandlerStack::create($mock);\n $client = new \\GuzzleHttp\\Client(['handler' => $handler]);\n\n $apiInstance = new Api\\MessageApi(\n $client,\n $config\n );\n $direction = \"direction_example\";\n $account_uid = \"account_uid_example\";\n $state = \"state_example\";\n $offset = 0;\n $limit = 10;\n\n }", "public function testAddContactMessageSuccessful()\n {\n $request = Request::create('/api/contact/message', 'POST', $this->validContactor);\n $response = $this->contactController->addContactMessage($request);\n $this->assertEquals(ResponseMessage::CONTACT_SUCCESS, $response->getData()->message);\n $this->assertDatabaseHas('contacts', $this->validContactor);\n }", "public function pullTransientMessage(): object|array;", "function setMessage($message, $type, &$array)\n{\n array_push($array, array(\n 'Message' => $message,\n 'Type' => $type\n ));\n}", "function record_message($message) {\n global $messages;\n array_push($messages, $message);\n}", "public function testNewOrderedQueue_contains() {\n\t\t\t$this->assertFalse($this->oq->contains(new stdClass));\n\t\t}", "public function testToArray(): void\n {\n $file = new FileObject();\n $url = new UrlObject();\n $formParameter = new FormParameterObject();\n\n $body = new RequestBodyObject([\n 'disabled' => false,\n 'file' => $file,\n 'form_parameter' => $formParameter,\n 'mode' => 'file',\n 'raw' => 'test-raw',\n 'url' => $url\n ]);\n\n self::assertEquals([\n 'disabled' => false,\n 'file' => $file,\n 'formdata' => $formParameter,\n 'mode' => 'file',\n 'raw' => 'test-raw',\n 'urlencoded' => $url\n ], $body->toArray());\n }", "public function test_message_can_be_created() {\n\n $this->assertInstanceOf(Message::class, $this->message);\n $this->assertDatabaseHasMessageWithPublicId($this->message->getPublicId());\n\n }", "public function canAddToResult();", "function api_create_response($payload, $status, $message) {\n if (is_numeric($payload)) {\n\n if ($payload == 1)\n $payload = array();\n elseif ($payload == 2)\n $payload = new \\stdClass();\n }\n\n $response_array = array('payload' => $payload, 'status' => $status, 'message' => $message);\n return $response_array;\n}", "function dialogue_is_a_conversation(stdClass $message) {\n if ($message->conversationindex == 1) { // Opener always has index of 1.\n return true;\n }\n return false;\n}", "public function testParticipantsMePut()\n {\n }", "function messages( $array ) {\n\t\t$this->messages_list = $array;\n\t\t}", "public function testCanMakeMessageBasic()\n {\n $opt = new TicketCheckEligibilityOptions([\n 'nrOfRequestedPassengers' => 1,\n 'passengers' => [\n new MPPassenger([\n 'type' => MPPassenger::TYPE_ADULT,\n 'count' => 1\n ])\n ],\n 'flightOptions' => [\n TicketCheckEligibilityOptions::FLIGHTOPT_PUBLISHED,\n ],\n 'ticketNumbers' => [\n '1722300000004'\n ]\n ]);\n\n $msg = new CheckEligibility($opt);\n\n $this->assertCount(1, $msg->numberOfUnit->unitNumberDetail);\n $this->assertEquals(1, $msg->numberOfUnit->unitNumberDetail[0]->numberOfUnits);\n $this->assertEquals(UnitNumberDetail::TYPE_PASS, $msg->numberOfUnit->unitNumberDetail[0]->typeOfUnit);\n\n $this->assertCount(1, $msg->paxReference);\n $this->assertCount(1, $msg->paxReference[0]->ptc);\n $this->assertEquals('ADT', $msg->paxReference[0]->ptc[0]);\n $this->assertCount(1, $msg->paxReference[0]->traveller);\n $this->assertEquals(1, $msg->paxReference[0]->traveller[0]->ref);\n $this->assertNull($msg->paxReference[0]->traveller[0]->infantIndicator);\n\n $this->assertCount(1, $msg->fareOptions->pricingTickInfo->pricingTicketing->priceType);\n $this->assertEquals(\n [\n PricingTicketing::PRICETYPE_PUBLISHEDFARES\n ],\n $msg->fareOptions->pricingTickInfo->pricingTicketing->priceType\n );\n\n $this->assertCount(1, $msg->ticketChangeInfo->ticketNumberDetails->documentDetails);\n $this->assertEquals('1722300000004', $msg->ticketChangeInfo->ticketNumberDetails->documentDetails[0]->number);\n $this->assertEmpty($msg->ticketChangeInfo->ticketRequestedSegments);\n\n $this->assertEmpty($msg->combinationFareFamilies);\n $this->assertNull($msg->customerRef);\n $this->assertEmpty($msg->fareFamilies);\n $this->assertEmpty($msg->feeOption);\n $this->assertEmpty($msg->formOfPaymentByPassenger);\n $this->assertNull($msg->globalOptions);\n $this->assertEmpty($msg->itinerary);\n $this->assertEmpty($msg->officeIdDetails);\n $this->assertEmpty($msg->passengerInfoGrp);\n $this->assertNull($msg->priceToBeat);\n $this->assertEmpty($msg->solutionFamily);\n $this->assertEmpty($msg->taxInfo);\n $this->assertNull($msg->travelFlightInfo);\n }", "abstract protected function processMessage(array $data, array $message) : bool;", "public function testPutVoicemailMessage()\n {\n }", "function addMessage( $message )\n {\n if ( isset($message['errorMessage']) )\n {\n $this->messages[] = array_merge($this->empty_message,$message);\n } else if ( isset($message[0]) && isset($message[0]['errorMessage']) ) {\n foreach ( $message as $m )\n {\n $this->messages[] = array_merge($this->empty_message,$m);\n }\n }\n }", "public function testCheckRequest(): void\n {\n $this->assertTrue(method_exists($this->stack, 'checkOrder'));\n }", "public function testAddToQueue()\n {\n $this->setUpDB(['email']);\n \n $Email = new \\EmailTemplate('test');\n \n // Add the message to queue\n $r = $Email->queue('[email protected]', 'test', 'test');\n \n // get data from DB\n $EmailQueue = new \\EmailQueue();\n $filter = ['too' => '[email protected]'];\n $Collection = $EmailQueue->Get($filter, []);\n \n // asserts\n $this->assertEquals(1, $r);\n $this->assertInstanceOf(\\Collection::class, $Collection);\n $this->assertCount(1, $Collection);\n $Item = $Collection->getItem();\n $this->assertInstanceOf(\\SetterGetter::class, $Item);\n $this->assertEquals('test', $Item->getSubject());\n $this->assertEquals('test', $Item->getBody());\n }", "public function isSent() {}", "public function canAddFieldsToTCATypeAfterExistingOnes() {}", "protected function expectAddEvent()\n {\n $this->eventPublisher->expects($this->once())\n ->method('addEvent')\n ->with(['uuid' => '123']);\n }", "protected function assertPayload(): void\n {\n }", "protected function assertPayload(): void\n {\n }", "protected function assertPayload(): void\n {\n }", "public function testMessageThreadsV2GetMessages()\n {\n }", "public function testParticipantsPost()\n {\n }", "public function hasMsg(){\n return $this->_has(18);\n }", "public function testOrderedQueueArrayAccess_for() {\n\t\t\t$o = array();\n\n\t\t\t// add objects...\n\t\t\t$this->oq[] = $o[] = new stdClass;\n\t\t\t$this->oq[] = $o[] = new stdClass;\n\t\t\t$this->oq[] = $o[] = new stdClass;\n\t\t\t$this->oq[] = $o[] = new stdClass;\n\n\t\t\t// assertions\n\t\t\tfor($i=0;$i<4;$i++) $this->assertSame($o[$i], $this->oq[$i]);\n\t\t}", "function add_message($messages){\n global $messages;\n $messages[] = $messages;\n}", "public function needsVerificationMessage ();", "public function testGetNewInterRequestObject()\n {\n $value = $this->class->get_new_inter_request_object(array());\n\n $this->assertInstanceOf('Lunr\\Corona\\InterRequest', $value);\n }", "public function testGetMessageFromKeyIncludingCurrent()\n {\n $storage = ['slimFlash' => [ 'Test' => ['Test', 'Test2']]];\n $flash = new Messages($storage);\n $flash->addMessageNow('Test', 'Test3');\n\n $messages = $flash->getMessages();\n\n $this->assertEquals(['Test', 'Test2','Test3'], $flash->getMessage('Test'));\n }", "public function testValidReturnOfUserSentMessages()\n {\n\n $senderuser = User::storeUser([\n 'username' => 'testo',\n 'email' => '[email protected]',\n 'password' => '123456789'\n ]);\n\n $token = auth()->login($senderuser);\n $headers = [$token];\n\n $receiveruser1 = User::storeUser([\n 'username' => 'testoo',\n 'email' => '[email protected]',\n 'password' => '123456789'\n ]);\n\n $receiveruser2 = User::storeUser([\n 'username' => 'testooo',\n 'email' => '[email protected]',\n 'password' => '123456789'\n ]);\n\n\n \n $message1= Message::createDummyMessage($senderuser->username, $receiveruser1->username, 'test_hii1', 'test_subject');\n\n\n $message2= Message::createDummyMessage($senderuser->username, $receiveruser2->username, 'test_hii2', 'test_subject');\n\n\n\n $this->json('GET', 'api/v1/auth/viewUserSentMessages', [], $headers)\n ->assertStatus(200)\n ->assertJson([\n \"success\" => \"true\",\n \"messages\" => [[\n \t\"receiver_name\" => \"testoo\",\n \t \"receiver_photo\" => null,\n \"message_subject\" => 'test_subject',\n \t \"message_content\" => \"test_hii1\",\n \"message_id\" => $message1->message_id,\n \"duration\" => link::duration($message1->message_date)\n\n ],[\n \t\"receiver_name\" => \"testooo\",\n \t \"receiver_photo\" => null,\n \"message_subject\" => 'test_subject',\n \t \"message_content\" => \"test_hii2\",\n \"message_id\" => $message2->message_id,\n \"duration\" => link::duration($message2->message_date)\n\n ]]\n ]);\n\n\n\n $senderuser->delete();\n $receiveruser1->delete();\n $receiveruser2->delete();\n }", "public function testAddToNewsLetterFailForDuplicateEmail()\n {\n $request = Request::create('/api/contact/subscribe', 'POST', $this->validSubscriber);\n $response = $this->contactController->addToNewsletter($request);\n $response2 = $this->contactController->addToNewsletter($request);\n\n $this->assertEquals(ResponseMessage::INPUT_ERROR, $response2->getData()->message);\n $this->assertObjectHasAttribute('email',$response2->getData()->data);\n }", "public function isEntityFilled(HistoricSmsList $object);", "public function testGetWebhookQueueAccountMessage()\n {\n $container = [];\n $sw = $this->createMockedSmartwaiver($container, APISuccessResponses::webhookQueueAccountMessage(), 3);\n\n $webhook = $sw->getWebhookQueueAccountMessage();\n $this->assertInstanceOf(SmartwaiverWebhookMessage::class, $webhook);\n\n $webhook = $sw->getWebhookQueueAccountMessage(false);\n $this->assertInstanceOf(SmartwaiverWebhookMessage::class, $webhook);\n\n $webhook = $sw->getWebhookQueueAccountMessage(true);\n $this->assertInstanceOf(SmartwaiverWebhookMessage::class, $webhook);\n\n $this->checkGetRequests($container, [\n '/v4/webhooks/queues/account?delete=false',\n '/v4/webhooks/queues/account?delete=false',\n '/v4/webhooks/queues/account?delete=true'\n ]);\n }", "public static function shouldReceive()\n {\n }", "public static function shouldReceive()\n {\n }", "public static function shouldReceive()\n {\n }", "public static function shouldReceive()\n {\n }", "public function testMessageThreadsV2GetMessages0()\n {\n }", "public function testCanAdd()\n {\n self::$apcu = [];\n $this->assertTrue($this->sut->add('myKey','myValue'));\n }", "private function changelog_validate_object () {\n\t\t# set valid objects\n\t\t$objects = array(\n\t\t\t\t\t\t\"ip_addr\",\n\t\t\t\t\t\t\"subnet\",\n\t\t\t\t\t\t\"section\"\n\t\t\t\t\t\t);\n\t\t# check\n\t\treturn in_array($this->object_type, $objects) ? true : false;\n\t}", "public function testGetVoicemailGroupMessages()\n {\n }", "public function test_updateMessage() {\n\n }", "public function hasMessage(): bool\n {\n return $this->hasJson('message');\n }", "public function testGetVoicemailMeMessages()\n {\n }", "public function testProtosGet()\n {\n }", "function add_success(&$log, $message){\n if(!is_array($log)) return;\n\n $log[] = array(\n \"type\" => \"success\",\n \"message\" => $message\n );\n}", "public function checkSubExtObj() {}", "public function testGetVoicemailMessages()\n {\n }", "public function test_should_deliver_already_processed() {\n\n\t\t$webhook = LLMS_REST_API()->webhooks()->create( array(\n\t\t\t'delivery_url' => 'https://mock.tld',\n\t\t\t'topic' => 'student.created',\n\t\t\t'status' => 'active',\n\t\t) );\n\n\t\t$student_id = $this->factory->student->create();\n\n\t\t// Not processed.\n\t\t$this->assertTrue( LLMS_Unit_Test_Util::call_method( $webhook, 'should_deliver', array( array( $student_id ) ) ) );\n\n\t\t// Process the hook.\n\t\t$webhook->process_hook( $student_id );\n\n\t\t// Processed.\n\t\t$this->assertFalse( LLMS_Unit_Test_Util::call_method( $webhook, 'should_deliver', array( array( $student_id ) ) ) );\n\n\t}", "public function willProcessRequest(array $data) {\n }", "public function testPatchVoicemailMessage()\n {\n }", "public function testSerialize()\n {\n $hostname = 'example.org';\n $json = [];\n\n // ban\n $json[] = (string) (new Request\\Ban($hostname, 'whatever'));\n $json[] = (string) (new Request\\Ban($hostname, ['still', 'flying']));\n // ban.url\n $json[] = (string) (new Request\\BanURL($hostname, 'whatever'));\n $json[] = (string) (new Request\\BanURL($hostname, ['still', 'flying']));\n // purge\n $json[] = (string) (new Request\\Purge($hostname, 'whatever'));\n $json[] = (string) (new Request\\Purge($hostname, ['still', 'flying']));\n // xkey\n $json[] = (string) (new Request\\Xkey($hostname, 'whatever'));\n $json[] = (string) (new Request\\Xkey($hostname, ['still', 'flying']));\n // xkey.soft\n $json[] = (string) (new Request\\XkeySoft($hostname, 'whatever'));\n $json[] = (string) (new Request\\XkeySoft($hostname, ['still', 'flying']));\n\n // validate json\n foreach ($json as $request) {\n $validator = new \\JsonSchema\\Validator();\n $schema = json_decode(\n file_get_contents(__DIR__.'/files/request.json'),\n JSON_THROW_ON_ERROR\n );\n\n $data = json_decode($request);\n $validator->validate($data, $schema);\n self::assertTrue($validator->isValid());\n }\n }", "public function testPostInvalidMessage(){\n\t\t//test to make sure non-admin can not post\n\t\t//sign out as admin, log-in as a voulenteer\n\t\t$logout = $this->guzzle-get('https://bootcamp-coders.cnm.edu/~cberaun2/bread-basket/public_html/php/controllers/sign-out-controller.php');\n\n\t\t$volLogin = new stdClass();\n\t\t$volLogin->email = \"[email protected]\";\n\t\t$volLogin->password = \"passwordabc\";\n\t\t$login = $this->guzzle->post('https://bootcamp-coders.cnm,edu/~cberaun2/bread-basket/public_html/php/controllers/sign-out-controller.php', ['allow_redirects' => ['strict' => true], 'json' => $volLogin, 'headers' => ['X-XSRF_TOKEN' => $this->token]]);\n\n\t\t$message = new Message(null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t\t$response = $this->guzzle->post('https://bootcamp-coders.cnm,edu/~cberaun2/bread-basket/public_html/php/api/message', ['allow_redirects' => ['strict' => true], 'json' => $volLogin, 'headers' => ['X-XSRF_TOKEN' => $this->token]]);\n\n\t\t$this->assertSame($response->getStatusCode(), 200);\n\t\t$body = $response->getBody();\n\t\t$retrievedMess = json_decode($body);\n\n\t\t//Make sure the organization was not entered into the databaase\n\t\t$shouldNotExist = Message::getMessageByMessageId($this->getPDO(), $this->VALID_MESSAGE_ID);\n\t\t$this->assertSame($shouldNotExist->getSize(), 0);\n\n\t\t//makeSure 401 error is returned for trying to access an admin method as a volunteer\n\t\t$this->asserSame(401, $retrievedMess->status);\n\t}", "public function test_peekMessage() {\n\n }", "public function testInsertARequestType()\r\n {\r\n $requestTypeController = new RequestTypeController();\r\n \r\n $beforeInsertingANewRequestType = $requestTypeController->GetRequestTypes();\r\n \r\n $requestTypeController->InsertARequestType(\"Test New Type\");\r\n \r\n $afterInsertingANewRequestType = $requestTypeController->GetRequestTypes();\r\n \r\n $this->assertEquals(count($beforeInsertingANewRequestType)+1,count($afterInsertingANewRequestType));\r\n }", "public function testAdd()\n {\n Phlash::add(\"info\", \"Please log in to continue\");\n\n $flashMessages = Phlash::get();\n\n $this->assertNotEmpty($flashMessages);\n $this->assertEquals(count($flashMessages), 1);\n $this->assertEquals($flashMessages[0]->id, 0);\n $this->assertEquals($flashMessages[0]->type, \"info\");\n $this->assertEquals($flashMessages[0]->message, \"Please log in to continue\");\n\n Phlash::clear();\n }", "public function testExistingOfElementInBag()\n {\n $this->populateBag();\n $this->assertTrue($this->bag->has('var1'));\n $this->assertTrue($this->bag->has('var2'));\n $this->assertTrue($this->bag->has('var3'));\n $this->assertFalse($this->bag->has('var 1'));\n $this->assertFalse($this->bag->has('var'));\n $this->assertFalse($this->bag->has('invalid var'));\n }", "public function canAddFieldsToTCATypeBeforeExistingOnes() {}", "public function testGetValidMessagebyMessageId(){\n\t\t//create a new message\n\t\t$newMessage =new message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t\t$newMessage->insert($this->getPDO());\n\n\t\t//grab the data from guzzle\n\t\t$response = $this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/' . $newMessage-getMessage());\n\t\t$this->assertSame($response->getStatusCode(),200);\n\t\t$body = $response->getBody();\n\t\t$alertLevel = json_decode ($body);\n\t\t$this->assertSame(200, $alertLevel->status);\n\t}" ]
[ "0.67530286", "0.65693074", "0.6433161", "0.63650674", "0.63164556", "0.6200107", "0.59128344", "0.58548766", "0.580537", "0.57742155", "0.57338995", "0.5711898", "0.5595448", "0.55055714", "0.54851294", "0.5481527", "0.54220605", "0.5414259", "0.54062873", "0.5383677", "0.537923", "0.5374566", "0.5374418", "0.53218025", "0.5320026", "0.53144455", "0.52907866", "0.5282258", "0.5269052", "0.5260544", "0.523211", "0.52128506", "0.5209604", "0.52001274", "0.51991767", "0.519469", "0.5145749", "0.51280653", "0.5126254", "0.51160437", "0.5111795", "0.51101923", "0.51054686", "0.5094586", "0.50934136", "0.50904423", "0.5084118", "0.50806993", "0.5073168", "0.50540394", "0.5043213", "0.50423074", "0.5036564", "0.5035161", "0.5023048", "0.50176156", "0.50129396", "0.5010567", "0.49990407", "0.49981478", "0.49981478", "0.49981478", "0.4990774", "0.499031", "0.49899864", "0.49896196", "0.49841833", "0.49730006", "0.49610156", "0.49510533", "0.49503842", "0.49499896", "0.49454567", "0.4943426", "0.49396107", "0.49396107", "0.49396107", "0.49396107", "0.49268588", "0.49259967", "0.49254805", "0.49198258", "0.49165532", "0.491504", "0.4908921", "0.49078742", "0.49008667", "0.490027", "0.4896839", "0.48881122", "0.48829612", "0.4879288", "0.4874613", "0.48721823", "0.48707658", "0.4866795", "0.48629305", "0.4862054", "0.48534048", "0.48493376" ]
0.69989586
0
Test get empty messages from previous request
public function testGetEmptyMessagesFromPrevRequest() { $storage = []; $flash = new Messages($storage); $this->assertEquals([], $flash->getMessages()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testGetMessagesFromPrevRequest()\n {\n $storage = ['slimFlash' => ['Test']];\n $flash = new Messages($storage);\n\n $this->assertEquals(['Test'], $flash->getMessages());\n }", "public function testGetWebhookQueueTemplateMessageEmpty()\n {\n $container = [];\n $sw = $this->createMockedSmartwaiver($container, APISuccessResponses::webhookQueueTemplateMessageNull());\n\n $webhook = $sw->getWebhookQueueTemplateMessage('TestingGUID');\n $this->assertNull($webhook);\n\n $this->checkGetRequests($container, ['/v4/webhooks/queues/template/TestingGUID?delete=false']);\n }", "public function testMessages()\n {\n $response = $this->json('GET', '/api/messages');\n $response->assertJsonStructure([\n 'messages'=>[\n 'current_page',\n 'data' => [\n [\n 'uid',\n 'sender',\n 'subject',\n 'message',\n 'time_sent',\n 'archived',\n 'read'\n ]\n ],\n 'first_page_url',\n 'from',\n 'last_page',\n 'last_page_url',\n 'next_page_url',\n 'path',\n 'per_page',\n 'prev_page_url',\n 'to',\n 'total'\n ]\n ]);\n }", "public function testGetWebhookQueueAccountMessageEmpty()\n {\n $container = [];\n $sw = $this->createMockedSmartwaiver($container, APISuccessResponses::webhookQueueAccountMessageNull());\n\n $webhook = $sw->getWebhookQueueAccountMessage();\n $this->assertNull($webhook);\n\n $this->checkGetRequests($container, ['/v4/webhooks/queues/account?delete=false']);\n }", "public function is_there_any_msg()\n\t{\n\t\tif(isset($_SESSION[\"message\"]))\n\t\t{\n\t\t\t$this->_message = $_SESSION[\"message\"];\n\t\t\tunset($_SESSION[\"message\"]);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->_message=\"\";\n\t\t}\n\t}", "public function testPendingValidationNoMapping()\n {\n $this->executeCommand();\n $this->assertCount(0, $this->validateReceiver->getSent());\n $this->assertCount(0, $this->captureReceiver->getSent());\n $this->assertCount(0, $this->cancelReceiver->getSent());\n }", "public function getMessages() {}", "public function getMessages() {}", "public function testListAllMessages()\n {\n $data = self::$ctnClient1->listMessages([\n 'startDate' => self::$testStartDate\n ]);\n\n $this->assertGreaterThanOrEqual(2, $data->msgCount);\n $this->assertFalse($data->hasMore);\n }", "function isEmpty(){\r\n if (sizeof($this->messages) == 0){\r\n return true;\r\n }\r\n return false;\r\n }", "public function testMessageThreadsV2GetMessages0()\n {\n }", "public function testMessages() {\n $result = new Hostingcheck_Result_Info();\n $this->assertEquals(array(), $result->messages());\n $this->assertFalse($result->hasMessages());\n\n $messages = array(\n new Hostingcheck_Message('Foo message'),\n new Hostingcheck_Message('Bar Message'),\n );\n $result = new Hostingcheck_Result_Info($messages);\n $this->assertEquals($messages, $result->messages());\n\n $this->assertTrue($result->hasMessages());\n }", "public function testGetAllMessages()\n {\n // Récupération des containers\n $appartmentRepository = $this->getContainer()->get(AppartmentRepository::class);\n $messageRepository = $this->getContainer()->get(MessageRepository::class);\n $entityManager = $this->getContainer()->get(EntityManagerInterface::class);\n $notificationService = $this->getContainer()->get(NotificationService::class);\n $templating = $this->getContainer()->get(\\Twig_Environment::class);\n\n $MessageService = new MessageService($appartmentRepository, $messageRepository, $entityManager, $notificationService, $templating);\n\n $result = $MessageService->getAllMessages($this->getUser());\n\n $this->assertArrayHasKey('appartments', $result);\n $this->assertArrayHasKey('count', $result);\n $this->assertEquals(0, $result['count']);\n }", "public function testValidReturnOfUserSentMessages()\n {\n\n $senderuser = User::storeUser([\n 'username' => 'testo',\n 'email' => '[email protected]',\n 'password' => '123456789'\n ]);\n\n $token = auth()->login($senderuser);\n $headers = [$token];\n\n $receiveruser1 = User::storeUser([\n 'username' => 'testoo',\n 'email' => '[email protected]',\n 'password' => '123456789'\n ]);\n\n $receiveruser2 = User::storeUser([\n 'username' => 'testooo',\n 'email' => '[email protected]',\n 'password' => '123456789'\n ]);\n\n\n \n $message1= Message::createDummyMessage($senderuser->username, $receiveruser1->username, 'test_hii1', 'test_subject');\n\n\n $message2= Message::createDummyMessage($senderuser->username, $receiveruser2->username, 'test_hii2', 'test_subject');\n\n\n\n $this->json('GET', 'api/v1/auth/viewUserSentMessages', [], $headers)\n ->assertStatus(200)\n ->assertJson([\n \"success\" => \"true\",\n \"messages\" => [[\n \t\"receiver_name\" => \"testoo\",\n \t \"receiver_photo\" => null,\n \"message_subject\" => 'test_subject',\n \t \"message_content\" => \"test_hii1\",\n \"message_id\" => $message1->message_id,\n \"duration\" => link::duration($message1->message_date)\n\n ],[\n \t\"receiver_name\" => \"testooo\",\n \t \"receiver_photo\" => null,\n \"message_subject\" => 'test_subject',\n \t \"message_content\" => \"test_hii2\",\n \"message_id\" => $message2->message_id,\n \"duration\" => link::duration($message2->message_date)\n\n ]]\n ]);\n\n\n\n $senderuser->delete();\n $receiveruser1->delete();\n $receiveruser2->delete();\n }", "public function testListFirstMessage()\n {\n $data = self::$ctnClient1->listMessages([\n 'startDate' => self::$testStartDate\n ], 1);\n\n $this->assertEquals(1, $data->msgCount);\n $this->assertTrue($data->hasMore);\n }", "public function testFromNoContentResponse() : void {\n $this->assertEmpty(Result::fromResponse(Response::fromName(\"no content\"))->toArray());\n }", "public function getMessages(){ }", "public function testShowEmptyMessages() \r\n {\r\n $render = $this->flash->show();\r\n $this->assertEquals(false, $render);\r\n }", "public function testUnauthorizedReturnOfUserSentMessages()\n {\n\n $senderuser = User::storeUser([\n 'username' => 'testo',\n 'email' => '[email protected]',\n 'password' => '123456789'\n ]);\n\n $token = auth()->login($senderuser);\n $headers = [$token];\n auth()->logout();\n\n $receiveruser1 = User::storeUser([\n 'username' => 'testoo',\n 'email' => '[email protected]',\n 'password' => '123456789'\n ]);\n\n $receiveruser2 = User::storeUser([\n 'username' => 'testooo',\n 'email' => '[email protected]',\n 'password' => '123456789'\n ]);\n\n\n $message1= Message::createDummyMessage($senderuser->username, $receiveruser1->username, 'test_hii1', 'test_subject');\n\n\n $message2= Message::createDummyMessage($senderuser->username, $receiveruser2->username, 'test_hii2', 'test_subject');\n\n\n\n $this->json('GET', 'api/v1/auth/viewUserSentMessages', [], $headers)\n ->assertStatus(401)\n ->assertJson([\n \"success\" => \"false\",\n \"error\" => \"UnAuthorized\"\n ]);\n\n $senderuser->delete();\n $receiveruser1->delete();\n $receiveruser2->delete();\n }", "function messageNoUsers()\n {\n $this->get('/usuarios?empty')\n ->assertStatus(200)\n ->assertSee('No hay usuarios registrados');\n }", "public function testFailContentEmpty()\n {\n $request = Request::create(\n '/test',\n 'POST',\n [],\n [],\n [],\n [],\n null\n );\n\n $this->expectException(JsonRpcRequestException::class);\n $this->expectExceptionMessage('Request content is null');\n\n new JsonRpcRequest($request);\n }", "public function testGetDefaultMessageIfNoMatchingValueFoundInMessagesList()\n {\n $this->translator->load();\n $this->assertEquals('default_value', $this->translator->get('invalid_message_key', 'default_value'));\n }", "public function test_getAllMessages() {\n\n }", "public function testMessage0()\n{\n\n $actual = $this->response->message();\n $expected = null; // TODO: Expected value here\n $this->assertEquals($expected, $actual);\n}", "public function testMessages()\n {\n $message = new PrivateMessage();\n $conversation = new Conversation();\n $this->assertEmpty($conversation->getMessages());\n\n $conversation->addMessage($message);\n $this->assertEquals(new ArrayCollection([$message]), $conversation->getMessages());\n\n $conversation->removeMessage($message);\n $this->assertEmpty($conversation->getMessages());\n }", "public function testAddMessageFromArrayForCurrentRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $formData = [\n 'username' => 'Scooby Doo',\n 'emailAddress' => '[email protected]',\n ];\n\n $flash->addMessageNow('old', $formData);\n\n $messages = $flash->getMessages();\n $this->assertEquals($formData, $messages['old'][0]);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEmpty($storage['slimFlash']);\n }", "public function testMessageThreadsV2GetMessages()\n {\n }", "public function test_get_user_messages_filtered(): void\n {\n $request = GroupRequest::ofUserName(self::DEFAULT_GROUP_DEEPLINK);\n $this->resolve($request, function (?int $groupId, ?int $accessHash) {\n $count = 0;\n $handler = function (?MessageModel $message = null) use (&$count) {\n if ($message) {\n $this->assertEquals('qweq', $message->getText());\n $count++;\n }\n };\n $client = new GroupMessagesScenario(\n new GroupId($groupId, $accessHash),\n $this->clientGenerator,\n new OptionalDateRange(time()),\n $handler,\n self::USERNAME\n );\n $client->setTimeout(self::TIMEOUT);\n $client->startActions();\n $this->assertEquals(0, $count);\n });\n }", "public function testSetMessagesForNextRequest()\n {\n $storage = [];\n \n $flash = new Messages($storage);\n $flash->addMessage('Test', 'Test');\n $flash->addMessage('Test', 'Test2');\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEquals(['Test', 'Test2'], $storage['slimFlash']['Test']);\n }", "public function any(): bool\n {\n return !empty($this->messages);\n }", "public function testSetMessagesForCurrentRequest()\n {\n $storage = ['slimFlash' => [ 'error' => ['An error']]];\n\n $flash = new Messages($storage);\n $flash->addMessageNow('error', 'Another error');\n $flash->addMessageNow('success', 'A success');\n $flash->addMessageNow('info', 'An info');\n\n $messages = $flash->getMessages();\n $this->assertEquals(['An error', 'Another error'], $messages['error']);\n $this->assertEquals(['A success'], $messages['success']);\n $this->assertEquals(['An info'], $messages['info']);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEmpty([], $storage['slimFlash']);\n }", "public function testAddMessageFromStringForCurrentRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $flash->addMessageNow('key', 'value');\n\n $messages = $flash->getMessages();\n $this->assertEquals(['value'], $messages['key']);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEmpty($storage['slimFlash']);\n }", "public function testAddContactMessageFailForIncompleteDetails()\n {\n $request = Request::create('/api/contact/message', 'POST', $this->invalidContactor);\n $response = $this->contactController->addContactMessage($request);\n $this->assertEquals(ResponseMessage::INPUT_ERROR, $response->getData()->message);\n $this->assertObjectHasAttribute('name',$response->getData()->data);\n $this->assertObjectHasAttribute('email',$response->getData()->data);\n $this->assertObjectHasAttribute('message',$response->getData()->data);\n $this->assertDatabaseMissing('contacts', $this->invalidContactor);\n }", "public function testGetMessageRequiredParams()\n {\n // Configure HTTP basic authorization: basicAuth\n $config = Configuration::getDefaultConfiguration()\n ->setUsername('YOUR_USERNAME')\n ->setPassword('YOUR_PASSWORD');\n\n $expected_code = 200;\n // Create a mock response\n $expected = new \\Karix\\Model\\MessageListResponse();\n // Create a mock handler\n $mock = new \\GuzzleHttp\\Handler\\MockHandler([\n new \\GuzzleHttp\\Psr7\\Response($expected_code, [], $expected),\n ]);\n $handler = \\GuzzleHttp\\HandlerStack::create($mock);\n $client = new \\GuzzleHttp\\Client(['handler' => $handler]);\n\n $apiInstance = new Api\\MessageApi(\n $client,\n $config\n );\n $direction = \"direction_example\";\n $account_uid = \"account_uid_example\";\n $state = \"state_example\";\n $offset = 0;\n $limit = 10;\n\n }", "public function testSendFirstMessage()\n {\n $data = [\n 'message' => Str::random('50'),\n ];\n\n $this->post(route('api.send.message'), $data)\n ->assertStatus(201)\n ->assertJson(['success' => true, 'text' => $data['text']]);\n }", "public function testGetValidMessageByMessageText(){\n\t\t//create a new message\n\t\t$newMessage =new message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t\t$newMessage->insert($this->getPDO());\n\n\t\t//grab the data from guzzle\n\t\t$response = $this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/' . $newMessage-getMessage());\n\t\t$this->assertSame($response->getStatusCode(),200);\n\t\t$body = $response->getBody();\n\t\t$alertLevel = json_decode ($body);\n\t\t$this->assertSame(200, $alertLevel->status);\n\t}", "public function messages();", "public function messages();", "public function messages();", "public static function hasMessages() {\n\t return (!empty(self::$messages));\n\t}", "public function getMessages();", "public function getMessages();", "public function getMessages();", "public function getMessages();", "public function getMessages();", "public function getMessages();", "public function getMessages();", "public function testPostInvalidMessage(){\n\t\t//test to make sure non-admin can not post\n\t\t//sign out as admin, log-in as a voulenteer\n\t\t$logout = $this->guzzle-get('https://bootcamp-coders.cnm.edu/~cberaun2/bread-basket/public_html/php/controllers/sign-out-controller.php');\n\n\t\t$volLogin = new stdClass();\n\t\t$volLogin->email = \"[email protected]\";\n\t\t$volLogin->password = \"passwordabc\";\n\t\t$login = $this->guzzle->post('https://bootcamp-coders.cnm,edu/~cberaun2/bread-basket/public_html/php/controllers/sign-out-controller.php', ['allow_redirects' => ['strict' => true], 'json' => $volLogin, 'headers' => ['X-XSRF_TOKEN' => $this->token]]);\n\n\t\t$message = new Message(null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t\t$response = $this->guzzle->post('https://bootcamp-coders.cnm,edu/~cberaun2/bread-basket/public_html/php/api/message', ['allow_redirects' => ['strict' => true], 'json' => $volLogin, 'headers' => ['X-XSRF_TOKEN' => $this->token]]);\n\n\t\t$this->assertSame($response->getStatusCode(), 200);\n\t\t$body = $response->getBody();\n\t\t$retrievedMess = json_decode($body);\n\n\t\t//Make sure the organization was not entered into the databaase\n\t\t$shouldNotExist = Message::getMessageByMessageId($this->getPDO(), $this->VALID_MESSAGE_ID);\n\t\t$this->assertSame($shouldNotExist->getSize(), 0);\n\n\t\t//makeSure 401 error is returned for trying to access an admin method as a volunteer\n\t\t$this->asserSame(401, $retrievedMess->status);\n\t}", "public function clear(){\r\n\t\t$this->_init_messages();\r\n\t}", "public function clearMsg() {\n\t\t$_SESSION['msg'] = null;\n\t}", "public function testGetEmptyErrorMessagesBeforeRunningValidation()\n {\n $this->assertEquals([], $this->validator->errors());\n }", "public function testClear()\n {\n Phlash::add(\"info\", \"Please log in to continue\");\n\n Phlash::clear();\n\n $flashMessages = Phlash::get();\n\n $this->assertFalse($flashMessages);\n }", "public function test_all_item_listed_or_no_listed_items_message_is_displayed()\n {\n $response = $this->get('/');\n if($response->assertSeeText(\"Details\")){\n $response->assertDontSeeText(\"Sorry not items have been listed yet. Please check back later.\");\n } else {\n $response->assertSeeText(\"Sorry not items have been listed yet. Please check back later.\");\n }\n }", "function printMessages()\n {\n //check if messages buffer contain any values\n if(isset($_SESSION['msg']))\n {\n echo \"{$_SESSION['msg']}\";\n unset($_SESSION['msg']);\n }\n }", "private function check_message ()\n\t{\t\tif (isset($_SESSION['message']))\n\t\t{\n\t\t\t// Add it as an attribute and erase the stored version\n\t\t\t$this->message = $_SESSION['message'];\n\t\t\tunset($_SESSION['message']);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->message = \"\";\n\t\t}\n\t}", "private function check_message(){\t\t\tif(isset($_SESSION['message'])){\r\n\t\t\t\t// Add it as an attribute and erase the stored version\r\n\t\t\t\t\r\n\t\t\t\t$this->message = $_SESSION['message'];\r\n\t\t\t\tunset($_SESSION['message']);\r\n\t\t\t}else{\r\n\t\t\t\t$this->message=\"\";\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t\r\n\t\t}", "public function isSent() {}", "public function testGetInvalidMessageByMessageText(){\n\t\t//create a new message\n\t\t$newMessage =new message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t\t$newMessage->insert($this->getPDO());\n\n\t\t//grab the data from guzzle\n\t\t$response = $this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/' . $newMessage-getMessage());\n\t\t$this->assertSame($response->getStatusCode(),200);\n\t\t$body = $response->getBody();\n\t\t$alertLevel = json_decode ($body);\n\t\t$this->assertSame(200, $alertLevel->status);\n\t}", "public function testForm() {\n $this->controller->process();\n $errors = $this->controller->getPlaceholder('loginfp.errors');\n $this->assertEmpty($errors);\n $this->assertEquals(1,$this->controller->emailsSent);\n }", "public function testMessageFeeEmpty()\n {\n $message = new Message();\n // leave $message empty!\n\n $expectFee = 0;\n $actualFee = Fee::calculateForMessage($message);\n\n $this->assertEquals($expectFee, $actualFee);\n }", "public function messages() {\n if (! $this->message) {\n $this->passes();\n }\n return $this->message;\n }", "public function testGetWebhookQueueTemplateMessage()\n {\n $container = [];\n $sw = $this->createMockedSmartwaiver($container, APISuccessResponses::webhookQueueTemplateMessage(), 3);\n\n $webhook = $sw->getWebhookQueueTemplateMessage('TestingGUID');\n $this->assertInstanceOf(SmartwaiverWebhookMessage::class, $webhook);\n\n $webhook = $sw->getWebhookQueueTemplateMessage('TestingGUID', false);\n $this->assertInstanceOf(SmartwaiverWebhookMessage::class, $webhook);\n\n $webhook = $sw->getWebhookQueueTemplateMessage('TestingGUID', true);\n $this->assertInstanceOf(SmartwaiverWebhookMessage::class, $webhook);\n\n $this->checkGetRequests($container, [\n '/v4/webhooks/queues/template/TestingGUID?delete=false',\n '/v4/webhooks/queues/template/TestingGUID?delete=false',\n '/v4/webhooks/queues/template/TestingGUID?delete=true'\n ]);\n }", "public function testGetMessage()\n {\n // Configure HTTP basic authorization: basicAuth\n $config = Configuration::getDefaultConfiguration()\n ->setUsername('YOUR_USERNAME')\n ->setPassword('YOUR_PASSWORD');\n\n $expected_code = 200;\n // Create a mock response\n $expected = new \\Karix\\Model\\MessageListResponse();\n // Create a mock handler\n $mock = new \\GuzzleHttp\\Handler\\MockHandler([\n new \\GuzzleHttp\\Psr7\\Response($expected_code, [], $expected),\n ]);\n $handler = \\GuzzleHttp\\HandlerStack::create($mock);\n $client = new \\GuzzleHttp\\Client(['handler' => $handler]);\n\n $apiInstance = new Api\\MessageApi(\n $client,\n $config\n );\n $direction = \"direction_example\";\n $account_uid = \"account_uid_example\";\n $state = \"state_example\";\n $offset = 0;\n $limit = 10;\n\n try {\n $result = $apiInstance->getMessage($direction, $account_uid, $state, $offset, $limit);\n $this->assertEquals($expected, $result);\n } catch (Exception $e) {\n $this->fail(\"Exception when calling MessageApi->getMessage: \".$e->getMessage());\n }\n }", "public function testAddMessageFromObjectForCurrentRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $user = new \\stdClass();\n $user->name = 'Scooby Doo';\n $user->emailAddress = '[email protected]';\n\n $flash->addMessageNow('user', $user);\n\n $messages = $flash->getMessages();\n $this->assertInstanceOf(\\stdClass::class, $messages['user'][0]);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEmpty($storage['slimFlash']);\n }", "public function getMessagesAndFlush() {}", "public function getMessageAction() {\n\n //this will return One message which is inserted first of All exist in Current Queue\n $result = $this->messageQueue->Get();\n $this->code = ($result)? 200 : 404;\n return new \\Symfony\\Component\\HttpFoundation\\Response(json_encode(array('result'=>$result)), $this->code , array(\n 'Content-Type' => 'application/json'\n ));\n }", "public function test_peekMessage() {\n\n }", "function testEmptyResponseBody() {\n\t$config = getConfig();\n\t$root = getRootPath();\n\t\n\t// Get the test page.\n\t$http = new \\AutoHttp\\Http($config);\n\t$page = $http->getPage($root .'/test/pages/http/headersonly.php');\n\t\n\t// Validate basic return structure.\n\tif (!validateResponse($page))\n\t\treturn 'Result array was in a bad format.';\n\t\n\t// Check the test header content.\n\tif (!array_key_exists('X-HttpTestHeader', $page['headers']))\n\t\treturn 'Test header doesn\\'t exist.';\t\t\n\tif ($page['headers']['X-HttpTestHeader'] != 'servertestval')\n\t\treturn 'Test header value wasn\\'t what we were expecting.';\n\t\t\n\t// Check the raw headers.\n\tif (count($page['headersRaw']) < 1 || strpos($page['headersRaw'][0], '200 OK') === false)\n\t\treturn 'Raw headers should contain the HTTP response code.';\n\t\t\n\t// Make sure the body is empty.\n\tif (strlen($page['body']) !== 0)\n\t\treturn 'Response body length should be 0.';\n\t\t\n\treturn true;\n}", "public function clear_messages() {\n\t\t$this->_write_messages( null );\n\t}", "public function testAddMessageFromArrayForNextRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $formData = [\n 'username' => 'Scooby Doo',\n 'emailAddress' => '[email protected]',\n ];\n\n $flash->addMessage('old', $formData);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEquals($formData, $storage['slimFlash']['old'][0]);\n }", "public function testGetQuickInboxMessages() {\n \t$this->assertInternalType('array',$this->chatModel->getQuickInboxMessages());\n }", "public function testGetMessageFromKeyIncludingCurrent()\n {\n $storage = ['slimFlash' => [ 'Test' => ['Test', 'Test2']]];\n $flash = new Messages($storage);\n $flash->addMessageNow('Test', 'Test3');\n\n $messages = $flash->getMessages();\n\n $this->assertEquals(['Test', 'Test2','Test3'], $flash->getMessage('Test'));\n }", "public function test_get_user_messages(): void\n {\n $request = GroupRequest::ofUserName(self::DEFAULT_GROUP_DEEPLINK);\n $this->resolve($request, function (?int $groupId, ?int $accessHash) {\n $count = 0;\n $handler = function (?MessageModel $message = null) use (&$count) {\n if ($message) {\n $this->assertEquals('qweq', $message->getText());\n $count++;\n }\n };\n $client = new GroupMessagesScenario(\n new GroupId($groupId, $accessHash),\n $this->clientGenerator,\n new OptionalDateRange(),\n $handler,\n self::USERNAME\n );\n $client->setTimeout(self::TIMEOUT);\n $client->startActions();\n $this->assertEquals(1, $count);\n });\n }", "public function testAddToNewsLetterFailForIncompleteDetails()\n {\n $request = Request::create('/api/contact/subscribe', 'POST', $this->invalidSubscriber);\n $response = $this->contactController->addToNewsletter($request);\n $this->assertEquals(ResponseMessage::INPUT_ERROR, $response->getData()->message);\n $this->assertObjectHasAttribute('name',$response->getData()->data);\n $this->assertObjectHasAttribute('email',$response->getData()->data);\n $this->assertDatabaseMissing('newsletter_subscribers', $this->invalidSubscriber);\n }", "public function testMessage()\r\n {\r\n\r\n $this->flash->message(\"testMessage\");\r\n $this->assertEquals(\"testMessage\", $_SESSION[\"flash\"][\"messages\"][\"message\"][0]);\r\n\r\n }", "public static function getActionMessage($empty = true){\n if (isset($_SESSION['system_message'])){\n $messages = $_SESSION['system_message'];\n $ret = '';\n if (is_array($messages)) {\n foreach ($messages as $message) {\n $ret.= $message;\n }\n }\n if ($empty) {\n unset($_SESSION['system_message']);\n }\n return $ret;\n }\n return null;\n }", "public function getNewMessageIfExist($request){\n\n $loggedUser = Auth::user()->id;\n $message = Message::where([['user_id','=',$loggedUser],['sender_user_id','=',$request->sender_user_id], ['is_read','=',0]])->get();\n\n $message->load(\"hasUser\", \"hasSender\");\n\n if($message->count() < 1){\n return response()->json(['success'=> 0]);\n }else{\n /**\n * Set view content of the dialog\n */\n $content = \"\";\n $messageIds = [];\n\n foreach ($message as $key => $item){\n /**\n * If message is repeat unset it\n */\n if($item->message == $request->lastMessage){\n unset($message[$key]);\n }\n /**\n * If message == last Message from form the unset it\n */\n\n //get ToDay (Azi)\n $today = Carbon::today('Europe/Moscow');\n $today = $today->format('d.m.y');\n // get hour and minutes\n $time = Carbon::parse($item->created_at);\n $time = $time->format('H:i');\n // get month day and year\n $created_at = Carbon::parse($item->created_at);\n $created_at = $created_at->format('d.m.y');\n\n if($created_at < $today){\n $message[$key]->dateFormat = $created_at.', '.$time;\n }else{\n $message[$key]->dateFormat = $time;\n }\n\n /**\n * Set role\n */\n $userRole = $item->hasSender->load('role_user')->role_user->load(\"role\")->role->alias;\n $userRoleName = $item->hasSender->load('role_user')->role_user->load(\"role\")->role->name;\n\n if($userRole == \"Moderator\" || $userRole == \"Admin\"){\n $message[$key]->hasSender->name = $userRoleName;\n };\n if($this->loggedUser == $item->hasSender->id){\n $message[$key]->hasSender->name = \"Вы\";\n }\n\n if ($item->sender_user_id == $this->loggedUser){\n $message[$key]->iAreSender = 1;\n }\n $avatarLink = strpos($item->hasSender->avatar, '://');\n\n\n $content .= $this->viewDialog($avatarLink, $item->hasSender->avatar, $item->hasSender->name, $item->hasSender->id, $item->dateFormat, $item->message, $item->iAreSender);\n $messageIds[] = $item->id;\n\n }\n /**\n *will the marked that read\n */\n $updated = DB::table('messages')->whereIn('id', $messageIds)->update(['is_read'=>1]);\n\n return response()->json(['success'=> 1, 'message'=>$content, 'updated_read' => $updated, 'senderId'=>$request->sender_user_id]);\n }\n }", "public function hasMsg(){\n return $this->_has(18);\n }", "public function testDefaultFromGetFirstMessageFromKeyIfKeyDoesntExist()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $this->assertEquals('This', $flash->getFirstMessage('Test', 'This'));\n }", "public function testGetStatusMessageWhenNotProvided()\n\t{\n\t\t// to test all the codes we have\n\t\t\n\t\t$fixture = new Apache_Solr_HttpTransport_Response(null, null, null, null, null);\n\t\t$this->assertEquals(\"Communication Error\", $fixture->getStatusMessage(), 'Did not get correct default status message for status code 0');\n\t\t\n\t\t$fixture = new Apache_Solr_HttpTransport_Response(200, null, null, null, null);\n\t\t$this->assertEquals(\"OK\", $fixture->getStatusMessage(), 'Did not get correct default status message for status code 200');\n\t\t\n\t\t$fixture = new Apache_Solr_HttpTransport_Response(400, null, null, null, null);\n\t\t$this->assertEquals(\"Bad Request\", $fixture->getStatusMessage(), 'Did not get correct default status message for status code 400');\n\t\t\n\t\t$fixture = new Apache_Solr_HttpTransport_Response(404, null, null, null, null);\n\t\t$this->assertEquals(\"Not Found\", $fixture->getStatusMessage(), 'Did not get correct default status message for status code 404');\n\t}", "function _reset_wp_mail_messages() {\n global $wp_test_expectations;\n \n $wp_test_expectations['pluggable']['wp_mail_messages'] = array();\n}", "public function testAddWithMultipleMessages()\n {\n Phlash::add(\"info\", \"Please log in to continue\");\n Phlash::add(\"error\", \"There was a problem processing your request\");\n\n $flashMessages = Phlash::get();\n\n $this->assertNotEmpty($flashMessages);\n $this->assertEquals(count($flashMessages), 2);\n $this->assertEquals($flashMessages[0]->id, 0);\n $this->assertEquals($flashMessages[0]->type, \"info\");\n $this->assertEquals($flashMessages[0]->message, \"Please log in to continue\");\n $this->assertEquals($flashMessages[1]->id, 1);\n $this->assertEquals($flashMessages[1]->type, \"error\");\n $this->assertEquals($flashMessages[1]->message, \"There was a problem processing your request\");\n\n Phlash::clear();\n }", "public function clear()\r\n {\r\n $this->messages->clear();\r\n }", "static function getMessages(){\n if(key_exists(MESSAGES, $_REQUEST)){\n return $_REQUEST[MESSAGES];\n }else{\n return array();\n }\n }", "public function testPostVoicemailMessages()\n {\n }", "public function getTestMessages()\n {\n return $this->_testMessages;\n }", "public function testGetVoicemailQueueMessages()\n {\n }", "public function testGetValidMessageByListingId(){\n\t\t//create a new message\n\t\t$newMessage =new message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t\t$newMessage->insert($this->getPDO());\n\n\t\t//grab the data from guzzle\n\t\t$response = $this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/' . $newMessage-getMessage());\n\t\t$this->assertSame($response->getStatusCode(),200);\n\t\t$body = $response->getBody();\n\t\t$alertLevel = json_decode ($body);\n\t\t$this->assertSame(200, $alertLevel->status);\n\t}", "function testRequiredDefaultMessage(){\n\t\t#mdx:required2\n\t\tFlSouto\\ParamFilters::$errmsg_required = 'Cannot be empty';\n\n\t\tParam::get('name')\n\t\t\t->context(['name'=>''])\n\t\t\t->filters()\n\t\t\t\t->required();\n\n\t\t$error = Param::get('name')->process()->error;\n\t\t#/mdx var_dump($error)\n\t\t$this->assertEquals(\"Cannot be empty\", $error);\n\t}", "public function testGetInvalidMessageByListingId(){\n\t\t//create a new message\n\t\t$newMessage =new message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t\t$newMessage->insert($this->getPDO());\n\n\t\t//grab the data from guzzle\n\t\t$response = $this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/' . $newMessage-getMessage());\n\t\t$this->assertSame($response->getStatusCode(),200);\n\t\t$body = $response->getBody();\n\t\t$alertLevel = json_decode ($body);\n\t\t$this->assertSame(200, $alertLevel->status);\n\t}", "public function stub()\n {\n return $this->returnMessage($this->message, $this->hasError);\n }", "public function clear()\n {\n $this->messages = [];\n }", "public function testAddMessageFromAnIntegerForCurrentRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $flash->addMessageNow('key', 46);\n $flash->addMessageNow('key', 48);\n\n $messages = $flash->getMessages();\n $this->assertEquals(['46','48'], $messages['key']);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEmpty($storage['slimFlash']);\n }", "public function testReceiveWithKeyIsEmpty()\n {\n $callback = function (){};\n $eventName = 'bar-foo-testing';\n\n $this->adapter->expects($this->once())->method('receive')\n ->with($eventName, $callback, null);\n\n $this->eventReceiver->receive($eventName, $callback);\n }", "public function empty_response(){\r\n $response['status']=502;\r\n $response['error']=true;\r\n $response['message']='No empty field';\r\n return $response;\r\n }", "public function getMessages(): array;", "public function getMessages(): array;", "public function getMessages(): array;", "public function\n\tclearMessages()\n\t{\n\t\t$this -> m_aStorage = [];\n\t}", "public function testDeleteMessageOkay()\n {\n $this->deleteMessageTest(true);\n }" ]
[ "0.6869914", "0.6421036", "0.6279734", "0.6275319", "0.6217242", "0.6190312", "0.61655146", "0.61655146", "0.6144499", "0.6110451", "0.61057013", "0.6095381", "0.609537", "0.59745735", "0.59645414", "0.59409404", "0.59265304", "0.59264684", "0.59016716", "0.58902115", "0.58838034", "0.58709383", "0.58570457", "0.5855326", "0.583873", "0.58332914", "0.5829861", "0.58270556", "0.58203244", "0.5795603", "0.5792499", "0.5779338", "0.57730025", "0.5762478", "0.57609093", "0.5750783", "0.5727665", "0.5727665", "0.5727665", "0.57247806", "0.57216805", "0.57216805", "0.57216805", "0.57216805", "0.57216805", "0.57216805", "0.57216805", "0.572069", "0.5718938", "0.57134354", "0.570519", "0.57018805", "0.5699465", "0.569114", "0.56885767", "0.56805545", "0.566536", "0.5665096", "0.56598556", "0.56499034", "0.56475765", "0.5631349", "0.5621941", "0.5618625", "0.5618347", "0.5616921", "0.5608848", "0.5608591", "0.56082654", "0.5606016", "0.56011003", "0.55933225", "0.55931413", "0.5591473", "0.55884284", "0.5588416", "0.5586061", "0.55808437", "0.55795556", "0.5576922", "0.5575067", "0.55741626", "0.5572208", "0.5566976", "0.5563449", "0.5562321", "0.5561515", "0.55610204", "0.55525625", "0.5548116", "0.554748", "0.55471766", "0.5541066", "0.5540942", "0.5535228", "0.55334795", "0.55334795", "0.55334795", "0.55284274", "0.552217" ]
0.76954585
0
Test set messages for current request
public function testSetMessagesForCurrentRequest() { $storage = ['slimFlash' => [ 'error' => ['An error']]]; $flash = new Messages($storage); $flash->addMessageNow('error', 'Another error'); $flash->addMessageNow('success', 'A success'); $flash->addMessageNow('info', 'An info'); $messages = $flash->getMessages(); $this->assertEquals(['An error', 'Another error'], $messages['error']); $this->assertEquals(['A success'], $messages['success']); $this->assertEquals(['An info'], $messages['info']); $this->assertArrayHasKey('slimFlash', $storage); $this->assertEmpty([], $storage['slimFlash']); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testSetMessagesForNextRequest()\n {\n $storage = [];\n \n $flash = new Messages($storage);\n $flash->addMessage('Test', 'Test');\n $flash->addMessage('Test', 'Test2');\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEquals(['Test', 'Test2'], $storage['slimFlash']['Test']);\n }", "public function testGetMessagesFromPrevRequest()\n {\n $storage = ['slimFlash' => ['Test']];\n $flash = new Messages($storage);\n\n $this->assertEquals(['Test'], $flash->getMessages());\n }", "public function testGetEmptyMessagesFromPrevRequest()\n {\n $storage = [];\n $flash = new Messages($storage);\n\n $this->assertEquals([], $flash->getMessages());\n }", "public function testSetMessages()\n {\n $this->_validator->setMessages(\n [\n Zend_Validate_StringLength::TOO_LONG => 'Your value is too long',\n Zend_Validate_StringLength::TOO_SHORT => 'Your value is too short'\n ]\n );\n\n $this->assertFalse($this->_validator->isValid('abcdefghij'));\n $messages = $this->_validator->getMessages();\n $this->assertEquals('Your value is too long', current($messages));\n\n $this->assertFalse($this->_validator->isValid('abc'));\n $messages = $this->_validator->getMessages();\n $this->assertEquals('Your value is too short', current($messages));\n }", "public function testAddMessageFromStringForCurrentRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $flash->addMessageNow('key', 'value');\n\n $messages = $flash->getMessages();\n $this->assertEquals(['value'], $messages['key']);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEmpty($storage['slimFlash']);\n }", "public function testMessages()\n {\n $response = $this->json('GET', '/api/messages');\n $response->assertJsonStructure([\n 'messages'=>[\n 'current_page',\n 'data' => [\n [\n 'uid',\n 'sender',\n 'subject',\n 'message',\n 'time_sent',\n 'archived',\n 'read'\n ]\n ],\n 'first_page_url',\n 'from',\n 'last_page',\n 'last_page_url',\n 'next_page_url',\n 'path',\n 'per_page',\n 'prev_page_url',\n 'to',\n 'total'\n ]\n ]);\n }", "public function testMessage()\r\n {\r\n\r\n $this->flash->message(\"testMessage\");\r\n $this->assertEquals(\"testMessage\", $_SESSION[\"flash\"][\"messages\"][\"message\"][0]);\r\n\r\n }", "public function testAddMessageFromAnIntegerForCurrentRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $flash->addMessageNow('key', 46);\n $flash->addMessageNow('key', 48);\n\n $messages = $flash->getMessages();\n $this->assertEquals(['46','48'], $messages['key']);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEmpty($storage['slimFlash']);\n }", "public function testAddMessageFromObjectForCurrentRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $user = new \\stdClass();\n $user->name = 'Scooby Doo';\n $user->emailAddress = '[email protected]';\n\n $flash->addMessageNow('user', $user);\n\n $messages = $flash->getMessages();\n $this->assertInstanceOf(\\stdClass::class, $messages['user'][0]);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEmpty($storage['slimFlash']);\n }", "private function initMessageTests() {\r\n\t\tif ($this->getConfig ()->get ( \"run_selftest_message\" ) == \"YES\") {\r\n\t\t\t$stmsg = new SpleefTestMessages ( $this );\r\n\t\t\t$stmsg->runTests ();\r\n\t\t}\r\n\t}", "public function testAddWithMultipleMessages()\n {\n Phlash::add(\"info\", \"Please log in to continue\");\n Phlash::add(\"error\", \"There was a problem processing your request\");\n\n $flashMessages = Phlash::get();\n\n $this->assertNotEmpty($flashMessages);\n $this->assertEquals(count($flashMessages), 2);\n $this->assertEquals($flashMessages[0]->id, 0);\n $this->assertEquals($flashMessages[0]->type, \"info\");\n $this->assertEquals($flashMessages[0]->message, \"Please log in to continue\");\n $this->assertEquals($flashMessages[1]->id, 1);\n $this->assertEquals($flashMessages[1]->type, \"error\");\n $this->assertEquals($flashMessages[1]->message, \"There was a problem processing your request\");\n\n Phlash::clear();\n }", "public function testAddMessageFromArrayForCurrentRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $formData = [\n 'username' => 'Scooby Doo',\n 'emailAddress' => '[email protected]',\n ];\n\n $flash->addMessageNow('old', $formData);\n\n $messages = $flash->getMessages();\n $this->assertEquals($formData, $messages['old'][0]);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEmpty($storage['slimFlash']);\n }", "static function getMessages(){\n if(key_exists(MESSAGES, $_REQUEST)){\n return $_REQUEST[MESSAGES];\n }else{\n return array();\n }\n }", "function manageMessages(&$response)\n\t{\n\t\tif(array_key_exists(\"_ERRORES\",$_SESSION))\n\t\t{\n\t\t\tif (count($_SESSION[\"_ERRORES\"])>0)\n\t\t\t{\n\t\t\t\t$response->setErrors($_SESSION[\"_ERRORES\"]);\n\t\t\t\tunset($_SESSION[\"_ERRORES\"]);\n\t\t\t}\n\t\t}\n\n\t\tif(array_key_exists(\"_MENSAJES\",$_SESSION))\n\t\t{\n\t\t\tif (count($_SESSION[\"_MENSAJES\"])>0)\n\t\t\t{\n\t\t\t\t$response->setMessages($_SESSION[\"_MENSAJES\"]);\n\t\t\t\tunset($_SESSION[\"_MENSAJES\"]);\n\t\t\t}\n\t\t}\n\t}", "public function test_get_user_messages_filtered(): void\n {\n $request = GroupRequest::ofUserName(self::DEFAULT_GROUP_DEEPLINK);\n $this->resolve($request, function (?int $groupId, ?int $accessHash) {\n $count = 0;\n $handler = function (?MessageModel $message = null) use (&$count) {\n if ($message) {\n $this->assertEquals('qweq', $message->getText());\n $count++;\n }\n };\n $client = new GroupMessagesScenario(\n new GroupId($groupId, $accessHash),\n $this->clientGenerator,\n new OptionalDateRange(time()),\n $handler,\n self::USERNAME\n );\n $client->setTimeout(self::TIMEOUT);\n $client->startActions();\n $this->assertEquals(0, $count);\n });\n }", "function check_for_querystrings() {\r\n\t\t\tif ( isset( $_REQUEST['message'] ) ) {\r\n\t\t\t\tUM()->shortcodes()->message_mode = true;\r\n\t\t\t}\r\n\t\t}", "public function messages()\n {\n }", "public function testPostVoicemailMessages()\n {\n }", "public function messages();", "public function messages();", "public function messages();", "private function check_message ()\n\t{\t\tif (isset($_SESSION['message']))\n\t\t{\n\t\t\t// Add it as an attribute and erase the stored version\n\t\t\t$this->message = $_SESSION['message'];\n\t\t\tunset($_SESSION['message']);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->message = \"\";\n\t\t}\n\t}", "public function testGetMessageFromKeyIncludingCurrent()\n {\n $storage = ['slimFlash' => [ 'Test' => ['Test', 'Test2']]];\n $flash = new Messages($storage);\n $flash->addMessageNow('Test', 'Test3');\n\n $messages = $flash->getMessages();\n\n $this->assertEquals(['Test', 'Test2','Test3'], $flash->getMessage('Test'));\n }", "public function testMessages() {\n $result = new Hostingcheck_Result_Info();\n $this->assertEquals(array(), $result->messages());\n $this->assertFalse($result->hasMessages());\n\n $messages = array(\n new Hostingcheck_Message('Foo message'),\n new Hostingcheck_Message('Bar Message'),\n );\n $result = new Hostingcheck_Result_Info($messages);\n $this->assertEquals($messages, $result->messages());\n\n $this->assertTrue($result->hasMessages());\n }", "public function getMessages() {}", "public function getMessages() {}", "public function test_get_user_messages(): void\n {\n $request = GroupRequest::ofUserName(self::DEFAULT_GROUP_DEEPLINK);\n $this->resolve($request, function (?int $groupId, ?int $accessHash) {\n $count = 0;\n $handler = function (?MessageModel $message = null) use (&$count) {\n if ($message) {\n $this->assertEquals('qweq', $message->getText());\n $count++;\n }\n };\n $client = new GroupMessagesScenario(\n new GroupId($groupId, $accessHash),\n $this->clientGenerator,\n new OptionalDateRange(),\n $handler,\n self::USERNAME\n );\n $client->setTimeout(self::TIMEOUT);\n $client->startActions();\n $this->assertEquals(1, $count);\n });\n }", "public function testMessageThreadsV2GetMessages()\n {\n }", "public function testSetTypeMessage() {\n\n $obj = new AppelsEnCours();\n\n $obj->setTypeMessage(\"typeMessage\");\n $this->assertEquals(\"typeMessage\", $obj->getTypeMessage());\n }", "public function test_getAllMessages() {\n\n }", "public function testMessages()\n {\n $message = new PrivateMessage();\n $conversation = new Conversation();\n $this->assertEmpty($conversation->getMessages());\n\n $conversation->addMessage($message);\n $this->assertEquals(new ArrayCollection([$message]), $conversation->getMessages());\n\n $conversation->removeMessage($message);\n $this->assertEmpty($conversation->getMessages());\n }", "protected function initializeMessages()\n {\n $this->messages = array(\n \n );\n }", "public function testGetVoicemailQueueMessages()\n {\n }", "public function testAddMessageFromStringForNextRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $flash->addMessage('key', 'value');\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEquals(['value'], $storage['slimFlash']['key']);\n }", "protected function _setSessionMessages($messages) {}", "public function testGetVoicemailMeMessages()\n {\n }", "public function testGetValidMessageByMessageText(){\n\t\t//create a new message\n\t\t$newMessage =new message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t\t$newMessage->insert($this->getPDO());\n\n\t\t//grab the data from guzzle\n\t\t$response = $this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/' . $newMessage-getMessage());\n\t\t$this->assertSame($response->getStatusCode(),200);\n\t\t$body = $response->getBody();\n\t\t$alertLevel = json_decode ($body);\n\t\t$this->assertSame(200, $alertLevel->status);\n\t}", "private function check_message(){\t\t\tif(isset($_SESSION['message'])){\r\n\t\t\t\t// Add it as an attribute and erase the stored version\r\n\t\t\t\t\r\n\t\t\t\t$this->message = $_SESSION['message'];\r\n\t\t\t\tunset($_SESSION['message']);\r\n\t\t\t}else{\r\n\t\t\t\t$this->message=\"\";\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t\r\n\t\t}", "function tn_prepare_messages() {\n\n\t$_messages = TN_Messages::get_instance();\n\n\t$messages = $_messages->get_messages();\n\n\tif( $messages ) :\n\n\t\tadd_action( 'tn_messages', function() use ( $messages ) { \n\n\t\t\tforeach( $messages as $key => $message ) {\n\t\t\t\t// we add data-message - useful if element is eg cloned to pull it downscreen\n\t\t\t\tif( isset( $message['success'] ) ) : ?>\n\t\t\t\t\t<div data-message=\"<?php echo ++$key; ?>\" class=\"tn_message success\"><?php echo $message['success']; ?></div>\n\t\t\t\t<?php elseif ( isset( $message['error'] ) ) : ?>\n\t\t\t\t\t<div data-message=\"<?php echo ++$key; ?>\" class=\"tn_message error\"><?php echo $message['error']; ?></div>\t\n\t\t\t\t<?php endif; \n\t\t\t}\n\n\t\t});\n\n\tendif;\n}", "public function set_message($message);", "function tn_messages() {\n\tdo_action( 'tn_messages' );\n}", "public function getMessages(){ }", "private function setMessage()\r\n\t{\r\n\t\t$model = $this->getModel();\r\n\t\tif (!$model->isMultiPage()) {\r\n\t\t\t$this->assign('message', '');\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t$message = '';\r\n\t\tif ($model->sessionModel) {\r\n\t\t\t$this->message = $model->sessionModel->status;\r\n\t\t\t//see http://fabrikar.com/forums/showpost.php?p=73833&postcount=14\r\n\t\t\t//if ($model->sessionModel->statusid == _FABRIKFORMSESSION_LOADED_FROM_COOKIE) {\r\n\t\t\tif ($model->sessionModel->last_page > 0) {\r\n\t\t\t\t$message .= ' <a href=\"#\" class=\"clearSession\">'.JText::_('COM_FABRIK_CLEAR').'</a>';\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t$this->assign('message', $message);\r\n\t}", "public function is_there_any_msg()\n\t{\n\t\tif(isset($_SESSION[\"message\"]))\n\t\t{\n\t\t\t$this->_message = $_SESSION[\"message\"];\n\t\t\tunset($_SESSION[\"message\"]);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->_message=\"\";\n\t\t}\n\t}", "public function testMessageThreadsV2GetMessages0()\n {\n }", "public function testSetMessage()\n {\n $inputInvalid = 'abcdefghij';\n $this->assertFalse($this->_validator->isValid($inputInvalid));\n $messages = $this->_validator->getMessages();\n $this->assertEquals(\"'$inputInvalid' is more than 8 characters long\", current($messages));\n\n $this->_validator->setMessage(\n 'Your value is too long',\n Zend_Validate_StringLength::TOO_LONG\n );\n\n $this->assertFalse($this->_validator->isValid('abcdefghij'));\n $messages = $this->_validator->getMessages();\n $this->assertEquals('Your value is too long', current($messages));\n }", "public function testRequestSetCorrectly()\n {\n $property = $this->logger_reflection->getProperty('request');\n $property->setAccessible(TRUE);\n\n $this->assertEquals($this->request, $property->getValue($this->logger));\n $this->assertSame($this->request, $property->getValue($this->logger));\n }", "public function setMessage( $message );", "public function initMessages()\n {\n $this->messages = [\n 'alpha' => '{{name}} must only contain alphabetic characters.',\n 'alnum' => '{{name}} must only contain alpha numeric characters and dashes.',\n 'noWhitespace' => '{{name}} must not contain white spaces.',\n 'length' => '{{name}} must length between {{minValue}} and {{maxValue}}.',\n 'email' => 'Please make sure you typed a correct email address.'\n ];\n }", "static private function _setMsgs( Array $data )\n\t{\n\t\tFactory::getInstance( 'Session' )->set( self::$var_name, $data );\n\t}", "function statusMessagesOn()\n\t{\n\t\t$this->bStatusMessages = true;\n\t}", "public function testGetAllMessages()\n {\n // Récupération des containers\n $appartmentRepository = $this->getContainer()->get(AppartmentRepository::class);\n $messageRepository = $this->getContainer()->get(MessageRepository::class);\n $entityManager = $this->getContainer()->get(EntityManagerInterface::class);\n $notificationService = $this->getContainer()->get(NotificationService::class);\n $templating = $this->getContainer()->get(\\Twig_Environment::class);\n\n $MessageService = new MessageService($appartmentRepository, $messageRepository, $entityManager, $notificationService, $templating);\n\n $result = $MessageService->getAllMessages($this->getUser());\n\n $this->assertArrayHasKey('appartments', $result);\n $this->assertArrayHasKey('count', $result);\n $this->assertEquals(0, $result['count']);\n }", "public function testGetMessageRequiredParams()\n {\n // Configure HTTP basic authorization: basicAuth\n $config = Configuration::getDefaultConfiguration()\n ->setUsername('YOUR_USERNAME')\n ->setPassword('YOUR_PASSWORD');\n\n $expected_code = 200;\n // Create a mock response\n $expected = new \\Karix\\Model\\MessageListResponse();\n // Create a mock handler\n $mock = new \\GuzzleHttp\\Handler\\MockHandler([\n new \\GuzzleHttp\\Psr7\\Response($expected_code, [], $expected),\n ]);\n $handler = \\GuzzleHttp\\HandlerStack::create($mock);\n $client = new \\GuzzleHttp\\Client(['handler' => $handler]);\n\n $apiInstance = new Api\\MessageApi(\n $client,\n $config\n );\n $direction = \"direction_example\";\n $account_uid = \"account_uid_example\";\n $state = \"state_example\";\n $offset = 0;\n $limit = 10;\n\n }", "public function setAllMessagesAsRead() {\n try \n {\n $request = $this->app->request()->getBody();\n $input = json_decode($request);\n\n if(!$input) throw new Exception('empty input');\n\n // set all messages as read\n Message::setAllMessagesAsRead($input);\n\n //return the latest messages after updating\n $offset = isset($input->offset) ? $input->offset : 0;\n $limit = isset($input->limit) ? $input->limit : 7; \n $messages = Message::findByUser($offset, $limit, $input->username);\n\n echo json_encode($messages);\n }\n catch(Exception $e) \n {\n response_json_error($this->app, 500, $e->getMessage());\n }\n }", "public function testAddMessageFromArrayForNextRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $formData = [\n 'username' => 'Scooby Doo',\n 'emailAddress' => '[email protected]',\n ];\n\n $flash->addMessage('old', $formData);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEquals($formData, $storage['slimFlash']['old'][0]);\n }", "public function getMessages() {\r\n \t$this->getForm()->getMessages();\r\n }", "public function setMessage(FilterResponseEvent $event) {\n /* @var \\Drupal\\system\\Plugin\\Condition\\RequestPath $condition */\n $condition = $this->conditionManager->createInstance('request_path');\n\n $condition->setConfiguration($this->config->get('request_path'));\n\n if ($condition->evaluate()) {\n drupal_set_message($this->config->get('message'));\n }\n }", "public function testGetVoicemailMessages()\n {\n }", "public function test_message_can_be_responded_to() {\n\n $response = Message::create('a thoughtful response', $this->user, $this->message);\n $this->assertEquals($this->message, $response->getParentMessage());\n\n $response = Message::findById($response->getId());\n $this->assertEquals($this->message, $response->getParentMessage()->loadDependencies());\n\n }", "public function testGetVoicemailGroupMessages()\n {\n }", "public function testForm() {\n $this->controller->process();\n $errors = $this->controller->getPlaceholder('loginfp.errors');\n $this->assertEmpty($errors);\n $this->assertEquals(1,$this->controller->emailsSent);\n }", "public function allowMessage()\n {\n $this->_data['Mensaje'] = 1;\n }", "public function testPutValidMessage () {\n\n\t\t//create a new message\n\t\t$newMessage = new Message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t\t$newMessage->insert($this->getPDO());\n\n\t\t//run a get request to establish session tokens\n\t\t$this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/');\n\n\t\t//grab the data from guzzle and enforce the status match our expectations\n\t\t$response = $this->guzzle->put('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/' . $newMessage->getMessage(),['headers' => ['X-XRF-TOKEN' => $this->getXsrfToken()], 'json' => $newMessage] );\n\t\t$this->assertSame($response->getStatusCode(), 200);\n\t\t$body = $response->getBpdy();\n\t\t$alertLevel = json_decode($body);\n\t\t$this->assertSame(200, $alertLevel->status);\n\n\t}", "function pms_check_request_args_success_messages() {\r\n\r\n if( !isset($_REQUEST) )\r\n return;\r\n\r\n // If there is a success message in the request add it directly\r\n if( isset( $_REQUEST['pmsscscd'] ) && isset( $_REQUEST['pmsscsmsg'] ) ) {\r\n\r\n $message_code = esc_attr( base64_decode( trim($_REQUEST['pmsscscd']) ) );\r\n $message = esc_attr( base64_decode( trim($_REQUEST['pmsscsmsg']) ) );\r\n\r\n pms_success()->add( $message_code, $message );\r\n\r\n // If there is no message, but the code is present check to see for a gateway action present\r\n // and add messages\r\n } elseif( isset( $_REQUEST['pmsscscd'] ) && !isset( $_REQUEST['pmsscsmsg'] ) ) {\r\n\r\n $message_code = esc_attr( base64_decode( trim($_REQUEST['pmsscscd']) ) );\r\n\r\n if( !isset( $_REQUEST['pms_gateway_payment_action'] ) )\r\n return;\r\n\r\n $payment_action = esc_attr( base64_decode( trim( $_REQUEST['pms_gateway_payment_action'] ) ) );\r\n\r\n if( isset( $_REQUEST['pms_gateway_payment_id'] ) ) {\r\n\r\n $payment_id = esc_attr( base64_decode( trim( $_REQUEST['pms_gateway_payment_id'] ) ) );\r\n $payment = pms_get_payment( $payment_id );\r\n\r\n // If status of the payment is completed add a success message\r\n if( $payment->status == 'completed' ) {\r\n\r\n if( $payment_action == 'upgrade_subscription' )\r\n pms_success()->add( $message_code, apply_filters( 'pms_message_gateway_payment_action', __( 'Congratulations, you have successfully upgraded your subscription.', 'paid-member-subscriptions' ), $payment->status, $payment_action, $payment ) );\r\n\r\n elseif( $payment_action == 'renew_subscription' )\r\n pms_success()->add( $message_code, apply_filters( 'pms_message_gateway_payment_action', __( 'Congratulations, you have successfully renewed your subscription.', 'paid-member-subscriptions' ), $payment->status, $payment_action, $payment ) );\r\n\r\n elseif( $payment_action == 'new_subscription' )\r\n pms_success()->add( $message_code, apply_filters( 'pms_message_gateway_payment_action', __( 'Congratulations, you have successfully subscribed to our website.', 'paid-member-subscriptions' ), $payment->status, $payment_action, $payment ) );\r\n\r\n elseif( $payment_action == 'retry_payment' )\r\n pms_success()->add( $message_code, apply_filters( 'pms_message_gateway_payment_action', __( 'Congratulations, you have successfully subscribed to our website.', 'paid-member-subscriptions' ), $payment->status, $payment_action, $payment ) );\r\n\r\n } elseif( $payment->status == 'pending' ) {\r\n\r\n if( $payment_action == 'upgrade_subscription' )\r\n pms_success()->add( $message_code, apply_filters( 'pms_message_gateway_payment_action', __( 'Thank you for your payment. The upgrade may take a while to be processed.', 'paid-member-subscriptions' ), $payment->status, $payment_action, $payment ) );\r\n\r\n elseif( $payment_action == 'renew_subscription' )\r\n pms_success()->add( $message_code, apply_filters( 'pms_message_gateway_payment_action', __( 'Thank you for your payment. The renew may take a while to be processed.', 'paid-member-subscriptions' ), $payment->status, $payment_action, $payment ) );\r\n\r\n elseif( $payment_action == 'new_subscription' )\r\n pms_success()->add( $message_code, apply_filters( 'pms_message_gateway_payment_action', __( 'Thank you for your payment. The subscription may take a while to get activated.', 'paid-member-subscriptions' ), $payment->status, $payment_action, $payment ) );\r\n\r\n elseif( $payment_action == 'retry_payment' )\r\n pms_success()->add( $message_code, apply_filters( 'pms_message_gateway_payment_action', __( 'Thank you for your payment. The subscription may take a while to get activated.', 'paid-member-subscriptions' ), $payment->status, $payment_action, $payment ) );\r\n\r\n }\r\n\r\n }\r\n\r\n }\r\n\r\n }", "public function testSetMessageDefaultKey()\n {\n $this->_validator->setMessage(\n 'Your value is too short',\n Zend_Validate_StringLength::TOO_SHORT\n );\n\n $this->assertFalse($this->_validator->isValid('abc'));\n $messages = $this->_validator->getMessages();\n $this->assertEquals('Your value is too short', current($messages));\n $errors = $this->_validator->getErrors();\n $this->assertEquals(Zend_Validate_StringLength::TOO_SHORT, current($errors));\n }", "protected function defineMessages()\n {\n return [];\n }", "function _reset_wp_mail_messages() {\n global $wp_test_expectations;\n \n $wp_test_expectations['pluggable']['wp_mail_messages'] = array();\n}", "public function getMessages();", "public function getMessages();", "public function getMessages();", "public function getMessages();", "public function getMessages();", "public function getMessages();", "public function getMessages();", "public function test_request(){\n\n return $this->send_request( 'en', 'es', array( 'about' ) );\n\n }", "public function testGetDefaultMessageIfNoMatchingValueFoundInMessagesList()\n {\n $this->translator->load();\n $this->assertEquals('default_value', $this->translator->get('invalid_message_key', 'default_value'));\n }", "function testf(Request $request)\n {\n return $this->sendSubsriptionSmsToSubscriber($request->str, $request->str1, $request->str2);\n }", "public function get_message_strings() {\n foreach($this->messages as $singleMessage) {\n \n }\n }", "public function testAddMessage()\n {\n $message1 = new Hostingcheck_Message('Foo message');\n $result = new Hostingcheck_Result_Info();\n $result->addMessage($message1);\n $this->assertEquals(array($message1), $result->messages());\n\n $message2 = new Hostingcheck_Message('Bar message');\n $result->addMessage($message2);\n $this->assertEquals(array($message1, $message2), $result->messages());\n\n $this->assertTrue($result->hasMessages());\n }", "public function testSetMessageLu() {\n\n $obj = new AppelsEnCours();\n\n $obj->setMessageLu(true);\n $this->assertEquals(true, $obj->getMessageLu());\n }", "public function testSettersAndGetters() \r\n \t{\r\n \t\t// create a message with minimum constructor args\r\n \t\t$message = new Message( Message::NORMAL );\r\n \t\t\r\n \t\t// Set remainder via setters\r\n \t\t$message->setHeader( (object)array('testProp' => 'testval' ) );\r\n \t\t$message->setBody( simplexml_load_string('<testMessage testAtt=\"Hello\" testAtt2=\"world\"/>' ));\r\n \t\t$message->setPriority( Message::PRIORITY_LOW );\r\n \t\t\r\n \t\t// test assertions\r\n \t\t$this->assertTrue( $message instanceof Message, \"Expecting \\$message is Message\" );\r\n \t\t$this->assertTrue( $message->getType() == Message::NORMAL, \"Expecting \\$message->getType() == Message::NORMAL\" );\r\n \t\t$this->assertTrue( $message->getHeader()->testProp == 'testval', \"Expecting \\$message->getHeader()->testProp == 'testval'\" );\r\n \t\t$this->assertTrue( $message->getBody()->attributes()->testAtt == 'Hello', \"Expecting \\$message->getBody()->attributes()->testAtt == 'Hello'\" );\r\n \t\t$this->assertTrue( $message->getPriority() == Message::PRIORITY_LOW, \"Expecting \\$message->getPriority() == Message::PRIORITY_LOW\" );\r\n \t\t\r\n \t}", "public function testSetSuiviMessages() {\n\n $obj = new Collaborateurs();\n\n $obj->setSuiviMessages(true);\n $this->assertEquals(true, $obj->getSuiviMessages());\n }", "public function testGetMessage()\n {\n // Configure HTTP basic authorization: basicAuth\n $config = Configuration::getDefaultConfiguration()\n ->setUsername('YOUR_USERNAME')\n ->setPassword('YOUR_PASSWORD');\n\n $expected_code = 200;\n // Create a mock response\n $expected = new \\Karix\\Model\\MessageListResponse();\n // Create a mock handler\n $mock = new \\GuzzleHttp\\Handler\\MockHandler([\n new \\GuzzleHttp\\Psr7\\Response($expected_code, [], $expected),\n ]);\n $handler = \\GuzzleHttp\\HandlerStack::create($mock);\n $client = new \\GuzzleHttp\\Client(['handler' => $handler]);\n\n $apiInstance = new Api\\MessageApi(\n $client,\n $config\n );\n $direction = \"direction_example\";\n $account_uid = \"account_uid_example\";\n $state = \"state_example\";\n $offset = 0;\n $limit = 10;\n\n try {\n $result = $apiInstance->getMessage($direction, $account_uid, $state, $offset, $limit);\n $this->assertEquals($expected, $result);\n } catch (Exception $e) {\n $this->fail(\"Exception when calling MessageApi->getMessage: \".$e->getMessage());\n }\n }", "function filterRequest($msg){\n if(isset($_GET['type'])){\n $type = $_GET['type'];\n\n // Verify data type\n if($type == 'data'){\n handleDataRequest($msg);\n }else if($type == 'multiple'){\n handleMultipleData($msg);\n }else if($type == 'station'){\n handleStationsRequest($msg);\n }else{\n $msg->message = 'Requested type not existing!';\n $msg->toJson();\n }\n }else{\n $msg->message = 'Type not set!';\n $msg->toJson();\n }\n}", "public function setMessage() {\n $numArgs = func_num_args();\n\n switch ($numArgs) {\n default:\n return false;\n break;\n\n // A global rule error message\n case 2:\n foreach ($this->post(null) as $key => $val) {\n $this->_errorPhraseOverrides[$key][func_get_arg(0)] = func_get_arg(1);\n }\n break;\n\n // Field specific rule error message\n case 3:\n $this->_errorPhraseOverrides[func_get_arg(1)][func_get_arg(0)] = func_get_arg(2);\n break;\n }\n\n return true;\n }", "public function setMessage($message);", "public function setMessage($message);", "public function setMessage($message);", "function printMessages()\n {\n //check if messages buffer contain any values\n if(isset($_SESSION['msg']))\n {\n echo \"{$_SESSION['msg']}\";\n unset($_SESSION['msg']);\n }\n }", "public function action_Message()\n\t{\n\t\t// get initial request (as we load it via HMVC)\n\t\t$request = Request::initial();\n\n\t\t// setup view\n\t\t$this->view = View::factory('Ticket/Message/Fieldset')\n\t\t->set('admin', $this->auth->logged_in('admin'))\n\t\t->bind('form', $form)\n\t\t->bind('ticket', $ticket);\n\n\t\t// load ticket from database\n\t\t$ticket = ORM::factory('Ticket', $this->request->param('id'));\n\n\t\t// factory orm item\n\t\t$item = ORM::factory('Ticket_Message');\n\n\t\t// create form\n\t\t$form = Form::factory($item);\n\n\t\t// on form submit\n\t\tif ($request->method() === HTTP_Request::POST)\n\t\t{\n\t\t\t// set ticket and user to item\n\t\t\t$item->ticket_id = $ticket->id;\n\t\t\t$item->user_id = $this->user->id;\n\t\t\t$item->values($request->post(), ['message']);\n\n\t\t\t// process ticket status if admin\n\t\t\tif ($this->auth->logged_in('admin') AND $request->post('status') != '')\n\t\t\t{\n\t\t\t\t$ticket->status = $request->post('status');\n\t\t\t\t$ticket->save();\n\t\t\t}\n\n\t\t\ttry\n\t\t\t{\n\t\t\t\t// validate and save item\n\t\t\t\t$item->save();\n\n\t\t\t}\n\t\t\tcatch (ORM_Validation_Exception $e)\n\t\t\t{\n\t\t\t\t// attach errors to form\n\t\t\t\t$form->attach($e);\n\t\t\t}\n\t\t}\n\t}", "public function requests()\n\t{\n\t\t$this->checkRequest();\n\t\t$this->getResponse();\n\t}", "public function test_updateMessage() {\n\n }", "public function testIfShowMethodReturnsMessages()\n {\n // Create our topics for testing\n factory(\\App\\Models\\Topic::class, 3)->create();\n factory(\\App\\Models\\Message::class, 50)->create();\n\n $class = App::make(TopicThreadController::class);\n\n // Retrieve a topic to test against\n $topic = \\App\\Models\\Topic::inRandomOrder()->first();\n\n $messages = $class->show($topic);\n\n $this->assertInternalType('array', $messages);\n }", "protected function beforeSending()\n {\n }", "public function setGroupMsg(){\n\t\t$viewDataController = new ViewDataController();\n\t\t$data = $viewDataController->buildData();\n\t\t$input = Request::all();\n\t\tCache::put(env('ENVIRONMENT').'_'.$data['user_id'].'_studentList', $input, 60);\n\t\tCache::put(env('ENVIRONMENT').'_'.$data['user_id'].'_is_list_user', 0, 60);\n\t\treturn 'success';\n\t}", "protected abstract function _message();", "public function testGetValidMessageByListingId(){\n\t\t//create a new message\n\t\t$newMessage =new message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t\t$newMessage->insert($this->getPDO());\n\n\t\t//grab the data from guzzle\n\t\t$response = $this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/' . $newMessage-getMessage());\n\t\t$this->assertSame($response->getStatusCode(),200);\n\t\t$body = $response->getBody();\n\t\t$alertLevel = json_decode ($body);\n\t\t$this->assertSame(200, $alertLevel->status);\n\t}", "private function initMessage()\n {\n $this->_message['MSG_ERROR'] = Utils::getMessageError();\n $this->_message['MSG_ALERT'] = Utils::getMessageALert();\n }", "public function getMessageBag();", "public function getTestMessages()\n {\n return $this->_testMessages;\n }" ]
[ "0.68090874", "0.64293087", "0.62194574", "0.6216122", "0.61718696", "0.6116908", "0.60891205", "0.5985521", "0.5919066", "0.5918706", "0.5909979", "0.5904052", "0.58962536", "0.58763707", "0.5839283", "0.5825164", "0.57972217", "0.57724", "0.57596606", "0.57596606", "0.57596606", "0.5748217", "0.57397574", "0.573954", "0.5726804", "0.5726804", "0.57148886", "0.57116914", "0.5701157", "0.5673689", "0.56562424", "0.5655326", "0.5644228", "0.5643629", "0.56296206", "0.5621607", "0.5619649", "0.5619437", "0.56190306", "0.56172115", "0.5608732", "0.5590681", "0.5589576", "0.55881876", "0.5588011", "0.5588009", "0.55839425", "0.55701274", "0.55431867", "0.55328906", "0.5523241", "0.5520537", "0.5511224", "0.5510089", "0.5509458", "0.55015564", "0.5496634", "0.54938126", "0.54862577", "0.54853225", "0.5477559", "0.5469445", "0.54598266", "0.54566586", "0.5446011", "0.54427075", "0.5436004", "0.5425813", "0.5425813", "0.5425813", "0.5425813", "0.5425813", "0.5425813", "0.5425813", "0.5418593", "0.5400955", "0.5389316", "0.5385758", "0.5380591", "0.5376956", "0.5364912", "0.5362102", "0.53614765", "0.53597444", "0.5358422", "0.5350456", "0.5350456", "0.5350456", "0.5344834", "0.5340862", "0.53372246", "0.5333052", "0.53308445", "0.53300476", "0.5325372", "0.5316176", "0.53060824", "0.5305736", "0.53023094", "0.52990174" ]
0.7029479
0
Test set messages for next request
public function testSetMessagesForNextRequest() { $storage = []; $flash = new Messages($storage); $flash->addMessage('Test', 'Test'); $flash->addMessage('Test', 'Test2'); $this->assertArrayHasKey('slimFlash', $storage); $this->assertEquals(['Test', 'Test2'], $storage['slimFlash']['Test']); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getNextMessage(){\r\n }", "public function testAddMessageFromAnIntegerForNextRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $flash->addMessage('key', 46);\n $flash->addMessage('key', 48);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEquals(['46', '48'], $storage['slimFlash']['key']);\n }", "protected function processMessages()\n {\n while ($done = curl_multi_info_read($this->multiHandle)) {\n $request = $this->resourceHash[(int)$done['handle']];\n $this->processResponse($request, $this->handles[$request], $done);\n }\n }", "public function testAddMessageFromArrayForNextRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $formData = [\n 'username' => 'Scooby Doo',\n 'emailAddress' => '[email protected]',\n ];\n\n $flash->addMessage('old', $formData);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEquals($formData, $storage['slimFlash']['old'][0]);\n }", "public function testGetMessagesFromPrevRequest()\n {\n $storage = ['slimFlash' => ['Test']];\n $flash = new Messages($storage);\n\n $this->assertEquals(['Test'], $flash->getMessages());\n }", "public function next()\n {\n next($this->requests);\n }", "public function testAddMessageFromStringForNextRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $flash->addMessage('key', 'value');\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEquals(['value'], $storage['slimFlash']['key']);\n }", "public function testAddWithMultipleMessages()\n {\n Phlash::add(\"info\", \"Please log in to continue\");\n Phlash::add(\"error\", \"There was a problem processing your request\");\n\n $flashMessages = Phlash::get();\n\n $this->assertNotEmpty($flashMessages);\n $this->assertEquals(count($flashMessages), 2);\n $this->assertEquals($flashMessages[0]->id, 0);\n $this->assertEquals($flashMessages[0]->type, \"info\");\n $this->assertEquals($flashMessages[0]->message, \"Please log in to continue\");\n $this->assertEquals($flashMessages[1]->id, 1);\n $this->assertEquals($flashMessages[1]->type, \"error\");\n $this->assertEquals($flashMessages[1]->message, \"There was a problem processing your request\");\n\n Phlash::clear();\n }", "public function testSetMessagesForCurrentRequest()\n {\n $storage = ['slimFlash' => [ 'error' => ['An error']]];\n\n $flash = new Messages($storage);\n $flash->addMessageNow('error', 'Another error');\n $flash->addMessageNow('success', 'A success');\n $flash->addMessageNow('info', 'An info');\n\n $messages = $flash->getMessages();\n $this->assertEquals(['An error', 'Another error'], $messages['error']);\n $this->assertEquals(['A success'], $messages['success']);\n $this->assertEquals(['An info'], $messages['info']);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEmpty([], $storage['slimFlash']);\n }", "public function testGetEmptyMessagesFromPrevRequest()\n {\n $storage = [];\n $flash = new Messages($storage);\n\n $this->assertEquals([], $flash->getMessages());\n }", "public function testMessages()\n {\n $response = $this->json('GET', '/api/messages');\n $response->assertJsonStructure([\n 'messages'=>[\n 'current_page',\n 'data' => [\n [\n 'uid',\n 'sender',\n 'subject',\n 'message',\n 'time_sent',\n 'archived',\n 'read'\n ]\n ],\n 'first_page_url',\n 'from',\n 'last_page',\n 'last_page_url',\n 'next_page_url',\n 'path',\n 'per_page',\n 'prev_page_url',\n 'to',\n 'total'\n ]\n ]);\n }", "function executeNextMessageDueToExpire()\n { \n $this->admin_message = AdminMessagePeer::getNextMessageDueToExpire(); \n }", "public function next()\n {\n $this->curIndex++;\n if($this->curIndex >= count($this->res)){\n $this->MakeNextReq();\n }\n }", "public function testAddMessageFromObjectForNextRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $user = new \\stdClass();\n $user->name = 'Scooby Doo';\n $user->emailAddress = '[email protected]';\n\n $flash->addMessage('user', $user);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertInstanceOf(\\stdClass::class, $storage['slimFlash']['user'][0]);\n }", "public function testMessageThreadsV2GetMessages()\n {\n }", "public function requests()\n\t{\n\t\t$this->checkRequest();\n\t\t$this->getResponse();\n\t}", "public function testMessageThreadsV2GetMessages0()\n {\n }", "public function processMessages() {\n while ( ( $execution = array_shift($this->queue) ) ) { \n $execution->event('continue');\n $this->messagesDelivered++;\n }\n }", "public function test_get_user_messages(): void\n {\n $request = GroupRequest::ofUserName(self::DEFAULT_GROUP_DEEPLINK);\n $this->resolve($request, function (?int $groupId, ?int $accessHash) {\n $count = 0;\n $handler = function (?MessageModel $message = null) use (&$count) {\n if ($message) {\n $this->assertEquals('qweq', $message->getText());\n $count++;\n }\n };\n $client = new GroupMessagesScenario(\n new GroupId($groupId, $accessHash),\n $this->clientGenerator,\n new OptionalDateRange(),\n $handler,\n self::USERNAME\n );\n $client->setTimeout(self::TIMEOUT);\n $client->startActions();\n $this->assertEquals(1, $count);\n });\n }", "public function testAddMessageFromAnIntegerForCurrentRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $flash->addMessageNow('key', 46);\n $flash->addMessageNow('key', 48);\n\n $messages = $flash->getMessages();\n $this->assertEquals(['46','48'], $messages['key']);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEmpty($storage['slimFlash']);\n }", "public function processRequests() {\n\t\t$receivedRequests = $this->receivedRequestMapper->findAll();\n\t\tforeach ($receivedRequests as $receivedRequest) {\n\t\t\t$id = $receivedRequest->getId();\n\t\t\t$sendingLocation = $receivedRequest->getSendingLocation();\n\t\t\t$type = $receivedRequest->getRequestType();\n\t\t\t$addedAt = $receivedRequest->getAddedAt();\n\t\t\t$field1 = $receivedRequest->getField1();\n\t\t\t\n\t\t\tswitch ($type) {\n\t\t\t\tcase Request::USER_EXISTS: //Want same behavior for these two queries\n\t\t\t\tcase Request::FETCH_USER: //for login for a user that doesn't exist in the db\n\t\t\t\t\t$userExists = $this->api->userExists($field1) ? '1' : '0';\t\n\n\t\t\t\t\t$this->api->beginTransaction();\n\t\t\t\t\t$response = new QueuedResponse($id, $sendingLocation, (string) $userExists, $this->api->microTime());\n\t\t\t\t\t$this->queuedResponseMapper->save($response); //Does not throw Exception if already exists\n\n\t\t\t\t\tif ($userExists) {\n\t\t\t\t\t\t$userUpdate = $this->userUpdateMapper->find($field1);\n\t\t\t\t\t\t$displayName = $this->api->getDisplayName($field1);\n\t\t\t\t\t\t$password = $this->api->getPassword($field1);\n\t\t\t\t\t\t$queuedUser = new QueuedUser($field1, $displayName, $password, $userUpdate->getUpdatedAt(), $sendingLocation); \n\t\t\t\t\t\t$this->queuedUserMapper->save($queuedUser); //Does not throw Exception if already exists\n\t\t\t\t\t}\n\t\t\t\t\t$this->api->commit();\n\t\t\t\t\t\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\t$this->api->log(\"Invalid request_type {$type} for request from {$sendingLocation} added_at {$addedAt}, field1 = {$field1}\");\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t$request = $this->receivedRequestMapper->delete($receivedRequest);\n\t\t}\n\t}", "public function testSendMultiPage()\n {\n $request1 = $this->getExpectedBody(\n [\n ['SKU' => 'test1'],\n ['SKU' => 'test2'],\n ['SKU' => 'test3'],\n ['SKU' => 'test4'],\n ['SKU' => 'test5'],\n ['SKU' => 'test6'],\n ['SKU' => 'test7'],\n ['SKU' => 'test8'],\n ['SKU' => 'test9'],\n ['SKU' => 'test10']\n ],\n []\n );\n\n\n $curl = $this->mockCurl($request1, 200, '', '', 2);\n\n $request2 = $this->getExpectedBody(\n [\n ['SKU' => 'test11'],\n ['SKU' => 'test12']\n ],\n []\n );\n\n $curl->shouldReceive('post')\n ->once()\n ->with('http://127.0.0.1/delta/', $request2);\n\n $this->mockEndpoint();\n\n $this->subject->addData(['SKU' => 'test1']);\n $this->subject->addData(['SKU' => 'test2']);\n $this->subject->addData(['SKU' => 'test3']);\n $this->subject->addData(['SKU' => 'test4']);\n $this->subject->addData(['SKU' => 'test5']);\n $this->subject->addData(['SKU' => 'test6']);\n $this->subject->addData(['SKU' => 'test7']);\n $this->subject->addData(['SKU' => 'test8']);\n $this->subject->addData(['SKU' => 'test9']);\n $this->subject->addData(['SKU' => 'test10']);\n $this->subject->addData(['SKU' => 'test11']);\n $this->subject->addData(['SKU' => 'test12']);\n\n $responses = $this->subject->send();\n\n $this->assertEquals(2, count($responses));\n\n $this->assertEquals(\n [\n 'status' => 200,\n 'body' => ''\n ],\n $responses[0]\n );\n\n $this->assertEquals(\n [\n 'status' => 200,\n 'body' => ''\n ],\n $responses[1]\n );\n }", "public function testPostVoicemailMessages()\n {\n }", "public function testFlashAssertionMultipleRequests(): void\n {\n $this->enableRetainFlashMessages();\n $this->disableErrorHandlerMiddleware();\n\n $this->get('/posts/index/with_flash');\n $this->assertResponseCode(200);\n $this->assertFlashMessage('An error message');\n\n $this->get('/posts/someRedirect');\n $this->assertResponseCode(302);\n $this->assertFlashMessage('A success message');\n }", "public function testListFirstMessage()\n {\n $data = self::$ctnClient1->listMessages([\n 'startDate' => self::$testStartDate\n ], 1);\n\n $this->assertEquals(1, $data->msgCount);\n $this->assertTrue($data->hasMore);\n }", "public function test_peekMessage() {\n\n }", "public function testMessage()\r\n {\r\n\r\n $this->flash->message(\"testMessage\");\r\n $this->assertEquals(\"testMessage\", $_SESSION[\"flash\"][\"messages\"][\"message\"][0]);\r\n\r\n }", "private function initMessageTests() {\r\n\t\tif ($this->getConfig ()->get ( \"run_selftest_message\" ) == \"YES\") {\r\n\t\t\t$stmsg = new SpleefTestMessages ( $this );\r\n\t\t\t$stmsg->runTests ();\r\n\t\t}\r\n\t}", "public function testGetMessageRequiredParams()\n {\n // Configure HTTP basic authorization: basicAuth\n $config = Configuration::getDefaultConfiguration()\n ->setUsername('YOUR_USERNAME')\n ->setPassword('YOUR_PASSWORD');\n\n $expected_code = 200;\n // Create a mock response\n $expected = new \\Karix\\Model\\MessageListResponse();\n // Create a mock handler\n $mock = new \\GuzzleHttp\\Handler\\MockHandler([\n new \\GuzzleHttp\\Psr7\\Response($expected_code, [], $expected),\n ]);\n $handler = \\GuzzleHttp\\HandlerStack::create($mock);\n $client = new \\GuzzleHttp\\Client(['handler' => $handler]);\n\n $apiInstance = new Api\\MessageApi(\n $client,\n $config\n );\n $direction = \"direction_example\";\n $account_uid = \"account_uid_example\";\n $state = \"state_example\";\n $offset = 0;\n $limit = 10;\n\n }", "public function testRelatedRequests()\n {\n $firstResponse = $this->http->send(\n new Request('GET', '/visit-counter.php')\n );\n\n $secondResponse = $this->http->send(\n new Request('GET', '/visit-counter.php', $this->prepareSessionHeader($firstResponse))\n );\n\n $this->assertSame('1', (string) $firstResponse->getBody());\n $this->assertSame('2', (string) $secondResponse->getBody());\n\n $this->assertCreatedNewSession($firstResponse);\n $this->assertFalse($secondResponse->hasHeader('Set-Cookie'));\n\n $this->assertSame(1, $this->redis->dbSize());\n }", "public function test_get_user_messages_filtered(): void\n {\n $request = GroupRequest::ofUserName(self::DEFAULT_GROUP_DEEPLINK);\n $this->resolve($request, function (?int $groupId, ?int $accessHash) {\n $count = 0;\n $handler = function (?MessageModel $message = null) use (&$count) {\n if ($message) {\n $this->assertEquals('qweq', $message->getText());\n $count++;\n }\n };\n $client = new GroupMessagesScenario(\n new GroupId($groupId, $accessHash),\n $this->clientGenerator,\n new OptionalDateRange(time()),\n $handler,\n self::USERNAME\n );\n $client->setTimeout(self::TIMEOUT);\n $client->startActions();\n $this->assertEquals(0, $count);\n });\n }", "public function test_getAllMessages() {\n\n }", "public function testGetVoicemailQueueMessages()\n {\n }", "private function firstStepRequests()\n\t{\n\t\t$fpwd_data = $this->timber->validator->clear(array(\n\t\t\t'fpwd_email' => array(\n \t\t\t\t'req' => 'post',\n \t'sanit' => 'semail',\n \t'valid' => 'vnotempty&vemail',\n \t'default' => '',\n \t'errors' => array(\n \t\t'vnotempty' => $this->timber->translator->trans('The email is invalid.'),\n \t\t'vemail' => $this->timber->translator->trans('The email is invalid.'),\n \t),\n\t\t\t),\n\t\t));\n\n\t\tif(true === $fpwd_data['error_status']){\n\t\t\t$this->response['data'] = $fpwd_data['error_text'];\n\t\t\treturn false;\n\t\t}\n\t\t$email = ($fpwd_data['fpwd_email']['status']) ? $fpwd_data['fpwd_email']['value'] : '';\n\n\t\t$user_data = $this->timber->user_model->getUserByMultiple( array('email' => $email, 'auth_by' => '1') );\n\n\t\tif( (false === $user_data) || !(is_object($user_data)) ){\n\t\t\t$this->response['data'] = $this->timber->translator->trans('The email is invalid.');\n\t\t\treturn false;\n\t\t}\n\n\t\t$user_data = $user_data->as_array();\n\n\t\t//delete old metas\n\t\t$this->timber->user_meta_model->dumpUserMeta( $user_data['us_id'], '_user_fpwd_hash' );\n\n\t\t//insert new one\n\t\t$hash = $this->timber->faker->randHash(20) . time();\n\t\t$meta_status = $this->timber->user_meta_model->addMeta(array(\n\t\t\t'us_id' => $user_data['us_id'],\n\t\t\t'me_key' => '_user_fpwd_hash',\n\t\t\t'me_value' => $hash,\n\t\t));\n\n\t\t# Run Now and don't run as a cron\n\t\t$message_status = $this->timber->notify->execMailerCron(array(\n\t\t\t'method_name' => 'fpwdEmailNotifier',\n\t\t\t'user_id' => $user_data['us_id'],\n\t\t\t'hash' => $hash,\n\t\t));\n\n\t\tif( $meta_status && $message_status ){\n\t\t\t$this->response['status'] = 'success';\n\t\t\t$this->response['data'] = $this->timber->translator->trans('Reset message sent successfully.');\n\t\t\treturn true;\n\t\t}\n\n\t\t$this->response['data'] = $this->timber->translator->trans('Something goes wrong! We apologize. try again later.');\n\t\treturn false;\n\t}", "function manageMessages(&$response)\n\t{\n\t\tif(array_key_exists(\"_ERRORES\",$_SESSION))\n\t\t{\n\t\t\tif (count($_SESSION[\"_ERRORES\"])>0)\n\t\t\t{\n\t\t\t\t$response->setErrors($_SESSION[\"_ERRORES\"]);\n\t\t\t\tunset($_SESSION[\"_ERRORES\"]);\n\t\t\t}\n\t\t}\n\n\t\tif(array_key_exists(\"_MENSAJES\",$_SESSION))\n\t\t{\n\t\t\tif (count($_SESSION[\"_MENSAJES\"])>0)\n\t\t\t{\n\t\t\t\t$response->setMessages($_SESSION[\"_MENSAJES\"]);\n\t\t\t\tunset($_SESSION[\"_MENSAJES\"]);\n\t\t\t}\n\t\t}\n\t}", "public function testListAllMessages()\n {\n $data = self::$ctnClient1->listMessages([\n 'startDate' => self::$testStartDate\n ]);\n\n $this->assertGreaterThanOrEqual(2, $data->msgCount);\n $this->assertFalse($data->hasMore);\n }", "public function testSendFirstMessage()\n {\n $data = [\n 'message' => Str::random('50'),\n ];\n\n $this->post(route('api.send.message'), $data)\n ->assertStatus(201)\n ->assertJson(['success' => true, 'text' => $data['text']]);\n }", "public function next(): void\n {\n next($this->payload);\n }", "public function testMessages() {\n $result = new Hostingcheck_Result_Info();\n $this->assertEquals(array(), $result->messages());\n $this->assertFalse($result->hasMessages());\n\n $messages = array(\n new Hostingcheck_Message('Foo message'),\n new Hostingcheck_Message('Bar Message'),\n );\n $result = new Hostingcheck_Result_Info($messages);\n $this->assertEquals($messages, $result->messages());\n\n $this->assertTrue($result->hasMessages());\n }", "private function dispatchNextMessages(): void\n {\n // Dispatch messages for the dependent migrators\n $nextMigrators = $this->migratorEntity->getNextMigrators()\n ->filter(fn(MigratorEntity $migrator) => ComponentStatus::CREATED === $migrator->getStatus());\n\n if ($nextMigrators->count() > 0) {\n foreach ($nextMigrators as $nextMigrator) {\n $this->messageBus->dispatch(new RunMigrator($nextMigrator));\n }\n return;\n }\n\n // Check remaining migrators before dispatching after task messages\n $remainingMigrators = $this->migrationEntity->getMigrators()\n ->filter(fn(MigratorEntity $migrator) => false === $migrator->hasEnded());\n\n if ($remainingMigrators->count() > 0) {\n return;\n }\n\n // Check for after tasks\n if ($this->migrationEntity->getAfterTasks()->count() > 0) {\n foreach ($this->migrationEntity->getAfterTasks() as $afterTask) {\n /** @var int $taskId */\n $taskId = $afterTask->getId();\n $this->messageBus->dispatch(new RunTask($taskId));\n }\n return;\n }\n\n\n // End of the migration\n $this->updateMigrationStatus(MigrationStatus::FINISHED);\n $this->migrationEntity->setFinishedAt();\n $this->entityManager->flush();\n }", "function tn_prepare_messages() {\n\n\t$_messages = TN_Messages::get_instance();\n\n\t$messages = $_messages->get_messages();\n\n\tif( $messages ) :\n\n\t\tadd_action( 'tn_messages', function() use ( $messages ) { \n\n\t\t\tforeach( $messages as $key => $message ) {\n\t\t\t\t// we add data-message - useful if element is eg cloned to pull it downscreen\n\t\t\t\tif( isset( $message['success'] ) ) : ?>\n\t\t\t\t\t<div data-message=\"<?php echo ++$key; ?>\" class=\"tn_message success\"><?php echo $message['success']; ?></div>\n\t\t\t\t<?php elseif ( isset( $message['error'] ) ) : ?>\n\t\t\t\t\t<div data-message=\"<?php echo ++$key; ?>\" class=\"tn_message error\"><?php echo $message['error']; ?></div>\t\n\t\t\t\t<?php endif; \n\t\t\t}\n\n\t\t});\n\n\tendif;\n}", "public function testForm() {\n $this->controller->process();\n $errors = $this->controller->getPlaceholder('loginfp.errors');\n $this->assertEmpty($errors);\n $this->assertEquals(1,$this->controller->emailsSent);\n }", "public function testAddMessageFromArrayForCurrentRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $formData = [\n 'username' => 'Scooby Doo',\n 'emailAddress' => '[email protected]',\n ];\n\n $flash->addMessageNow('old', $formData);\n\n $messages = $flash->getMessages();\n $this->assertEquals($formData, $messages['old'][0]);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEmpty($storage['slimFlash']);\n }", "public function next()\n {\n $this->valid = (false !== next($this->sessionData)); \n }", "public function testValidReturnOfUserSentMessages()\n {\n\n $senderuser = User::storeUser([\n 'username' => 'testo',\n 'email' => '[email protected]',\n 'password' => '123456789'\n ]);\n\n $token = auth()->login($senderuser);\n $headers = [$token];\n\n $receiveruser1 = User::storeUser([\n 'username' => 'testoo',\n 'email' => '[email protected]',\n 'password' => '123456789'\n ]);\n\n $receiveruser2 = User::storeUser([\n 'username' => 'testooo',\n 'email' => '[email protected]',\n 'password' => '123456789'\n ]);\n\n\n \n $message1= Message::createDummyMessage($senderuser->username, $receiveruser1->username, 'test_hii1', 'test_subject');\n\n\n $message2= Message::createDummyMessage($senderuser->username, $receiveruser2->username, 'test_hii2', 'test_subject');\n\n\n\n $this->json('GET', 'api/v1/auth/viewUserSentMessages', [], $headers)\n ->assertStatus(200)\n ->assertJson([\n \"success\" => \"true\",\n \"messages\" => [[\n \t\"receiver_name\" => \"testoo\",\n \t \"receiver_photo\" => null,\n \"message_subject\" => 'test_subject',\n \t \"message_content\" => \"test_hii1\",\n \"message_id\" => $message1->message_id,\n \"duration\" => link::duration($message1->message_date)\n\n ],[\n \t\"receiver_name\" => \"testooo\",\n \t \"receiver_photo\" => null,\n \"message_subject\" => 'test_subject',\n \t \"message_content\" => \"test_hii2\",\n \"message_id\" => $message2->message_id,\n \"duration\" => link::duration($message2->message_date)\n\n ]]\n ]);\n\n\n\n $senderuser->delete();\n $receiveruser1->delete();\n $receiveruser2->delete();\n }", "public function testPendingValidationNoMapping()\n {\n $this->executeCommand();\n $this->assertCount(0, $this->validateReceiver->getSent());\n $this->assertCount(0, $this->captureReceiver->getSent());\n $this->assertCount(0, $this->cancelReceiver->getSent());\n }", "public function processResponses() {\n\t\t$receivedResponses = $this->receivedResponseMapper->findAll();\n\t\tforeach ($receivedResponses as $receivedResponse) {\n\t\t\t$requestId = $receivedResponse->getRequestId();\n\t\t\t$answer = $receivedResponse->getAnswer();\n\t\t\n\t\t\t$queuedRequest = $this->queuedRequestMapper->find($requestId);\n\t\t\tif ($queuedRequest) {\n\t\t\t\t$type = $queuedRequest->getRequestType();\n\t\t\t\t$field1 = $queuedRequest->getField1();\n\t\t\t}\n\t\t\telse {\n\t\t\t\t//request no longer exists, so just delete response\n\t\t\t\t$this->receivedResponseMapper->delete($receivedResponse);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t\n\t\t\tswitch ($type) {\n\t\t\t\tcase Request::USER_EXISTS:\n\t\t\t\t\tif ($answer !== \"1\" AND $answer !== \"0\") {\n\t\t\t\t\t\t$this->api->log(\"ReceivedResponse for Request USER_EXISTS, request_id = {$receivedResponse->getId()} had invalid response = {$answer}\"); \n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tif ($answer === \"0\") {\n\t\t\t\t\t\t$friendships = $this->friendshipMapper->findAllByUser($field1);\n\t\t\t\t\t\tforeach ($friendships as $friendship) {\n\t\t\t\t\t\t\t$this->friendshipMapper->delete($friendship);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t$this->api->beginTransaction();\n\t\t\t\t\t//Don't need destination for delete since they should all be this instance\n\t\t\t\t\t$this->receivedResponseMapper->delete($receivedResponse);\n \t\t\t\t\t$this->queuedRequestMapper->delete($receivedResponse);\n\t\t\t\t\t$this->api->commit();\n\t\t\t\t\tbreak;\n\t\t\t\tcase Request::FETCH_USER: \n\t\t\t\t\tif ($answer !== \"1\" AND $answer !== \"0\") {\n\t\t\t\t\t\t$this->api->log(\"ReceivedResponse for Request FETCH_USER, request_id = {$receivedResponse->getId()} had invalid response = {$answer}\"); \n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\t$this->api->beginTransaction();\n\t\t\t\t\t//Don't need destination for delete since they should all be this instance\n\t\t\t\t\t$this->receivedResponseMapper->delete($receivedResponse);\n \t\t\t\t\t$this->queuedRequestMapper->delete($receivedResponse);\n\t\t\t\t\t$this->api->commit();\n\t\t\t\t\t\n\t\t\t\t\tbreak;\t\n\t\t\t\tdefault:\n\t\t\t\t\t$this->api->log(\"Invalid request_type {$type} for request id {$requestId}\");\n\t\t\t\t\tcontinue;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}", "public function testAddMessageFromStringForCurrentRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $flash->addMessageNow('key', 'value');\n\n $messages = $flash->getMessages();\n $this->assertEquals(['value'], $messages['key']);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEmpty($storage['slimFlash']);\n }", "public function testSetMessages()\n {\n $this->_validator->setMessages(\n [\n Zend_Validate_StringLength::TOO_LONG => 'Your value is too long',\n Zend_Validate_StringLength::TOO_SHORT => 'Your value is too short'\n ]\n );\n\n $this->assertFalse($this->_validator->isValid('abcdefghij'));\n $messages = $this->_validator->getMessages();\n $this->assertEquals('Your value is too long', current($messages));\n\n $this->assertFalse($this->_validator->isValid('abc'));\n $messages = $this->_validator->getMessages();\n $this->assertEquals('Your value is too short', current($messages));\n }", "public function setAllMessagesAsRead() {\n try \n {\n $request = $this->app->request()->getBody();\n $input = json_decode($request);\n\n if(!$input) throw new Exception('empty input');\n\n // set all messages as read\n Message::setAllMessagesAsRead($input);\n\n //return the latest messages after updating\n $offset = isset($input->offset) ? $input->offset : 0;\n $limit = isset($input->limit) ? $input->limit : 7; \n $messages = Message::findByUser($offset, $limit, $input->username);\n\n echo json_encode($messages);\n }\n catch(Exception $e) \n {\n response_json_error($this->app, 500, $e->getMessage());\n }\n }", "public function testGetMessage()\n {\n // Configure HTTP basic authorization: basicAuth\n $config = Configuration::getDefaultConfiguration()\n ->setUsername('YOUR_USERNAME')\n ->setPassword('YOUR_PASSWORD');\n\n $expected_code = 200;\n // Create a mock response\n $expected = new \\Karix\\Model\\MessageListResponse();\n // Create a mock handler\n $mock = new \\GuzzleHttp\\Handler\\MockHandler([\n new \\GuzzleHttp\\Psr7\\Response($expected_code, [], $expected),\n ]);\n $handler = \\GuzzleHttp\\HandlerStack::create($mock);\n $client = new \\GuzzleHttp\\Client(['handler' => $handler]);\n\n $apiInstance = new Api\\MessageApi(\n $client,\n $config\n );\n $direction = \"direction_example\";\n $account_uid = \"account_uid_example\";\n $state = \"state_example\";\n $offset = 0;\n $limit = 10;\n\n try {\n $result = $apiInstance->getMessage($direction, $account_uid, $state, $offset, $limit);\n $this->assertEquals($expected, $result);\n } catch (Exception $e) {\n $this->fail(\"Exception when calling MessageApi->getMessage: \".$e->getMessage());\n }\n }", "function messages_send($count = 5){\n\t\tfor($i=0;$i<$count;$i++)\n\t\t{\n\t\t\t$element = vazco_newsletter::queuePop('not_sent');\n\t\t\tif($element!==null)\n\t\t\t{\n\t\t\t\t$result = vazco_newsletter::sendMessage($element[0],$element[1]);\n\t\t\t\tif($result)\n\t\t\t\t\tvazco_newsletter::queuePush($element,'sent');\n\t\t\t\telse\n\t\t\t\t\tvazco_newsletter::queuePush($element,'error');\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}", "public function testPostValidMessage(){\n\t\t//get the count of the numbers of rows in the database\n\t\t$numRows = $this->getConnection()->getRowCount(\"message\");\n\n\t\t//create a new message to send\n\t\t$newMessage = new Message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\n\t\t//run a get request to establish session tokens\n\t\t$this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/');\n\n\t\t//Grab the Data from guzzle and enforce the status match our expectations\n\t\t$response = $this->guzzle->post('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/', ['headers' => ['X-XRF-TOKEN' => $this->getXsrfToken()], 'json' => $newMessage]);\n\t\t$this->assertSame($response->getStatusCode(), 200);\n\t\t$body = $response->getBody();\n\t\t$alertLevel = jason_decode($body);\n\t\t$this->assertSame(200, $alertLevel->status);\n\n\t\t//ensure a new row was added to the database\n\t\t$this->assertSame($numRows + 1, $this->getConnection()->getRowCount(\"message\"));\n\t}", "private function parseResponses() \r\n {\r\n $validStates = array('Response', 'Response30');\r\n $messages = $this->MessageQueue->find('all', array(\r\n 'fields' => array('messageIdentity', 'message', 'processState', 'isCopied', 'sourceDeviceAlias'),\r\n 'conditions' => array(\r\n 'mailbox' => $this->CurrentDevice->deviceAlias,\r\n 'processState' => $validStates\r\n ),\r\n 'order' => 'createDate'\r\n ));\r\n \r\n // Start a transaction\r\n $this->MessageQueue->transaction(null, true);\r\n\r\n // Process all the messages. Any messages that fail will be placed into the $errors array.\r\n $errors = array();\r\n $processed = array();\r\n foreach($messages as $message)\r\n {\r\n $message = $message['MessageQueue'];\r\n\r\n try\r\n {\r\n libxml_use_internal_errors(true);\r\n $xml = Xml::build($message['message']);\r\n $namespaces = array_flip($xml->getNamespaces(true));\r\n\r\n // Convert the XML to an array and pass the resulting message to the correct processing function.\r\n $payload = Set::reverse($xml);\r\n // Set messageQuery to the payload array for message handling.\r\n $this->messageQuery[] = $payload['LawEnforcementTransaction']['Transaction']['Response'];\r\n\r\n if ($this->{\"handle{$message['processState']}\"}($message, $payload, $namespaces))\r\n $processed[] = $message['messageIdentity'];\r\n else\r\n $errors[] = array(\r\n 'message' => $message,\r\n 'error' => 'Message id ' . $message['messageIdentity'] . ' failed to process.'\r\n );\r\n }\r\n catch(Exception $e)\r\n {\r\n $errors[] = array(\r\n 'message' => $message,\r\n 'error' => 'Exception thrown while processing Message id ' . $message['messageIdentity'] . ': '\r\n . $e->getMessage()\r\n );\r\n }\r\n }\r\n \r\n // Just send the raw LawEnforcementTransaction to the user as is with a statement indicating the error.\r\n if (!empty($errors))\r\n {\r\n $copy = $errors;\r\n foreach($copy as $index => $error) {\r\n try\r\n {\r\n $this->queueErrorResponse($error['error'], $error['message']);\r\n $processed[] = $error['message']['messageIdentity'];\r\n unset($copy[$index]);\r\n }\r\n catch(Exception $e)\r\n {\r\n $errors[$index]['error'] = \"Failed to enqueue message that failed processing. \" \r\n . \"Original Error:\\n\\n\" . $error['error'];\r\n }\r\n }\r\n }\r\n\r\n // Dequeue all processed messages.\r\n if (!empty($processed))\r\n $this->MessageQueue->deleteAll(array('messageIdentity' => $processed));\r\n \r\n // Deal with any errors that failed to get directed towards the user. All we can do is change them in the queu\r\n // to a new state (so they're not lost) and log them in the CLIPS error log.\r\n //\r\n // This should almost never happen.\r\n if (!empty($errors)) {\r\n $ids = Set::extract($errors, '{n}.message.messageIdentity');\r\n \r\n // Log each of the messages that failed\r\n foreach($errors as $id => $error) {\r\n CakeLog::write('error', \"Message (id {$error['message']['messageIdentity']}) failed to process. \" \r\n . \"{$error['error']}\\n{$error['message']['message']}\");\r\n }\r\n \r\n // UpdateAll doesn't behave like other Cake model functions. We have to quote the param ourself.\r\n $this->MessageQueue->updateAll(\r\n array('processState' => '\\'CLIPS_Error\\''),\r\n array('messageIdentity' => $ids)\r\n );\r\n }\r\n\r\n return $this->MessageQueue->transaction(true, true);\r\n }", "public function testPendingValidationWithMapping()\n {\n $this->mockPaymentMapping(\n MiraklMock::ORDER_COMMERCIAL_NONE_VALIDATED,\n StripeMock::CHARGE_STATUS_AUTHORIZED,\n 12345\n );\n $this->mockPaymentMapping(\n MiraklMock::ORDER_COMMERCIAL_PARTIALLY_VALIDATED,\n StripeMock::PAYMENT_INTENT_STATUS_REQUIRES_CAPTURE,\n 12345\n );\n $this->executeCommand();\n $this->assertCount(1, $messages = $this->validateReceiver->getSent());\n $this->assertCount(2, $messages[0]->getMessage()->getOrders());\n $this->assertCount(0, $this->captureReceiver->getSent());\n $this->assertCount(0, $this->cancelReceiver->getSent());\n }", "public function testGetVoicemailMeMessages()\n {\n }", "protected function _setSessionMessages($messages) {}", "public function testMessageThreadsV2Post()\n {\n }", "public function testPutValidMessage () {\n\n\t\t//create a new message\n\t\t$newMessage = new Message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t\t$newMessage->insert($this->getPDO());\n\n\t\t//run a get request to establish session tokens\n\t\t$this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/');\n\n\t\t//grab the data from guzzle and enforce the status match our expectations\n\t\t$response = $this->guzzle->put('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/' . $newMessage->getMessage(),['headers' => ['X-XRF-TOKEN' => $this->getXsrfToken()], 'json' => $newMessage] );\n\t\t$this->assertSame($response->getStatusCode(), 200);\n\t\t$body = $response->getBpdy();\n\t\t$alertLevel = json_decode($body);\n\t\t$this->assertSame(200, $alertLevel->status);\n\n\t}", "private function setQueue() {\n if (count($this->request->q) > 0) {\n try {\n $this->client->setQueue(array($this->request->q));\n $this->view->addParameter(\"result\", \"success\");\n } catch(Exception $e) {\n $this->view->addParameter(\"result\", \"failure\");\n $this->view->addParameter(\"data\", \"Failed to execute '{$this->request->action}' action\");\n }\n } else {\n $this->view->addParameter(\"result\", \"invalid\");\n $this->view->addParameter(\"data\", \"Query array must not be empty\");\n }\n }", "public function __sleep()\n {\n return array('request','response','sources','contents','errors');\n }", "public function test_updateMessage() {\n\n }", "public function test_refreshMessageTimeout() {\n\n }", "private function setExpectations()\n {\n\n if ($this->status === $this->wish) {\n $this->bodyToClass();\n } else {\n $this->bodyToErrors();\n }\n }", "public function testMessageThreadsV2Get0()\n {\n }", "public function request_manager( )\n\t{\n\t\t$last_request = $this->php_session->get('last_request');\n\t\t//5 second interval\n\t\tif( $last_request+5 >= time() )\n\t\t{\n\t\t\t$req_count = $this->php_session->get('request_count');\n\t\t\t$req_count += 1;\n\t\t\t$this->php_session->set('request_count' , $req_count);\n\t\t\tif( $req_count >= 20 )\n\t\t\t\t$this->error('Too many HTTP requests from your session.');\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->php_session->set('request_count' , 0 );\n\t\t}\n\t\t$this->php_session->set('last_request' , time( ) );\n\t\t\t\n\t}", "public function testMessages()\n {\n $message = new PrivateMessage();\n $conversation = new Conversation();\n $this->assertEmpty($conversation->getMessages());\n\n $conversation->addMessage($message);\n $this->assertEquals(new ArrayCollection([$message]), $conversation->getMessages());\n\n $conversation->removeMessage($message);\n $this->assertEmpty($conversation->getMessages());\n }", "protected function validateNextRequest(Request $request)\n {\n $this->expectedRequest = $request;\n }", "public function testMessageThreadsV2Get()\n {\n }", "public function testGetMessageFromKeyIncludingCurrent()\n {\n $storage = ['slimFlash' => [ 'Test' => ['Test', 'Test2']]];\n $flash = new Messages($storage);\n $flash->addMessageNow('Test', 'Test3');\n\n $messages = $flash->getMessages();\n\n $this->assertEquals(['Test', 'Test2','Test3'], $flash->getMessage('Test'));\n }", "protected function queueMessages()\n {\n $pages = $users = $files = $sites = 0;\n\n foreach ($this->pagesToQueue() as $id) {\n yield \"P{$id}\";\n $pages++;\n }\n foreach ($this->pagesToRemove() as $id) {\n yield \"RP{$id}\";\n $pages++;\n }\n foreach ($this->usersToRemove() as $id) {\n yield \"RU{$id}\";\n $users++;\n }\n foreach ($this->filesToRemove() as $id) {\n yield \"RF{$id}\";\n $files++;\n }\n foreach ($this->sitesToRemove() as $id) {\n yield \"RS{$id}\";\n $sites++;\n }\n\n yield 'R' . json_encode([$pages, $users, $files, $sites]);\n }", "public function getMessagesAndFlush() {}", "public function requestsMany($message = 'Interface requests are too frequent!')\n {\n return $this->failed($message, 429);\n }", "private function secondStepRequests()\n\t{\n\t\t$fpwd_data = $this->timber->validator->clear(array(\n\t\t\t'fpwd_new_password' => array(\n \t\t\t\t'req' => 'post',\n \t'sanit' => 'sstring',\n 'valid' => 'vnotempty&vstrlenbetween:8,20&vpassword',\n 'default' => '',\n 'errors' => array(\n \t'vnotempty' => $this->timber->translator->trans('The password must not be empty.'),\n \t'vstrlenbetween' => $this->timber->translator->trans('The password must have a lenght of eight or more.'),\n \t'vpassword' => $this->timber->translator->trans('The password must contain at least two numbers and not contain any invalid chars.')\n )\n\t\t\t),\n\t\t\t'fpwd_hash' => array(\n \t\t\t\t'req' => 'post',\n 'sanit' => 'sstring',\n 'valid' => 'vnotempty&vstrlenbetween:8,150',\n 'default' => '',\n 'errors' => array(\n \t'vnotempty' => $this->timber->translator->trans('Invalid request! try to reset password again.'),\n \t'vstrlenbetween' => $this->timber->translator->trans('Invalid request! try to reset password again.')\n )\n\t\t\t),\n\t\t));\n\n\t\tif(true === $fpwd_data['error_status']){\n\t\t\t$this->response['data'] = $fpwd_data['error_text'];\n\t\t\treturn false;\n\t\t}\n\n\t\t$new_password = ( $fpwd_data['fpwd_new_password']['status'] ) ? $fpwd_data['fpwd_new_password']['value'] : '';\n\t\t$hash = ( ($fpwd_data['fpwd_new_password']['status']) && ($fpwd_data['fpwd_hash']['status']) ) ? $fpwd_data['fpwd_hash']['value'] : '';\n\n\t\t$user_meta = $this->timber->user_meta_model->getMetaByMultiple(array(\n\t\t\t'me_key' => '_user_fpwd_hash',\n\t\t\t'me_value' => $hash\n\t\t));\n\n\t\tif( (false === $user_meta) || !(is_object($user_meta)) ){\n\t\t\t$this->response['data'] = $this->timber->translator->trans('Invalid request! try to reset password again.');\n\t\t\treturn false;\n\t\t}\n\n\t\t$user_meta = $user_meta->as_array();\n\n\t\t//update password\n\t\t$update_status = $this->timber->user_model->updateUserById(array(\n\t\t\t'us_id' => $user_meta['us_id'],\n\t\t\t'password' => $this->timber->hasher->HashPassword($new_password),\n\t\t\t'updated_at' => $this->timber->time->getCurrentDate(true)\n\t\t));\n\t\t$meta_status = $this->timber->user_meta_model->deleteMetaById($user_meta['me_id']);\n\n\t\tif( $update_status && $meta_status ){\n\t\t\t$this->response['status'] = 'success';\n\t\t\t$this->response['data'] = $this->timber->translator->trans('Password changed successfully.');\n\t\t\treturn true;\n\t\t}\n\t\t$this->response['data'] = $this->timber->translator->trans('Something goes wrong! We apologize. try again later.');\n\t\treturn false;\n\t}", "public function test_message_can_be_responded_to() {\n\n $response = Message::create('a thoughtful response', $this->user, $this->message);\n $this->assertEquals($this->message, $response->getParentMessage());\n\n $response = Message::findById($response->getId());\n $this->assertEquals($this->message, $response->getParentMessage()->loadDependencies());\n\n }", "public function test_request(){\n\n return $this->send_request( 'en', 'es', array( 'about' ) );\n\n }", "public function test_reply_depth_limit_can_be_reached() {\n\n $limit = (int) getenv('message_reply_limit');\n for ($i = 1; $i <= $limit + 1; $i++) {\n if ($i + 1 == $limit) {\n $this->expectException(ReplyDepthException::class);\n }\n $this->message = Message::create(\n 'a thoughtful response',\n $this->user,\n $this->message\n );\n $this->assertMessageCount($i + 1); // Replies + root message\n }\n\n }", "public function testGetAllMessages()\n {\n // Récupération des containers\n $appartmentRepository = $this->getContainer()->get(AppartmentRepository::class);\n $messageRepository = $this->getContainer()->get(MessageRepository::class);\n $entityManager = $this->getContainer()->get(EntityManagerInterface::class);\n $notificationService = $this->getContainer()->get(NotificationService::class);\n $templating = $this->getContainer()->get(\\Twig_Environment::class);\n\n $MessageService = new MessageService($appartmentRepository, $messageRepository, $entityManager, $notificationService, $templating);\n\n $result = $MessageService->getAllMessages($this->getUser());\n\n $this->assertArrayHasKey('appartments', $result);\n $this->assertArrayHasKey('count', $result);\n $this->assertEquals(0, $result['count']);\n }", "public function testAddMessage()\n {\n $message1 = new Hostingcheck_Message('Foo message');\n $result = new Hostingcheck_Result_Info();\n $result->addMessage($message1);\n $this->assertEquals(array($message1), $result->messages());\n\n $message2 = new Hostingcheck_Message('Bar message');\n $result->addMessage($message2);\n $this->assertEquals(array($message1, $message2), $result->messages());\n\n $this->assertTrue($result->hasMessages());\n }", "public function getMessages() {}", "public function getMessages() {}", "public function getMessageAction() {\n\n //this will return One message which is inserted first of All exist in Current Queue\n $result = $this->messageQueue->Get();\n $this->code = ($result)? 200 : 404;\n return new \\Symfony\\Component\\HttpFoundation\\Response(json_encode(array('result'=>$result)), $this->code , array(\n 'Content-Type' => 'application/json'\n ));\n }", "public function isSent() {}", "public function testGetValidMessageByListingId(){\n\t\t//create a new message\n\t\t$newMessage =new message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t\t$newMessage->insert($this->getPDO());\n\n\t\t//grab the data from guzzle\n\t\t$response = $this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/' . $newMessage-getMessage());\n\t\t$this->assertSame($response->getStatusCode(),200);\n\t\t$body = $response->getBody();\n\t\t$alertLevel = json_decode ($body);\n\t\t$this->assertSame(200, $alertLevel->status);\n\t}", "public function testProtosGet()\n {\n }", "public function testSmsCampaignsSendPost()\n {\n }", "function processMessageIn($message) {\n\t\t$service = $message->getKeyword();\n\t\t$keyword = $message->getKeyword(2);\n\n\t\tswitch ($keyword) {\n\t\t\tcase \"get\":\n\t\t\t\t$this->addSubscriber($message);\n\t\t\tbreak;\n\t\t\tcase \"yes\":\n\t\t\t\t$this->confirmSubscriber($message);\n\t\t\tbreak;\n\t\t\tcase \"cancel\":\n\t\t\tcase \"quit\":\n\t\t\tcase \"end\":\n\t\t\tcase \"unsubscribe\":\n\t\t\tcase \"stop\":\n\t\t\t\t$this->removeSubscriber($message);\n\t\t\tbreak;\n\t\t\tcase \"#\":\n\t\t\t\t$this->processMessageOut($message, null);\n\t\t\tbreak;\n\t\t\tcase \"#uk\":\n\t\t\t\t$this->processMessageOut($message, \"UK\");\n\t\t\tbreak;\n\t\t\tcase \"#us\":\n\t\t\t\t$this->processMessageOut($message, \"US\");\n\t\t\tbreak;\n\t\t\tcase \"status\":\n\t\t\t\t$this->statusCheck($message, $service);\n\t\t\tbreak;\n\t\t}\n\n\t}", "public function testActionMarkReplies()\n\t{\n\t\t$req = HttpReq::instance();\n\t\t$req->query->topics = 1;\n\n\t\t// Get the controller, call index\n\t\t$controller = new Markasread(new EventManager());\n\t\t$controller->setUser(User::$info);\n\t\t$result = $controller->action_markreplies();\n\n\t\t// Check that the result was set\n\t\t$this->assertEquals('action=unreadreplies', $result, 'Result::' . $result);\n\t}", "function pms_check_request_args_success_messages() {\r\n\r\n if( !isset($_REQUEST) )\r\n return;\r\n\r\n // If there is a success message in the request add it directly\r\n if( isset( $_REQUEST['pmsscscd'] ) && isset( $_REQUEST['pmsscsmsg'] ) ) {\r\n\r\n $message_code = esc_attr( base64_decode( trim($_REQUEST['pmsscscd']) ) );\r\n $message = esc_attr( base64_decode( trim($_REQUEST['pmsscsmsg']) ) );\r\n\r\n pms_success()->add( $message_code, $message );\r\n\r\n // If there is no message, but the code is present check to see for a gateway action present\r\n // and add messages\r\n } elseif( isset( $_REQUEST['pmsscscd'] ) && !isset( $_REQUEST['pmsscsmsg'] ) ) {\r\n\r\n $message_code = esc_attr( base64_decode( trim($_REQUEST['pmsscscd']) ) );\r\n\r\n if( !isset( $_REQUEST['pms_gateway_payment_action'] ) )\r\n return;\r\n\r\n $payment_action = esc_attr( base64_decode( trim( $_REQUEST['pms_gateway_payment_action'] ) ) );\r\n\r\n if( isset( $_REQUEST['pms_gateway_payment_id'] ) ) {\r\n\r\n $payment_id = esc_attr( base64_decode( trim( $_REQUEST['pms_gateway_payment_id'] ) ) );\r\n $payment = pms_get_payment( $payment_id );\r\n\r\n // If status of the payment is completed add a success message\r\n if( $payment->status == 'completed' ) {\r\n\r\n if( $payment_action == 'upgrade_subscription' )\r\n pms_success()->add( $message_code, apply_filters( 'pms_message_gateway_payment_action', __( 'Congratulations, you have successfully upgraded your subscription.', 'paid-member-subscriptions' ), $payment->status, $payment_action, $payment ) );\r\n\r\n elseif( $payment_action == 'renew_subscription' )\r\n pms_success()->add( $message_code, apply_filters( 'pms_message_gateway_payment_action', __( 'Congratulations, you have successfully renewed your subscription.', 'paid-member-subscriptions' ), $payment->status, $payment_action, $payment ) );\r\n\r\n elseif( $payment_action == 'new_subscription' )\r\n pms_success()->add( $message_code, apply_filters( 'pms_message_gateway_payment_action', __( 'Congratulations, you have successfully subscribed to our website.', 'paid-member-subscriptions' ), $payment->status, $payment_action, $payment ) );\r\n\r\n elseif( $payment_action == 'retry_payment' )\r\n pms_success()->add( $message_code, apply_filters( 'pms_message_gateway_payment_action', __( 'Congratulations, you have successfully subscribed to our website.', 'paid-member-subscriptions' ), $payment->status, $payment_action, $payment ) );\r\n\r\n } elseif( $payment->status == 'pending' ) {\r\n\r\n if( $payment_action == 'upgrade_subscription' )\r\n pms_success()->add( $message_code, apply_filters( 'pms_message_gateway_payment_action', __( 'Thank you for your payment. The upgrade may take a while to be processed.', 'paid-member-subscriptions' ), $payment->status, $payment_action, $payment ) );\r\n\r\n elseif( $payment_action == 'renew_subscription' )\r\n pms_success()->add( $message_code, apply_filters( 'pms_message_gateway_payment_action', __( 'Thank you for your payment. The renew may take a while to be processed.', 'paid-member-subscriptions' ), $payment->status, $payment_action, $payment ) );\r\n\r\n elseif( $payment_action == 'new_subscription' )\r\n pms_success()->add( $message_code, apply_filters( 'pms_message_gateway_payment_action', __( 'Thank you for your payment. The subscription may take a while to get activated.', 'paid-member-subscriptions' ), $payment->status, $payment_action, $payment ) );\r\n\r\n elseif( $payment_action == 'retry_payment' )\r\n pms_success()->add( $message_code, apply_filters( 'pms_message_gateway_payment_action', __( 'Thank you for your payment. The subscription may take a while to get activated.', 'paid-member-subscriptions' ), $payment->status, $payment_action, $payment ) );\r\n\r\n }\r\n\r\n }\r\n\r\n }\r\n\r\n }", "public function testAddMessageFromObjectForCurrentRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $user = new \\stdClass();\n $user->name = 'Scooby Doo';\n $user->emailAddress = '[email protected]';\n\n $flash->addMessageNow('user', $user);\n\n $messages = $flash->getMessages();\n $this->assertInstanceOf(\\stdClass::class, $messages['user'][0]);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEmpty($storage['slimFlash']);\n }", "public function testPostInvalidMessage(){\n\t\t//test to make sure non-admin can not post\n\t\t//sign out as admin, log-in as a voulenteer\n\t\t$logout = $this->guzzle-get('https://bootcamp-coders.cnm.edu/~cberaun2/bread-basket/public_html/php/controllers/sign-out-controller.php');\n\n\t\t$volLogin = new stdClass();\n\t\t$volLogin->email = \"[email protected]\";\n\t\t$volLogin->password = \"passwordabc\";\n\t\t$login = $this->guzzle->post('https://bootcamp-coders.cnm,edu/~cberaun2/bread-basket/public_html/php/controllers/sign-out-controller.php', ['allow_redirects' => ['strict' => true], 'json' => $volLogin, 'headers' => ['X-XSRF_TOKEN' => $this->token]]);\n\n\t\t$message = new Message(null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t\t$response = $this->guzzle->post('https://bootcamp-coders.cnm,edu/~cberaun2/bread-basket/public_html/php/api/message', ['allow_redirects' => ['strict' => true], 'json' => $volLogin, 'headers' => ['X-XSRF_TOKEN' => $this->token]]);\n\n\t\t$this->assertSame($response->getStatusCode(), 200);\n\t\t$body = $response->getBody();\n\t\t$retrievedMess = json_decode($body);\n\n\t\t//Make sure the organization was not entered into the databaase\n\t\t$shouldNotExist = Message::getMessageByMessageId($this->getPDO(), $this->VALID_MESSAGE_ID);\n\t\t$this->assertSame($shouldNotExist->getSize(), 0);\n\n\t\t//makeSure 401 error is returned for trying to access an admin method as a volunteer\n\t\t$this->asserSame(401, $retrievedMess->status);\n\t}", "public function testGetVoicemailMessages()\n {\n }", "public function process_queue()\r\n {\r\n error_reporting(0);\r\n\r\n // TODO: Prefill information is stored in this array. It's nasty, but it works for now.\r\n // This will need to be cleaned up somehow, later.\r\n $this->prefillRequests = array();\r\n\r\n $this->parseResponses();\r\n\r\n // Array of keys that need to be included in the response.\r\n $include = array('request', 'class', 'hit');\r\n $responseQuery = [];\r\n foreach($this->messageQuery as $response) {\r\n // Switch all keys to lower case to prevent possible case errors.\r\n $responseArr = array_change_key_case($response, CASE_LOWER);\r\n // returns an array that intersects with the keys from the $include array\r\n $responseQuery[] = array_intersect_key($responseArr, array_flip($include));\r\n }\r\n\r\n $requestSummary = $this->ArchiveResponse->ArchiveRequest->Request->getSummary(\r\n $this->CurrentAgency->agencyId,\r\n $this->CurrentDevice->agencyDeviceId);\r\n\r\n $summary = array(\r\n 'requests' => $requestSummary,\r\n 'response' => $responseQuery,\r\n 'prefill' => $this->prefillRequests\r\n );\r\n $this->set('summary', $summary);\r\n }", "function messages( $array ) {\n\t\t$this->messages_list = $array;\n\t\t}", "public function messages()\n {\n }", "public function testGetVoicemailGroupMessages()\n {\n }", "private function repect_ech_m(){\t\n\t\t\t\n\t\t\tif($this->get_request_method() != \"GET\"){\n\t\t\t\t$this->response('',406);\n\t\t\t}\n\t\t\t\n\t\t\t$result=repect_ech_m();\n\t\t\t$this->response($this->json($result), 200);\n\t\t\t$this->response('',204);\t\n\t\t}", "protected function initializeMessages()\n {\n $this->messages = array(\n \n );\n }", "public function test_next_map()\n {\n $this->assertSame('Al Basrah Insurgency v1', $this->btwServer->nextMap());\n }", "function tn_messages() {\n\tdo_action( 'tn_messages' );\n}" ]
[ "0.62519413", "0.61591566", "0.61474276", "0.60851175", "0.607869", "0.6024805", "0.6023967", "0.58872044", "0.58124787", "0.5809612", "0.58067995", "0.57403266", "0.57360333", "0.5706457", "0.5687764", "0.5684246", "0.5680642", "0.5617745", "0.5605141", "0.5577496", "0.55737954", "0.554145", "0.55352926", "0.5522789", "0.551162", "0.5498583", "0.54957664", "0.5482698", "0.54694", "0.5450951", "0.5447974", "0.5436517", "0.5425723", "0.54105175", "0.5407406", "0.53928196", "0.53864294", "0.53571534", "0.5352516", "0.5349125", "0.5306798", "0.52982825", "0.52806294", "0.5278766", "0.5266187", "0.5263631", "0.52613986", "0.52604204", "0.5256624", "0.5248061", "0.5245154", "0.5242094", "0.52307594", "0.5210261", "0.5204962", "0.5195658", "0.5192268", "0.5191232", "0.5185531", "0.5174844", "0.51634425", "0.51586", "0.51564485", "0.5134395", "0.51339024", "0.51312315", "0.5130671", "0.51222587", "0.5122021", "0.5116605", "0.51106834", "0.5108258", "0.5099688", "0.50988865", "0.50931746", "0.5091619", "0.50899494", "0.5085194", "0.50799316", "0.5073375", "0.5073375", "0.50711864", "0.507044", "0.50687504", "0.5066088", "0.50659037", "0.5064981", "0.506386", "0.505967", "0.5059213", "0.5056575", "0.50479454", "0.50468874", "0.5044712", "0.5042246", "0.50360477", "0.5029552", "0.50282866", "0.5027558", "0.50163454" ]
0.73202366
0
Test getting the message from the key
public function testGetMessageFromKey() { $storage = ['slimFlash' => [ 'Test' => ['Test', 'Test2']]]; $flash = new Messages($storage); $this->assertEquals(['Test', 'Test2'], $flash->getMessage('Test')); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testGetFirstMessageFromKey()\n {\n $storage = ['slimFlash' => [ 'Test' => ['Test', 'Test2']]];\n $flash = new Messages($storage);\n\n $this->assertEquals('Test', $flash->getFirstMessage('Test'));\n }", "public function testGetMessageFromKeyIncludingCurrent()\n {\n $storage = ['slimFlash' => [ 'Test' => ['Test', 'Test2']]];\n $flash = new Messages($storage);\n $flash->addMessageNow('Test', 'Test3');\n\n $messages = $flash->getMessages();\n\n $this->assertEquals(['Test', 'Test2','Test3'], $flash->getMessage('Test'));\n }", "function verifyKey($msg){\n\n // TODO: check if this key is in the database!\n if(isset($_GET['key'])){\n $apiKey = $_GET['key'];\n $userid = $_GET['userid'];\n\n if($apiKey == getApiKey($userid)){\n // Fillter on datatype\n filterRequest($msg);\n }else{\n $msg->message = 'Invalid key!';\n $msg->toJson();\n }\n }else{\n $msg->message = 'Key not set!';\n $msg->toJson();\n }\n}", "public function testDefaultFromGetFirstMessageFromKeyIfKeyDoesntExist()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $this->assertEquals('This', $flash->getFirstMessage('Test', 'This'));\n }", "public function testCanGetMessageByKeyFromTranslator()\n {\n $this->translator->load();\n $message = $this->translator->get('test_message');\n $this->assertEquals('file has been loaded', $message);\n }", "public function testKey()\n\t{\n\t\t$retunMessage = '';\n\t\t\n\t\t$this->setRequestQuery( array( 'phone'=>Wp_WhitePages_Model_Api::API_REQUEST_TEST_PHONENUMBER) );\n\t\t$testRequest = $this->_makeRequest(Wp_WhitePages_Model_Api::API_REQUEST_METHOD_TEST);\n\n\t\tif($this->_result[\"result\"]['type'] == 'error')\n\t\t{\n\t\t\t$retunMessage = $this->_result[\"result\"][\"message\"];\n\t\t}\n\t\telseif($this->_result[\"result\"])\n\t\t{\n\t\t\t$retunMessage = Mage::helper('whitePages')->__(Wp_WhitePages_Model_Api::API_REQUEST_TEST_SUCCESS_MESSAGE);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$retunMessage = Mage::helper('whitePages')->__(Wp_WhitePages_Model_Api::API_REQUEST_TEST_ERROR_MESSAGE);\n\t\t}\n\n\t\treturn $retunMessage;\n\t}", "public function testGetKey()\n {\n }", "abstract public function get_message();", "public function testGetMessage()\n {\n $config = new Configuration();\n// $config->setHost(\"http://127.0.0.1:8080\");\n $apiInstance = new DaDaPushMessageApi(\n // If you want use custom http client, pass your client which implements `GuzzleHttp\\ClientInterface`.\n // This is optional, `GuzzleHttp\\Client` will be used as default.\n new \\GuzzleHttp\\Client(),\n $config\n );\n\n $channel_token = 'ctb3lwO6AeiZOwqZgp8BE8980FdNgp0cp6MCf';\n $message_id=227845;\n $result = $apiInstance->getMessage($message_id, $channel_token);\n print_r($result);\n self::assertTrue($result->getCode()==0);\n }", "public function testGetMessage()\n {\n // Configure HTTP basic authorization: basicAuth\n $config = Configuration::getDefaultConfiguration()\n ->setUsername('YOUR_USERNAME')\n ->setPassword('YOUR_PASSWORD');\n\n $expected_code = 200;\n // Create a mock response\n $expected = new \\Karix\\Model\\MessageListResponse();\n // Create a mock handler\n $mock = new \\GuzzleHttp\\Handler\\MockHandler([\n new \\GuzzleHttp\\Psr7\\Response($expected_code, [], $expected),\n ]);\n $handler = \\GuzzleHttp\\HandlerStack::create($mock);\n $client = new \\GuzzleHttp\\Client(['handler' => $handler]);\n\n $apiInstance = new Api\\MessageApi(\n $client,\n $config\n );\n $direction = \"direction_example\";\n $account_uid = \"account_uid_example\";\n $state = \"state_example\";\n $offset = 0;\n $limit = 10;\n\n try {\n $result = $apiInstance->getMessage($direction, $account_uid, $state, $offset, $limit);\n $this->assertEquals($expected, $result);\n } catch (Exception $e) {\n $this->fail(\"Exception when calling MessageApi->getMessage: \".$e->getMessage());\n }\n }", "public function testGetValidMessagebyMessageId(){\n\t\t//create a new message\n\t\t$newMessage =new message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t\t$newMessage->insert($this->getPDO());\n\n\t\t//grab the data from guzzle\n\t\t$response = $this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/' . $newMessage-getMessage());\n\t\t$this->assertSame($response->getStatusCode(),200);\n\t\t$body = $response->getBody();\n\t\t$alertLevel = json_decode ($body);\n\t\t$this->assertSame(200, $alertLevel->status);\n\t}", "public function testCreateMessageBodyDraftHasMessageKey()\n {\n\n $this->expectException(ImapClientException::class);\n\n $account = $this->getTestUserStub()->getMailAccount(\"dev_sys_conjoon_org\");\n $mailFolderId = \"INBOX\";\n $folderKey = new FolderKey($account, $mailFolderId);\n $client = $this->createClient();\n $client->createMessageBodyDraft(\n $folderKey,\n new MessageBodyDraft(new MessageKey(\"a\", \"b\", \"c\"))\n );\n }", "public function test_peekMessage() {\n\n }", "private static function get_email_message($user_data, $key)\n {\n }", "public function testProtosGet()\n {\n }", "public function testGetMessageById()\n {\n // Configure HTTP basic authorization: basicAuth\n $config = Configuration::getDefaultConfiguration()\n ->setUsername('YOUR_USERNAME')\n ->setPassword('YOUR_PASSWORD');\n\n $expected_code = 200;\n // Create a mock response\n $expected = new \\Karix\\Model\\MessageResponse();\n // Create a mock handler\n $mock = new \\GuzzleHttp\\Handler\\MockHandler([\n new \\GuzzleHttp\\Psr7\\Response($expected_code, [], $expected),\n ]);\n $handler = \\GuzzleHttp\\HandlerStack::create($mock);\n $client = new \\GuzzleHttp\\Client(['handler' => $handler]);\n\n $apiInstance = new Api\\MessageApi(\n $client,\n $config\n );\n $uid = \"uid_example\";\n\n try {\n $result = $apiInstance->getMessageById($uid);\n $this->assertEquals($expected, $result);\n } catch (Exception $e) {\n $this->fail(\"Exception when calling MessageApi->getMessageById: \".$e->getMessage());\n }\n }", "public function testGetValidMessageByMessageText(){\n\t\t//create a new message\n\t\t$newMessage =new message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t\t$newMessage->insert($this->getPDO());\n\n\t\t//grab the data from guzzle\n\t\t$response = $this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/' . $newMessage-getMessage());\n\t\t$this->assertSame($response->getStatusCode(),200);\n\t\t$body = $response->getBody();\n\t\t$alertLevel = json_decode ($body);\n\t\t$this->assertSame(200, $alertLevel->status);\n\t}", "public function test_getMessageById() {\n\n }", "public function testLogMessage()\n {\n $message = 'Test message #' . rand();\n\n $data = self::$ctnClient1->logMessage($message);\n\n $this->assertTrue(isset($data->messageId));\n }", "public function testAuthenticationsSmsIdGet()\n {\n }", "public function testGetKey()\n {\n $subject = $this->createInstance();\n $reflect = $this->reflect($subject);\n\n $key = uniqid('key-');\n\n $reflect->_setKey($key);\n\n $this->assertEquals($key, $subject->getKey(), 'Set and retrieved keys are not the same.');\n }", "public function testMessageThreadsV2GetMessages()\n {\n }", "public function test_getMessage() {\n\n }", "public function testGetVoicemailMeMessages()\n {\n }", "public function test_getAllMessages() {\n\n }", "public function test_generate_key()\n {\n $key = GuestToken::generate_key();\n $this->assertGreaterThan(10, strlen($key));\n }", "Public function testGetInvalidMessageByMessageId(){\n\t //create a new message\n\t $newMessage =new message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t $newMessage->insert($this->getPDO());\n\n\t //grab the data from guzzle\n\t $response = $this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/' . $newMessage-getMessage());\n\t $this->assertSame($response->getStatusCode(),200);\n\t $body = $response->getBody();\n\t $alertLevel = json_decode ($body);\n\t $this->assertSame(200, $alertLevel->status);\n }", "public function testGetVoicemailMessages()\n {\n }", "function request($message, $peer_id, $keyboard, $sticker_id)\r\n{\r\n $request_params = array(\r\n 'message' => $message,\r\n 'peer_id' => $peer_id,\r\n 'access_token' => VK_API_TOKEN,\r\n 'v' => '5.80',\r\n 'sticker_id' => $sticker_id,\r\n 'keyboard' => json_encode($keyboard)\r\n );\r\n\r\n $get_params = http_build_query($request_params);\r\n file_get_contents('https://api.vk.com/method/messages.send?' . $get_params);\r\n echo('ok');\r\n}", "public function testGetKey()\n {\n $subject = new Iteration($key = 'test-key', '');\n\n $this->assertEquals($key, $subject->getKey());\n }", "public function testPutVoicemailMessage()\n {\n }", "public function testGetVoicemailGroupMessages()\n {\n }", "public function testGetVoicemailQueueMessages()\n {\n }", "public function testGetMessages()\n {\n $config = new Configuration();\n// $config->setHost(\"http://127.0.0.1:8080\");\n $apiInstance = new DaDaPushMessageApi(\n // If you want use custom http client, pass your client which implements `GuzzleHttp\\ClientInterface`.\n // This is optional, `GuzzleHttp\\Client` will be used as default.\n new \\GuzzleHttp\\Client(),\n $config\n );\n\n $channel_token = 'ctb3lwO6AeiZOwqZgp8BE8980FdNgp0cp6MCf';\n $page=1;\n $page_size=10;\n\n $result = $apiInstance->getMessages($page,$page_size, $channel_token);\n print_r($result);\n self::assertTrue($result->getCode()==0);\n }", "public function testMessage()\r\n {\r\n\r\n $this->flash->message(\"testMessage\");\r\n $this->assertEquals(\"testMessage\", $_SESSION[\"flash\"][\"messages\"][\"message\"][0]);\r\n\r\n }", "public function testGetVoicemailMessage()\n {\n }", "public function testMessageThreadsV2GetMessages0()\n {\n }", "function testAPIKeySession()\n\t{\n\t\t$arrReturn = array();\n\t\t$strCheckSpelling = \"Hornbill ! $ % ^ * ( ) _ + @ ~ . , / ' ' < > & \\\" 'Service Manager' Spelling Mitsake\";\n\n\t\t$the_transport = new \\Esp\\Transport(self::ESP_ADDRESS, \"xmlmc\", \"dav\");\n\t\t$mc = new \\Esp\\MethodCall($the_transport);\n\n\t\t$mc->setAPIKey(self::API_KEY);\n\t\t$mc->invoke(\"session\", \"getSessionInfo\");\n\t\t$strSessionID = $mc->getReturnParamAsString(\"sessionId\");\n\n\t\tarray_push($arrReturn, $this->buildResponse(\"session\", \"getSessionInfo\", \"DEBUG\", \"Session ID: \" . $strSessionID));\n\n\t\treturn $arrReturn;\n\t}", "public function testDeleteKey()\n {\n }", "protected abstract function _message();", "public function testMessageThreadsV2Get()\n {\n }", "public function testApikey() {\n $this->assertNotNull($this->object->apikey('8f14e45fceea167a5a36dedd4bea2543'));\n }", "public function get_message( $key = null ) {\n // Gets the message for the given key from the message_values property.\n if ( $key === null ) return $this->message_values;\n else if ( isset($this->message_values[$key] ) ) return $this->message_values[$key];\n else return false;\n }", "public function testValidGetById() {\n\t\t//create a new message, and insert ino the database\n\t\t$newMessage = new Message(null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t\t$newMessage->insert($this->getPDO());\n\n\t\t//send the get request to the API\n\t\t$response = $this->guzzle=get('http://bootcamp-coders.cnm.edu/~cberaun2/bread-basket/public_html/php/api/message/' . $newMessage->getMessageId(), ['headers' => ['XRSF-TOKEN' => $this->token]]);\n\n\t\t//ensure the response was sent, and the api returned a positive status\n\t\t$this->assertSame($response->getStatusCode(), 200);\n\t\t$body = $response->getBody();\n\t\t$retrievedMass = json_encode($body);\n\t\t$this->AssertSame(200, $retrievedMass->status);\n\n\t\t//ensure the returned values meet expectations (just clicking enough to make sure the right thing was obtained)\n\t\t$this->assertSame($retrievedMass->data->messageId, $newMessage->getMessageId());\n\t\t$this->assertSame($retrievedMass->data->orgId, $this->VALID_ORG_ID);\n\t}", "public function assertFlashedMessage($key)\n {\n $this->assertTrue(Lang::has($key), \"Oops! The language key '$key' doesn't exist\");\n $this->assertSessionHas('flash_notification.message', trans($key));\n }", "private function read($key){\r\n}", "public function testPutValidMessage () {\n\n\t\t//create a new message\n\t\t$newMessage = new Message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t\t$newMessage->insert($this->getPDO());\n\n\t\t//run a get request to establish session tokens\n\t\t$this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/');\n\n\t\t//grab the data from guzzle and enforce the status match our expectations\n\t\t$response = $this->guzzle->put('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/' . $newMessage->getMessage(),['headers' => ['X-XRF-TOKEN' => $this->getXsrfToken()], 'json' => $newMessage] );\n\t\t$this->assertSame($response->getStatusCode(), 200);\n\t\t$body = $response->getBpdy();\n\t\t$alertLevel = json_decode($body);\n\t\t$this->assertSame(200, $alertLevel->status);\n\n\t}", "public function testGetInvalidMessageByMessageText(){\n\t\t//create a new message\n\t\t$newMessage =new message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t\t$newMessage->insert($this->getPDO());\n\n\t\t//grab the data from guzzle\n\t\t$response = $this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/' . $newMessage-getMessage());\n\t\t$this->assertSame($response->getStatusCode(),200);\n\t\t$body = $response->getBody();\n\t\t$alertLevel = json_decode ($body);\n\t\t$this->assertSame(200, $alertLevel->status);\n\t}", "public function testPostVoicemailMessages()\n {\n }", "public function testAntBackendGetMessage()\r\n\t{\r\n\t\t// Create new mail object and save it to ANT\r\n\t\t$obj = CAntObject::factory($this->dbh, \"email_message\", null, $this->user);\r\n\t\t$obj->setGroup(\"Inbox\");\r\n\t\t$obj->setValue(\"flag_seen\", 'f');\r\n\t\t$obj->setHeader(\"Subject\", \"UnitTest EmailSubject\");\r\n\t\t$obj->setHeader(\"From\", \"[email protected]\");\r\n\t\t$obj->setHeader(\"To\", \"[email protected]\");\r\n\t\t$obj->setBody(\"UnitTest EmailBody\", \"plain\");\r\n\t\t$eid = $obj->save();\r\n\r\n\t\t$contentParams = new ContentParameters();\r\n $email = $this->backend->getEmail($eid, $contentParams);\r\n $this->assertEquals($obj->getValue(\"subject\"), $email->subject);\r\n $this->assertEquals($obj->getValue(\"sent_from\"), $email->from); \r\n \r\n // Cleanup\r\n $obj->removeHard();\r\n\t}", "public function testGetterMethod()\n {\n $publickey = '-----BEGIN CERTIFICATE-----\nMIIDijCCAvOgAwIBAgIJAOXBQLEpMB4rMA0GCSqGSIb3DQEBBQUAMIGLMQswCQYD\nVQQGEwJKUDEOMAwGA1UECBMFVG9reW8xETAPBgNVBAcTCFNoaW5qdWt1MRAwDgYD\nVQQKEwdleGFtcGxlMRAwDgYDVQQLEwdleGFtcGxlMRQwEgYDVQQDEwtleGFtcGxl\nLmNvbTEfMB0GCSqGSIb3DQEJARYQcm9vdEBleGFtcGxlLmNvbTAeFw0wOTEwMTUw\nODMyNDdaFw0xOTEwMTMwODMyNDdaMIGLMQswCQYDVQQGEwJKUDEOMAwGA1UECBMF\nVG9reW8xETAPBgNVBAcTCFNoaW5qdWt1MRAwDgYDVQQKEwdleGFtcGxlMRAwDgYD\nVQQLEwdleGFtcGxlMRQwEgYDVQQDEwtleGFtcGxlLmNvbTEfMB0GCSqGSIb3DQEJ\nARYQcm9vdEBleGFtcGxlLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA\norhSQotOymjP+lnDqRvrlYWKzd3M8vE82U7emeS9KQPtCBoy+fXP/kMEMxG/YU+c\nNAS/2BLFGN48EPM0ZAQap384nx+TNZ6sGuCJa60go8yIWff72DZjSZI6otfPjC9S\nNlxOnNLNAfGWAiaCcuBP1uJVhyrs1pu7SaEXBOP4pQ0CAwEAAaOB8zCB8DAdBgNV\nHQ4EFgQU3mEIdWrvKu+yuwIJD2WczQLI3j4wgcAGA1UdIwSBuDCBtYAU3mEIdWrv\nKu+yuwIJD2WczQLI3j6hgZGkgY4wgYsxCzAJBgNVBAYTAkpQMQ4wDAYDVQQIEwVU\nb2t5bzERMA8GA1UEBxMIU2hpbmp1a3UxEDAOBgNVBAoTB2V4YW1wbGUxEDAOBgNV\nBAsTB2V4YW1wbGUxFDASBgNVBAMTC2V4YW1wbGUuY29tMR8wHQYJKoZIhvcNAQkB\nFhByb290QGV4YW1wbGUuY29tggkA5cFAsSkwHiswDAYDVR0TBAUwAwEB/zANBgkq\nhkiG9w0BAQUFAAOBgQAO2ZKL0/tPhpVfbOoSXl+tlmTyyb8w7mCnjYYWwcwUAf1N\nylgYxKPrKfamjZKpeRY487VbTee1jfud709oIK5l9ghjz64kPRn/AYHTRwRkBKbb\nwuBWH4L6Rw3ml0ODXW64bdTx/QsAv5M1SyCp/nl8R27dz3MX2D1Ov2o4ipTlZw==\n-----END CERTIFICATE-----';\n $this->assertEquals('testuser', $this->consumer->getKey());\n $this->assertEquals('testpass', $this->consumer->getSecret());\n $this->assertEquals($publickey, $this->consumer->getPublicKey());\n }", "public function testGetMessageByIdRequiredParams()\n {\n // Configure HTTP basic authorization: basicAuth\n $config = Configuration::getDefaultConfiguration()\n ->setUsername('YOUR_USERNAME')\n ->setPassword('YOUR_PASSWORD');\n\n $expected_code = 200;\n // Create a mock response\n $expected = new \\Karix\\Model\\MessageResponse();\n // Create a mock handler\n $mock = new \\GuzzleHttp\\Handler\\MockHandler([\n new \\GuzzleHttp\\Psr7\\Response($expected_code, [], $expected),\n ]);\n $handler = \\GuzzleHttp\\HandlerStack::create($mock);\n $client = new \\GuzzleHttp\\Client(['handler' => $handler]);\n\n $apiInstance = new Api\\MessageApi(\n $client,\n $config\n );\n $uid = \"uid_example\";\n\n $_tempVal = $uid;\n $uid = null;\n try {\n $result = $apiInstance->getMessageById($uid);\n $this->fail(\"No exception when calling MessageApi->getMessageById with null uid\");\n } catch (\\InvalidArgumentException $e) {\n $this->assertEquals('Missing the required parameter $uid when calling getMessageById', $e->getMessage());\n }\n $uid = $_tempVal;\n }", "public function testGetMessageRequiredParams()\n {\n // Configure HTTP basic authorization: basicAuth\n $config = Configuration::getDefaultConfiguration()\n ->setUsername('YOUR_USERNAME')\n ->setPassword('YOUR_PASSWORD');\n\n $expected_code = 200;\n // Create a mock response\n $expected = new \\Karix\\Model\\MessageListResponse();\n // Create a mock handler\n $mock = new \\GuzzleHttp\\Handler\\MockHandler([\n new \\GuzzleHttp\\Psr7\\Response($expected_code, [], $expected),\n ]);\n $handler = \\GuzzleHttp\\HandlerStack::create($mock);\n $client = new \\GuzzleHttp\\Client(['handler' => $handler]);\n\n $apiInstance = new Api\\MessageApi(\n $client,\n $config\n );\n $direction = \"direction_example\";\n $account_uid = \"account_uid_example\";\n $state = \"state_example\";\n $offset = 0;\n $limit = 10;\n\n }", "static function getSingleMessage($key = 'id', $value = 0)\r\n {\r\n if ($value === '')\r\n {\r\n return null;\r\n }\r\n\r\n $tableMessage = DatabaseManager::getNameTable('TABLE_MESSAGE');\r\n\r\n $query = \"SELECT $tableMessage.*\r\n FROM $tableMessage \r\n WHERE $tableMessage.$key = '$value'\";\r\n\r\n if ($value2 !== '')\r\n {\r\n $query = $query . \" AND $tableMessage.$key2 = '$value2'\";\r\n }\r\n\r\n $myMessage = DatabaseManager::singleFetchAssoc($query);\r\n $myMessage = self::ArrayToMessage($myMessage);\r\n\r\n return $myMessage;\r\n }", "public function testGetCacheKey(): void\n {\n // If I have a method\n $uut = $this->getMethod($this->method);\n\n // I expect the active modules tracker key to be returned\n $moduleManager = $this->getMockManager($this->method);\n $expected = \"modules-cache\";\n $this->assertSame($expected, $uut->invoke($moduleManager));\n }", "public static function retrieve($key){\n if(self::exists($key)){\n return self::$answers[strtolower($key)];\n }\n return \"ERROR\";\n }", "public function testMessages()\n {\n $response = $this->json('GET', '/api/messages');\n $response->assertJsonStructure([\n 'messages'=>[\n 'current_page',\n 'data' => [\n [\n 'uid',\n 'sender',\n 'subject',\n 'message',\n 'time_sent',\n 'archived',\n 'read'\n ]\n ],\n 'first_page_url',\n 'from',\n 'last_page',\n 'last_page_url',\n 'next_page_url',\n 'path',\n 'per_page',\n 'prev_page_url',\n 'to',\n 'total'\n ]\n ]);\n }", "public function testBasicTest()\n {\n\n\n $testData = [\n \"msisdn\" => \"441632960960\",\n \"to\" => \"441632960961\",\n \"messageId\" => \"02000000E68951D8\",\n \"text\" => \"Hello7\",\n \"type\" => \"text\",\n \"keyword\" => \"HELLO7\",\n \"message-timestamp\" => \"2016-07-05 21:46:15\"\n ];\n $response = $this->postJson('/receive-sms', $testData);\n\n $response->assertStatus(200);\n }", "abstract public function getMessage(): ReceivedMessage;", "abstract public function getMessage(): ReceivedMessage;", "public function test_updateMessage() {\n\n }", "public function testFixture(): void {\n $message = $this->getFixture(\"example_bounce.eml\");\n\n self::assertEquals(\"<>\", $message->return_path);\n self::assertEquals([\n 0 => 'from somewhere.your-server.de by somewhere.your-server.de with LMTP id 3TP8LrElAGSOaAAAmBr1xw (envelope-from <>); Thu, 02 Mar 2023 05:27:29 +0100',\n 1 => 'from somewhere06.your-server.de ([1b21:2f8:e0a:50e4::2]) by somewhere.your-server.de with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) id 1pXaXR-0006xQ-BN for [email protected]; Thu, 02 Mar 2023 05:27:29 +0100',\n 2 => 'from [192.168.0.10] (helo=sslproxy01.your-server.de) by somewhere06.your-server.de with esmtps (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) id 1pXaXO-000LYP-9R for [email protected]; Thu, 02 Mar 2023 05:27:26 +0100',\n 3 => 'from localhost ([127.0.0.1] helo=sslproxy01.your-server.de) by sslproxy01.your-server.de with esmtps (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) id 1pXaXO-0008gy-7x for [email protected]; Thu, 02 Mar 2023 05:27:26 +0100',\n 4 => 'from Debian-exim by sslproxy01.your-server.de with local (Exim 4.92) id 1pXaXO-0008gb-6g for [email protected]; Thu, 02 Mar 2023 05:27:26 +0100',\n 5 => 'from somewhere.your-server.de by somewhere.your-server.de with LMTP id 3TP8LrElAGSOaAAAmBr1xw (envelope-from <>)',\n ], $message->received->all());\n self::assertEquals(\"[email protected]\", $message->envelope_to);\n self::assertEquals(\"Thu, 02 Mar 2023 05:27:29 +0100\", $message->delivery_date);\n self::assertEquals([\n 0 => 'somewhere.your-server.de; iprev=pass (somewhere06.your-server.de) smtp.remote-ip=1b21:2f8:e0a:50e4::2; spf=none smtp.mailfrom=<>; dmarc=skipped',\n 1 => 'somewhere.your-server.de'\n ], $message->authentication_results->all());\n self::assertEquals([\n 0 => 'from somewhere.your-server.de by somewhere.your-server.de with LMTP id 3TP8LrElAGSOaAAAmBr1xw (envelope-from <>); Thu, 02 Mar 2023 05:27:29 +0100',\n 1 => 'from somewhere06.your-server.de ([1b21:2f8:e0a:50e4::2]) by somewhere.your-server.de with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) id 1pXaXR-0006xQ-BN for [email protected]; Thu, 02 Mar 2023 05:27:29 +0100',\n 2 => 'from [192.168.0.10] (helo=sslproxy01.your-server.de) by somewhere06.your-server.de with esmtps (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) id 1pXaXO-000LYP-9R for [email protected]; Thu, 02 Mar 2023 05:27:26 +0100',\n 3 => 'from localhost ([127.0.0.1] helo=sslproxy01.your-server.de) by sslproxy01.your-server.de with esmtps (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) id 1pXaXO-0008gy-7x for [email protected]; Thu, 02 Mar 2023 05:27:26 +0100',\n 4 => 'from Debian-exim by sslproxy01.your-server.de with local (Exim 4.92) id 1pXaXO-0008gb-6g for [email protected]; Thu, 02 Mar 2023 05:27:26 +0100',\n 5 => 'from somewhere.your-server.de by somewhere.your-server.de with LMTP id 3TP8LrElAGSOaAAAmBr1xw (envelope-from <>)',\n ], $message->received->all());\n self::assertEquals(\"[email protected]\", $message->x_failed_recipients);\n self::assertEquals(\"auto-replied\", $message->auto_submitted);\n self::assertEquals(\"Mail Delivery System <[email protected]>\", $message->from);\n self::assertEquals(\"[email protected]\", $message->to);\n self::assertEquals(\"1.0\", $message->mime_version);\n self::assertEquals(\"Mail delivery failed\", $message->subject);\n self::assertEquals(\"[email protected]\", $message->message_id);\n self::assertEquals(\"2023-03-02 04:27:26\", $message->date->first()->setTimezone('UTC')->format(\"Y-m-d H:i:s\"));\n self::assertEquals(\"Clear (ClamAV 0.103.8/26827/Wed Mar 1 09:28:49 2023)\", $message->x_virus_scanned);\n self::assertEquals(\"0.0 (/)\", $message->x_spam_score);\n self::assertEquals(\"[email protected]\", $message->delivered_to);\n self::assertEquals(\"multipart/report\", $message->content_type->last());\n self::assertEquals(\"5d4847c21c8891e73d62c8246f260a46496958041a499f33ecd47444fdaa591b\", hash(\"sha256\", $message->getTextBody()));\n self::assertFalse($message->hasHTMLBody());\n\n $attachments = $message->attachments();\n self::assertCount(2, $attachments);\n\n $attachment = $attachments[0];\n self::assertInstanceOf(Attachment::class, $attachment);\n self::assertEquals('c541a506', $attachment->filename);\n self::assertEquals(\"c541a506\", $attachment->name);\n self::assertEquals('', $attachment->getExtension());\n self::assertEquals('text', $attachment->type);\n self::assertEquals(\"message/delivery-status\", $attachment->content_type);\n self::assertEquals(\"85ac09d1d74b2d85853084dc22abcad205a6bfde62d6056e3a933ffe7e82e45c\", hash(\"sha256\", $attachment->content));\n self::assertEquals(267, $attachment->size);\n self::assertEquals(1, $attachment->part_number);\n self::assertNull($attachment->disposition);\n self::assertNotEmpty($attachment->id);\n\n $attachment = $attachments[1];\n self::assertInstanceOf(Attachment::class, $attachment);\n self::assertEquals('da786518', $attachment->filename);\n self::assertEquals(\"da786518\", $attachment->name);\n self::assertEquals('', $attachment->getExtension());\n self::assertEquals('text', $attachment->type);\n self::assertEquals(\"message/rfc822\", $attachment->content_type);\n self::assertEquals(\"7525331f5fab23ea77f595b995336aca7b8dad12db00ada14abebe7fe5b96e10\", hash(\"sha256\", $attachment->content));\n self::assertEquals(776, $attachment->size);\n self::assertEquals(2, $attachment->part_number);\n self::assertNull($attachment->disposition);\n self::assertNotEmpty($attachment->id);\n }", "public function getMessage();", "public function getMessage();", "public function getMessage();", "public function getMessage();", "public function getMessage();", "public function getMessage();", "public function getMessage();", "public function getMessage();", "public function getMessage();", "public function getMessage();", "public function getMessage();", "public function getMessage();", "public function getMessage();", "public function testCustomKey()\n {\n $key = 'my-custom-key';\n $auth = new JwtAuthenticate($this->Registry, [\n 'key' => $key,\n 'queryDatasource' => false,\n ]);\n\n $payload = ['sub' => 100];\n $token = JWT::encode($payload, $key);\n\n $request = new ServerRequest();\n $request = $request->withEnv('HTTP_AUTHORIZATION', 'Bearer ' . $token);\n $result = $auth->getUser($request, $this->response);\n $this->assertEquals($payload, $result);\n\n $request = new ServerRequest(['url' => '/posts/index?token=' . $token]);\n $result = $auth->getUser($request, $this->response);\n $this->assertEquals($payload, $result);\n }", "public function testListKeys()\n {\n }", "public function testGetKeyRevisionHistory()\n {\n }", "public function testReceiveWithKeyIsEmpty()\n {\n $callback = function (){};\n $eventName = 'bar-foo-testing';\n\n $this->adapter->expects($this->once())->method('receive')\n ->with($eventName, $callback, null);\n\n $this->eventReceiver->receive($eventName, $callback);\n }", "public function getMessage( $key, $code ) {\n\t\t$title = Title::makeTitle( $this->getNamespace(), $key );\n\t\t$handle = new MessageHandle( $title );\n\t\t$groupId = MessageIndex::getPrimaryGroupId( $handle );\n\t\tif ( $groupId === $this->getId() ) {\n\t\t\t// Message key owned by aggregate group.\n\t\t\t// Should not ever happen, but it does.\n\t\t\terror_log( \"AggregateMessageGroup $groupId cannot be primary owner of key $key\" );\n\n\t\t\treturn null;\n\t\t}\n\n\t\t$group = MessageGroups::getGroup( $groupId );\n\t\tif ( $group ) {\n\t\t\treturn $group->getMessage( $key, $code );\n\t\t} else {\n\t\t\treturn null;\n\t\t}\n\t}", "public function testGetArrayKey() : void\n {\n $this->assertEquals('inner_content', FileInfoStreamFactory::getArrayKey());\n\n return;\n }", "public function testGetValidMessageByOrgId(){\n\t\t//create a new message\n\t\t$newMessage =new message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t\t$newMessage->insert($this->getPDO());\n\n\t\t//grab the data from guzzle\n\t\t$response = $this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/' . $newMessage-getMessage());\n\t\t$this->assertSame($response->getStatusCode(),200);\n\t\t$body = $response->getBody();\n\t\t$alertLevel = json_decode ($body);\n\t\t$this->assertSame(200, $alertLevel->status);\n\t}", "public function getMessage() {}", "public function getMessage() {}", "public function getMessage() {}", "public function getResponseMessage();", "function getMessage ($messageKey, $title = \"\", $arrParam=array()) {\n\tif (!empty($messageKey)) {\n\t\t$message = Constants::$listMessage[$messageKey];\n\t\t$message = str_replace(\"###TITLE###\", $title, $message);\n\t\t$arrParam = is_array($arrParam) ? $arrParam : array();\n\t\tforeach ($arrParam as $k => $v) {\n\t\t\t$k = strtoupper($k);\n\t\t\t$message = str_replace(\"###$k###\", $v, $message);\n\t\t}\n\t\treturn $message;\n\t}\n\treturn \"\";\n}", "public function test_get_user_messages(): void\n {\n $request = GroupRequest::ofUserName(self::DEFAULT_GROUP_DEEPLINK);\n $this->resolve($request, function (?int $groupId, ?int $accessHash) {\n $count = 0;\n $handler = function (?MessageModel $message = null) use (&$count) {\n if ($message) {\n $this->assertEquals('qweq', $message->getText());\n $count++;\n }\n };\n $client = new GroupMessagesScenario(\n new GroupId($groupId, $accessHash),\n $this->clientGenerator,\n new OptionalDateRange(),\n $handler,\n self::USERNAME\n );\n $client->setTimeout(self::TIMEOUT);\n $client->startActions();\n $this->assertEquals(1, $count);\n });\n }", "function getReply($key){\n\t$mysql=new MySQL();\n\n\t$select=$mysql->table(REPLY_TABLE)->where(\"`key`='$key'\")->select();\n\tif($select!=NULL){\t\t//There exist a reply for this key\n\n\t\tif($select[0]['type']=='text'){\t//It's a TextMessage\n\t\t\treturn new TextMessage($select[0]['content']);\n\t\t}else{\n\t\t\t$news=new NewsMessage();\n\t\t\t$news->LoadFromTX(array($select[0]['content']));\n\t\t\treturn $news;\n\t\t}\n\t}\n}", "private function get_message()\n {\n switch (self::$requestType) {\n case 'payRequest':\n self::$msg = sha1(self::$mid . self::$amount . self::$cac . self::$MsTxnId . self::$firstName . self::$familyName . self::$timeStamp, true);\n break;\n case 'payNote':\n self::$msg = sha1(self::$mid . self::$amount . self::$cac . self::$PspTxnId . self::$MsTxnId . self::$timeStamp . self::$Result, true);\n break;\n }\n }", "function pkeyGet($kv)\n {\n return Memcached_DataObject::pkeyGet('QnA_Answer', $kv);\n }", "public function testMessageThreadsV2Get0()\n {\n }", "protected function getMessage()\n {\n //return new \\Swift_Message('Test subject', 'Test body.');\n }", "function get ($key) {\n return $this->memcached->get($key);\n }", "abstract public function doVerify(string $expected, string $payload, Key $key): bool;", "public function testGetValidMessageByListingId(){\n\t\t//create a new message\n\t\t$newMessage =new message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t\t$newMessage->insert($this->getPDO());\n\n\t\t//grab the data from guzzle\n\t\t$response = $this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/' . $newMessage-getMessage());\n\t\t$this->assertSame($response->getStatusCode(),200);\n\t\t$body = $response->getBody();\n\t\t$alertLevel = json_decode ($body);\n\t\t$this->assertSame(200, $alertLevel->status);\n\t}", "public function testKeyNotFound()\n {\n $headers = [\n 'Content-Type' => 'text/plain',\n 'X-Authorization-Timestamp' => time(),\n 'Authorization' => 'acquia-http-hmac realm=\"Pipet service\",'\n . 'id=\"bad-id\",'\n . 'nonce=\"d1954337-5319-4821-8427-115542e08d10\",'\n . 'version=\"2.0\",'\n . 'headers=\"\",'\n . 'signature=\"MRlPr/Z1WQY2sMthcaEqETRMw4gPYXlPcTpaLWS2gcc=\"',\n ];\n $request = new Request('GET', 'https://example.com/test', $headers);\n\n $this->expectException(KeyNotFoundException::class);\n\n $authenticator = new RequestAuthenticator(new MockKeyLoader($this->keys));\n $authenticator->authenticate($request);\n }", "public function testSendMessageDraftNoDraft()\n {\n\n $account = $this->getTestUserStub()->getMailAccount(\"dev_sys_conjoon_org\");\n $mailFolderId = \"DRAFTS\";\n $messageItemId = \"989786\";\n $messageKey = new MessageKey($account, $mailFolderId, $messageItemId);\n\n $client = $this->createClient();\n\n $rangeList = new Horde_Imap_Client_Ids();\n $rangeList->add($messageKey->getId());\n\n $imapStub = Mockery::mock(\"overload:\" . Horde_Imap_Client_Socket::class);\n\n $fetchResult = [];\n $fetchResult[$messageKey->getId()] = new class () {\n /**\n * constructor.\n */\n public function __construct()\n {\n }\n\n /**\n *\n * @noinspection PhpUnused\n */\n public function getFullMsg()\n {\n }\n\n /**\n * @return array\n */\n public function getFlags(): array\n {\n return [];\n }\n };\n\n\n $imapStub->shouldReceive(\"fetch\")\n ->with(\n $messageKey->getMailFolderId(),\n Mockery::any(),\n [\"ids\" => $rangeList]\n )\n ->andReturn($fetchResult);\n\n $this->expectException(ImapClientException::class);\n $client->sendMessageDraft($messageKey);\n }", "function MyApp_Mail_Info_Get($key=\"\")\n {\n if (empty($this->MailInfo))\n {\n $this->MyApp_Mail_Init();\n }\n\n if (!empty($key))\n {\n if (!empty($this->MailInfo[ $key ]))\n {\n return $this->MailInfo[ $key ];\n }\n else\n {\n return $key;\n }\n }\n\n return $this->MailInfo;\n }", "public function testAddMessageFromStringForNextRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $flash->addMessage('key', 'value');\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEquals(['value'], $storage['slimFlash']['key']);\n }" ]
[ "0.74023134", "0.73835194", "0.6972725", "0.69450796", "0.69185096", "0.6911737", "0.6717153", "0.6451006", "0.639705", "0.63416713", "0.6319928", "0.622334", "0.6215651", "0.6082025", "0.607969", "0.6066614", "0.6066289", "0.60417175", "0.60350317", "0.5990788", "0.59269774", "0.5911723", "0.590148", "0.586259", "0.5852697", "0.58410084", "0.58389324", "0.5829831", "0.58043617", "0.57963234", "0.5778048", "0.5769038", "0.57634115", "0.57611716", "0.57568735", "0.5751319", "0.57382977", "0.573748", "0.57037807", "0.5703556", "0.5699102", "0.5697091", "0.56855196", "0.56842744", "0.5677839", "0.567174", "0.564144", "0.561802", "0.56169885", "0.5606806", "0.55987763", "0.5589664", "0.55852115", "0.55734134", "0.5559628", "0.5559188", "0.55436087", "0.5536489", "0.55248696", "0.55248696", "0.55109257", "0.5508353", "0.54925454", "0.54925454", "0.54925454", "0.54925454", "0.54925454", "0.54925454", "0.54925454", "0.54925454", "0.54925454", "0.54925454", "0.54925454", "0.54925454", "0.54925454", "0.5491125", "0.54817057", "0.5473179", "0.5460642", "0.54555595", "0.5451124", "0.5450365", "0.54441154", "0.54441154", "0.54441154", "0.54327494", "0.5431105", "0.5429971", "0.54108465", "0.5404026", "0.54030645", "0.54005545", "0.5397939", "0.53923786", "0.538637", "0.53748727", "0.53732955", "0.536407", "0.5360953", "0.53537977" ]
0.77857244
0
Test getting the first message from the key
public function testGetFirstMessageFromKey() { $storage = ['slimFlash' => [ 'Test' => ['Test', 'Test2']]]; $flash = new Messages($storage); $this->assertEquals('Test', $flash->getFirstMessage('Test')); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testDefaultFromGetFirstMessageFromKeyIfKeyDoesntExist()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $this->assertEquals('This', $flash->getFirstMessage('Test', 'This'));\n }", "public function testGetMessageFromKey()\n {\n $storage = ['slimFlash' => [ 'Test' => ['Test', 'Test2']]];\n $flash = new Messages($storage);\n\n $this->assertEquals(['Test', 'Test2'], $flash->getMessage('Test'));\n }", "public function testGetMessageFromKeyIncludingCurrent()\n {\n $storage = ['slimFlash' => [ 'Test' => ['Test', 'Test2']]];\n $flash = new Messages($storage);\n $flash->addMessageNow('Test', 'Test3');\n\n $messages = $flash->getMessages();\n\n $this->assertEquals(['Test', 'Test2','Test3'], $flash->getMessage('Test'));\n }", "public function first($key, $wrap = ':message')\n {\n $res = $this->get($key, $wrap);\n return array_shift($res);\n }", "public function firstKey();", "public function testFirstMessage()\n {\n $message = new PrivateMessage();\n $conversation = new Conversation();\n $this->assertNull($conversation->getFirstMessage());\n\n $conversation->setFirstMessage($message);\n $this->assertSame($message, $conversation->getFirstMessage());\n }", "static function getSingleMessage($key = 'id', $value = 0)\r\n {\r\n if ($value === '')\r\n {\r\n return null;\r\n }\r\n\r\n $tableMessage = DatabaseManager::getNameTable('TABLE_MESSAGE');\r\n\r\n $query = \"SELECT $tableMessage.*\r\n FROM $tableMessage \r\n WHERE $tableMessage.$key = '$value'\";\r\n\r\n if ($value2 !== '')\r\n {\r\n $query = $query . \" AND $tableMessage.$key2 = '$value2'\";\r\n }\r\n\r\n $myMessage = DatabaseManager::singleFetchAssoc($query);\r\n $myMessage = self::ArrayToMessage($myMessage);\r\n\r\n return $myMessage;\r\n }", "public function testListFirstMessage()\n {\n $data = self::$ctnClient1->listMessages([\n 'startDate' => self::$testStartDate\n ], 1);\n\n $this->assertEquals(1, $data->msgCount);\n $this->assertTrue($data->hasMore);\n }", "function verifyKey($msg){\n\n // TODO: check if this key is in the database!\n if(isset($_GET['key'])){\n $apiKey = $_GET['key'];\n $userid = $_GET['userid'];\n\n if($apiKey == getApiKey($userid)){\n // Fillter on datatype\n filterRequest($msg);\n }else{\n $msg->message = 'Invalid key!';\n $msg->toJson();\n }\n }else{\n $msg->message = 'Key not set!';\n $msg->toJson();\n }\n}", "public function getFirstMessage(): ?MessageInterface;", "public function test_peekMessage() {\n\n }", "public function testCanGetMessageByKeyFromTranslator()\n {\n $this->translator->load();\n $message = $this->translator->get('test_message');\n $this->assertEquals('file has been loaded', $message);\n }", "public function testKey()\n\t{\n\t\t$retunMessage = '';\n\t\t\n\t\t$this->setRequestQuery( array( 'phone'=>Wp_WhitePages_Model_Api::API_REQUEST_TEST_PHONENUMBER) );\n\t\t$testRequest = $this->_makeRequest(Wp_WhitePages_Model_Api::API_REQUEST_METHOD_TEST);\n\n\t\tif($this->_result[\"result\"]['type'] == 'error')\n\t\t{\n\t\t\t$retunMessage = $this->_result[\"result\"][\"message\"];\n\t\t}\n\t\telseif($this->_result[\"result\"])\n\t\t{\n\t\t\t$retunMessage = Mage::helper('whitePages')->__(Wp_WhitePages_Model_Api::API_REQUEST_TEST_SUCCESS_MESSAGE);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$retunMessage = Mage::helper('whitePages')->__(Wp_WhitePages_Model_Api::API_REQUEST_TEST_ERROR_MESSAGE);\n\t\t}\n\n\t\treturn $retunMessage;\n\t}", "public function findFirstByKey($key);", "public function getNextMessage(){\r\n }", "public function get_message( $key = null ) {\n // Gets the message for the given key from the message_values property.\n if ( $key === null ) return $this->message_values;\n else if ( isset($this->message_values[$key] ) ) return $this->message_values[$key];\n else return false;\n }", "abstract public function get_message();", "public function first($defaultMsg='') {\n $r=$this->firstError();\n if ($r!==null) return $r;\n $r=$this->firstWarning();\n if ($r!==null) return $r;\n $r=$this->firstInfo();\n if ($r!==null) return $r;\n $r=$this->firstSuccess();\n if ($r!==null) return $r;\n return $defaultMsg;\n }", "public function testGetKey()\n {\n }", "public function testSendFirstMessage()\n {\n $data = [\n 'message' => Str::random('50'),\n ];\n\n $this->post(route('api.send.message'), $data)\n ->assertStatus(201)\n ->assertJson(['success' => true, 'text' => $data['text']]);\n }", "public function first($key = null)\n {\n return $this->errors[$key][0];\n }", "function nextMessage(): string\n{\n return Session::pop('message');\n}", "public function readone() {\n\t\t$msg = Core_Ipc_Messages::find(['stream' => md5($this->stream)], ['limit' => 1, 'order' => 'msgid']);\n\t\tif(empty($msg)) {\n\t\t\treturn false;\n\t\t}\n\t\t$msg->delete();\n\t\treturn $msg->instance;\n\t}", "public function testGetMessageById()\n {\n // Configure HTTP basic authorization: basicAuth\n $config = Configuration::getDefaultConfiguration()\n ->setUsername('YOUR_USERNAME')\n ->setPassword('YOUR_PASSWORD');\n\n $expected_code = 200;\n // Create a mock response\n $expected = new \\Karix\\Model\\MessageResponse();\n // Create a mock handler\n $mock = new \\GuzzleHttp\\Handler\\MockHandler([\n new \\GuzzleHttp\\Psr7\\Response($expected_code, [], $expected),\n ]);\n $handler = \\GuzzleHttp\\HandlerStack::create($mock);\n $client = new \\GuzzleHttp\\Client(['handler' => $handler]);\n\n $apiInstance = new Api\\MessageApi(\n $client,\n $config\n );\n $uid = \"uid_example\";\n\n try {\n $result = $apiInstance->getMessageById($uid);\n $this->assertEquals($expected, $result);\n } catch (Exception $e) {\n $this->fail(\"Exception when calling MessageApi->getMessageById: \".$e->getMessage());\n }\n }", "public function testGetValidMessagebyMessageId(){\n\t\t//create a new message\n\t\t$newMessage =new message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t\t$newMessage->insert($this->getPDO());\n\n\t\t//grab the data from guzzle\n\t\t$response = $this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/' . $newMessage-getMessage());\n\t\t$this->assertSame($response->getStatusCode(),200);\n\t\t$body = $response->getBody();\n\t\t$alertLevel = json_decode ($body);\n\t\t$this->assertSame(200, $alertLevel->status);\n\t}", "public function testReceiveWithKeyIsEmpty()\n {\n $callback = function (){};\n $eventName = 'bar-foo-testing';\n\n $this->adapter->expects($this->once())->method('receive')\n ->with($eventName, $callback, null);\n\n $this->eventReceiver->receive($eventName, $callback);\n }", "public function testGetKey()\n {\n $subject = new Iteration($key = 'test-key', '');\n\n $this->assertEquals($key, $subject->getKey());\n }", "public function testCreateMessageBodyDraftHasMessageKey()\n {\n\n $this->expectException(ImapClientException::class);\n\n $account = $this->getTestUserStub()->getMailAccount(\"dev_sys_conjoon_org\");\n $mailFolderId = \"INBOX\";\n $folderKey = new FolderKey($account, $mailFolderId);\n $client = $this->createClient();\n $client->createMessageBodyDraft(\n $folderKey,\n new MessageBodyDraft(new MessageKey(\"a\", \"b\", \"c\"))\n );\n }", "public function firstKey() {\n\t\t$keys = $this->keys();\n\t\treturn array_shift($keys);\n\t}", "function blpop(string $key): string {\n while (is_null($message = predis()->lpop($key))) {\n usleep(100000);\n }\n\n return $message;\n}", "public function getMessage($key = null)\n {\n $messageList = self::$messages;\n\n if (null === $key) {\n return $messageList;\n }\n\n return isset($messageList[$key]) ? $messageList[$key] : null;\n }", "public function testMessageThreadsV2GetMessages0()\n {\n }", "public function testGetKey()\n {\n $subject = $this->createInstance();\n $reflect = $this->reflect($subject);\n\n $key = uniqid('key-');\n\n $reflect->_setKey($key);\n\n $this->assertEquals($key, $subject->getKey(), 'Set and retrieved keys are not the same.');\n }", "public function testGetMessage()\n {\n // Configure HTTP basic authorization: basicAuth\n $config = Configuration::getDefaultConfiguration()\n ->setUsername('YOUR_USERNAME')\n ->setPassword('YOUR_PASSWORD');\n\n $expected_code = 200;\n // Create a mock response\n $expected = new \\Karix\\Model\\MessageListResponse();\n // Create a mock handler\n $mock = new \\GuzzleHttp\\Handler\\MockHandler([\n new \\GuzzleHttp\\Psr7\\Response($expected_code, [], $expected),\n ]);\n $handler = \\GuzzleHttp\\HandlerStack::create($mock);\n $client = new \\GuzzleHttp\\Client(['handler' => $handler]);\n\n $apiInstance = new Api\\MessageApi(\n $client,\n $config\n );\n $direction = \"direction_example\";\n $account_uid = \"account_uid_example\";\n $state = \"state_example\";\n $offset = 0;\n $limit = 10;\n\n try {\n $result = $apiInstance->getMessage($direction, $account_uid, $state, $offset, $limit);\n $this->assertEquals($expected, $result);\n } catch (Exception $e) {\n $this->fail(\"Exception when calling MessageApi->getMessage: \".$e->getMessage());\n }\n }", "public function getFirstMessage()\n {\n return isset($this->_messages[0]) ? $this->_messages[0] : '';\n }", "private static function get_email_message($user_data, $key)\n {\n }", "public function firstKey(): ?int;", "public function testLogMessage()\n {\n $message = 'Test message #' . rand();\n\n $data = self::$ctnClient1->logMessage($message);\n\n $this->assertTrue(isset($data->messageId));\n }", "public function getMessage( $key, $code ) {\n\t\t$title = Title::makeTitle( $this->getNamespace(), $key );\n\t\t$handle = new MessageHandle( $title );\n\t\t$groupId = MessageIndex::getPrimaryGroupId( $handle );\n\t\tif ( $groupId === $this->getId() ) {\n\t\t\t// Message key owned by aggregate group.\n\t\t\t// Should not ever happen, but it does.\n\t\t\terror_log( \"AggregateMessageGroup $groupId cannot be primary owner of key $key\" );\n\n\t\t\treturn null;\n\t\t}\n\n\t\t$group = MessageGroups::getGroup( $groupId );\n\t\tif ( $group ) {\n\t\t\treturn $group->getMessage( $key, $code );\n\t\t} else {\n\t\t\treturn null;\n\t\t}\n\t}", "function test_get_by_id()\n {\n $dm = new mdl_direct_message();\n $result = $dm->get_by_id(1, 1);\n\n $this->assertEquals(count($result), 1);\n }", "function getReply($key){\n\t$mysql=new MySQL();\n\n\t$select=$mysql->table(REPLY_TABLE)->where(\"`key`='$key'\")->select();\n\tif($select!=NULL){\t\t//There exist a reply for this key\n\n\t\tif($select[0]['type']=='text'){\t//It's a TextMessage\n\t\t\treturn new TextMessage($select[0]['content']);\n\t\t}else{\n\t\t\t$news=new NewsMessage();\n\t\t\t$news->LoadFromTX(array($select[0]['content']));\n\t\t\treturn $news;\n\t\t}\n\t}\n}", "function MyApp_Mail_Info_Get($key=\"\")\n {\n if (empty($this->MailInfo))\n {\n $this->MyApp_Mail_Init();\n }\n\n if (!empty($key))\n {\n if (!empty($this->MailInfo[ $key ]))\n {\n return $this->MailInfo[ $key ];\n }\n else\n {\n return $key;\n }\n }\n\n return $this->MailInfo;\n }", "public function getFirstKeyInChain(): string\n {\n if ($this->isLeaf) {\n if (!$this->keyTotal) {\n throw new MissedKeysException();\n }\n\n return array_key_first($this->keys);\n }\n\n return $this->keys[array_key_first($this->keys)]->getFirstKeyInChain();\n }", "public function testKey()\n {\n $this->collection->seek(2);\n $this->assertEquals(2, $this->collection->key());\n\n $this->collection->seek('a');\n $this->assertEquals('a', $this->collection->key());\n }", "public function testFirst()\n {\n $this->collection->seek(2);\n $this->collection->first();\n $this->assertEquals(0, $this->collection->key());\n $this->assertEquals(1, $this->collection->current());\n }", "function get($msg_index) {\n if (isset($this->inbox[$msg_index])) \n {\n return $this->inbox[$msg_index];\n }else\n {\n return false;\n }\n }", "public function testGetMessage()\n {\n $config = new Configuration();\n// $config->setHost(\"http://127.0.0.1:8080\");\n $apiInstance = new DaDaPushMessageApi(\n // If you want use custom http client, pass your client which implements `GuzzleHttp\\ClientInterface`.\n // This is optional, `GuzzleHttp\\Client` will be used as default.\n new \\GuzzleHttp\\Client(),\n $config\n );\n\n $channel_token = 'ctb3lwO6AeiZOwqZgp8BE8980FdNgp0cp6MCf';\n $message_id=227845;\n $result = $apiInstance->getMessage($message_id, $channel_token);\n print_r($result);\n self::assertTrue($result->getCode()==0);\n }", "function getMsgList($key = \"\") {\n $msgListArr = array(\n 0 => \"Invalid email and password combination.\",\n 1 => \"Your account is not active.Please contact administrator.\",\n 2 => \"Invalid old password. Please enter correct password.\",\n 3 => \"Password updated Successfully.\",\n 4 => \"Please select another Username.\",\n 5 => \"Record Added Sucessfully.\",\n 6 => \"Record Updated Sucessfully.\",\n 7 => \"Record Removed Sucessfully.\",\n 8 => \"Please select another category name.\",\n 9 => \"Invalid email address.\",\n 10 => \"Error in sending email.\",\n );\n if (isset($msgListArr[$key]))\n return $msgListArr[$key];\n else\n return $msgListArr;\n}", "public function firstInfo($default=null) {\n if (isset($this->infoMsg[0])) {\n return $this->infoMsg[0];\n }\n return $default;\n }", "static function get($key = '') {\n if ($key !== '' && array_key_exists($key, self::$results)) {\n return self::$results[$key];\n }\n $results = self::getAllPendingResults();\n if (count($results) === 1 && $key === '') {\n $singleKey = array_keys($results);\n return $results[$singleKey[0]];\n }\n return $results[$key];\n }", "function get($msg_index=NULL) {\n\n if (count($this->inbox) <= 0) {\n\n\treturn array();\n\n }\n\n elseif ( ! is_null($msg_index) && isset($this->inbox[$msg_index])) {\n\n\treturn $this->inbox[$msg_index];\n\n }\n\n return $this->inbox[0];\n}", "public function testGetDefaultMessageIfNoMatchingValueFoundInMessagesList()\n {\n $this->translator->load();\n $this->assertEquals('default_value', $this->translator->get('invalid_message_key', 'default_value'));\n }", "public function testMessageThreadsV2GetMessages()\n {\n }", "public function getmessage()\n {\n return array_shift($this->storage);\n }", "public function testAddMessageFromStringForNextRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $flash->addMessage('key', 'value');\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEquals(['value'], $storage['slimFlash']['key']);\n }", "public function testValidGetById() {\n\t\t//create a new message, and insert ino the database\n\t\t$newMessage = new Message(null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t\t$newMessage->insert($this->getPDO());\n\n\t\t//send the get request to the API\n\t\t$response = $this->guzzle=get('http://bootcamp-coders.cnm.edu/~cberaun2/bread-basket/public_html/php/api/message/' . $newMessage->getMessageId(), ['headers' => ['XRSF-TOKEN' => $this->token]]);\n\n\t\t//ensure the response was sent, and the api returned a positive status\n\t\t$this->assertSame($response->getStatusCode(), 200);\n\t\t$body = $response->getBody();\n\t\t$retrievedMass = json_encode($body);\n\t\t$this->AssertSame(200, $retrievedMass->status);\n\n\t\t//ensure the returned values meet expectations (just clicking enough to make sure the right thing was obtained)\n\t\t$this->assertSame($retrievedMass->data->messageId, $newMessage->getMessageId());\n\t\t$this->assertSame($retrievedMass->data->orgId, $this->VALID_ORG_ID);\n\t}", "public function testOffsetGetMissingKey()\n {\n self::assertNull($this->container->offsetGet('this key does not exist in the container'));\n }", "public function testProtosGet()\n {\n }", "public function testGetMessageByIdRequiredParams()\n {\n // Configure HTTP basic authorization: basicAuth\n $config = Configuration::getDefaultConfiguration()\n ->setUsername('YOUR_USERNAME')\n ->setPassword('YOUR_PASSWORD');\n\n $expected_code = 200;\n // Create a mock response\n $expected = new \\Karix\\Model\\MessageResponse();\n // Create a mock handler\n $mock = new \\GuzzleHttp\\Handler\\MockHandler([\n new \\GuzzleHttp\\Psr7\\Response($expected_code, [], $expected),\n ]);\n $handler = \\GuzzleHttp\\HandlerStack::create($mock);\n $client = new \\GuzzleHttp\\Client(['handler' => $handler]);\n\n $apiInstance = new Api\\MessageApi(\n $client,\n $config\n );\n $uid = \"uid_example\";\n\n $_tempVal = $uid;\n $uid = null;\n try {\n $result = $apiInstance->getMessageById($uid);\n $this->fail(\"No exception when calling MessageApi->getMessageById with null uid\");\n } catch (\\InvalidArgumentException $e) {\n $this->assertEquals('Missing the required parameter $uid when calling getMessageById', $e->getMessage());\n }\n $uid = $_tempVal;\n }", "public function testAddMessageFromAnIntegerForNextRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $flash->addMessage('key', 46);\n $flash->addMessage('key', 48);\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEquals(['46', '48'], $storage['slimFlash']['key']);\n }", "private function read($key){\r\n}", "public static function retrieve($key){\n if(self::exists($key)){\n return self::$answers[strtolower($key)];\n }\n return \"ERROR\";\n }", "function getFirstMessageBlock(){\n global $mysqli;\n $results = $mysqli->query(\"SELECT block_index FROM messages ORDER BY message_index ASC LIMIT 1\");\n if($results){\n $row = $results->fetch_assoc();\n return $row['block_index'];\n }\n}", "public function testGetEmptyKey()\n {\n $data = [\n '' => 'some value'\n ];\n $result = Hash::get($data, '');\n $this->assertSame($data[''], $result);\n }", "function msg_get($umd=NULL){\n $keys = is_null($umd)?$this->domain_seq:(array)$umd;\n $res = array();\n foreach($keys as $ck) $res[$ck] = $this->domains[$ck]->msg_get();\n return is_array($umd)?$res:array_shift($res);\n }", "public function assertFlashedMessage($key)\n {\n $this->assertTrue(Lang::has($key), \"Oops! The language key '$key' doesn't exist\");\n $this->assertSessionHas('flash_notification.message', trans($key));\n }", "function getMessage ($messageKey, $title = \"\", $arrParam=array()) {\n\tif (!empty($messageKey)) {\n\t\t$message = Constants::$listMessage[$messageKey];\n\t\t$message = str_replace(\"###TITLE###\", $title, $message);\n\t\t$arrParam = is_array($arrParam) ? $arrParam : array();\n\t\tforeach ($arrParam as $k => $v) {\n\t\t\t$k = strtoupper($k);\n\t\t\t$message = str_replace(\"###$k###\", $v, $message);\n\t\t}\n\t\treturn $message;\n\t}\n\treturn \"\";\n}", "public function first(): string;", "abstract public function getFullMessage($msgNo);", "function __get($key){\n if($this->_get($key)==TRUE) return $key; \n return $this->_err(array(1,$key));\n }", "public function test_getMessageById() {\n\n }", "public function testGetArrayKey() : void\n {\n $this->assertEquals('inner_content', FileInfoStreamFactory::getArrayKey());\n\n return;\n }", "public function getFirst($key)\n {\n $params = $this->getParams($key);\n\n return (array_key_exists(0, $params)) ? $params[0] : null;\n }", "public function testCollapseKeyFire() {\n $config = new APNsConfig();\n $fcmTest = new FCMTest();\n $config -> setCollapseKey('test');\n $firstResult = $fcmTest -> fireWithConfig($config);\n sleep(5);\n $secondResult = $fcmTest -> fireWithConfig($config);\n\n $this -> assertEquals($firstResult, $secondResult);\n $this -> assertTrue($firstResult);\n }", "public function getFirst() {}", "public function firstSuccess($default=null) {\n if (isset($this->successMsg[0])) {\n return $this->successMsg[0];\n }\n return $default;\n }", "private function _getKey() {\n if (is_array($this->_keys) && count($this->_keys) > 0) {\n return $this->_keys[0];\n }\n\n return false;\n }", "public function getFirstMessageObj()\r\n {\r\n $tMsg = new TicketMessage($this->messages[0]);\r\n \r\n if($tMsg->isValid())\r\n {\r\n throw new Exception(__METHOD__.\" unable to get ticket\");\r\n }\r\n \r\n return $tMsg;\r\n }", "public function first() {}", "Public function testGetInvalidMessageByMessageId(){\n\t //create a new message\n\t $newMessage =new message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t $newMessage->insert($this->getPDO());\n\n\t //grab the data from guzzle\n\t $response = $this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/' . $newMessage-getMessage());\n\t $this->assertSame($response->getStatusCode(),200);\n\t $body = $response->getBody();\n\t $alertLevel = json_decode ($body);\n\t $this->assertSame(200, $alertLevel->status);\n }", "public function testGetMessagesFromPrevRequest()\n {\n $storage = ['slimFlash' => ['Test']];\n $flash = new Messages($storage);\n\n $this->assertEquals(['Test'], $flash->getMessages());\n }", "function get_index($message){\r\n\tpreg_match('/^\\D*(?=\\d)/', $message, $i);\r\n\treturn isset($i[0]) ? strlen($i[0]) : false;\r\n}", "public function testGetValidMessageByMessageText(){\n\t\t//create a new message\n\t\t$newMessage =new message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t\t$newMessage->insert($this->getPDO());\n\n\t\t//grab the data from guzzle\n\t\t$response = $this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/' . $newMessage-getMessage());\n\t\t$this->assertSame($response->getStatusCode(),200);\n\t\t$body = $response->getBody();\n\t\t$alertLevel = json_decode ($body);\n\t\t$this->assertSame(200, $alertLevel->status);\n\t}", "public function testSendMessageDraftNoDraft()\n {\n\n $account = $this->getTestUserStub()->getMailAccount(\"dev_sys_conjoon_org\");\n $mailFolderId = \"DRAFTS\";\n $messageItemId = \"989786\";\n $messageKey = new MessageKey($account, $mailFolderId, $messageItemId);\n\n $client = $this->createClient();\n\n $rangeList = new Horde_Imap_Client_Ids();\n $rangeList->add($messageKey->getId());\n\n $imapStub = Mockery::mock(\"overload:\" . Horde_Imap_Client_Socket::class);\n\n $fetchResult = [];\n $fetchResult[$messageKey->getId()] = new class () {\n /**\n * constructor.\n */\n public function __construct()\n {\n }\n\n /**\n *\n * @noinspection PhpUnused\n */\n public function getFullMsg()\n {\n }\n\n /**\n * @return array\n */\n public function getFlags(): array\n {\n return [];\n }\n };\n\n\n $imapStub->shouldReceive(\"fetch\")\n ->with(\n $messageKey->getMailFolderId(),\n Mockery::any(),\n [\"ids\" => $rangeList]\n )\n ->andReturn($fetchResult);\n\n $this->expectException(ImapClientException::class);\n $client->sendMessageDraft($messageKey);\n }", "public function getRandomKey(){\n\n //get keys\n return $this->client->randomkey();\n }", "function getFirst() ;", "public function peekFirst();", "public function getKey() {}", "public function getKey() {}", "public function testGetMessageRequiredParams()\n {\n // Configure HTTP basic authorization: basicAuth\n $config = Configuration::getDefaultConfiguration()\n ->setUsername('YOUR_USERNAME')\n ->setPassword('YOUR_PASSWORD');\n\n $expected_code = 200;\n // Create a mock response\n $expected = new \\Karix\\Model\\MessageListResponse();\n // Create a mock handler\n $mock = new \\GuzzleHttp\\Handler\\MockHandler([\n new \\GuzzleHttp\\Psr7\\Response($expected_code, [], $expected),\n ]);\n $handler = \\GuzzleHttp\\HandlerStack::create($mock);\n $client = new \\GuzzleHttp\\Client(['handler' => $handler]);\n\n $apiInstance = new Api\\MessageApi(\n $client,\n $config\n );\n $direction = \"direction_example\";\n $account_uid = \"account_uid_example\";\n $state = \"state_example\";\n $offset = 0;\n $limit = 10;\n\n }", "public function next_message() \n {\n if( ! $this->is_open() || $this->msgnum === NULL ||\n $this->msgnum > $this->count_messages() ) return false;\n \n $this->msgnum++;\n if( $this->msgnum > $this->count_messages() ) return false; \n\n\n if( ! $rawheaders = @imap_fetchheader($this->imap_stream,$this->msgnum) ){\n $this->errors = imap_errors();\n return false;\n } \n \n if( ! $rawbody = imap_body($this->imap_stream,$this->msgnum) ) {\n $this->errors = imap_errors();\n return false;\n } \n\n imap_errors();\t \n $this->current_msg = new IMAPMessage( $this->msgnum, $rawheaders, $rawbody );\n return $this->current_msg;\n }", "public function getIntroMessage($key) {\n\t\t$msg = $this->getIntroMessageParts($key);\n\t\t$curr = Controller::curr();\n\t\t$msg = $curr->customise($msg)->renderWith('embargoIntro');\n\t\treturn $msg;\n\t}", "public function testKeyNotFound()\n {\n $headers = [\n 'Content-Type' => 'text/plain',\n 'X-Authorization-Timestamp' => time(),\n 'Authorization' => 'acquia-http-hmac realm=\"Pipet service\",'\n . 'id=\"bad-id\",'\n . 'nonce=\"d1954337-5319-4821-8427-115542e08d10\",'\n . 'version=\"2.0\",'\n . 'headers=\"\",'\n . 'signature=\"MRlPr/Z1WQY2sMthcaEqETRMw4gPYXlPcTpaLWS2gcc=\"',\n ];\n $request = new Request('GET', 'https://example.com/test', $headers);\n\n $this->expectException(KeyNotFoundException::class);\n\n $authenticator = new RequestAuthenticator(new MockKeyLoader($this->keys));\n $authenticator->authenticate($request);\n }", "public function getError( string $key, $first = false ) {\n\t\t$found = array_filter( $this->getErrors(), function ( $error ) use ( $key ) {\n\t\t\treturn $error[ 'key' ] === $key;\n\t\t} );\n\n\t\t$found = array_values( $found );\n\n\t\tif ( $first ) {\n\t\t\treturn array_shift( $found );\n\t\t}\n\n\t\treturn $found;\n\t}", "function testAPIKeySession()\n\t{\n\t\t$arrReturn = array();\n\t\t$strCheckSpelling = \"Hornbill ! $ % ^ * ( ) _ + @ ~ . , / ' ' < > & \\\" 'Service Manager' Spelling Mitsake\";\n\n\t\t$the_transport = new \\Esp\\Transport(self::ESP_ADDRESS, \"xmlmc\", \"dav\");\n\t\t$mc = new \\Esp\\MethodCall($the_transport);\n\n\t\t$mc->setAPIKey(self::API_KEY);\n\t\t$mc->invoke(\"session\", \"getSessionInfo\");\n\t\t$strSessionID = $mc->getReturnParamAsString(\"sessionId\");\n\n\t\tarray_push($arrReturn, $this->buildResponse(\"session\", \"getSessionInfo\", \"DEBUG\", \"Session ID: \" . $strSessionID));\n\n\t\treturn $arrReturn;\n\t}", "public function testMessageThreadsV2Get0()\n {\n }", "function get ($key) {\n return $this->memcached->get($key);\n }", "public function test_get_user_messages(): void\n {\n $request = GroupRequest::ofUserName(self::DEFAULT_GROUP_DEEPLINK);\n $this->resolve($request, function (?int $groupId, ?int $accessHash) {\n $count = 0;\n $handler = function (?MessageModel $message = null) use (&$count) {\n if ($message) {\n $this->assertEquals('qweq', $message->getText());\n $count++;\n }\n };\n $client = new GroupMessagesScenario(\n new GroupId($groupId, $accessHash),\n $this->clientGenerator,\n new OptionalDateRange(),\n $handler,\n self::USERNAME\n );\n $client->setTimeout(self::TIMEOUT);\n $client->startActions();\n $this->assertEquals(1, $count);\n });\n }", "public function getFirst();", "public function testAuthenticationsSmsIdGet()\n {\n }" ]
[ "0.7507137", "0.69184434", "0.6886332", "0.64328176", "0.6408872", "0.6302087", "0.6230232", "0.6221132", "0.6141961", "0.61303663", "0.6051193", "0.5973054", "0.59687555", "0.5947246", "0.58659756", "0.5840703", "0.57835543", "0.57457983", "0.57017016", "0.5682362", "0.5671264", "0.5669568", "0.56508636", "0.5615954", "0.56003356", "0.5586511", "0.5562374", "0.55535704", "0.55484307", "0.5545911", "0.5487535", "0.5477825", "0.5476184", "0.54701144", "0.5449058", "0.54427075", "0.5438226", "0.5422736", "0.542003", "0.5405106", "0.5392892", "0.5375936", "0.53626764", "0.5359491", "0.5354555", "0.53310764", "0.5331063", "0.5315341", "0.5286939", "0.52823275", "0.52806336", "0.5270228", "0.52674955", "0.5266938", "0.5258612", "0.52564675", "0.52450943", "0.5238422", "0.5233884", "0.5233125", "0.5226553", "0.5207467", "0.52037776", "0.51998806", "0.5191691", "0.5175792", "0.5169454", "0.5161625", "0.51561636", "0.51509297", "0.5137486", "0.5136853", "0.5134316", "0.5131146", "0.5123515", "0.51181215", "0.51045436", "0.5102499", "0.50945616", "0.50904655", "0.50830126", "0.50819105", "0.5076121", "0.5075411", "0.5074595", "0.50745773", "0.50703233", "0.5066156", "0.5066156", "0.50604796", "0.505057", "0.5045734", "0.50414634", "0.5040223", "0.5030987", "0.50247437", "0.50097215", "0.500215", "0.49996758", "0.49941343" ]
0.81680954
0
Test getting the default message if the key doesn't exist
public function testDefaultFromGetFirstMessageFromKeyIfKeyDoesntExist() { $storage = ['slimFlash' => []]; $flash = new Messages($storage); $this->assertEquals('This', $flash->getFirstMessage('Test', 'This')); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testGetDefaultMessageIfNoMatchingValueFoundInMessagesList()\n {\n $this->translator->load();\n $this->assertEquals('default_value', $this->translator->get('invalid_message_key', 'default_value'));\n }", "public static function getDefaultMessage(): string;", "public function get_option_default($key)\n {\n switch ($key) {\n case self::FIELD_MESSAGE:\n return 'Hello, World!';\n\n default:\n return '';\n }\n }", "public function testSetMessageDefaultKey()\n {\n $this->_validator->setMessage(\n 'Your value is too short',\n Zend_Validate_StringLength::TOO_SHORT\n );\n\n $this->assertFalse($this->_validator->isValid('abc'));\n $messages = $this->_validator->getMessages();\n $this->assertEquals('Your value is too short', current($messages));\n $errors = $this->_validator->getErrors();\n $this->assertEquals(Zend_Validate_StringLength::TOO_SHORT, current($errors));\n }", "public function testGetFirstMessageFromKey()\n {\n $storage = ['slimFlash' => [ 'Test' => ['Test', 'Test2']]];\n $flash = new Messages($storage);\n\n $this->assertEquals('Test', $flash->getFirstMessage('Test'));\n }", "private function maybe_print_message( $message, $default ) {\n\t\treturn ! empty( $message ) ? $message : $default;\n\t}", "public function defaultMessage()\n {\n return \"There are no webhooks registered for {$this->eventName}\";\n }", "function get_message($default='')\n\t{\n\t\t$msg = isset($_SESSION['message']) ? $_SESSION['message'] : $default;\n\t\tunset($_SESSION['message']);\n\t\treturn $msg;\n\t}", "public function testGetMessageFromKeyIncludingCurrent()\n {\n $storage = ['slimFlash' => [ 'Test' => ['Test', 'Test2']]];\n $flash = new Messages($storage);\n $flash->addMessageNow('Test', 'Test3');\n\n $messages = $flash->getMessages();\n\n $this->assertEquals(['Test', 'Test2','Test3'], $flash->getMessage('Test'));\n }", "public function get_message( $key = null ) {\n // Gets the message for the given key from the message_values property.\n if ( $key === null ) return $this->message_values;\n else if ( isset($this->message_values[$key] ) ) return $this->message_values[$key];\n else return false;\n }", "private function get($key, $default = null)\n {\n if (isset($this->responseData['error'][$key])) {\n return $this->responseData['error'][$key];\n }\n\n return $default;\n }", "function trans_or_default(string $key, $default, array $replace = [], $locale = null): string\n {\n $message = trans($key, $replace, $locale);\n\n return $message === $key ? $default : $message;\n }", "public function testGetMessageFromKey()\n {\n $storage = ['slimFlash' => [ 'Test' => ['Test', 'Test2']]];\n $flash = new Messages($storage);\n\n $this->assertEquals(['Test', 'Test2'], $flash->getMessage('Test'));\n }", "public function testGetFlashDefault()\n {\n $val = $this->_req->getFlash('DOESNT_EXIST', 'default value');\n $this->assertEquals('default value', $val);\n }", "public function getMessDefault ()\n {\n return $this->mess_default;\n }", "private function _get($key, $default = null) {}", "public function getDefaultMessage()\n {\n return $this->defaultMessage;\n }", "function errorMsg($keyName, $label) {\n\n // PHP checks whether certain keys have been returned with values in the GET Global Super Array, if it has then echo the value into the input field\n if(isset($_GET[$keyName]) && $_GET[$keyName] === '') {\n\n return \"<div class='warning_msg'>Please enter \" . $label . \".</div>\";\n\n } //end if statement\n\n}", "abstract protected function getNotFoundMessage();", "function getMsgList($key = \"\") {\n $msgListArr = array(\n 0 => \"Invalid email and password combination.\",\n 1 => \"Your account is not active.Please contact administrator.\",\n 2 => \"Invalid old password. Please enter correct password.\",\n 3 => \"Password updated Successfully.\",\n 4 => \"Please select another Username.\",\n 5 => \"Record Added Sucessfully.\",\n 6 => \"Record Updated Sucessfully.\",\n 7 => \"Record Removed Sucessfully.\",\n 8 => \"Please select another category name.\",\n 9 => \"Invalid email address.\",\n 10 => \"Error in sending email.\",\n );\n if (isset($msgListArr[$key]))\n return $msgListArr[$key];\n else\n return $msgListArr;\n}", "function testRequiredDefaultMessage(){\n\t\t#mdx:required2\n\t\tFlSouto\\ParamFilters::$errmsg_required = 'Cannot be empty';\n\n\t\tParam::get('name')\n\t\t\t->context(['name'=>''])\n\t\t\t->filters()\n\t\t\t\t->required();\n\n\t\t$error = Param::get('name')->process()->error;\n\t\t#/mdx var_dump($error)\n\t\t$this->assertEquals(\"Cannot be empty\", $error);\n\t}", "abstract public function Get(string $key, $default = NULL);", "public function get(string $key = NULL, $default = NULL) /* mixed */\n\t{\n\t\treturn (isset($this->flashRecord[$key], $this->flashRecord[$key]['data'])) ? $this->flashRecord[$key]['data'] : $default;\n\t}", "private function altMessageExist()\n { \n return !empty($this->altMessage);\n }", "public function testCanGetMessageByKeyFromTranslator()\n {\n $this->translator->load();\n $message = $this->translator->get('test_message');\n $this->assertEquals('file has been loaded', $message);\n }", "private function getIsExpected($key, $default)\n {\n if (array_key_exists($key, $this->server)) {\n if (isset($this->server[$key])) {\n return (bool) (int) $this->server[$key];\n }\n return null;\n }\n return $default;\n }", "function array_key_or_exit($key, $arr, $msg) {\n exit_if(!array_key_exists($key, $arr), $msg);\n return $arr[$key];\n}", "public function has($key): bool\n {\n return !empty($this->messages[$key]);\n }", "public function assertFlashedMessage($key)\n {\n $this->assertTrue(Lang::has($key), \"Oops! The language key '$key' doesn't exist\");\n $this->assertSessionHas('flash_notification.message', trans($key));\n }", "function verifyKey($msg){\n\n // TODO: check if this key is in the database!\n if(isset($_GET['key'])){\n $apiKey = $_GET['key'];\n $userid = $_GET['userid'];\n\n if($apiKey == getApiKey($userid)){\n // Fillter on datatype\n filterRequest($msg);\n }else{\n $msg->message = 'Invalid key!';\n $msg->toJson();\n }\n }else{\n $msg->message = 'Key not set!';\n $msg->toJson();\n }\n}", "public function getIfExists($key, $default_value=null);", "function getMessage ($messageKey, $title = \"\", $arrParam=array()) {\n\tif (!empty($messageKey)) {\n\t\t$message = Constants::$listMessage[$messageKey];\n\t\t$message = str_replace(\"###TITLE###\", $title, $message);\n\t\t$arrParam = is_array($arrParam) ? $arrParam : array();\n\t\tforeach ($arrParam as $k => $v) {\n\t\t\t$k = strtoupper($k);\n\t\t\t$message = str_replace(\"###$k###\", $v, $message);\n\t\t}\n\t\treturn $message;\n\t}\n\treturn \"\";\n}", "function _err_msg($key, $params = NULL)\n\t{\n\t\treturn F::lang($key, $params);\n\t}", "public function get(string $key, $default = false);", "public function ensureDefaultKeys() {}", "public function testOffsetGetMissingKey()\n {\n self::assertNull($this->container->offsetGet('this key does not exist in the container'));\n }", "private function msg($k){\r\n global $language;\r\n\r\n return $language[$k];\r\n\r\n\r\n }", "public function get ($key, $default=false);", "abstract public function get_message();", "function _get_param($key, $default_value = '')\n\t\t{\n\t\t\t$val = $this->EE->TMPL->fetch_param($key);\n\n\t\t\tif($val == '') {\n\t\t\t\treturn $default_value;\n\t\t\t}\n\t\t\treturn $val;\n\t\t}", "function stage_get_fallback_template($chosen_key, $default_key = null, $data = array())\n{\n // Does the file exist -> return\n $path = Settings::getFallbackTemplatePath($chosen_key, $default_key);\n return stage_render_template($path, $data);\n}", "public function default(){\n msg('Please select one of the menu commands.');\n }", "function inputGet($key, $default = \"\")\n{\n\tif(inputHas($key)) {\n\t\treturn $_REQUEST[$key];\n\t} else {\n\t\treturn $default;\n\t}\n}", "public function hasDefault();", "public function getIntroMessage($key) {\n\t\t$msg = $this->getIntroMessageParts($key);\n\t\t$curr = Controller::curr();\n\t\t$msg = $curr->customise($msg)->renderWith('embargoIntro');\n\t\treturn $msg;\n\t}", "public function displayDefaultMessageOutputEn()\n {\n // initialize the class with defaults (en_US locale, library path).\n $message = new CustomerMessage();\n\n // we expect the default message, because error 987.654.321 might not exist\n // in the default locale file en_US.csv.\n $this->assertEquals(\n 'An unexpected error occurred. Please contact us to get further information.',\n $message->getMessage('987.654.321')\n );\n }", "public function get($key, $default = null){\n\t\tif(true === array_key_exists($key, $this->stack)){\n\t\t\treturn $this->stack[$key];\n\t\t}else{\n\t\t\t$this->messages[] = \"$key not found in stack. using default: $default\";\n\t\t\treturn $default;\n\t\t}\n\t}", "public function get(string $key, $default = null);", "public function get(string $key, $default = null);", "public function get(string $key, $default = null);", "public function get(string $key, $default = null);", "public function get(string $key, $default = null);", "public function get(string $key, $default = null);", "public function get(string $key, $default = null);", "public function get(string $key, $default = null);", "private static function get($key = null, $default = null) {\r\n\r\n if(null !== $key && isset(static::$method['method'], static::$method['data'])) {\r\n\r\n if(true === static :: isMethod(static::$method['method'])) {\r\n\r\n $translator = new StringTranslator(static::$method['data']);\r\n $data = $translator -> get($key);\r\n $default = (null === $data ? $default : $data);\r\n }\r\n\r\n static::$method = [];\r\n }\r\n\r\n return $default;\r\n }", "protected function initMessage(): ?string\n {\n return 'entity.validation_failed';\n }", "static function getSingleMessage($key = 'id', $value = 0)\r\n {\r\n if ($value === '')\r\n {\r\n return null;\r\n }\r\n\r\n $tableMessage = DatabaseManager::getNameTable('TABLE_MESSAGE');\r\n\r\n $query = \"SELECT $tableMessage.*\r\n FROM $tableMessage \r\n WHERE $tableMessage.$key = '$value'\";\r\n\r\n if ($value2 !== '')\r\n {\r\n $query = $query . \" AND $tableMessage.$key2 = '$value2'\";\r\n }\r\n\r\n $myMessage = DatabaseManager::singleFetchAssoc($query);\r\n $myMessage = self::ArrayToMessage($myMessage);\r\n\r\n return $myMessage;\r\n }", "public function first($defaultMsg='') {\n $r=$this->firstError();\n if ($r!==null) return $r;\n $r=$this->firstWarning();\n if ($r!==null) return $r;\n $r=$this->firstInfo();\n if ($r!==null) return $r;\n $r=$this->firstSuccess();\n if ($r!==null) return $r;\n return $defaultMsg;\n }", "function get($key, $default = null);", "public function get($key){\n\t\treturn (key_exists($key, $this->data)) ? $this->data[$key] : Translator::DEFAULT_INVALID_KEY;\n\t}", "function MyApp_Mail_Info_Get($key=\"\")\n {\n if (empty($this->MailInfo))\n {\n $this->MyApp_Mail_Init();\n }\n\n if (!empty($key))\n {\n if (!empty($this->MailInfo[ $key ]))\n {\n return $this->MailInfo[ $key ];\n }\n else\n {\n return $key;\n }\n }\n\n return $this->MailInfo;\n }", "private static function get_email_message($user_data, $key)\n {\n }", "function cspm_setting_exists($key, $array, $default = ''){\r\n\t\t\t\r\n\t\t\t$array_value = isset($array[$key]) ? $array[$key] : $default;\r\n\t\t\t\r\n\t\t\t$setting_value = empty($array_value) ? $default : $array_value;\r\n\t\t\t\r\n\t\t\treturn $setting_value;\r\n\t\t\t\r\n\t\t}", "abstract public function get($key, $default = false);", "public function getMessage() {}", "public function getMessage() {}", "public function getMessage() {}", "public function testMissReturnsNull(): void\n {\n $key = 'I do not exist';\n $a = $this->testNotStrict->get($key);\n $this->assertNull($a);\n }", "private function initMessage()\n {\n $this->_message['MSG_ERROR'] = Utils::getMessageError();\n $this->_message['MSG_ALERT'] = Utils::getMessageALert();\n }", "public function get(string $key, $default = null)\n {\n return false;\n }", "public function get_service_message( $key, $args = array(), $default = null ) {\n\t\tif ( empty( $this->service_messages[ $key ] ) ) {\n\t\t\t// Get error message if this is a registered Tribe_Error key.\n\t\t\t$error = tribe_error( $key );\n\n\t\t\tif ( is_wp_error( $error ) && 'unknown' !== $error->get_error_code() ) {\n\t\t\t\treturn $error->get_error_message();\n\t\t\t}\n\n\t\t\t// Use default message if set.\n\t\t\tif ( null !== $default ) {\n\t\t\t\treturn $default;\n\t\t\t}\n\n\t\t\treturn $this->get_unknow_message();\n\t\t}\n\n\t\treturn vsprintf( $this->service_messages[ $key ], $args );\n\t}", "public function get($key, $default = null);", "public function get($key, $default = null);", "public function get($key, $default = null);", "public function get($key, $default = null);", "public function get($key, $default = null);", "public function get($key, $default = null);", "public function get($key, $default = null);", "public function get($key, $default = null);", "public function get($key, $default = null);", "public function get($key, $default = null);", "public function get($key, $default = null);", "public function get($key, $default = null);", "public function get($key, $default = null);", "public function get($key, $default = null);", "public function get($key, $default = null);", "public function get($key, $default = null);", "public function testGetKeyUriWithEmptyLabel() {\n // throw the empty label exception message\n GoogleAuthenticator::getKeyUri('hotp', '', 'secret');\n }", "function get_param($key, $default_value = '')\n\t{\n\t\t$val = ee()->TMPL->fetch_param($key);\n\t\t\n\t\tif($val == '') \n\t\t\treturn $default_value;\n\t\telse\n\t\t\treturn $val;\n\t}", "function set_message_key($key, $val)\n{\n if(!isset($_SESSION[$key]))\n {\n $_SESSION[$key] = $val;\n }\n}", "public function getMessage();", "public function getMessage();", "public function getMessage();", "public function getMessage();", "public function getMessage();", "public function getMessage();", "public function getMessage();", "public function getMessage();", "public function getMessage();" ]
[ "0.7424013", "0.7027813", "0.6519302", "0.6421024", "0.63071084", "0.6300398", "0.6262814", "0.62199277", "0.62195075", "0.62076044", "0.6201398", "0.6134098", "0.6125542", "0.60229933", "0.6016036", "0.59516007", "0.5947008", "0.59423625", "0.59402615", "0.5927038", "0.5853016", "0.5833716", "0.5819003", "0.58159596", "0.5813812", "0.57850015", "0.57611763", "0.5702429", "0.5699146", "0.5669038", "0.56415844", "0.5615205", "0.559537", "0.55950236", "0.55893725", "0.5588027", "0.5560889", "0.55538243", "0.5541476", "0.55386865", "0.5531685", "0.55250823", "0.5517469", "0.55152094", "0.5512411", "0.55117875", "0.550975", "0.55090064", "0.55090064", "0.55090064", "0.55090064", "0.55090064", "0.55090064", "0.55090064", "0.55090064", "0.5507799", "0.5493924", "0.54918885", "0.5488523", "0.5487539", "0.5486226", "0.5478729", "0.5469479", "0.5459529", "0.5449037", "0.54466", "0.54466", "0.54466", "0.5444482", "0.5442859", "0.543683", "0.5430214", "0.5429367", "0.5429367", "0.5429367", "0.5429367", "0.5429367", "0.5429367", "0.5429367", "0.5429367", "0.5429367", "0.5429367", "0.5429367", "0.5429367", "0.5429367", "0.5429367", "0.5429367", "0.5429367", "0.5410809", "0.54099804", "0.54047203", "0.5382254", "0.5382254", "0.5382254", "0.5382254", "0.5382254", "0.5382254", "0.5382254", "0.5382254", "0.5382254" ]
0.7725253
0
Test getting the message from the key
public function testGetMessageFromKeyIncludingCurrent() { $storage = ['slimFlash' => [ 'Test' => ['Test', 'Test2']]]; $flash = new Messages($storage); $flash->addMessageNow('Test', 'Test3'); $messages = $flash->getMessages(); $this->assertEquals(['Test', 'Test2','Test3'], $flash->getMessage('Test')); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testGetMessageFromKey()\n {\n $storage = ['slimFlash' => [ 'Test' => ['Test', 'Test2']]];\n $flash = new Messages($storage);\n\n $this->assertEquals(['Test', 'Test2'], $flash->getMessage('Test'));\n }", "public function testGetFirstMessageFromKey()\n {\n $storage = ['slimFlash' => [ 'Test' => ['Test', 'Test2']]];\n $flash = new Messages($storage);\n\n $this->assertEquals('Test', $flash->getFirstMessage('Test'));\n }", "function verifyKey($msg){\n\n // TODO: check if this key is in the database!\n if(isset($_GET['key'])){\n $apiKey = $_GET['key'];\n $userid = $_GET['userid'];\n\n if($apiKey == getApiKey($userid)){\n // Fillter on datatype\n filterRequest($msg);\n }else{\n $msg->message = 'Invalid key!';\n $msg->toJson();\n }\n }else{\n $msg->message = 'Key not set!';\n $msg->toJson();\n }\n}", "public function testDefaultFromGetFirstMessageFromKeyIfKeyDoesntExist()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $this->assertEquals('This', $flash->getFirstMessage('Test', 'This'));\n }", "public function testCanGetMessageByKeyFromTranslator()\n {\n $this->translator->load();\n $message = $this->translator->get('test_message');\n $this->assertEquals('file has been loaded', $message);\n }", "public function testKey()\n\t{\n\t\t$retunMessage = '';\n\t\t\n\t\t$this->setRequestQuery( array( 'phone'=>Wp_WhitePages_Model_Api::API_REQUEST_TEST_PHONENUMBER) );\n\t\t$testRequest = $this->_makeRequest(Wp_WhitePages_Model_Api::API_REQUEST_METHOD_TEST);\n\n\t\tif($this->_result[\"result\"]['type'] == 'error')\n\t\t{\n\t\t\t$retunMessage = $this->_result[\"result\"][\"message\"];\n\t\t}\n\t\telseif($this->_result[\"result\"])\n\t\t{\n\t\t\t$retunMessage = Mage::helper('whitePages')->__(Wp_WhitePages_Model_Api::API_REQUEST_TEST_SUCCESS_MESSAGE);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$retunMessage = Mage::helper('whitePages')->__(Wp_WhitePages_Model_Api::API_REQUEST_TEST_ERROR_MESSAGE);\n\t\t}\n\n\t\treturn $retunMessage;\n\t}", "public function testGetKey()\n {\n }", "abstract public function get_message();", "public function testGetMessage()\n {\n $config = new Configuration();\n// $config->setHost(\"http://127.0.0.1:8080\");\n $apiInstance = new DaDaPushMessageApi(\n // If you want use custom http client, pass your client which implements `GuzzleHttp\\ClientInterface`.\n // This is optional, `GuzzleHttp\\Client` will be used as default.\n new \\GuzzleHttp\\Client(),\n $config\n );\n\n $channel_token = 'ctb3lwO6AeiZOwqZgp8BE8980FdNgp0cp6MCf';\n $message_id=227845;\n $result = $apiInstance->getMessage($message_id, $channel_token);\n print_r($result);\n self::assertTrue($result->getCode()==0);\n }", "public function testGetMessage()\n {\n // Configure HTTP basic authorization: basicAuth\n $config = Configuration::getDefaultConfiguration()\n ->setUsername('YOUR_USERNAME')\n ->setPassword('YOUR_PASSWORD');\n\n $expected_code = 200;\n // Create a mock response\n $expected = new \\Karix\\Model\\MessageListResponse();\n // Create a mock handler\n $mock = new \\GuzzleHttp\\Handler\\MockHandler([\n new \\GuzzleHttp\\Psr7\\Response($expected_code, [], $expected),\n ]);\n $handler = \\GuzzleHttp\\HandlerStack::create($mock);\n $client = new \\GuzzleHttp\\Client(['handler' => $handler]);\n\n $apiInstance = new Api\\MessageApi(\n $client,\n $config\n );\n $direction = \"direction_example\";\n $account_uid = \"account_uid_example\";\n $state = \"state_example\";\n $offset = 0;\n $limit = 10;\n\n try {\n $result = $apiInstance->getMessage($direction, $account_uid, $state, $offset, $limit);\n $this->assertEquals($expected, $result);\n } catch (Exception $e) {\n $this->fail(\"Exception when calling MessageApi->getMessage: \".$e->getMessage());\n }\n }", "public function testGetValidMessagebyMessageId(){\n\t\t//create a new message\n\t\t$newMessage =new message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t\t$newMessage->insert($this->getPDO());\n\n\t\t//grab the data from guzzle\n\t\t$response = $this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/' . $newMessage-getMessage());\n\t\t$this->assertSame($response->getStatusCode(),200);\n\t\t$body = $response->getBody();\n\t\t$alertLevel = json_decode ($body);\n\t\t$this->assertSame(200, $alertLevel->status);\n\t}", "public function testCreateMessageBodyDraftHasMessageKey()\n {\n\n $this->expectException(ImapClientException::class);\n\n $account = $this->getTestUserStub()->getMailAccount(\"dev_sys_conjoon_org\");\n $mailFolderId = \"INBOX\";\n $folderKey = new FolderKey($account, $mailFolderId);\n $client = $this->createClient();\n $client->createMessageBodyDraft(\n $folderKey,\n new MessageBodyDraft(new MessageKey(\"a\", \"b\", \"c\"))\n );\n }", "public function test_peekMessage() {\n\n }", "private static function get_email_message($user_data, $key)\n {\n }", "public function testProtosGet()\n {\n }", "public function testGetMessageById()\n {\n // Configure HTTP basic authorization: basicAuth\n $config = Configuration::getDefaultConfiguration()\n ->setUsername('YOUR_USERNAME')\n ->setPassword('YOUR_PASSWORD');\n\n $expected_code = 200;\n // Create a mock response\n $expected = new \\Karix\\Model\\MessageResponse();\n // Create a mock handler\n $mock = new \\GuzzleHttp\\Handler\\MockHandler([\n new \\GuzzleHttp\\Psr7\\Response($expected_code, [], $expected),\n ]);\n $handler = \\GuzzleHttp\\HandlerStack::create($mock);\n $client = new \\GuzzleHttp\\Client(['handler' => $handler]);\n\n $apiInstance = new Api\\MessageApi(\n $client,\n $config\n );\n $uid = \"uid_example\";\n\n try {\n $result = $apiInstance->getMessageById($uid);\n $this->assertEquals($expected, $result);\n } catch (Exception $e) {\n $this->fail(\"Exception when calling MessageApi->getMessageById: \".$e->getMessage());\n }\n }", "public function testGetValidMessageByMessageText(){\n\t\t//create a new message\n\t\t$newMessage =new message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t\t$newMessage->insert($this->getPDO());\n\n\t\t//grab the data from guzzle\n\t\t$response = $this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/' . $newMessage-getMessage());\n\t\t$this->assertSame($response->getStatusCode(),200);\n\t\t$body = $response->getBody();\n\t\t$alertLevel = json_decode ($body);\n\t\t$this->assertSame(200, $alertLevel->status);\n\t}", "public function test_getMessageById() {\n\n }", "public function testLogMessage()\n {\n $message = 'Test message #' . rand();\n\n $data = self::$ctnClient1->logMessage($message);\n\n $this->assertTrue(isset($data->messageId));\n }", "public function testAuthenticationsSmsIdGet()\n {\n }", "public function testGetKey()\n {\n $subject = $this->createInstance();\n $reflect = $this->reflect($subject);\n\n $key = uniqid('key-');\n\n $reflect->_setKey($key);\n\n $this->assertEquals($key, $subject->getKey(), 'Set and retrieved keys are not the same.');\n }", "public function testMessageThreadsV2GetMessages()\n {\n }", "public function test_getMessage() {\n\n }", "public function testGetVoicemailMeMessages()\n {\n }", "public function test_getAllMessages() {\n\n }", "public function test_generate_key()\n {\n $key = GuestToken::generate_key();\n $this->assertGreaterThan(10, strlen($key));\n }", "Public function testGetInvalidMessageByMessageId(){\n\t //create a new message\n\t $newMessage =new message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t $newMessage->insert($this->getPDO());\n\n\t //grab the data from guzzle\n\t $response = $this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/' . $newMessage-getMessage());\n\t $this->assertSame($response->getStatusCode(),200);\n\t $body = $response->getBody();\n\t $alertLevel = json_decode ($body);\n\t $this->assertSame(200, $alertLevel->status);\n }", "public function testGetVoicemailMessages()\n {\n }", "function request($message, $peer_id, $keyboard, $sticker_id)\r\n{\r\n $request_params = array(\r\n 'message' => $message,\r\n 'peer_id' => $peer_id,\r\n 'access_token' => VK_API_TOKEN,\r\n 'v' => '5.80',\r\n 'sticker_id' => $sticker_id,\r\n 'keyboard' => json_encode($keyboard)\r\n );\r\n\r\n $get_params = http_build_query($request_params);\r\n file_get_contents('https://api.vk.com/method/messages.send?' . $get_params);\r\n echo('ok');\r\n}", "public function testGetKey()\n {\n $subject = new Iteration($key = 'test-key', '');\n\n $this->assertEquals($key, $subject->getKey());\n }", "public function testPutVoicemailMessage()\n {\n }", "public function testGetVoicemailGroupMessages()\n {\n }", "public function testGetVoicemailQueueMessages()\n {\n }", "public function testGetMessages()\n {\n $config = new Configuration();\n// $config->setHost(\"http://127.0.0.1:8080\");\n $apiInstance = new DaDaPushMessageApi(\n // If you want use custom http client, pass your client which implements `GuzzleHttp\\ClientInterface`.\n // This is optional, `GuzzleHttp\\Client` will be used as default.\n new \\GuzzleHttp\\Client(),\n $config\n );\n\n $channel_token = 'ctb3lwO6AeiZOwqZgp8BE8980FdNgp0cp6MCf';\n $page=1;\n $page_size=10;\n\n $result = $apiInstance->getMessages($page,$page_size, $channel_token);\n print_r($result);\n self::assertTrue($result->getCode()==0);\n }", "public function testMessage()\r\n {\r\n\r\n $this->flash->message(\"testMessage\");\r\n $this->assertEquals(\"testMessage\", $_SESSION[\"flash\"][\"messages\"][\"message\"][0]);\r\n\r\n }", "public function testGetVoicemailMessage()\n {\n }", "function testAPIKeySession()\n\t{\n\t\t$arrReturn = array();\n\t\t$strCheckSpelling = \"Hornbill ! $ % ^ * ( ) _ + @ ~ . , / ' ' < > & \\\" 'Service Manager' Spelling Mitsake\";\n\n\t\t$the_transport = new \\Esp\\Transport(self::ESP_ADDRESS, \"xmlmc\", \"dav\");\n\t\t$mc = new \\Esp\\MethodCall($the_transport);\n\n\t\t$mc->setAPIKey(self::API_KEY);\n\t\t$mc->invoke(\"session\", \"getSessionInfo\");\n\t\t$strSessionID = $mc->getReturnParamAsString(\"sessionId\");\n\n\t\tarray_push($arrReturn, $this->buildResponse(\"session\", \"getSessionInfo\", \"DEBUG\", \"Session ID: \" . $strSessionID));\n\n\t\treturn $arrReturn;\n\t}", "public function testMessageThreadsV2GetMessages0()\n {\n }", "public function testDeleteKey()\n {\n }", "protected abstract function _message();", "public function testApikey() {\n $this->assertNotNull($this->object->apikey('8f14e45fceea167a5a36dedd4bea2543'));\n }", "public function testMessageThreadsV2Get()\n {\n }", "public function get_message( $key = null ) {\n // Gets the message for the given key from the message_values property.\n if ( $key === null ) return $this->message_values;\n else if ( isset($this->message_values[$key] ) ) return $this->message_values[$key];\n else return false;\n }", "public function testValidGetById() {\n\t\t//create a new message, and insert ino the database\n\t\t$newMessage = new Message(null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t\t$newMessage->insert($this->getPDO());\n\n\t\t//send the get request to the API\n\t\t$response = $this->guzzle=get('http://bootcamp-coders.cnm.edu/~cberaun2/bread-basket/public_html/php/api/message/' . $newMessage->getMessageId(), ['headers' => ['XRSF-TOKEN' => $this->token]]);\n\n\t\t//ensure the response was sent, and the api returned a positive status\n\t\t$this->assertSame($response->getStatusCode(), 200);\n\t\t$body = $response->getBody();\n\t\t$retrievedMass = json_encode($body);\n\t\t$this->AssertSame(200, $retrievedMass->status);\n\n\t\t//ensure the returned values meet expectations (just clicking enough to make sure the right thing was obtained)\n\t\t$this->assertSame($retrievedMass->data->messageId, $newMessage->getMessageId());\n\t\t$this->assertSame($retrievedMass->data->orgId, $this->VALID_ORG_ID);\n\t}", "public function assertFlashedMessage($key)\n {\n $this->assertTrue(Lang::has($key), \"Oops! The language key '$key' doesn't exist\");\n $this->assertSessionHas('flash_notification.message', trans($key));\n }", "private function read($key){\r\n}", "public function testPutValidMessage () {\n\n\t\t//create a new message\n\t\t$newMessage = new Message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t\t$newMessage->insert($this->getPDO());\n\n\t\t//run a get request to establish session tokens\n\t\t$this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/');\n\n\t\t//grab the data from guzzle and enforce the status match our expectations\n\t\t$response = $this->guzzle->put('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/' . $newMessage->getMessage(),['headers' => ['X-XRF-TOKEN' => $this->getXsrfToken()], 'json' => $newMessage] );\n\t\t$this->assertSame($response->getStatusCode(), 200);\n\t\t$body = $response->getBpdy();\n\t\t$alertLevel = json_decode($body);\n\t\t$this->assertSame(200, $alertLevel->status);\n\n\t}", "public function testGetInvalidMessageByMessageText(){\n\t\t//create a new message\n\t\t$newMessage =new message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t\t$newMessage->insert($this->getPDO());\n\n\t\t//grab the data from guzzle\n\t\t$response = $this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/' . $newMessage-getMessage());\n\t\t$this->assertSame($response->getStatusCode(),200);\n\t\t$body = $response->getBody();\n\t\t$alertLevel = json_decode ($body);\n\t\t$this->assertSame(200, $alertLevel->status);\n\t}", "public function testPostVoicemailMessages()\n {\n }", "public function testAntBackendGetMessage()\r\n\t{\r\n\t\t// Create new mail object and save it to ANT\r\n\t\t$obj = CAntObject::factory($this->dbh, \"email_message\", null, $this->user);\r\n\t\t$obj->setGroup(\"Inbox\");\r\n\t\t$obj->setValue(\"flag_seen\", 'f');\r\n\t\t$obj->setHeader(\"Subject\", \"UnitTest EmailSubject\");\r\n\t\t$obj->setHeader(\"From\", \"[email protected]\");\r\n\t\t$obj->setHeader(\"To\", \"[email protected]\");\r\n\t\t$obj->setBody(\"UnitTest EmailBody\", \"plain\");\r\n\t\t$eid = $obj->save();\r\n\r\n\t\t$contentParams = new ContentParameters();\r\n $email = $this->backend->getEmail($eid, $contentParams);\r\n $this->assertEquals($obj->getValue(\"subject\"), $email->subject);\r\n $this->assertEquals($obj->getValue(\"sent_from\"), $email->from); \r\n \r\n // Cleanup\r\n $obj->removeHard();\r\n\t}", "public function testGetterMethod()\n {\n $publickey = '-----BEGIN CERTIFICATE-----\nMIIDijCCAvOgAwIBAgIJAOXBQLEpMB4rMA0GCSqGSIb3DQEBBQUAMIGLMQswCQYD\nVQQGEwJKUDEOMAwGA1UECBMFVG9reW8xETAPBgNVBAcTCFNoaW5qdWt1MRAwDgYD\nVQQKEwdleGFtcGxlMRAwDgYDVQQLEwdleGFtcGxlMRQwEgYDVQQDEwtleGFtcGxl\nLmNvbTEfMB0GCSqGSIb3DQEJARYQcm9vdEBleGFtcGxlLmNvbTAeFw0wOTEwMTUw\nODMyNDdaFw0xOTEwMTMwODMyNDdaMIGLMQswCQYDVQQGEwJKUDEOMAwGA1UECBMF\nVG9reW8xETAPBgNVBAcTCFNoaW5qdWt1MRAwDgYDVQQKEwdleGFtcGxlMRAwDgYD\nVQQLEwdleGFtcGxlMRQwEgYDVQQDEwtleGFtcGxlLmNvbTEfMB0GCSqGSIb3DQEJ\nARYQcm9vdEBleGFtcGxlLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA\norhSQotOymjP+lnDqRvrlYWKzd3M8vE82U7emeS9KQPtCBoy+fXP/kMEMxG/YU+c\nNAS/2BLFGN48EPM0ZAQap384nx+TNZ6sGuCJa60go8yIWff72DZjSZI6otfPjC9S\nNlxOnNLNAfGWAiaCcuBP1uJVhyrs1pu7SaEXBOP4pQ0CAwEAAaOB8zCB8DAdBgNV\nHQ4EFgQU3mEIdWrvKu+yuwIJD2WczQLI3j4wgcAGA1UdIwSBuDCBtYAU3mEIdWrv\nKu+yuwIJD2WczQLI3j6hgZGkgY4wgYsxCzAJBgNVBAYTAkpQMQ4wDAYDVQQIEwVU\nb2t5bzERMA8GA1UEBxMIU2hpbmp1a3UxEDAOBgNVBAoTB2V4YW1wbGUxEDAOBgNV\nBAsTB2V4YW1wbGUxFDASBgNVBAMTC2V4YW1wbGUuY29tMR8wHQYJKoZIhvcNAQkB\nFhByb290QGV4YW1wbGUuY29tggkA5cFAsSkwHiswDAYDVR0TBAUwAwEB/zANBgkq\nhkiG9w0BAQUFAAOBgQAO2ZKL0/tPhpVfbOoSXl+tlmTyyb8w7mCnjYYWwcwUAf1N\nylgYxKPrKfamjZKpeRY487VbTee1jfud709oIK5l9ghjz64kPRn/AYHTRwRkBKbb\nwuBWH4L6Rw3ml0ODXW64bdTx/QsAv5M1SyCp/nl8R27dz3MX2D1Ov2o4ipTlZw==\n-----END CERTIFICATE-----';\n $this->assertEquals('testuser', $this->consumer->getKey());\n $this->assertEquals('testpass', $this->consumer->getSecret());\n $this->assertEquals($publickey, $this->consumer->getPublicKey());\n }", "public function testGetMessageByIdRequiredParams()\n {\n // Configure HTTP basic authorization: basicAuth\n $config = Configuration::getDefaultConfiguration()\n ->setUsername('YOUR_USERNAME')\n ->setPassword('YOUR_PASSWORD');\n\n $expected_code = 200;\n // Create a mock response\n $expected = new \\Karix\\Model\\MessageResponse();\n // Create a mock handler\n $mock = new \\GuzzleHttp\\Handler\\MockHandler([\n new \\GuzzleHttp\\Psr7\\Response($expected_code, [], $expected),\n ]);\n $handler = \\GuzzleHttp\\HandlerStack::create($mock);\n $client = new \\GuzzleHttp\\Client(['handler' => $handler]);\n\n $apiInstance = new Api\\MessageApi(\n $client,\n $config\n );\n $uid = \"uid_example\";\n\n $_tempVal = $uid;\n $uid = null;\n try {\n $result = $apiInstance->getMessageById($uid);\n $this->fail(\"No exception when calling MessageApi->getMessageById with null uid\");\n } catch (\\InvalidArgumentException $e) {\n $this->assertEquals('Missing the required parameter $uid when calling getMessageById', $e->getMessage());\n }\n $uid = $_tempVal;\n }", "public function testGetMessageRequiredParams()\n {\n // Configure HTTP basic authorization: basicAuth\n $config = Configuration::getDefaultConfiguration()\n ->setUsername('YOUR_USERNAME')\n ->setPassword('YOUR_PASSWORD');\n\n $expected_code = 200;\n // Create a mock response\n $expected = new \\Karix\\Model\\MessageListResponse();\n // Create a mock handler\n $mock = new \\GuzzleHttp\\Handler\\MockHandler([\n new \\GuzzleHttp\\Psr7\\Response($expected_code, [], $expected),\n ]);\n $handler = \\GuzzleHttp\\HandlerStack::create($mock);\n $client = new \\GuzzleHttp\\Client(['handler' => $handler]);\n\n $apiInstance = new Api\\MessageApi(\n $client,\n $config\n );\n $direction = \"direction_example\";\n $account_uid = \"account_uid_example\";\n $state = \"state_example\";\n $offset = 0;\n $limit = 10;\n\n }", "static function getSingleMessage($key = 'id', $value = 0)\r\n {\r\n if ($value === '')\r\n {\r\n return null;\r\n }\r\n\r\n $tableMessage = DatabaseManager::getNameTable('TABLE_MESSAGE');\r\n\r\n $query = \"SELECT $tableMessage.*\r\n FROM $tableMessage \r\n WHERE $tableMessage.$key = '$value'\";\r\n\r\n if ($value2 !== '')\r\n {\r\n $query = $query . \" AND $tableMessage.$key2 = '$value2'\";\r\n }\r\n\r\n $myMessage = DatabaseManager::singleFetchAssoc($query);\r\n $myMessage = self::ArrayToMessage($myMessage);\r\n\r\n return $myMessage;\r\n }", "public function testGetCacheKey(): void\n {\n // If I have a method\n $uut = $this->getMethod($this->method);\n\n // I expect the active modules tracker key to be returned\n $moduleManager = $this->getMockManager($this->method);\n $expected = \"modules-cache\";\n $this->assertSame($expected, $uut->invoke($moduleManager));\n }", "public static function retrieve($key){\n if(self::exists($key)){\n return self::$answers[strtolower($key)];\n }\n return \"ERROR\";\n }", "public function testMessages()\n {\n $response = $this->json('GET', '/api/messages');\n $response->assertJsonStructure([\n 'messages'=>[\n 'current_page',\n 'data' => [\n [\n 'uid',\n 'sender',\n 'subject',\n 'message',\n 'time_sent',\n 'archived',\n 'read'\n ]\n ],\n 'first_page_url',\n 'from',\n 'last_page',\n 'last_page_url',\n 'next_page_url',\n 'path',\n 'per_page',\n 'prev_page_url',\n 'to',\n 'total'\n ]\n ]);\n }", "public function testBasicTest()\n {\n\n\n $testData = [\n \"msisdn\" => \"441632960960\",\n \"to\" => \"441632960961\",\n \"messageId\" => \"02000000E68951D8\",\n \"text\" => \"Hello7\",\n \"type\" => \"text\",\n \"keyword\" => \"HELLO7\",\n \"message-timestamp\" => \"2016-07-05 21:46:15\"\n ];\n $response = $this->postJson('/receive-sms', $testData);\n\n $response->assertStatus(200);\n }", "abstract public function getMessage(): ReceivedMessage;", "abstract public function getMessage(): ReceivedMessage;", "public function test_updateMessage() {\n\n }", "public function testFixture(): void {\n $message = $this->getFixture(\"example_bounce.eml\");\n\n self::assertEquals(\"<>\", $message->return_path);\n self::assertEquals([\n 0 => 'from somewhere.your-server.de by somewhere.your-server.de with LMTP id 3TP8LrElAGSOaAAAmBr1xw (envelope-from <>); Thu, 02 Mar 2023 05:27:29 +0100',\n 1 => 'from somewhere06.your-server.de ([1b21:2f8:e0a:50e4::2]) by somewhere.your-server.de with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) id 1pXaXR-0006xQ-BN for [email protected]; Thu, 02 Mar 2023 05:27:29 +0100',\n 2 => 'from [192.168.0.10] (helo=sslproxy01.your-server.de) by somewhere06.your-server.de with esmtps (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) id 1pXaXO-000LYP-9R for [email protected]; Thu, 02 Mar 2023 05:27:26 +0100',\n 3 => 'from localhost ([127.0.0.1] helo=sslproxy01.your-server.de) by sslproxy01.your-server.de with esmtps (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) id 1pXaXO-0008gy-7x for [email protected]; Thu, 02 Mar 2023 05:27:26 +0100',\n 4 => 'from Debian-exim by sslproxy01.your-server.de with local (Exim 4.92) id 1pXaXO-0008gb-6g for [email protected]; Thu, 02 Mar 2023 05:27:26 +0100',\n 5 => 'from somewhere.your-server.de by somewhere.your-server.de with LMTP id 3TP8LrElAGSOaAAAmBr1xw (envelope-from <>)',\n ], $message->received->all());\n self::assertEquals(\"[email protected]\", $message->envelope_to);\n self::assertEquals(\"Thu, 02 Mar 2023 05:27:29 +0100\", $message->delivery_date);\n self::assertEquals([\n 0 => 'somewhere.your-server.de; iprev=pass (somewhere06.your-server.de) smtp.remote-ip=1b21:2f8:e0a:50e4::2; spf=none smtp.mailfrom=<>; dmarc=skipped',\n 1 => 'somewhere.your-server.de'\n ], $message->authentication_results->all());\n self::assertEquals([\n 0 => 'from somewhere.your-server.de by somewhere.your-server.de with LMTP id 3TP8LrElAGSOaAAAmBr1xw (envelope-from <>); Thu, 02 Mar 2023 05:27:29 +0100',\n 1 => 'from somewhere06.your-server.de ([1b21:2f8:e0a:50e4::2]) by somewhere.your-server.de with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) id 1pXaXR-0006xQ-BN for [email protected]; Thu, 02 Mar 2023 05:27:29 +0100',\n 2 => 'from [192.168.0.10] (helo=sslproxy01.your-server.de) by somewhere06.your-server.de with esmtps (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) id 1pXaXO-000LYP-9R for [email protected]; Thu, 02 Mar 2023 05:27:26 +0100',\n 3 => 'from localhost ([127.0.0.1] helo=sslproxy01.your-server.de) by sslproxy01.your-server.de with esmtps (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) id 1pXaXO-0008gy-7x for [email protected]; Thu, 02 Mar 2023 05:27:26 +0100',\n 4 => 'from Debian-exim by sslproxy01.your-server.de with local (Exim 4.92) id 1pXaXO-0008gb-6g for [email protected]; Thu, 02 Mar 2023 05:27:26 +0100',\n 5 => 'from somewhere.your-server.de by somewhere.your-server.de with LMTP id 3TP8LrElAGSOaAAAmBr1xw (envelope-from <>)',\n ], $message->received->all());\n self::assertEquals(\"[email protected]\", $message->x_failed_recipients);\n self::assertEquals(\"auto-replied\", $message->auto_submitted);\n self::assertEquals(\"Mail Delivery System <[email protected]>\", $message->from);\n self::assertEquals(\"[email protected]\", $message->to);\n self::assertEquals(\"1.0\", $message->mime_version);\n self::assertEquals(\"Mail delivery failed\", $message->subject);\n self::assertEquals(\"[email protected]\", $message->message_id);\n self::assertEquals(\"2023-03-02 04:27:26\", $message->date->first()->setTimezone('UTC')->format(\"Y-m-d H:i:s\"));\n self::assertEquals(\"Clear (ClamAV 0.103.8/26827/Wed Mar 1 09:28:49 2023)\", $message->x_virus_scanned);\n self::assertEquals(\"0.0 (/)\", $message->x_spam_score);\n self::assertEquals(\"[email protected]\", $message->delivered_to);\n self::assertEquals(\"multipart/report\", $message->content_type->last());\n self::assertEquals(\"5d4847c21c8891e73d62c8246f260a46496958041a499f33ecd47444fdaa591b\", hash(\"sha256\", $message->getTextBody()));\n self::assertFalse($message->hasHTMLBody());\n\n $attachments = $message->attachments();\n self::assertCount(2, $attachments);\n\n $attachment = $attachments[0];\n self::assertInstanceOf(Attachment::class, $attachment);\n self::assertEquals('c541a506', $attachment->filename);\n self::assertEquals(\"c541a506\", $attachment->name);\n self::assertEquals('', $attachment->getExtension());\n self::assertEquals('text', $attachment->type);\n self::assertEquals(\"message/delivery-status\", $attachment->content_type);\n self::assertEquals(\"85ac09d1d74b2d85853084dc22abcad205a6bfde62d6056e3a933ffe7e82e45c\", hash(\"sha256\", $attachment->content));\n self::assertEquals(267, $attachment->size);\n self::assertEquals(1, $attachment->part_number);\n self::assertNull($attachment->disposition);\n self::assertNotEmpty($attachment->id);\n\n $attachment = $attachments[1];\n self::assertInstanceOf(Attachment::class, $attachment);\n self::assertEquals('da786518', $attachment->filename);\n self::assertEquals(\"da786518\", $attachment->name);\n self::assertEquals('', $attachment->getExtension());\n self::assertEquals('text', $attachment->type);\n self::assertEquals(\"message/rfc822\", $attachment->content_type);\n self::assertEquals(\"7525331f5fab23ea77f595b995336aca7b8dad12db00ada14abebe7fe5b96e10\", hash(\"sha256\", $attachment->content));\n self::assertEquals(776, $attachment->size);\n self::assertEquals(2, $attachment->part_number);\n self::assertNull($attachment->disposition);\n self::assertNotEmpty($attachment->id);\n }", "public function testCustomKey()\n {\n $key = 'my-custom-key';\n $auth = new JwtAuthenticate($this->Registry, [\n 'key' => $key,\n 'queryDatasource' => false,\n ]);\n\n $payload = ['sub' => 100];\n $token = JWT::encode($payload, $key);\n\n $request = new ServerRequest();\n $request = $request->withEnv('HTTP_AUTHORIZATION', 'Bearer ' . $token);\n $result = $auth->getUser($request, $this->response);\n $this->assertEquals($payload, $result);\n\n $request = new ServerRequest(['url' => '/posts/index?token=' . $token]);\n $result = $auth->getUser($request, $this->response);\n $this->assertEquals($payload, $result);\n }", "public function getMessage();", "public function getMessage();", "public function getMessage();", "public function getMessage();", "public function getMessage();", "public function getMessage();", "public function getMessage();", "public function getMessage();", "public function getMessage();", "public function getMessage();", "public function getMessage();", "public function getMessage();", "public function getMessage();", "public function testListKeys()\n {\n }", "public function testGetKeyRevisionHistory()\n {\n }", "public function testReceiveWithKeyIsEmpty()\n {\n $callback = function (){};\n $eventName = 'bar-foo-testing';\n\n $this->adapter->expects($this->once())->method('receive')\n ->with($eventName, $callback, null);\n\n $this->eventReceiver->receive($eventName, $callback);\n }", "public function getMessage( $key, $code ) {\n\t\t$title = Title::makeTitle( $this->getNamespace(), $key );\n\t\t$handle = new MessageHandle( $title );\n\t\t$groupId = MessageIndex::getPrimaryGroupId( $handle );\n\t\tif ( $groupId === $this->getId() ) {\n\t\t\t// Message key owned by aggregate group.\n\t\t\t// Should not ever happen, but it does.\n\t\t\terror_log( \"AggregateMessageGroup $groupId cannot be primary owner of key $key\" );\n\n\t\t\treturn null;\n\t\t}\n\n\t\t$group = MessageGroups::getGroup( $groupId );\n\t\tif ( $group ) {\n\t\t\treturn $group->getMessage( $key, $code );\n\t\t} else {\n\t\t\treturn null;\n\t\t}\n\t}", "public function testGetArrayKey() : void\n {\n $this->assertEquals('inner_content', FileInfoStreamFactory::getArrayKey());\n\n return;\n }", "public function testGetValidMessageByOrgId(){\n\t\t//create a new message\n\t\t$newMessage =new message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t\t$newMessage->insert($this->getPDO());\n\n\t\t//grab the data from guzzle\n\t\t$response = $this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/' . $newMessage-getMessage());\n\t\t$this->assertSame($response->getStatusCode(),200);\n\t\t$body = $response->getBody();\n\t\t$alertLevel = json_decode ($body);\n\t\t$this->assertSame(200, $alertLevel->status);\n\t}", "public function getMessage() {}", "public function getMessage() {}", "public function getMessage() {}", "public function getResponseMessage();", "function getMessage ($messageKey, $title = \"\", $arrParam=array()) {\n\tif (!empty($messageKey)) {\n\t\t$message = Constants::$listMessage[$messageKey];\n\t\t$message = str_replace(\"###TITLE###\", $title, $message);\n\t\t$arrParam = is_array($arrParam) ? $arrParam : array();\n\t\tforeach ($arrParam as $k => $v) {\n\t\t\t$k = strtoupper($k);\n\t\t\t$message = str_replace(\"###$k###\", $v, $message);\n\t\t}\n\t\treturn $message;\n\t}\n\treturn \"\";\n}", "public function test_get_user_messages(): void\n {\n $request = GroupRequest::ofUserName(self::DEFAULT_GROUP_DEEPLINK);\n $this->resolve($request, function (?int $groupId, ?int $accessHash) {\n $count = 0;\n $handler = function (?MessageModel $message = null) use (&$count) {\n if ($message) {\n $this->assertEquals('qweq', $message->getText());\n $count++;\n }\n };\n $client = new GroupMessagesScenario(\n new GroupId($groupId, $accessHash),\n $this->clientGenerator,\n new OptionalDateRange(),\n $handler,\n self::USERNAME\n );\n $client->setTimeout(self::TIMEOUT);\n $client->startActions();\n $this->assertEquals(1, $count);\n });\n }", "function getReply($key){\n\t$mysql=new MySQL();\n\n\t$select=$mysql->table(REPLY_TABLE)->where(\"`key`='$key'\")->select();\n\tif($select!=NULL){\t\t//There exist a reply for this key\n\n\t\tif($select[0]['type']=='text'){\t//It's a TextMessage\n\t\t\treturn new TextMessage($select[0]['content']);\n\t\t}else{\n\t\t\t$news=new NewsMessage();\n\t\t\t$news->LoadFromTX(array($select[0]['content']));\n\t\t\treturn $news;\n\t\t}\n\t}\n}", "function pkeyGet($kv)\n {\n return Memcached_DataObject::pkeyGet('QnA_Answer', $kv);\n }", "private function get_message()\n {\n switch (self::$requestType) {\n case 'payRequest':\n self::$msg = sha1(self::$mid . self::$amount . self::$cac . self::$MsTxnId . self::$firstName . self::$familyName . self::$timeStamp, true);\n break;\n case 'payNote':\n self::$msg = sha1(self::$mid . self::$amount . self::$cac . self::$PspTxnId . self::$MsTxnId . self::$timeStamp . self::$Result, true);\n break;\n }\n }", "public function testMessageThreadsV2Get0()\n {\n }", "protected function getMessage()\n {\n //return new \\Swift_Message('Test subject', 'Test body.');\n }", "function get ($key) {\n return $this->memcached->get($key);\n }", "abstract public function doVerify(string $expected, string $payload, Key $key): bool;", "public function testGetValidMessageByListingId(){\n\t\t//create a new message\n\t\t$newMessage =new message (null, $this->VALID_MESSAGE_ID, $this->VALID_LISTING_Id, $this->VALID_ORG_ID, $this->VALID_MESSAGE_ID, $this->VALID_MESSAGE_TEXT);\n\t\t$newMessage->insert($this->getPDO());\n\n\t\t//grab the data from guzzle\n\t\t$response = $this->guzzle->get('http://bootcamp-coders.cnm.edu/~bread-basket/public_html/php/api/message/' . $newMessage-getMessage());\n\t\t$this->assertSame($response->getStatusCode(),200);\n\t\t$body = $response->getBody();\n\t\t$alertLevel = json_decode ($body);\n\t\t$this->assertSame(200, $alertLevel->status);\n\t}", "public function testKeyNotFound()\n {\n $headers = [\n 'Content-Type' => 'text/plain',\n 'X-Authorization-Timestamp' => time(),\n 'Authorization' => 'acquia-http-hmac realm=\"Pipet service\",'\n . 'id=\"bad-id\",'\n . 'nonce=\"d1954337-5319-4821-8427-115542e08d10\",'\n . 'version=\"2.0\",'\n . 'headers=\"\",'\n . 'signature=\"MRlPr/Z1WQY2sMthcaEqETRMw4gPYXlPcTpaLWS2gcc=\"',\n ];\n $request = new Request('GET', 'https://example.com/test', $headers);\n\n $this->expectException(KeyNotFoundException::class);\n\n $authenticator = new RequestAuthenticator(new MockKeyLoader($this->keys));\n $authenticator->authenticate($request);\n }", "public function testSendMessageDraftNoDraft()\n {\n\n $account = $this->getTestUserStub()->getMailAccount(\"dev_sys_conjoon_org\");\n $mailFolderId = \"DRAFTS\";\n $messageItemId = \"989786\";\n $messageKey = new MessageKey($account, $mailFolderId, $messageItemId);\n\n $client = $this->createClient();\n\n $rangeList = new Horde_Imap_Client_Ids();\n $rangeList->add($messageKey->getId());\n\n $imapStub = Mockery::mock(\"overload:\" . Horde_Imap_Client_Socket::class);\n\n $fetchResult = [];\n $fetchResult[$messageKey->getId()] = new class () {\n /**\n * constructor.\n */\n public function __construct()\n {\n }\n\n /**\n *\n * @noinspection PhpUnused\n */\n public function getFullMsg()\n {\n }\n\n /**\n * @return array\n */\n public function getFlags(): array\n {\n return [];\n }\n };\n\n\n $imapStub->shouldReceive(\"fetch\")\n ->with(\n $messageKey->getMailFolderId(),\n Mockery::any(),\n [\"ids\" => $rangeList]\n )\n ->andReturn($fetchResult);\n\n $this->expectException(ImapClientException::class);\n $client->sendMessageDraft($messageKey);\n }", "function MyApp_Mail_Info_Get($key=\"\")\n {\n if (empty($this->MailInfo))\n {\n $this->MyApp_Mail_Init();\n }\n\n if (!empty($key))\n {\n if (!empty($this->MailInfo[ $key ]))\n {\n return $this->MailInfo[ $key ];\n }\n else\n {\n return $key;\n }\n }\n\n return $this->MailInfo;\n }", "public function testAddMessageFromStringForNextRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $flash->addMessage('key', 'value');\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEquals(['value'], $storage['slimFlash']['key']);\n }" ]
[ "0.77864105", "0.74032694", "0.69719326", "0.6945242", "0.69185305", "0.6912389", "0.6718969", "0.64488673", "0.63963664", "0.63402426", "0.632061", "0.6224188", "0.62159353", "0.6081999", "0.60797566", "0.6066287", "0.60654104", "0.60415053", "0.6034778", "0.5991311", "0.59290683", "0.59101707", "0.59012437", "0.5861738", "0.58522505", "0.58417135", "0.58393073", "0.5829107", "0.5801922", "0.57987726", "0.57771146", "0.5768663", "0.5762944", "0.5760265", "0.5756662", "0.5750677", "0.5738611", "0.57368314", "0.570574", "0.5701342", "0.5698313", "0.56982875", "0.56863797", "0.56842643", "0.5680651", "0.56724566", "0.5641653", "0.56170225", "0.56165296", "0.560645", "0.55988", "0.55892956", "0.5583712", "0.55726135", "0.55615044", "0.5560795", "0.554299", "0.55371386", "0.5522904", "0.5522904", "0.55114263", "0.5509039", "0.5492439", "0.5490366", "0.5490366", "0.5490366", "0.5490366", "0.5490366", "0.5490366", "0.5490366", "0.5490366", "0.5490366", "0.5490366", "0.5490366", "0.5490366", "0.5490366", "0.5482483", "0.54756534", "0.5462543", "0.54550236", "0.54529446", "0.54505813", "0.54423934", "0.54423934", "0.54423934", "0.54308337", "0.542979", "0.5429553", "0.54108953", "0.54026467", "0.54021764", "0.53996986", "0.53963614", "0.5393392", "0.53891355", "0.5375051", "0.5374185", "0.53643376", "0.5362542", "0.53529686" ]
0.73845595
2
Adds an event handler.
public function on($event, $callable) { if (!is_array($this->events)) { $this->events = []; } if (is_callable($callable)) { $this->events[$event] = $callable; } return $this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function add_event_handler($event, $callback);", "public function addHandler(Handler $handler);", "function AddHandler(&$handler)\r\n\t{\r\n\t\t$this->handlers[] = $handler;\r\n\t}", "public function addHandler(EventHandlerInterface $handler)\n {\n $this->handlers[] = $handler;\n }", "public function addHandler($event, $handler)\n {\n if (!is_callable($handler)) {\n throw new TBoneException('The handler provided is not callable.');\n }\n\n $this->eventHandlers[] = [\n 'event' => $event,\n 'handler' => $handler,\n ];\n\n return true;\n }", "public static function addHandler($name, $handler) {\n if (array_key_exists($name, Event::$_handlers)) {\n Event::$_handlers[$name][] = $handler;\n } else {\n Event::$_handlers[$name] = array($handler);\n }\n }", "public function addHandler(string $command, string $handler);", "public function on(string $event, $handler)\n {\n if (self::isSupportedEvent($event)) {\n $this->options[$event] = $handler;\n }\n }", "public function add_event_handler($module_name, $event_name, $removable = true)\n\t{\n\t\tCmsEvents::add_event_handler($module_name, $event_name, false, $this->get_name(), $removable);\n\t}", "public function addEventListener($event, $callable){\r\n $this->events[$event] = $callable;\r\n }", "public function attach(string $eventClass, callable $handler)\n {\n $this->listeners[$eventClass][] = $handler;\n }", "public function add_callback($tagName, $callback)\n {\n $this->handlers[$tagName] = $callback;\n }", "public function addHandler($handler, $priority)\n {\n $this->handlers[] = array($handler, $priority);\n }", "function addEvent($event) {\n Event::addEvent($event);\n }", "public function handle($event)\n {\n $this->handledEvents[] = $event;\n }", "protected function addHandler($typeName, callable $handler)\n {\n $this->handlers->set($typeName, new Delegate($handler));\n }", "public static function add_event_handler( $modulename, $eventname, $tag_name = false, $module_handler = false, $removable = true)\n\t{\n\t\tif( $tag_name == false && $module_handler == false )\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\tif( $tag_name != false && $module_handler != false )\n\t\t{\n\t\t\treturn false;\n\t\t}\n\n\t\t$handler = null;\n\t\t$event = cms_orm('CmsDatabaseEvent')->find_by_module_name_and_event_name($modulename, $eventname);\n\n\t\tif ($event != null)\n\t\t{\t\n\t\t\tif ($tag_name != '')\n\t\t\t\t$handler = cms_orm('CmsDatabaseEventHandler')->find_by_event_id_and_tag_name($event->id, $tag_name);\n\t\t\telse\n\t\t\t\t$handler = cms_orm('CmsDatabaseEventHandler')->find_by_event_id_and_module_name($event->id, $module_handler);\n\n\t\t\tif ($handler != null)\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn false;\n\t\t}\n\n\t\t$handler = new CmsDatabaseEventHandler();\n\t\t$handler->event_id = $event->id;\n\t\tif ($tag_name != '')\n\t\t\t$handler->tag_name = $tag_name;\n\t\telse\n\t\t\t$handler->module_name = $module_handler;\n\t\t$handler->removable = $removable;\n\n\t\treturn $handler->save();\n\t}", "public function addCurlHandler(callable $handler)\n {\n $this->curlHandlers[] = $handler;\n }", "public function on($eventName, $callable);", "public function on($eventName, $callable);", "public function addHandler(...$handlers)\n {\n array_push($this->handlers, ...$handlers);\n }", "function register($event, callable $handler){\n\t\t$this->events[$event][] = [\n\t\t\tstatic::FUNC_KEY => $handler\n\t\t];\n\t\treturn count($this->events[$event]);\n\t}", "public function add(IErrorHandler $errorHandler): void;", "public function register(Handler $handler);", "public function addEvent($event){\n $this->events[]=$event;\n }", "public function addHandler(TaskHandlerInterface $handler) {\n\t\t$this->handlers[$handler->getTaskName()] = $handler;\n\t}", "public function register(Handler $handler) : void;", "public function setHandler(callable $handler)\n {\n $this->handler = $handler;\n }", "public function attachEvent($event, $handler, $priority = 0)\n {\n if (($handlers = $this->events[$event][$priority] ?? null) === null) {\n $handlers = $this->events[$event][$priority] = new SplDoublyLinkedList();\n ksort($this->events[$event]);\n }\n\n $handlers->push($handler);\n }", "public function addHandler($operation, callable $callback)\n {\n $this->handlers[$operation] = $callback;\n $this->addOperation($operation);\n }", "function eventRegister($eventName, EventListener $listener);", "public function addHandler($eventClass, $handler)\n {\n assert('is_string($eventClass)');\n assert('class_exists($eventClass)');\n\n if (!($handler instanceof IEventHandler)) {\n throw new \\LogicException('Event handlers must implement IEventHandler');\n }\n\n if (!isset($this->_handlers[$eventClass])) {\n $this->_handlers[$eventClass] = array();\n }\n\n $this->_handlers[$eventClass][] = $handler;\n }", "function ibase_set_event_handler($event_handler, $event_name1, $event_name2 = NULL, $_ = NULL)\n{\n}", "public function register($event, $handler, $priority) {\n $this->handlers[$event][$priority] = $handler;\n }", "public function add()\n\t{\n\t\t// Only add the events if we are on that controller\n\t\tif (Router::$controller == 'main')\n\t\t{\n\t\t\tEvent::add('ushahidi_filter.view_pre_render.layout', array($this, 'add_requirements'));\n\t\t\t\n\t\t\tEvent::add('ushahidi_action.header_scripts', array($this, '_main_js'));\n\t\t\tEvent::add('ushahidi_action.map_main_filters', array($this, '_button'));\n\t\t}\n\t}", "public function on($event, $callback){ }", "public function addEventListener($event, $callback, $weight = null);", "public function add_js_handler() {\n\n\t\t\tif ( ! self::$handler_file ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\twp_add_inline_script( $this->get_handle(), self::$handler_file );\n\t\t}", "public function onEventAdd()\n\t{\n\t\t$this->onTaskAdd();\n\t}", "public function addListener($event, $listener, $priority = 0);", "public function add_handler($obj, $func)\n {\n $this->object_handlers[$obj] = $func;\n }", "public function listen($event, $handler)\r\n {\r\n if(array_key_exists($event, $this->broadcast)) {\r\n\r\n $eventObject = $this->getEventObject($event, $this->broadcast[$event]);\r\n\r\n if(is_callable($handler)) {\r\n call_user_func_array($handler, [$eventObject]);\r\n } else {\r\n call_user_func_array([$this->app->make($handler), 'listen'], [$eventObject]);\r\n }\r\n }\r\n }", "public function pushHandler(Handler\\HandlerInterface $handler)\n {\n array_unshift($this->handlers, $handler);\n }", "function add_listener($hook, $function_name){\n\t\tglobal $listeners;\n\n\t\t$listeners[$hook][] = $function_name;\n\t}", "public function addListener($eventName, $listener, $priority = 0);", "public function addEvent($type, $handler)\n\t{\n\t\t$this->_validateEventHandler($handler);\n\t\tif ( ! isset($this->_events[$type]))\n\t\t{\n\t\t\t$this->_events[$type] = array();\n\t\t}\n\t\t$this->_events[$type][] = $handler;\n\t\treturn $this;\n\t}", "public function appendListenerForEvent(string $eventType, callable $listener): callable;", "public function addHandler($moduleName, $className);", "function ibase_set_event_handler($connection, $event_handler, $event_name1, $event_name2 = NULL, $_ = NULL)\n{\n}", "final public function addHandler(hookHandler $hookHandler) {\n\n\t\t$this->verifyHandlerType($hookHandler);\n\n\t\t$objectHash = spl_object_hash($hookHandler);\n\t\t$this->classes[get_class($hookHandler)][$objectHash] = $hookHandler;\n\t\t$this->objects[$objectHash] = $hookHandler;\n\t}", "function defineHandlers() {\n EventsManager::listen('on_rawtext_to_richtext', 'on_rawtext_to_richtext');\n EventsManager::listen('on_daily', 'on_daily');\n EventsManager::listen('on_wireframe_updates', 'on_wireframe_updates');\n }", "public function addNested(Lux_Event_Handler $event_handler, $name)\n {\n $this->_nested[$name] = $event_handler;\n }", "function defineHandlers(&$events) {\n /*\n * example handlers see: handlers/on_admin_sections.php and handlers/on_build_menu.php\n * \n */\n\n //$events->listen('on_build_menu', 'on_build_menu');\n //$events->listen('on_admin_sections', 'on_admin_sections');\n }", "public function listen($event, $listener);", "public function AddEventHandler(&$array, $evt, $code)\n {\n if(isset($array[$evt]))\n $array[$evt] .= ';' . $code;\n else\n $array[$evt] = $code;\n }", "public function pushHandler(HandlerInterface $handler)\n {\n array_unshift($this->handlers, $handler);\n }", "final public function addFunctionOnHandlerDependency(callable $function, hookHandler $handler) {\n\t\t// take into account the handlers registered via do_action/do_filter\n\t\tforeach ($this->getCoreHokkCallbacks() as $priority => $hook) {\n\t\t\t$callback = $hook['function'];\n\t\t\tif ($callback == $function) {\n\t\t\t\t$this->addPriorityOnHandlerDependency($priority,$handler);\n\t\t\t}\n\t\t}\n\t}", "public function add($event, $class): void\n {\n $this->eventClasses[$event] = $class;\n }", "function SetEventHandler( $type, $function )\r\n {\r\n if ( !isset( $this->_functions[$function] ) ) return false;\r\n $this->_events[$type] = $function;\r\n return true;\r\n }", "public function add($methodExpr, $expression, $handler=null) {\n $this->map[] = [$methodExpr, $expression, $handler];\n }", "public function on($event, $handler, $context = null, $priority = 0)\n\t{\n\t\t// Check wether a priority is\n\t\t// given in place of a context.\n\t\tif (is_int($context))\n\t\t{\n\t\t\t// Switch then around\n\t\t\t$priority = $context;\n\t\t\t$context = null;\n\t\t}\n\n\t\t// When the object is self binding\n\t\tif ($context === null and $this->_eventBindSelf)\n\t\t{\n\t\t\t// Set the context to $this\n\t\t\t$context = $this;\n\t\t}\n\n\t\t// Ensure there is a Container\n\t\t$this->_eventContainer or $this->_eventContainer = new Container();\n\n\t\t// Add the event\n\t\t$this->_eventContainer->on($event, $handler, $context, $priority);\n\n\t\t// Remain chainable\n\t\treturn $this;\n\t}", "function register_elgg_event_handler($event, $object_type, $function, $priority = 500) {\n\treturn events($event, $object_type, $function, $priority);\n}", "public function addCommandHandler(ICommandHandler $commandHandler)\n {\n $commandClassName = preg_replace('/(.*)Handler$/i', '$1', self::findBaseName($commandHandler));\n \n $this->commandHandlers[$commandClassName] = $commandHandler;\n }", "public function onEvent();", "protected function add()\n {\n $this->numArgs = $this->findNumArgs($this->callback);\n if (is_string($this->callback) && class_exists($this->callback)) {\n $this->useCallbackManager('invoke', $this->callback);\n }\n foreach ((array) $this->hook as $hook) {\n \\add_filter($hook, $this->callback, $this->priority, $this->numArgs);\n }\n }", "public function registerEvents()\n {\n if (!empty($this->clientEvents)) {\n $js = [];\n foreach ($this->clientEvents as $event => $handle) {\n $handle = new JsExpression($handle);\n $js[] = \"$({$this->var}).on('{$event}', {$handle});\";\n }\n $this->getView()->registerJs(implode(PHP_EOL, $js));\n }\n }", "protected function addCodexHook($hookPoint, $handler)\n {\n Extensions::addHook($hookPoint, $handler);\n }", "public function attach(string $event, callable $listener, int $priority = 0): void;", "public static function hook($event_name, $fn) \n {\n $instance = self::get_instance();\n $instance->hooks[$event_name][] = $fn;\n }", "public function onHandle(HandlerEvent $event)\n {\n if ($this->hasEventHandler(self::EVENT_ON_HANDLE)) {\n $this->raiseEvent(self::EVENT_ON_HANDLE, $event);\n }\n }", "public function handler(HandlerInterface $handler);", "public function addEventSubscriber(IEventSubscriber $subscriber);", "public function directive($name, callable $handler)\n {\n $this->customDirectives[$name] = $handler;\n }", "function listenTo(string $eventName, callable $callback)\n {\n EventManager::register($eventName, $callback);\n }", "public function add_event($type, $method_name)\n\t{\n\t\tif (!array_key_exists($type, $this->_events)) $this->_events[$type] = array();\n\t\t$this->_events[$type][] = $method_name;\n\t}", "public function addEvent(VEvent $event)\n {\n $this->events[] = $event;\n }", "public function aim_register_handler()\r\n\t{\r\n\t\tforeach (func_get_args() as $arg) {\r\n\t\t\tif (is_array($arg) && count($arg) >= 1) {\r\n\t\t\t\tforeach ($arg as $k => $v) {\r\n if (empty($v[1]) || is_null($v[1]) || !isset($v[1])) $v[1] = CLIENT_DEFAULT;\r\n $k = strtolower($k);\r\n\t\t\t\t\t$this->core->handlers[$k] = array('name' => $k, 'callback' => $v[0], 'type' => $v[1]);\r\n\t\t\t\t} \r\n\t\t\t} else {\r\n\t\t\t\t$this->core->aim_debug('Empty/invalid array cannot be a handler in ' . __FUNCTION__, AIM_WARN);\r\n\t\t\t} \r\n\t\t}\r\n\t}", "public function _on($EventName, $Callback, $Priority = 0);", "public function on($event, callable $callback, $priority = 10);", "function register_hook($event, $advise, &$obj, $method, $param=NULL) {\n $this->_hooks[$event.'_'.$advise][] = array(&$obj, $method, $param);\n }", "public function addSubscriber(EventSubscriberInterface $subscriber);", "public function subscribe(): void\n {\n foreach (static::$eventHandlerMap as $eventName => $handler) {\n $this->events->listen($eventName, [$this, $handler]);\n }\n }", "public function attach(string $event, callable $callback, int $priority = self::PRIORITY_MIN): void;", "public function setLogHandler(callable $handler)\n\t{\n\t\tself::$__handler = $handler;\n\t}", "public function setHandler($closure)\n {\n if (!is_callable($closure)) {\n throw new InvalidArgumentException('Argument must be callable.');\n }\n\n $this->handler = $closure;\n }", "public function add_event($_data){\r\n\t\t$args=$this->create_args($_data);\r\n\t\treturn($this->execute('add_event',$args));\r\n\t}", "public function postEventadd();", "protected function addListener($id, array $event)\n {\n if (!isset($event['method'])) {\n $closure = function ($matches) {\n return strtoupper($matches[0]);\n };\n $event['method'] = preg_replace_callback('/(?<=\\b)[a-z]/i', $closure, $event['event']);\n $event['method'] = 'on'.preg_replace('/[^a-z0-9]/i', '', $event['method']);\n }\n\n $this->listeners[isset($event['priority']) ? $event['priority'] : 0][] = [$id, $event['event'], $event['method']];\n }", "private function init_event_listeners() {\n\t\t// add_action('wp_ajax_example_action', [$this, 'example_function']);\n\t}", "public function register(Doku_Event_Handler $controller)\n {\n $controller->register_hook('HTML_EDITFORM_OUTPUT', 'BEFORE', $this, '_edit_form'); // release Hogfather and below\n $controller->register_hook('FORM_EDIT_OUTPUT', 'BEFORE', $this, '_edit_form'); // release Igor and above\n\n $controller->register_hook('ACTION_ACT_PREPROCESS', 'BEFORE', $this, '_action_act_preprocess');\n $controller->register_hook('TPL_ACT_UNKNOWN', 'BEFORE', $this, '_tpl_act_changes');\n }", "public function addQueryHandler(IQueryHandler $queryHandler)\n {\n $queryClassName = preg_replace('/(.*)Handler$/i', '$1', self::findBaseName($queryHandler));\n \n $this->queryHandlers[$queryClassName] = $queryHandler;\n }", "public function add_handle($key, $value) {\n\t\t$this->handles[$key] = $value;\n\t}", "public function attach($identifier, $event, callable $listener, $priority = 1)\n {\n }", "public function addEntryAddedListener(callable $listener): SubscriptionInterface;", "function get_handler() {\r\n }", "public function on($event, Closure $closure)\n {\n if (! array_key_exists($event, $this->events)) {\n $this->events[$event] = [];\n }\n\n $this->events[$event][] = $closure;\n }", "public function setHandler(\\Phalconry\\Mvc\\Application\\HandlerInterface $handler);", "public static function usesCustomHandler();", "public function addRoute($pattern, $handler)\n {\n $this->routes->append($pattern, $handler);\n }", "public static function on($handler, $callback)\n {\n if(!isset(static::$events[$handler])) static::$events[$handler] = array();\n\n if(is_callable($callback)) {\n return static::$events[$handler][] = $callback;\n }\n\n if(is_string($callback) && !class_exists($callback)) {\n throw new InvalidArgumentException(\"Class \\\"{$callback}\\\" does not exist\");\n }\n\n if(!method_exists($callback, 'handle')) {\n throw new InvalidArgumentException(\"Class \\\"{$callback}\\\" does not have method \\\"handle\\\"\");\n }\n\n return static::$events[$handler][] = $callback;\n }", "public function register(): void\n {\n $eventManager = EventManager::getInstance();\n\n $this->discoverEvents();\n\n foreach ($this->getListeners() as $moduleName => $moduleEvents) {\n foreach ($moduleEvents as $eventName => $eventListeners) {\n foreach (array_unique($eventListeners) as $listener) {\n $eventManager->addEventHandler(\n $moduleName,\n $eventName,\n [$listener, 'handle']\n );\n }\n }\n }\n }" ]
[ "0.753823", "0.7375281", "0.71615744", "0.6746188", "0.6623115", "0.6564252", "0.6524019", "0.6452527", "0.6312969", "0.6260705", "0.61921364", "0.61099666", "0.6050911", "0.6046066", "0.6036312", "0.5955765", "0.59408945", "0.5920697", "0.5910216", "0.5910216", "0.59096754", "0.5890627", "0.5860256", "0.585846", "0.5853638", "0.584006", "0.5825183", "0.5812976", "0.5802776", "0.5783055", "0.5777991", "0.5773434", "0.5760655", "0.5753979", "0.5747686", "0.5746813", "0.57310486", "0.5724638", "0.5709379", "0.56648475", "0.56570685", "0.56507605", "0.56322753", "0.56241584", "0.5619885", "0.55988646", "0.5598691", "0.5573718", "0.5572278", "0.55478996", "0.5539815", "0.55305266", "0.5502864", "0.5486732", "0.5481652", "0.5481431", "0.5455964", "0.54552233", "0.542992", "0.54107076", "0.5383726", "0.5382267", "0.5351802", "0.53466415", "0.53424793", "0.5336623", "0.5321903", "0.5303989", "0.5300897", "0.5296715", "0.5289398", "0.5266314", "0.525607", "0.52373034", "0.5230635", "0.5224691", "0.52188784", "0.5206201", "0.5198088", "0.5181383", "0.5180935", "0.5178399", "0.517661", "0.517642", "0.5173065", "0.5171429", "0.5169049", "0.51621306", "0.51546276", "0.5154022", "0.51381147", "0.5135831", "0.5130576", "0.512692", "0.5122411", "0.5119324", "0.51186925", "0.51181287", "0.51154524", "0.51149833", "0.5112269" ]
0.0
-1
Executes CURL call. Returns API response.
public function call($endpoint, LicenseRequest $license, $method = 'POST') { $microtime = microtime(true); $this->trigger('start', [$microtime]); // Begin $this->setCurl(preg_match('/https\:/', $license->url)); $this->resolveEndpoint($endpoint, $license); // Make call $url = $license->url . $endpoint; $this->trigger('endpoint', [$endpoint, $url]); curl_setopt($this->curl, CURLOPT_URL, $url); // Set method $this->trigger('request', [$license->request]); switch ($method) { case 'GET': curl_setopt($this->curl, CURLOPT_POST, 0); break; case 'POST': curl_setopt($this->curl, CURLOPT_POST, 1); if ($license->request && count($license->request) > 0) { curl_setopt($this->curl, CURLOPT_POSTFIELDS, http_build_query($license->request)); } break; case 'JPOST': case 'JPUT': case 'JGET': case 'JDELETE': $json = json_encode($license->request); curl_setopt($this->curl, CURLOPT_CUSTOMREQUEST, preg_replace('/J/', '', $method, -1)); curl_setopt($this->curl, CURLOPT_POSTFIELDS, $json); // Rewrite headers curl_setopt($this->curl, CURLOPT_HTTPHEADER, [ 'Content-Type: application/json', 'Content-Length: ' . strlen($json), ]); break; } // Get response $this->response = curl_exec($this->curl); if (curl_errno($this->curl)) { $error = curl_error($this->curl); curl_close($this->curl); if (!empty($error)) { throw new Exception($error); } } else { curl_close($this->curl); } $this->trigger('response', [$this->response]); $this->trigger('finish', [microtime(true), $microtime]); return empty($this->response) ? null : json_decode($this->response); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function sendCurl() {\n\t\t$this->curlResponse = $this->curl->exec();\n\t}", "protected function _exec() {\r\n $response = curl_exec($this->_curl);\r\n $httpStatusCode = $this->getOption(CURLINFO_HTTP_CODE);\r\n $httpError = in_array(floor($httpStatusCode / 100), array(4, 5));\r\n if($httpError) {\r\n $this->_error = \"Http Error Status Code {$httpStatusCode}\";\r\n }\r\n\r\n $curlError = !(curl_errno($this->_curl) === 0);\r\n if($curlError) {\r\n $this->_error = curl_error($this->_curl);\r\n }\r\n return $response;\r\n }", "public function exec()\n {\n return curl_exec($this->curl);\n }", "public function exec()\n {\n return curl_exec($this->curl);\n }", "function exec() {\r\n return curl_exec($this->curl);\r\n }", "protected function execCurl() \n\t{\t\t\t\n\t\tif ( $this->sandbox == true )\n\t\t{\n\t\t\t$server = $this->_server['sandbox'];\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$server = $this->_server['live'];\n\t\t}\n\n\t\t$url = $server . $this->adhocPostUrl;\n\t\t\n\t\t$headers = array(\n\t\t\t'Content-type: application/x-www-form-urlencoded',\n\t\t\t'Authorization: GoogleLogin auth=' . $this->getAuthToken(),\n\t\t\t'developerToken: ' . $this->developerToken,\n\t\t\t'clientCustomerId: ' . $this->clientCustomerId,\n\t\t\t'returnMoneyInMicros: true',\n\t\t\t\t\t\t\n\t\t);\n\n\t\t$data = '__rdxml=' . urlencode( $this->__rdxml );\n\t\t\n\t\t$ch = curl_init( $url );\n\t\tcurl_setopt( $ch, CURLOPT_POST, 1 );\n\t\tcurl_setopt( $ch, CURLOPT_POSTFIELDS, $data );\n\t\tcurl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, FALSE );\n\t\tcurl_setopt( $ch, CURLOPT_FOLLOWLOCATION, TRUE );\n\t\tcurl_setopt( $ch, CURLOPT_HEADER, FALSE );\n\t\tcurl_setopt( $ch, CURLOPT_RETURNTRANSFER, TRUE );\n\t\tcurl_setopt( $ch, CURLOPT_HTTPHEADER, $headers );\n\t\t\n\t\t$response = curl_exec( $ch );\n\t\t$httpCode = curl_getinfo( $ch, CURLINFO_HTTP_CODE );\n\t\t$error = curl_error( $ch );\n\t\tcurl_close( $ch );\n\t\t\n\t\tif( $httpCode == 200 || $httpCode == 403 )\n\t\t{\n\t\t\treturn $response;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif ( !empty( $error ) )\n\t\t\t{\n\t\t\t\tthrow new exception( $httpCode . ' - ' . $error );\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tthrow new exception( $httpCode . ' - Unknow error occurred while post operation.' ); \n\t\t\t}\n\t\t}\n\t}", "function callApi($url) {\n\n $ch = curl_init();\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);\n curl_setopt ($ch, CURLOPT_URL, $url);\n\n // Get the response and close the channel.\n $response = curl_exec ( $ch );\n\n if ($response === false) {\n echo \"Failed to \".$action.\" : \" . curl_error ( $ch );\n }\n\n curl_close($ch);\n\n return $response;\n}", "private function executeCurl ()\n {\n $result = curl_exec($this->cURL);\n\n if (!$result)\n {\n throw new CurlException($this->cURL);\n }\n\n return $result;\n }", "public function apiCall($url) {\n\t\t// Open curl.\n\t\t$ch = curl_init();\n\t\tcurl_setopt($ch, CURLOPT_URL, $url);\n\t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n\t\tcurl_setopt($ch, CURLOPT_USERPWD, $this->api_username . \":\" . $this->api_password);\n\t\tcurl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);\n\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);\n\t\t$output = curl_exec($ch);\n\t\tcurl_close($ch);\n\t\treturn $output;\n\t}", "function curl_URL_call($url){\n\t$ch = curl_init();\n\tcurl_setopt($ch, CURLOPT_URL, $url);\n\tcurl_setopt($ch, CURLOPT_HEADER, 0);\n\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); \n\t$output = curl_exec($ch);\n\tcurl_close($ch);\n\treturn $output;\n}", "protected function execute($url)\n {\n $curl = curl_init();\n curl_setopt($curl, CURLOPT_URL, $url);\n curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($curl, CURLOPT_ENCODING, \"\");\n curl_setopt($curl, CURLOPT_MAXREDIRS, 10);\n curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 15);\n curl_setopt($curl, CURLOPT_TIMEOUT, 30);\n curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);\n curl_setopt($curl, CURLOPT_CUSTOMREQUEST, self::GET);\n if ($this->isValidArray($this->requestHeader)) {\n curl_setopt($curl, CURLOPT_HTTPHEADER, $this->requestHeader);\n }\n\n $res = null;\n $err = null;\n try {\n $res = curl_exec($curl);\n $err = curl_error($curl);\n if (!empty($err)) $this->errorStack[] = $err;\n } catch (Exception $e) {\n $err = $e->getMessage();\n $this->errorStack[] = $err;\n } finally {\n curl_close($curl);\n return ($this->validateResponse($res, $err)) ? $res : $this->getError();\n }\n }", "private function execute()\n {\n // executes a cURL session for the request, and sets the result variable\n $result = Request::get($this->getRequestURL())->send();\n // return the json result\n return $result->raw_body;\n }", "function execute($url, $options)\n\t{\n\t\t$curl = curl_init($url);\n\t\tcurl_setopt_array($curl, $options);\n\t\treturn curl_exec($curl);\n\t}", "private function callAPI($url)\n {\n $curl = curl_init();\n curl_setopt($curl, CURLOPT_URL, $url);\n curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);\n $result = curl_exec($curl);\n curl_close($curl);\n return $result;\n }", "public function _call($url)\n {\n\n $ch = curl_init();\n\n curl_setopt($ch, CURLOPT_URL, $url);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n\n if ($this->curlTimeout) {\n curl_setopt($ch, CURLOPT_TIMEOUT_MS, $this->curlTimeout);\n }\n\n $output = curl_exec($ch);\n\n if ($output === false) {\n throw new \\Exception(curl_error($ch));\n }\n\n curl_close($ch);\n\n return $output;\n }", "function execCurl($url) {\n\t//echo \"<br> URL: $url <br>\";\n\t\n\t$curl = curl_init();\n\t\n\tcurl_setopt_array($curl, array(\n\t\tCURLOPT_URL => $url,\n\t\tCURLOPT_RETURNTRANSFER => true,\n\t\tCURLOPT_HEADER => false)\n\t);\n\t\n\t$curl_response = curl_exec($curl);\n\t\n\t$curl_errno = curl_errno($curl);\n $curl_error = curl_error($curl);\n\t\n\tif (curl_error($curl) || $curl_response === false || $curl_errno > 0)\n {\n $info = curl_getinfo($curl);\n echo 'error occured during curl exec - ' . var_export($info) ;\n echo '<br> error -----------> '. $curl_error; \n curl_close($curl);\n }\n \n curl_close($curl);\n\treturn $curl_response;\n}", "public function doCall($url) {\n $ch = curl_init();\n $timeout = 5;\n\n curl_setopt($ch, CURLOPT_URL, $url);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);\n curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);\n curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);\n\n curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);\n curl_setopt($ch, CURLOPT_USERPWD, \"{$this->http_auth_username}:{$this->http_auth_pass}\");\n\n curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0');\n $data = curl_exec($ch);\n $errno = curl_errno($ch);\n $error = curl_error($ch);\n\n curl_close($ch);\n return $data;\n }", "public function execute($url)\n { if (!function_exists('curl_init')) {\n die('Sorry cURL is not installed!');\n }\n\n // OK cool - then let's create a new cURL resource handle\n $this->ch = curl_init();\n\n // Now set some options (most are optional)\n\n // Set URL to download\n curl_setopt($this->ch, CURLOPT_URL, $url);\n\n foreach ($this->curlOptions as $key=>$value) {\n curl_setopt($this->ch, $key, $value);\n }\n\n // Download the given URL, and return output\n $output = curl_exec($this->ch);\n\n // Close the cURL resource, and free system resources\n curl_close($this->ch);\n\n return $output;\n }", "private function sendCurl($url) {\n $handle = curl_init();\n $opts = curl_setopt_array($handle, array(\n CURLOPT_RETURNTRANSFER => 1,\n CURLOPT_URL => 'https://' . $url . \"&method=CURL\",\n CURLOPT_USERAGENT => $_SERVER['HTTP_USER_AGENT'],\n CURLOPT_POST => 1,\n CURLOPT_POSTFIELDS => $this->payload\n ));\n // Send the request & save response to $resp\n $exec = curl_exec($handle);\n // Close request to clear up some resources\n $close = curl_close($handle);\n\n //$json_array = json_decode($exec, TRUE);\n\n if($this->testing) echo \"<hr /><h1>JSON RESPONSE:</h1><br />$exec <hr />\";\n }", "private function execute() {\n\t\t// Max exec time of 1 minute.\n\t\tset_time_limit(60);\n\t\t// Open cURL request\n\t\t$curl_session = curl_init();\n\n\t\t// Set the url to post request to\n\t\tcurl_setopt ($curl_session, CURLOPT_URL, $this->url);\n\t\t// cURL params\n\t\tcurl_setopt ($curl_session, CURLOPT_HEADER, 0);\n\t\tcurl_setopt ($curl_session, CURLOPT_POST, 1);\n\t\t// Pass it the query string we created from $this->data earlier\n\t\tcurl_setopt ($curl_session, CURLOPT_POSTFIELDS, $this->curl_str);\n\t\t// Return the result instead of print\n\t\tcurl_setopt($curl_session, CURLOPT_RETURNTRANSFER,1);\n\t\t// Set a cURL timeout of 30 seconds\n\t\tcurl_setopt($curl_session, CURLOPT_TIMEOUT,30);\n\t\tcurl_setopt($curl_session, CURLOPT_SSL_VERIFYPEER, FALSE);\n\n\t\t// Send the request and convert the return value to an array\n\t\t$response = preg_split('/$\\R?^/m',curl_exec($curl_session));\n\n\t\t// Check that it actually reached the SagePay server\n\t\t// If it didn't, set the status as FAIL and the error as the cURL error\n\t\tif (curl_error($curl_session)){\n\t\t\t$this->status = 'FAIL';\n\t\t\t$this->error = curl_error($curl_session);\n\t\t}\n\n\t\t// Close the cURL session\n\t\tcurl_close ($curl_session);\n\n\t\t// Turn the response into an associative array\n\t\tfor ($i=0; $i < count($response); $i++) {\n\t\t\t// Find position of first \"=\" character\n\t\t\t$splitAt = strpos($response[$i], '=');\n\t\t\t// Create an associative array\n\t\t\t$this->response[trim(substr($response[$i], 0, $splitAt))] = trim(substr($response[$i], ($splitAt+1)));\n\t\t}\n\n\t\t// Return values. Assign stuff based on the return 'Status' value from SagePay\n\t\tswitch($this->response['Status']) {\n\t\t\tcase 'OK':\n\t\t\t\t// Transactino made succssfully\n\t\t\t\t$this->status = 'success';\n\t\t\t\t$_SESSION['transaction']['VPSTxId'] = $this->response['VPSTxId']; // assign the VPSTxId to a session variable for storing if need be\n\t\t\t\t$_SESSION['transaction']['TxAuthNo'] = $this->response['TxAuthNo']; // assign the TxAuthNo to a session variable for storing if need be\n\t\t\t\tbreak;\n\t\t\tcase '3DAUTH':\n\t\t\t\t// Transaction required 3D Secure authentication\n\t\t\t\t// The request will return two parameters that need to be passed with the 3D Secure\n\t\t\t\t$this->acsurl = $this->response['ACSURL']; // the url to request for 3D Secure\n\t\t\t\t$this->pareq = $this->response['PAReq']; // param to pass to 3D Secure\n\t\t\t\t$this->md = $this->response['MD']; // param to pass to 3D Secure\n\t\t\t\t$this->status = '3dAuth'; // set $this->status to '3dAuth' so your controller knows how to handle it\n\t\t\t\tbreak;\n\t\t\tcase 'REJECTED':\n\t\t\t\t// errors for if the card is declined\n\t\t\t\t$this->status = 'declined';\n\t\t\t\t$this->error = 'Your payment was not authorised by your bank or your card details where incorrect.';\n\t\t\t\tbreak;\n\t\t\tcase 'NOTAUTHED':\n\t\t\t\t// errors for if their card doesn't authenticate\n\t\t\t\t$this->status = 'notauthed';\n\t\t\t\t$this->error = 'Your payment was not authorised by your bank or your card details where incorrect.';\n\t\t\t\tbreak;\n\t\t\tcase 'INVALID':\n\t\t\t\t// errors for if the user provides incorrect card data\n\t\t\t\t$this->status = 'invalid';\n\t\t\t\t$this->error = 'One or more of your card details where invalid. Please try again.';\n\t\t\t\tbreak;\n\t\t\tcase 'FAIL':\n\t\t\t\t// errors for if the transaction fails for any reason\n\t\t\t\t$this->status = 'fail';\n\t\t\t\t$this->error = 'An unexpected error has occurred. Please try again.';\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t// default error if none of the above conditions are met\n\t\t\t\t$this->status = 'error';\n\t\t\t\t$this->error = 'An error has occurred. Please try again.';\n\t\t\t\tbreak;\n\t\t}\n\n\t\t// set error sessions if the request failed or was declined to be handled by controller\n\t\tif($this->status !== 'success') {\n\t\t\t$_SESSION['error']['status'] = $this->status;\n\t\t\t$_SESSION['error']['description'] = $this->error;\n\t\t}\n\t}", "function make_call($url)\n {\n echo \"API Call:<br /><textarea id='orig' rows='4' cols='150'>$url</textarea><br />\";\n $ch = curl_init();\n $timeout = 20;\n curl_setopt($ch, CURLOPT_FAILONERROR, 1);\n curl_setopt($ch, CURLOPT_VERBOSE, true);\n curl_setopt($ch, CURLOPT_URL, $url);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);\n curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);\n curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);\n curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);\n\n\n $data = curl_exec($ch);\n\n if (curl_errno($ch)) {\n print curl_error($ch);\n } else {\n curl_close($ch);\n }\n echo htmlentities($data) . \"<br />\";\n return $data;\n }", "public function exec(){\n return curl_exec($this->handler);\n }", "public function execute()\n {\n return curl_exec($this->_handle);\n }", "private function exec_curl( $ch ) {\n\t\t$response = array();\n\n\t\t$response[ 'body' ] = curl_exec( $ch );\n\t\t$response[ 'status' ] = curl_getinfo($ch, CURLINFO_HTTP_CODE);\n\n\t\t$this->log( 'exec_curl response: ' . print_r( $response, true ) );\n\n\t\tcurl_close( $ch );\n\n\t\treturn $response;\n\t}", "function doCurl ($url, $options) {\n\tglobal $adminName, $adminPass, $verbose, $doe;\n\t\n\t$options = $options +\n\t\t\t array(CURLOPT_RETURNTRANSFER => true,\n\t\t\t\t\t CURLOPT_USERPWD => $adminName . \":\" . $adminPass,\n\t\t\t\t\t CURLOPT_HTTPHEADER => array('OCS-APIRequest:true', 'Accept: application/json'),\n\t\t\t );\n\n\tif ($verbose > 2) {\n\t\t$options = $options +\n\t\t\t\t array(CURLOPT_VERBOSE => TRUE,\n\t\t\t\t\t\t CURLOPT_HEADER => TRUE\n\t\t\t\t );\n\t}\n\n\t$ch = curl_init($url);\n\n \tcurl_setopt_array( $ch, $options);\n\t\n// For use with Charles proxy:\n// \tcurl_setopt($ch, CURLOPT_PROXYPORT, '8888');\n// \tcurl_setopt($ch, CURLOPT_PROXYTYPE, 'HTTP');\n// \tcurl_setopt($ch, CURLOPT_PROXY, '127.0.0.1');\n\n $response = curl_exec($ch);\n //print_r($response);\n $response = json_decode($response);\n //print_r($response);\n\n $statuscode = $response->{'ocs'}->{'meta'}->statuscode;\n\n \n if($statuscode != \"100\"){\n echo $statuscode;\n echo $response->{'ocs'}->{'meta'}->message;\n return $statuscode;\n exit(1);\n }\n\n if($response === false) {\n echo 'Curl error: ' . curl_error($ch) . \"\\n\";\n\t\texit(1);\n\t}\n\t\n\tcurl_close($ch);\n \n\t/* An error causes an exit\n\tif (preg_match(\"~<statuscode>(\\d+)</statuscode>~\", $response, $matches)) {\n $responseCode = $matches[1]; // what's the status code\n //echo $matches[3];\n //echo \"<h3>\" . $response . \"</h3>\";\n if ($responseCode == '404') {\n return \"2\";\n exit(2);\n } elseif ($responseCode != '100') {\n echo \"1Error response code; exiting\\n$response\\n\";\n\t\t\texit(1);\n\t\t}\n\t}\n\telse { // something is definitely wrong\n echo \"No statuscode response; exiting:\\n$response\\n\";\n \n\t\texit(1);\n\t}\n */\n\t// What sort of response do we want to give\n//\tif ($verbose == 1) { echo \"Response code from server: $responseCode\\n\"; }\n\t//if ($verbose == 1) { echo \"\\n\"; }\n\t//if ($verbose > 1) { echo \"Response from server:\\n$response\\n\\n\"; }\n\n\treturn $response;\n}", "function curl($url) {\n\n $ch = curl_init(); // Initialising cURL\n curl_setopt($ch, CURLOPT_URL, $url); // Setting cURL's URL option with the $url variable passed into the function\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); // Setting cURL's option to return the webpage data\n curl_setopt($ch, CURLOPT_HTTPHEADER, array(\n\t \t'Accept: application/json',\n\t \t'X-ELS-APIKey: 82b47f24bf707a447d642d170ae6e318'\n\t ));\n $data = curl_exec($ch); // Executing the cURL request and assigning the returned data to the $data variable\n curl_close($ch); // Closing cURL\n return $data; // Returning the data from the function\n }", "function curl( $url ) {\n\t$curl = curl_init( $url );\n\tcurl_setopt( $curl, CURLOPT_RETURNTRANSFER, true );\n\tcurl_setopt( $curl, CURLOPT_HEADER, 0 );\n\tcurl_setopt( $curl, CURLOPT_USERAGENT, '' );\n\tcurl_setopt( $curl, CURLOPT_TIMEOUT, 10 );\n\t$response = curl_exec( $curl );\n\tif ( 0 !== curl_errno( $curl ) || 200 !== curl_getinfo( $curl, CURLINFO_HTTP_CODE ) ) {\n\t\t$response = null;\n\t}\n\tcurl_close( $curl );\n\treturn $response;\n}", "private function runCurl($url, $postVals = null, $headers = null, $auth = false){\r\n $ch = curl_init($url);\r\n\r\n $options = array(\r\n CURLOPT_RETURNTRANSFER => true,\r\n CURLOPT_CONNECTTIMEOUT => 20,\r\n CURLOPT_TIMEOUT => 20\r\n );\r\n\r\n if (!empty($_SERVER['HTTP_USER_AGENT'])){\r\n $options[CURLOPT_USERAGENT] = $_SERVER['HTTP_USER_AGENT'];\r\n } else {\r\n $options[CURLOPT_USERAGENT] = \"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13\";\r\n }\r\n\r\n if ($postVals != null){\r\n $options[CURLOPT_POSTFIELDS] = $postVals;\r\n $options[CURLOPT_CUSTOMREQUEST] = \"POST\";\r\n }\r\n\r\n if ($this->auth_mode == 'oauth'){\r\n $headers = array(\"Authorization: {$this->token_type} {$this->access_token}\");\r\n $options[CURLOPT_HEADER] = false;\r\n $options[CURLINFO_HEADER_OUT] = false;\r\n $options[CURLOPT_HTTPHEADER] = $headers;\r\n $options[CURLOPT_SSL_VERIFYPEER] = false;\r\n }\r\n\r\n if ($auth){\r\n $options[CURLOPT_HTTPAUTH] = CURLAUTH_BASIC;\r\n $options[CURLOPT_USERPWD] = $this->client_id . \":\" . $this->client_secret;\r\n $options[CURLOPT_SSLVERSION] = 4;\r\n $options[CURLOPT_SSL_VERIFYPEER] = false;\r\n $options[CURLOPT_SSL_VERIFYHOST] = 2;\r\n }\r\n\r\n curl_setopt_array($ch, $options);\r\n $apiResponse = curl_exec($ch);\r\n $response = json_decode($apiResponse);\r\n\r\n //check if non-valid JSON is returned\r\n if ($error = json_last_error()){\r\n $response = $apiResponse;\r\n }\r\n curl_close($ch);\r\n\r\n return $response;\r\n }", "public static function sendCurl($_url, $_params)\n {\n $Curl = curl_init();\n $_params[CURLOPT_URL] = $_url;\n curl_setopt_array($Curl, $_params);\n\n $CurlOutput = curl_exec($Curl);\n\n if (curl_errno($Curl)) {\n echo(\"Remote service error: \".curl_error($Curl).\".\");\n }\n\n curl_close($Curl);\n\n return $CurlOutput;\n }", "function call_url($url)\n\t{\n\t\t$ch = curl_init ($url);\n\t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER,true);\n\t\tcurl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, false);\n\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);\n\t\tcurl_setopt($ch, CURLOPT_HTTPGET, TRUE);\n\t\t$out = curl_exec($ch);\n\t\tcurl_close($ch);\n\t\t\n\t\treturn $out;\n\t}", "protected function _execute(){\n\t\t\t$this->_getUrl();\n\n\t\t\t$c = curl_init($this->_url);\n\t\t\tob_start();\n\t\t\tif(!empty($this->_postFields)) {\n\t\t\t\tcurl_setopt($c, CURLOPT_POST, 1);\n\t\t\t\tcurl_setopt($c, CURLOPT_POSTFIELDS, json_encode($this->_postFields));\n\t\t\t}\n\n\t\t\tcurl_exec($c);\n\t\t\tcurl_close($c);\n\t\t\t$this->_result = trim(ob_get_contents());\n\t\t\tob_end_clean();\n\t\t}", "function __apiCall($url, $post_parameters = FALSE) {\n \n \t// Initialize the cURL session\n\t $curl_session = curl_init();\n\t \t\n\t // Set the URL of api call\n\t\tcurl_setopt($curl_session, CURLOPT_URL, $url);\n\t\t \n\t\t// If there are post fields add them to the call\n\t\tif($post_parameters !== FALSE) {\n\t\t\tcurl_setopt ($curl_session, CURLOPT_POSTFIELDS, $post_parameters);\n\t\t}\n\t\t \n\t\t// Return the curl results to a variable\n\t curl_setopt($curl_session, CURLOPT_RETURNTRANSFER, 1);\n\t\t \n\t // Execute the cURL session\n\t $contents = curl_exec ($curl_session);\n\t\t \n\t\t// Close cURL session\n\t\tcurl_close ($curl_session);\n\t\t \n\t\t// Return the response\n\t\treturn json_decode($contents);\n \n }", "private function dispatch(): void {\n $curl = curl_init();\n\n curl_setopt_array($curl, array(\n CURLOPT_URL => \"{$this->apiUrl}/{$this->endpoint}\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => \"CURL_HTTP_VERSION_1_1\",\n CURLOPT_CUSTOMREQUEST => $this->method\n ));\n\n $this->response = curl_exec($curl); \n curl_close($curl);\n }", "function funExecuteCurl($ch){\n return curl_exec($ch);\n\n}", "public function execute($getCurlObject = false)\n {\n if ($this->credentials instanceof \\PHPCR\\SimpleCredentials) {\n $this->curl->setopt(CURLOPT_USERPWD, $this->credentials->getUserID().':'.$this->credentials->getPassword());\n } else {\n $this->curl->setopt(CURLOPT_USERPWD, null);\n }\n\n $headers = array(\n 'Depth: ' . $this->depth,\n 'Content-Type: '.$this->contentType,\n 'User-Agent: '.self::USER_AGENT\n );\n $headers = array_merge($headers, $this->additionalHeaders);\n\n $this->curl->setopt(CURLOPT_RETURNTRANSFER, true);\n $this->curl->setopt(CURLOPT_CUSTOMREQUEST, $this->method);\n $this->curl->setopt(CURLOPT_URL, $this->uri);\n $this->curl->setopt(CURLOPT_HTTPHEADER, $headers);\n $this->curl->setopt(CURLOPT_POSTFIELDS, $this->body);\n if ($getCurlObject) {\n $this->curl->parseResponseHeaders();\n }\n\n\n $response = $this->curl->exec();\n\n $httpCode = $this->curl->getinfo(CURLINFO_HTTP_CODE);\n if ($httpCode >= 200 && $httpCode < 300) {\n if ($getCurlObject) {\n return $this->curl;\n }\n return $response;\n }\n\n switch ($this->curl->errno()) {\n case CURLE_COULDNT_RESOLVE_HOST:\n case CURLE_COULDNT_CONNECT:\n throw new \\PHPCR\\NoSuchWorkspaceException($this->curl->error());\n }\n\n // TODO extract HTTP status string from response, more descriptive about error\n\n // use XML error response if it's there\n if (substr($response, 0, 1) === '<') {\n $dom = new \\DOMDocument();\n $dom->loadXML($response);\n $err = $dom->getElementsByTagNameNS(Client::NS_DCR, 'exception');\n if ($err->length > 0) {\n $err = $err->item(0);\n $errClass = $err->getElementsByTagNameNS(Client::NS_DCR, 'class')->item(0)->textContent;\n $errMsg = $err->getElementsByTagNameNS(Client::NS_DCR, 'message')->item(0)->textContent;\n\n $exceptionMsg = 'HTTP ' . $httpCode . ': ' . $errMsg;\n switch($errClass) {\n case 'javax.jcr.NoSuchWorkspaceException':\n throw new \\PHPCR\\NoSuchWorkspaceException($exceptionMsg);\n case 'javax.jcr.nodetype.NoSuchNodeTypeException':\n throw new \\PHPCR\\NodeType\\NoSuchNodeTypeException($exceptionMsg);\n case 'javax.jcr.ItemNotFoundException':\n throw new \\PHPCR\\ItemNotFoundException($exceptionMsg);\n case 'javax.jcr.nodetype.ConstraintViolationException':\n throw new \\PHPCR\\NodeType\\ConstraintViolationException($exceptionMsg);\n\n //TODO: map more errors here?\n default:\n\n // try to generically \"guess\" the right exception class name\n $class = substr($errClass, strlen('javax.jcr.'));\n $class = explode('.', $class);\n array_walk($class, function(&$ns) { $ns = ucfirst(str_replace('nodetype', 'NodeType', $ns)); });\n $class = '\\\\PHPCR\\\\'.implode('\\\\', $class);\n\n if (class_exists($class)) {\n throw new $class($exceptionMsg);\n }\n throw new \\PHPCR\\RepositoryException($exceptionMsg . \" ($errClass)\");\n }\n }\n }\n\n if (404 === $httpCode) {\n throw new \\PHPCR\\PathNotFoundException(\"HTTP 404 Path Not Found: {$this->method} {$this->uri}\");\n } elseif (405 == $httpCode) {\n throw new \\Jackalope\\Transport\\Davex\\HTTPErrorException(\"HTTP 405 Method Not Allowed: {$this->method} {$this->uri}\", 405);\n } elseif ($httpCode >= 500) {\n throw new \\PHPCR\\RepositoryException(\"HTTP $httpCode Error from backend on: {$this->method} {$this->uri} \\n\\n$response\");\n }\n\n $curlError = $this->curl->error();\n\n $msg = \"Unexpected error: \\nCURL Error: $curlError \\nResponse (HTTP $httpCode): {$this->method} {$this->uri} \\n\\n$response\";\n throw new \\PHPCR\\RepositoryException($msg);\n }", "function curl($url) {\n $ch = curl_init(); \n curl_setopt($ch, CURLOPT_URL, $url);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); \n $output = curl_exec($ch); \n curl_close($ch); \n return $output;\n}", "protected function exec($url)\n {\n $client = $this->getRequest();\n try{\n $response = $client->request('POST',$this->buildRequestUrl(),[\n 'json' => [\n 'longUrl' => $url\n ]\n ]);\n } catch (\\GuzzleHttp\\Exception\\ClientException $e){\n $response = $e->getResponse();\n }\n return $this->handleResponse($response->getBody());\n }", "protected function curlRequest($url)\n {\n //curl_init — Initialize a cURL session (Client URL Library)\n $curl = curl_init();\n curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($curl, CURLOPT_URL, $url);\n\n return curl_exec($curl);\n }", "public function execQuery()\n{\n\n $url = $this->getURL();\n // create curl resource \n $ch = curl_init(); \n\n //return the transfer as a string \n curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); \n curl_setopt( $ch, CURLOPT_USERAGENT, \"MyUserAgent\" );\n\n // set url \n curl_setopt($ch, CURLOPT_URL, $url);\n\n // $output contains the output string \n $result = curl_exec($ch); \n\n $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); \n\n // Check if any error occurred\n if(curl_errno($ch))\n {\n echo 'Curl error: ' . curl_error($ch);\n }\n // close curl resource to free up system resources \n curl_close($ch); \n\n return $result;\n}", "public function execute() {\n $body = curl_exec($this->_handle); \n $status = curl_getinfo($this->_handle, CURLINFO_HTTP_CODE);\n return array(\n 'body' => $body,\n 'status' => $status\n );\n }", "function executeRequest() {\n\n\t\t// curl general\n\t\t$curl_options = [\n\t\t\tCURLOPT_RETURNTRANSFER => true,\n\t\t\tCURLOPT_SSL_VERIFYPEER => true,\n\t\t\tCURLOPT_CUSTOMREQUEST => $this->_requestType\n\t\t];\n\n\t\t// set to post\n\t\tif($this->_requestType == 'POST') {\n\t\t\t$curl_options[CURLOPT_POST] = true;\n\t\t}\n\n\t\t// build url and append query params\n\t\t$url = $this->url($this->_url);\n\t\t$this->_params[$this->_oauth2->getAccessTokenName()] = $this->_oauth2->getAccessToken();\n\t\tif(count($this->_params) > 0) {\n\t\t\t$url->setQuery($this->_params);\n\t\t}\n\t\t$curl_options[CURLOPT_URL] = $url->val();\n\n\t\t// check request headers\n\t\tif(count($this->_headers) > 0) {\n\t\t\t$header = [];\n\t\t\tforeach ($this->_headers as $key => $parsed_urlvalue) {\n\t\t\t\t$header[] = \"$key: $parsed_urlvalue\";\n\t\t\t}\n\t\t\t$curl_options[CURLOPT_HTTPHEADER] = $header;\n\t\t}\n\n\t\t// init curl\n\t\t$ch = curl_init();\n\t\tcurl_setopt_array($ch, $curl_options);\n\n\t\t// https handling\n\t\tif($this->_certificateFile != '') {\n\t\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);\n\t\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);\n\t\t\tcurl_setopt($ch, CURLOPT_CAINFO, $this->_certificateFile);\n\t\t} else {\n\t\t\t// bypass ssl verification\n\t\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);\n\t\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);\n\t\t}\n\n\t\t// execute the curl request\n\t\t$result = curl_exec($ch);\n\t\t$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);\n\t\t$content_type = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);\n\t\tif($curl_error = curl_error($ch)) {\n\t\t\tthrow new OAuth2Exception($curl_error);\n\t\t} else {\n\t\t\t$json_decode = $this->jsonDecode($result, true);\n\t\t}\n\t\tcurl_close($ch);\n\n\t\treturn [\n\t\t\t'result' => (null === $json_decode) ? $result : $json_decode,\n\t\t\t'code' => $http_code,\n\t\t\t'content_type' => $content_type\n\t\t];\n\t}", "function run_curl($p_path) {\r\n\r\n global $CURL_OPTIONS;\r\n\r\n $tp_result = array();\r\n $tp_curl = curl_init($p_path);\r\n curl_setopt_array($tp_curl, $CURL_OPTIONS);\r\n $tp_result['content'] = curl_exec($tp_curl);\r\n $tp_result['code'] = curl_getinfo($tp_curl, CURLINFO_HTTP_CODE);\r\n curl_close($tp_curl);\r\n return $tp_result;\r\n\r\n}", "public function getResponse()\n {\n $url = $this->_url;\n\n if (count($this->_params)) {\n $query_string = http_build_query($this->_params);\n $url .= '?' . $query_string;\n }\n\n $ch = curl_init();\n\n // set some default values\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 1);\n curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);\n curl_setopt($ch, CURLOPT_TIMEOUT, 30);\n\n // set user generated values\n foreach ($this->_options as $key => $value) {\n curl_setopt($ch, $key, $value);\n }\n\n curl_setopt($ch, CURLOPT_URL, $url);\n\n $result = curl_exec($ch);\n\n curl_close($ch);\n\n return $result;\n }", "public function executeRequest()\n {\n $aux = array();\n\n foreach ($this->headers as $header => $value) {\n $aux[] = \"$header: $value\";\n }\n\n curl_setopt($this->handler, CURLOPT_HTTPHEADER, $aux);\n\n $body = curl_exec($this->handler);\n\n if(empty($body)){\n $code = curl_errno($this->handler);\n\n if ($code == 60 || $code == 77) {\n curl_setopt($this->handler, CURLOPT_CAINFO, __DIR__ . '/cacerts.pem');\n $body = curl_exec($this->handler);\n }\n\n if(empty($body)){\n $error = curl_error($this->handler);\n $code = curl_errno($this->handler);\n throw new \\Exception($error, $code);\n }\n }\n\n $statusCode = curl_getinfo($this->handler, CURLINFO_HTTP_CODE);\n $cookies = curl_getinfo($this->handler, CURLINFO_COOKIELIST);\n\n $response = new HttpResponse();\n $response->cookies = $cookies;\n $response->statusCode = $statusCode;\n $this->getBodyAndHeaders($body, $response);\n\n curl_close($this->handler);\n\n return $response;\n }", "public function execute(Carerix_Api_Rest_Request $request)\n {\n $ch = curl_init();\n curl_setopt($ch, CURLOPT_URL, $request->getUrl());\n // This constant is not available when open_basedir or safe_mode are enabled.\n// curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n // [AY] CURLOPT_VERBOSE, CURLOPT_HEADER required for capturing response headers\n curl_setopt($ch, CURLOPT_VERBOSE, 1);\n curl_setopt($ch, CURLOPT_HEADER, 1);\n curl_setopt($ch, CURLINFO_HEADER_OUT, 1); // [AY] required for capturing request headers\n curl_setopt($ch, CURLOPT_HTTPHEADER, ['Expect:']);\n curl_setopt($ch, CURLOPT_USERAGENT, __CLASS__);\n curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);\n curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);\n\n $proxy = $request->getProxy();\n if ($proxy) {\n $proxy = parse_url($proxy);\n curl_setopt($ch, CURLOPT_PROXY, $proxy['host']);\n if (array_key_exists('port', $proxy)) {\n curl_setopt($ch, CURLOPT_PROXYPORT, $proxy['port']);\n }\n }\n\n $username = $request->getUsername();\n $password = $request->getPassword();\n\n if ($username && $password) {\n curl_setopt($ch, CURLOPT_USERPWD, $username . ':' . $password);\n }\n\n switch ($request->getMethod()) {\n case self::POST:\n case self::PUT:\n curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $request->getMethod());\n switch ($request->getResponseType()) {\n case 'xml':\n $contentType = 'application/xml';\n break;\n\n case 'json':\n $contentType = 'application/json';\n break;\n\n case 'sencha':\n case 'js':\n $contentType = 'application/javascript';\n break;\n }\n curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: ' . $contentType]);\n curl_setopt($ch, CURLOPT_POSTFIELDS, $request->getBody());\n break;\n case self::DELETE:\n curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');\n break;\n case self::GET:\n default:\n break;\n }\n\n $response = curl_exec($ch);\n\n $this->last_request = curl_getinfo($ch, CURLINFO_HEADER_OUT);\n $this->last_request .= $request->getBody();\n // [AY] in case of 204 No content response response is always empty\n if ($response === false) {\n $errorNumber = curl_errno($ch);\n $error = curl_error($ch);\n curl_close($ch);\n\n throw new Exception($errorNumber . ': ' . $error);\n }\n\n $response = $this->parseResponse($response);\n $this->last_response = $response;\n\n [$header, $body] = explode(\"\\r\\n\\r\\n\", $response, 2);\n\n $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);\n if (!in_array($code, ['200', '201', '204'])) {\n throw new Carerix_Api_Rest_Exception($body, $code);\n }\n curl_close($ch);\n\n return $body;\n }", "protected function execute() : int\n {\n $this->response = curl_exec($this->curl);\n $this->errorCode = curl_errno($this->curl);\n $this->errorMessage = curl_error($this->curl);\n\n $symbol = \"\\r\\n\\r\\n\";\n if (!(strpos($this->response, $symbol) === false)) {\n list($header, $this->response) = explode($symbol, $this->response, 2);\n while (strtolower(trim($header)) === 'http/1.1 100 continue') {\n list($header, $this->response) = explode($symbol, $this->response, 2);\n }\n $this->responseHeader = preg_split(\n '/\\r\\n/',\n $header,\n null,\n PREG_SPLIT_NO_EMPTY\n );\n }\n\n return $this->errorCode;\n }", "private function curlRequest($url)\n {\n $curl_handle=curl_init();\n curl_setopt($curl_handle, CURLOPT_URL, $url);\n curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);\n curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);\n curl_setopt($curl_handle, CURLOPT_USERAGENT, Request::header('user-agent'));\n $response = curl_exec($curl_handle);\n curl_close($curl_handle);\n return $response;\n }", "public function exec()\n {\n return curl_exec($this->_session);\n }", "private function sendQueryByCurl() {\n $this->curl = curl_init();\n\n // JSON data request\n $jsonData = $this->getJsonData();\n\n // some params\n $urlParams = $this->getParamsUrlFormat();\n\n $this->setCurlOpts($this->curl, $jsonData, $urlParams);\n $this->setResult(curl_exec($this->curl));\n $this->setHttpCode(curl_getinfo($this->curl, CURLINFO_HTTP_CODE));\n\n curl_close($this->curl);\n }", "function curlRequest($url, $authHeader){\n //Initialize the Curl Session.\n $ch = curl_init();\n //Set the Curl url.\n curl_setopt ($ch, CURLOPT_URL, $url);\n //Set the HTTP HEADER Fields.\n curl_setopt ($ch, CURLOPT_HTTPHEADER, array($authHeader));\n //CURLOPT_RETURNTRANSFER- TRUE to return the transfer as a string of the return value of curl_exec().\n curl_setopt ($ch, CURLOPT_RETURNTRANSFER, TRUE);\n //CURLOPT_SSL_VERIFYPEER- Set FALSE to stop cURL from verifying the peer's certificate.\n curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, False);\n //Execute the cURL session.\n $curlResponse = curl_exec($ch);\n //Get the Error Code returned by Curl.\n $curlErrno = curl_errno($ch);\n if ($curlErrno) {\n $curlError = curl_error($ch);\n throw new Exception($curlError);\n }\n //Close a cURL session.\n curl_close($ch);\n return $curlResponse;\n }", "public static function _call_get($url){\n $curl = curl_init();\n // Set curl opt as array\n curl_setopt_array($curl, array(\n CURLOPT_URL => $url,\n // No more than 30 sec on a website\n CURLOPT_TIMEOUT=>10,\n CURLOPT_FOLLOWLOCATION => true,\n CURLOPT_RETURNTRANSFER => true,\n ));\n // Run curl\n $response = curl_exec($curl);\n //Check for errors \n if(curl_errno($curl)){\n $errorMessage = curl_error($curl);\n $statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);\n // Log error message .\n $return = array('success'=>FALSE,'error'=>$errorMessage,'status'=>$statusCode);\n } else {\n $statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);\n // Log success\n $return = array('success'=>TRUE,'response'=>$response,'status'=>$statusCode);\n }\n //close request\n curl_close($curl);\n //Return\n return $return;\n }", "private function curl($url, &$response, &$error)\n\t{\n\t\t$handler = curl_init();\n\t\tcurl_setopt($handler, CURLOPT_URL, $url);\n\t\tcurl_setopt($handler, CURLOPT_RETURNTRANSFER, true);\n\t\t$response = curl_exec($handler);\n\t\t$error = curl_errno($handler);\n\t\tcurl_close($handler);\n\t}", "function curlGet($url) {\n\t\t$ch = curl_init();\t// Initialising cURL session\n\t\t// Setting cURL options\n\t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);\n\t\tcurl_setopt($ch, CURLOPT_URL, $url);\n\t\t$results = curl_exec($ch);\t// Executing cURL session\n\t\tcurl_close($ch);\t// Closing cURL session\n\t\treturn $results;\t// Return the results\n\t}", "public static function execHttp(&$ch)\n {\n $response = curl_exec($ch);\n\n if(empty($response)){\n $code = curl_errno($ch);\n\n if ($code == 60 || $code == 77) {\n curl_setopt($ch, CURLOPT_CAINFO, __DIR__ . '/cacerts.pem');\n $response = curl_exec($ch);\n }\n\n if(empty($response)){\n $error = curl_error($ch);\n $code = curl_errno($ch);\n throw new \\Exception($error, $code);\n }\n }\n\n return $response;\n }", "private function callUrl($url)\r\n\t{\r\n\r\n\t\t$ch\t\t = curl_init();\r\n\t\tcurl_setopt($ch, CURLOPT_URL, $url);\r\n\t\tcurl_setopt($ch, CURLOPT_POSTFIELDS, $this -> payload);\r\n\t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\r\n\t\tcurl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);\r\n\t\t$data\t = curl_exec($ch);\r\n\t\t$err\t = curl_errno($ch);\r\n\r\n\t\tif ($err > 0) {\r\n\t\t\t$this -> errorMessage = curl_error($ch);\r\n\t\t}\r\n\r\n\t\t$this -> errorCode = $err;\r\n\r\n\t\tcurl_close($ch);\r\n\r\n\t\treturn $err == 0 ? $data : false;\r\n\t}", "function Curl_Call($url, $args) {\n\n\t\t$ch = curl_init();\n\t\tcurl_setopt($ch, CURLOPT_URL, $url);\n\t\tcurl_setopt($ch, CURLOPT_HEADER, false);\n\t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n\t\tcurl_setopt($ch, CURLOPT_POST, true);\n\t\tcurl_setopt($ch, CURLOPT_VERBOSE, true);\n\t\tcurl_setopt($ch, CURLOPT_POSTFIELDS, $args);\n\t\t$data = curl_exec($ch);\n\n\t\t//echo \"<pre>\".print_r(curl_getinfo($ch));\n\n\t\treturn $data;\n\t}", "private function request($url)\n\t{\n\t\t$curl_handler = curl_init();\n\n\t\t$url = $url . \"&api_key=\" . $this->apikey;\n\n\t\tcurl_setopt($curl_handler, CURLOPT_URL, $url);\n\t\tcurl_setopt($curl_handler, CURLOPT_RETURNTRANSFER, 1);\n\n\t\t$response = curl_exec($curl_handler);\n\n\t\tcurl_close($curl_handler);\n\n\t\tif ($response !== false)\n\t\t{\n\t\t\treturn $response;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t}", "function http($url, $method = 'GET', $postfields = NULL, $headers = array()) {\n\t\t$ci = curl_init();\n\t\t/* Curl settings */\n\t\tcurl_setopt($ci, CURLOPT_CONNECTTIMEOUT, $this->connecttimeout);\n\t\tcurl_setopt($ci, CURLOPT_TIMEOUT, $this->timeout);\n\t\tcurl_setopt($ci, CURLOPT_RETURNTRANSFER, TRUE);\n\t\tcurl_setopt($ci, CURLOPT_HTTPHEADER, array_merge(array('Expect:'),$headers));\n\t\tcurl_setopt($ci, CURLOPT_SSL_VERIFYPEER, $this->ssl_verifypeer);\n\n\t\tswitch ($method) {\n\t\tcase 'POST':\n\t\t\tcurl_setopt($ci, CURLOPT_POST, TRUE);\n\t\t\tif (!empty($postfields)) {\n\t\t\t\tcurl_setopt($ci, CURLOPT_POSTFIELDS, $postfields);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 'DELETE':\n\t\t\tcurl_setopt($ci, CURLOPT_CUSTOMREQUEST, 'DELETE');\n\t\t\tif (!empty($postfields)) {\n\t\t\t\t$url = \"{$url}?{$postfields}\";\n\t\t\t}\n\t\t}\n\n\t\tcurl_setopt($ci, CURLOPT_URL, $url);\n\t\t$response = curl_exec($ci);\n\t\t$this->http_code = curl_getinfo($ci, CURLINFO_HTTP_CODE);\n\t\t$this->last_api_call = $url;\n\t\tcurl_close ($ci);\n\t\treturn $response;\n\t}", "function CallAPI($method, $url, $data = false)\n{\n $curl = curl_init();\n\n switch ($method)\n {\n case \"POST\":\n curl_setopt($curl, CURLOPT_POST, 1);\n\n if ($data)\n curl_setopt($curl, CURLOPT_POSTFIELDS, $data);\n break;\n case \"PUT\":\n curl_setopt($curl, CURLOPT_PUT, 1);\n break;\n default:\n if ($data)\n $url = sprintf(\"%s?%s\", $url, http_build_query($data));\n }\n\n // Optional Authentication:\n curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);\n curl_setopt($curl, CURLOPT_USERPWD, \"username:password\");\n\n curl_setopt($curl, CURLOPT_URL, $url);\n curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);\n\n $result = curl_exec($curl);\n\n curl_close($curl);\n\n// echo \"<pre>\",print_r($result);\n return $result;\n}", "public function execute($data)\n {\n //Initialize the logger\n $this->logger->info($this->httpConfig->getMethod() . ' ' . $this->httpConfig->getUrl());\n\n //Initialize Curl Options\n $ch = curl_init($this->httpConfig->getUrl());\n $options = $this->httpConfig->getCurlOptions();\n if (empty($options[CURLOPT_HTTPHEADER])) {\n unset($options[CURLOPT_HTTPHEADER]);\n }\n curl_setopt_array($ch, $options);\n curl_setopt($ch, CURLOPT_URL, $this->httpConfig->getUrl());\n curl_setopt($ch, CURLOPT_HEADER, false);\n curl_setopt($ch, CURLINFO_HEADER_OUT, true);\n curl_setopt($ch, CURLOPT_HTTPHEADER, $this->getHttpHeaders());\n\n //Determine Curl Options based on Method\n switch ($this->httpConfig->getMethod()) {\n case 'POST':\n curl_setopt($ch, CURLOPT_POST, true);\n curl_setopt($ch, CURLOPT_POSTFIELDS, $data);\n break;\n case 'PUT':\n case 'PATCH':\n case 'DELETE':\n curl_setopt($ch, CURLOPT_POSTFIELDS, $data);\n break;\n }\n\n //Default Option if Method not of given types in switch case\n if ($this->httpConfig->getMethod() != null) {\n curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $this->httpConfig->getMethod());\n }\n\n $this->responseHeaders = [];\n $this->skippedHttpStatusLine = false;\n curl_setopt($ch, CURLOPT_HEADERFUNCTION, [$this, 'parseResponseHeaders']);\n\n //Execute Curl Request\n $result = curl_exec($ch);\n //Retrieve Response Status\n $httpStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE);\n\n //Retry if Certificate Exception\n if (curl_errno($ch) == 60) {\n $this->logger->info(\"Invalid or no certificate authority found - Retrying using bundled CA certs file\");\n curl_setopt($ch, CURLOPT_CAINFO, dirname(__FILE__) . '/cacert.pem');\n $result = curl_exec($ch);\n //Retrieve Response Status\n $httpStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE);\n }\n\n //Throw Exception if Retries and Certificates doenst work\n if (curl_errno($ch)) {\n $ex = new PayPalConnectionException(\n $this->httpConfig->getUrl(),\n curl_error($ch),\n curl_errno($ch)\n );\n curl_close($ch);\n throw $ex;\n }\n\n // Get Request and Response Headers\n $requestHeaders = curl_getinfo($ch, CURLINFO_HEADER_OUT);\n $this->logger->debug(\"Request Headers \\t: \" . str_replace(\"\\r\\n\", \", \", $requestHeaders));\n $this->logger->debug(($data && $data != '' ? \"Request Data\\t\\t: \" . $data : \"No Request Payload\") . \"\\n\" . str_repeat('-', 128) . \"\\n\");\n $this->logger->info(\"Response Status \\t: \" . $httpStatus);\n $this->logger->debug(\"Response Headers\\t: \" . $this->implodeArray($this->responseHeaders));\n\n //Close the curl request\n curl_close($ch);\n\n //More Exceptions based on HttpStatus Code\n if ($httpStatus < 200 || $httpStatus >= 300) {\n $ex = new PayPalConnectionException(\n $this->httpConfig->getUrl(),\n \"Got Http response code $httpStatus when accessing {$this->httpConfig->getUrl()}.\",\n $httpStatus\n );\n $ex->setData($result);\n $this->logger->error(\"Got Http response code $httpStatus when accessing {$this->httpConfig->getUrl()}. \" . $result);\n $this->logger->debug(\"\\n\\n\" . str_repeat('=', 128) . \"\\n\");\n throw $ex;\n }\n\n $this->logger->debug(($result && $result != '' ? \"Response Data \\t: \" . $result : \"No Response Body\") . \"\\n\\n\" . str_repeat('=', 128) . \"\\n\");\n\n //Return result object\n return $result;\n }", "protected function executeCurl(array $options)\n {\n curl_setopt_array($this->curl, $options);\n $result = curl_exec($this->curl);\n self::curlValidate($this->curl, $result);\n\n return $result;\n }", "function _curlRequest( $url, $method, $data = null, $sendAsJSON = true, $auth = true ) {\n\t$curl = curl_init();\n\tif ( $method == 'GET' && $data !== null ) {\n\t\t$url .= '?' . http_build_query( $data );\n\t}\n\tcurl_setopt( $curl, CURLOPT_URL, $url );\n\tif ( $auth ) {\n\t\tcurl_setopt( $curl, CURLOPT_USERPWD, P_SECRET );\n\t}\n\tcurl_setopt( $curl, CURLOPT_CUSTOMREQUEST, $method );\n\tif ( $method == 'POST' && $data !== null ) {\n\t\tif ( $sendAsJSON ) {\n\t\t\t$data = json_encode( $data );\n\t\t\tcurl_setopt( $curl, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'Content-Length: ' . strlen( $data ) ) );\n\t\t}\n\t\tcurl_setopt( $curl, CURLOPT_POSTFIELDS, $data );\n\t}\n\tcurl_setopt( $curl, CURLOPT_RETURNTRANSFER, true );\n\tcurl_setopt( $curl, CURLOPT_HEADER, false );\n\tcurl_setopt( $curl, CURLOPT_SSL_VERIFYPEER, false );\n\tcurl_setopt( $curl, CURLOPT_SSL_VERIFYHOST, false );\n\t$response = curl_exec( $curl );\n\tif ( $response === false ) {\n\t\techo curl_error( $curl );\n\t\tcurl_close( $curl );\n\n\t\treturn false;\n\t}\n\t$httpCode = curl_getinfo( $curl, CURLINFO_HTTP_CODE );\n\tif ( $httpCode >= 400 ) {\n\t\techo curl_error( $curl );\n\t\tcurl_close( $curl );\n\n\t\treturn false;\n\t}\n\tcurl_close( $curl );\n\n\treturn json_decode( $response, true );\n}", "public function exec()\n\t{\n\t\t// Set the header to be processed by the parser and turn off header\n\t\tcurl_setopt($this->connection, CURLOPT_HEADERFUNCTION, array($this, 'parse_header'));\n\t\tcurl_setopt($this->connection, CURLOPT_HEADER, FALSE);\n\n\t\t//Some servers (like Lighttpd) will not process the curl request without this header and will return error code 417 instead.\n\t\t//Apache does not need it, but it is safe to use it there as well.\n\t\tcurl_setopt($this->connection, CURLOPT_HTTPHEADER, array(\"Expect:\"));\n\n\t\tif ($this->config['cache'] AND ($this->cache instanceof Cache))\n\t\t{\n\t\t\t$cached = $this->load_cache();\n\t\t}\n\n\t\tif ( ! $this->executed)\n\t\t{\n\t\t\tif ( ! curl_setopt_array($this->connection, $this->options))\n\t\t\t\tthrow new Kohana_User_Exception('Curl.exec()', 'There was a problem setting the curl_setopt_array');\n\n\t\t\t$this->result = curl_exec($this->connection);\n\n//\t\t\tif (curl_errno($this->connection) !== 0)\n//\t\t\t\tthrow new Kohana_User_Exception('Curl.exec()', curl_error($this->connection));\n\n\t\t\t$this->info = curl_getinfo($this->connection);\n\n\t\t\t$this->executed = TRUE;\n\t\t\t$this->cached_result = FALSE;\n\t\t}\n\n\t\tif ($this->config['cache'] AND ($this->cache instanceof Cache))\n\t\t\t$this->cache();\n\n\t\treturn $this;\n\t}", "function acapi_call($method, $resource, $args, $params = array(), $body = array(), $options = array()) {\n $default_options = array(\n 'display' => TRUE,\n );\n $options = array_merge($default_options, $options);\n\n $debug = drush_get_option('debug', FALSE);\n $verbose = drush_get_option('verbose', FALSE);\n $simulate = drush_get_option('simulate', FALSE);\n $format = acapi_get_option('format');\n\n // Build the API call URL.\n $url = acapi_get_option('endpoint');\n $url .= acapi_dt($resource, $args);\n $url .= '.json';\n\n foreach ($params as $k => $v) {\n if (is_array($v)) {\n unset($params[$k]);\n foreach ($v as $key => $val) {\n $params[\"$k-$key\"] = \"$k%5B%5D=\" . urlencode($val);\n }\n }\n else {\n $params[$k] = \"$k=\" . urlencode($v);\n }\n }\n\n $url .= '?' . implode('&', $params);\n\n $creds = acapi_get_creds();\n if (!$creds) {\n return FALSE;\n }\n\n // Build the body.\n $json_body = json_encode($body);\n\n $display = \"curl -X $method '$url'\";\n if ($debug) {\n $display .= \" ($creds)\";\n }\n if ($debug || $verbose || $simulate) {\n drush_print($display, 0, STDERR);\n if (!empty($body)) {\n drush_print(\" $json_body\", 0, STDERR);\n }\n }\n\n if ($simulate) {\n return;\n }\n\n $headers = array();\n $ch = curl_init($url);\n // Basic request settings\n curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);\n curl_setopt($ch, CURLOPT_USERAGENT, basename(__FILE__));\n if (!empty($options['result_stream'])) {\n curl_setopt($ch, CURLOPT_FILE, $options['result_stream']);\n }\n else {\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);\n }\n // User authentication\n curl_setopt($ch, CURLOPT_HTTPAUTH, TRUE);\n curl_setopt($ch, CURLOPT_USERPWD, $creds);\n // SSL\n curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);\n curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, preg_match('@^https:@', acapi_get_option('endpoint')));\n curl_setopt($ch, CURLOPT_CAINFO, acapi_get_option('cainfo'));\n // Redirects\n if (!empty($options['redirect'])) {\n curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);\n curl_setopt($ch, CURLOPT_MAXREDIRS, $options['redirect']+1);\n }\n /* Body\n We need to set a Content-Length header even on empty POST requests, or the webserver\n will throw a 411 Length Required.\n */\n\n curl_setopt($ch, CURLOPT_POSTFIELDS, $json_body);\n $headers[] = 'Content-Type: application/json;charset=utf-8';\n $headers[] = 'Content-Length: ' . strlen($json_body);\n // Headers\n if (!empty($headers)) {\n curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);\n }\n // Debugging\n curl_setopt($ch, CURLOPT_VERBOSE, $debug);\n // Go\n $content = curl_exec($ch);\n if (curl_errno($ch) > 0) {\n return drush_set_error('ACAPI_CURL_ERROR', dt('Error accessing @url: @err', array('@url' => $url, '@err' => curl_error($ch))));\n }\n\n $result = json_decode($content);\n $status = curl_getinfo($ch, CURLINFO_HTTP_CODE);\n curl_close($ch);\n\n if (!empty($format)) {\n drush_print(drush_format($result, NULL, $format));\n }\n else if ($options['display']) {\n if (is_array($result)) {\n foreach ($result as $item) {\n if (! is_scalar($item)) {\n drush_print_table(drush_key_value_to_array_table(acapi_convert_values($item)));\n }\n else {\n drush_print($item);\n }\n }\n }\n else {\n if ($method == 'POST') {\n // All POST actions return a task. Display something helpful.\n drush_log(dt('Task @taskid started.', array('@taskid' => $result->id)), 'ok');\n }\n else {\n drush_print_table(drush_key_value_to_array_table(acapi_convert_values($result)));\n }\n }\n }\n\n if ($status != 200) {\n return drush_set_error('ACAPI_HTTP_STATUS_' . $status, dt('API status code @status', array('@status' => $status)));\n }\n\n return array($status, $result);\n}", "function curl($url)\n{\n $ch = curl_init();\n curl_setopt($ch, CURLOPT_URL, $url);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n $return = curl_exec($ch);\n curl_close($ch);\n return $return;\n}", "public function _curl_c($url,$postFields=NULL)\n {\n $ch = curl_init($url);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($ch, CURLOPT_HEADER, false);\n\n if ($postFields!==NULL){\n if (is_array($postFields)){\n $postStr = json_encode($postFields);\n curl_setopt($ch,CURLOPT_POSTFIELDS,$postStr);\n }\n if (is_string($postFields)){\n curl_setopt($ch,CURLOPT_POSTFIELDS,$postFields);\n }\n }\n $result = curl_exec($ch);\n \n \n if (curl_errno($ch)){\n \t\n $errNo = curl_errno($ch);\n curl_close($ch);\n return $this->resultStatus(false,curl_strerror($errNo));\n }else{\n \tcurl_close($ch);\n return $this->resultStatus(true,json_decode($result,true));\n }\n }", "function FetchURL($url, $options = array())\n\t{\n\t\t$timeout = 20;\n\t\tif (isset($options['timeout'])) { $timeout = $options['timeout']; }\n\n\t\t$curl_handler = curl_init();\n\n\t\tif (!empty($options['get_fields']))\n\t\t{\n\t\t\t$url_parameters = array();\n\t\t\tforeach($options['get_fields'] as $field => $value)\n\t\t\t{ $url_parameters[] = urlencode($field) . '=' . urlencode($value); }\n\n\t\t\t$url .= '?' . join('&', $url_parameters);\n\t\t}\n\n\t\tcurl_setopt($curl_handler, CURLOPT_URL, $url);\n\t\tcurl_setopt($curl_handler, CURLOPT_RETURNTRANSFER, 1);\n\t\tcurl_setopt($curl_handler, CURLOPT_CONNECTTIMEOUT, $timeout);\n\t\t//curl_setopt($curl_handler, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);\n\n\t\tif (!empty($options['post_array']))\n\t\t{\n\t\t\tcurl_setopt($curl_handler, CURLOPT_POST, 1);\n\t\t\tcurl_setopt($curl_handler, CURLOPT_POSTFIELDS, $options['post_array']);\n\t\t}\n\n\t\tif (!empty($options['auth_string']))\n\t\t{\n\t\t\tcurl_setopt($curl_handler, CURLOPT_USERPWD, $auth_string);\n\t\t\tcurl_setopt($curl_handler, CURLOPT_HTTPAUTH, CURLAUTH_ANY);\n\t\t\tcurl_setopt($curl_handler, CURLOPT_SSL_VERIFYPEER, 0);\n\t\t}\n\t\t\n\t\tif (!empty($options['follow']))\n\t\t{\n\t\t\tcurl_setopt($curl_handler, CURLOPT_FOLLOWLOCATION, true);\n\t\t}\n\n\t\tif (!empty($options['headers'])) { curl_setopt($curl_handler, CURLOPT_HTTPHEADER, $headers); }\n\n\t\t$response = curl_exec($curl_handler);\n\t\tself::$status = curl_getinfo($curl_handler, CURLINFO_HTTP_CODE);\n\t\tcurl_close($curl_handler);\n\n\t\treturn $response;\n\t}", "protected function makeRequest()\n {\n $this->buildRequestURL();\n \n $ch = curl_init($this->requestUrl);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n\n $output = curl_exec($ch);\n \n if ($output === false) {\n throw new \\ErrorException(curl_error($ch));\n }\n\n curl_close($ch);\n return $output;\n\n }", "public function curlGetCall( $url ) \n {\n \n try\n {\n $requestTime = date('r');\n #CURL REQUEST PROCESS-START#\n $curl = curl_init();\n curl_setopt($curl, CURLOPT_URL, $url);\n curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);\n $result = curl_exec($curl);\n }\n catch( Exception $e)\n {\n $strResponse = \"\";\n $strErrorCode = $e->getCode();\n $strErrorMessage = $e->getMessage();\n die('Connection Failure with API');\n }\n $responseArr = json_decode($result,true);\n return $responseArr;\n }", "public static function apiRequest($url){\n $handle = curl_init();\n curl_setopt($handle, CURLOPT_URL, $url);\n curl_setopt($handle, CURLOPT_RETURNTRANSFER, $url);\n curl_setopt($handle, CURLOPT_CONNECTTIMEOUT, 5);\n\n $output = curl_exec($handle);\n $status = curl_getinfo($handle,CURLINFO_HTTP_CODE);\n curl_close($handle);\n\n if($status != 200){\n return json_encode(\"RESOURCE NOT FOUND\");\n }\n\n return $output;\n\n }", "public function sendRequest()\n\t{\n\t\tphpCAS::traceBegin();\n\t\t$ch = curl_init($this->url);\n\t\tif(is_null($this->url) || ! $this->url)\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\t\t/**\n\t\t * *******************************************************\n\t\t * Set SSL configuration\n\t\t * *******************************************************\n\t\t */\n\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);\n\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);\n\t\tcurl_setopt($ch, CURLOPT_USERAGENT,'casUA_wa67h28m_alliance');\n\t\tif($this->caCertPath)\n\t\t{\n\t\t\tcurl_setopt($ch, CURLOPT_CAINFO, $this->caCertPath['pem']);\n\t\t\tcurl_setopt($ch, CURLOPT_SSLCERT, $this->caCertPath['crt']);\n\t\t\tcurl_setopt($ch, CURLOPT_SSLKEY, $this->caCertPath['key']);\n\t\t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n\t\t\tphpCAS::trace('CURL: Set CURLOPT_CAINFO');\n\t\t}\n\t\t\n\t\t// return the CURL output into a variable\n\t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n\t\t/**\n\t\t * *******************************************************\n\t\t * Perform the query\n\t\t * *******************************************************\n\t\t */\n\t\t$buf = curl_exec($ch);\n\t\tif($buf === false)\n\t\t{\n\t\t\tphpCAS::trace('curl_exec() failed');\n\t\t\t$this->storeErrorMessage('CURL error #' . curl_errno($ch) . ': ' . curl_error($ch));\n\t\t\t$res = false;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->storeResponseBody($buf);\n\t\t\tphpCAS::trace(\"Response Body: \\n\" . $buf . \"\\n\");\n\t\t\t$res = true;\n\t\t}\n\t\t// close the CURL session\n\t\tcurl_close($ch);\n\t\t\n\t\tphpCAS::traceEnd($res);\n\t\treturn $res;\n\t}", "public function make_request() {\n $curl = curl_init();\n\n // Setting our options.\n $options = [\n CURLOPT_URL => $this->get_request_url(),\n CURLOPT_ENCODING => \"gzip\",\n CURLOPT_RETURNTRANSFER => true\n ];\n \n // Setting our extra options - please see top of class for info.\n if(SELF::DEBUG){ $options[CURLOPT_VERBOSE] = true; }\n if(!SELF::SECURE) { $options[CURLOPT_SSL_VERIFYPEER] = false; }\n\n curl_setopt_array($curl, $options);\n\n $this->results = curl_exec($curl);\n\n // https://www.php.net/manual/en/function.curl-errno.php\n if(curl_errno($curl)) {\n throw new \\Exception('Issue occurred with CURL request to server: ' . curl_errno($curl));\n }\n\n // If in debug mode print out the results of our request.\n if(SELF::DEBUG){\n echo '<pre>'.print_r(curl_getinfo($curl),1).'</pre>';\n }\n\n curl_close($curl);\n\n return $this->results;\n }", "function curlRequest() \n {\n\t\t$ch=curl_init();\n\t\tcurl_setopt($ch, CURLOPT_URL, $this->URL);\n\t\tcurl_setopt($ch, CURLOPT_TIMEOUT, 180);\n\t\tcurl_setopt($ch, CURLOPT_HEADER, 0);\n\t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n\t\tcurl_setopt($ch, CURLOPT_POST, 1);\n\t\tcurl_setopt($ch, CURLOPT_POSTFIELDS, $this->XMLRequest);\n\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);\n\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);\n\t\tcurl_setopt($ch, CURLOPT_SSLVERSION, 3);\n\t\tcurl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);\n\t\t$httpHeader = array(\"Content-Type: text/xml; charset=UTF-8\", \"Content-Encoding: UTF-8\");\n\t\tcurl_setopt($ch, CURLOPT_HTTPHEADER, $httpHeader);\n\t\t// Execute request, store response and HTTP response code\n\t\t$data=curl_exec($ch);\n\t\t$this->errno = curl_getinfo( $ch, CURLINFO_HTTP_CODE );\n\t\tcurl_close($ch);\n\t\treturn($data);\n\t}", "function airtableCallByCurl($url, $headers) {\n\n $ch = curl_init();\n curl_setopt($ch, CURLOPT_HTTPGET, 1);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($ch, CURLOPT_TIMEOUT, 10);\n curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);\n curl_setopt($ch, CURLOPT_URL, $url);\n $entries = curl_exec($ch);\n curl_close($ch);\n $airtableResponse = json_decode($entries, TRUE);\n\n return $airtableResponse;\n}", "function get_rest_api($api_url = '')\n{\n try {\n // url\n $url = $api_url;\n\n // init\n $curl = curl_init();\n // execute rest\n curl_setopt($curl, CURLOPT_URL, $url);\n curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);\n \n // save data \n $response = curl_exec($curl); \n\n // close connection\n curl_close($curl);\n\n return $response;\n\n } catch (\\Throwable $th) {\n //throw $th;\n }\n}", "function api_test_curl()\r\n\t{\r\n\t\techo \"true\";\r\n\t}", "private function curl($url,$data){\n $ch = curl_init();\n curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);\n curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);\n curl_setopt($ch, CURLOPT_URL, $url);\n curl_setopt($ch, CURLOPT_POST, 1);\n\n curl_setopt($ch, CURLOPT_POSTFIELDS,\n http_build_query($data));\n\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n\n $server_output = curl_exec($ch);\n if($server_output===false){\n $error = curl_error($ch);\n $this->log_middle(\"curl false:\" . $error);\n }\n curl_close($ch);\n\n return $server_output;\n\n }", "public function exec() {\n $this->response = curl_exec($this->ch);\n return $this;\n }", "function do_curl($url, $data_arr=NULL, $tierionHeaderArray=[])\n{\n\t$ch = curl_init($url);\n\n\t$headers = $tierionHeaderArray;\n\t// curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C)');\n\tcurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);\n\tcurl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);\n\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n\tcurl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);\n\n\tif ($data_arr != NULL) {\n\t\t$headers = array_merge(array('Content-Type: application/json'), $headers);\n\t\t$data_string = json_encode($data_arr);\n\t\tcurl_setopt($ch, CURLOPT_POST, 1);\n\t\tcurl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);\n\t}\n\tcurl_setopt($ch, CURLOPT_HTTPHEADER, $headers);\n\n\tob_start(); // prevent any output\n\treturn curl_exec($ch); // Execute the Curl Command\n\tob_end_clean(); // stop preventing output\n\tcurl_close($ch);\n}", "private function execute($action, array $options = []) {\n if (!$this->baseUrl) {\n $this->logger->error('No CKAN url found.');\n return FALSE;\n }\n\n try {\n $options = array_merge_recursive($options, [\n 'headers' => [\n 'Accept' => 'application/json',\n ],\n 'timeout' => 5,\n ]);\n $url = $this->baseUrl . $action;\n\n $response = json_decode($this->client->get($url, $options)->getBody(), FALSE);\n }\n catch (\\Exception $e) {\n if ($errorResponse = $e->getResponse()) {\n if ($errorResponse->getStatusCode() === 404) {\n $this->logger->warning($e->getMessage());\n }\n else {\n $result = json_decode($errorResponse->getBody()->getContents(), FALSE);\n if (isset($result->error)) {\n $error = (array) $result->error;\n unset($error['__type']);\n $this->logger->error(json_encode($error));\n }\n }\n }\n else {\n $this->logger->error($e->getMessage());\n }\n return FALSE;\n }\n\n // Check if the call was successful according to CKAN.\n if (isset($response->success, $response->result) && $response->success) {\n return $response->result;\n }\n\n if (isset($response->error)) {\n $error = (array) $response->error;\n unset($error['__type']);\n $this->logger->error(json_encode($error));\n }\n\n return FALSE;\n }", "public function send()\n {\n return curl_exec($this->curl);\n }", "public function callApi(\n string $url,\n string $apiKey,\n array $payload = [],\n string $method = HttpClientInterface::METHOD_POST,\n string $filename = null) : string\n {\n $curl = curl_init($url);\n\n $headers = ['Authorization: DeepL-Auth-Key '.$apiKey];\n\n // If a filename is provided, send the file\n if ($filename) {\n $payload['file'] = curl_file_create($filename);\n curl_setopt($curl, CURLOPT_POST, true);\n\n $headers[] = 'Content-Type: multipart/form-data';\n }\n\n curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);\n curl_setopt($curl, CURLOPT_POSTFIELDS, $filename ? $payload : http_build_query($payload));\n curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, $this->sslVerifyPeer);\n\n // Set up proxy\n if ($this->proxyIp) {\n curl_setopt($curl, CURLOPT_PROXY, $this->proxyIp);\n if ($this->proxyCredentials) {\n curl_setopt($curl, CURLOPT_PROXYUSERPWD, $this->proxyCredentials);\n }\n }\n\n // Set API key via header\n curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);\n\n // Log cURL request to a logfile\n if ($this->logging) {\n $logfileName = $this->logFilename ?? __DIR__.'/'.self::DEFAULT_LOGFILE_NAME;\n $logfile = fopen($logfileName, 'w');\n curl_setopt($curl, CURLOPT_VERBOSE, 1);\n curl_setopt($curl, CURLOPT_STDERR, $logfile);\n }\n\n $rawResponseData = curl_exec($curl);\n\n $this->handleError($curl, $rawResponseData);\n\n // Close files\n curl_close($curl);\n if ($this->logging) {\n fclose($logfile);\n }\n\n return $rawResponseData;\n }", "function doGet($url)\n{\n $return = curlExecute($url);\n return $return;\n}", "public function getResultByCurlRequest($url) {\n//\t\terror_log(\"API Call: '\".$url.\"'\");\n\t\t$ch = curl_init();\n\t\tcurl_setopt($ch, CURLOPT_URL, $url);\n\t\tcurl_setopt($ch, CURLOPT_HEADER, 0);\n\t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n\t\t$result = curl_exec($ch);\n\t\tcurl_close($ch);\n//\t\terror_log(\"JSON: $result\");\n\t\treturn $result;\n\t}", "private static function execCurl($full_url, $type,\n $headers, $post_data = null) {\n $curl_request = self::getCurlRequestType($type);\n\n if ($post_data !== null) {\n if ($type !== 'POST') {\n throw new Exception('Cannot post field data with non-POST request!');\n }\n }\n\n $session = curl_init($full_url);\n curl_setopt($session, CURLOPT_SSL_VERIFYPEER, true);\n curl_setopt($session, CURLOPT_SSL_VERIFYHOST, 2);\n curl_setopt($session, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($session, CURLOPT_HTTPHEADER, $headers);\n curl_setopt($session, $curl_request, true);\n if ($post_data !== null) {\n curl_setopt($session, CURLOPT_POSTFIELDS, $post_data);\n }\n\n // Do it\n $server_output = curl_exec($session);\n curl_close($session);\n\n if ($server_output === false) {\n throw new Exception(\"Couldn't make cURL request!\");\n }\n\n return $server_output;\n }", "function curlGet($url){\n $ch = curl_init();\n\n //setting curl options\n curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);\n curl_setopt($ch, CURLOPT_URL, $url);\n /*\n Additional curl_setopt\n CURLOPT_USERAGENT \n CURLOPT_HTTPHEADER\n */\n $result = curl_exec($ch);\n \n //$httpResponse = curl_getinfo($ch,CURLINFO_HTTP_CODE);\n //echo $httpResponse;\n\n curl_close($ch);\n return $result;\n }", "function curl_query($curl) {\n $response = curl_exec($curl);\n\n if (!is_string($response)) {\n error('Failed to execute cURL query for ' . spy($curl) . '.');\n }\n\n return $response;\n}", "function http($url, $post_data = null) {\n\t\t$ch = curl_init ();\n\t\tif (defined ( \"CURL_CA_BUNDLE_PATH\" ))\n\t\t\tcurl_setopt ( $ch, CURLOPT_CAINFO, CURL_CA_BUNDLE_PATH );\n\t\tcurl_setopt ( $ch, CURLOPT_URL, $url );\n\t\tcurl_setopt ( $ch, CURLOPT_CONNECTTIMEOUT, 30 );\n\t\tcurl_setopt ( $ch, CURLOPT_TIMEOUT, 30 );\n\t\tcurl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );\n\t\t//////////////////////////////////////////////////\n\t\t///// Set to 1 to verify Hots SSL Cert ///////\n\t\t//////////////////////////////////////////////////\n\t\tcurl_setopt ( $ch, CURLOPT_SSL_VERIFYPEER, 0 );\n\t\tif (isset ( $post_data )) {\n\t\t\tcurl_setopt ( $ch, CURLOPT_POST, 1 );\n\t\t\tcurl_setopt ( $ch, CURLOPT_POSTFIELDS, $post_data );\n\t\t}\n\t\t$response = curl_exec ( $ch );\n\t\t$this->http_status = curl_getinfo ( $ch, CURLINFO_HTTP_CODE );\n\t\t$this->last_api_call = $url;\n\t\tcurl_close ( $ch );\n\t\tif(empty($response)) {\n\t\t\treturn 'WP-API might be down or unresponsive. Please go to http://flocks.biz and check if the main website is working. Send us an email to [email protected] in case you have more doubts.';\n\t\t}\n\t\tif(preg_match(\"/request\\-token/i\",$response) || preg_match(\"/access\\-token/i\",$response)) {\n\t\t\t//echo \"<br/><br/>\".preg_replace(array(\"/.*oauth\\_version\\=1\\.0/i\"),array(\"\"),urldecode($response)).\"<br/><br/>\";\n\t\t\treturn preg_replace(array(\"/.*oauth\\_version\\=1\\.0/i\"),array(\"\"),urldecode($response));\n\t\t} else {\n\t\t\t//echo \"<br/><br/>\".$response.\"<br/><br/>\";\n\t\t\treturn $response;\n\t\t}\n\t}", "function curl($url, $post_fields = null, $return_headers = false)\n {\n global $standard_headers;\n global $cookie;\n\n $ch = curl_init($url);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);\n curl_setopt($ch, CURLOPT_HTTPHEADER, $standard_headers);\n curl_setopt($ch, CURLOPT_COOKIE, $cookie);\n\n if($return_headers == true) {\n curl_setopt($ch, CURLOPT_HEADER, 1);\n }\n\n if(!is_null($post_fields)) {\n curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');\n curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post_fields));\n } else {\n curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');\n }\n\n $response = curl_exec($ch);\n curl_close($ch);\n return $response;\n }", "private function runCurl($url, $postVals = null) {\n\t\t$ch = curl_init ( $url );\n\n\t\t$options = array (\n\t\t\t\tCURLOPT_RETURNTRANSFER => true,\n\t\t\t\tCURLOPT_COOKIE => \"reddit_session={$this->session}\",\n\t\t\t\tCURLOPT_TIMEOUT => 3\n\t\t);\n\t\tcurl_setopt ( $ch, CURLOPT_HTTPHEADER, array (\n\t\t\t\t'User-Agent: Game-of-Bands/v1.4'\n\t\t) );\n\n\t\tif ($postVals != null) {\n\t\t\t$options [CURLOPT_POSTFIELDS] = $postVals;\n\t\t\t$options [CURLOPT_CUSTOMREQUEST] = \"POST\";\n\t\t}\n\n\t\tcurl_setopt_array ( $ch, $options );\n\n\t\t$response = json_decode ( curl_exec ( $ch ) );\n\t\tcurl_close ( $ch );\n\n\t\treturn $response;\n\t}", "function basicCurl($curlURL) {\n $url = $curlURL;\n $cURL = curl_init();\n curl_setopt($cURL, CURLOPT_URL, $url);\n curl_setopt($cURL, CURLOPT_HTTPGET, true);\n curl_setopt($cURL, CURLOPT_HTTPHEADER, array(\n 'Content-Type: application/json',\n 'Accept: application/json'\n ));\n curl_setopt($cURL, CURLOPT_FOLLOWLOCATION, true);\n curl_setopt($cURL, CURLOPT_RETURNTRANSFER, 1);\n curl_setopt($cURL, CURLOPT_USERAGENT, \"spider\");\n $result = curl_exec($cURL);\n \nif ($result === FALSE) {\n return \"cURL Error: \" . curl_error($cURL);\n} else {\n\treturn $result;\n}\n curl_close($cURL);\n \n}", "public static function curlCall($param) {\n $retVal = '';\n $method = ((isset($param['method'])) && ($param['method'] != \"\")) ? strtolower($param['method']) : \"get\";\n $formate = ((isset($param['formate'])) && ($param['formate'] != \"\")) ? strtolower($param['formate']) : \"array\";\n # Init Curl Call #\n $ch = curl_init();\n # Set Options #\n curl_setopt($ch, CURLOPT_URL, $param['url']);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);\n curl_setopt($ch, CURLOPT_TIMEOUT, 300);\n curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);\n if ($method == 'post') {\n curl_setopt($ch, CURLOPT_POST, TRUE);\n curl_setopt($ch, CURLOPT_POSTFIELDS, $param['postData']);\n }\n if(isset($param['headerJson']) && $param['headerJson'] != '') {\n\t\t\tif($param['headerJson']\t==\t'json') {\n\t\t\t\tif(isset($param['auth_token']) && $param['auth_token']!= ''){\n\t\t\t\t\tcurl_setopt($ch, CURLOPT_HTTPHEADER, array( \n\t\t\t\t\t\t'Content-Type: application/json', \n\t\t\t\t\t\t'Content-Length: ' . strlen($param['postData']),\n\t\t\t\t\t\t'HR-API-AUTH-TOKEN:'.$param['auth_token'])); \n\t\t\t\t}else{\n\t\t\t\t\tcurl_setopt($ch, CURLOPT_HTTPHEADER, array( \n\t\t\t\t\t\t'Content-Type: application/json', \n\t\t\t\t\t\t'Content-Length: ' . strlen($param['postData']))); \n\t\t\t\t}\n\t\t\t} else if($param['headerJson']\t==\t'array') {\n\t\t\t\tcurl_setopt($ch, CURLOPT_HTTPHEADER, array(\n\t\t\t\t\t'Content-type: multipart/form-data'\n\t\t\t\t));\n\t\t\t}\n\t\t}\n $retVal = curl_exec($ch);\n curl_close($ch);\n unset($method);\n if ($formate == \"array\") {\n return json_decode($retVal, TRUE);\n } else {\n return $retVal;\n }\n }", "function CallAPI($method, $url, $data = false)\r\n{\r\n $curl = curl_init();\r\n\r\n switch ($method)\r\n {\r\n case \"POST\":\r\n curl_setopt($curl, CURLOPT_POST, 1);\r\n\r\n if ($data)\r\n curl_setopt($curl, CURLOPT_POSTFIELDS, $data);\r\n break;\r\n case \"PUT\":\r\n curl_setopt($curl, CURLOPT_PUT, 1);\r\n break;\r\n default:\r\n if ($data)\r\n $url = sprintf(\"%s?%s\", $url, http_build_query($data));\r\n }\r\n\r\n // Optional Authentication:\r\n curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);\r\n curl_setopt($curl, CURLOPT_USERPWD, \"username:password\");\r\n\r\n curl_setopt($curl, CURLOPT_URL, $url);\r\n curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);\r\n\r\n $result = curl_exec($curl);\r\n\r\n curl_close($curl);\r\n\r\n return $result;\r\n}", "function apiCall ($url, $data) {\n\t$url = \"https://api.cloudns.net/{$url}\";\n\t$data = \"auth-id=\".AUTH_ID.\"&auth-password=\".AUTH_PASS.\"&{$data}\";\n\t\n\t$init = curl_init();\n\tcurl_setopt($init, CURLOPT_RETURNTRANSFER, true);\n\tcurl_setopt($init, CURLOPT_URL, $url);\n\tcurl_setopt($init, CURLOPT_POST, true);\n\tcurl_setopt($init, CURLOPT_POSTFIELDS, $data);\n\tcurl_setopt($init, CURLOPT_USERAGENT, 'cloudns_api_script/0.1 (+https://github.com/ClouDNS/cloudns-api-bulk-updates/tree/master/bulk-records-update)');\n\t\n\t$content = curl_exec($init);\n\t\n\tcurl_close($init);\n\t\n\treturn json_decode($content, true);\n}", "public function call($url, $request = 'GET')\n {\n // Construct the URL\n $url = 'https://www.transifex.com/api/2/project/'.$this->projectSlug.$url;\n\n // Construct the command\n $cmd = 'curl -s -L -X '.$request.' --user '.$this->username.':'.$this->password.' '.$url;\n //echo $cmd.\"\\n\";\n\n // Make the call\n $rs = exec($cmd, $output);\n $output = implode(\"\\n\", $output);\n $json = json_decode($output);\n\n return $json;\n }", "private function exec()\n {\n if (!empty($this->headers)) {\n curl_setopt($this->handler, CURLOPT_HTTPHEADER, $this->headers);\n }\n\n $this->response = curl_exec($this->handler);\n $this->responseCode = curl_getinfo($this->handler, CURLINFO_HTTP_CODE);\n\n curl_close($this->handler);\n\n return $this;\n }", "function fetch_url ($url, $post_options = []) {\n $ch = curl_init($url);\n curl_setopt($ch, CURLOPT_FOLLOWLOCATION\t,0);\n curl_setopt($ch, CURLOPT_HEADER\t\t\t,0); // DO NOT RETURN HTTP HEADERS\n curl_setopt($ch, CURLOPT_RETURNTRANSFER\t,1); // RETURN THE CONTENTS OF THE CALL\n curl_setopt($ch, CURLOPT_HEADER, false);\n curl_setopt($ch, CURLOPT_TIMEOUT, 9);\n curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,false);\n curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);\n curl_setopt($ch, CURLOPT_MAXREDIRS, 3);\n curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 9);\n curl_setopt($ch, CURLOPT_ENCODING, '');\n $response = curl_exec($ch);\n curl_close($ch);\n return $response;\n}", "private function curlExec(&$ch)\n {\n $res = curl_exec($ch);\n if (false === $res) {\n throw new Exception(curl_error($ch), curl_errno($ch));\n }\n return $res;\n }", "function Send($url, $POST){ //работа с CURL'ом\n\t$ch = curl_init();// Устанавливаем соединение\n\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n\tcurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);\n\tcurl_setopt($ch, CURLOPT_POST, 1);\n\tcurl_setopt($ch, CURLOPT_POSTFIELDS, $POST);\n\tcurl_setopt($ch, CURLOPT_TIMEOUT, 10);\n\tcurl_setopt($ch, CURLOPT_URL, $url);\n\n\t$result = curl_exec($ch);\n\n\tif($result === false) print $err = curl_error($ch);\n\n\treturn $result;\n}", "private function perform_request($fields){\r\n curl_setopt($this->ch,CURLOPT_POST,count($fields));\r\n curl_setopt($this->ch,CURLOPT_POSTFIELDS,$fields);\r\n\r\n //execute post\r\n $result = curl_exec($this->ch);\r\n if($result === false){\r\n throw new ApiCurlException(curl_error($this->ch));\r\n }\r\n return $result;\r\n }", "public function Curl($url) {\n\t\t$session = curl_init($url);\n curl_setopt($session, CURLOPT_HEADER, false);\n curl_setopt($session, CURLOPT_RETURNTRANSFER, true);\n $json = curl_exec($session);\n curl_close($session);\n\t\t\n\t\t$data = json_decode($json);\n\t\treturn $data;\n\t}" ]
[ "0.72677535", "0.723068", "0.7193403", "0.7193403", "0.7096205", "0.70845675", "0.7052806", "0.687872", "0.68333244", "0.6783016", "0.67781395", "0.6773794", "0.675209", "0.67475617", "0.67200893", "0.67084616", "0.6686995", "0.6652942", "0.66395193", "0.66252357", "0.6564008", "0.65426064", "0.6537116", "0.6534601", "0.65302217", "0.65216905", "0.6500413", "0.648952", "0.6476972", "0.6471653", "0.64669794", "0.6441449", "0.64322555", "0.6432034", "0.6424916", "0.6424572", "0.64105266", "0.6392003", "0.6389431", "0.6380894", "0.6361121", "0.6331159", "0.63213533", "0.6300867", "0.6300767", "0.62974674", "0.6296328", "0.62903386", "0.628442", "0.6265923", "0.6262852", "0.62469506", "0.624427", "0.6234419", "0.6224529", "0.62204695", "0.6217159", "0.6214082", "0.6199175", "0.61989623", "0.6187538", "0.6183209", "0.6179425", "0.61682576", "0.6148695", "0.6138621", "0.61382353", "0.61346996", "0.6131849", "0.6111518", "0.6110939", "0.6099858", "0.6098766", "0.6081093", "0.60718006", "0.6069731", "0.606865", "0.6067001", "0.60666084", "0.60644126", "0.6062487", "0.6061447", "0.60569036", "0.60543346", "0.60533124", "0.6038762", "0.6022726", "0.60195243", "0.6019018", "0.601871", "0.6015454", "0.6014851", "0.60133266", "0.60117126", "0.60054207", "0.59970903", "0.59885436", "0.5987016", "0.59836465", "0.59799874", "0.59787714" ]
0.0
-1
Sets curl property and its settings.
private function setCurl($is_https = false) { // Init $this->curl = curl_init(); // Sets basic parameters curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($this->curl, CURLOPT_TIMEOUT, isset($this->request->settings['timeout']) ? $this->request->settings['timeout'] : 100); // Set parameters to maintain cookies across sessions curl_setopt($this->curl, CURLOPT_COOKIESESSION, true); curl_setopt($this->curl, CURLOPT_COOKIEFILE, sys_get_temp_dir() . '/cookies_file'); curl_setopt($this->curl, CURLOPT_COOKIEJAR, sys_get_temp_dir() . '/cookies_file'); curl_setopt($this->curl, CURLOPT_USERAGENT, 'OLEGNAX-PURCHASE-VERIFY'); if ($is_https) { $this->setSSL(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function configureCurl ()\n {\n curl_setopt_array($this->cURL, [\n CURLOPT_URL => $this->url,\n CURLOPT_RETURNTRANSFER => true\n ]);\n }", "protected function _setCurlOpts() {\n $this->_setCurlOptArray($this->_getCurlOpts());\n }", "private function initCurl()\n {\n $this->curlObj = curl_init();\n curl_setopt_array($this->curlObj, array(\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_POST => true,\n CURLOPT_FORBID_REUSE => true,\n CURLOPT_HEADER => false,\n CURLOPT_TIMEOUT => 120,\n CURLOPT_CONNECTTIMEOUT => 2,\n CURLOPT_HTTPHEADER => [\"Connection: Keep-Alive\", \"Keep-Alive: 120\"]\n ));\n }", "private function setUpCurl()\n {\n $this->curl = $this->get('app.curl.connector');\n $this->curl->setEndPointBaseUrl($this->getParameter('themoviedb_endpoint_url'));\n $this->curl->setExtraHeaders([\n CURLOPT_HEADER => false,\n CURLOPT_HTTPHEADER => [\"Accept: application/json\"],\n CURLOPT_SSL_VERIFYPEER => false\n ]);\n }", "public function setupOption($k, $v){\n if($this->isCurlSet()){\n curl_setopt($this->curl, $k, $v);\n } else {\n throw new SdkException(\"cURL instance is not set when calling setup Option.\");\n }\n }", "public function setCurl(Curl $curl)\n {\n $this->curl = $curl;\n\n return $this;\n }", "public function setCurlOption($option, $value){\n\t\tcurl_setopt($this->_curl, $option,$value);\n\t}", "private function init() {\n $this->_cm = curl_init();\n curl_setopt($this->_cm, CURLOPT_PROXY, $config['curl']['proxy']);\n curl_setopt($this->_cm, CURLOPT_HTTPAUTH, CURLAUTH_BASIC | CURLAUTH_DIGEST);\n curl_setopt($this->_cm, CURLOPT_SSL_VERIFYPEER, FALSE);\n curl_setopt($this->_cm, CURLOPT_SSL_VERIFYHOST, FALSE);\n curl_setopt($this->_cm, CURLOPT_RETURNTRANSFER, TRUE);\n curl_setopt($this->_cm, CURLOPT_TIMEOUT, $config['curl']['timeout']);\n curl_setopt($this->_cm, CURLOPT_POST, true); \n }", "public function setUrl($url) {\n return curl_setopt($this->ch,CURLOPT_URL,$url);\n }", "public function set_curl_options(array $curl_options = array())\n {\n }", "private function initCurl()\n\t{\n\t\t$this->_curl = curl_init();\n\t\t//TODO: delete useless lines\n\t\tcurl_setopt ($this->_curl, CURLOPT_SSL_VERIFYPEER, FALSE);\n\t\tcurl_setopt ($this->_curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);\n\t\tcurl_setopt ($this->_curl, CURLOPT_TIMEOUT, 4000);\n\t\tcurl_setopt ($this->_curl, CURLOPT_FOLLOWLOCATION, 1);\n\t\tcurl_setopt ($this->_curl, CURLOPT_RETURNTRANSFER, 1);\n\t\tcurl_setopt ($this->_curl, CURLOPT_COOKIEJAR, self::$_COOKIE);\n\t\tcurl_setopt ($this->_curl, CURLOPT_COOKIEFILE, self::$_COOKIE);\n\t\tcurl_setopt ($this->_curl, CURLOPT_POST, 1);\n\t}", "private function setUrl()\n {\n curl_setopt($this->curl, CURLOPT_URL, $this->server);\n }", "private function init()\n {\n $this->curl = curl_init();\n }", "public function init()\n {\n $this->curl = curl_init();\n }", "protected function setOptions($curl)\n {\n if(!curl_setopt($curl, CURLOPT_POST, $this->options->post))\n {\n throw new Exception('Could not set option [post]');\n }\n \n if(!curl_setopt($curl, CURLOPT_HEADER, $this->options->header))\n {\n throw new Exception('Could not set option [header]');\n }\n \n if(!curl_setopt($curl, CURLOPT_RETURNTRANSFER, $this->options->returnTransfer))\n {\n throw new Exception('Could not set option [return transfer]');\n }\n }", "private function setURL($url)\r\n\t{\r\n\t\tcurl_setopt($this->getConnection(), CURLOPT_URL, $url);\r\n\t}", "protected function transferDeprecatedCurlSettings() {}", "protected function init()\n {\n $this->curl = curl_init();\n curl_setopt($this->curl, CURLOPT_SSL_VERIFYHOST, 2);\n curl_setopt($this->curl, CURLOPT_SSL_VERIFYPEER, FALSE);\n // this line makes it work under https\n curl_setopt($this->curl, CURLOPT_USERAGENT, $this->user_agent);\n curl_setopt($this->curl, CURLOPT_TIMEOUT, $this->timeout);\n curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, 1);\n curl_setopt($this->curl, CURLOPT_FOLLOWLOCATION, 1);\n curl_setopt($this->curl, CURLOPT_COOKIEJAR, $this->cookiejar);\n curl_setopt($this->curl, CURLOPT_COOKIEFILE, $this->cookiejar);\n curl_setopt($this->curl, CURLOPT_REFERER, $this->referer);\n if (isset($this->encoding)) {\n curl_setopt($this->curl, CURLOPT_ENCODING, $this->encoding);\n }\n if ($this->omitSSLVerification) {\n curl_setopt($this->curl, CURLOPT_SSL_VERIFYHOST, false);\n curl_setopt($this->curl, CURLOPT_SSL_VERIFYPEER, false);\n }\n if (isset($this->userAuthData)) {\n curl_setopt($this->curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);\n curl_setopt($this->curl, CURLOPT_USERPWD, $this->userAuthData);\n }\n if ($this->proxy != '') {\n curl_setopt($this->curl, CURLOPT_PROXY, $this->proxy);\n if ($this->proxyType == self::PROXY_TYPE_SOCKS4) {\n curl_setopt($this->curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4);\n } else if ($this->proxyType == self::PROXY_TYPE_SOCKS5) {\n curl_setopt($this->curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);\n }\n }\n $this->errorno = false;\n $this->error = false;\n }", "public function curlInit() {\n parent::curlInit();\n curl_setopt($this->curl, CURLOPT_HEADER, true);\n curl_setopt($this->curl, CURLOPT_ACCEPT_ENCODING, 'identity');\n }", "protected static function configure($curl) {\n\t\t\tcurl_setopt($curl, CURLOPT_RETURNTRANSFER, true);\t\t\t\t//We want the data returned as a variable\n\t\t\tcurl_setopt($curl, CURLOPT_TIMEOUT, 10);\t\t\t\t\t\t//Maximum wait before timeout\n\t\t\tself::authenticate($curl);\t\t\t\t\t\t\t\t\t//Authenticate our socket\n return $curl;\n\t\t}", "protected function setCurlOptions($option, $value)\n {\n curl_setopt($this->request, $option, $value);\n }", "public function setupCurl()\n {\n $ch = curl_init();\n curl_setopt($ch,CURLOPT_URL,\"https://jsonplaceholder.typicode.com/posts\");\n curl_setopt($ch, CURLOPT_HEADER, 0);\n curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);\n\n return $ch;\n }", "private function curl_setopts($curl_handle, $config, $service) {\n curl_setopt($curl_handle, CURLOPT_URL, str_replace('%s', $this->url, $config[$service]['url']));\n $timeout = isset($this->options['timeout']) ? $this->options['timeout'] : 6;\n\n // other necessary settings:\n // CURLOPT_HEADER means include header in output, which we do not want\n // CURLOPT_RETURNTRANSER means return output as string or not\n curl_setopt_array($curl_handle, array(\n CURLOPT_HEADER => 0,\n CURLOPT_RETURNTRANSFER => 1,\n CURLOPT_TIMEOUT => $timeout,\n CURLOPT_SSL_VERIFYPEER => false,\n CURLOPT_SSL_VERIFYHOST => false,\n ));\n\n // set the http method: default is GET\n if($config[$service]['method'] === 'POST') {\n curl_setopt($curl_handle, CURLOPT_POST, 1);\n }\n\n // set the body and headers\n $headers = isset($config[$service]['headers']) ? $config[$service]['headers'] : array();\n $body = isset($config[$service]['body']) ? $config[$service]['body'] : NULL;\n\n if(isset($body)) {\n if(isset($headers['Content-Type']) && $headers['Content-Type'] === 'application/json') {\n $data_string = json_encode($body);\n\n curl_setopt($curl_handle, CURLOPT_HTTPHEADER, array(\n 'Content-Type: application/json',\n 'Content-Length: ' . strlen($data_string))\n );\n\n curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $data_string);\n }\n }\n\n // set the useragent\n $useragent = isset($config[$service]['User-Agent']) ? $config[$service]['User-Agent'] : 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0';\n curl_setopt($curl_handle, CURLOPT_USERAGENT, $useragent);\n }", "public function init()\n {\n $this->curl = (new Curl())->setOption(\n CURLOPT_HTTPHEADER, [\n 'Authorization: Basic ' . $this->apiKey,\n 'Content-Type: application/json'\n ]\n );\n }", "public function init(): void{\n $this->handler = curl_init();\n }", "public function setopt($key, $value){\n curl_setopt($this->ch, $key, $value);\n }", "public function initCurlHandler()\r\n {\r\n $this->curlHandler = curl_init();\r\n }", "protected function setCurlConstants(): void\n {\n $constants = [\n 'CURLOPT_SSLVERSION' => 32,\n 'CURL_SSLVERSION_TLSv1_2' => 6,\n 'CURLOPT_SSL_VERIFYPEER' => 64,\n 'CURLOPT_SSLCERT' => 10025,\n ];\n\n foreach ($constants as $key => $value) {\n if (!defined($key)) {\n define($key, $constants[$key]);\n }\n }\n }", "public function __construct()\n\t{\n\t\t$this->curl = curl_init();\n\t}", "private function setCurlOptions(&$ch, $headers = array())\n {\n curl_setopt($ch, CURLOPT_USERPWD, $this->authentication);\n curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($ch, CURLOPT_HEADER, false);\n curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);\n curl_setopt($ch, CURLOPT_BUFFERSIZE, 4096);\n curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 25);\n curl_setopt($ch, CURLOPT_TIMEOUT, 30);\n }", "private function initCurlHandle()\n {\n $this->closeCurlHandle();\n $this->curlHandle = \\curl_init();\n }", "public function setOpt($key, $value)\n {\n curl_setopt($this->curl, $key, $value);\n }", "protected function init()\n {\n // To start with, disable FOLLOWLOCATION since we'll handle it\n curl_setopt($this->curlHandle, \\CURLOPT_FOLLOWLOCATION, false);\n\n // Always return the transfer\n curl_setopt($this->curlHandle, \\CURLOPT_RETURNTRANSFER, true);\n\n // Force IPv4, since this class isn't yet comptible with IPv6\n $curlVersion = curl_version();\n\n if ($curlVersion['features'] & \\CURLOPT_IPRESOLVE) {\n curl_setopt($this->curlHandle, \\CURLOPT_IPRESOLVE, \\CURL_IPRESOLVE_V4);\n }\n }", "public function setopt($key, $value)\n {\n curl_setopt($this->curl, $key, $value);\n }", "private function setOptions(CurlHandle $curlHandle): void\n {\n foreach ($this->options as $optionName => $optionValue) {\n curl_setopt($curlHandle, $optionName, $optionValue);\n }\n }", "public function setCurlOptions($option, $curlArray = [])\n {\n $this->curlOptions[$option] = $curlArray;\n }", "public function initialize()\n {\n curl_setopt($this->ch, CURLOPT_AUTOREFERER, TRUE);\n curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, TRUE);\n curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);\n curl_setopt($this->ch, CURLOPT_MAXREDIRS, 5);\n curl_setopt($this->ch, CURLOPT_USERAGENT, self::$USER_AGENT); \n // curl_setopt($this->ch, CURLOPT_COOKIEFILE, '/tmp/curl_client');\n // curl_setopt($this->ch, CURLOPT_COOKIEJAR, '/tmp/curl_client');\n // curl_setopt($this->ch, CURLOPT_HEADER, TRUE);\n return $this;\n }", "function set_property(){\n }", "private function setopt($url, $referer)\n {\n // Set request URL\n curl_setopt($this->handle, CURLOPT_URL, $url);\n\n // Remove any current HTTP headers\n curl_setopt($this->handle, CURLOPT_HEADER, 0);\n\n // Follow redirects, or not\n if ($this->redirs)\n {\n curl_setopt($this->handle, CURLOPT_FOLLOWLOCATION, 1);\n curl_setopt($this->handle, CURLOPT_MAXREDIRS, 10);\n }\n else\n {\n curl_setopt($this->handle, CURLOPT_FOLLOWLOCATION, 0);\n curl_setopt($this->handle, CURLOPT_MAXREDIRS, 0);\n }\n\n // Return data from transfer\n curl_setopt($this->handle, CURLOPT_RETURNTRANSFER, 1);\n\n // Set UserAgent string\n curl_setopt($this->handle, CURLOPT_USERAGENT, $this->useragent);\n\n // If it's a HTTPS (SSL) URL, disable verification\n if (substr($url, 4, 1) == 's')\n {\n curl_setopt($this->handle, CURLOPT_SSL_VERIFYPEER, false);\n curl_setopt($this->handle, CURLOPT_SSL_VERIFYHOST, false);\n }\n\n // Set cookie jar\n if ($this->cookies)\n {\n curl_setopt($this->handle, CURLOPT_COOKIEJAR, $this->cookiejar);\n curl_setopt($this->handle, CURLOPT_COOKIEFILE, $this->cookiejar);\n }\n\n // If a proxy is set, use it\n if ($this->proxy != '')\n {\n curl_setopt($this->handle, CURLOPT_PROXY, $this->proxy);\n\n if ($this->proxypwd != '')\n {\n curl_setopt($this->handle, CURLOPT_PROXYUSERPWD, $this->proxypwd);\n }\n }\n\n // Set referrer if one is specified\n if ($referer != '')\n {\n curl_setopt($this->handle, CURLOPT_REFERER, $referer);\n }\n\n // XHR\n if ($this->xhr == true)\n {\n curl_setopt($this->handle, CURLOPT_HTTPHEADER, array(\"X-Requested-With: XMLHttpRequest\"));\n }\n }", "function __construct() {\n\n $this->curl = curl_init();\n\n curl_setopt_array($this->curl, [\n CURLOPT_USERAGENT => 'FeedImport',\n CURLOPT_TIMEOUT => 120,\n CURLOPT_CONNECTTIMEOUT => 30,\n CURLOPT_RETURNTRANSFER => TRUE,\n CURLOPT_ENCODING => 'UTF-8'\n ]);\n\n }", "public function setCurlOptions(array $options)\n {\n $this->curl_options = $options;\n\n // We need to reinitialize the SOAP client.\n $this->soap = null;\n }", "public function setUrl($pUrl)\n\t{\n\t\t$this->url = $pUrl;\n\t\tcurl_setopt($this->curlRessource, CURLOPT_URL, $pUrl);\n\t}", "public function __construct(){\n $this->connection = curl_init();\n }", "private function registerCurl()\n {\n // Curl options\n $curlOptions = [\n [CURLOPT_RETURNTRANSFER, true],\n [CURLOPT_FOLLOWLOCATION, true],\n [CURLOPT_MAXREDIRS, 2],\n [CURLOPT_HTTPAUTH, CURLAUTH_BASIC],\n [CURLOPT_SSLVERSION, 6],\n [CURLOPT_SSL_VERIFYPEER, false],\n [CURLOPT_SSL_VERIFYHOST, false],\n ];\n\n // Register service via dependency injection\n $service = $this->services->register('crawler', '%crawler.class%');\n\n // Set options via setopt\n array_walk(\n $curlOptions,\n function (array $params) use ($service) {\n $service->addMethodCall('setopt', $params);\n }\n );\n\n $this->services->setParameter('crawler.class', 'Curl\\Curl');\n }", "public function setOption($key,$value) {\n if($key == CURLOPT_HTTPHEADER)\n return setHeader($value);\n else\n return curl_setopt($this->ch,$key,$value);\n }", "public function useCurl($useCurl)\n {\n $this->request->useCurl($useCurl);\n }", "private function setCurlUse(bool $bool){\n\t\t$this->curluse = $bool;\n\t}", "public function __construct($url)\n {\n $this->curl = curl_init($url);\n }", "public function setOption($name, $value)\n {\n curl_setopt($this->_handle, $name, $value);\n }", "public function __construct()\n {\n $this->ch = curl_init();\n $this->initialize();\n }", "public function __construct() {\n $this->_handle = curl_init();\n $this->_opt(CURLOPT_HEADER, false);\n $this->_opt(CURLOPT_RETURNTRANSFER, true);\n }", "private function _opt($opt, $value) {\n curl_setopt($this->_handle, $opt, $value);\n }", "public function setCurlOption(int $option, $value): void\n {\n // Headers must be handled serperatly\n if (CURLOPT_HTTPHEADER === $option) {\n // $value must be an array. setHttpHeaders() will enforce this.\n $this->setHttpHeaders($value);\n\n return;\n }\n\n $this->curlOptions[$option] = $value;\n }", "private function setProxyURL($purl){\n\t\t$this->proxy_url = $purl;\n\t\tif(isset($this->proxy_url)) $this->setCurlUse(true);\n\t}", "public function init($url)\n {\n $this->closeCurlHandle();\n $this->curlHandle = curl_init($url);\n }", "public function __construct()\n {\n $this->curl = curl_init();\n\n curl_setopt_array(\n $this->curl,\n array(\n CURLOPT_FOLLOWLOCATION => true,\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_TIMEOUT => 60,\n CURLOPT_CONNECTTIMEOUT => 10,\n CURLOPT_VERBOSE => true,\n CURLOPT_HEADERFUNCTION => array($this, 'header'),\n CURLOPT_ENCODING => 'gzip,deflate',\n CURLOPT_USERAGENT => 'doi-index/0.1 (+http://goo.gl/AejefJ)',\n CURLOPT_COOKIEFILE => '/tmp/cookies.txt',\n CURLOPT_COOKIEJAR => '/tmp/cookies.txt',\n )\n );\n }", "function __construct() { \n if(!extension_loaded('curl'))\n exit('Fatal error:The system does not extend php_curl.dll.');\n $this-> ch = curl_init();\n $this-> reset();\n }", "public function setURL($url)\n {\n $this->url = $url;\n }", "function setUrl($url) {\n\t\t$this->_url = $url;\n\t}", "function setUrl($url) {\n\t\t$this->_url = $url;\n\t}", "public function setCurlOptions(array $curlOptions, bool $erase = false)\n {\n if (!$erase) {\n $curlOptions = array_replace($this->curlOptions, $curlOptions);\n }\n\n // Remove reserved CURL options\n $reservedOptions = [CURLOPT_HTTP_VERSION,\n CURLOPT_CUSTOMREQUEST,\n CURLOPT_URL,\n CURLOPT_HEADER,\n CURLINFO_HEADER_OUT,\n CURLOPT_HTTPHEADER,\n CURLOPT_RETURNTRANSFER,\n CURLOPT_POST,\n CURLOPT_POSTFIELDS];\n if (defined('CURLOPT_FOLLOWLOCATION')) {\n $reservedOptions[] = CURLOPT_FOLLOWLOCATION;\n }\n\n foreach ($reservedOptions as $reservedOption) {\n unset($curlOptions[$reservedOption]);\n }\n\n $this->curlOptions = $curlOptions;\n }", "function curl_option(&$curl, $option, $value) {\n return curl_options($curl, [$option => $value]);\n}", "private function setSSL()\n {\n curl_setopt($this->curl, CURLOPT_SSL_VERIFYHOST, 0);\n curl_setopt($this->curl, CURLOPT_SSL_VERIFYPEER, 0);\n curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, 1);\n }", "public function init()\n {\n $this->_session = curl_init();\n }", "private function initCurl() {\n\t\tif( $this->valid() ) {\n\t\t\t$this->ch = curl_init();\n\t\t\tcurl_setopt( $this->ch, CURLOPT_URL, \t\t\t\t$this->config['postUrl'] );\n\t\t\tcurl_setopt( $this->ch, CURLOPT_RETURNTRANSFER, \tTRUE);\n\t\t\tcurl_setopt( $this->ch, CURLOPT_FOLLOWLOCATION, \tTRUE);\n\t\t\tcurl_setopt( $this->ch, CURLOPT_TIMEOUT, \t\t\t10);\n\t\t\tcurl_setopt( $this->ch, CURLOPT_HEADER, \t\t\tFALSE ); \n\t\t\tcurl_setopt( $this->ch, CURLOPT_POST, \t\t\t\tcount( $this->getFieldsAsString() ) );\n\t\t\tcurl_setopt( $this->ch, CURLOPT_POSTFIELDS, \t\t$this->getFieldsAsString() ); \n\t\t\tcurl_setopt( $this->ch, CURLOPT_REFERER, \t\t\t$this->config['referrerUrl'] );\n\t\t\tcurl_setopt( $this->ch, CURLOPT_USERAGENT, \t\t\t$this->config['userAgent']);\n\t\t\tcurl_setopt( $this->ch, CURLOPT_AUTOREFERER, \t\tTRUE);\n\t\t\tcurl_setopt( $this->ch, CURLOPT_VERBOSE, \t\t\tFALSE);\n\t\t\tcurl_setopt( $this->ch, CURLOPT_COOKIEJAR, \t\t\t$this->config['cookieFile']);\n\t\t\treturn TRUE;\n\t\t}\n\t\treturn FALSE;\n\t}", "public function __construct() {\n $this->curl_handle = curl_init();\n curl_setopt($this->curl_handle, CURLOPT_TIMEOUT, $this->time_out);\n curl_setopt($this->curl_handle, CURLOPT_CONNECTTIMEOUT, $this->connect_time_out);\n curl_setopt($this->curl_handle, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($this->curl_handle, CURLOPT_AUTOREFERER, true);\n curl_setopt($this->curl_handle, CURLOPT_FOLLOWLOCATION, true);\n }", "public function applyCurlOptions($channel);", "public function curl_connect($curlUrl = null, $curl_options = null){\n\t\tif (!$this->curl_connection){\n\t\t\t$header = array();\n\t\t\t$header[0] = \"Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\";\n\t\t\t$header[] = \"Cache-Control: max-age=0\";\n\t\t\t$header[] = \"Connection: keep-alive\";\n\t\t\t$header[] = \"Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\";\n\t\t\t$header[] = \"Accept-Language: en-us,en;q=0.5\";\n\t\t\t$header[] = \"User-Agent: Patron conversion tool\";\n\n\t\t\t$cookie = $this->getCookieJar();\n\n\t\t\t$this->curl_connection = curl_init($curlUrl);\n\t\t\t$default_curl_options = array(\n\t\t\t\t\tCURLOPT_CONNECTTIMEOUT => 20,\n\t\t\t\t\tCURLOPT_TIMEOUT => 60,\n\t\t\t\t\tCURLOPT_HTTPHEADER => $header,\n\t\t\t\t//CURLOPT_USERAGENT => 'User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0',\n\t\t\t\t//CURLOPT_USERAGENT => \"User-Agent:Pika \" . $gitBranch,\n\t\t\t\t\tCURLOPT_RETURNTRANSFER => true,\n\t\t\t\t\tCURLOPT_SSL_VERIFYPEER => false,\n\t\t\t\t\tCURLOPT_FOLLOWLOCATION => true,\n\t\t\t\t\tCURLOPT_UNRESTRICTED_AUTH => true,\n\t\t\t\t\tCURLOPT_COOKIEJAR => $cookie,\n\t\t\t\t\tCURLOPT_COOKIESESSION => false,\n\t\t\t\t\tCURLOPT_FORBID_REUSE => false,\n\t\t\t\t\tCURLOPT_HEADER => false,\n\t\t\t\t\tCURLOPT_AUTOREFERER => true,\n\t\t\t\t// CURLOPT_HEADER => true, // debugging only\n\t\t\t\t// CURLOPT_VERBOSE => true, // debugging only\n\t\t\t);\n\n\t\t\tif ($curl_options) {\n\t\t\t\t$default_curl_options = array_merge($default_curl_options, $curl_options);\n\t\t\t}\n\t\t\tcurl_setopt_array($this->curl_connection, $default_curl_options);\n\t\t}else{\n\t\t\t//Reset to HTTP GET and set the active URL\n\t\t\tcurl_setopt($this->curl_connection, CURLOPT_HTTPGET, true);\n\t\t\tcurl_setopt($this->curl_connection, CURLOPT_URL, $curlUrl);\n\t\t}\n\n\t\treturn $this->curl_connection;\n\t}", "protected function setCurlOptions($parameters)\n {\n //create request\n $handle = curl_init($this->url);\n\n //set the payload\n curl_setopt($handle, CURLOPT_POST, true);\n curl_setopt($handle, CURLOPT_POSTFIELDS, $parameters);\n\n //return body only\n curl_setopt($handle, CURLOPT_HEADER, 0);\n curl_setopt($handle, CURLOPT_RETURNTRANSFER, 1);\n\n //create errors on timeout and on response code >= 300\n curl_setopt($handle, CURLOPT_TIMEOUT, 45);\n curl_setopt($handle, CURLOPT_FAILONERROR, true);\n curl_setopt($handle, CURLOPT_FOLLOWLOCATION, false);\n\n //set up host and cert verification\n curl_setopt($handle, CURLOPT_SSL_VERIFYHOST, 2);\n\n /**\n * NOTE on php.net\n * http://php.net/manual/en/function.curl-setopt.php\n * Your best bet is to not set this and let it use the default.\n * Setting it to 2 or 3 is very dangerous given the known vulnerabilities in SSLv2 and SSLv3.\n */\n // curl_setopt($handle, CURLOPT_SSLVERSION, 3);\n curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, false);\n\n if($this->sslCACertPath) {\n curl_setopt($handle, CURLOPT_CAINFO, $this->sslCACertPath);\n curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, true);\n }\n\n return $handle;\n }", "public function setOpt($key, $value)\n {\n curl_setopt(\n $this->_session,\n $key,\n $value\n );\n }", "function funSetCurlPath($ch, $path){\n curl_setopt($ch, CURLOPT_URL, $path);\n\n return $ch;\n}", "public static function setExtraCurlOption($key, $value) \n\t{\n\t\tacPhpCas::setReporting();\n\t\tphpCAS::setExtraCurlOption($key, $value);\t\t\n\t}", "function init_curl()\n\t{\n\t\t$this->ch = curl_init();\n\t\t$user_agent = $this->user_agent;\n\t\t$header[] = \"Accept: application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/jpeg, application/x-ms-xbap, application/x-shockwave-flash, */*\";\n\t\t$header[] = \"Accept-Language: en-US\";\n\t\t$header[] = \"User-Agent: \" . $user_agent;\n\t\t$header[] = \"Connection: Keep-Alive\";\n\t\t$header[] = \"Pragma:\";\n\t\t$header[] = \"Expect:\";\n\t\t$header[] = \"Content-Type:\";\n\n\t\t$this->header = $header;\n\n\t\t$header2[] = \"Accept: application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/jpeg, application/x-ms-xbap, application/x-shockwave-flash, */*\";\n\t\t$header2[] = \"Accept-Language: en-US\";\n\t\t$header2[] = \"User-Agent: \" . $user_agent;\n\t\t$header2[] = \"Connection: Keep-Alive\";\n\t\t$header2[] = \"Content-Type: application/x-www-form-urlencoded\";\n\t\t$header2[] = \"Pragma:\";\n\t\t$header2[] = \"Expect:\";\n\n\t\t$this->header_post = $header2;\n\n\t\t$header3[] = \"Accept: application/json, text/javascript, */*\";\n\t\t$header3[] = \"Accept-Language: en-US\";\n\t\t$header3[] = \"User-Agent: \" . $user_agent;\n\t\t$header3[] = \"Content-Type: application/x-www-form-urlencoded\";\n\t\t$header3[] = \"x-requested-with: XMLHttpRequest\";\n\t\t$header3[] = \"Connection: Keep-Alive\";\n\t\t$header3[] = \"Pragma:\";\n\t\t$header3[] = \"Expect:\";\n\n\t\t$this->header_json = $header3;\n\n\t\t$header4[] = \"Accept: application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/jpeg, application/x-ms-xbap, application/x-shockwave-flash, */*\";\n\t\t$header4[] = \"Accept-Language: en-US\";\n\t\t$header4[] = \"User-Agent: \" . $user_agent;\n\t\t$header4[] = \"Connection: Keep-Alive\";\n\t\t$header4[] = \"Content-Type: multipart/form-data\";\n\t\t$header4[] = \"Pragma:\";\n\t\t$header4[] = \"Expect:\";\n\n\t\t$this->header_multipart = $header4;\n\n\t\tcurl_setopt($this->ch, CURLOPT_USERAGENT, $user_agent);\n\t\tcurl_setopt($this->ch, CURLOPT_COOKIEJAR, $this->opt[\"cookie_dir\"].\"/\".$this->id);\n\t\tcurl_setopt($this->ch, CURLOPT_COOKIEFILE, $this->opt[\"cookie_dir\"].\"/\".$this->id);\n\t\t//curl_setopt($this->ch, CURLOPT_ENCODING, 'gzip, deflate');\n\t\tcurl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1);\n\t\tcurl_setopt($this->ch, CURLOPT_HEADER, 1);\n\t\tcurl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, 1);\n\t\tcurl_setopt($this->ch, CURLOPT_VERBOSE, $this->opt[\"verbose\"]);\n\t\tcurl_setopt($this->ch, CURLOPT_TIMEOUT, $this->opt[\"timeout\"]);\n\t\tcurl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, FALSE);\n\t\tcurl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, FALSE);\n\n\t\tif ($this->opt[\"use_proxy\"] && isset($proxy))\n\t\tcurl_setopt($this->ch, CURLOPT_PROXY, $proxy);\n\t\t//print \"Set Curl Proxy $proxy\\n\";\n\t\t//curl_setopt($this->ch, CURLOPT_PROXYUSERPWD, \"ocbeta:echo11ra\");\n\n\t\t//if ($this->opt[\"use_ips\"])\n\t\t//curl_setopt($this->ch, CURLOPT_INTERFACE, $this->get_ip());\n\t}", "public function setUrl($url){\n $this->url = $url;\n }", "public function setURL($url);", "public function setURL($url);", "public function setUrl($url) {}", "public function setUrl($url)\n {\n self::$url = $url;\n }", "public function setUrl($url) {\n $this->url = $url;\n }", "public function setCurlEngineType()\n {\n $this->getEngine()->setType(\"curl\");\n }", "public function setUrl($url) {\n\t\t$this->url = $url;\n\t}", "public function __construct() {\n parent::__construct();\n\n $curlversion = curl_version();\n if (isset($curlversion['version']) && stripos($curlversion['version'], '7.35.') === 0) {\n // There is a flaw with curl 7.35.0 that causes problems with client reuse.\n $this->cacheclient = false;\n }\n }", "private function init($url = null)\n {\n if ($url !== null) {\n $this->url = $url;\n }\n\n $this->handler = curl_init();\n\n curl_setopt($this->handler, CURLOPT_URL, $this->url);\n curl_setopt($this->handler, CURLOPT_RETURNTRANSFER, true);\n\n return $this;\n }", "function curl_options(&$curl, $options) {\n if (!curl_setopt_array($curl, $options)) {\n error('Failed to initialize cURL options for ' . spy($curl) . '.');\n }\n\n return $curl;\n}", "private function initCurl() {\r\n\t\tif (isset($this->curl)) { return $this->curl; }\r\n\r\n\t\t$this->curl = curl_init();\r\n\r\n\t\tcurl_setopt($this->curl, CURLOPT_RETURNTRANSFER, true);\r\n\t\tcurl_setopt($this->curl, CURLOPT_TIMEOUT, $this->request_timeout);\r\n\r\n\t\tif (isset($this->cookie_jar)) {\r\n\t\t\tcurl_setopt($this->curl, CURLOPT_COOKIEJAR, $this->cookie_jar);\r\n\t\t\tcurl_setopt($this->curl, CURLOPT_COOKIEFILE, $this->cookie_jar);\r\n\t\t}\r\n\r\n\t\tcurl_setopt($this->curl, CURLOPT_FOLLOWLOCATION, $this->is_multiple);\r\n\r\n\t\t# If a User Agent has been set, set the curl option\r\n\t\tif (isset($this->user_agent)) {\r\n\t\t\tcurl_setopt($this->curl, CURLOPT_USERAGENT, $this->user_agent);\r\n\t\t}\r\n\r\n\t\t# We are not too concerned about the strictness of SSL when finding redirects\r\n\t\t# Without these, some SSL links just fail to return anything\r\n\t\tcurl_setopt($this->curl, CURLOPT_SSL_VERIFYHOST, 0); \r\n\t\tcurl_setopt($this->curl, CURLOPT_SSL_VERIFYPEER, 0); \r\n\r\n\t\t# We want the headers returned to us to follow redirects\r\n\t\tcurl_setopt($this->curl, CURLOPT_HEADER, true); \r\n\t\t$this->code = curl_getinfo($this->curl, CURLINFO_HTTP_CODE);\r\n\t\treturn $this->curl;\r\n\t}", "public function setp($property, $value){\n //not working static fn if(property_exists('Config_allsites', $property)){\n if(property_exists($this, $property)){\n $this->$property = $value;\n }\n return $this;\n }", "public function setOpt($opt_key, $opt_value) {\n curl_setopt($this->_getCommHandler(), $opt_key, $opt_value);\n return $this;\n }", "function setUrl($url);", "function setURL($url){\n $this->urltoopen = $url;\n }", "public function init(){\n $handle = $this->getHandler();\n if ( $handle !== null && is_resource($handle) ) curl_close($handle);\n $ch = curl_init();\n if ($ch === false) throw new \\Exception('Can\\'t initialize cURL transport.'); \n $this->handle = $ch;\n return($this);\n }", "public function setUrl($url)\n {\n $this->_url = $url;\n }", "public function set_opt($custom_options = array()) {\r\n\t\t$debug_backtrace = debug_backtrace();\r\n\t\t$this_file = __FILE__;\r\n\t\tif (!empty($debug_backtrace[0][\"file\"]) && !empty($this_file) && ($debug_backtrace[0][\"file\"] == $this_file)) { $internal = true; } else { $internal = false; }\r\n\t\tforeach ($custom_options as $key => $value) {\r\n\t\t\tif (!is_string($key)) { trigger_error(\"curl option name must be string instead of default php constant\", E_USER_WARNING); }\r\n\t\t\telseif (!defined($key)) {\r\n\t\t\t\t$curl_version = curl_version();\r\n\t\t\t\ttrigger_error(\"'{$key}' is not a valid option in php v\".phpversion().\" or curl library v\".$curl_version[\"version\"], E_USER_WARNING);\r\n\t\t\t}\r\n\t\t\telseif ($key == \"CURLOPT_COOKIEFILE\") { $this->set_cookiefile($value); }\r\n\t\t\telseif ($key == \"CURLOPT_COOKIEJAR\") { $this->set_cookiejar($value); }\r\n\t\t\telseif (!$internal && in_array($key, array(\"CURLOPT_SAFE_UPLOAD\", \"CURLOPT_PROTOCOLS\", \"CURLOPT_RETURNTRANSFER\", \"CURLOPT_HEADERFUNCTION\", \"CURLINFO_HEADER_OUT\"))) {\r\n\t\t\t\ttrigger_error(\"'{$key}' option is locked in this class to ensure functionalities\", E_USER_WARNING);\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tif (curl_setopt($this->ch, constant($key), $value)) { $this->options[$key] = $value; }\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public function setUrl( $url );", "public function setUrl($url)\n\t{\n\t\t$this->url = $url;\n\t}", "public function setUrl($url)\n\t{\n\t\t$this->url = $url;\n\t}", "public function __construct(\n $url = null,\n $options = [\n CURLOPT_USERAGENT => \"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\",\n CURLOPT_RETURNTRANSFER => true\n ]\n )\n {\n $this->ch = curl_init();\n if(!is_null($url))\n $this->setOption(CURLOPT_URL, $url);\n if(!is_null($options)) {\n foreach ($options as $key => $value) {\n $this->setOption($key, $value);\n }\n }\n }", "public function init(){\n if (!extension_loaded('curl')) {\n throw new SdkException('The PHP exention curl must be installed to use this PDK.');\n }\n $this->curl = curl_init();\n }", "public function setUrl( $url )\n\t{\n\t\tif ( $url ) {\n $this->url = $url;\n\t\t}\n\t}", "function funInitCurl(){\n $ch = curl_init();\n\n curl_setopt($ch, CURLOPT_HEADER, 0);\n curl_setopt($ch, CURLOPT_VERBOSE, 1);\n curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0)');\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n curl_setopt($ch, CURLOPT_POST, 0);\n curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 20);\n\n return $ch;\n}", "function __construct(){\n\t\t$this->key = TRELLO_DEV_KEY;\n\t\t$this->token = TRELLO_USER_TOKEN;\n\n\t\t$this->curl = new Curl();\n\t}" ]
[ "0.7115164", "0.6903635", "0.67886484", "0.66602075", "0.6625037", "0.6577221", "0.65577656", "0.6510868", "0.6476004", "0.64215595", "0.6400426", "0.6364996", "0.6319862", "0.631053", "0.6304868", "0.62921137", "0.62331855", "0.62123114", "0.6159156", "0.61526424", "0.6131071", "0.61096805", "0.6084003", "0.6063934", "0.6056911", "0.6027856", "0.60056144", "0.6004181", "0.598822", "0.597857", "0.5978562", "0.5973786", "0.5963711", "0.5955987", "0.591185", "0.5904279", "0.5892049", "0.5891946", "0.58653253", "0.58625066", "0.5844664", "0.5826555", "0.5813445", "0.5810965", "0.58040094", "0.5801692", "0.578933", "0.57637936", "0.5725247", "0.5695683", "0.56840783", "0.5675461", "0.56660146", "0.566442", "0.56563175", "0.5656124", "0.5653946", "0.56476206", "0.56391823", "0.56391823", "0.56314594", "0.5628226", "0.562117", "0.55754393", "0.55426836", "0.55338454", "0.5514245", "0.54967177", "0.54790384", "0.54782414", "0.5473054", "0.5469809", "0.5467536", "0.5458148", "0.5431804", "0.5431804", "0.54281473", "0.5425686", "0.54251844", "0.5411062", "0.53968483", "0.53929865", "0.53815234", "0.5374769", "0.5373615", "0.53599006", "0.5354944", "0.53316694", "0.5327501", "0.53208756", "0.5311862", "0.5302792", "0.5301587", "0.5289725", "0.5289725", "0.5283128", "0.5265726", "0.5264797", "0.52555686", "0.52528656" ]
0.61168706
21
Sets SSL curl properties when requesting an https url.
private function setSSL() { curl_setopt($this->curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($this->curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, 1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function setCurl($is_https = false)\n {\n // Init\n $this->curl = curl_init();\n // Sets basic parameters\n curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, 1);\n curl_setopt($this->curl, CURLOPT_TIMEOUT, isset($this->request->settings['timeout']) ? $this->request->settings['timeout'] : 100);\n // Set parameters to maintain cookies across sessions\n curl_setopt($this->curl, CURLOPT_COOKIESESSION, true);\n curl_setopt($this->curl, CURLOPT_COOKIEFILE, sys_get_temp_dir() . '/cookies_file');\n curl_setopt($this->curl, CURLOPT_COOKIEJAR, sys_get_temp_dir() . '/cookies_file');\n curl_setopt($this->curl, CURLOPT_USERAGENT, 'OLEGNAX-PURCHASE-VERIFY');\n if ($is_https) {\n $this->setSSL();\n }\n }", "public function https_url($url)\n {\n }", "public function enableSSLChecks() {}", "public static function setSsl() {\n $attr = conf::getMainIni('mysql_attr');\n if (isset($attr['mysql_attr'])) {\n self::$dbh->setAttribute(PDO::MYSQL_ATTR_SSL_KEY, $attr['ssl_key']);\n self::$dbh->setAttribute(PDO::MYSQL_ATTR_SSL_CERT, $attr['ssl_cert']);\n self::$dbh->setAttribute(PDO::MYSQL_ATTR_SSL_CA, $attr['ssl_ca']);\n }\n }", "private function configureCurl ()\n {\n curl_setopt_array($this->cURL, [\n CURLOPT_URL => $this->url,\n CURLOPT_RETURNTRANSFER => true\n ]);\n }", "static function http_api_curl($handle, $r, $url) {\n\t\t\tif(strpos($url, 'paypal.com') !== false)\n\t\t\t\tcurl_setopt( $handle, CURLOPT_SSLVERSION, 6 );\n\t\t}", "public function forceSSL();", "public function forceSSL();", "public function setUseSSL($use_ssl){\r\n\t\t$this->useSSL = $use_ssl;\r\n\t}", "function wp_update_urls_to_https()\n {\n }", "public function set_use_ssl($_use_ssl)\n {\n $this->_use_ssl = $_use_ssl;\n }", "public function useHttps($flag = true) {\r\n\t\t$this->useHttps = true;\r\n\t\treturn $this;\r\n\t}", "function get_ssl($ssl_port){\n\t\tif($ssl_port == 80){\n\t\t\t$this->ssl = 'http';\n\t\t}\n\t\telse {\n\t\t\t$this->ssl = 'https';\n\t\t}\n\t}", "function get_ssl($ssl_port){\n\t\tif($ssl_port == 80){\n\t\t\t$this->ssl = 'http';\n\t\t}\n\t\telse {\n\t\t\t$this->ssl = 'https';\n\t\t}\n\t}", "public function https($https) {\n if (is_string($https)) {\n $this->https = $https;\n }\n return $this->https;\n }", "public function https($https) {\n if (is_string($https)) {\n $this->https = $https;\n }\n return $this->https;\n }", "public function testIsSSLD() {\n // If it's HTTPS is set, SSL\n $_SERVER['HTTP_X_FORWARDED_PROTO'] = 'HTTPS';\n\n $this->assertTrue( security::is_ssl() );\n }", "private function initCurl()\n {\n $this->curlObj = curl_init();\n curl_setopt_array($this->curlObj, array(\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_POST => true,\n CURLOPT_FORBID_REUSE => true,\n CURLOPT_HEADER => false,\n CURLOPT_TIMEOUT => 120,\n CURLOPT_CONNECTTIMEOUT => 2,\n CURLOPT_HTTPHEADER => [\"Connection: Keep-Alive\", \"Keep-Alive: 120\"]\n ));\n }", "protected function setHttpClientConfiguration(): void\n {\n $this->setCurlConstants();\n\n $this->httpClientConfig = [\n CURLOPT_SSLVERSION => CURL_SSLVERSION_TLSv1_2,\n CURLOPT_SSL_VERIFYPEER => $this->validateSSL,\n ];\n\n // Initialize Http Client\n $this->setClient();\n }", "public function disableSSLChecks() {}", "protected function _setCurlOpts() {\n $this->_setCurlOptArray($this->_getCurlOpts());\n }", "public function useSecureProtocol($protocol)\n {\n if($protocol == true)\n {\n $this->protocol = 'https';\n }\n else\n {\n $this->protocol = 'http';\n }\n }", "public function usesHttps()\n {\n return $this->useHttps;\n }", "private function configureSslValidation()\n {\n if ($this->config[ 'cas_validation' ] == 'self') {\n phpCAS::setCasServerCert($this->config[ 'cas_cert' ]);\n } else {\n if ($this->config[ 'cas_validation' ] == 'ca') {\n phpCAS::setCasServerCACert($this->config[ 'cas_cert' ]);\n } else {\n phpCAS::setNoCasServerValidation();\n }\n }\n }", "public function testIsSSLA() {\n // To revert\n $https = ( isset( $_SERVER['HTTPS'] ) ) ? $_SERVER['HTTPS'] : NULL;\n\n // If it's off, it should not show ssl\n $_SERVER['HTTPS'] = 'off';\n\n // Should NOT be SSL\n $this->assertFalse( security::is_ssl() );\n\n // Revert\n $_SERVER['HTTPS'] = $https;\n }", "public function getUseSSL(){\r\n\t\treturn $this->useSSL;\r\n\t}", "protected function setCurlConstants(): void\n {\n $constants = [\n 'CURLOPT_SSLVERSION' => 32,\n 'CURL_SSLVERSION_TLSv1_2' => 6,\n 'CURLOPT_SSL_VERIFYPEER' => 64,\n 'CURLOPT_SSLCERT' => 10025,\n ];\n\n foreach ($constants as $key => $value) {\n if (!defined($key)) {\n define($key, $constants[$key]);\n }\n }\n }", "public static function checkHttps()\n\t{\n\t\tif (!ConfigCls::getNeedHttps())\n\t\t\treturn true;\n\n\t\t//Else, return true only if HTTP is set\n\t\tif (!self::httpsUsed())\n\t\t\tdie('HTTPS connection required');\n\t}", "public function setInsecure()\n\t{\n\t\t$this->insecure = true;\n\t}", "protected function init()\n {\n $this->curl = curl_init();\n curl_setopt($this->curl, CURLOPT_SSL_VERIFYHOST, 2);\n curl_setopt($this->curl, CURLOPT_SSL_VERIFYPEER, FALSE);\n // this line makes it work under https\n curl_setopt($this->curl, CURLOPT_USERAGENT, $this->user_agent);\n curl_setopt($this->curl, CURLOPT_TIMEOUT, $this->timeout);\n curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, 1);\n curl_setopt($this->curl, CURLOPT_FOLLOWLOCATION, 1);\n curl_setopt($this->curl, CURLOPT_COOKIEJAR, $this->cookiejar);\n curl_setopt($this->curl, CURLOPT_COOKIEFILE, $this->cookiejar);\n curl_setopt($this->curl, CURLOPT_REFERER, $this->referer);\n if (isset($this->encoding)) {\n curl_setopt($this->curl, CURLOPT_ENCODING, $this->encoding);\n }\n if ($this->omitSSLVerification) {\n curl_setopt($this->curl, CURLOPT_SSL_VERIFYHOST, false);\n curl_setopt($this->curl, CURLOPT_SSL_VERIFYPEER, false);\n }\n if (isset($this->userAuthData)) {\n curl_setopt($this->curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);\n curl_setopt($this->curl, CURLOPT_USERPWD, $this->userAuthData);\n }\n if ($this->proxy != '') {\n curl_setopt($this->curl, CURLOPT_PROXY, $this->proxy);\n if ($this->proxyType == self::PROXY_TYPE_SOCKS4) {\n curl_setopt($this->curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4);\n } else if ($this->proxyType == self::PROXY_TYPE_SOCKS5) {\n curl_setopt($this->curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);\n }\n }\n $this->errorno = false;\n $this->error = false;\n }", "private function setCertificates(CurlHandle $curlHandle, HttpClientRequestInterface $request): void\n {\n if ($request->getCACertificate() !== null) {\n curl_setopt($curlHandle, CURLOPT_CAINFO, $request->getCACertificate()->__toString());\n }\n\n if ($request->getClientCertificate() !== null) {\n curl_setopt($curlHandle, CURLOPT_SSLCERT, $request->getClientCertificate()->__toString());\n }\n\n if ($request->getClientCertificatePassword() !== null) {\n curl_setopt($curlHandle, CURLOPT_SSLCERTPASSWD, $request->getClientCertificatePassword());\n }\n\n if ($request->getClientCertificateType() !== null) {\n curl_setopt($curlHandle, CURLOPT_SSLCERTTYPE, $request->getClientCertificateType());\n }\n\n if ($request->getClientKey() !== null) {\n curl_setopt($curlHandle, CURLOPT_SSLKEY, $request->getClientKey()->__toString());\n }\n }", "function avatars_via_https( array $args ) : array {\n\t$args['scheme'] = 'https';\n\treturn $args;\n}", "public function https_get($url , $params = []){\n// $this->response = $curl->get($url , $params)->response;\n if($params){\n $url = $url . '?' . http_build_query($params);\n }\n $this->response = $this->https_request($url );\n return $this;\n }", "public function enableSecureApiUrl()\n\t{\n\t\t$this->api_url = self::API_SECURE_URL;\n\t}", "function set_https($string){// $string is the passing argument\n\tif (is_ssl()) {\n\t\t$test = strpos($string, 'https:');//checks if the link has https in it, if so it returns true\n\t\tif($test === false){\n\t\t\t$result = str_replace('http:', 'https:', $string);\n\t\t\t//swaps the http: , with https: ( \":\"\" is for so i you can use http://example.org/how-http-works/'\n //without transforming the secon http to https)\n\t\t\treturn $result;\n\t\t}else{\n\t\t\treturn $string;\n\t\t}\n\t}else{\n\t\treturn $string;\n\t}\n}", "public function testIsSSLC() {\n // To revert\n $original_port = ( isset( $_SERVER['SERVER_PORT'] ) ) ? $_SERVER['SERVER_PORT'] : NULL;\n\n // If it's HTTPS is not set, but the port is, SSL\n $_SERVER['SERVER_PORT'] = 443;\n\n // Should be SSL!\n $this->assertTrue( security::is_ssl() );\n\n // Revert\n $_SERVER['SERVER_PORT'] = $original_port;\n }", "static public function getSecureURL() {\n\t\treturn self::$ssl_url;\n\t}", "function https_redirect_active_curl($url) {\n\n\t$url = str_ireplace('https://', 'http://', $url) . '/';\n\n\t$ch = curl_init();\n\tcurl_setopt($ch, CURLOPT_URL, $url);\n\tcurl_setopt($ch, CURLOPT_TIMEOUT, '60'); // in seconds\n\tcurl_setopt($ch, CURLOPT_HEADER, 1);\n\tcurl_setopt($ch, CURLOPT_NOBODY, 1);\n\tcurl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);\n\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n\tcurl_exec($ch);\n\n\tif(substr(curl_getinfo($ch)['url'], 0, 8) === 'https://')\n\t\treturn true;\n\telse\n\t\treturn false;\n}", "public function getSSLUrl()\n {\n return preg_replace('|^http://|i', 'https://', $this->getUrl());\n }", "public function setup() : void\n {\n // setup ssl options\n $this->options['ssl'] = array(\n 'verify_peer' => true,\n 'verify_peer_name' => true,\n 'allow_self_signed' => true // All root certificates are self-signed\n );\n }", "function _is_url_https( string $url ) {\n\t\treturn IMFORZA_Utils::is_url_https( $url );\n\t}", "public function testUseCdnsWithHttps()\n {\n $_SERVER['HTTPS'] = 'on';\n CMS::config()->cdns = [\n 'cdn1.test'\n ];\n\n $this->assertEquals(\n 'https://test_resource',\n $this->object->useCdns('http://test_resource', false)\n );\n }", "public static function setSSL($enabled, $validate = true)\n\t{\n\t\tself::$useSSL = $enabled;\n\t\tself::$useSSLValidation = $validate;\n\t}", "function ssl($url = ''){\r\n if(empty($url)) return FALSE;\r\n if(get_sso_option('is_ssl')){\r\n $url = @preg_replace('|^http://|', 'https://', $url);\r\n if(empty($url)) return FALSE;\r\n else return $url;\r\n }else return $url;\r\n}", "public static function isSSL($url = false)\n {\n return self::getProtocol($url) === 'https';\n }", "public static function ssl_url($url)\n {\n $config = cmsms()->GetConfig();\n\n $ssl_url = '';\n if( isset($config['ssl_url']) ) \n {\n\t$ssl_url = $config['ssl_url'];\n }\n if( empty($ssl_url) )\n {\n\t$ssl_url = str_replace('http://','https://',$config['root_url']);\n }\n \n if( startswith($url,$ssl_url) )\n {\n\treturn $url;\n }\n else if( startswith($url,$config['root_url']) )\n {\n\t$url = str_replace($config['root_url'],$ssl_url,$url);\n\treturn $url;\n }\n return FALSE;\n }", "public function ignoreSSLErrors()\r\n {\r\n $this->commandLineOptions[] = '--ignore-ssl-errors=true';\r\n $this->commandLineOptions[] = '--ssl-protocol=tlsv1';\r\n }", "private function initCurl()\n\t{\n\t\t$this->_curl = curl_init();\n\t\t//TODO: delete useless lines\n\t\tcurl_setopt ($this->_curl, CURLOPT_SSL_VERIFYPEER, FALSE);\n\t\tcurl_setopt ($this->_curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);\n\t\tcurl_setopt ($this->_curl, CURLOPT_TIMEOUT, 4000);\n\t\tcurl_setopt ($this->_curl, CURLOPT_FOLLOWLOCATION, 1);\n\t\tcurl_setopt ($this->_curl, CURLOPT_RETURNTRANSFER, 1);\n\t\tcurl_setopt ($this->_curl, CURLOPT_COOKIEJAR, self::$_COOKIE);\n\t\tcurl_setopt ($this->_curl, CURLOPT_COOKIEFILE, self::$_COOKIE);\n\t\tcurl_setopt ($this->_curl, CURLOPT_POST, 1);\n\t}", "public function get_test_ssl_support()\n {\n }", "protected function _initForceSSL() {\n\t\tif($_SERVER['SERVER_PORT'] != '443') {\n\t\t\theader('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);\n\t\t\texit();\n\t\t}\n\t}", "public function _settings_field_ssl() {\n global $zendesk_support;\n $ssl = (bool) $zendesk_support->settings['ssl'];\n ?>\n <?php if ( $ssl ): ?>\n <span class=\"description\"><?php _e( 'Your account is using SSL', 'zendesk' ); ?></span>\n <?php else: ?>\n <span class=\"description\"><?php _e( 'Your account is <strong>not</strong> using SSL', 'zendesk' ); ?></span>\n <?php endif; ?>\n <?php\n }", "public static function isSSL() {\n\t\treturn isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on';\n\t}", "public function getSsl() {\n return @$this->attributes['ssl'];\n }", "public function get_use_ssl()\n {\n return $this->_use_ssl;\n }", "protected function setCurlOptions($parameters)\n {\n //create request\n $handle = curl_init($this->url);\n\n //set the payload\n curl_setopt($handle, CURLOPT_POST, true);\n curl_setopt($handle, CURLOPT_POSTFIELDS, $parameters);\n\n //return body only\n curl_setopt($handle, CURLOPT_HEADER, 0);\n curl_setopt($handle, CURLOPT_RETURNTRANSFER, 1);\n\n //create errors on timeout and on response code >= 300\n curl_setopt($handle, CURLOPT_TIMEOUT, 45);\n curl_setopt($handle, CURLOPT_FAILONERROR, true);\n curl_setopt($handle, CURLOPT_FOLLOWLOCATION, false);\n\n //set up host and cert verification\n curl_setopt($handle, CURLOPT_SSL_VERIFYHOST, 2);\n\n /**\n * NOTE on php.net\n * http://php.net/manual/en/function.curl-setopt.php\n * Your best bet is to not set this and let it use the default.\n * Setting it to 2 or 3 is very dangerous given the known vulnerabilities in SSLv2 and SSLv3.\n */\n // curl_setopt($handle, CURLOPT_SSLVERSION, 3);\n curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, false);\n\n if($this->sslCACertPath) {\n curl_setopt($handle, CURLOPT_CAINFO, $this->sslCACertPath);\n curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, true);\n }\n\n return $handle;\n }", "#[Pure]\n public function getSslOptions() {}", "function isSSL()\n{\n\treturn (isset($_SERVER[\"HTTPS\"]) && ($_SERVER[\"HTTPS\"] == \"on\")) || (isset($_SERVER[\"HTTP_X_FORWARDED_PROTO\"]) && $_SERVER[\"HTTP_X_FORWARDED_PROTO\"] == \"https\");\n}", "public function isUsingHttps() {\r\n\t\treturn $this->useHttps;\r\n\t}", "public function isSSL(): bool\n {\n return\n strtolower($this->headers->get('X-Forwarded-Https', '')) == 'on' ||\n $this->headers->get('X-Forwarded-Https') == 1 ||\n strtolower($this->headers->get('X-Forwarded-Proto', '')) == 'https' ||\n strtolower($this->server->get('HTTPS', '')) == 'on' ||\n $this->server->get('HTTPS') == 1;\n }", "static function MakeHttps($url){\n\t\t\treturn preg_replace('~^(https?:)?//~','https://',$url);\n\t\t}", "public function testSchemeIsHttpsIfHttpsValueIsOn()\n {\n $server = ['HTTPS' => 'on'];\n $request = new Request($this->config, $server);\n\n $this->assertEquals('https://', $request->scheme);\n $this->assertEquals('https://', $request->getScheme());\n }", "public static function setHttpsOnly($httpsOnly) {\n\t\tself::instance()->httpsOnly($httpsOnly);\n\t}", "public function curlInit() {\n parent::curlInit();\n curl_setopt($this->curl, CURLOPT_HEADER, true);\n curl_setopt($this->curl, CURLOPT_ACCEPT_ENCODING, 'identity');\n }", "function trigger_https()\n\t{\n\t\t$exclude_url_list = array();\n\t\t//$exclude_url_list[] = '/(.*)js$/';\n\t\tforeach ($exclude_url_list as $exclude_url) {\n\t\t\tif(preg_match($exclude_url, uri_string()))\n\t\t\t{\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t \n\t\t// switch to HTTPS for these urls\n\t\t$ssl_url_list = array();\n\t\t$ssl_url_list[] = '/(.*)contact(.*)$/';\n\t \n\t\tforeach ($ssl_url_list as $ssl_url) {\n\t\t\tif(preg_match($ssl_url, uri_string()))\n\t\t\t{\n\t\t\t\tforce_ssl();\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t \n\t\t// still here? switch to HTTP (if necessary)\n\t\tremove_ssl();\n\t}", "public function test_https_status()\n {\n }", "protected function sslRedirection()\n {\n return;\n }", "public function isSSL(){\n\n if( !empty( $_SERVER['HTTPS'] ) && ($_SERVER['HTTPS'] != 'off') )\n return true;\n\n if( !empty( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' )\n return true;\n\n return false;\n\n }", "private function initCurl() {\r\n\t\tif (isset($this->curl)) { return $this->curl; }\r\n\r\n\t\t$this->curl = curl_init();\r\n\r\n\t\tcurl_setopt($this->curl, CURLOPT_RETURNTRANSFER, true);\r\n\t\tcurl_setopt($this->curl, CURLOPT_TIMEOUT, $this->request_timeout);\r\n\r\n\t\tif (isset($this->cookie_jar)) {\r\n\t\t\tcurl_setopt($this->curl, CURLOPT_COOKIEJAR, $this->cookie_jar);\r\n\t\t\tcurl_setopt($this->curl, CURLOPT_COOKIEFILE, $this->cookie_jar);\r\n\t\t}\r\n\r\n\t\tcurl_setopt($this->curl, CURLOPT_FOLLOWLOCATION, $this->is_multiple);\r\n\r\n\t\t# If a User Agent has been set, set the curl option\r\n\t\tif (isset($this->user_agent)) {\r\n\t\t\tcurl_setopt($this->curl, CURLOPT_USERAGENT, $this->user_agent);\r\n\t\t}\r\n\r\n\t\t# We are not too concerned about the strictness of SSL when finding redirects\r\n\t\t# Without these, some SSL links just fail to return anything\r\n\t\tcurl_setopt($this->curl, CURLOPT_SSL_VERIFYHOST, 0); \r\n\t\tcurl_setopt($this->curl, CURLOPT_SSL_VERIFYPEER, 0); \r\n\r\n\t\t# We want the headers returned to us to follow redirects\r\n\t\tcurl_setopt($this->curl, CURLOPT_HEADER, true); \r\n\t\t$this->code = curl_getinfo($this->curl, CURLINFO_HTTP_CODE);\r\n\t\treturn $this->curl;\r\n\t}", "public function __construct() {\n parent::__construct();\n $this->setOdataType('#microsoft.graph.security.sslCertificate');\n }", "protected function init()\n {\n // To start with, disable FOLLOWLOCATION since we'll handle it\n curl_setopt($this->curlHandle, \\CURLOPT_FOLLOWLOCATION, false);\n\n // Always return the transfer\n curl_setopt($this->curlHandle, \\CURLOPT_RETURNTRANSFER, true);\n\n // Force IPv4, since this class isn't yet comptible with IPv6\n $curlVersion = curl_version();\n\n if ($curlVersion['features'] & \\CURLOPT_IPRESOLVE) {\n curl_setopt($this->curlHandle, \\CURLOPT_IPRESOLVE, \\CURL_IPRESOLVE_V4);\n }\n }", "public function getSSL() \n {\n return (bool)$this->_ssl;\n }", "public function setCurlOptions(array $options)\n {\n $this->curl_options = $options;\n\n // We need to reinitialize the SOAP client.\n $this->soap = null;\n }", "private function setUrl()\n {\n curl_setopt($this->curl, CURLOPT_URL, $this->server);\n }", "public function getSsl()\n {\n return $this->ssl;\n }", "public function getSsl()\n {\n return $this->ssl;\n }", "public function getSsl()\n {\n return $this->ssl;\n }", "protected function transferDeprecatedCurlSettings() {}", "public function modifyInstanceSSL($request)\n {\n $runtime = new RuntimeOptions([]);\n\n return $this->modifyInstanceSSLWithOptions($request, $runtime);\n }", "public function setVerifySsl($verify_ssl)\n {\n $this->verify_ssl = $verify_ssl;\n }", "public function withSSL(int $mode = self::SSL_AUTO): self\n {\n $this->ssl = $mode;\n\n return $this;\n }", "public function testIsSSLB() {\n // To revert\n $https = ( isset( $_SERVER['HTTPS'] ) ) ? $_SERVER['HTTPS'] : NULL;\n\n // If it's on, it should be ssl\n $_SERVER['HTTPS'] = 'on';\n\n // Should be SSL!\n $this->assertTrue( security::is_ssl() );\n\n // Revert\n $_SERVER['HTTPS'] = $https;\n }", "public static function setSSLAuth($sslCert = null, $sslKey = null, $sslCACert = null)\n\t{\n\t\tself::$sslCert = $sslCert;\n\t\tself::$sslKey = $sslKey;\n\t\tself::$sslCACert = $sslCACert;\n\t}", "private function setCrypto()\n {\n $this->cryptoType = STREAM_CRYPTO_METHOD_TLS_CLIENT;\n //PHP 5.6.7 dropped inclusion of TLS 1.1 and 1.2 in STREAM_CRYPTO_METHOD_TLS_CLIENT\n //so add them back in manually if we can\n if (defined('STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT')) {\n $this->cryptoType |= STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT;\n $this->cryptoType |= STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT;\n }\n }", "public function __https()\n{\n\tif(strpos($_SERVER['HTTP_HOST'],'www') === false or !isset($_SERVER['HTTPS']))\n\t{\n\t\theader('Location: '._https);\n\t\texit(0);\n\t}\n}", "public function getSsl()\n {\n return $this->getConfig('ssl');\n }", "public function getUseSsl()\n {\n return $this->use_ssl;\n }", "public function set_use_tls($_use_tls)\n {\n $this->_use_tls = $_use_tls;\n }", "function wp_is_https_supported()\n {\n }", "public function describeInstanceSSL($request)\n {\n $runtime = new RuntimeOptions([]);\n\n return $this->describeInstanceSSLWithOptions($request, $runtime);\n }", "public function isHttps(): bool {\n\t\treturn $this->getScheme() === 'https' ? TRUE : FALSE;\n\t}", "function qa_is_https_probably()\n{\n\tif (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }\n\n\treturn (@$_SERVER['HTTPS'] && ($_SERVER['HTTPS'] != 'off')) || (@$_SERVER['SERVER_PORT'] == 443);\n}", "public function isSSL()\n {\n if (is_null($this->is_ssl)) {\n $server = provider::access('server');\n\n $this->is_ssl = (\n $server->isExist('HTTP_HOST') &&\n $server->isExist('HTTPS') &&\n $server->isValid('HTTPS', validate::T_PATTERN, array('pattern' => '/on/i'))\n );\n }\n\n return $this->is_ssl;\n }", "public function setUp()\n {\n parent::setUp();\n $this->configRequest([\n 'environment' => [\n 'HTTPS' => 'on'\n ]\n ]);\n }", "public function setUp()\n {\n parent::setUp();\n $this->configRequest([\n 'environment' => [\n 'HTTPS' => 'on'\n ]\n ]);\n }", "public function isHttps() {\n global $is_https;\n\n return $is_https;\n }", "private function checkSecureUrl()\n {\n $custom_ssl_var = 0;\n if (isset($_SERVER['HTTPS'])) {\n if ($_SERVER['HTTPS'] == 'on') {\n $custom_ssl_var = 1;\n }\n } else if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {\n $custom_ssl_var = 1;\n }\n if ((bool) Configuration::get('PS_SSL_ENABLED') && $custom_ssl_var == 1) {\n return true;\n } else {\n return false;\n }\n }", "public function setIsSecure($flag = true)\n {\n $this->setServer('HTTPS', $flag ? 'on' : null);\n return $this;\n }", "public function secureSsl()\n {\n return $this->secureSsl;\n }", "public function setSslOptions(?array $options = null) {}", "private function setURL($url)\r\n\t{\r\n\t\tcurl_setopt($this->getConnection(), CURLOPT_URL, $url);\r\n\t}" ]
[ "0.67573386", "0.66084594", "0.6411469", "0.6334074", "0.62385255", "0.62204045", "0.621059", "0.621059", "0.61937183", "0.61431164", "0.6126274", "0.6072844", "0.60616535", "0.60616535", "0.6024835", "0.6024835", "0.5980887", "0.5961165", "0.59462595", "0.5920146", "0.5916298", "0.5905596", "0.58800834", "0.58477616", "0.58345675", "0.5831107", "0.5823603", "0.5818316", "0.5809514", "0.5794119", "0.5792143", "0.57874614", "0.5786802", "0.57670426", "0.5755054", "0.57427967", "0.57380325", "0.57281435", "0.5710755", "0.5700243", "0.56953007", "0.5685348", "0.56812793", "0.56795174", "0.56658846", "0.56549895", "0.5654417", "0.565058", "0.563997", "0.56338227", "0.56297565", "0.5619187", "0.56126946", "0.56105566", "0.5606172", "0.5603948", "0.5599336", "0.5588495", "0.55881", "0.55528295", "0.5543914", "0.5541769", "0.55258185", "0.55166847", "0.5512008", "0.5509445", "0.55021524", "0.54990983", "0.54919046", "0.5486465", "0.5483614", "0.54806995", "0.5480156", "0.5475831", "0.5475831", "0.5475831", "0.546573", "0.5463348", "0.54599214", "0.545662", "0.5454469", "0.54539365", "0.5453658", "0.5449691", "0.5439245", "0.5424568", "0.5418132", "0.5411537", "0.54013485", "0.5397054", "0.5396415", "0.53947926", "0.5384561", "0.5384561", "0.5373201", "0.5367854", "0.53595203", "0.5355884", "0.53549266", "0.5349063" ]
0.79271114
0
Resolve endpoint based on handler setup.
private function resolveEndpoint(&$endpoint, LicenseRequest $license) { switch ($license->handler) { case 'wp_rest': $endpoint = '/wp-json/woo-license-keys/v1/' . str_replace('license_key_', '', $endpoint); break; default: $endpoint = '?action=' . $endpoint; break; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function resolve(): void\n {\n $path = $this->request->path();\n $method = $this->request->method();\n $handler = $this->routes[$method][$path] ?? false;\n\n if (!$handler) {\n $this->response->showNotFoundPage();\n return;\n }\n\n [$controller, $method] = $handler;\n\n (new $controller())->$method($this->request);\n }", "public function resolveRequestHandler() {}", "protected abstract function resolveService();", "public function getEndpoint();", "public function getEndpoint();", "public function getEndpoint();", "public function resolveUri($uri) {}", "public function setEndpointHandler(EndpointHandlerInterface $endpointHandler);", "public function resolve($handler)\n\t{\n\t\tif(is_array($handler) && is_string($handler[0]))\n\t\t{\n\t\t\t$handler[0] = new $handler[0];\n\t\t\t$handler[0]->init($this->log, $this->config, $this->hubic);\n\t\t}\n\t\t\n\t\treturn $handler;\n\t}", "final public function initialize()\n {\n if (! isset($_GET['_synful_ep_'])) {\n $response = (new SynfulException(500, 1002))->response;\n sf_respond($response->code, $response->serialize());\n exit;\n }\n\n $endpoint = $_GET['_synful_ep_'];\n $found_endpoint = false;\n $selected_route = null;\n $fields = [];\n\n foreach (Synful::$routes as $route) {\n if (strtolower($route->method) != strtolower($_SERVER['REQUEST_METHOD'])) {\n continue;\n }\n\n // Separate the parameters from the endpoint.\n $route_endpoint_elements = explode('/', $route->path);\n $route_endpoint_path = [];\n $route_endpoint_properties = [];\n for ($i = 0; $i < count($route_endpoint_elements); $i++) {\n $field = $route_endpoint_elements[$i];\n\n if (\n strpos($field, '{') === 0 &&\n strpos($field, '}') === (strlen($field) - 1)\n ) {\n $field = str_replace('{', '', $field);\n $field = str_replace('}', '', $field);\n\n $route_endpoint_properties[$i] = $field;\n } else {\n $route_endpoint_path[$i] = $field;\n }\n }\n\n $route_endpoint_without_properties = implode(\n $route_endpoint_path,\n '/'\n );\n\n unset($route_endpoint_path);\n\n // Check if the requested endpoint matches the route.\n // If the route endpoint without properties is empty,\n // we will check the property count.\n //\n // A route with an empty prefix will override all other\n // routes in the system.\n if (\n $route_endpoint_without_properties == '' ||\n strpos(\n $endpoint,\n $route_endpoint_without_properties\n ) !== false\n ) {\n // Match the fields in the endpoint with the properties\n // in the route's endpoint definition.\n $endpoint_elements = explode('/', $endpoint);\n if (\n count(\n $endpoint_elements\n ) != count(\n $route_endpoint_elements\n )\n ) {\n $response = (new SynfulException(500, 1018))->response;\n sf_respond($response->code, $response->serialize());\n exit;\n }\n\n foreach (\n $route_endpoint_properties as $key => $property\n ) {\n $fields[$property] = $endpoint_elements[$key];\n }\n\n $found_endpoint = true;\n $selected_route = $route->path;\n break;\n }\n }\n\n if (! $found_endpoint) {\n if (\n file_exists('./public/'.$endpoint) &&\n is_readable('./public/'.$endpoint) &&\n strpos($endpoint, '..') === false\n ) {\n $file_location = './public/'.$endpoint;\n $mime_type = mime_content_type($file_location);\n if ($mime_type === false) {\n $mime_type = 'text/plain';\n }\n\n header('Content-Type: '.$mime_type);\n http_response_code(200);\n echo file_get_contents($file_location);\n exit;\n } else {\n $response = (new SynfulException(404, 1001))->response;\n sf_respond($response->code, $response->serialize());\n exit;\n }\n }\n\n $input = file_get_contents('php://input');\n\n // Ger parameters are stored in a different location.\n if ($_SERVER['REQUEST_METHOD'] == 'GET') {\n $params = $_GET;\n\n // Remove System variables\n unset($params['_synful_ep_']);\n\n $input = (new URLSerializer)->serialize($params);\n }\n\n $route = Synful::$routes[$selected_route];\n\n $response = Synful::handleRequest(\n $route,\n $input,\n $fields,\n Synful::getClientIP()\n );\n\n $all_middleware = [];\n\n if (property_exists($route, 'middleware')) {\n if (! is_array($route->middleware)) {\n throw new SynfulException(500, 1017);\n }\n\n $all_middleware = $all_middleware + $route->middleware;\n }\n\n foreach ($all_middleware as $middleware) {\n $middleware = new $middleware;\n /** @noinspection PhpUndefinedMethodInspection */\n $middleware->after($response);\n }\n\n if ($response->serializer == null) {\n $serializer = sf_conf('system.serializer');\n $serializer = new $serializer;\n\n if (\n property_exists($route, 'serializer') &&\n class_exists($route->serializer)\n ) {\n $serializer = new $route->serializer;\n }\n\n $response->setSerializer($serializer);\n }\n\n /** @noinspection PhpUndefinedFieldInspection */\n header('Content-Type: '.$response->serializer->mime_type);\n sf_respond(\n $response->code,\n $response->serialize(),\n $response->headers()\n );\n }", "abstract public function resolve();", "public function getEndpoint($endpoint)\n {\n // Get Endpoint Class name\n $endpoint = studly_case($endpoint);\n\n if (!array_key_exists($endpoint, $this->endpoints)) {\n throw new InvalidEndpointException(\"Endpoint {$endpoint} does not exists\");\n }\n\n $class = $this->endpoints[$endpoint];\n\n // Check if an instance has already been initiated\n if (isset($this->cachedEndpoints[$endpoint]) === false) {\n // check if class is an EndPoint\n $endpointClass = new \\ReflectionClass($class);\n if (!$endpointClass->isSubclassOf('Atog\\Api\\Endpoint')) {\n throw new InvalidEndpointException(\"Class {$class} does not extend Atog\\\\Api\\\\Endpoint\");\n }\n \n // check for model\n $model = new Model();\n if (array_key_exists('models', $this->config) && array_key_exists($endpoint, $this->config['models'])) {\n $modelClass = $this->config['models'][$endpoint];\n if (class_exists($modelClass)) {\n $model = new $modelClass();\n }\n }\n $this->cachedEndpoints[$endpoint] = new $class($this, $model);\n }\n \n return $this->cachedEndpoints[$endpoint];\n }", "function choose_handler(): callable\n {\n return \\Yurun\\Util\\Swoole\\Guzzle\\choose_handler();\n }", "abstract protected function getEndpoint($ip);", "public function resolveRequestHandler() {\n\t\t$availableRequestHandlerClassNames = $this->reflectionService->getAllImplementationClassNamesForInterface('F3\\FLOW3\\MVC\\RequestHandlerInterface');\n\n\t\t$suitableRequestHandlers = array();\n\t\tforeach ($availableRequestHandlerClassNames as $requestHandlerClassName) {\n\t\t\tif (!$this->objectManager->isObjectRegistered($requestHandlerClassName)) continue;\n\n\t\t\t$requestHandler = $this->objectManager->getObject($requestHandlerClassName);\n\t\t\tif ($requestHandler->canHandleRequest()) {\n\t\t\t\t$priority = $requestHandler->getPriority();\n\t\t\t\tif (isset($suitableRequestHandlers[$priority])) throw new \\F3\\FLOW3\\MVC\\Exception('More than one request handler with the same priority can handle the request, but only one handler may be active at a time!', 1176475350);\n\t\t\t\t$suitableRequestHandlers[$priority] = $requestHandler;\n\t\t\t}\n\t\t}\n\t\tif (count($suitableRequestHandlers) === 0) throw new \\F3\\FLOW3\\MVC\\Exception('No suitable request handler found.', 1205414233);\n\t\tksort($suitableRequestHandlers);\n\t\treturn array_pop($suitableRequestHandlers);\n\t}", "private function GetEndpoint($endpoint, $params = NULL) {\n $endpoint = UrlUtils::AddParamsToUrl($endpoint, $params);\n if (!empty($this->server)) {\n $endpoint = UrlUtils::ReplaceServerInUrl($endpoint, $this->server);\n }\n return $endpoint;\n }", "public function getActualHandler();", "protected function resolveHandler(ExceptionHandler|string $handler): ExceptionHandler\n {\n $resolved = $handler;\n if (is_string($handler)) {\n $resolved = IoCFacade::tryMake($handler);\n }\n\n if (!($resolved instanceof ExceptionHandler)) {\n throw new LogicException('Provided exception handler MUST be a valid class path. Handler MUST also inherit from \\Aedart\\Contracts\\Exceptions\\ExceptionHandler');\n }\n\n return $resolved;\n }", "public function getEndpoint($resource_type_id, $safe=TRUE, $skip_cache=FALSE);", "public function resolve(Command $command, $handler = null);", "protected function resolveHandler($task) {\n\t\t\n\t\tif (isset($this->handlers[$task])) {\n\t\t\treturn $this->handlers[$task];\n\t\t}\n\t\t\n\t\t$di = $this->getDI();\n\t\t\n\t\t$handlerName = $task.$this->handlerClassSuffix;\n\t\t\n\t\tif (! $di->has($handlerName)) {\n\t\t\tthrow new Task\\NotHandledException(\"No handler found for cli task '$task'.\");\n\t\t}\n\t\t\n\t\treturn $di->get($handlerName);\n\t}", "private function handleEndpoint(Collection $config)\n {\n if ($config['endpoint']) {\n $config[Options::BASE_URL] = $config['endpoint'];\n return;\n }\n\n if ($config[Options::BASE_URL]) {\n return;\n }\n\n $endpoint = call_user_func(\n $config['endpoint_provider'],\n array(\n 'scheme' => $config[Options::SCHEME],\n 'region' => $config[Options::REGION],\n 'service' => $config[Options::SERVICE]\n )\n );\n\n $config[Options::BASE_URL] = $endpoint['endpoint'];\n\n // Set a signature if one was not explicitly provided.\n if (!$config->hasKey(Options::SIGNATURE)\n && isset($endpoint['signatureVersion'])\n ) {\n $config->set(Options::SIGNATURE, $endpoint['signatureVersion']);\n }\n\n // The the signing region if endpoint rule specifies one.\n if (isset($endpoint['credentialScope'])) {\n $scope = $endpoint['credentialScope'];\n if (isset($scope['region'])) {\n $config->set(Options::SIGNATURE_REGION, $scope['region']);\n }\n }\n }", "public function routeUrlDestinationAutodetect()\n {\n\n }", "public function resolve() {\n $path = $this->request->getPath();\n $method = $this->request->getMethod();\n $callback = $this->routes[$method][$path] ?? false;\n\n if ($callback === false) {\n $this->response->setStatusCode(404);\n //Configuring the status of the request to 404 always that a requisition to a non mapping route is made \n return $this->renderView('_404');\n }\n if (is_string($callback)) {\n // Assuming that if callback is a string, we will resolve it in a view\n\n return $this->renderView($callback);\n }\n if (is_array($callback)) {\n $callback = new $callback[0];\n // If it's an array, this means that the method to send data was POST and we need to create an object to be able to use this object to call render method from Controller class in class SiteController\n }\n\n return call_user_func($callback);\n // If the callback it's a function, this method will execute it\n }", "protected function resolveEndpoint($name)\n {\n $endpointClass = 'Byte5\\LaravelHarvest\\Endpoints\\\\'.$this->getEndpointName($name);\n\n if (! class_exists($endpointClass)) {\n throw new \\RuntimeException(\"Endpoint $name does not exist!\");\n }\n\n return new $endpointClass;\n }", "private function GetEndpoint($endpoint, $server = NULL, $params = NULL) {\n $endpoint = UrlUtils::AddParamsToUrl($endpoint, $params);\n if (!empty($server)) {\n $endpoint = UrlUtils::ReplaceServerInUrl($endpoint, $server);\n }\n return $endpoint;\n }", "protected function bindUriMiddleware()\n {\n return function (callable $handler) {\n return function (Request $request, array $options) use ($handler) {\n $tplPath = $request->getUri()->getPath();\n \n $query = [];\n parse_str($request->getUri()->getQuery(), $query);\n \n list($contentType) = preg_replace('/\\s*;.*/', '', $request->getHeader('Content-Type')) + [null];\n if ($contentType === 'multipart/form-data') {\n $data = static::parseMultipartFormData((string)$request->getBody());\n } elseif ($contentType === 'application/json') {\n $data = json_decode((string)$request->getBody());\n } elseif ($contentType === 'x-www-form-urlencoded') {\n $data = [];\n parse_str((string)$request->getBody(), $data);\n }\n \n $url = static::bindUri($tplPath, $query, isset($data) ? $data : null);\n $uri = $request->getUri()\n ->withPath(parse_url($url, PHP_URL_PATH))\n ->withQuery(parse_url($url, PHP_URL_QUERY) ?: '');\n \n return $handler($request->withUri($uri), $options);\n };\n };\n }", "public function getHandler() {\n\t\t/** @var \\Cundd\\Rest\\HandlerInterface $handler */\n\t\tlist($vendor, $extension,) = Utility::getClassNamePartsForPath($this->dispatcher->getPath());\n\n\t\t// Check if an extension provides a Handler\n\t\t$handlerClass = 'Tx_' . $extension . '_Rest_Handler';\n\t\tif (!class_exists($handlerClass)) {\n\t\t\t$handlerClass = ($vendor ? $vendor . '\\\\' : '') . $extension . '\\\\Rest\\\\Handler';\n\t\t}\n\n\t\t// Get the specific builtin handler\n\t\tif (!class_exists($handlerClass)) {\n\t\t\t$handlerClass = 'Cundd\\\\Rest\\\\Handler\\\\' . $extension . 'Handler';\n\t\t\t// Get the default handler\n\t\t\tif (!class_exists($handlerClass)) {\n\t\t\t\t$handlerClass = 'Cundd\\\\Rest\\\\HandlerInterface';\n\t\t\t}\n\t\t}\n\t\t$handler = $this->get($handlerClass);\n\t\t//$handler->setRequest($this->dispatcher->getRequest());\n\t\treturn $handler;\n\t}", "public function getEndpoint(): string;", "public function getEndpoint(): string;", "public function getEndpoint(): string;", "public function getEndpoint(): string;", "function resolveURL($uri);", "public function doResolveHost() {\r\n if (preg_match('|[a-zA-Z]|', $this->getTarget())) {\r\n return $this->resolveHost($this->getTarget());\r\n }\r\n return $this->resolveAddr($this->getTarget());\r\n }", "public function resolve($resource, $type = null);", "protected function getTargetHandler(): TargetHandlerInterface\n {\n return new Route();\n }", "public function getApiEndpoint();", "public function resolve(CommandInterface $command): HandlerInterface;", "public function resolve() : mixed\n {\n $method = $this->request->getMethod();\n $url = $this->request->getUrl();\n $callback = $this->routeMap[$method][$url] ?? false;\n if (!$callback) {\n\n $callback = $this->getCallback();\n\n if ($callback === false) {\n throw new NotFoundException();\n }\n }\n if (is_string($callback)) {\n return $this->renderView($callback);\n }\n if (is_array($callback)) {\n /**\n * @var $controller \\kingstonenterprises\\app\\Controller\n */\n $controller = new $callback[0];\n $controller->action = $callback[1];\n Application::$app->controller = $controller;\n /*$middlewares = $controller->getMiddlewares();\n foreach ($middlewares as $middleware) {\n $middleware->execute();\n }*/\n $callback[0] = $controller;\n }\n return call_user_func($callback, $this->request, $this->response);\n }", "public static function resolve() {\n $paths = func_get_args();\n if (count($paths)===1 && is_array($paths[0])) $paths = $paths[0];\n\n $prefix = [];\n $imploded = null;\n $stripped = [];\n\n // Strip all stream wrapper schemes, and prepend the\n // last found scheme to the resolved path.\n foreach($paths as $path) {\n $newPrefix = [];\n $path = self::stripScheme($path, $newPrefix);\n\n if (count($newPrefix)) {\n if ($imploded && $imploded!==implode('', $newPrefix)) {\n // Switched scheme, so skip previous paths (like a root change)\n $stripped = [];\n }\n\n $prefix = $newPrefix;\n $imploded = implode('', $prefix);\n }\n\n if ($path) $stripped[] = $path;\n }\n\n $nonDefault = array_filter($prefix, function($prefix){\n return $prefix!=='file://';\n });\n\n if (count($nonDefault)===0) $prefix = [];\n\n // Do a posix-style join for remote URLs and VFS streams\n $nonAbsolutable = array_filter($prefix, function($prefix){\n return $prefix==='vfs://' || !stream_is_local($prefix.'/foo');\n });\n\n if (count($nonAbsolutable)>0) {\n $method = 'join';\n $adapter = self::$posix;\n } else {\n $method = 'resolve';\n $adapter = self::$adapter;\n }\n\n $resolved = $adapter->$method($stripped);\n\n return implode('', $prefix) . $resolved;\n }", "public function\n\tGetRoute():\n\t?Nether\\Avenue\\RouteHandler {\n\n\t\t$Handler = NULL;\n\t\t$Dm = $Pm = NULL;\n\t\t$Nope = NULL;\n\t\t$Qk = NULL;\n\t\t$Qv = NULL;\n\t\t$Query = $this->GetQuery();\n\n\t\tforeach($this->Routes as $Handler) {\n\n\t\t\t// require a domain hard match.\n\n\t\t\tif(!preg_match($Handler->GetDomain(),$this->Domain,$Dm))\n\t\t\tcontinue;\n\n\t\t\t// require a path hard match.\n\n\t\t\tif(!preg_match($Handler->GetPath(),$this->Path,$Pm))\n\t\t\tcontinue;\n\n\t\t\t// require a query soft match.\n\n\t\t\t$Nope = FALSE;\n\t\t\tforeach($Handler->GetQuery() as $Qk => $Qv) {\n\t\t\t\tif(!$Qv)\n\t\t\t\tcontinue;\n\n\t\t\t\tif(!array_key_exists($Qv,$Query))\n\t\t\t\tif(!array_key_exists($Qk,$Query) || $Query[$Qk] !== $Qv)\n\t\t\t\t$Nope = TRUE;\n\t\t\t}\n\n\t\t\tif($Nope)\n\t\t\tcontinue;\n\n\t\t\t// fetch the arguments found by the route match.\n\t\t\tunset($Dm[0],$Pm[0]);\n\t\t\t$Handler->SetArgv(array_merge($Dm,$Pm));\n\n\t\t\t// ask the route if it is willing to handle the request.\n\t\t\tif(!$this->WillHandlerAcceptRequest($Handler))\n\t\t\tcontinue;\n\n\t\t\t// and since we found a match we are done.\n\t\t\treturn $Handler;\n\t\t}\n\n\t\treturn NULL;\n\t}", "public function get_matched_handler()\n {\n }", "public function endpoint()\n {\n if(!$this->properties['endpoint'] && $this->channel_id())\n {\n $url = route('directory', [\n 'channel_id' => $this->channel_id(),\n 'directory_id' => $this->id()\n ]);\n\n $this->properties['endpoint'] = parse_url($url, PHP_URL_PATH);\n }\n\n return $this->properties['endpoint'];\n }", "public function getEndpoint()\n {\n $basePath = $this->app['config']->get('api.base_path', self::DEFAULT_BASE_PATH);\n $basePath = $this->stripTrailingSlash($basePath);\n\n // determine the base URL for the API,\n // i.e. https://api.example.com/v1\n $urlBase = $this->app['config']->get('api.url');\n if ($urlBase) {\n $urlBase = $this->stripTrailingSlash($urlBase);\n } else {\n // no base URL was defined so we're going to generate one\n $urlBase = $this->app['base_url'];\n $urlBase = $this->stripTrailingSlash($urlBase).$basePath;\n }\n\n // get the requested path, strip any trailing '/'\n $path = $this->stripTrailingSlash($this->request->path());\n\n // strip out the base path (i.e. /api/v1) from the\n // requested path\n if ($basePath) {\n $path = str_replace($basePath, '', $path);\n }\n\n return $urlBase.$path;\n }", "protected function register_rewrite_endpoints() {\n\t\tif ( ! empty( $this->endpoints ) ) {\n\t\t\tforeach ( $this->endpoints as $slug => $arr ) {\n\t\t\t\tadd_rewrite_endpoint( $slug, $arr['type'] );\n\t\t\t}\n\t\t}\n\t}", "public function resolve(QueryInterface $query): HandlerInterface;", "protected function getRouting_ResolverService()\n {\n return $this->services['routing.resolver'] = new \\phpbb\\routing\\loader_resolver(${($_ = isset($this->services['routing.loader.collection']) ? $this->services['routing.loader.collection'] : $this->getRouting_Loader_CollectionService()) && false ?: '_'});\n }", "public function handle($uri = null) {\n\n\t\tif(!$uri)\n\t\t\t$uri = $this->getRewriteUri();\n\n\t\t/**\n\t\t * Remove extra slashes in the route\n\t\t */\n\n\t\tif($this->_removeExtraSlashes && $uri != '/')\n\t\t\t$handledUri = rtrim($uri, '/');\n\t\telse\n\t\t\t$handledUri = $uri;\n\n\t\t$request = null;\n\t\t$currentHostName = null;\n\t\t$routeFound = false;\n\t\t$parts = [];\n\t\t$params = [];\n\t\t$matches = null;\n\t\t$this->_wasMatched = false;\n\t\t$this->_matchedRoute = null;\n\n\t\tif(!is_object($this->_dependencyContainer))\n\t\t\tthrow new Exception('A dependency injection container is required to access the \\'request\\' service.');\n\n\t\tforeach($this->_routes as $route) {\n\n\t\t\t$params = [];\n\t\t\t$matches = null;\n\n\t\t\t$methods = $route->getHttpMethods();\n\n\t\t\tif(!is_null($methods)) {\n\n\t\t\t\t/** @var \\Mike\\Http\\Request $request */\n\n\t\t\t\tif(is_null($request))\n\t\t\t\t\t$request = $this->_dependencyContainer->get('request');\n\n\t\t\t\tif(!$request->isMethod($methods))\n\t\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\t$hostname = $route->getHostName();\n\n\t\t\tif(!is_null($hostname)) {\n\n\t\t\t\tif(is_null($currentHostName))\n\t\t\t\t\t$currentHostName = $request->getHttpHost();\n\n\t\t\t\tif(!$currentHostName)\n\t\t\t\t\tcontinue;\n\n\t\t\t\tif(Text::contains($hostname, '(')) {\n\n\t\t\t\t\tif(!Text::contains($hostname, '#')) {\n\n\t\t\t\t\t\t$regexHostName = '#^' . $hostname;\n\n\t\t\t\t\t\tif(!Text::contains($hostname, ':'))\n\t\t\t\t\t\t\t$regexHostName .= '(:[[:digit:]]+)?';\n\n\t\t\t\t\t\t$regexHostName .= '$#i';\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t$regexHostName = $hostname;\n\t\t\t\t\t}\n\n\t\t\t\t\t$matched = preg_match($regexHostName, $currentHostName);\n\n\t\t\t\t} else {\n\n\t\t\t\t\t$matched = ($currentHostName == $hostname);\n\t\t\t\t}\n\n\t\t\t\tif(!$matched)\n\t\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * If the route has parentheses use preg_match\n\t\t\t */\n\n\t\t\t$pattern = $route->getCompiledPattern();\n\n\t\t\tif(Text::contains($pattern, '^'))\n\t\t\t\t$routeFound = preg_match($pattern, $handledUri, $matches);\n\n\t\t\telse\n\t\t\t\t$routeFound = ($pattern == $handledUri);\n\n\t\t\t/**\n\t\t\t * Check for beforeMatch conditions\n\t\t\t */\n\n\t\t\tif($routeFound) {\n\n\t\t\t\t$beforeMatch = $route->getBeforeMatch();\n\n\t\t\t\tif(!is_null($beforeMatch)) {\n\n\t\t\t\t\tif(!is_callable($beforeMatch))\n\t\t\t\t\t\tthrow new Exception('Before-Match callback is not callable in matched route.');\n\n\t\t\t\t\t$routeFound = call_user_func_array($beforeMatch, [$handledUri, $route, $this]);\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif($routeFound) {\n\n\t\t\t\t$paths = $route->getPaths();\n\n\t\t\t\tif(is_array($matches)) {\n\n\t\t\t\t\t$converters = $route->getConverters();\n\n\t\t\t\t\tforeach($paths as $part => $position) {\n\n\t\t\t\t\t\tif(!is_string($part))\n\t\t\t\t\t\t\tthrow new Exception('Wrong key in paths: ' . $part);\n\n\t\t\t\t\t\tif(!is_string($position) && !is_integer($position))\n\t\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\t\tif(isset($matches[$position])) {\n\n\t\t\t\t\t\t\tif(is_array($converters)) {\n\n\t\t\t\t\t\t\t\tif(isset($converters[$part])) {\n\n\t\t\t\t\t\t\t\t\t$parts[$part] = call_user_func_array($converters[$part], [ $matches[$position] ]);\n\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t$parts[$part] = $matches[$position];\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tif(is_array($converters)) {\n\n\t\t\t\t\t\t\t\tif(isset($converters[$part]))\n\t\t\t\t\t\t\t\t\t$parts[$part] = call_user_func_array($converters[$part], [$position]);\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tif(is_integer($position))\n\t\t\t\t\t\t\t\t\tunset($parts[$part]);\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t$this->_matches = $matches;\n\t\t\t\t}\n\n\t\t\t\t$this->_matchedRoute = $route;\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif($routeFound)\n\t\t\t$this->_wasMatched = true;\n\t\telse\n\t\t\t$this->_wasMatched = false;\n\n\t\tif(!$routeFound) {\n\n\t\t\t$notFoundPaths = $this->_notFoundPaths;\n\n\t\t\tif(!is_null($notFoundPaths)) {\n\n\t\t\t\t$parts = Route::getRoutePaths($notFoundPaths);\n\t\t\t\t$routeFound = true;\n\n\t\t\t}\n\n\t\t}\n\n\t\t$this->_module = $this->_defaultModule;\n\t\t$this->_controller = $this->_defaultController;\n\t\t$this->_action = $this->_defaultAction;\n\t\t$this->_params = $this->_defaultParams;\n\n\t\tif($routeFound) {\n\n\t\t\tif(isset($parts['module'])) {\n\n\t\t\t\tif(!is_numeric($parts['module']))\n\t\t\t\t\t$this->_module = $parts['module'];\n\n\t\t\t\tunset($parts['module']);\n\t\t\t}\n\n\n\t\t\tif(isset($parts['controller'])) {\n\n\t\t\t\tif(!is_numeric($parts['controller']))\n\t\t\t\t\t$this->_controller = $parts['controller'];\n\n\t\t\t\tunset($parts['controller']);\n\t\t\t}\n\n\n\t\t\tif(isset($parts['action'])) {\n\n\t\t\t\tif(!is_numeric($parts['action']))\n\t\t\t\t\t$this->_action = $parts['action'];\n\n\t\t\t\tunset($parts['action']);\n\t\t\t}\n\n\t\t\tif(isset($parts['params'])) {\n\n\t\t\t\tif(is_string($parts['params'])) {\n\n\t\t\t\t\t$strParams = trim($parts['params'], '/');\n\n\t\t\t\t\tif($strParams != '')\n\t\t\t\t\t\t$params = explode('/', $strParams);\n\n\t\t\t\t}\n\n\t\t\t\tunset($parts['params']);\n\t\t\t}\n\n\t\t\tif(count($params))\n\t\t\t\t$this->_params = array_merge($params, $parts);\n\t\t\telse\n\t\t\t\t$this->_params = $parts;\n\n\t\t}\n\t}", "protected function resolve()\n {\n// $callStack = new CallStack;\n\n $executePattern = $this->route->getProperty('execute');\n\n /** @var ExecuteHandler[] $handlers */\n $handlers = array();\n\n $middlewares = array();\n\n $decorators = array();\n\n foreach ($this->route->getFullRoutes() as $route) {\n $group = $route->getGroup();\n\n foreach ($group->factory->getExecuteHandlers() as $handler)\n $handlers[get_class($handler)] = $handler;\n\n // stack all the handlers\n foreach ($group->getExecuteHandlers() as $name => $handler)\n $handlers[$name] = $handler;\n\n foreach ($group->getMiddlewares() as $middleware)\n $middlewares[] = new Call($this->resolveMiddleware($middleware[0]), $middleware[1]);\n// $callStack->addCallable($this->resolveMiddleware($middleware[0]), $middleware[1]);\n\n // append all route middlewares\n// foreach ($route->getProperty('middleware') as $middleware)\n// $middlewares[] = new Call($this->resolveMiddleware($middleware[0]), $middleware[1]);\n// $callStack->addCallable($this->resolveMiddleware($middleware[0]), $middleware[1]);\n\n foreach ($route->getStates() as $key => $value)\n $this->states[$key] = $value;\n\n foreach ($route->getFlags() as $flag)\n $this->flags[] = $flag;\n\n foreach ($route->getSerieses() as $key => $value) {\n if (!array_key_exists($key, $this->serieses))\n $this->serieses[$key] = array();\n\n foreach ($value as $v)\n $this->serieses[$key][] = $v;\n }\n\n foreach ($group->getDecorators() as $decorator)\n $decorators[] = new Call($this->resolveMiddleware($decorator));\n\n// foreach ($route->getDecorators() as $decorator)\n// $decorators[] = new Call($this->resolveMiddleware($decorator));\n\n // pass config.\n if ($config = $route->getProperty('config'))\n $this->config = array_merge($this->config, $config);\n }\n\n foreach ($handlers as $name => $class) {\n $handler = null;\n\n if (is_string($class)) {\n $handler = new $class;\n } else if (is_object($class)) {\n if ($class instanceof \\Closure) {\n $class($handler = new DynamicHandler());\n } else if ($class instanceof ExecuteHandler) {\n $handler = $class;\n }\n }\n\n if (!$handler || !is_object($handler) || !($handler instanceof ExecuteHandler))\n throw new InvalidArgumentException('Handler must be either class name, ' . ExecuteHandler::class . ' or \\Closure ');\n\n if ($handler->validateHandle($executePattern)) {\n $resolve = $handler->resolveHandle($executePattern);\n\n if (!is_callable($resolve))\n throw new \\Exedra\\Exception\\InvalidArgumentException('The resolveHandle() method for handler [' . get_class($handler) . '] must return \\Closure or callable');\n\n $properties = array();\n\n if ($this->route->hasDependencies())\n $properties['dependencies'] = $this->route->getProperty('dependencies');\n\n if (!$resolve)\n throw new InvalidArgumentException('The route [' . $this->route->getAbsoluteName() . '] execute handle was not properly resolved. ' . (is_string($executePattern) ? ' [' . $executePattern . ']' : ''));\n\n// $callStack->addCallable($resolve, $properties);\n\n return $this->createCallStack($middlewares, $decorators, new Call($resolve, $properties));\n\n// return $callStack;\n }\n }\n\n return null;\n }", "public function getEndpoint(): Endpoint\n {\n /** @var \\Muffin\\Webservice\\Model\\Endpoint */\n return $this->getRepository();\n }", "public function resolve() {}", "static function propfind($path, $handler)\r\n {\r\n Route::route(\"PROPFIND\", $path, $handler);\r\n }", "function resolve(Request $request, $path, $filter);", "public function getHandler() {}", "protected function getHostFromUri() {}", "public function __get($endpoint)\n {\n return $this->getEndpoint($endpoint);\n }", "function choose_handler(): callable\n {\n $handler = null;\n $defaultHandler = DefaultHandler::getDefaultHandler();\n if (\\is_string($defaultHandler))\n {\n $handler = new $defaultHandler();\n }\n elseif (\\is_callable($defaultHandler))\n {\n $handler = $defaultHandler();\n }\n elseif (\\function_exists('curl_multi_exec') && \\function_exists('curl_exec'))\n {\n $handler = Proxy::wrapSync(new CurlMultiHandler(), new CurlHandler());\n }\n elseif (\\function_exists('curl_exec'))\n {\n $handler = new CurlHandler();\n }\n elseif (\\function_exists('curl_multi_exec'))\n {\n $handler = new CurlMultiHandler();\n }\n\n if (ini_get('allow_url_fopen'))\n {\n $handler = $handler\n ? Proxy::wrapStreaming($handler, new StreamHandler())\n : new StreamHandler();\n }\n elseif (!$handler)\n {\n throw new \\RuntimeException('GuzzleHttp requires cURL, the ' . 'allow_url_fopen ini setting, or a custom HTTP handler.');\n }\n\n return $handler;\n }", "public static function resolve_resource_by_uri($uri, $context, $info)\n {\n }", "public function resolveRouteBinding($value);", "public function endpoints(): RouteEndpointsInterface;", "protected function route(Endpoint $endpoint, $route) {\t\r\n\t\t$count = count($route);\r\n\t\t\r\n\t\tif ($count == 0) return null;\r\n\t\t\r\n\t\tfor ($i = 0; $i < $count; $i++) {\r\n\t\t\t/* @var $endpoint Endpoint */\r\n\t\t\t$endpoint = $endpoint->resolve($route[$i]);\r\n\t\t\t\r\n\t\t\tif ($endpoint === null) return null;\r\n\t\t\t\r\n\t\t\tif ($endpoint instanceof \\Closure) {\r\n\t\t\t\tif ($i == $count - 1) {\r\n\t\t\t\t\treturn $endpoint;\r\n\t\t\t\t} else {\r\n\t\t\t\t\treturn null;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public function __invoke(Resolver $resolver): Response;", "public function DetermineEndPoint(){\r\n\t\treturn ((isset($_SERVER['HTTPS'])&&$_SERVER['HTTPS']=='on')?'https':'http').'://'.$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME'];\r\n\t}", "public function getEndpoint() {\n return $this->endpoint;\n }", "private function endpoint( $endpoint )\n {\n return ($this->api) ?\n vsprintf(\"%s/%s\",[$this->api_prefix, trim($endpoint,\"/\")]) :\n $endpoint;\n }", "public function getEndpoint() {\n return $this->src->getAttribute('endpoint');\n }", "protected static function discover_endpoints($issuer) {\n $curl = new curl();\n\n if (empty($issuer->get('baseurl'))) {\n return 0;\n }\n\n $url = $issuer->get_endpoint_url('discovery');\n if (!$url) {\n $url = $issuer->get('baseurl') . '/.well-known/openid-configuration';\n }\n\n if (!$json = $curl->get($url)) {\n $msg = 'Could not discover end points for identity issuer' . $issuer->get('name');\n throw new moodle_exception($msg);\n }\n\n if ($msg = $curl->error) {\n throw new moodle_exception('Could not discover service endpoints: ' . $msg);\n }\n\n $info = json_decode($json);\n if (empty($info)) {\n $msg = 'Could not discover end points for identity issuer' . $issuer->get('name');\n throw new moodle_exception($msg);\n }\n\n foreach (endpoint::get_records(['issuerid' => $issuer->get('id')]) as $endpoint) {\n if ($endpoint->get('name') != 'discovery_endpoint') {\n $endpoint->delete();\n }\n }\n\n foreach ($info as $key => $value) {\n if (substr_compare($key, '_endpoint', - strlen('_endpoint')) === 0) {\n $record = new stdClass();\n $record->issuerid = $issuer->get('id');\n $record->name = $key;\n $record->url = $value;\n\n $endpoint = new endpoint(0, $record);\n $endpoint->create();\n }\n\n if ($key == 'scopes_supported') {\n $issuer->set('scopessupported', implode(' ', $value));\n $issuer->update();\n }\n }\n\n // We got to here - must be a decent OpenID connect service. Add the default user field mapping list.\n foreach (user_field_mapping::get_records(['issuerid' => $issuer->get('id')]) as $userfieldmapping) {\n $userfieldmapping->delete();\n }\n\n // Create the field mappings.\n $mapping = [\n 'given_name' => 'firstname',\n 'middle_name' => 'middlename',\n 'family_name' => 'lastname',\n 'email' => 'email',\n 'website' => 'url',\n 'nickname' => 'alternatename',\n 'picture' => 'picture',\n 'address' => 'address',\n 'phone' => 'phone1',\n 'locale' => 'lang'\n ];\n foreach ($mapping as $external => $internal) {\n $record = (object) [\n 'issuerid' => $issuer->get('id'),\n 'externalfield' => $external,\n 'internalfield' => $internal\n ];\n $userfieldmapping = new user_field_mapping(0, $record);\n $userfieldmapping->create();\n }\n\n return endpoint::count_records(['issuerid' => $issuer->get('id')]);\n }", "public function handle($endpoint=true)\r\n {\r\n // we will record the path data for the route.\r\n // We set the routeMapper variables and the route path.\r\n self::setPath(function(){\r\n\r\n // we are sending\r\n // the controller and routes.php path.\r\n return [\r\n 'controllerPath' => path()->controller(),\r\n 'routePath' => path()->route(),\r\n ];\r\n },$endpoint);\r\n\r\n // in the paths data,\r\n // we run the route mapper values ​​and the route files one by one.\r\n foreach (self::$paths as $mapper=>$controller){\r\n core()->fileSystem->callFile($mapper);\r\n }\r\n }", "private function checkIfEndpointsSet()\n {\n if(empty($this->apiEndpoint)) {\n $this->apiEndpoint = $this->baseApiEndpoint . '/' . $this->apiVersionEndpoint;\n }\n\n if(empty($this->tokenEndpoint)) {\n $this->tokenEndpoint = $this->baseApiEndpoint . '/' . $this->apiOauthEndpoint;\n }\n }", "public function resolvable();", "public function resolve($resource);", "public function getResolver()\n {\n }", "public function getHandlerData()\n {\n $uri = $this->request->getUri();\n $method = $this->request->getMethod();\n $searches = array_keys($this->patterns);\n $replaces = array_values($this->patterns);\n\n $this->routes = str_replace('//', '/', $this->routes);\n\n $routes = $this->routes;\n foreach ($routes as $pos => $route) {\n $curRoute = str_replace(['//', '\\\\'], '/', $route);\n if (strpos($curRoute, ':') !== false) {\n $curRoute = str_replace($searches, $replaces, $curRoute);\n }\n if (preg_match('#^' . $curRoute . '$#', $uri, $matched)) {\n\n if (isset($this->callbacks[$pos][$method])) {\n //remove $matched[0] as [1] is the first parameter.\n array_shift($matched);\n\n $this->currentRoute = $curRoute;\n $this->currentVars = $matched;\n\n return $this->getHandlerDetail($this->callbacks[$pos][$method], $matched);\n }\n }\n }\n\n return $this->getHandlerDetail($this->errorCallback, []);\n }", "public function getEndpoint()\n {\n $tokens = ['{endpointName}' => $this->endpointObject->getEndpointName()];\n return $this->parseTokens($this->_endpoint, array_merge($tokens, $this->_tokens));\n }", "public function createHandle($request, $endpoint) {\n $url = $endpoint->getBaseUri().$request->getUri();\n $method = $request->getMethod();\n\n $handler = curl_init();\n curl_setopt($handler, CURLOPT_URL, $url);\n curl_setopt($handler, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($handler, CURLOPT_ENCODING, \"\");\n curl_setopt($handler, CURLOPT_MAXREDIRS, 5);\n curl_setopt($handler, CURLOPT_TIMEOUT, $endpoint->getTimeout());\n curl_setopt($handler, CURLOPT_CONNECTTIMEOUT, $endpoint->getTimeout());\n curl_setopt($handler, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);\n curl_setopt($handler, CURLOPT_POSTFIELDS, \"\");\n curl_setopt($handler, CURLOPT_HTTPHEADER, [\"content-type: application/json\"]);\n\n if($method == Request::METHOD_POST) {\n curl_setopt($handler, CURLOPT_POST, true);\n } elseif ($method == Request::METHOD_GET) {\n curl_setopt($handler, CURLOPT_HTTPGET, true);\n } elseif ($method == Request::METHOD_HEAD) {\n curl_setopt($handler, CURLOPT_CUSTOMREQUEST, 'HEAD');\n } else {\n throw new InvalidArgumentException(\"unsupported method: $method\");\n }\n\n return $handler;\n }", "public function getEndpoint()\n {\n return $this->endpoint;\n }", "public function getEndpoint()\n {\n return $this->endpoint;\n }", "public function getEndpoint()\n {\n return $this->endpoint;\n }", "public function getEndpoint()\n {\n return $this->endpoint;\n }", "public function getEndpoint()\n {\n return $this->endpoint;\n }", "public function getEndpoint()\n {\n return $this->endpoint;\n }", "public static function resolveHandler($command){\n return \\Illuminate\\Bus\\Dispatcher::resolveHandler($command);\n }", "protected function resolveEnumBinding()\n {\n foreach ($this->enums as $name => $class) {\n Route::bind($name, function ($value) use ($class) {\n return $class::from($value);\n });\n }\n }", "protected function ResolveURL() {\n\n\n $Server= $this->GetOption('RequestContext')->SERVER;\n $URL= $Server['REQUEST_URI'];\n\n // expand relative URL\n if (strpos($URL, '://') === false) {\n $SSL= $this->IsSecure();\n $Scheme= $SSL ? 'https' : 'http';\n $Host= $this->GetHost();\n $Port= $this->GetPort();\n $Port= (!$SSL && $Port === 80) || ($SSL && $Port === 443)\n ? ''\n : ':'.$Port;\n $Relative= trim($URL, '/');\n $Relative= ($Relative) ? '/'.$Relative : '';\n $URL= $Scheme.'://'.$Host.$Port.$Relative;\n }\n\n // store URL\n $this->URL= $URL;\n\n // get URL components\n $Parts= parse_url($this->URL);\n if (!is_array($Parts)) {\n $this->Error('Request/ResolveURL: Bad URL ('.$this->URL.').');\n return;\n }\n $Parts += array(\n 'scheme' => 'http',\n 'host' => 'localhost',\n 'port' => $this->IsSecure() ? '443' : '80', // default ports\n 'path' =>'/',\n 'query' => '', // after the question mark (?)\n 'fragment'=> '', // after the hashmark (#)\n 'user' => '',\n 'pass' => '',\n );\n $this->UrlParts= $Parts;\n }", "abstract public function getEndpoints();", "public function handle(ServerRequestInterface $request, $handler, array $vars): ?ResponseInterface;", "public function call( &$env )\n\t{\n\t\t$env_server_name = @$env[ 'SERVER_NAME' ];\n\t\t$env_server_port = @$env[ 'SERVER_PORT' ];\n\t\t$env_path = @$env[ 'PATH_INFO' ];\n\t\t$env_script_name = @$env[ 'SCRIPT_NAME' ];\n\t\t$env_http_host = @$env[ 'HTTP_HOST' ];\n\t\t\n\t\ttry\n\t\t{\n\t\t\tforeach ( $this->mapping as $mapping )\n\t\t\t{\n\t\t\t\tlist( $mapping_host, $mapping_location, $mapping_matcher, $mapping_middleware_app ) = $mapping;\n\t\t\t\t\n\t\t\t\t// All the conditions for which we'd consider the request host as a 'match':\n\t\t\t\t$host_viable = $mapping_host == $env_http_host ||\n\t\t\t\t $env_server_name == $env_http_host ||\n\t\t\t\t ( is_null( $mapping_host ) &&\n\t\t\t\t ( $env_http_host == $env_server_name ||\n\t\t\t\t $env_http_host == $env_server_name.':'.$env_server_port ) );\n\t\t\t\t\n\t\t\t\t// Skip the current entry if none of these strategies evaluate to true:\n\t\t\t\tif ( !$host_viable )\n\t\t\t\t\tcontinue;\n\t\t\t\t\n\t\t\t\t// Each entry has a regex pattern to match against. Check if the request URI matches:\n\t\t\t\tif ( !( preg_match_all( $mapping_matcher, $env_path, $matches ) > 0 ) )\n\t\t\t\t\tcontinue;\n\t\t\t\t\n\t\t\t\t// If the request URI matches, the remainder (i.e. $match[ 1 ]) should start with a '/':\n\t\t\t\tif ( !( empty( $matches[ 1 ][ 0 ] ) || substr( $matches[ 1 ][ 0 ], 0, 1 ) == '/' ) )\n\t\t\t\t\tcontinue;\n\t\t\t\t\n\t\t\t\t// If we got here, we found a matching route. Given:\n\t\t\t\t// a) we're matching against '/admin/panel'\n\t\t\t\t// b) the request URI (minus host) is '/admin/panel/foo'\n\t\t\t\t// This next line will change the environment properties thusly:\n\t\t\t\t// SCRIPT_NAME => '/admin/panel'\n\t\t\t\t// PATH_INFO => '/foo'\n\t\t\t\t// Note that any query string won't make it into PATH_INFO because the web server will put it in QUERY_STRING.\n\t\t\t\t$env = array_merge( $env, array( 'SCRIPT_NAME' => $env_script_name.$mapping_location, 'PATH_INFO' => $matches[ 1 ][ 0 ] ) );\n\t\t\t\t\n\t\t\t\t// Call the middleware the entry refers to, providing it the newly modified environment.\n\t\t\t\t$return = $mapping_middleware_app->call( $env );\n\t\t\t\t\n\t\t\t\t$env = array_merge( $env, array( 'PATH_INFO' => $env_path, 'SCRIPT_NAME' => $env_script_name ) );\n\t\t\t\t\n\t\t\t\treturn $return;\n\t\t\t}\n\t\t\t\n\t\t\tarray_merge( $env, array( 'PATH_INFO' => $env_path, 'SCRIPT_NAME' => $env_script_name ) );\n\t\t\t\n\t\t\treturn array( 404, array( 'Content-Type' => 'text/html', 'X-Cascade' => 'pass' ), array( \"Not Found: {$env_path}\" ) );\n\t\t}\n\t\tcatch ( Exception $e )\n\t\t{\n\t\t\t$env = array_merge( $env, array( 'PATH_INFO' => $env_path, 'SCRIPT_NAME' => $env_script_name ) );\n\t\t\tthrow $e; // Not sure if this is what we want.\n\t\t}\n\t}", "protected function getEndpoint()\n {\n return $this->getTestMode() ? $this->testEndpoint : $this->liveEndpoint;\n }", "public function test_it_is_able_to_resolve_handler_from_laravel_container(): void\n {\n $locator = app('Victormln\\LaravelTactician\\Locator\\LocatorInterface');\n $locator->addHandler('Victormln\\LaravelTactician\\Tests\\Stubs\\TestCommandHandler',\n 'Victormln\\LaravelTactician\\Tests\\Stubs\\TestCommand');\n $handler = $locator->getHandlerForCommand('Victormln\\LaravelTactician\\Tests\\Stubs\\TestCommand');\n $this->assertInstanceOf('Victormln\\LaravelTactician\\Tests\\Stubs\\TestCommandHandler', $handler);\n }", "public function getEndpoint() \n {\n return $this->endpoint;\n }", "public function resolveTarget(UriInterface $uri, $target)\n\t{\n\t\t$scheme = $this->getConnectionType();\n\t\t$uri->withScheme($scheme);\n\t\t$uri->withHost($target);\n\t\t\n\t\t$target = $uri->getUri();\n\t\t\n\t\treturn $target;\n\t}", "public static function get(string $route, string $handler, string $middleware = '');", "public function getRouteResolver(): Closure\n {\n return $this->routeResolver ?: function () {\n //\n };\n }", "public function getHandler();", "public function getHandler();", "abstract function resolve($class);", "protected function endpoint($type) {\n\n // Get the endpoint from the parent.\n $endpoint = parent::endpoint($type);\n\n // For get and set calls, we append \"properties\" to the endpoint.\n if ($this->id && in_array($type, array('get', 'set'))) {\n $endpoint .= '/properties';\n }\n\n // Return the endpoint.\n return $endpoint;\n }", "public function withAddedEndpoint(RouteEndpointInterface $routeEndpoint): RouteInterface;", "public function resolve($method, $uri) {\n $uri = '/'.trim($uri, '/');\n\n $action = $this->routes[$method.$uri]['action'];\n if (isset($action['uses'])) {\n require $action['uses'];\n }\n else {\n array_map('call_user_func', $action);\n }\n }", "public function resolve(Command $command, $handler = null)\n {\n try {\n switch (true) {\n case $command instanceof SelfHandling:\n return $command;\n\n case $handler instanceof Handler:\n return $handler;\n\n case is_string($handler):\n return $this->initClass($handler);\n\n case $handler instanceof Closure:\n return new ClosureHandler($handler);\n\n default:\n $translatedClass = $this->translator->translate($command);\n return $this->initClass($translatedClass);\n }\n } catch (\\Exception $e) {\n // If we made it here, do nothing and let's just throw an exception.\n }\n\n throw new CouldNotResolveHandlerException('Could not locate a handler');\n }" ]
[ "0.62028146", "0.62020904", "0.581338", "0.5774712", "0.5774712", "0.5774712", "0.5741109", "0.56810147", "0.56753063", "0.55393904", "0.5363542", "0.53080195", "0.5270615", "0.5248363", "0.5228355", "0.52201134", "0.5203067", "0.51983386", "0.5197025", "0.5186267", "0.51824015", "0.5170785", "0.51342183", "0.5104833", "0.5101999", "0.5088788", "0.50794035", "0.50685185", "0.50674254", "0.50674254", "0.50674254", "0.50674254", "0.5062334", "0.5055198", "0.5053142", "0.5047501", "0.50469875", "0.5032085", "0.5021439", "0.5020933", "0.50193477", "0.5005654", "0.4992819", "0.49919376", "0.49774393", "0.49669328", "0.49536425", "0.49259928", "0.49196494", "0.49174872", "0.49165028", "0.49155217", "0.4910983", "0.490095", "0.48951626", "0.48919454", "0.4884316", "0.48816526", "0.48812696", "0.48777997", "0.48743293", "0.48697454", "0.48681486", "0.4853326", "0.48508754", "0.48197877", "0.48068953", "0.4802035", "0.4794012", "0.47889698", "0.47824103", "0.4775458", "0.47562507", "0.47537646", "0.4753395", "0.4752388", "0.4752388", "0.4752388", "0.4752388", "0.4752388", "0.4752388", "0.47508606", "0.47501224", "0.47488233", "0.47443828", "0.4742887", "0.47406453", "0.47370365", "0.47357202", "0.47107115", "0.47079146", "0.46949783", "0.4692578", "0.46782875", "0.46782875", "0.4669276", "0.4656424", "0.4652833", "0.46490252", "0.46484506" ]
0.57913405
3
Gets the station ID from name
public function getStationID(string $station_name) { if (substr($station_name, 0, 11) === "TRADE HUB: ") { $station_name = substr($station_name, 11); } $this->db->select('eve_idstation'); $this->db->where('name', $station_name); $query = $this->db->get('station'); if ($query->num_rows() != 0) { $result = $query->row(); } else { $result = false; } return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getIdForName($name, $dbh=null) {\r\n if (is_null($dbh)) $dbh = connect_to_database();\r\n $sql = \"SELECT id FROM stock WHERE LOWER(name) = LOWER('$name')\";\r\n $sth = make_query($dbh, $sql);\r\n $results = get_all_rows($sth);\r\n if ($results) {\r\n return $results[0]['id'];\r\n }\r\n }", "public function getStationName(): string\n {\n return $this->name;\n }", "private function whichStation() {\n\t\t$stations = @file(Flight::get(\"pathStation\"),FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);\n\t\tif (count($stations) >=1 && $stations ) {\n\t\t\t$x = '';\n\t\t\tforeach ($stations as $st) {\n\t\t\t\tif (substr($st,0,1) == '1') {\n\t\t\t\t\t$x = substr($st,1);\n\t\t\t\t\t$x = explode(\" #\",$x);\n\t\t\t\t\t$x = $x[0];\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ($x == '') {$x = Flight::get(\"defaultStation\");}\n\t\t}\n\t\telse $x = (Flight::get(\"defaultStation\"));\n\t\treturn trim($x);\n\t}", "static function getIdOf ($name)\n {\n return array_search ($name, self::$NAMES);\n }", "public function getIDFromName($name) {\n\t\t\n\t\t\t//construct query to grab the user's OSU ID by using their name\n\t\t\t$query = \"SELECT * FROM users WHERE name='\" . $name . \"'\";\n\t\t\t//execute query\n\t\t\t$result = $this->db->query($query);\n\t\t\t\n\t\t\t//get next row of returned results (should only be one row)\n\t\t\t$row = $result->fetch();\n\t\t\t\n\t\t\t//if query failed\n\t\t\tif (!$row) {\n\t\t\t\techo 'Error getting student ID!';\n\t\t\t\treturn FALSE;\n\t\t\t}\n\t\t\t//return name\n\t\t\telse {\n\t\t\t\treturn $row['osuId'];\n\t\t\t}\n\t\t}", "public function getIdentifier()\n {\n $configID = $this->get_config() ? $this->get_config()->ID : 1;\n return ucfirst($this->get_mode()) . \"Site\" . $configID;\n }", "function get_system_id( $dsn, $system_name ) {\n\t$db =& MDB2::factory($dsn);\n\t\n\tif (DB::isError($db)) {\n\t\tdie ($db->getMessage());\n\t}\n\n\t# Get Server_Id\n\t$sql = \"SELECT id FROM systems WHERE name = '\" . $system_name . \"'\";\n\n\treturn $db->queryOne($sql);\n\n}", "public function getIdByName($name) {\n $id = $this->db->queryToSingleValue(\n \t\"select \n \t\tid\n from \n \tOvalSourceDef \n where\n \tname='\".mysql_real_escape_string($name).\"'\");\n if ($id == null) {\n return -1;\n }\n return $id;\n }", "static function findIdByName($name) {\n $campaign = self::findByName($name);\n if (count($campaign)>0) return $campaign['id'];\n return 0;\n }", "function getSoId($so_name)\n\t{\n\t\tglobal $log;\n $log->info(\"in getSoId \".$so_name);\n\t\tglobal $adb;\n\t\tif($so_name != '')\n\t\t{\n\t\t\t$sql = \"select salesorderid from ec_salesorder where subject='\".$so_name.\"'\";\n\t\t\t$result = $adb->query($sql);\n\t\t\t$so_id = $adb->query_result($result,0,\"salesorderid\");\n\t\t}\n\t\treturn $so_id;\n\t}", "function getUniqueId(string $name): string;", "public function id($name)\n {\n return self::$driver->id($name);\n }", "function getArtistID($conn, $name) {\n $query = \"SELECT artist_id FROM artist WHERE artist_name LIKE '${name}'\";\n $result = mysqli_query($conn, $query);\n if ($result) {\n $row = mysqli_fetch_assoc($result);\n return $row['artist_id'];\n } else {\n return 0;\n }\n }", "protected function getIdentifier () {\n\t\n\t\tif (!isset($this->tableName)) {\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\t$parts = explode(\"_\", $this->tableName);\n\t\t$finalPart = $parts[(count($parts) - 1)];\n\t\t\n\t\treturn substr($finalPart, 0, -1).\"ID\";\n\t\n\t}", "public function getSpaceIdByNameFromResponse(string $name): string {\n\t\t$space = $this->getSpaceByNameFromResponse($name);\n\t\tAssert::assertIsArray($space, \"Space with name $name not found\");\n\t\tif (!isset($space[\"id\"])) {\n\t\t\tthrow new Exception(__METHOD__ . \" space with name $name not found\");\n\t\t}\n\t\treturn $space[\"id\"];\n\t}", "public function getId(): string\n {\n return $this->name;\n }", "public function getStationByName($stationName){\n return $this->stationRequest->getStationByName($stationName);\n }", "public function getIdentifier();", "public function getIdentifier();", "public function getIdentifier();", "public function getIdentifier();", "public function getIdentifier();", "public function getIdentifier();", "public function getIdentifier();", "public function getIdentifier();", "public function getIdentifier();", "public function getIdentifier()\n {\n return $this->getAttribute('metadata.name', null);\n }", "public static function class2id($name) {\n $nameWithoutNumber = preg_replace('/\\d/', '', $name);\n if (!ctype_upper($nameWithoutNumber)) {\n $spacedWord = preg_replace('/(?<![A-Z])[A-Z]/', ' \\0', $name);\n $words = explode(' ', trim($spacedWord, ' '));\n $words[0] = strtolower($words[0]);\n $nameID = \"\";\n foreach ($words as $word) {\n $nameID .= $word;\n }\n } else {\n $nameID = $name;\n }\n return $nameID;\n }", "public static function nameToId($name) {\n return DB::queryFirstField(\"SELECT id FROM users WHERE username=%s \", $name);\n }", "public function get_workspace_id($workspace_name){\n \n $this->team->db->select('id');\n $this->team->db->where('name', $workspace_name);\n $workspace_pre = $this->team->db->get('workspaces');\n \n $workspace = $workspace_pre->result();\n \n $workspace_id = 0;\n if($workspace!=null){\n $workspace_id = $workspace[0]->id;\n }\n \n //echo \"END FUNCTION get_workspace_id(workspace_model) Workspaces_model.php<br />\";\n \n return $workspace_id;\n }", "public function getNameID()\n {\n return $this->nameID;\n }", "function getIdentifier();", "function getIdentifier();", "private static function getSiteId($site_name)\n {\n // default to luxurylink, siteId=1\n $site_id = 1;\n\n switch ($site_name) {\n case 'luxurylink':\n $site_id = 1;\n break;\n case 'family':\n $site_id = 2;\n break;\n default:\n $site_id = 1;\n }\n\n return $site_id;\n }", "public function getIdentifier() {}", "public function getIdentifier() {}", "public function getIdentifier() {}", "public function getIdentifier() {}", "public function getIdentifier() {}", "public function getIdentifier() {}", "public function getIdentifier() {}", "public function getIdentifier() {}", "public function nameToId($name)\n {\n // If the username already contains an ampersand, then we don't need to process. \n $pos = strpos($name, '@');\n if ($pos !== false)\n {\n return $name;\n }\n \n $url = 'http://idgettr.com';\n switch ($this->get('params')->get('source'))\n {\n case 'user_photos':\n case 'friend_photos':\n $data = array('photostream' => 'http://www.flickr.com/photos/'.$name);\n break;\n case 'group_photos':\n $data = array('photostream' => 'https://www.flickr.com/groups/'.$name);\n break;\n case 'set_photos':\n $data = array('photostream' => 'https://www.flickr.com/photos/'.$name.'/sets/'.$this->get('params')->get('flickrset'));\n break;\n }\n\n if ($url)\n {\n if (function_exists('curl_init'))\n {\n $useragent = \"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1)\";\n\n $curl_handle = curl_init();\n curl_setopt($curl_handle, CURLOPT_URL, $url);\n curl_setopt($curl_handle, CURLOPT_POST, 1);\n curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $data);\n curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 30);\n curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);\n curl_setopt($curl_handle, CURLOPT_REFERER, 'idgettr.com');\n curl_setopt($curl_handle, CURLOPT_USERAGENT, $useragent);\n $buffer = curl_exec($curl_handle);\n curl_close($curl_handle);\n\n if (!empty($buffer))\n {\n $pos = strpos($buffer, '<p><strong>id:</strong> ');\n if ($pos !== false)\n {\n $pos_start = $pos + 24;\n $pos_end = strpos($buffer, '</p>', $pos_start);\n $length = $pos_end - $pos_start;\n $id = substr($buffer, $pos_start, $length);\n return $id;\n } \n }\n }\n }\n\n\t\treturn false;\n }", "public function getTrainerId($name){\n $query = new Query();\n $sql = \"SELECT trainer_id\n FROM Trainers\n WHERE trainer_name = ?;\";\n //Construct bind parameters\n $bindTypeStr = \"s\"; \n $bindArr = Array($name);\n $query->setAll($sql,$bindTypeStr,$bindArr);\n //Send query to database. Refer to utils/ResultContainer.php for its contents.\n $resultContainer = $query->handleQuery(); \n if (!$resultContainer->isSuccess()){\n $result->setFailure();\n $result->mergeErrorMessages($queryResult); //Retriving errors from model.\n };\n $row = $resultContainer->get_mysqli_result()->fetch_assoc();\n \n\n return $row[\"trainer_id\"];\n }", "private function getServiceId($name)\n {\n return sprintf('%s.%s.%s', $this->prefix, $this->resourceName, $name);\n }", "public function getNameId()\n {\n return $this->nameId;\n }", "protected function getInstanceIdentifierName(): string\n\t{\n\t\treturn (string) $this->getKeyName();\n\t}", "public function getIdentifier()\n {\n return $this->getAttribute($this->identifier);\n }", "function findStationIndex($checkStationName, $dataArray) {\n foreach($dataArray as $key => $station) \n if ($checkStationName == $station[\"stationName\"]) return $key;\n return -1;\n }", "private function getNameAttributeId()\n {\n $attributeId = null;\n $attribute = $this->eavConfig->getAttribute('catalog_category', 'name');\n\n if ($attribute->getAttributeId()) {\n $attributeId = $attribute->getAttributeId();\n }\n\n return $attributeId;\n }", "function _wsdl_docs_get_service_id($name) {\n // Get service ID by service name and url.\n // @todo what happens if there are 2 services with the same name?\n $service_id = db_select('wsclient_service', 'ws')\n ->fields('ws', array('id'))\n ->condition('ws.name', $name)\n ->execute()\n ->fetchField();\n return $service_id;\n}", "public function fetchPharmacyId($name)\n {\n $id = $this->db->runQuery(\"SELECT pharmid FROM Staff WHERE staffName = '$name'\");\n return $id[0]['pharmid'];\n }", "function getArtworkArtistID($conn, $name) {\n $query = \"SELECT artwork_artist_id FROM artwork_artist WHERE artwork_artist_name LIKE '${name}'\";\n $result = mysqli_query($conn, $query);\n if ($result) {\n $row = mysqli_fetch_assoc($result);\n return $row['artwork_artist_id'];\n } else {\n return 0;\n }\n }", "public function getSeriesId($seriename)\n {\n $seriename = urlencode($seriename);\n $url = $this->tvdbapiurl . 'GetSeries.php?seriesname=' . $seriename;\n\n $feed = self::downloadUrl($url);\n $xml = simplexml_load_string($feed);\n\n $node = $xml->Series->seriesid;\n\n if ($node !== null) {\n $serieid = (int) $node;\n\n return $serieid;\n } else {\n return false;\n }\n }", "function getNameFromId($id='') {\n\t\tif(!$id) return '';\n\t\t$result = $this->select('name',\"`store_id` = '\".$this->store_id.\"' AND id = '$id'\");\n\t\tif($result) return $result[0]['name'];\n\t\treturn '';\n\t}", "public function findLocationID($name = false) {\r\n\r\n $query = \"SELECT jn_location_id FROM jn_locations WHERE LOWER(jn_location_name) = ?\";\r\n\r\n #$name = \"'%\" . $name . \"%'\";\r\n $name = strtolower(trim($name));\r\n\r\n return $this->db->fetchOne($query, $name);\r\n }", "protected function GetId() {\n\n $Id= $this->GetOption('Id');\n if (!$Id) {\n $Id= $this->GetName(); // let id be same as name\n $Id= str_replace(array('[',']'),'_', $Id); // id cannot contain '[' and ']'\n $Id= trim($Id, '_'); // id cannot start with '_'\n }\n return $Id;\n }", "private function get_tsuite_id_by_name($name, $parent_id)\r\n {\r\n $debugMsg='Class:' .__CLASS__ . ' - Method:' . __FUNCTION__ . ' :: ';\r\n \r\n if ($parent_id == null || $parent_id <= 0)\r\n {\r\n $msg = $debugMsg . ' FATAL Error $parentNodeID can not null and <= 0';\r\n throw new Exception($msg);\r\n }\r\n \r\n \r\n $sql = \"/* {$debugMsg} */ \" .\r\n \" SELECT NHA.id FROM \" . $this->db_handler->get_table('nodes_hierarchy') . \" NHA \" .\r\n \" WHERE NHA.node_type_id = 2 \" .\r\n \" AND NHA.name = '\" . $this->db_handler->prepare_string($name) . \"'\" .\r\n \" AND NHA.parent_id = \" . $this->db_handler->prepare_int($parent_id);\r\n \r\n $rs = $this->db_handler->get_recordset($sql);\r\n if (isset($rs[0]['id']) && $rs[0]['id'] > 0)\r\n {\r\n return $rs[0]['id'];\r\n }\r\n else \r\n {\r\n return 0;\r\n }\r\n }", "function getIdentifier() ;", "function getIdentifier() ;", "function getIdentifier() ;", "public function getStrId();", "function get_id($table_name, $name, $db) {\n try {\n $sql = \"SELECT id FROM :table WHERE name=:name;\";\n $stmt = $db->prepare($sql);\n $params = array(\"table\" => $table_name,\n \"name\" => $name);\n $stmt->execute($params);\n }\n catch (PDOException $ex) {\n catch_error(\"Failed to get \" . $name . \" from \" . $table_name . \".\", $ex);\n }\n }", "public static function getId(){\n\t\t\n\t\t$serverName = isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : \"unknown\";\n\t\t\n\t\t//added MD5 because IE doesn't like dots I suspect\n\t\treturn md5(\\GO::config()->id.'AT'.$serverName);\n\t}", "static function getnerateIdByName($name)\n\t{\n\t\treturn md5(strtolower($name));\n\t}", "public function getIdByName($name)\n {\n $arr = $this->listing();\n if (!isset($arr[$name])) {\n return false;\n }\n\n return $arr[(string) $name];\n }", "public static function get_id_for_name( $name ) {\n\t\t$names = array(\n\t\t\t'wordpress' => WordPress_Module::MODULE_ID,\n\t\t\t'apache' => Apache_Module::MODULE_ID,\n\t\t\t'nginx' => Nginx_Module::MODULE_ID,\n\t\t);\n\n\t\tif ( isset( $names[ $name ] ) ) {\n\t\t\treturn $names[ $name ];\n\t\t}\n\n\t\treturn false;\n\t}", "abstract public function getIdent();", "function field_name_to_id($name) {\n if (preg_match('/^([^\\[\\]]+)\\[(.*)\\]$/', $name, $matches)) {\n return $matches[1] . '.' . $matches[2];\n } else {\n return $name;\n }\n}", "function get_room_id($name) {\n global $DB;\n\n return $DB->get_record('roomscheduler_rooms', array('name' => $name));\n}", "abstract public function getIdentifier();", "public function readIdByName($name) {\n $query = \"SELECT id FROM $this->tableName WHERE name=?\";\n $statement = ConnectionHandler::getConnection ()->prepare ( $query );\n $statement->bind_param ( 's', $name );\n $statement->execute ();\n $result = $statement->get_result();\n\n $row = $result->fetch_assoc();\n $value = $row['id'];\n\n $result->close();\n\n return $value;\n }", "public abstract function getIdentifier();", "public function getInstanceIdentifier(): string\n\t{\n\t\treturn (string) $this->getKey();\n\t}", "protected function get_station( ) {\n// This function is never called. It is here for completeness of documentation.\n\n if (strlen($this->current_group_text) == 4) {\n $this->wxInfo['STATION'] = $this->current_group_text;\n $this->current_ptr++;\n }\n $this->current_group++;\n }", "function Product_lookup_id_by_name($name) {\n\t// Create call\n\t$call = new xmlrpcmsg('Product.lookup_id_by_name', array(new xmlrpcval($name, \"string\")));\n\n\t// Do call and return value\n\treturn do_call($call);\n}", "function fetchId($name)\n {\n //return $this->_parent->_name.'-'.\"popup-$name[1]\";\n return $this->_parent->getName().'-'.\"popup-$name[1]\";\n }", "protected function getIdentifier()\n {\n if ($this->parameters->scheme === 'unix') {\n return $this->parameters->path;\n }\n\n return \"{$this->parameters->host}:{$this->parameters->port}\";\n }", "function obtenerStationType($identificador)\n{\n\tglobal $database_softPark, $softPark, $mysqli;\n\t#mysql_select_db($database_softPark, $softPark);\n\t$query_consultafuncion = sprintf(\"SELECT stationstype.Name FROM stationstype WHERE id= %s\",$identificador);\n\t$consultafuncion = $mysqli->query($query_consultafuncion) or die(mysqli_error());\n\t$row_consultafuncion = $consultafuncion->fetch_assoc();\n\t#$totalRows_consultafuncion = $row_consultafuncion->num_rows;\n\treturn $row_consultafuncion['Name']; \n\tmysqli_free_result($consultafuncion);\n}", "function findByName($name)\r\n\t{\r\n\t\tglobal $debug;\r\n\t\t$dbh = getOpenedConnection();\r\n\t\t\r\n\t\tif ($dbh == null)\r\n\t\t\treturn;\r\n\t\t\t\r\n\t\t$sql = \"\r\n\t\t\tselect Id\r\n\t\t\tfrom tbl_Pistol_CompetitionDay\r\n\t\t\twhere Name like '$this->Name'\r\n\t\t\";\r\n\t\t\r\n\t\t$result = mysqli_query($dbh,$sql);\r\n\t\tif ($obj = mysqli_fetch_object($result))\r\n\t\t{\r\n\t\t\t$found = $obj->Id;\r\n\t\t}\r\n\r\n\t\tmysqli_free_result($result);\r\n\t\tif ($found != 0) {\r\n\t\t\t$this->load($found);\r\n\t\t}\r\n\t\t\r\n\t\treturn $found;\r\n\t}", "function localIdentifier()\n\t{\n\t\t$id = $this->identifier();\n\t\treturn substr($id,0, strpos($id, '::'));\n\t}", "public function getIdentifier(): string;", "public function getIdentifier(): string;", "public function getStateMachineId();", "public function getSeasonIdAttribute()\n {\n $videoIds = $this->id;\n $seasonName = Season::whereHas('videoSeason', function ($query) use ($videoIds) {\n $query->where('video_id', $videoIds);\n })->select('id')->where('is_active', 1)->first();\n\n return !empty($seasonName) ? $seasonName->id : '';\n }", "public function getIdFromName($name)\n {\n $this->load->model('Semesters');\n $semesterIndex = strpos($name, 'S');\n\n $semesterName = substr($name, $semesterIndex);\n $groupName = substr($name, 0, $semesterIndex);\n\n $semesterId = $this->Semesters->getIdFromName($semesterName);\n\n $res = $this->db\n ->select('idGroup')\n ->from('Group')\n ->where('idSemester', $semesterId)\n ->where('groupName', $groupName)\n ->get()\n ->row();\n\n if (is_null($res)) {\n return FALSE;\n }\n return (int) $res->idGroup;\n }", "public function getSpaceId();", "public function getNodename();", "private function _getCurrentStoreId()\n {\n $storeName = Mage::app()->getRequest()->getParam('store');\n\n if (!$storeName) {\n $website = Mage::app()->getRequest()->getParam('website');\n return $this->_getHelper()->getStoreIdByWebsite($website);\n }\n return $this->_getHelper()->getStoreIdByStoreCode($storeName);\n }", "protected function getIdentifierKey($name)\n {\n if ($position = strpos($name, 'Identifier') . strpos($name, '_identifier') ) {\n return strtolower(substr($name, 0, $position));\n }\n return null;\n }", "public function getStudentId() {\n\t\tpreg_match ( '/\\d{9}/', $this->transcript, $ID ); // this will get the SID of the student\n\n\t\tif (count ( $ID ) > 0) {\n\t\t\t\t\n\t\t\t// $key= mt_rand ( MIN_KEY, MAX_KEY ); // will append a random key to the SI\n\t\t\treturn $ID [0]; // . strval($key);\n\t\t} else\n\t\t\treturn null;\n\t}", "public function getIdentifier() : string\n\t{\n\t\treturn $this->identifier;\n\t}", "public function getIdentifier() : string\n\t{\n\t\treturn $this->identifier;\n\t}", "public static function getIdByName($state)\n {\n }", "function convertNameToID($name) {\n $name = str_replace(\" \",\"-\",$name);\n $name = strtolower($name);\n return $name;\n}", "public function getIdentAttribute()\n {\n $flight_id = $this->airline->code;\n $flight_id .= $this->flight_number;\n\n # TODO: Add in code/leg if set\n\n return $flight_id;\n }", "function getStoreName($store_id) {\n\t\n\t\taddToDebugLog(\"getStoreName(), Function Entry - supplied parameters: Store ID: \" . $store_id . \", INFO\");\n\t\n\t\t$sql = \"SELECT store_name FROM hackcess.store where store_id = \" . $store_id . \";\";\n\t\t$result = search($sql);\n\t\n\t\treturn $result[0][0];\n\t\n\t}", "public function getIdentifierName()\n {\n return $this->identifierName;\n }", "public function forName();", "public function getId()\n {\n return (substr($this->_id, 0, 12));\n }" ]
[ "0.64477944", "0.64183456", "0.6276595", "0.62217396", "0.61974126", "0.5980914", "0.59624326", "0.59511644", "0.5909803", "0.59054863", "0.5901047", "0.5900353", "0.5878598", "0.5853307", "0.58530253", "0.5844175", "0.5843036", "0.5837389", "0.5837389", "0.5837389", "0.5837389", "0.5837389", "0.5837389", "0.5837389", "0.5837389", "0.5837389", "0.58333063", "0.58169496", "0.5813583", "0.5813352", "0.57960004", "0.5777686", "0.5777686", "0.57725996", "0.5762501", "0.5762501", "0.5762481", "0.5762055", "0.5762055", "0.5762055", "0.5762055", "0.5762055", "0.57599854", "0.5759328", "0.5735313", "0.570975", "0.57048404", "0.5704391", "0.5703989", "0.5703706", "0.5697133", "0.5682749", "0.56802934", "0.56699264", "0.56685364", "0.56637883", "0.565856", "0.5638453", "0.5638019", "0.5638013", "0.5638013", "0.5630826", "0.56293505", "0.5603645", "0.56033057", "0.5596021", "0.5586375", "0.55748403", "0.55730563", "0.55692124", "0.5566646", "0.5561335", "0.5561052", "0.5556313", "0.55481035", "0.55473465", "0.5546049", "0.55443186", "0.5539658", "0.5538221", "0.55267525", "0.5517055", "0.5517055", "0.55152273", "0.5510137", "0.5495928", "0.5492761", "0.5480385", "0.5479077", "0.5469148", "0.5467814", "0.54565233", "0.54565233", "0.54479283", "0.5446021", "0.544405", "0.5443959", "0.5436043", "0.5431538", "0.54273146" ]
0.7542614
0
Initialize the price lookup for a stocklist
public function init(string $origin, string $destination, int $buyer, int $seller, string $buy_method, string $sell_method, int $stocklist, int $user_id) { $this->stationFromName = (string) $origin; $this->stationToName = (string) $destination; $this->stationFromID = (int) $this->getStationID($origin)->eve_idstation; $this->stationToID = (int) $this->getStationID($destination)->eve_idstation; $this->characterFrom = (string) $buyer; $this->characterTo = (string) $seller; $this->characterFromName = (string) $this->getCharacterName($buyer); $this->characterToName = (string) $this->getCharacterName($seller); $this->characterFromMethod = (string) $buy_method; $this->characterToMethod = (string) $sell_method; $this->stocklistID = (int) $stocklist; $this->stockListName = (string) $this->getStockListName($stocklist)->name; $CI = &get_instance(); $CI->load->model('Tax_Model'); $this->settings = $this->User->getUserProfitSettings($user_id); $CI->Tax_Model->tax($this->stationFromID, $this->stationToID, $buyer, $seller, $this->settings); $this->transTaxFrom = $CI->Tax_Model->calculateTax('from'); $this->brokerFeeFrom = $CI->Tax_Model->calculateBroker('from'); $this->transTaxTo = $CI->Tax_Model->calculateTax('to'); $this->brokerFeeTo = $CI->Tax_Model->calculateBroker('to'); return $this->generateResults(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function _construct()\r\n {\r\n $this->_init('ss_price', 'price_id');\r\n }", "public function __construct(PriceList $price_list = null)\n {\n $this->price_list = $price_list;\n }", "public function __construct(StockPrice $stockPrice)\n {\n //\n $this->stockPrice = $stockPrice;\n\n }", "function init()\n {\n // the first band.\n $ethFeeSchedule = new FeeScheduleList();\n $ethFeeSchedule->push(new FeeScheduleItem(0.0, 1.0, 0.30, 0.0));\n $ethFeeSchedule->push(new FeeScheduleItem(1.0, 2.5, 0.24, 0.0));\n $ethFeeSchedule->push(new FeeScheduleItem(2.5, 5.0, 0.22, 0.0));\n $ethFeeSchedule->push(new FeeScheduleItem(5.0, 10.0, 0.19, 0.0));\n $ethFeeSchedule->push(new FeeScheduleItem(10.0, 20.0, 0.15, 0.0));\n $ethFeeSchedule->push(new FeeScheduleItem(20.0, INF, 0.10, 0.0));\n\n $pairs = $this->publicQuery('/products');\n foreach($pairs as $pairInfo){\n try{\n $pair = $pairInfo['base_currency'] . $pairInfo['quote_currency'];\n $base = CurrencyPair::Base($pair); //checks the format\n if ($base == Currency::ETH) {\n $this->feeSchedule->addPairFees($pair, $ethFeeSchedule);\n }\n\n $this->supportedPairs[] = mb_strtoupper($pair);\n $this->minOrderSizes[$pair] = $pairInfo['base_min_size'];\n $this->productIds[$pair] = $pairInfo['id'];\n $this->quotePrecisions[$pair] = intval(abs(floor(log10($pairInfo['quote_increment']))));\n }catch(\\Exception $e){}\n }\n }", "public function __construct()\n {\n $this->itemPrices = new ArrayCollection();\n }", "private function getPrices () {\n\t\tlibxml_use_internal_errors(true);\n\t\n\t\t$dom = new DOMDocument();\n\n\t\t@$dom->loadHTML( $this->result );\n\t\t$xpath = new DOMXPath( $dom );\n\t\t\n\t\t$this->prices[] = array(\n\t\t\t'station.from' => $this->getPostField('from.searchTerm'),\n\t\t\t'station.to' => $this->getPostField('to.searchTerm'),\n\t\t\t'station.prices' => $xpath->query($this->config['lookupString'])\n\t\t);\n\t}", "public function __construct(PriceListRepositoryInterface $price_list)\n {\n parent::__construct();\n $this->repository = $price_list;\n $this->repository\n ->pushCriteria(\\Litepie\\Repository\\Criteria\\RequestCriteria::class)\n ->pushCriteria(\\Litecms\\Pricelist\\Repositories\\Criteria\\PriceListResourceCriteria::class);\n }", "public function __construct(StockPrice $stockPrice)\n {\n\n\n\n //\n $belowYForOneMinute = false;\n $this->stockPrice = $stockPrice;\n $this->current_general = StockHelper::getCurrentGeneralPrice($this->stockPrice->tlong);\n if($this->current_general){\n $this->previous_general =StockHelper::getPreviousGeneralPrice($this->current_general['tlong']);\n }\n\n $this->unclosed_orders = StockOrder::where(\"code\", $this->stockPrice->code)\n ->where(\"closed\", \"=\", false)\n ->where(\"order_type\", \"=\", StockOrder::DL0)\n ->where(\"deal_type\", \"=\", StockOrder::SHORT_SELL)\n ->where(\"date\", $this->stockPrice->date)\n ->orderBy(\"tlong\", \"asc\")\n ->get();\n\n $this->previous_order = StockOrder::where(\"code\", $this->stockPrice->code)\n ->where(\"closed\", \"=\", true)\n ->where(\"order_type\", \"=\", StockOrder::DL0)\n ->where(\"deal_type\", \"=\", StockOrder::SHORT_SELL)\n ->where(\"date\", $this->stockPrice->date)\n ->orderByDesc(\"tlong2\")\n ->first();\n\n $range = range($this->stockPrice->tlong - 600, $this->stockPrice->tlong);\n\n if($this->stockPrice->best_bid_price <= $this->stockPrice->yesterday_final)\n $belowYForOneMinute = true;\n\n foreach ($range as $tmp){\n $price = Redis::hgetall(\"Stock:prices#{$this->stockPrice->code}#{$tmp}\");\n\n if($price){\n\n if($price['best_bid_price'] > $price['yesterday_final']){\n $belowYForOneMinute = false;\n }\n\n }\n }\n\n\n\n $this->lowest_updated = Redis::get(\"Stock:lowest_updated#{$this->stockPrice->code}#{$this->stockPrice->date}\") == 1;\n $this->highest_updated = Redis::get(\"Stock:highest_updated#{$this->stockPrice->code}#{$this->stockPrice->date}\") == 1;\n\n $this->previous_price = Redis::hgetall(\"Stock:previousPrice#{$this->stockPrice->code}#{$this->stockPrice->date}\");\n $this->general_start = StockHelper::getGeneralStart($this->stockPrice->date);\n $this->yesterday_final = StockHelper::getYesterdayFinal($this->stockPrice->date);\n\n //$this->lowest_updated = $this->previous_price && $this->previous_price['low'] - $this->stockPrice->low;\n //$this->highest_updated = $this->previous_price && $this->previous_price['high'] < $this->stockPrice->high;\n $this->stock_trend = $this->previous_5_mins_price ? $this->previous_5_mins_price['best_ask_price'] > $this->stockPrice->best_ask_price ? \"DOWN\" : \"UP\" : false;\n\n $this->high_range = $this->stockPrice->yesterday_final > 0 ? (($this->stockPrice->high - $this->stockPrice->yesterday_final)/$this->stockPrice->yesterday_final)*100 : 0;\n $this->low_range = $this->stockPrice->yesterday_final > 0 ? (($this->stockPrice->low - $this->stockPrice->yesterday_final)/$this->stockPrice->yesterday_final)*100 : 0;\n\n $this->high_was_great = $this->high_range > 2;\n $this->low_was_great = $this->low_range < -2;\n\n /**\n * Analyze stock price\n */\n $time_since_previous_order = 0;\n if($this->previous_order){\n $time_since_previous_order = ($this->stockPrice->tlong - $this->previous_order->tlong2) / 1000 / 60;\n }\n\n $date = new DateTime();\n $date->setDate($this->stockPrice->stock_time[\"year\"], $this->stockPrice->stock_time[\"mon\"], $this->stockPrice->stock_time[\"mday\"]);\n $date->setTime(9, 0, 0);\n $this->time_since_begin = ($this->stockPrice->tlong / 1000 - $date->getTimestamp()) / 60;\n\n\n if(1\n && ($this->stockPrice->stock_time['hours'] < 13 || ($this->stockPrice->stock_time['hours'] == 13 && $this->stockPrice->stock_time['minutes'] < 10))\n && $this->lowest_updated\n //&& $this->stockPrice->open > $this->stockPrice->yesterday_final\n /*&& count($this->unclosed_orders) < 2\n && $belowYForOneMinute\n && $this->time_since_begin > 1*/\n && !$this->previous_order\n #&& ($time_since_previous_order == 0 || $time_since_previous_order > 5 )\n ){\n $this->should_sell = true;\n\n }\n $this->should_sell_another = false;\n }", "public function getListPrice()\n {\n return 0;\n }", "public function getListPrice()\n {\n return 0;\n }", "public function __construct()\n {\n $this->stocks = Stock::all();\n }", "public function getPrices()\n {\n }", "public function __construct() \n\t{\n\t\t$strSqlModel = \n\t\t'SELECT cat.*, prd.* \n\t\tFROM \n\t\t(\n\t\t\t(\n\t\t\t\t(\n\t\t\t\t\t(\n\t\t\t\t\t\tproducts prd INNER JOIN categories cat ON (prd.prd_cat_id = cat.cat_id)\n\t\t\t\t\t) INNER JOIN prices pri ON (prd.prd_id = pri.pri_prd_id)\n\t\t\t\t) INNER JOIN countries cnt ON (pri.pri_cnt_id = cnt.cnt_id)\n\t\t\t) INNER JOIN currencies cur ON (cnt.cnt_cur_id = cur.cur_id)\n\t\t)\n\t\tINNER JOIN stocks stk ON (prd.prd_id = stk.stk_prd_id) \n\t\t'.CONF_TAG_LIST_SQL_CRITERIA.' \n\t\tGROUP BY prd.prd_id \n\t\tORDER BY cat.cat_id ASC, prd.prd_id ASC \n\t\t'.CONF_TAG_LIST_SQL_LIMIT.'';\n\t\t\n\t\t$intPageNbRow = CONF_LIST_PAGE_COUNT_ROW_PROD;\n\t\t\n\t\t$tabCritOperation = array();\n\t\t$tabCritOperation['cur_id'] = \"(cur.cur_id = \".CONF_TAG_LIST_SQL_OPE_VALUE.\")\";\n\t\t\n\t\tparent::__construct($strSqlModel, $tabCritOperation, $intPageNbRow);\n\t}", "function GetPrice($symbol)\n{\n\t//google finance can only handle up to 100 quotes at a time so split up query then merge results\n\tif(count($symbol) > 100)\n\t{\n\t\t$retArr = array();\n\t\tfor($j=0; $j< count($symbol); $j +=100)\n\t\t{\n\t\t\t$arr = LookUpWithFormattedString(FormatString(array_slice($symbol, $j, 100)));\n\t\t\t$retArr = array_merge($retArr, $arr);\n\t\t}\n\t\treturn $retArr;\n\t}\n\telse\n\t\treturn LookUpWithFormattedString(FormatString($symbol));\n}", "public function getTickerPrice($symbol = NULL);", "protected function findPrice()\n\t{\n\t\trequire_once(TL_ROOT . '/system/modules/isotope/providers/ProductPriceFinder.php');\n\n\t\t$arrPrice = ProductPriceFinder::findPrice($this);\n\n\t\t$this->arrData['price'] = $arrPrice['price'];\n\t\t$this->arrData['tax_class'] = $arrPrice['tax_class'];\n\t\t$this->arrCache['from_price'] = $arrPrice['from_price'];\n\t\t$this->arrCache['minimum_quantity'] = $arrPrice['min'];\n\n\t\t// Add \"price_tiers\" to attributes, so the field is available in the template\n\t\tif ($this->hasAdvancedPrices())\n\t\t{\n\t\t\t$this->arrAttributes[] = 'price_tiers';\n\n\t\t\t// Add \"price_tiers\" to variant attributes, so the field is updated through ajax\n\t\t\tif ($this->hasVariantPrices())\n\t\t\t{\n\t\t\t\t$this->arrVariantAttributes[] = 'price_tiers';\n\t\t\t}\n\n\t\t\t$this->arrCache['price_tiers'] = $arrPrice['price_tiers'];\n\t\t}\n\t}", "public function __construct($price, $currency)\n {\n $this->price = $price;\n $this->currency = $currency;\n }", "protected function calculatePrices()\n {\n }", "public function __construct($price, array $items) {\n $this->price = $price;\n // this is really creating a hashset, from the passed in array.\n foreach ($items as $item) {\n $this->items[$item] = $item;\n }\n }", "public function setListPrice(float $listPrice)\n\t{\n\t\t$this->addKeyValue('list_price', $listPrice); \n\n\t}", "function get_price_object() {\r\n\t\t$price_obj = array (\r\n\t\t\t\t\"Currency\" => false,\r\n\t\t\t\t\"TotalDisplayFare\" => 0,\r\n\t\t\t\t\"PriceBreakup\" => array (\r\n\t\t\t\t\t\t'BasicFare' => 0,\r\n\t\t\t\t\t\t'Tax' => 0,\r\n\t\t\t\t\t\t'AgentCommission' => 0,\r\n\t\t\t\t\t\t'AgentTdsOnCommision' => 0\r\n\t\t\t\t) \r\n\t\t);\r\n\t\treturn $price_obj;\r\n\t}", "public function getListPrice()\n\t{\n\t\treturn $this->getKeyValue('list_price'); \n\n\t}", "public function updateprices()\n {\n\n $aParams = oxRegistry::getConfig()->getRequestParameter(\"updateval\");\n if (is_array($aParams)) {\n foreach ($aParams as $soxId => $aStockParams) {\n $this->addprice($soxId, $aStockParams);\n }\n }\n }", "public function initShoppingCarts()\n\t{\n\t\t$this->collShoppingCarts = array();\n\t}", "public function __construct($laundress, $price)\n {\n $this->laundress = $laundress;\n $this->price = $price;\n }", "public function __construct(Stock $stock)\n {\n $this->stock = $stock;\n }", "public static function init() {\r\n\t\tif( class_exists( 'WC_Name_Your_Price_Helpers' ) ) {\r\n\t\t\tadd_filter( 'woocommerce_cart_id', array( __CLASS__, 'force_sold_individually' ), 10, 5 );\r\n\t\t}\r\n\t}", "public function __construct(float $price)\n {\n $this->price = $price;\n }", "public function resolvePrice();", "function __construct($id, $label, $price, $nbSame, $listProvConcern){\n \n parent::__construct($id, $label, $price);\n $this->nbSame = $nbSame;\n // $this->provInfo = $this->getProvInfo();\n // $this->totalPrice = $this->getTotalPrice();\n \n \n }", "public function initOffensives()\n\t{\n\t\t$this->collOffensives = array();\n\t}", "public function getAllList_Price()\n {\n try\n {\n // Создаем новый запрс\n $db = $this->getDbo();\n $query = $db->getQuery(true);\n\n $query->select('a.*');\n $query->from('`#__gm_ceiling_components_option` AS a');\n $query->select('CONCAT( component.title , \\' \\', a.title ) AS full_name');\n $query->select('component.id AS component_id');\n $query->select('component.title AS component_title');\n $query->select('component.unit AS component_unit');\n $query->join('RIGHT', '`#__gm_ceiling_components` AS component ON a.component_id = component.id');\n\n $db->setQuery($query);\n $return = $db->loadObjectList();\n return $return;\n }\n catch(Exception $e)\n {\n Gm_ceilingHelpersGm_ceiling::add_error_in_log($e->getMessage(), __FILE__, __FUNCTION__, func_get_args());\n }\n }", "function builder_price() {\n\n $this->Item->recursive = 0;\n\n if( !isset($this->params['named']['limit']) ) {\n $this->paginate['limit'] = REPORT_LIMIT;\n $this->paginate['maxLimit'] = REPORT_LIMIT;\n }\n elseif( isset($this->params['named']['limit']) && $this->params['named']['limit'] != 'All' ) {\n $this->paginate['limit'] = isset($this->params['named']['limit']) ? $this->params['named']['limit'] : REPORT_LIMIT;\n $this->paginate['maxLimit'] = isset($this->params['named']['limit']) ? $this->params['named']['limit'] : REPORT_LIMIT;\n }\n else {\n $this->paginate['limit'] = 0;\n $this->paginate['maxLimit'] = 0;\n }\n $this->Prg->commonProcess();\n $this->paginate['conditions'] = $this->Item->parseCriteria($this->passedArgs);\n $this->paginate['conditions']['Item.base_item']['base_item'] = 0;\n\n $items = $this->paginate();\n $paginate = true;\n $legend = \"Items\";\n\n $this->set(compact('items', 'paginate', 'legend'));\n }", "public function __construct()\n {\n $this->productList = new ProductList();\n }", "protected function _construct()\n {\n $this->_init(CarrierModel::RATE_TABLE_NAME, 'rate_id');\n }", "public function init()\n\t{\n\t\t$this->dictionary = new Dictionary($this->iblockId);\n\t\t$this->storage = new Storage($this->iblockId);\n\t\tif (self::$catalog === null)\n\t\t{\n\t\t\tself::$catalog = \\Bitrix\\Main\\Loader::includeModule(\"catalog\");\n\t\t}\n\n\t\tif (self::$catalog)\n\t\t{\n\t\t\t$catalog = \\CCatalogSKU::getInfoByProductIBlock($this->iblockId);\n\t\t\tif (!empty($catalog) && is_array($catalog))\n\t\t\t{\n\t\t\t\t$this->skuIblockId = $catalog[\"IBLOCK_ID\"];\n\t\t\t\t$this->skuPropertyId = $catalog[\"SKU_PROPERTY_ID\"];\n\t\t\t}\n\t\t}\n\t}", "function setItem_price($price){\n $this->item_price = $price;\n }", "public function __construct()\n {\n $this->_cash = array ( 1 => 25, 2 => 74, 5 => 14, 10 => 18, 20 => 0, 50 => 5, 100 => 30, 200 => 15, 500 => 8, 1000 => 11, 2000 => 8, 5000 => 5, 10000 => 2, 20000 => 0, 50000 => 0 );\n;\n }", "function init() {\r\n\r\n\t\t\tadd_filter( 'woocommerce_get_settings_pages', array( &$this, 'settings_tfls' ) );\r\n\r\n\t\t\t// Add wholesale price field to product\r\n\t\t\tadd_action( 'woocommerce_product_options_general_product_data', array(\r\n\t\t\t\t&$this,\r\n\t\t\t\t'product_options_wholesale_price'\r\n\t\t\t));\r\n\r\n\t\t\t// Save wholesale prices\r\n\t\t\tadd_action( 'woocommerce_process_product_meta', array(\r\n\t\t\t\t&$this,\r\n\t\t\t\t'process_product_simple_wholesale_price'\r\n\t\t\t));\r\n\r\n\t\t\t// Add international and wholesale prices to products\r\n\t\t\tadd_action( 'woocommerce_product_options_general_product_data', array(\r\n\t\t\t\t&$this,\r\n\t\t\t\t'product_options_countries_prices'\r\n\t\t\t) );\r\n\r\n\t\t\tadd_action( 'woocommerce_process_product_meta_simple', array(\r\n\t\t\t\t&$this,\r\n\t\t\t\t'process_product_simple_countries_prices'\r\n\t\t\t) );\r\n\r\n\t\t\tif ( WC()->version < '2.3' ) {\r\n\t\t\t\t//Deprecated\r\n\t\t\t\tadd_action( 'woocommerce_product_after_variable_attributes', array(\r\n\t\t\t\t\t&$this,\r\n\t\t\t\t\t'product_variable_attributes_countries_prices_wc2_2'\r\n\t\t\t\t), 10, 3 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tadd_action( 'woocommerce_product_after_variable_attributes', array(\r\n\t\t\t\t\t&$this,\r\n\t\t\t\t\t'product_variable_attributes_countries_prices'\r\n\t\t\t\t), 10, 3 );\r\n\t\t\t}\r\n\r\n\r\n\t\t\tadd_action( 'woocommerce_process_product_meta_variable', array(\r\n\t\t\t\t&$this,\r\n\t\t\t\t'process_product_variable_countries_prices'\r\n\t\t\t) );\r\n\r\n\t\t\tadd_action( 'woocommerce_save_product_variation', array(\r\n\t\t\t\t&$this,\r\n\t\t\t\t'save_product_variation_countries_prices'\r\n\t\t\t), 10, 2 );\r\n\r\n\t\t\tadd_filter( 'woocommerce_currency', array( &$this, 'order_currency' ) );\r\n\r\n\t\t\tadd_action( 'admin_notices', array( &$this, 'check_database_file' ) );\r\n\r\n\t\t}", "function getAllRates($interval) {\n\n\t\tforeach ( $this->lConf['productDetails'] as $uid => $val ) {\n\t\t\t// get all prices for given UID and given dates\n\t\t\t$this->lConf['productDetails'][$uid]['prices'] = tx_abbooking_div::getPrices($uid, $interval);\n\t\t}\n\n\t\treturn 0;\n\t}", "function initialise_classified_listing(&$row)\n{\n $free_days = $GLOBALS['SITE_DB']->query_select_value_if_there('classifieds_prices', 'MAX(c_days)', array(\n 'c_catalogue_name' => $row['c_name'],\n 'c_price' => 0.0,\n ));\n $row['ce_last_moved'] = $row['ce_add_date'];\n if (!is_null($free_days)) {\n $row['ce_last_moved'] += $free_days * 60 * 60 * 24;\n }\n $GLOBALS['SITE_DB']->query_update('catalogue_entries', array('ce_last_moved' => $row['ce_last_moved']), array('id' => $row['id']), '', 1);\n}", "public function newstock()\n {\n for ($i=0; $i<=6; $i++) {\n for ($j=0; $j<=$i; $j++) {\n $stock[] = [$i,$j];\n }\n }\n $this->stock = $stock;\n }", "function __construct() {\n parent::__construct('stocks_held', 'id');\n }", "public function __construct($_sKU = NULL,$_startPrice = NULL,$_quantity = NULL,$_variationSpecifics = NULL,$_quantitySold = NULL,$_sellingStatus = NULL,$_discountPriceInfo = NULL,$_any = NULL)\r\n\t{\r\n\t\tparent::__construct(array('SKU'=>$_sKU,'StartPrice'=>$_startPrice,'Quantity'=>$_quantity,'VariationSpecifics'=>($_variationSpecifics instanceof EbayShoppingStructNameValueListArrayType)?$_variationSpecifics:new EbayShoppingStructNameValueListArrayType($_variationSpecifics),'QuantitySold'=>$_quantitySold,'SellingStatus'=>$_sellingStatus,'DiscountPriceInfo'=>$_discountPriceInfo,'any'=>$_any));\r\n\t}", "public function __construct(\n GetSkuListInStock $getSkuListInStockToUpdate,\n IndexStructureInterface $indexStructureHandler,\n IndexHandlerInterface $indexHandler,\n IndexDataBySkuListProvider $indexDataBySkuListProvider,\n IndexNameBuilder $indexNameBuilder,\n StockIndexer $stockIndexer,\n DefaultStockProviderInterface $defaultStockProvider\n ) {\n $this->getSkuListInStock = $getSkuListInStockToUpdate;\n $this->indexStructure = $indexStructureHandler;\n $this->indexHandler = $indexHandler;\n $this->indexDataBySkuListProvider = $indexDataBySkuListProvider;\n $this->indexNameBuilder = $indexNameBuilder;\n $this->stockIndexer = $stockIndexer;\n $this->defaultStockProvider = $defaultStockProvider;\n }", "public function init()\n {\n // Validate config\n $required = ['host', 'client_key', 'client_secret'];\n foreach ($required as $current) {\n if (!isset($this->config['Catalog'][$current])) {\n throw new ILSException(\"Missing Catalog/{$current} config setting.\");\n }\n }\n\n $this->validHoldStatuses\n = !empty($this->config['Holds']['valid_hold_statuses'])\n ? explode(':', $this->config['Holds']['valid_hold_statuses'])\n : [];\n\n $this->itemHoldsEnabled\n = isset($this->config['Holds']['enableItemHolds'])\n ? $this->config['Holds']['enableItemHolds'] : true;\n\n $this->itemHoldExcludedItemCodes\n = !empty($this->config['Holds']['item_hold_excluded_item_codes'])\n ? explode(':', $this->config['Holds']['item_hold_excluded_item_codes'])\n : [];\n\n $this->titleHoldBibLevels\n = !empty($this->config['Holds']['title_hold_bib_levels'])\n ? explode(':', $this->config['Holds']['title_hold_bib_levels'])\n : ['a', 'b', 'm', 'd'];\n\n $this->defaultPickUpLocation\n = isset($this->config['Holds']['defaultPickUpLocation'])\n ? $this->config['Holds']['defaultPickUpLocation']\n : '';\n if ($this->defaultPickUpLocation === 'user-selected') {\n $this->defaultPickUpLocation = false;\n }\n\n if (!empty($this->config['ItemStatusMappings'])) {\n $this->itemStatusMappings = array_merge(\n $this->itemStatusMappings, $this->config['ItemStatusMappings']\n );\n }\n\n // Init session cache for session-specific data\n $namespace = md5(\n $this->config['Catalog']['host'] . '|'\n . $this->config['Catalog']['client_key']\n );\n $factory = $this->sessionFactory;\n $this->sessionCache = $factory($namespace);\n }", "public function organique_price_filter_init() {\n\t\t\t\tif ( is_active_widget( false, false, 'organique_price_filter', true ) && ! is_admin() ) {\n\n\t\t\t\t\t$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';\n\n\t\t\t\t\twp_register_script( 'wc-price-slider', WC()->plugin_url() . '/assets/js/frontend/price-slider' . $suffix . '.js', array( 'jquery-ui-slider' ), WC_VERSION, true );\n\n\t\t\t\t\twp_localize_script( 'wc-price-slider', 'woocommerce_price_slider_params', array(\n\t\t\t\t\t\t'currency_symbol' => get_woocommerce_currency_symbol(),\n\t\t\t\t\t\t'currency_pos' => get_option( 'woocommerce_currency_pos' ),\n\t\t\t\t\t\t'min_price' => isset( $_GET['min_price'] ) ? esc_attr( $_GET['min_price'] ) : '',\n\t\t\t\t\t\t'max_price' => isset( $_GET['max_price'] ) ? esc_attr( $_GET['max_price'] ) : ''\n\t\t\t\t\t) );\n\n\t\t\t\t\tadd_filter( 'loop_shop_post_in', array( $this, 'price_filter' ) );\n\t\t\t\t}\n\t\t\t}", "public function ajaxGetPriceList()\n\t{\n\t\tJSession::checkToken() or JSession::checkToken('get') or jexit(JText::_('JINVALID_TOKEN'));\n\n\t\t$tickettypeId = JRequest::getVar('tickettype_id', 0);\n\t\t$departureCityId = JRequest::getVar('selected_departure_city_id', 0);\n\n\t\tif (!$tickettypeId || !$departureCityId)\n\t\t{\n\t\t\texit();\n\t\t}\n\n\t\t$modelTicketType = CkJModel::getInstance('tickettype', 'PapiersdefamillesModel');\n\t\t$ticketType = $modelTicketType->getItem($tickettypeId);\n\n\t\tif (empty($ticketType->pricelist))\n\t\t{\n\t\t\techo \"0\";\n\t\t\texit();\n\t\t}\n\n\t\tif (!empty($ticketType->pricelist))\n\t\t{\n\t\t\t$priceList = json_decode($ticketType->pricelist);\n\n\t\t\t$priceFilterArr = array_filter(\n\t\t\t\t$priceList,\n\t\t\t\tfunction ($e) use ($departureCityId) {\n\t\t\t\t\treturn ($e->departure_city_id == $departureCityId);\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tif (empty($priceFilterArr))\n\t\t\t{\n\t\t\t\techo \"0\";\n\t\t\t\texit();\n\t\t\t}\n\n\t\t\t$config = JFactory::getConfig();\n\t\t\t$fromname = $config->get('offset');\n\t\t\tdate_default_timezone_set($fromname);\n\n\t\t\t$now = date('Y-m-d');\n\t\t\t$nowDay = date('d');\n\t\t\t$nowMonth = date('m');\n\t\t\t//$nowYear = date('Y');\n\t\t\t$months = PapiersdefamillesHelperEnum::_('pricelists_month_id');\n\n\n\t\t\t// Find min price\n\t\t\tif (!empty($priceFilterArr) && isset($priceFilterArr[0]))\n\t\t\t{\n\t\t\t\t$min = ($nowDay < 16) ? $priceFilterArr[0]->price_1 : $priceFilterArr[0]->price_2;\n\n\t\t\t\tforeach ($priceFilterArr as $item)\n\t\t\t\t{\n\t\t\t\t\tif ($item->month_id)\n\t\t\t\t\t{\n\t\t\t\t\t\t$price = ($nowDay < 16) ? $item->price_1 : $item->price_2;\n\n\t\t\t\t\t\tif ($price < $min) $min = $price;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Render pricelist\n\t\t\t$html = '<div class=\"pricelist-table\">';\n\n\n\t\t\tforeach ($priceFilterArr as $item)\n\t\t\t{\n\t\t\t\t$class = (intval($item->month_id) === intval($nowMonth)) ? ' active' : '';\n\n\t\t\t\tif ($item->month_id)\n\t\t\t\t{\n\t\t\t\t\t$price = $item->price_2;\n\n\t\t\t\t\tif ($nowDay < 16) $price = $item->price_1;\n\t\t\t\t\tif (isset($min) && $min == $price) $class .= ' min_price';\n\n\t\t\t\t\t$html .= '<div class=\"pricelist-item ribbon' . $class . '\">';\n\t\t\t\t\t$html .= '<span class=\"month\">' . $months[$item->month_id]['text'] . '</span>';\n\t\t\t\t\t$html .= '<span class=\"year\">.' . $item->year . '</span>';\n\t\t\t\t\t$html .= '<span class=\"position-right\">';\n\t\t\t\t\t$html .= '<span class=\"price\">' . $price . '</span>';\n\t\t\t\t\t$html .= '<span class=\"currency\">€</span>';\n\t\t\t\t\t$html .= '<span class=\"last\">TTC/<sub>pers</sub></span>';\n\t\t\t\t\t$html .= '</span>';\n\t\t\t\t\t$html .= '</div>';\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!empty($priceFilterArr) && isset($priceFilterArr[0]))\n\t\t\t{\n\t\t\t\t$html .= '<p class=\"note\">' . JText::_('PAPIERSDEFAMILLES_TEXT_NOTICE_PRICE_BOOKING') . '</p>';\n\t\t\t}\n\n\t\t\t$html .= '</div>';\n\n\n\t\t\techo $html;\n\t\t}\n\n\t\texit();\n\t}", "function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('DBO_Prices',$k,$v); }", "public function init() {\n\t\t$this->store_url = 'https://getblocklab.com';\n\t\t$this->product_slug = 'block-lab-pro';\n\t}", "protected function loadRates()\n {\n $currencyPairs = ['eurgbp', 'eurusd', 'gbpjpy', 'usdjpy'];\n\n foreach ($currencyPairs as $pair) {\n $pairObject = CurrencyPair::fromString($pair);\n $aRandomValue = mt_rand() / mt_getrandmax();\n $this->currencyRate[$pair] = new CurrencyRate($pairObject, $aRandomValue);\n }\n\n }", "function findsPrPosPriceList($pricelist)\n{\n\t$data['from'] = 'prpos';\n\t$data['select'] = 'ID, ARTNR, LST_NR, POS_0_WERT';\n\t$addWhere = \"\n\t\tLST_NR = '\" . $pricelist . \"'\";\n\treturn SQLSelect($data['from'], $data['select'], $addWhere, 0, 0, 0, 'shop', __FILE__, __LINE__);\n}", "public function __construct($tools, $stock)\n {\n parent::__construct();\n if ($stock == 'true') {\n if (!$result = $this->db->query(\"SELECT * FROM `product` LEFT JOIN `category` \n ON `category`.`id` = `product`.`category`\n WHERE `category`.`name` = '$tools' \n AND `product`.`stock_quantity` > 0;\")) {\n throw new \\mysqli_sql_exception($this->db->error, $this->db->errno);\n }\n $this->productIds = array_column($result->fetch_all(), 0);\n $this->N = $result->num_rows;\n } else {\n if (!$result = $this->db->query(\"SELECT * FROM `product` LEFT JOIN `category` \n ON `category`.`id` = `product`.`category`\n WHERE `category`.`name` = '$tools';\")) {\n throw new \\mysqli_sql_exception($this->db->error, $this->db->errno);\n }\n $this->productIds = array_column($result->fetch_all(), 0);\n $this->N = $result->num_rows;\n }\n }", "public function __construct()\n {\n $exchange_rates = new ExchangeRatesService();\n\n $res = $exchange_rates->get('EUR');\n if($res->getStatusCode() === 200)\n $this->eur_data = json_decode( $res->getBody() );\n \n $res = $exchange_rates->get('USD');\n if($res->getStatusCode() === 200)\n $this->usd_data = json_decode( $res->getBody() );\n\n $res = $exchange_rates->get('GBP');\n if($res->getStatusCode() === 200)\n $this->gbp_data = json_decode( $res->getBody() );\n\n $res = $exchange_rates->get('RUB');\n if($res->getStatusCode() === 200)\n $this->rub_data = json_decode( $res->getBody() );\n }", "public function loadStockData(){\n if (JeproshopTools::isLoadedObject($this, 'product_id')){\n // By default, the product quantity correspond to the available quantity to sell in the current shop\n $this->quantity = JeproshopStockAvailableModelStockAvailable::getQuantityAvailableByProduct($this->product_id, 0);\n $this->out_of_stock = JeproshopStockAvailableModelStockAvailable::outOfStock($this->product_id);\n $this->depends_on_stock = JeproshopStockAvailableModelStockAvailable::dependsOnStock($this->product_id);\n if (JeproshopContext::getContext()->shop->getShopContext() == JeproshopShopModelShop::CONTEXT_GROUP && JeproshopContext::getContext()->shop->getContextShopGroup()->share_stock == 1){\n $this->advanced_stock_management = $this->useAdvancedStockManagement();\n }\n }\n }", "function initialize() {\n $this->_configure = $this->config->item('biz_listing_configure');\n $this->_pagination = $this->config->item('pagination');\n $this->_validation = $this->config->item('biz_listing_validation');\n }", "public function init()\n {\n\n // initialize the prepared statements\n $this->addFinder($this->finderFactory->createFinder($this, SqlStatementKeys::PRODUCT_VARCHARS));\n $this->addFinder($this->finderFactory->createFinder($this, SqlStatementKeys::PRODUCT_VARCHARS_BY_PK_AND_STORE_ID));\n $this->addFinder($this->finderFactory->createFinder($this, SqlStatementKeys::PRODUCT_VARCHAR_BY_ATTRIBUTE_CODE_AND_ENTITY_TYPE_ID_AND_STORE_ID));\n $this->addFinder($this->finderFactory->createFinder($this, SqlStatementKeys::PRODUCT_VARCHAR_BY_ATTRIBUTE_CODE_AND_ENTITY_TYPE_ID_AND_STORE_ID_AND_VALUE));\n $this->addFinder($this->finderFactory->createFinder($this, SqlStatementKeys::PRODUCT_VARCHAR_BY_ATTRIBUTE_CODE_AND_ENTITY_TYPE_ID_AND_STORE_ID_AND_PK));\n }", "function addListPrice($request) {\n\t\t$sourceModule = $request->getModule();\n\t\t$sourceRecordId = $request->get('src_record');\n\t\t$relatedModule = $request->get('related_module');\n\t\t$relInfos = $request->get('relinfo');\n\n\t\t$sourceModuleModel = Vtiger_Module_Model::getInstance($sourceModule);\n\t\t$relatedModuleModel = Vtiger_Module_Model::getInstance($relatedModule);\n\t\t$relationModel = Vtiger_Relation_Model::getInstance($sourceModuleModel, $relatedModuleModel);\n\t\tforeach($relInfos as $relInfo) {\n\t\t\t$price = CurrencyField::convertToDBFormat($relInfo['price'], null, true);\n\t\t\t$relationModel->addListPrice($sourceRecordId, $relInfo['id'], $price);\n\t\t}\n\t}", "public function init() {\n\n $listingtype_id = $this->_getParam('listingtype_id', null);\n if (Engine_Api::_()->getDbtable('modules', 'core')->isModuleEnabled('sitereviewpaidlisting')) {\n //FOR UPDATE EXPIRATION\n if ((Engine_Api::_()->getApi('settings', 'core')->getSetting('sitereviewpaidlisting.task.updateexpiredlistings') + 900) <= time()) {\n Engine_Api::_()->sitereviewpaidlisting()->updateExpiredListings($listingtype_id);\n }\n }\n }", "function _set_stock_info(&$data)\n\t{\n\t\tforeach ($this->cart->contents() as $item)\n\t\t{\n\t\t\t$prod_id = $item['id'];\n\t\t\t$product = $this->database->GetProductById($prod_id);\n\n\t\t\t//Check stock and set stock info\n\t\t\t$data['products'][$item['rowid'].'stock_state'] = $this->_set_stock_state($product, $item);\n\n\t\t\t$data['products'][$prod_id] = $product;\n\t\t}\n\t}", "private function initialiseChoices()\n {\n // Fetch a vendor key if possible, to cache against\n try {\n $vendorKey = $this->systemBrandService->getVendorCredentials()['vendorKey'];\n }\n catch (\\Exception $e) {\n $vendorKey = 'defaultVendor';\n }\n\n if (null !== $this->rentGuaranteeOfferingType && null !== $this->propertyLettingType && ! $this->isInitialised) {\n\n $cacheKey = sprintf(\n 'Lookup-Product-Collection-%s-%s-%s',\n $this->rentGuaranteeOfferingType,\n $this->propertyLettingType,\n $vendorKey\n );\n $productCollection = $this->cache->fetch($cacheKey);\n\n $this->values = array();\n $this->choices = array();\n\n if ( ! $productCollection) {\n $productCollection = $this->entityManager->find(new ProductCollection(), array(\n 'rentGuaranteeOfferingType' => $this->rentGuaranteeOfferingType,\n 'propertyLettingType' => $this->propertyLettingType,\n ));\n\n $this->cache->save($cacheKey, $productCollection);\n }\n\n /** @var \\Barbon\\HostedApi\\AppBundle\\Form\\Common\\Model\\Product $product */\n foreach ($productCollection as $product) {\n $this->values[] = (string) $product->getProductId();\n $this->choices[] = (string) $product->getProductId(); //$product->getName();\n $this->labels[] = (string) $product->getName();\n }\n\n $this->isInitialised = true;\n return $productCollection;\n }\n \n return null;\n }", "abstract function getPriceFromAPI($pair);", "function pricesAction(){\n\t $this->_helper->layout->disableLayout();\n\t $this->_helper->viewRenderer->setNoRender(TRUE);\n\t \n \t// $session = SessionWrapper::getInstance();\n \t$formvalues = $this->_getAllParams();\n \t// debugMessage($formvalues);\n \t\n \t$where_query = \"\";\n \t$bundled = true;\n \t$commodityquery = false;\n \tif(count($formvalues) == 3){\n \t\techo \"NULL_PARAMETER_LIST\";\n \t\texit();\n \t}\n \tif(isArrayKeyAnEmptyString('commodity', $formvalues) && isArrayKeyAnEmptyString('commodityid', $formvalues) && $this->_getParam('range') != 'all'){\n \t\techo \"COMMODITY_NULL\";\n \t\texit();\n \t}\n \t# commodity query\n \tif((!isArrayKeyAnEmptyString('commodityid', $formvalues) || !isArrayKeyAnEmptyString('commodity', $formvalues)) && $this->_getParam('range') != 'all'){\n \t\t$com = new Commodity();\n \t\t// commodityid specified\n \t\tif(!isEmptyString($this->_getParam('commodityid'))){\n\t \t\t$com->populate($formvalues['commodityid']);\n\t \t\t// debugMessage($com->toArray());\n\t \t\tif(isEmptyString($com->getID()) || !is_numeric($formvalues['commodityid'])){\n\t \t\t\techo \"COMMODITY_INVALID\";\n\t \t\t\texit();\n\t \t\t}\n\t \t\t$comid = $formvalues['commodityid'];\n\t \t\t$where_query .= \" AND d.commodityid = '\".$comid.\"' \";\n \t\t}\n \t\t// commodty name specified\n \t\tif(!isEmptyString($this->_getParam('commodity'))){\n \t\t\t$searchstring = $formvalues['commodity'];\n \t\t\t$islist = false;\n\t \t\tif(strpos($searchstring, ',') !== false) {\n\t\t\t\t\t$islist = true;\n\t\t\t\t}\n\t\t\t\tif(!$islist){\n\t \t\t\t$comid = $com->findByName($searchstring);\n\t \t\t\t$comid_count = count($comid);\n\t \t\t\tif($comid_count == 0){\n\t\t \t\t\techo \"COMMODITY_INVALID\";\n\t\t \t\t\texit();\n\t\t \t\t}\n\t\t \t\tif($comid_count == 1){\n\t\t \t\t\t$where_query .= \" AND d.commodityid = '\".$comid[0]['id'].\"' \";\n\t\t \t\t}\n\t \t\t\tif($comid_count > 1){\n\t \t\t\t\t$ids_array = array();\n\t \t\t\t\tforeach ($comid as $value){\n\t \t\t\t\t\t$ids_array[] = $value['id'];\n\t \t\t\t\t}\n\t \t\t\t\t$ids_list = implode($ids_array, \"','\");\n\t \t\t\t\t// debugMessage($ids_list);\n\t\t \t\t\t$where_query .= \" AND d.commodityid IN('\".$ids_list.\"') \";\n\t\t \t\t}\n\t\t\t\t}\n\t\t\t\tif($islist){\n\t\t\t\t\t$bundled = false;\n\t\t\t\t\t$searchstring = trim($searchstring);\n\t\t\t\t\t$seach_array = explode(',', $searchstring);\n\t\t\t\t\t// debugMessage($seach_array);\n\t\t\t\t\tif(is_array($seach_array)){\n\t\t\t\t\t\t$ids_array = array();\n\t\t\t\t\t\tforeach ($seach_array as $string){\n\t\t\t\t\t\t\t$com = new Commodity();\n\t\t\t\t\t\t\t$comid = $com->findByName($string);\n\t \t\t\t\t\t$comid_count = count($comid);\n\t\t\t\t\t\t\tif($comid_count > 0){\n\t\t\t \t\t\t\tforeach ($comid as $value){\n\t\t\t \t\t\t\t\t$ids_array[] = $value['id'];\n\t\t\t \t\t\t\t}\n\t\t\t\t \t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(count($ids_array) > 0){\n\t\t\t\t\t\t\t$ids_list = implode($ids_array, \"','\");\n\t\t\t \t\t\t// debugMessage($ids_list);\n\t\t\t\t \t\t$where_query .= \" AND d.commodityid IN('\".$ids_list.\"') \";\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\techo \"COMMODITY_LIST_INVALID\";\n\t\t \t\t\t\texit();\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\techo \"COMMODITY_LIST_INVALID\";\n\t\t \t\t\texit();\n\t\t\t\t\t}\n\t\t\t\t}\n \t\t}\n\t \t\t\n \t\t$commodityquery = true;\n \t\tif($this->_getParam('unbundled') == '1'){\n \t\t\t$bundled = false;\n \t\t}\n \t\t\n \t}\n \t# markets query\n \t$marketquery = false;\n \t\tif(!isArrayKeyAnEmptyString('marketid', $formvalues) || !isArrayKeyAnEmptyString('market', $formvalues)){\n \t\t\t$market = new PriceSource();\n \t\t\tif(!isEmptyString($this->_getParam('marketid'))){\n\t \t\t$market->populate($formvalues['marketid']);\n\t \t\t// debugMessage($market->toArray());\n\t \t\tif(isEmptyString($market->getID()) || !is_numeric($formvalues['marketid'])){\n\t \t\t\techo \"MARKET_INVALID\";\n\t \t\t\texit();\n\t \t\t}\n\t \t\t$makid = $formvalues['marketid'];\n \t\t\t}\n \t\t\tif(!isEmptyString($this->_getParam('market'))){\n \t\t\t\t$makid = $market->findByName($formvalues['market']);\n \t\t\tif(isEmptyString($makid)){\n\t \t\t\techo \"MARKET_INVALID\";\n\t \t\t\texit();\n\t \t\t}\n \t\t\t}\n \t\t$marketquery = true;\n \t\t$where_query .= \" AND d.sourceid = '\".$makid.\"' \";\n \t}\n \t# district query\n \t$districtquery = false;\n \tif(!isArrayKeyAnEmptyString('districtid', $formvalues) || !isArrayKeyAnEmptyString('district', $formvalues)){\n \t\t\t$district = new District();\n \t\t\tif(!isArrayKeyAnEmptyString('districtid', $formvalues)){\n\t \t\t$district->populate($formvalues['districtid']);\n\t \t\t// debugMessage($market->toArray());\n\t \t\tif(isEmptyString($district->getID()) || !is_numeric($formvalues['districtid'])){\n\t \t\t\techo \"DISTRICT_INVALID\";\n\t \t\t\texit();\n\t \t\t}\n\t \t\t$distid = $formvalues['districtid'];\n \t\t\t}\n \t\t\tif(!isArrayKeyAnEmptyString('district', $formvalues)){\n \t\t\t\t$distid = $district->findByName($formvalues['district'], 2);\n \t\t\tif(isEmptyString($distid)){\n\t \t\t\techo \"DISTRICT_INVALID\";\n\t \t\t\texit();\n\t \t\t}\n \t\t\t}\n \t\t$districtquery = true;\n \t\tif($this->_getParam('unbundled') == '1'){\n \t\t\t$bundled = false;\n \t\t}\n \t\t$where_query .= \" AND d2.districtid = '\".$distid.\"' \";\n \t}\n \t# region query \n \t$regionquery = false;\n \tif(!isArrayKeyAnEmptyString('regionid', $formvalues) || !isArrayKeyAnEmptyString('region', $formvalues)){\n \t\t\t$region = new Region();\n \t\t\tif(!isArrayKeyAnEmptyString('regionid', $formvalues)){\n\t \t\t$region->populate($formvalues['regionid']);\n\t \t\t// debugMessage(region->toArray());\n\t \t\tif(isEmptyString($region->getID()) || !is_numeric($formvalues['regionid'])){\n\t \t\t\techo \"REGION_INVALID\";\n\t \t\t\texit();\n\t \t\t}\n\t \t\t$regid = $formvalues['regionid'];\n \t\t\t}\n \t\tif(!isEmptyString($this->_getParam('region'))){\n \t\t\t\t$regid = $region->findByName($formvalues['region'], 1);\n \t\t\tif(isEmptyString($regid)){\n\t \t\t\techo \"REGION_INVALID\";\n\t \t\t\texit();\n\t \t\t}\n \t\t\t}\n \t\t$regionquery = true;\n \t\t$bundled = true;\n \t\tif($this->_getParam('unbundled') == '1'){\n \t\t\t$bundled = false;\n \t\t}\n \t\t$where_query .= \" AND d2.regionid = '\".$regid.\"' \";\n \t}\n \t# all prices query\n \t$allpricesquery = false;\n \tif(!isArrayKeyAnEmptyString('range', $formvalues) && $this->_getParam('range') == 'all'){\n \t\t$allpricesquery = true;\n \t}\n \t// debugMessage($where_query); // exit();\n \t\t\n \t$conn = Doctrine_Manager::connection(); \n \t$query = \"SELECT \n\t\t\t\t\td2.regionid as regionid,\n\t\t\t\t\td2.region as region,\n\t\t\t\t\td2.districtid as districtid,\n\t\t\t\t\td2.district as district,\n \t\t\t\td.datecollected as date, \n\t\t\t\t\tREPLACE(d2.name,' Market','')as market,\n\t\t\t\t\td.sourceid as marketid,\n\t\t\t\t\tc.name as commodity,\n\t\t\t\t\td.commodityid as commodityid,\n\t\t\t\t\tcu.name as unit,\n\t\t\t\t\td.retailprice AS retailprice, \n\t\t\t\t\td.wholesaleprice AS wholesaleprice\n\t\t\t\t\tFROM commoditypricedetails AS d \n\t\t\t\t\tINNER JOIN commodity AS c ON (d.`commodityid` = c.id)\n\t\t\t\t\tLEFT JOIN commodityunit AS cu ON (c.unitid = cu.id)\n\t\t\t\t\tINNER JOIN (\n\t\t\t\t\tSELECT cp.sourceid,\n\t\t\t\t\tp.locationid as districtid,\n\t\t\t\t\tl.name as district,\n\t\t\t\t\tl.regionid as regionid, \n\t\t\t\t\tr.name as region, \n\t\t\t\t\tMAX(cp.datecollected) AS datecollected, \n\t\t\t\t\tp.name FROM commoditypricedetails cp \n\t\t\t\t\tINNER JOIN commoditypricesubmission AS cs1 ON (cp.`submissionid` = cs1.`id` \n\t\t\t\t\tAND cs1.`status` = 'Approved') \n\t\t\t\t\tINNER JOIN pricesource AS p ON (cp.sourceid = p.id AND p.`applicationtype` = 0 )\n\t\t\t\t\tINNER JOIN location AS l ON (p.locationid = l.id AND l.locationtype = 2)\n\t\t\t\t\tINNER JOIN location AS r ON (l.regionid = r.id AND r.locationtype = 1)\n\t\t\t\t\tWHERE cp.`pricecategoryid` = 2 GROUP BY cp.sourceid) AS d2 \n\t\t\t\t\tON (d.`sourceid` = d2.sourceid AND d.`datecollected` = d2.datecollected) \n\t\t\t\t\tWHERE d.`pricecategoryid` = 2 AND d.retailprice > 0 AND d.wholesaleprice > 0 AND date(d.datecollected) >= date(now()-interval 60 day) \".$where_query.\" ORDER BY d2.name\";\n \t\n \t// debugMessage($query);\n \t$result = $conn->fetchAll($query);\n \t$pricecount = count($result);\n \t// debugMessage($result); \n \t// exit();\n \tif($pricecount == 0){\n \t\techo \"RESULT_NULL\";\n \t} else {\n \t\t$feed = '';\n \t\t# format commodity output\n \t\tif($commodityquery && !$marketquery && !$districtquery){\n \t\t\t$feed = '';\n \t\t\tif(!$bundled){\n\t\t\t \tforeach ($result as $line){\n\t\t\t\t \t$feed .= '<item>';\n\t\t\t \t\t$feed .= '<region>'.$line['region'].'</region>';\n\t\t\t \t\t$feed .= '<regionid>'.$line['regionid'].'</regionid>';\n\t\t\t\t \t$feed .= '<district>'.$line['district'].'</district>';\n\t\t\t\t \t$feed .= '<districtid>'.$line['districtid'].'</districtid>';\n\t\t\t\t \t$feed .= '<market>'.$line['market'].'</market>';\n\t\t\t\t \t$feed .= '<marketid>'.$line['marketid'].'</marketid>';\n\t\t\t\t \t$feed .= '<commodity>'.$line['commodity'].'</commodity>';\n\t\t\t\t \t$feed .= '<commodityid>'.$line['commodityid'].'</commodityid>';\n\t\t\t\t \t$feed .= '<unit>' .$line['unit'].'</unit>';\n\t\t\t\t \t$feed .= '<datecollected>'.$line['date'].'</datecollected>';\n\t\t\t\t \t$feed .= '<retailprice>'.$line['retailprice'].'</retailprice>';\n\t\t\t\t\t $feed .= '<wholesaleprice>'.$line['wholesaleprice'].'</wholesaleprice>';\n\t\t\t\t\t $feed .= '</item>';\n\t\t\t \t}\n \t\t\t} else {\n \t\t\t\t$total_rp = 0;\n \t\t\t\t$total_wp = 0;\n \t\t\t\tforeach ($result as $line){\n \t\t\t\t\t$total_rp += $line['retailprice'];\n \t\t\t\t\t$total_wp += $line['wholesaleprice'];\n \t\t\t\t}\n \t\t\t\t$avg_rp = $total_rp/$pricecount;\n \t\t\t\t$avg_rp = ceil($avg_rp / 50) * 50;\n \t\t\t\t$avg_wp = $total_wp/$pricecount;\n \t\t\t\t$avg_wp = ceil($avg_wp / 50) * 50;\n \t\t\t\t\n \t\t\t\t$feed .= '<item>';\n\t\t\t\t \t$feed .= '<commodity>'.$result[0]['commodity'].'</commodity>';\n\t\t\t\t \t$feed .= '<commodityid>'.$result[0]['commodityid'].'</commodityid>';\n\t\t\t\t \t$feed .= '<unit>' .$result[0]['unit'].'</unit>';\n\t\t\t\t \t$feed .= '<datecollected>'.$result[0]['date'].'</datecollected>';\n\t\t\t\t \t$feed .= '<retailprice>'.$avg_rp.'</retailprice>';\n\t\t\t\t $feed .= '<wholesaleprice>'.$avg_wp.'</wholesaleprice>';\n\t\t\t\t $feed .= '<unbundled>1</unbundled>';\n\t\t\t\t $feed .= '</item>';\n \t\t\t}\n \t\t}\n \t\t# format market output\n \t\tif($marketquery){\n \t\t\t$feed = '';\n\t \t\tforeach ($result as $line){\n\t\t\t \t$feed .= '<item>';\n\t\t\t \t$feed .= '<region>'.$line['region'].'</region>';\n\t\t\t \t$feed .= '<regionid>'.$line['regionid'].'</regionid>';\n\t\t\t \t$feed .= '<district>'.$line['district'].'</district>';\n\t\t\t \t$feed .= '<districtid>'.$line['districtid'].'</districtid>';\n\t\t\t \t$feed .= '<market>'.$line['market'].'</market>';\n\t\t\t \t$feed .= '<marketid>'.$line['marketid'].'</marketid>';\n\t\t\t \t$feed .= '<commodity>'.$line['commodity'].'</commodity>';\n\t\t\t \t$feed .= '<commodityid>'.$line['commodityid'].'</commodityid>';\n\t\t\t \t$feed .= '<unit>' .$line['unit'].'</unit>';\n\t\t\t \t$feed .= '<datecollected>'.$line['date'].'</datecollected>';\n\t\t\t \t$feed .= '<retailprice>'.$line['retailprice'].'</retailprice>';\n\t\t\t\t $feed .= '<wholesaleprice>'.$line['wholesaleprice'].'</wholesaleprice>';\n\t\t\t\t $feed .= '</item>';\n\t \t\t}\n \t\t}\n \t\t# format region output\n \t\tif($districtquery){\n \t\t\t$feed = '';\n \t\t\tif(!$bundled){\n\t\t\t \tforeach ($result as $line){\n\t\t\t\t \t$feed .= '<item>';\n\t\t \t\t\t$feed .= '<region>'.$line['region'].'</region>';\n\t\t \t\t\t$feed .= '<regionid>'.$line['regionid'].'</regionid>';\n\t\t\t\t \t$feed .= '<district>'.$line['district'].'</district>';\n\t\t\t\t \t$feed .= '<districtid>'.$line['districtid'].'</districtid>';\n\t\t\t \t\t$feed .= '<market>'.$line['market'].'</market>';\n\t\t\t \t\t$feed .= '<marketid>'.$line['marketid'].'</marketid>';\n\t\t\t\t \t$feed .= '<commodity>'.$line['commodity'].'</commodity>';\n\t\t\t\t \t$feed .= '<commodityid>'.$line['commodityid'].'</commodityid>';\n\t\t\t\t \t$feed .= '<unit>' .$line['unit'].'</unit>';\n\t\t\t\t \t$feed .= '<datecollected>'.$line['date'].'</datecollected>';\n\t\t\t\t \t$feed .= '<retailprice>'.$line['retailprice'].'</retailprice>';\n\t\t\t\t\t $feed .= '<wholesaleprice>'.$line['wholesaleprice'].'</wholesaleprice>';\n\t\t\t\t\t $feed .= '</item>';\n\t\t\t \t}\n \t\t\t} else {\n \t\t\t\t$total_rp = 0;\n \t\t\t\t$total_wp = 0;\n \t\t\t\tforeach ($result as $line){\n \t\t\t\t\t$total_rp += $line['retailprice'];\n \t\t\t\t\t$total_wp += $line['wholesaleprice'];\n \t\t\t\t}\n \t\t\t\t$avg_rp = $total_rp/$pricecount;\n \t\t\t\t$avg_rp = ceil($avg_rp / 50) * 50;\n \t\t\t\t$avg_wp = $total_wp/$pricecount;\n \t\t\t\t$avg_wp = ceil($avg_wp / 50) * 50;\n \t\t\t\t\t\n \t\t\t\t$feed .= '<item>';\n\t\t\t \t$feed .= '<region>'.$result[0]['region'].'</region>';\n\t\t\t \t$feed .= '<regionid>'.$result[0]['regionid'].'</regionid>';\n\t\t\t\t $feed .= '<district>'.$result[0]['district'].'</district>';\n\t\t\t\t $feed .= '<districtid>'.$result[0]['districtid'].'</districtid>';\n\t\t\t\t $feed .= '<commodity>'.$result[0]['commodity'].'</commodity>';\n\t\t\t\t $feed .= '<commodityid>'.$result[0]['commodityid'].'</commodityid>';\n\t\t\t\t $feed .= '<unit>' .$result[0]['unit'].'</unit>';\n\t\t\t\t $feed .= '<datecollected>'.$result[0]['date'].'</datecollected>';\n\t\t\t\t $feed .= '<retailprice>'.$avg_rp.'</retailprice>';\n\t\t\t\t\t$feed .= '<wholesaleprice>'.$avg_wp.'</wholesaleprice>';\n\t\t\t\t\t$feed .= '<unbundled>1</unbundled>';\n\t\t\t\t\t$feed .= '</item>';\n \t\t\t}\n \t\t}\n \t\t# format region output\n \t\tif($regionquery){\n \t\t\t$feed = '';\n \t\t\tif(!$bundled){\n\t\t\t \tforeach ($result as $line){\n\t\t\t\t\t $feed .= '<item>';\n\t\t\t \t\t$feed .= '<region>'.$line['region'].'</region>';\n\t\t\t \t\t$feed .= '<regionid>'.$line['regionid'].'</regionid>';\n\t\t\t\t\t $feed .= '<district>'.$line['district'].'</district>';\n\t\t\t\t\t $feed .= '<districtid>'.$line['districtid'].'</districtid>';\n\t\t\t\t \t$feed .= '<market>'.$line['market'].'</market>';\n\t\t\t\t \t$feed .= '<marketid>'.$line['marketid'].'</marketid>';\n\t\t\t\t\t $feed .= '<commodity>'.$line['commodity'].'</commodity>';\n\t\t\t\t\t $feed .= '<commodityid>'.$line['commodityid'].'</commodityid>';\n\t\t\t\t\t $feed .= '<unit>' .$line['unit'].'</unit>';\n\t\t\t\t\t $feed .= '<datecollected>'.$line['date'].'</datecollected>';\n\t\t\t\t\t $feed .= '<retailprice>'.$line['retailprice'].'</retailprice>';\n\t\t\t\t\t\t$feed .= '<wholesaleprice>'.$line['wholesaleprice'].'</wholesaleprice>';\n\t\t\t\t\t\t$feed .= '</item>';\n\t\t\t \t}\n \t\t\t} else {\n \t\t\t\t$total_rp = 0;\n \t\t\t\t$total_wp = 0;\n \t\t\t\tforeach ($result as $line){\n \t\t\t\t\t$total_rp += $line['retailprice'];\n \t\t\t\t\t$total_wp += $line['wholesaleprice'];\n \t\t\t\t}\n \t\t\t\t$avg_rp = $total_rp/$pricecount;\n \t\t\t\t$avg_rp = ceil($avg_rp / 50) * 50;\n \t\t\t\t$avg_wp = $total_wp/$pricecount;\n \t\t\t\t$avg_wp = ceil($avg_wp / 50) * 50;\n \t\t\t\t\n \t\t\t\t$feed .= '<item>';\n\t\t\t \t$feed .= '<region>'.$result[0]['region'].'</region>';\n\t\t\t \t$feed .= '<regionid>'.$result[0]['regionid'].'</regionid>';\n\t\t\t\t $feed .= '<commodity>'.$result[0]['commodity'].'</commodity>';\n\t\t\t\t $feed .= '<commodityid>'.$result[0]['commodityid'].'</commodityid>';\n\t\t\t\t $feed .= '<unit>' .$result[0]['unit'].'</unit>';\n\t\t\t\t $feed .= '<datecollected>'.$result[0]['date'].'</datecollected>';\n\t\t\t\t $feed .= '<retailprice>'.$avg_rp.'</retailprice>';\n\t\t\t\t\t$feed .= '<wholesaleprice>'.$avg_wp.'</wholesaleprice>';\n\t\t\t\t\t$feed .= '<unbundled>1</unbundled>';\n\t\t\t\t\t$feed .= '</item>';\n \t\t\t}\n \t\t}\n \t\t# format all prices output\n \t\tif($allpricesquery){\n \t\t\t$feed = '';\n \t\t\tforeach ($result as $line){\n\t\t\t \t$feed .= '<item>';\n\t\t\t \t$feed .= '<region>'.$line['region'].'</region>';\n\t\t\t \t$feed .= '<regionid>'.$line['regionid'].'</regionid>';\n\t\t\t \t$feed .= '<district>'.$line['district'].'</district>';\n\t\t\t \t$feed .= '<districtid>'.$line['districtid'].'</districtid>';\n\t\t \t\t$feed .= '<market>'.$line['market'].'</market>';\n\t\t \t\t$feed .= '<marketid>'.$line['marketid'].'</marketid>';\n\t\t\t \t$feed .= '<commodity>'.$line['commodity'].'</commodity>';\n\t\t\t \t$feed .= '<commodityid>'.$line['commodityid'].'</commodityid>';\n\t\t\t \t$feed .= '<unit>' .$line['unit'].'</unit>';\n\t\t\t \t$feed .= '<datecollected>'.$line['date'].'</datecollected>';\n\t\t\t \t$feed .= '<retailprice>'.$line['retailprice'].'</retailprice>';\n\t\t\t\t $feed .= '<wholesaleprice>'.$line['wholesaleprice'].'</wholesaleprice>';\n\t\t\t\t $feed .= '</item>';\n\t \t\t}\n \t\t}\n \t\t\n \t\t# output the xml returned\n \t\tif(isEmptyString($feed)){\n \t\t\techo \"EXCEPTION_ERROR\";\n \t\t} else {\n \t\t\techo '<?xml version=\"1.0\" encoding=\"UTF-8\"?><items>'.$feed.'</items>';\n \t\t}\n\t }\n }", "function initSpCost(){\r\n\t$SP_Cost = 0;\r\n}", "public function initData()\n {\n $this->appliedNumberingData = array();\n $this->currHyperlink = null;\n }", "public function getStock();", "public function api_update_price(){\n $watchlists = $this->wr->all();\n foreach($watchlists as $watchlist)\n {\n $current_price = $this->get_quotes($watchlist->id);\n\n $this->wr->update([\n 'current_price' => $current_price,\n ],$watchlist->id);\n }\n }", "public function getPrices(Collection $currencies)\n {\n $currencies = $currencies\n ->pluck('id', 'currency_code')\n ->map(function($id){\n return [\n 'id' => $id,\n 'currency_id' => null\n ];\n })->toArray();\n\n // add currencyIds\n foreach($this->currencyIds() as $currencyCode => $currencyID){\n if($currencies[$currencyCode]) {\n $currencies[$currencyCode]['currency_id'] = $currencyID;\n }\n }\n\n\n // exchangeRate\n $exchangeRate = $this->getExchangeRate();\n\n\n // make api call\n $version = '';\n $url = $this->apiBase . $version . '/public/ticker/ALL';\n $res = null;\n\n try{\n $res = Http::request(Http::GET, $url);\n }\n catch (\\Exception $e){\n // Error handling\n echo($e->getMessage());\n exit();\n }\n\n\n // data from API\n $data = [];\n $dataOriginal = json_decode($res->content, true);\n $data = $dataOriginal['data'];\n\n\n // Finalize data. [id, currency_id, price]\n $currencies = array_map(function($currency) use($data, $exchangeRate){\n $dataAvailable = true;\n if(is_array($currency['currency_id'])){\n foreach($currency['currency_id'] as $i){\n if(!isset($data[$i])){\n $dataAvailable = false;\n }\n }\n } else {\n $dataAvailable = isset($data[$currency['currency_id']]);\n }\n\n\n if($dataAvailable){\n if(is_array($currency['currency_id'])){ // 2 step\n $level1 = doubleval($data[$currency['currency_id'][0]]['closing_price']) / $exchangeRate;\n $level2 = doubleval($data[$currency['currency_id'][1]]['closing_price']) / $exchangeRate;\n $currency['price'] = $level1 * $level2;\n }\n else { // 1 step: string\n $currency['price'] = doubleval($data[$currency['currency_id']]['closing_price']) / $exchangeRate;\n }\n\n }\n else {\n $currency['price'] = null;\n }\n\n return $currency;\n\n }, $currencies);\n\n\n return $currencies;\n\n\n }", "public function __construct(\n Template\\Context $context,\n //registry is where Magento keeps the current \n //product when the page is loaded \n //used for getProduct()\n Registry $registry, \n\n //stockregistry is where stock data is stored\n //used for getQty()\n StockRegistryInterface $stockRegistry,\n array $data = []\n )\n {\n parent::__construct($context, $data);\n $this->registry = $registry;\n $this->stockRegistry = $stockRegistry;\n }", "public function __construct() \n {\n $this->_supplyOrderList = array();\n $this->_errorList = array();\n\n }", "protected function init()\r\n {\r\n $this->table_name = 'libelles';\r\n $this->table_type = 'system';\r\n $this->table_gateway_alias = 'Sbm\\Db\\SysTableGateway\\Libelles';\r\n $this->id_name = array(\r\n 'nature',\r\n 'code'\r\n );\r\n }", "protected function convertPriceList() {\n\t\t$retArray =array();\n\t\t\n\t\tforeach ($this->DetailPriceList as $name => $nameValue) {\n\t\t\t$description = '';\n\t\t\t$unit = '';\n\t\t\t$price = 0;\n\t\t\t$avgPrice = 0;\n\t\t\tif (is_array($nameValue)) {\n\t\t\t\tforeach ($nameValue as $desc => $prices) {\n\t\t\t\t\tif (is_array($prices)) {\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$price = $nameValue;\n\t\t\t\t$avgPrice = $price;\n\t\t\t}\n\t\t\t$retArray[] = array($name,$description, $unit,$price, $avgPrice );\n\t\t}\n\t}", "public function __construct()\n\t{\n\t\t$this->srs = Supplier::srs();\n\n\t\tparent::__construct();\n\t}", "public function initOpenids()\n\t{\n\t\t$this->collOpenids = array();\n\t}", "private static function initAvailableProduct($rule, $sku_id, $params = array())\n {\n if (!isset(self::$available_products[$sku_id][$rule['id']]) || (isset(self::$available_products[$sku_id][$rule['id']]) && !isset(self::$available_products[$sku_id][$rule['id']]['quantity']))) {\n self::$available_products[$sku_id][$rule['id']] = array(\n 'quantity' => 0,\n 'discount' => 0,\n 'affiliate' => 0,\n );\n // Если у данного товара не было скидок, и мы были вынуждены проверить его из-за опции \n // \"Отображать доступные скидки для товаров, которые удовлетворяют условиям\", ставим флаг, что для данного товара можно не просчитывать\n // скидки. Вывод скидок следует регулировать в типах отображения\n if (!empty($params['prod_meet_cond'])) {\n self::$available_products[$sku_id][$rule['id']]['without_discount'] = 1;\n }\n }\n self::$available_products[$sku_id][$rule['id']]['rule'] = array(\n \"id\" => $rule['id'],\n \"sort\" => $rule['frontend_sort'],\n \"name\" => $rule['name'] ? $rule['name'] : _wp(\"Discount #\") . $rule['id'],\n \"description\" => $rule['description'] ? $rule['description'] : '',\n \"code\" => $rule['code'],\n \"discount\" => !empty($rule['discount']) ? shop_currency($rule['discount'], !empty($rule['discount_currency']) ? $rule['discount_currency'] : wa('shop')->getConfig()->getCurrency(true), wa('shop')->getConfig()->getCurrency(false), false) : 0,\n \"discount_percentage\" => !empty($rule['discount_percentage']) ? $rule['discount_percentage'] : 0,\n \"affiliate\" => !empty($rule['affiliate']) ? $rule['affiliate'] : 0,\n \"affiliate_percentage\" => !empty($rule['affiliate_percentage']) ? $rule['affiliate_percentage'] : 0\n );\n }", "abstract public function getPrice();", "public function __construct($_host, $_user, $_pw, $_db, $_prices) {\n $this->_host = $_host;\n $this->_user = $_user;\n $this->_pw = $_pw;\n $this->_db = $_db;\n\n $this->_conn = $this->_DBConnection();\n\n if($_prices === 'on') {\n $this->_prices = $this->getAllPrices();\n }\n }", "protected function initialize()\n {\n $this->data = new stdClass();\n $this->data->ownId = null;\n $this->data->amount = new stdClass();\n $this->data->amount->currency = self::AMOUNT_CURRENCY;\n $this->data->amount->subtotals = new stdClass();\n $this->data->items = [];\n $this->data->receivers = [];\n }", "function __construct($parent){\n\n parent::__construct($parent);\n \n // Workaround - older php versions can't have string concatination in \"static\" \n $this->list_quering['s_rate'] .= ' ('.trim(CONST_currency).')';\n\n // Initialise if needed\n if ( @$_GET['drop_list_once'] == $this->ID) bList::deleteList($this->ID,True);\n if ((@$_GET['init_list_once'] === 'yes') || $this->parent_ID == myOrg_ID) $this->init();\n \n // Set flag \"Recalculate the travel estimate if the rates are changed\" \n if ($this->myPost_bList()) $this->set_flagToBeUpdated();\n\n // Sanity\n if ($this->parent_ID != myOrg_ID) $this->list_showing['_s_plc'] = 'Yes / No';\n }", "function __construct($tkr, $entry_date, $open, $high, $low, $close, $vol, $adj_close) {\n\t\t\t$this->tkr = $tkr;\n\t\t\t$this->entry_date = $entry_date;\n\t\t\t$this->open = $open;\n\t\t\t$this->high = $high;\n\t\t\t$this->low = $low;\n\t\t\t$this->close = $close;\n\t\t\t$this->vol = $vol;\n\t\t\t$this->adj_close = $adj_close;\n\t\t\t\n\t\t\t$tkr_qry = sprintf(\"SELECT * FROM %s WHERE ticker='%s'\", TKR_TBL, $this->tkr);\n\t\t\tif (!mysql_ping()) {\n\t\t\t\t$con = connect();\n\t\t\t\t}\n\t\t\t$result = mysql_query($tkr_qry);\n\t\t\tif (!$result) {\n\t\t\t\tdie(\"ERROR: Could not get ticker ID: \" . mysql_error());\n\t\t\t\t}\n\t\t\telse {\n\t\t\t\t$data = mysql_fetch_row($result);\n\t\t\t\t$this->tkr_id = $data[0];\n\t\t\t\t}\n\t\t\t}", "public function __construct(StockCollection $vehicles)\n {\n $this->vehicles = $vehicles;\n }", "public function pricing() { \n $data['page'] = 'Pricing';\n $data['page_title'] = 'Pricing';\n $data['page_module'] = 'setting';\n $price_list= $this->Setting_Model-> getPurchaseTransactionById($this->session->userdata('user_id'));\n for($i=0;$i<count($price_list);$i++){\n\t\t\tif($price_list[$i]->stock_group_id == 3){\n\t\t\t\tif($price_list[$i]->category_id == 13){\n\t\t\t\t\t$price_list[$i]->product_name = $this->Masterdata_Model->getFarmImplementsModelById($price_list[$i]->sub_category_id, $price_list[$i]->product_id)->name.\" - \".$price_list[$i]->classification;\n\t\t\t\t} else {\n\t\t\t\t\t$price_list[$i]->product_name = $this->Masterdata_Model->getProductByCategoryAndSubcategory($price_list[$i]->category_id, $price_list[$i]->sub_category_id, $price_list[$i]->product_id)->name.\" - \".$price_list[$i]->classification;\n\t\t\t\t}\t\t\t\t\n\t\t\t} else if($price_list[$i]->stock_group_id == 2){\n $price_list[$i]->product_name = $this->Masterdata_Model->cropNameById($price_list[$i]->category_id, $price_list[$i]->sub_category_id, $price_list[$i]->product_id)->name.\" - \".$price_list[$i]->classification;\n\t\t\t} else {\t\t\t\t\t\t\t\t\n\t\t\t\tif($price_list[$i]->category_id == 3 || $price_list[$i]->category_id == 4 || $price_list[$i]->category_id == 5){\n\t\t\t\t\t$price_list[$i]->product_name = $this->Masterdata_Model->brandListBySuppliersById($price_list[$i]->category_id, $price_list[$i]->sub_category_id, $price_list[$i]->product_id)->name.\" - \".$price_list[$i]->classification;\n\t\t\t\t} else {\n\t\t\t\t\t$price_list[$i]->product_name = $this->Masterdata_Model->getProductByCategoryAndSubcategory($price_list[$i]->category_id, $price_list[$i]->sub_category_id, $price_list[$i]->product_id)->name.\" - \".$price_list[$i]->classification;\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t}\n $data['price_list']=$price_list;\n $this->load->view('setting/pricinglist', $data); \t \n\t}", "function setSyncItemsPriceStandard()\n {\n }", "public function pricesProvider()\n {\n return [\n 'sufficient data' => [\n 'period' => 14,\n 'precision' => 2,\n 'prices' => [\n 4834.91,// current\n 4724.89,// previous\n 4555.14,\n 4587.48,\n 4386.69,\n 4310.01,\n 4337.44,\n 4280.68,\n 4316.01,\n 4114.01,\n 4040.0,\n 4016.0,\n 4086.29,\n 4139.98,\n 4108.37,\n 4285.08,\n ],\n 'expected RSI' => [\n 81.19,// current\n 67.86,// previous\n 62.72,\n ],\n ],\n 'insufficient data' => [\n 'period' => 14,\n 'precision' => 2,\n 'prices' => [\n 4834.91,// current\n 4724.89,// previous\n ],\n 'expected RSI' => [],\n ],\n ];\n }", "protected function _construct()\n {\n $this->_init(QuotePickupLocation::class, QuotePickupLocationResource::class);\n }", "function setPrice($new_price)\n {\n $this->price = $new_price;\n }", "public function getPriceFromDatabase()\n {\n }", "public function initialize()\n {\n $this->setSchema(\"cubicfox\");\n $this->setSource(\"rates\");\n\n $this->hasManyToMany(\n \"id\",\n \"Users\",\n \"user_id\", \n \"product_id\",\n \"Products\",\n \"id\"\n );\n }", "public function __construct()\n {\n $this->cart = Cart::content();\n $this->checkStock();\n }", "public function updatePrices($contractId, $priceList);", "public function test_comicEntityIsCreated_prices_setPrices()\n {\n $sut = $this->getSUT();\n $prices = $sut->getPrices();\n $expected = [\n Price::create(\n 'printPrice',\n 19.99\n ),\n ];\n\n $this->assertEquals($expected, $prices);\n }", "function ppt_resources_get_usd_stocks($data)\n{\n// return $data;\n if (!isset($data['year'])) {\n return services_error('Year is not defined!', 500);\n }\n\n $year = $data['year'];\n $accounts = [];\n // If there is no uid sent with the api so get the current user id.\n if (isset($data['uid'])) {\n $uid = $data['uid'];\n } else {\n global $user;\n $uid = $user->uid;\n }\n $countries = array();\n if (isset($data['countries'])) {\n $countries = $data['countries'];\n }\n $reps = array();\n if (isset($data['reps'])) {\n $reps = $data['reps'];\n }\n\n $user = user_load($uid);\n\n // Check if user selected accounts.\n if (isset($data['accounts'])) {\n $accounts = $data['accounts'];\n } else {\n $accounts = ppt_resources_get_role_accounts($user, $countries);\n }\n\n $products = [];\n // Check if user selected products.\n if (isset($data['products'])) {\n $products = get_products_dosages($data['products']);\n } else {\n // If the user is rep.\n if (is_rep($user)) {\n $products = get_products_for_current_user($uid);\n } else {\n $products = get_products_for_accounts($accounts);\n }\n }\n//return entity_metadata_wrapper('field_collection_item', 18045);\n $entries = get_entries($accounts, $products, NULL, $reps);\n $entries_records = get_entries_records_for_year($entries, $year, 'consumption_stock_entry');\n $reports = sum_records_per_field($entries_records, 'field_product', TRUE);\n return $reports;\n}", "function getArticlesByPrice($priceMin=0, $priceMax=0, $usePriceGrossInstead=0, $proofUid=1){\n //first get all real articles, then create objects and check prices\n\t //do not get prices directly from DB because we need to take (price) hooks into account\n\t $table = 'tx_commerce_articles';\n\t $where = '1=1';\n\t if($proofUid){\n\t $where.= ' and tx_commerce_articles.uid_product = '.$this->uid;\n\t }\t\n //todo: put correct constant here\n\t $where.= ' and article_type_uid=1';\n\t $where.= $this->cObj->enableFields($table);\n\t $groupBy = '';\n\t $orderBy = 'sorting';\n\t $limit = '';\n\t $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery (\n\t 'uid', $table,\n\t $where, $groupBy,\n\t $orderBy,$limit\n\t );\n\t $rawArticleUidList = array();\n\t while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {\n\t $rawArticleUidList[] = $row['uid'];\n\t }\n\t $GLOBALS['TYPO3_DB']->sql_free_result($res);\n\t \n\t //now run the price test\n\t $articleUidList = array();\n\t foreach ($rawArticleUidList as $rawArticleUid) {\n\t\t $tmpArticle = new tx_commerce_article($rawArticleUid,$this->lang_uid);\n\t\t $tmpArticle->load_data();\n\t\t\t $myPrice = $usePriceGrossInstead ? $tmpArticle->get_price_gross() : $tmpArticle->get_price_net();\n\t\t\t if (($priceMin <= $myPrice) && ($myPrice <= $priceMax)) {\n\t\t\t $articleUidList[] = $tmpArticle->get_uid();\n\t\t\t }\n\t\t }\n if(count($articleUidList)>0){\n return $articleUidList;\n }else{\n return false;\n\t }\n\t}", "public function get_prices()\n\t{\n\t\t$product_price_old = 0;\n\t\t$product_price_sale = 0;\n\t\t$price = 0;\n\t\t$eco = 0;\n\t\t$taxes = 0;\n\t\t$dataoc = isset($this->request->post['dataoc']) ? $this->request->post['dataoc'] : '';\n\n\t\tif (!empty($dataoc)) {\n\t\t\t$dataoc = str_replace('&quot;', '\"', $dataoc);\n\t\t\t$json = @json_decode($dataoc, true);\n\t\t\t$product_quantity = isset($json['quantity']) ? $json['quantity'] : 0;\n\t\t\t$product_id_oc = isset($json['product_id_oc']) ? $json['product_id_oc'] : 0;\n\t\t\tif ($product_id_oc == 0) $product_id_oc = isset($json['_product_id_oc']) ? $json['_product_id_oc'] : 0;\n\n\t\t\t// get options\n\t\t\t$options = isset($json['option_oc']) ? $json['option_oc'] : array();\n\t\t\tforeach ($options as $key => $value) {\n\t\t\t\tif ($value == null || empty($value)) unset($options[$key]);\n\t\t\t}\n\n\t\t\t// get all options of product\n\t\t\t$options_temp = $this->get_options_oc($product_id_oc);\n\n\t\t\t// Calc price for ajax\n\t\t\tforeach ($options_temp as $value) {\n\t\t\t\tforeach ($options as $k => $option_val) {\n\t\t\t\t\tif ($k == $value['product_option_id']) {\n\t\t\t\t\t\tif ($value['type'] == 'checkbox' && is_array($option_val) && count($option_val) > 0) {\n\t\t\t\t\t\t\tforeach ($option_val as $val) {\n\t\t\t\t\t\t\t\tforeach ($value['product_option_value'] as $op) {\n\t\t\t\t\t\t\t\t\t// calc price\n\t\t\t\t\t\t\t\t\tif ($val == $op['product_option_value_id']) {\n\t\t\t\t\t\t\t\t\t\tif ($op['price_prefix'] == $this->minus) $price -= isset($op['price_no_tax']) ? $op['price_no_tax'] : 0;\n\t\t\t\t\t\t\t\t\t\telse $price += isset($op['price_no_tax']) ? $op['price_no_tax'] : 0;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} elseif ($value['type'] == 'radio' || $value['type'] == 'select') {\n\t\t\t\t\t\t\tforeach ($value['product_option_value'] as $op) {\n\t\t\t\t\t\t\t\tif ($option_val == $op['product_option_value_id']) {\n\t\t\t\t\t\t\t\t\tif ($op['price_prefix'] == $this->minus) $price -= isset($op['price_no_tax']) ? $op['price_no_tax'] : 0;\n\t\t\t\t\t\t\t\t\telse $price += isset($op['price_no_tax']) ? $op['price_no_tax'] : 0;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// the others have not price, so don't need calc\n\t\t\t\t\t}\n\t\t\t\t\t// if not same -> return.\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$product_prices = $this->get_product_price($product_id_oc, $product_quantity);\n\t\t\t$product_price_old = isset($product_prices['price_old']) ? $product_prices['price_old'] : 0;\n\t\t\t$product_price_sale = isset($product_prices['price_sale']) ? $product_prices['price_sale'] : 0;\n\t\t\t$enable_taxes = $this->config->get('tshirtecommerce_allow_taxes');\n\t\t\tif ($enable_taxes === null || $enable_taxes == 1) {\n\t\t\t\t$taxes = isset($product_prices['taxes']) ? $product_prices['taxes'] : 0;\n\t\t\t\t$eco = isset($product_prices['eco']) ? $product_prices['eco'] : 0;\n\t\t\t} else {\n\t\t\t\t$taxes = 0;\n\t\t\t\t$eco = 0;\n\t\t\t}\n\t\t\t\n\t\t} // do nothing when empty/blank\n\n\t\t// return price for ajax\n\t\techo @json_encode(array(\n\t\t\t'price' => $price, \n\t\t\t'price_old' => $product_price_old, \n\t\t\t'price_sale' => $product_price_sale, \n\t\t\t'taxes' => $taxes,\n\t\t\t'eco' => $eco\n\t\t));\n\t\treturn;\n\t}", "public function __construct()\n {\n Mage_Core_Block_Template::__construct();\n $this->setTemplate('sam_layerednavigation/catalog/layer/filter.phtml');\n\n $this->_filterModelName = 'catalog/layer_filter_price';\n }", "public function getPLNPrepaidPricelist()\n {\n $user = Auth::user();\n $quickbuy = false;\n if ($user->is_store) {\n $quickbuy = true;\n }\n $priceArr = [];\n // get all Prepaid Pricelist data from Cache if available or fresh fetch from API\n $prepaidPricelist = $this->getAllPrepaidPricelist();\n foreach ($prepaidPricelist['data'] as $row) {\n if ($row['category'] == 'PLN') {\n if ($row['price'] <= 40000) {\n $initPrice = $row['price'] + 50;\n }\n if ($row['price'] > 40000) {\n $initPrice = $row['price'] + 70;\n }\n // Here we add 4% (2% for Profit Sharing Conribution, 2% for Seller's profit)\n // We also round-up last 3 digits to 500 increments, all excess will be Seller's profit\n $addedPrice = $initPrice + 2000;\n $last3DigitsCheck = substr($addedPrice, -3);\n $check = 500 - $last3DigitsCheck;\n if ($check == 0) {\n $price = $addedPrice;\n }\n if ($check > 0 && $check < 500) {\n $price = $addedPrice + $check;\n }\n if ($check == 500) {\n $price = $addedPrice;\n }\n if ($check < 0) {\n $price = $addedPrice + (500 + $check);\n }\n\n if ($row['brand'] == 'PLN') {\n $priceArr[] = [\n 'buyer_sku_code' => $row['buyer_sku_code'],\n 'desc' => $row['desc'],\n 'price' => $price,\n 'brand' => $row['brand'],\n 'product_name' => $row['product_name'],\n 'seller_name' => $row['seller_name']\n ];\n }\n }\n }\n\n $pricelist = collect($priceArr)->sortBy('price')->toArray();\n $pricelistCall = null; //placeholder\n\n return view('member.app.shopping.prepaid_pricelist')\n ->with('title', 'Token PLN')\n ->with(compact('pricelist'))\n ->with(compact('pricelistCall'))\n ->with(compact('quickbuy'))\n ->with('type', 3);\n }", "public function _construct()\n {\n $this->_initProductCollection();\n parent::_construct();\n }", "public static function price($pair) {\n\t\t\treturn (self::valid($prices = self::prices(array($pair)))) ? $prices->prices[0] : $prices;\n\t\t}", "public function __construct($cost, $isbn)\n {\n //assigning the instance variables using constructor\n $this->price = $cost;\n $this->isbnNumber = $isbn;\n }", "function initialize($data)\n\t{\n\t\t$this->book_id = $data['txnid'];\n\t\t$this->pgi_amount = 1.00; //$data['pgi_amount'];\n\t\t$this->firstname = $data['firstname'];\n\t\t$this->email = $data['email'];\n\t\t$this->phone = $data['phone'];\n\t\tif(isset($data['txn_type']) && $data['txn_type'] == 'REFUND')\n\t\t{\n\t\t\t$this->txn_type = $data['txn_type'];\n\t\t\t$this->pg_txn_id = $data['pg_txnid'];\n\t\t\t$this->refund_amt = $data['refund_amt'];\n\t\t\t$this->m_refund_id = \"R-\".time(); //We generate this\n\t\t}\n\t\tif(isset($data['txn_type']) && $data['txn_type'] == 'INSTANT_RECHARGE')\n\t\t{\n\t\t\t$this->txn_type = $data['txn_type'];\n\t\t\t$this->payment_mode_only = $data[\"payment_mode_only\"];\n\t\t\t$this->payment_type_id = $data[\"payment_type_id\"];\n\t\t}\n\n\t\t/*We need to store product info value in session as Paytm does have param to send/receive this as request/response respectively.*/\n\t\t$GLOBALS[\"CI\"]->session->set_userdata(\"paytm_productinfo\", $data['productinfo']);\n\t}", "public function __construct($inventory_code, $stockId)\n {\n $this->inventory_code = $inventory_code;\n $this->stockId = $stockId;\n }" ]
[ "0.67749494", "0.6619689", "0.6213537", "0.6108304", "0.60767144", "0.5828017", "0.578052", "0.5702991", "0.5642617", "0.5642617", "0.56220454", "0.5607911", "0.55695087", "0.5542295", "0.5537879", "0.55313766", "0.549851", "0.54833096", "0.54716736", "0.54691976", "0.54689115", "0.5453855", "0.53989476", "0.5391865", "0.5377704", "0.5354473", "0.53346854", "0.5308002", "0.52565116", "0.5230965", "0.5229275", "0.5219535", "0.5208985", "0.5190294", "0.5185514", "0.5179401", "0.51477313", "0.51428914", "0.5133021", "0.51240814", "0.5115955", "0.5112302", "0.5112112", "0.5111136", "0.51016366", "0.50909287", "0.5086339", "0.508308", "0.50817835", "0.5074299", "0.5071746", "0.50685424", "0.5068068", "0.506542", "0.5049239", "0.50181764", "0.5008167", "0.49961668", "0.49874145", "0.49859315", "0.49713147", "0.49661237", "0.49354511", "0.4928677", "0.49272045", "0.4905726", "0.4893389", "0.48798326", "0.48793885", "0.4878477", "0.4876257", "0.48707458", "0.48700318", "0.4868516", "0.48629665", "0.48617882", "0.48604113", "0.485937", "0.4851633", "0.4851205", "0.4844709", "0.48439288", "0.48437282", "0.4842668", "0.4840777", "0.48392212", "0.48375264", "0.4837165", "0.48333132", "0.4817587", "0.48168278", "0.4812383", "0.4802584", "0.47986948", "0.47985476", "0.47981393", "0.47965124", "0.47960633", "0.47858587", "0.47821933", "0.47806552" ]
0.0
-1
Generates the result array with prices
private function generateResults(): array { $contents = $this->getStockListContents(); $results = []; $buy_broker_per = ($this->brokerFeeFrom - 1) * 100; $buy_tax_per = ($this->transTaxFrom - 1) * 100; $sell_broker_per = (1 - $this->brokerFeeTo) * 100; $sell_tax_per = (1 - $this->transTaxTo) * 100; $taxes = [ "list" => $this->stockListName, "buy_character" => $this->characterFromName, "sell_character" => $this->characterToName, "buy_station" => $this->stationFromName, "sell_station" => $this->stationToName, "buy_method" => $this->characterFromMethod, "sell_method" => $this->characterToMethod, "buy_broker" => $buy_broker_per, "buy_tax" => $buy_tax_per, "sell_broker" => $sell_broker_per, "sell_tax" => $sell_tax_per, ]; foreach ($contents as $row) { $this->RateLimiter->rateLimit(); $item_id = (int) $row->id; $item_name = $row->name; $row->vol == 0 ? $item_vol = 1 : $item_vol = $row->vol; $best_buy_price = $this->getCrestData($item_id, $this->stationFromID, $this->characterFromMethod); $buy_broker_fee = $best_buy_price * ($this->brokerFeeFrom - 1); $best_sell_price = $this->getCrestData($item_id, $this->stationToID, $this->characterToMethod); $sell_broker_fee = $best_sell_price * (1 - $this->brokerFeeTo); $sell_trans_tax = $best_sell_price * (1 - $this->transTaxTo); $best_buy_price_taxed = $best_buy_price * $this->brokerFeeFrom; $best_sell_price_taxed = $best_sell_price * $this->brokerFeeTo * $this->transTaxTo; $profit_raw = $best_sell_price_taxed - $best_buy_price_taxed; $profit_m3 = $profit_raw / $item_vol; $best_buy_price_taxed != 0 ? $profit_margin = ($profit_raw / $best_buy_price_taxed) * 100 : $profit_margin = 0; $item_res = array("id" => $item_id, "name" => $item_name, "vol" => $item_vol, "buy_price" => $best_buy_price, "buy_broker" => $buy_broker_fee, "sell_price" => $best_sell_price, "sell_broker" => $sell_broker_fee, "sell_tax" => $sell_trans_tax, "profit_raw" => $profit_raw, "profit_m3" => $profit_m3, "profit_margin" => $profit_margin); array_push($results, $item_res); } return array("results" => $results, "req" => $taxes); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function getPrices () {\n\t\tlibxml_use_internal_errors(true);\n\t\n\t\t$dom = new DOMDocument();\n\n\t\t@$dom->loadHTML( $this->result );\n\t\t$xpath = new DOMXPath( $dom );\n\t\t\n\t\t$this->prices[] = array(\n\t\t\t'station.from' => $this->getPostField('from.searchTerm'),\n\t\t\t'station.to' => $this->getPostField('to.searchTerm'),\n\t\t\t'station.prices' => $xpath->query($this->config['lookupString'])\n\t\t);\n\t}", "public function getPrices()\n {\n }", "public function getPricing() : array\n {\n $data = $this->fetchJson();\n $result = [];\n\n foreach ($data['fuel']['types'] as $fuelType) {\n if (!in_array($fuelType['name'], $this->types)) {\n continue;\n }\n\n $result[] = [\n 'name' => $fuelType['name'],\n 'price' => $fuelType['price'] * 100\n ] ;\n }\n\n return $result;\n }", "protected function calculatePrices()\n {\n }", "public function getPriceMatrix()\n\t{\t\t\n\t\t$result = array(\n\t\t\t\t\"best_price\" => $this->getBestPrice()->getAmount(),\n\t\t\t\t\"highest_price\" => $this->getHighestPrice()->getAmount(),\n\t\t\t\t\"currency_code\" => \"EUR\",\n\t\t\t\t\"time_window_ranges\" =>\n\t\t\t\tarray(\n\t\t\t\t\t\"min_hour\" => $this->getMinHour(),\n\t\t\t\t\t\"max_hour\" => $this->getMaxHour(),\n\t\t\t\t\t\"days\" => $this->getDays()\n\t\t\t\t\t\n\t\t\t\t),\n\t\t\t\t\"time_window_prices\" => $this->getTimeWindowPricesArray()\n\t\t);\n\n\t\treturn json_encode($result);\n\t}", "public function getPriceAll()\n { \n $collection = $this->PostCollectionFactory->create();\n /*$a = $collection->getPrice();*/\n foreach ($collection as $key => $value) {\n $value->getPrice();\n }\n return $value->getPrice();\n }", "public function getAllPrices(): array {\n $_prices = [\n 'resources' => [],\n 'factories' => [],\n 'loot' => [],\n 'units' => [],\n ];\n\n foreach(self::TABLE_NAMES as $arrayIndex => $minMax) {\n $globalIndex = 0;\n\n for($index = $minMax['min']; $index <= $minMax['max']; ++$index) {\n $query = 'SELECT * FROM ';\n\n $officialId = $this->_convertInternalIdToOldStructure($index);\n\n foreach(self::PRICE_INTERVALS as $interval => $seconds) {\n $indexInterval = $index . '_' . $interval;\n\n $query .= '(\n SELECT\n AVG(' . $officialId . '_k) AS `' . $indexInterval . '_ai`,\n AVG(nullif(' . $officialId . '_tk, 0)) AS `' . $indexInterval . '_player`\n FROM `price` ';\n\n if($interval !== 'max') {\n $query .= 'WHERE `ts` >= (UNIX_TIMESTAMP() - ' . $seconds . ')';\n }\n\n $query .= ') AS `' . $indexInterval . '`, ';\n }\n\n $query = substr($query, 0, -2);\n\n $getPrices = $this->_conn->query($query);\n\n if($getPrices->num_rows > 0) {\n while($result = $getPrices->fetch_assoc()) {\n foreach(self::PRICE_INTERVALS as $interval => $seconds) {\n $_prices[$arrayIndex][$globalIndex][$interval]['ai'] = round($result[$index . '_' . $interval . '_ai']);\n $_prices[$arrayIndex][$globalIndex][$interval]['player'] = round($result[$index . '_' . $interval . '_player']);\n }\n }\n } else {\n foreach(self::PRICE_INTERVALS as $interval => $seconds) {\n $_prices[$arrayIndex][$globalIndex][$interval]['ai'] = 0;\n $_prices[$arrayIndex][$globalIndex][$interval]['player'] = 0;\n }\n }\n\n ++$globalIndex;\n }\n }\n\n return $_prices;\n }", "public function getPriceList()\n {\n try {\n $apiClient = $this->getApiClientPricing();\n $priceList = $apiClient->get(\n array(\"parcel\" => array('dimensions' => $this->getParcelDimensions()))\n );\n\n return json_decode($priceList);\n } catch (\\Exception $e) {\n Logger::debug($e->getMessage());\n return array();\n }\n }", "public function pricesProvider()\n {\n return [\n 'sufficient data' => [\n 'period' => 14,\n 'precision' => 2,\n 'prices' => [\n 4834.91,// current\n 4724.89,// previous\n 4555.14,\n 4587.48,\n 4386.69,\n 4310.01,\n 4337.44,\n 4280.68,\n 4316.01,\n 4114.01,\n 4040.0,\n 4016.0,\n 4086.29,\n 4139.98,\n 4108.37,\n 4285.08,\n ],\n 'expected RSI' => [\n 81.19,// current\n 67.86,// previous\n 62.72,\n ],\n ],\n 'insufficient data' => [\n 'period' => 14,\n 'precision' => 2,\n 'prices' => [\n 4834.91,// current\n 4724.89,// previous\n ],\n 'expected RSI' => [],\n ],\n ];\n }", "public function getAllList_Price()\n {\n try\n {\n // Создаем новый запрс\n $db = $this->getDbo();\n $query = $db->getQuery(true);\n\n $query->select('a.*');\n $query->from('`#__gm_ceiling_components_option` AS a');\n $query->select('CONCAT( component.title , \\' \\', a.title ) AS full_name');\n $query->select('component.id AS component_id');\n $query->select('component.title AS component_title');\n $query->select('component.unit AS component_unit');\n $query->join('RIGHT', '`#__gm_ceiling_components` AS component ON a.component_id = component.id');\n\n $db->setQuery($query);\n $return = $db->loadObjectList();\n return $return;\n }\n catch(Exception $e)\n {\n Gm_ceilingHelpersGm_ceiling::add_error_in_log($e->getMessage(), __FILE__, __FUNCTION__, func_get_args());\n }\n }", "public function getItemsPrice()\n {\n return [10,20,54];\n }", "public function run()\n {\n $priceList = [\n ['337','5 Refractarios de Vidrio y 5 tapas de plastico Glazé',1],\n ['338','5 Refractarios de Vidrio y 5 tapas de plastico Glazé',2],\n ['339','5 Refractarios de Vidrio y 5 tapas de plastico Glazé',4],\n ['340','5 Refractarios de Vidrio y 5 tapas de plastico Glazé',3],\n ['341','5 Refractarios de Vidrio y 5 tapas de plastico Glazé',1],\n ['369','Abanico de Techo Harbor Breeze',1],\n ['172','abanico de techo harbor breeze.',2],\n ['531','Abanico Harbor',1],\n ['168','Abanico Taurus',1],\n ['175','Abanico Taurus',1],\n ['179','Abanico Taurus',1],\n ['310','alaciadora con placas de ceramica timco.',1],\n ['311','alaciadora con placas de ceramica timco.',1],\n ['312','alaciadora con placas de ceramica timco.',1],\n ['335','Alaciadora Revlon',2],\n ['336','Alaciadora Revlon',3],\n ['152','Alaciadora Taurus.',4],\n ['153','Alaciadora Taurus.',2],\n ['154','Alaciadora Taurus.',3],\n ['155','Alaciadora Taurus.',4],\n ['253','Arrocera c/tapa Tramontina',2],\n ['254','Arrocera c/tapa Tramontina',1],\n ['418','Asador Outdoor trend',3],\n ['360','Aspiradora',1],\n ['423','Aspiradora Dirt Devil',2],\n ['449','Aspiradora Mikel¨S',3],\n ['490','Aspiradora Mikel¨S',2],\n ['134','audifonos stf sound',3],\n ['135','audifonos stf sound',4],\n ['136','audifonos stf sound',2],\n ['137','audifonos stf sound',4],\n ['138','audifonos stf sound',1],\n ['365','Audifonos STF Sound',4],\n ['397','Audifonos STF Sound',3],\n ['406','Audifonos STF Sound',2],\n ['421','Audifonos STF Sound',1],\n ['422','Audifonos STF Sound',3],\n ['558','Audifonos STF Sound',4],\n ['559','Audifonos STF Sound',2],\n ['560','Audifonos STF Sound',4],\n ['178','Azador de Carbón Outdoor Trend',1],\n ['9','Bafle Recargable (Bocina) Concierto mio',2],\n ['352','Bajilla Ebro (12pz)',3],\n ['353','Bajilla Ebro (12pz)',4],\n ['358','Bajilla Santa Anita (16pz)',2],\n ['371','Bandeja Rectangular PYR-O-REY',1],\n ['372','Bandeja Rectangular PYR-O-REY',3],\n ['429','Bandeja Rectangular PYR-O-REY',4],\n ['548','Baño de burbujas para pies Revlon',3],\n ['604','Baño de burbujas Revlon',1],\n ['373','Bateria CINSA (7pz)',2],\n ['534','Bateria CINSA (7pz)',3],\n ['6','Bateria de Cocina (9pz) Ekos',1],\n ['480','Bateria de Cocina (9pz) Ekos',3],\n ['481','Bateria de Cocina (9pz) Ekos',4],\n ['618','Bateria de cocina 20pz Main Stays',1],\n ['619','Bateria de cocina 20pz Main Stays',3],\n ['107','bateria ecko 9 pzs.',2],\n ['308','batidora de imersion sunbeam.',1],\n ['299','batidora de imersion taurus.',3],\n ['300','batidora de imersion taurus.',4],\n ['301','batidora de imersion taurus.',2],\n ['302','batidora de imersion taurus.',1],\n ['303','batidora de imersion taurus.',4],\n ['304','batidora de imersion taurus.',2],\n ['305','batidora de imersion taurus.',4],\n ['306','batidora de imersion taurus.',3],\n ['307','batidora de imersion taurus.',3],\n ['519','Batidora Tradition',1],\n ['367','Batidora Traditions',2],\n ['375','Batidora Traditions',4],\n ['376','Batidora Traditions',4],\n ['165','bocina bafle.',3],\n ['166','bocina bafle.',2],\n ['167','bocina bafle.',1],\n ['91','bocina bafle.?cm',3],\n ['99','bocina bafle.?cm',1],\n ['430','Bocina Bluetooth Kaiser',2],\n ['431','Bocina Bluetooth Kaiser',2],\n ['148','bocina green leaf.',1],\n ['171','bocina green leaf.',2],\n ['444','Bocina green leaf.',1],\n ['8','Bocina Inalambrica Green Leaf',1],\n ['468','Bocina Inalambrica Green Leaf',2],\n ['522','Bocina Logitech',2],\n ['128','bocinas logitech.',3],\n ['510','Bocinas logitech.',4],\n ['580','Bolsa Cosmetic Lab',4],\n ['581','Bolsa Cosmetic Lab',3],\n ['536','Bolsita negra Cosmetic Lab',4],\n ['552','Bolsita negra Cosmetic Lab',2],\n ['586','Bolsita negra Cosmetic Lab',2],\n ['662','Brochas 6pz',3],\n ['664','Brochas 6pz',4],\n ['663','Brochas 8pz',3],\n ['118','brown sunbeam',4],\n ['119','brown sunbeam',3],\n ['120','brown sunbeam',4],\n ['121','brown sunbeam',3],\n ['255','Cable Pasa Corriente 120 a 12 V cc 2.5 m multitop',4],\n ['256','Cable Pasa Corriente 120 a 12 V cc 2.5 m multitop',3],\n ['48','Cafetera Best Home',4],\n ['49','Cafetera Best Home',3],\n ['189','Cafetera Best Home',4],\n ['190','Cafetera Best Home',2],\n ['366','Cafetera Best Home',2],\n ['392','Cafetera Best Home',2],\n ['386','Cafetera Best Home',4],\n ['433','Cafetera Best Home',2],\n ['442','Cafetera Best Home',2],\n ['443','Cafetera Best Home',1],\n ['85','cafetera best home.',2],\n ['110','cafetera best home.',3],\n ['144','cafetera best home.',4],\n ['466','Cafetera de goteo Best Home',2],\n ['216','caja de herramientas 17\" truper.',3],\n ['217','caja de herramientas 17\" truper.',2],\n ['218','caja de herramientas 17\" truper.',4],\n ['489','Calefactor Best Home',1],\n ['57','Calefactor de halógeno Best Home',3],\n ['251','Calentador c/tapa de Vidrio CINSA 1.7 Litros',4],\n ['252','Calentador c/tapa de Vidrio CINSA 1.7 Litros',2],\n ['354','Calentón Best Home',1],\n ['361','Calentón Best Home',4],\n ['507','Calentón Best Home',2],\n ['374','Class Bows (5pz) Libbey',1],\n ['159','cobertor con borrega.',4],\n ['243','Cobertor Fusionado Estampado con Borrega Soft Sensations King Size',2],\n ['244','Cobertor Fusionado Estampado con Borrega Soft Sensations Matrimonial',1],\n ['113','cobijita cuadrada.',4],\n ['196','Colcha con cojin Mainstays',2],\n ['237','Colcha con Cojin Mainstays',2],\n ['229','colchon ortopedico individual master',3],\n ['230','colchon ortopedico individual master',4],\n ['231','Colchón Ortopedico Individual Master',2],\n ['232','Colchón Super Ortopedico Individual Master',1],\n ['233','Colchón Super Ortopedico Individual Master',3],\n ['535','Comedor',1],\n ['124','copa cristar 4 pzs.',2],\n ['125','copa cristar 4 pzs.',2],\n ['504','Copa cristar 4 pzs.',4],\n ['501','Copas cristar (4pz)',2],\n ['364','Copas de Cristal (4pz)',1],\n ['390','Copas de Cristal (4pz)',3],\n ['72','cortadora de cabello taurus',4],\n ['73','cortadora de cabello taurus',2],\n ['74','cortadora de cabello taurus',1],\n ['147','cortadora de cabello taurus',3],\n ['416','Cortadora de cabello taurus',4],\n ['425','cortadora de cabello taurus',2],\n ['426','cortadora de cabello taurus',1],\n ['440','cortadora de cabello taurus',3],\n ['470','Cortadora de cabello taurus',4],\n ['471','Cortadora de cabello taurus',4],\n ['520','Cortadora de cabello taurus',1],\n ['582','Cosmetiquera',3],\n ['583','Cosmetiquera',2],\n ['584','Cosmetiquera',3],\n ['585','Cosmetiquera',2],\n ['653','Cosmetiquera',1],\n ['659','Cosmetiquera',3],\n ['643','Cosmetiquera Cosmetic Lab',3],\n ['599','Cosmetiquera cristalina Cosmetic Lab',2],\n ['600','Cosmetiquera gris con blanco Cosmetic Lab',3],\n ['567','Cosmetiquera rosa Cosmetic Lab',2],\n ['568','Cosmetiquera rosa Cosmetic Lab',2],\n ['569','Cosmetiquera rosa Cosmetic Lab',3],\n ['570','Cosmetiquera rosa Cosmetic Lab',4],\n ['537','Cosmetiquera The Best',1],\n ['84','crock. Pot olla electrica.',3],\n ['546','Cuadro flotante Main Stayns 24 fotos (Blanco)',2],\n ['545','Cuadro flotante Main Stayns 24 fotos (Negro)',3],\n ['417','Cubiertos SK (16pz)',1],\n ['176','Delineadora de Barba Timco',1],\n ['645','Desarmador de trinquete Stanley',3],\n ['641','Desarmadores truper 5pz',1],\n ['642','Desarmadores truper 5pz',2],\n ['434','Duo Cups T-Fal',3],\n ['592','DVD con Karaoke',2],\n ['593','DVD con Karaoke',1],\n ['241','Edredón de Microfibra Matrimonial Mainstays',3],\n ['242','Edredón de Microfibra Matrimonial Mainstays',4],\n ['158','edredon mainstays.',5],\n ['191','Edredon Viajero',2],\n ['195','Edredon Viajero 926',3],\n ['235','Edredón Viajero NANO (1.15 x 1.50) mts beige',4],\n ['236','Edredón Viajero NANO (1.15 x 1.50) mts café',1],\n ['239','Edredrón Doble Vista Individual Essentails Home',2],\n ['240','Edredrón Doble Vista Individual Essentails Home',3],\n ['238','Edredrón Matrimonial Mainstays',4],\n ['414','Escurridor de platos',1],\n ['437','Escurridor de platos Hamilton Beach',2],\n ['438','Escurridor de platos Hamilton Beach',3],\n ['439','Escurridor de platos Hamilton Beach',4],\n ['633','Estuche de brochas 6pz',1],\n ['3','Estufa Acros',2],\n ['108','estufa para bufe black + decker.',3],\n ['1','Estufa Ranger IEM',4],\n ['385','Exprimidor electrico proctor siler',1],\n ['529','Exprimidor electrico proctor siler',2],\n ['530','Exprimidor electrico proctor siler',3],\n ['399','Frasada',1],\n ['400','Frasada',2],\n ['401','Frasada',3],\n ['402','Frasada',4],\n ['403','Frasada',1],\n ['404','Frasada',2],\n ['511','Frazada Main Stayns',3],\n ['538','Frazada Main Stayns',1],\n ['539','Frazada Main Stayns',2],\n ['540','Frazada Main Stayns',3],\n ['541','Frazada Main Stayns',4],\n ['566','Frazada Main Stayns',1],\n ['370','Frazada Mainstays',2],\n ['156','frazada mainstays.',4],\n ['157','frazada mainstays.',1],\n ['163','frazada mainstays.',2],\n ['112','frazada throw',3],\n ['245','Frazada Viajera NANO',4],\n ['219','hielera 12 latas 10.5 litros nyc.',1],\n ['220','hielera 12 latas 10.5 litros nyc.',2],\n ['486','hielera 12 latas nyc.',3],\n ['225','hielera 54 lata 45.5 litros nyc.',4],\n ['223','hielera coleman 34 litros',1],\n ['224','hielera coleman 34 litros',2],\n ['221','hielera igloo 11 litros',3],\n ['222','hielera igloo 11 litros',3],\n ['532','Horno Black and Decker',1],\n ['203','horno de microondas hamilton Beach.',2],\n ['180','Horno Electrico Best Home',3],\n ['487','Horno microondas Hamilton',4],\n ['350','Jarra y Vasos Crisa (5pz)',1],\n ['448','Jarra y Vasos Crisa (5pz)',2],\n ['459','Jarra y Vasos Crisa (7pz)',3],\n ['66','Jarra y Vasos Crisia (5pz)',4],\n ['184','Jarra y Vasos Crisia (7pz)',1],\n ['349','Juedo de Cubiertos Mainstays',2],\n ['26','Juego Crisa (8pz)',3],\n ['461','Juego Crisa (8pz)',3],\n ['602','Juego de 6 llaves pretul',1],\n ['647','Juego de 6 llaves pretul',2],\n ['101','juego de agua bassic',3],\n ['102','juego de agua bassic',4],\n ['379','Juego de Agua Bassic (7pz)',1],\n ['380','Juego de Agua Bassic (7pz)',2],\n ['395','Juego de agua Bassic (7pz)',3],\n ['419','Juego de Agua Bassic (7pz)',4],\n ['12','Juego de Agua Neptuno (7pz)',1],\n ['23','Juego de Agua Neptuno (7pz)',2],\n ['29','Juego de Agua Neptuno (7pz)',4],\n ['75','juego de agua neptuno 7 pzas.',1],\n ['76','juego de agua neptuno 7 pzas.',2],\n ['658','Juego de baño',3],\n ['660','Juego de baño',3],\n ['639','Juego de baño 7pz Aromanice',1],\n ['640','Juego de baño 7pz Aromanice',2],\n ['553','Juego de baño Aromanice',3],\n ['554','Juego de baño Aromanice',4],\n ['555','Juego de baño Aromanice',1],\n ['644','Juego de baño Aromanice',2],\n ['465','Juego de Bar de vidrio (8pz)',4],\n ['485','Juego de Bar de vidrio (8pz)',1],\n ['183','Juego de Bar Libbey (8pz)',1],\n ['505','Juego de Bar Libbey (8pz)',2],\n ['561','Juego de brochas 7pz Xpert Beauty',3],\n ['562','Juego de brochas 7pz Xpert Beauty',4],\n ['563','Juego de brochas 7pz Xpert Beauty',1],\n ['564','Juego de brochas 7pz Xpert Beauty',2],\n ['565','Juego de brochas 7pz Xpert Beauty',4],\n ['608','Juego de brochas 8pz',1],\n ['609','Juego de brochas 8pz',2],\n ['610','Juego de brochas 8pz',1],\n ['188','Juego de Cocina (4pz) Ekco',2],\n ['104','juego de cocina 4 pzs ecko.',4],\n ['405','Juego de Cubiertos (16pz)',1],\n ['257','Juego de Cubiertos (16pz) Mainstays',2],\n ['258','Juego de Cubiertos (16pz) Mainstays',3],\n ['259','Juego de Cubiertos (16pz) Mainstays',4],\n ['260','Juego de Cubiertos (16pz) Mainstays',1],\n ['261','Juego de Cubiertos (16pz) Mainstays',2],\n ['293','juego de cubiertos 16 pcs mainstays.',3],\n ['309','juego de cubiertos 16 pzas simple kitchen.',4],\n ['284','juego de cubiertos 16 pzs gibson.',1],\n ['285','juego de cubiertos 16 pzs gibson.',2],\n ['286','juego de cubiertos 16 pzs gibson.',4],\n ['287','juego de cubiertos 16 pzs gibson.',1],\n ['288','juego de cubiertos 16 pzs gibson.',2],\n ['289','juego de cubiertos 16 pzs gibson.',4],\n ['290','juego de cubiertos 16 pzs gibson.',1],\n ['291','juego de cubiertos 16 pzs gibson.',2],\n ['63','Juego de Cubiertos Sk (16pz)',3],\n ['64','Juego de Cubiertos Sk (16pz)',4],\n ['276','juego de cucharas 5 pzs para cocinar.',1],\n ['277','juego de cucharas 5 pzs para cocinar.',2],\n ['278','juego de cucharas 5 pzs para cocinar.',3],\n ['279','juego de cucharas 5 pzs para cocinar.',4],\n ['280','juego de cucharas 5 pzs para cocinar.',1],\n ['281','juego de cucharas 5 pzs para cocinar.',2],\n ['282','juego de cucharas 5 pzs para cocinar.',3],\n ['283','juego de cucharas 5 pzs para cocinar.',3],\n ['383','Juego de cuchillos top choice',4],\n ['488','Juego de cuchillos 12 piezas Tramontina',1],\n ['262','juego de cuchillos 4 pcs tramontina.',2],\n ['263','juego de cuchillos 4 pcs tramontina.',3],\n ['264','juego de cuchillos 4 pcs tramontina.',4],\n ['265','juego de cuchillos 4 pcs tramontina.',1],\n ['266','juego de cuchillos 4 pcs tramontina.',2],\n ['267','juego de cuchillos 4 pcs tramontina.',3],\n ['268','juego de cuchillos 4 pcs tramontina.',1],\n ['269','juego de cuchillos 4 pcs tramontina.',2],\n ['270','juego de cuchillos 4 pcs tramontina.',3],\n ['271','juego de cuchillos 4 pcs tramontina.',4],\n ['272','juego de cuchillos 4 pcs tramontina.',1],\n ['273','juego de cuchillos 4 pcs tramontina.',2],\n ['274','juego de cuchillos 4 pcs tramontina.',3],\n ['275','juego de cuchillos 4 pcs tramontina.',4],\n ['292','juego de cuchillos 4 pcs tramontina.',1],\n ['44','Juego de cuchillos Top Choice',2],\n ['182','Juego de cuchillos Top Choice',3],\n ['199','Juego de Cuchillos Top Choice',4],\n ['646','Juego de desarmador de puntas',1],\n ['638','Juego de desarmador truper',2],\n ['650','Juego de desatornillador truper',3],\n ['321','juego de herramientas 15 pzas workpro.',4],\n ['427','Juego de herramientas pretul (70pz)',1],\n ['428','Juego de herramientas pretul (70pz)',2],\n ['41','Juego de jarras y vasos crisa',3],\n ['42','Juego de jarras y vasos crisa',4],\n ['607','Juego de maquillaje 37pz',1],\n ['572','Juego de maquillaje 37pz C.L.',2],\n ['573','Juego de maquillaje 37pz C.L.',3],\n ['634','Juego de maquillaje 41pz',4],\n ['635','Juego de maquillaje 41pz',1],\n ['636','Juego de maquillaje 41pz',2],\n ['637','Juego de maquillaje 41pz',3],\n ['318','juego de peluqueria 18 pzas conair.',4],\n ['319','juego de peluqueria 18 pzas conair.',1],\n ['31','Juego de puntas p/desarmador Truper',2],\n ['32','Juego de puntas p/desarmador Truper',3],\n ['411','Juego de puntas y dados Truper (25pz)',4],\n ['193','Juego de recipientes Best Home (3pz)',1],\n ['194','Juego de recipientes Best Home (3pz)',1],\n ['67','Juego de Sartenes (3pz) Ecko',2],\n ['68','Juego de Sartenes (3pz) Ecko',3],\n ['69','Juego de Sartenes (3pz) Ecko',4],\n ['70','Juego de Sartenes (4pz) Ecko',1],\n ['477','Juego de servir Jarra con vaso',2],\n ['469','Juego de vasos (12pz) Main Stayns',3],\n ['478','Juego de vasos (6pz9 glaze',4],\n ['632','Juego de vasos 6pz Glaze',2],\n ['620','Juego de vasos 8pz Main Stays',3],\n ['621','Juego de vasos 8pz Main Stays',4],\n ['622','Juego de vasos 8pz Main Stays',3],\n ['623','Juego de vasos 8pz Main Stays',1],\n ['624','Juego de vasos 8pz Main Stays',2],\n ['625','Juego de vasos 8pz Vsantos',3],\n ['626','Juego de vasos 8pz Vsantos',4],\n ['627','Juego de vasos 8pz Vsantos',1],\n ['467','Juego de vasos de España (10pz) Santos',2],\n ['458','Juego de vasos Vsantos (10pz)',3],\n ['7','Juego de Vasos, Platos y Cucharas (12 pz) Santa Elenita',4],\n ['456','Juego para agua valencia (6pz)',1],\n ['38','Juguera Electrica Hometech',2],\n ['39','Juguera Electrica Hometech',3],\n ['71','Juguera Electrica Hometech',4],\n ['197','Juguera Electrica Hometech',1],\n ['457','Kit de peluqueria Timco (10pz)',2],\n ['116','lampara de buro best home.',3],\n ['435','lampara de buro best home.',3],\n ['4','Lavadora Acros',1],\n ['201','lavadora automatica daewo 14kg.',2],\n ['204','lavadora automatica daewo 19 kg.',3],\n ['200','lavadora automatica daewo 19kg.',4],\n ['143','licuadora americam',2],\n ['10','Licuadora American',1],\n ['20','Licuadora American',2],\n ['21','Licuadora American',1],\n ['22','Licuadora American',2],\n ['34','Licuadora American',3],\n ['36','Licuadora American',1],\n ['37','Licuadora American',2],\n ['462','Licuadora American',3],\n ['89','licuadora american.',4],\n ['142','licuadora oster',3],\n ['151','licuadora oster',1],\n ['177','Licuadora Oster',2],\n ['483','Licuadora Oster',3],\n ['198','Licuadora Taurus',4],\n ['359','Licuadora Taurus',1],\n ['388','Licuadora Taurus',2],\n ['574','Make up collection 89pz',3],\n ['575','Make up collection 89pz',4],\n ['579','Make up collection 89pz',1],\n ['576','Make up collection 96pz',2],\n ['577','Make up collection 96pz',3],\n ['578','Make up collection 96pz',4],\n ['226','maleta etco travel.',3],\n ['227','maleta etco travel.',1],\n ['174','Maleta LQ Chica',2],\n ['173','Maleta LQ Mediana',3],\n ['59','Manta de Polar Mainstays',4],\n ['60','Manta de Polar Mainstays',1],\n ['61','Manta de Polar Mainstays',2],\n ['342','Manta de Polar Mainstays',3],\n ['343','Manta de Polar Mainstays',4],\n ['344','Manta de Polar Mainstays',3],\n ['345','Manta de Polar Mainstays',4],\n ['346','Manta de Polar Mainstays',2],\n ['347','Manta de Polar Mainstays',3],\n ['348','Manta de Polar Mainstays',1],\n ['591','Manta de Polar Mainstays',2],\n ['652','Manta Mainstays azul',3],\n ['651','Manta Mainstays gris',4],\n ['648','Manta polar Azul',1],\n ['657','Manta polar café',2],\n ['656','Manta polar gris',3],\n ['649','Manta polar verde',4],\n ['398','Maquina para el cabello Timco',1],\n ['549','Maquina para palomitas sunbeam',2],\n ['603','Matraka con dados 16pz Santul',3],\n ['105','microondas daewoo.',2],\n ['106','microondas daewoo.',2],\n ['202','microondas daewoo.',2],\n ['249','Olla de Aluminio c/tapa Hometrends 1.9 litros',3],\n ['250','Olla de Aluminio c/tapa Hometrends 1.9 litros',4],\n ['247','Olla de Aluminio c/tapa Hometrends 2.8 litros',1],\n ['248','Olla de Aluminio c/tapa Hometrends 2.8 litros',2],\n ['246','Olla de Aluminio c/tapa Hometrends 4.7 litros',3],\n ['160','olla de coccion lenta black & decker.',4],\n ['492','olla de lento cocimiento Black and decker',1],\n ['473','Olla de lento cocimiento hamilton beach',2],\n ['464','Olla Lento Cocimiento Black Decker',3],\n ['181','Olla Lento Cocimiento Hamilton Beach',4],\n ['378','Olla Lento Cocimiento Hamilton Beach',1],\n ['187','Parrilla Electrica Michel',2],\n ['368','Parrilla Electrica Michel',3],\n ['77','parrilla electrica michel.',4],\n ['149','parrilla electrica taurus',1],\n ['150','parrilla electrica taurus',2],\n ['377','Parrilla Michel',3],\n ['82','parrillera electrica michel.',4],\n ['408','Perfiladora tauros',1],\n ['409','Perfiladora tauros',2],\n ['410','Perfiladora tauros',3],\n ['11','Plancha Black & Decker',4],\n ['14','Plancha Black & Decker',1],\n ['15','Plancha Black & Decker',2],\n ['16','Plancha Black & Decker',3],\n ['17','Plancha Black & Decker',4],\n ['18','Plancha Black & Decker',1],\n ['78','plancha black & decker.',2],\n ['79','plancha black & decker.',3],\n ['80','plancha black & decker.',4],\n ['103','plancha black & decker.',1],\n ['19','Plancha Taurus',2],\n ['122','plancha taurus.',3],\n ['123','plancha taurus.',4],\n ['500','Platos Crisa (12pz)',1],\n ['43','Platos elite (3pz)',2],\n ['450','Platos porcelana elit (3pz)',3],\n ['30','Proctor Silex (exprimidor)',4],\n ['384','Rasuradora timco Men',1],\n ['407','Razones crisa (8pz)',2],\n ['357','Recamara',3],\n ['451','Recipientes Best Home (3pz)',4],\n ['313','recortadora de barba y bigote conair.',1],\n ['314','recortadora de barba y bigote conair.',2],\n ['315','recortadora de barba y bigote conair.',3],\n ['316','recortadora de barba y bigote conair.',4],\n ['317','recortadora de barba y bigote conair.',1],\n ['320','recortadora de barba y bigote conair.',2],\n ['514','Recortadora de barba y bigote conair.',2],\n ['2','Refrigerador Mabe',3],\n ['542','Reloj de pared',4],\n ['590','Reloj Home Trends',1],\n ['322','rizador de cabello taurus.',2],\n ['323','rizador de cabello taurus.',3],\n ['324','rizador de cabello taurus.',4],\n ['325','rizador de cabello taurus.',1],\n ['326','rizador de cabello taurus.',2],\n ['327','rizador de cabello taurus.',3],\n ['328','rizador de cabello taurus.',1],\n ['329','rizador de cabello taurus.',2],\n ['330','rizador de cabello taurus.',3],\n ['331','rizador de cabello taurus.',1],\n ['362','Ropero',2],\n ['50','Sandwichera Black & Decker',4],\n ['62','Sandwichera Black & Decker',4],\n ['81','sandwichera black and decker',3],\n ['40','Santa Elenita (16pz)',2],\n ['52','Sarten electrico Holstein',1],\n ['351','Sarten electrico Holstein',4],\n ['356','Secadora Conair',3],\n ['139','secadora conair.',3],\n ['140','secadora conair.',1],\n ['332','Secadora Mediana Conair',2],\n ['333','Secadora Mediana Conair',3],\n ['334','Secadora Mediana Conair',4],\n ['164','secadora timco.',1],\n ['297','set de accesorios para asar 3 pzas acero inoxidable.',2],\n ['298','set de accesorios para asar 3 pzas acero inoxidable.',3],\n ['296','set de accesorios para asar 3 pzas. Acero inoxidable.',4],\n ['294','set de accesorios para asar 3 pzas. Outdoor trend',1],\n ['295','set de accesorios para asar 3 pzas. Outdoor trend',2],\n ['571','Set de brochas 6pz Cosmetic Lab',3],\n ['543','Set de cubiertos 24 piezas',4],\n ['544','Set de cubiertos 24 piezas',1],\n ['594','Set de cuchillos Acero Inoxidable',2],\n ['595','Set de cuchillos Acero Inoxidable',3],\n ['596','Set de cuchillos Acero Inoxidable',2],\n ['493','Set de tazas (3pz) Main Stayns',1],\n ['192','Set de Tazones (3pz)',2],\n ['513','Set de Tazones (3pz) Main Stayns',3],\n ['598','Set de tazones 3pz',4],\n ['631','Set de tazones 3pz Main Stays',1],\n ['460','Set de Tazones Mainstays (3pz)',2],\n ['661','Set de utencilios Backyard Grill',4],\n ['597','Set de utencilios de bambu',4],\n ['654','Set de utencilios de bambu',3],\n ['655','Set de utencilios de bambu',1],\n ['611','Set de vaso 8 pz Crisa',2],\n ['612','Set de vaso 8 pz Crisa',3],\n ['613','Set de vaso 8 pz Crisa',4],\n ['614','Set de vaso 8 pz Crisa',1],\n ['615','Set de vaso 8 pz Crisa',2],\n ['517','Set Oasis (2pz)',3],\n ['605','Silla mariposa Main Stays',4],\n ['606','Silla mariposa Main Stays',1],\n ['5','Smart TV RCA 40\"',2],\n ['228','sofacama hometrends.',3],\n ['601','Stanley Control Grip 29pz',4],\n ['382','Tablet tech pad \"7\"',1],\n ['387','Tablet tech pad \"7\"',2],\n ['455','Tablet tech pad \"7\"',3],\n ['518','Tablet tech pad \"7\"',4],\n ['129','tablet tech pad 7\"',1],\n ['130','tablet tech pad 7\"',4],\n ['131','tablet tech pad 7\"',3],\n ['132','tablet tech pad 7\"',2],\n ['133','tablet tech pad 7\"',1],\n ['412','tazones crisa',4],\n ['413','tazones crisa',3],\n ['420','Tazones crisa (8pz)',2],\n ['452','Tazones crisa (8pz)',1],\n ['497','Tazones crisa (8pz)',4],\n ['90','tazones crisa 8 pzas.',3],\n ['92','tazones crisa 8 pzas.',2],\n ['56','Tazones de Vidrio Crisa',1],\n ['415','Tazones Maintavs (3pz)',4],\n ['441','Tazones Maintavs (3pz)',3],\n ['498','Tazones Maintays (3pz)',2],\n ['234','Televición Led Smart FHD TV 40\" RCA',1],\n ['215','television orizzonte 43\" smart.',4],\n ['205','television quaroni 32\" led.',3],\n ['206','television quaroni 32\" led.',2],\n ['207','television quaroni 32\" led.',1],\n ['208','television quaroni 32\" led.',2],\n ['209','television quaroni 32\" led.',4],\n ['210','television quaroni 32\" led.',2],\n ['211','television quaroni 32\" led.',3],\n ['212','television quaroni 32\" led.',4],\n ['213','television quaroni 32\" led.',2],\n ['214','television quaroni 32\" led.',4],\n ['111','tetera best home.',1],\n ['33','Tetera Electrica RCA',2],\n ['35','Tetera RCA',1],\n ['169','Tetera RCA',3],\n ['393','Tetera RCA',1],\n ['463','Tetera RCA',2],\n ['117','t-fal duo cups.',2],\n ['355','Tostador Best Home',3],\n ['479','Tostador de pan Taurus',1],\n ['145','tostador taurus',2],\n ['185','Tostador Taurus',3],\n ['186','Tostador Taurus',4],\n ['550','Tres espejos Home creations',1],\n ['551','Tres espejos Home creations',2],\n ['484','Vajilla (12pz) Bormioli',3],\n ['491','Vajilla (12pz) Crisa',4],\n ['51','Vajilla (12pz) Venecia',1],\n ['474','Vajilla (12pz)Bormioli',2],\n ['616','Vajilla 12pz Andalucita',3],\n ['617','Vajilla 12pz Home Gallery',4],\n ['503','Vajilla Bicrila (12pz)',1],\n ['502','Vajilla Crisa (12pz)',2],\n ['556','Vajilla Crisa (12pz)',3],\n ['557','Vajilla Crisa (8pz)',4],\n ['630','Vajilla de porcelana 12pz Home Gallery',1],\n ['628','Vajilla de vidrio 12pz crisa',2],\n ['629','Vajilla de vidrio 12pz crisa',3],\n ['446','Vajilla Ebro (12pz)',3],\n ['447','Vajilla Ebro (12pz)',1],\n ['472','vajilla para 4 personas opal glass',1],\n ['476','Vajilla para 5 personas Bormioli',3],\n ['58','Vajilla Santa Elenita (16pz)',2],\n ['88','vajilla venecia 12 pzas.',1],\n ['93','vajilla venecia 12 pzas.',1],\n ['94','vajilla venecia 12 pzas.',2],\n ['98','vajilla venecia 12 pzas.',3],\n ['516','vajilla venecia 12 pzas.',4],\n ['65','Vajilla Vicria (12pz)',1],\n ['389','Vajilla vicrila (12pz)',2],\n ['432','Vajilla vicrila (12pz)',3],\n ['521','Vajillas Santa Anita (16pz)',4],\n ['127','vallija 12 pzs crisa.',1],\n ['547','Vaporera 5.2 lts Hammilton',2],\n ['496','Vaso Bassic (8pz)',3],\n ['53','Vasos (6pz) Bassic',4],\n ['54','Vasos (6pz) Bassic',2],\n ['55','Vasos (6pz) Bassic',1],\n ['24','Vasos (8pz) Bassic',3],\n ['25','Vasos (8pz) Bassic',1],\n ['13','Vasos (8pz) Crisa',3],\n ['391','Vasos Bassic (6pz)',4],\n ['394','Vasos Bassic (6pz)',3],\n ['396','Vasos Bassic (6pz)',1],\n ['436','Vasos Bassic (8pz)',4],\n ['445','Vasos Bassic (8pz)',4],\n ['515','Vasos Bassic (8pz)',4],\n ['170','vasos bassic 6 pzas.',1],\n ['87','vasos bassic 8 pzas.',2],\n ['95','vasos bassic 8 pzas.',3],\n ['28','Vasos Crisa (8pz)',1],\n ['161','Vasos Crisa (8pz)',2],\n ['162','Vasos Crisa (8pz)',3],\n ['83','vasos crisa 8 pzas.',1],\n ['86','vasos crisa 8 pzas.',2],\n ['96','vasos crisa 8 pzas.',3],\n ['97','vasos crisa 8 pzas.',1],\n ['100','vasos crisa 8 pzas.',1],\n ['146','vasos crisa 8 pzas.',2],\n ['424','Vasos España (10pz)',3],\n ['499','Vasos España (10pz)',1],\n ['509','Vasos España (10pz)',2],\n ['512','Vasos España (10pz)',3],\n ['381','Vasos glaze',1],\n ['453','Vasos Glaze (6pz)',2],\n ['454','Vasos Glaze (6pz)',1],\n ['494','Vasos Glaze (6pz)',2],\n ['495','Vasos Glaze (6pz)',1],\n ['506','Vasos Glaze (6pz)',2],\n ['508','Vasos Glaze (6pz)',1],\n ['523','Vasos glaze (6pz)',4],\n ['524','Vasos glaze (6pz)',3],\n ['525','Vasos glaze (6pz)',2],\n ['526','Vasos glaze (6pz)',3],\n ['527','Vasos glaze (6pz)',4],\n ['528','Vasos glaze (6pz)',2],\n ['533','Vasos Glaze (6pz)',3],\n ['45','Vasos Glazé (6pz)',4],\n ['46','Vasos Glazé (6pz)',2],\n ['47','Vasos Glazé (6pz)',3],\n ['114','vasos glazé 6 pzs',4],\n ['115','vasos glazé 6 pzs',2],\n ['126','vasos glazé 6 pzs',3],\n ['141','vasos glazé 6 pzs',2],\n ['109','vasos vicrila 8 pzas.',3],\n ['363','Ventilador Taurus',2],\n ['27','Vitrolero (3 tLts)',3],\n ['482','Vitrolero practico Jema flex',2],\n ['587','Zapatero 2 niveles',3],\n ['588','Zapatero 2 niveles',2],\n ['589','Zapatero 2 niveles',3],\n ['475','Juego de 6 vasos de cristal',4]\n ];\n\n foreach ($priceList as $key => $priceName) {\n Prize::create([\n 'article_no' => $priceName[0],\n 'name' => $priceName[1],\n 'batch' => $priceName[2],\n ]);\n }\n }", "public function get_prices()\n\t{\n\t\t$product_price_old = 0;\n\t\t$product_price_sale = 0;\n\t\t$price = 0;\n\t\t$eco = 0;\n\t\t$taxes = 0;\n\t\t$dataoc = isset($this->request->post['dataoc']) ? $this->request->post['dataoc'] : '';\n\n\t\tif (!empty($dataoc)) {\n\t\t\t$dataoc = str_replace('&quot;', '\"', $dataoc);\n\t\t\t$json = @json_decode($dataoc, true);\n\t\t\t$product_quantity = isset($json['quantity']) ? $json['quantity'] : 0;\n\t\t\t$product_id_oc = isset($json['product_id_oc']) ? $json['product_id_oc'] : 0;\n\t\t\tif ($product_id_oc == 0) $product_id_oc = isset($json['_product_id_oc']) ? $json['_product_id_oc'] : 0;\n\n\t\t\t// get options\n\t\t\t$options = isset($json['option_oc']) ? $json['option_oc'] : array();\n\t\t\tforeach ($options as $key => $value) {\n\t\t\t\tif ($value == null || empty($value)) unset($options[$key]);\n\t\t\t}\n\n\t\t\t// get all options of product\n\t\t\t$options_temp = $this->get_options_oc($product_id_oc);\n\n\t\t\t// Calc price for ajax\n\t\t\tforeach ($options_temp as $value) {\n\t\t\t\tforeach ($options as $k => $option_val) {\n\t\t\t\t\tif ($k == $value['product_option_id']) {\n\t\t\t\t\t\tif ($value['type'] == 'checkbox' && is_array($option_val) && count($option_val) > 0) {\n\t\t\t\t\t\t\tforeach ($option_val as $val) {\n\t\t\t\t\t\t\t\tforeach ($value['product_option_value'] as $op) {\n\t\t\t\t\t\t\t\t\t// calc price\n\t\t\t\t\t\t\t\t\tif ($val == $op['product_option_value_id']) {\n\t\t\t\t\t\t\t\t\t\tif ($op['price_prefix'] == $this->minus) $price -= isset($op['price_no_tax']) ? $op['price_no_tax'] : 0;\n\t\t\t\t\t\t\t\t\t\telse $price += isset($op['price_no_tax']) ? $op['price_no_tax'] : 0;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} elseif ($value['type'] == 'radio' || $value['type'] == 'select') {\n\t\t\t\t\t\t\tforeach ($value['product_option_value'] as $op) {\n\t\t\t\t\t\t\t\tif ($option_val == $op['product_option_value_id']) {\n\t\t\t\t\t\t\t\t\tif ($op['price_prefix'] == $this->minus) $price -= isset($op['price_no_tax']) ? $op['price_no_tax'] : 0;\n\t\t\t\t\t\t\t\t\telse $price += isset($op['price_no_tax']) ? $op['price_no_tax'] : 0;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// the others have not price, so don't need calc\n\t\t\t\t\t}\n\t\t\t\t\t// if not same -> return.\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$product_prices = $this->get_product_price($product_id_oc, $product_quantity);\n\t\t\t$product_price_old = isset($product_prices['price_old']) ? $product_prices['price_old'] : 0;\n\t\t\t$product_price_sale = isset($product_prices['price_sale']) ? $product_prices['price_sale'] : 0;\n\t\t\t$enable_taxes = $this->config->get('tshirtecommerce_allow_taxes');\n\t\t\tif ($enable_taxes === null || $enable_taxes == 1) {\n\t\t\t\t$taxes = isset($product_prices['taxes']) ? $product_prices['taxes'] : 0;\n\t\t\t\t$eco = isset($product_prices['eco']) ? $product_prices['eco'] : 0;\n\t\t\t} else {\n\t\t\t\t$taxes = 0;\n\t\t\t\t$eco = 0;\n\t\t\t}\n\t\t\t\n\t\t} // do nothing when empty/blank\n\n\t\t// return price for ajax\n\t\techo @json_encode(array(\n\t\t\t'price' => $price, \n\t\t\t'price_old' => $product_price_old, \n\t\t\t'price_sale' => $product_price_sale, \n\t\t\t'taxes' => $taxes,\n\t\t\t'eco' => $eco\n\t\t));\n\t\treturn;\n\t}", "protected function convertPriceList() {\n\t\t$retArray =array();\n\t\t\n\t\tforeach ($this->DetailPriceList as $name => $nameValue) {\n\t\t\t$description = '';\n\t\t\t$unit = '';\n\t\t\t$price = 0;\n\t\t\t$avgPrice = 0;\n\t\t\tif (is_array($nameValue)) {\n\t\t\t\tforeach ($nameValue as $desc => $prices) {\n\t\t\t\t\tif (is_array($prices)) {\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$price = $nameValue;\n\t\t\t\t$avgPrice = $price;\n\t\t\t}\n\t\t\t$retArray[] = array($name,$description, $unit,$price, $avgPrice );\n\t\t}\n\t}", "private function generateOutputData()\n {\n $output = [];\n $products = Cart::content();\n // Loop over the products to add the unit price and total in the right format.\n foreach ($products as $product) {\n $unit_price = $product->price / 100;\n $product->unit_price = number_format($unit_price, 2);\n // TODO Fix this hack\n $product->quantity = $product->qty;\n $product->total_price = number_format($unit_price * $product->qty, 2);\n\n $product->available = $product->model->isQuantityAvailable((int) $product->quantity);\n }\n\n $output['products'] = $products;\n $output['disable_creation'] = $products->isEmpty() && $this->getCustomerId() === null;\n $output['company'] = Company::find(1);\n $output['customer'] = Customer::find($this->getCustomerId());\n\n $elements = ['subtotal', 'tax', 'total'];\n // Use PHP magic to dynamically get the elements from the array\n // calling their respective functions from Cart.\n foreach ($elements as $element) {\n $output[$element] = (float) Cart::$element(2, '.', '') / 100;\n $output[$element] = number_format($output[$element], 2);\n }\n\n return $output;\n }", "public function getPrices() {\n // get available price information\n $pricesAsDom = $this->product->get(\"SupplyDetail/Price\");\n\n // get child nodes as array\n $pricesAsArray = array_map(array($this,'_childNodes2Array'), $pricesAsDom);\n return $pricesAsArray;\n }", "public function listProductprices(){\n try{\n $sql = \"Select * from productforsale pr inner join product p on pr.id_product = p.id_product inner join categoryp c on p.id_categoryp = c.id_categoryp inner join medida m on p.product_unid_type = m.medida_id\";\n $stm = $this->pdo->prepare($sql);\n $stm->execute();\n $result = $stm->fetchAll();\n } catch (Exception $e){\n $this->log->insert($e->getMessage(), 'Inventory|listProductprices');\n $result = 2;\n }\n\n return $result;\n }", "public function getSalePrices()\n {\n return $this->postRequest('GetSalePrices');\n }", "public function get_price() {\n $query = $this->db->query(\"SELECT * FROM price \");\n\n if ($query) {\n return $query->result_array();\n }\n }", "protected function parseResult()\n\t{\n\t\t$result = [];\n\t\tif(!empty($this->result)) {\n\t\t\tforeach($this->crypto as $pair => $coin) {\n\t\t\t\tif(!empty($this->result[$pair])) {\n\t\t\t\t\t$result[$coin] = $this->result[$pair]['last'];\n\t\t\t\t}\n\t\t\t}\n\t\t\t$this->price = $result;\n\t\t\treturn;\n\t\t}\n\n\t\tthrow new Exception(\"Price error \" . __CLASS__);\n\t}", "function prodottiPriceArray($con) {\n $resultPrd = mysqli_query($con, \"SELECT * FROM prodotti\");\n while($rowPrd = mysqli_fetch_array($resultPrd)) {\n $prd_array = array();\n $prd_id = $rowPrd['prd_id'];\n $prd_price_1 = $rowPrd['prd_price_1'];\n $prd_price_2 = $rowPrd['prd_price_2'];\n $prd_price_3 = $rowPrd['prd_price_3'];\n $prd_price_4 = $rowPrd['prd_price_4'];\n $prd_price_5 = $rowPrd['prd_price_5'];\n $prd_price_6 = $rowPrd['prd_price_6'];\n $prd_tab_1 = $rowPrd['prd_tab_1'];\n $prd_tab_2 = $rowPrd['prd_tab_2'];\n $prd_tab_3 = $rowPrd['prd_tab_3'];\n $prd_tab_4 = $rowPrd['prd_tab_4'];\n $prd_tab_5 = $rowPrd['prd_tab_5'];\n $prd_tab_6 = $rowPrd['prd_tab_6'];\n\n if($prd_price_1 != 0 || $prd_tab_1 != NULL) array_push($prd_array, (object) ['z' => (float)$prd_price_1, 'a' => (int)$prd_tab_1]);\n if($prd_price_2 != 0 || $prd_tab_2 != NULL ) array_push($prd_array, (object) ['z' => (float)$prd_price_2, 'a' => (int)$prd_tab_2]);\n if($prd_price_3 != 0 || $prd_tab_3 != NULL ) array_push($prd_array, (object) ['z' => (float)$prd_price_3, 'a' => (int)$prd_tab_3]);\n if($prd_price_4 != 0 || $prd_tab_4 != NULL ) array_push($prd_array, (object) ['z' => (float)$prd_price_4, 'a' => (int)$prd_tab_4]);\n if($prd_price_5 != 0 || $prd_tab_5 != NULL ) array_push($prd_array, (object) ['z' => (float)$prd_price_5, 'a' => (int)$prd_tab_5]);\n if($prd_price_6 != 0 || $prd_tab_6 != NULL ) array_push($prd_array, (object) ['z' => (float)$prd_price_6, 'a' => (int)$prd_tab_6]);\n\n $arraySrz = json_encode($prd_array);\n $sqlArray = \"UPDATE prodotti SET prd_price_array ='$arraySrz' WHERE prd_id = '$prd_id'\";\n mysqli_query($con,$sqlArray);\n }\n}", "public function getPrices(Collection $currencies)\n {\n $currencies = $currencies\n ->pluck('id', 'currency_code')\n ->map(function($id){\n return [\n 'id' => $id,\n 'currency_id' => null\n ];\n })->toArray();\n\n // add currencyIds\n foreach($this->currencyIds() as $currencyCode => $currencyID){\n if($currencies[$currencyCode]) {\n $currencies[$currencyCode]['currency_id'] = $currencyID;\n }\n }\n\n\n // exchangeRate\n $exchangeRate = $this->getExchangeRate();\n\n\n // make api call\n $version = '';\n $url = $this->apiBase . $version . '/public/ticker/ALL';\n $res = null;\n\n try{\n $res = Http::request(Http::GET, $url);\n }\n catch (\\Exception $e){\n // Error handling\n echo($e->getMessage());\n exit();\n }\n\n\n // data from API\n $data = [];\n $dataOriginal = json_decode($res->content, true);\n $data = $dataOriginal['data'];\n\n\n // Finalize data. [id, currency_id, price]\n $currencies = array_map(function($currency) use($data, $exchangeRate){\n $dataAvailable = true;\n if(is_array($currency['currency_id'])){\n foreach($currency['currency_id'] as $i){\n if(!isset($data[$i])){\n $dataAvailable = false;\n }\n }\n } else {\n $dataAvailable = isset($data[$currency['currency_id']]);\n }\n\n\n if($dataAvailable){\n if(is_array($currency['currency_id'])){ // 2 step\n $level1 = doubleval($data[$currency['currency_id'][0]]['closing_price']) / $exchangeRate;\n $level2 = doubleval($data[$currency['currency_id'][1]]['closing_price']) / $exchangeRate;\n $currency['price'] = $level1 * $level2;\n }\n else { // 1 step: string\n $currency['price'] = doubleval($data[$currency['currency_id']]['closing_price']) / $exchangeRate;\n }\n\n }\n else {\n $currency['price'] = null;\n }\n\n return $currency;\n\n }, $currencies);\n\n\n return $currencies;\n\n\n }", "function fetch_prices()\n {\n $data = $this->db->query('SELECT * FROM `users_prices` WHERE users_price_order != 999 ORDER BY users_price_order ASC');\n if (!isset($data[0])) {\n return false;\n }\n return $data;\n }", "public function getPrices($ean) {\n \t// 1. check digits length of EAN number and fill it with zero if necessary\n $ean = $this->checkDigitLen($ean);\n\n // 2. request search page by url\n // Create DOM from URL\n $html = file_get_html($this->host . '/search?hl=nl&output=search&tbm=shop&q=' . $ean);\n\n // 3. find the first product link on this page\n $prodLink = $this->findProdLink($html);\n\n // 4. add /online?hl=nl string to the end of the product link and compose url for product link\n $prodLink .= '/online?hl=nl';\n $prodLink = $this->host . $prodLink; // https://www.google.nl/shopping/product/12115883691353094589/online?hl=nl\n\n // 5. download the product link\n $downloadedProd = file_get_html($prodLink);\n\n // 6. Create an array with the prices\n return $this->createPricesArray($downloadedProd);\n\n }", "public function computePriceProvider(){\n\n /*Price once a child is < 4 years full day 0€*/\n yield [Booking::TYPE_DAY, '2019-01-01' , false, 0];\n /*Price once a child is < 4 years full day \"reduce\" 0€*/\n yield [Booking::TYPE_DAY, '2019-01-01', true, 0];\n /*Price once a child is < 4 years half day 0€*/\n yield [Booking::TYPE_HALF_DAY, '2019-01-01', false, 0];\n /*Price once a child is < 4 years half day \"reduce\" 0€*/\n yield [Booking::TYPE_HALF_DAY, '2019-01-01', true, 0];\n\n\n /*Price once a child is 4 - 12 years full day 8€*/\n yield [Booking::TYPE_DAY, '2014-01-01', false, 8];\n /*Price once a child is 4 - 12 years full day \"reduce\" 8€*/\n yield [Booking::TYPE_DAY, '2014-01-01', true, 8];\n /*Price once a child is 4 - 12 years half day 4€*/\n yield [Booking::TYPE_HALF_DAY, '2014-01-01', false, 4];\n /*Price once a child is 4 - 12 years half day \"reduce\" 4€*/\n yield [Booking::TYPE_HALF_DAY, '2014-01-01', true, 4];\n\n\n /*Price normal full day 16€*/\n yield [Booking::TYPE_DAY, '1980-01-01', false, 16];\n /*Price normal full day \"reduce\" 10€*/\n yield [Booking::TYPE_DAY, '1980-01-01', true, 10];\n /*Price normal half day 8€*/\n yield [Booking::TYPE_HALF_DAY, '1980-01-01', false, 8];\n /*Price normal half day \"reduce\" 5€*/\n yield [Booking::TYPE_HALF_DAY, '1980-01-01', true, 5];\n\n\n /*Price senior >60 years full day 12€*/\n yield [Booking::TYPE_DAY, '1955-01-01', false, 12];\n /*Price senior >60 years full day \"reduce\" 10€*/\n yield [Booking::TYPE_DAY, '1955-01-01', true, 10];\n /*Price senior >60 years half day 6€*/\n yield [Booking::TYPE_HALF_DAY, '1955-01-01', false, 6];\n /*Price senior >60 years half day \"reduce\" 5€*/\n yield [Booking::TYPE_HALF_DAY, '1955-01-01', true, 5];\n\n }", "function get_price_object() {\r\n\t\t$price_obj = array (\r\n\t\t\t\t\"Currency\" => false,\r\n\t\t\t\t\"TotalDisplayFare\" => 0,\r\n\t\t\t\t\"PriceBreakup\" => array (\r\n\t\t\t\t\t\t'BasicFare' => 0,\r\n\t\t\t\t\t\t'Tax' => 0,\r\n\t\t\t\t\t\t'AgentCommission' => 0,\r\n\t\t\t\t\t\t'AgentTdsOnCommision' => 0\r\n\t\t\t\t) \r\n\t\t);\r\n\t\treturn $price_obj;\r\n\t}", "public function getPriceHistory() { return array($this->getPrice()); }", "public function get_prices($ids)\n\t{\n\t\t$data = '';\n\n\t\t// create comma sepearted lists\n\t\t$items = '';\n\t\tforeach ($ids as $id) {\n\t\t\tif ($items != '') {\n\t\t\t\t$items .= ',';\n\t\t\t}\n\t\t\t$items .= $id;\n\t\t}\n\n\t\t// get multiple product info based on list of ids\n\t\tif($result = $this->Database->query(\"SELECT id, price FROM $this->db_table WHERE id IN ($items) ORDER BY name\" ))\n\t\t{\n\t\t\tif($result->num_rows > 0)\n\t\t\t{\n\t\t\t\twhile($row = $result->fetch_array())\n\t\t\t\t{\n\t\t\t\t\t$data[] = array(\n\t\t\t\t\t\t'id' => $row['id'],\n\t\t\t\t\t\t'price' => $row['price']\n\t\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $data;\n\n\t}", "public function run()\n {\n $prices = [\n [\n \"product_id\" => 1,\n \"amount\" => 39.90,\n \"started_at\" => Carbon::now(),\n \"finished_at\" => null\n ],\n [\n \"product_id\" => 2,\n \"amount\" => 49.90,\n \"started_at\" => Carbon::now(),\n \"finished_at\" => null\n ],\n [\n \"product_id\" => 3,\n \"amount\" => 69.90,\n \"started_at\" => Carbon::now(),\n \"finished_at\" => null\n ],\n [\n \"product_id\" => 4,\n \"amount\" => 39.90,\n \"started_at\" => Carbon::now(),\n \"finished_at\" => null\n ],\n [\n \"product_id\" => 5,\n \"amount\" => 49.90,\n \"started_at\" => Carbon::now(),\n \"finished_at\" => null\n ],\n [\n \"product_id\" => 6,\n \"amount\" => 69.90,\n \"started_at\" => Carbon::now(),\n \"finished_at\" => null\n ],\n\n // [\n // \"product_id\" => 1,\n // \"amount\" => 7.89,\n // \"started_at\" => Carbon::now(),\n // \"finished_at\" => Carbon::now()->addDay(7)\n // ],\n // [\n // \"product_id\" => 1,\n // \"amount\" => 9.99,\n // \"started_at\" => Carbon::now()->addDay(7),\n // \"finished_at\" => Carbon::now()->addDay(10)\n // ],\n // [\n // \"product_id\" => 1,\n // \"amount\" => 12,\n // \"started_at\" => Carbon::now(),\n // \"finished_at\" => null\n // ],\n // [\n // \"product_id\" => 2,\n // \"amount\" => (mt_rand(100, 5000) / 100),\n // \"started_at\" => Carbon::now(),\n // \"finished_at\" => Carbon::now()->addDay(5)\n // ],\n // [\n // \"product_id\" => 2,\n // \"amount\" => (mt_rand(100, 5000) / 100),\n // \"started_at\" => Carbon::now()->addDay(5),\n // \"finished_at\" => null\n // ],\n // [\n // \"product_id\" => 3,\n // \"amount\" => (mt_rand(100, 5000) / 100),\n // \"started_at\" => Carbon::now(),\n // \"finished_at\" => Carbon::now()->addDay(2)\n // ],\n // [\n // \"product_id\" => 3,\n // \"amount\" => (mt_rand(100, 5000) / 100),\n // \"started_at\" => Carbon::now()->addDay(2),\n // \"finished_at\" => null\n // ],\n // [\n // \"product_id\" => 4,\n // \"amount\" => (mt_rand(100, 5000) / 100),\n // \"started_at\" => Carbon::now(),\n // \"finished_at\" => null\n // ],\n // [\n // \"product_id\" => 5,\n // \"amount\" => 17.89,\n // \"started_at\" => Carbon::now(),\n // \"finished_at\" => Carbon::now()->addDay(7)\n // ],\n // [\n // \"product_id\" => 5,\n // \"amount\" => 19.99,\n // \"started_at\" => Carbon::now()->addDay(7),\n // \"finished_at\" => Carbon::now()->addDay(10)\n // ],\n // [\n // \"product_id\" => 5,\n // \"amount\" => 14,\n // \"started_at\" => Carbon::now(),\n // \"finished_at\" => null\n // ],\n // [\n // \"product_id\" => 6,\n // \"amount\" => (mt_rand(100, 5000) / 100),\n // \"started_at\" => Carbon::now(),\n // \"finished_at\" => Carbon::now()->addDay(5)\n // ],\n // [\n // \"product_id\" => 6,\n // \"amount\" => (mt_rand(100, 5000) / 100),\n // \"started_at\" => Carbon::now()->addDay(5),\n // \"finished_at\" => null\n // ],\n // [\n // \"product_id\" => 7,\n // \"amount\" => (mt_rand(100, 5000) / 100),\n // \"started_at\" => Carbon::now(),\n // \"finished_at\" => Carbon::now()->addDay(2)\n // ],\n // [\n // \"product_id\" => 7,\n // \"amount\" => (mt_rand(100, 5000) / 100),\n // \"started_at\" => Carbon::now()->addDay(2),\n // \"finished_at\" => null\n // ],\n // [\n // \"product_id\" => 8,\n // \"amount\" => (mt_rand(100, 5000) / 100),\n // \"started_at\" => Carbon::now(),\n // \"finished_at\" => null\n // ],\n // [\n // \"product_id\" => 9,\n // \"amount\" => (mt_rand(100, 5000) / 100),\n // \"started_at\" => Carbon::now(),\n // \"finished_at\" => Carbon::now()->addDay(2)\n // ],\n // [\n // \"product_id\" => 9,\n // \"amount\" => (mt_rand(100, 5000) / 100),\n // \"started_at\" => Carbon::now()->addDay(2),\n // \"finished_at\" => null\n // ],\n // [\n // \"product_id\" => 10,\n // \"amount\" => (mt_rand(100, 5000) / 100),\n // \"started_at\" => Carbon::now(),\n // \"finished_at\" => null\n // ],\n // [\n // \"product_id\" => 11,\n // \"amount\" => (mt_rand(100, 5000) / 100),\n // \"started_at\" => Carbon::now(),\n // \"finished_at\" => null\n // ],\n // [\n // \"product_id\" => 12,\n // \"amount\" => (mt_rand(100, 5000) / 100),\n // \"started_at\" => Carbon::now(),\n // \"finished_at\" => null\n // ]\n ];\n\n foreach ($prices as $price) {\n $price = Price::create([\n \"product_id\" => $price[\"product_id\"],\n \"amount\" => $price[\"amount\"],\n \"started_at\" => $price[\"started_at\"],\n \"finished_at\" => $price[\"finished_at\"]\n ]);\n }\n }", "function getProducts() {\n\t\t$saleData = array();\n\t\tif($stmt = $this->connection->prepare(\"select * from products;\")) {\n\t\t\t$stmt -> execute();\n\n\t\t\t$stmt->store_result();\n\t\t\t$stmt->bind_result($id, $itemName, $itemImage, $itemDesc, $salePrice, $regularPrice, $numberLeft);\n\n\t\t\tif($stmt ->num_rows >0){\n\t\t\t\twhile($stmt->fetch() ){\n\t\t\t\t\t$saleData[] = array(\n\t\t\t\t\t\t'id' => $id,\n\t\t\t\t\t\t'itemName' => $itemName,\n\t\t\t\t\t\t'itemImage' => $itemImage,\n\t\t\t\t\t\t'itemDesc' => $itemDesc,\n\t\t\t\t\t\t'salePrice' => $salePrice,\n\t\t\t\t\t\t'regularPrice' => $regularPrice,\n\t\t\t\t\t\t'numberLeft' => $numberLeft\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $saleData;\n\t}", "public function getEmoneyPricelist($operator_id)\n {\n $user = Auth::user();\n $quickbuy = false;\n if ($user->is_store) {\n $quickbuy = true;\n }\n // switch operators\n $operator = 'GO PAY';\n switch ($operator_id) {\n case 22:\n $operator = 'MANDIRI E-TOLL';\n break;\n case 23:\n $operator = 'OVO';\n break;\n case 24:\n $operator = 'DANA';\n break;\n case 25:\n $operator = 'LinkAja';\n break;\n case 26:\n $operator = 'SHOPEE PAY';\n break;\n case 27:\n $operator = 'BRI BRIZZI';\n break;\n case 28:\n $operator = 'TAPCASH BNI';\n break;\n }\n\n // empty array to be filled with selected operator pricelist data\n $priceArr = [];\n // get all Prepaid Pricelist data from Cache if available or fresh fetch from API\n $prepaidPricelist = $this->getAllPrepaidPricelist();\n foreach ($prepaidPricelist['data'] as $row) {\n if ($row['category'] == 'E-Money') {\n $addedPrice = $row['price'] + 1000;\n $last3DigitsCheck = substr($addedPrice, -3);\n $check = 500 - $last3DigitsCheck;\n if ($check == 0) {\n $price = $addedPrice;\n }\n if ($check > 0 && $check < 500) {\n $price = $addedPrice + $check;\n }\n if ($check == 500) {\n $price = $addedPrice;\n }\n if ($check < 0) {\n $price = $addedPrice + (500 + $check);\n }\n\n if ($row['brand'] == $operator) {\n $priceArr[] = [\n 'buyer_sku_code' => $row['buyer_sku_code'],\n 'desc' => $row['desc'],\n 'price' => $price,\n 'brand' => $row['brand'],\n 'product_name' => $row['product_name'],\n 'seller_name' => $row['seller_name']\n ];\n }\n }\n }\n $pricelist = collect($priceArr)->sortBy('price')->toArray();\n $pricelistCall = null;\n\n return view('member.app.shopping.prepaid_pricelist')\n ->with('title', 'Isi Emoney')\n ->with(compact('pricelist'))\n ->with(compact('pricelistCall'))\n ->with(compact('quickbuy'))\n ->with('type', $operator_id);\n }", "static function generate_order_prices(Model_Cart $shopping_cart, $shipping_id=false, $payment_id=false, $raw_discount=0)\n {\n\n if($shopping_cart->total_cart_price_with_tax==0) return array();\n \n // nazvy indexu shodne s db tabulkou \"order\"\n \n // inicializace vsech promennych co se budou pocitat v kosiku\n \n $prices[\"order_price_no_vat\"]=0; // soucet cen produktu s nulovou dani\n $prices[\"order_price_lower_vat\"]=0; // soucet cen produktu s nizsi sazbou dane (vcetne dane)\n $prices[\"order_price_higher_vat\"]=0; // soucet cen produktu s vyssi sazbou dane (vcetne dane)\n\n // nasledujici se bude generovat az v create_order:\n $prices[\"order_no_vat_rate\"]=0; // \n $prices[\"order_lower_vat_rate\"]=db::select(\"hodnota\")->from(\"taxes\")->where(\"code\",\"=\",\"lower_vat\")->execute()->get(\"hodnota\"); // hodnota nizsi sazby dane\n $prices[\"order_higher_vat_rate\"]=db::select(\"hodnota\")->from(\"taxes\")->where(\"code\",\"=\",\"higher_vat\")->execute()->get(\"hodnota\"); // hodnota vyssi sazby dane\n \n $prices[\"order_lower_vat\"]=0; // soucet vsech nizsich dani na produktech\n $prices[\"order_higher_vat\"]=0; // soucet vsech vyssich dani na produktech\n \n $prices[\"order_total_without_vat\"]=0; // celkova cena kosiku bez dane\n $prices[\"order_total_with_vat\"]=0; // celkova cena kosiku s dani\n \n $prices[\"order_discount\"]=0; // hodnota slevy na objednavce (vcetne dane)\n \n $prices[\"order_total_with_discount\"]=0;// celkova cena kosiku s dani a zapoctenymi slevami \n \n $prices[\"order_shipping_price\"]=0; // cena dopravy s dani\n $prices[\"order_payment_price\"]=0; // cena platby s dani\n \n $prices[\"order_total\"]=0; // cena celkem po zapocitani dopravy a platby\n $prices[\"order_correction\"]=0; // hodnota zaokrouhleni platby\n $prices[\"order_total_CZK\"]=0; // cena k zaplaceni celkem po zaokrouhleni\n \n // udaje k doprave, ktera byla pouzita k vypoctu objednavky\n $prices[\"order_shipping_id\"]=0;\n $prices[\"order_shipping_nazev\"]=\"\";\n $prices[\"order_shipping_popis\"]=\"\";\n \n // udaje k platbe, ktera byla pouzita k vypoctu objednavky\n $prices[\"order_payment_id\"]=0;\n $prices[\"order_payment_nazev\"]=\"\";\n $prices[\"order_payment_popis\"]=\"\";\n \n \n \n // generovani vyse uvedenych promennych\n \n $prices[\"order_price_no_vat\"] = $shopping_cart->total_cart_price_no_tax;\n $prices[\"order_price_lower_vat\"] = $shopping_cart->total_cart_price_lower_tax;\n $prices[\"order_price_higher_vat\"] = $shopping_cart->total_cart_price_higher_tax;\n \n $prices[\"order_lower_vat\"] = $shopping_cart->total_lower_tax_value; \n $prices[\"order_higher_vat\"] = $shopping_cart->total_higher_tax_value;\n \n $prices[\"order_total_without_vat\"] = $shopping_cart->total_cart_price_without_tax; \n $prices[\"order_total_with_vat\"] = $shopping_cart->total_cart_price_with_tax; \n \n $prices[\"order_shipping_id\"] =$shipping_id;\n $prices[\"order_payment_id\"] =$payment_id;\n \n //////////////////////////////////////// \n // vypocet slev na objednavce TODO podle potreb projektu:\n $prices=static::calculate_order_discount($prices, $shopping_cart, $raw_discount);\n \n // prirazeni voucheru k objednavce\n $voucher=Service_Voucher::get_voucher();\n if($voucher)\n {\n $prices[\"order_voucher_id\"]=$voucher->id;\n $prices[\"order_voucher_discount\"]=$shopping_cart->total_cart_voucher_discount;\n }\n \n ////////////////////////////////////////\n $prices[\"order_total_with_discount\"] = $prices[\"order_total_with_vat\"]-$prices[\"order_discount\"];\n if($prices[\"order_total_with_discount\"]<0) $prices[\"order_total_with_discount\"]=0;\n \n // cena za dopdieravu\n if($shipping_id)\n {\n $shipping = orm::factory(\"shipping\",$shipping_id);\n $prices[\"order_shipping_nazev\"] = $shipping->nazev;\n $prices[\"order_shipping_popis\"] = $shipping->popis;\n // cena dopravy\n if($shipping->cenove_hladiny)\n {\n $prices[\"order_shipping_price\"] = Service_Hana_Shipping::get_level_price($shipping_id, round($prices[\"order_total_with_discount\"]));\n if($prices[\"order_shipping_price\"]==false) $prices[\"order_shipping_price\"]=$shipping->cena;\n }\n else\n { \n $prices[\"order_shipping_price\"] = $shipping->cena;\n } \n\n }\n\n // cena za platbu\n if($payment_id)\n {\n $payment = orm::factory(\"payment\",$payment_id);\n $prices[\"order_payment_nazev\"]=$payment->nazev;\n $prices[\"order_payment_popis\"]=$payment->popis;\n \n // vypocet platby na zaklade typu\n if($payment->typ==2)\n {\n // TODO - platba na zaklade hodnoty objednaneho zbozi \n $prices[\"order_payment_price\"] = $price[\"order_total_with_discount\"]($payment->cena/100); \n }\n else\n {\n $prices[\"order_payment_price\"] = $payment->cena;\n }\n \n $shp=$prices[\"order_shipping_price\"] + $prices[\"order_payment_price\"];\n if($shp<0) $prices[\"order_payment_price\"]=$prices[\"order_shipping_price\"]; // pokud je platba dana slevou, nelze se dostat do zaporu (jeji sleva je ve vysi max ceny dopravy)\n \n }\n \n //////////////////////////////////////////////\n $prices[\"order_total\"] = $prices[\"order_total_with_discount\"] + $prices[\"order_shipping_price\"] + $prices[\"order_payment_price\"];\n $prices[\"order_total_CZK\"] =round($prices[\"order_total\"]); \n $prices[\"order_correction\"] =$prices[\"order_total_CZK\"]-$prices[\"order_total\"]; \n \n return $prices;\n }", "public function getPrice();", "public function getPrice();", "public function getPrice();", "public function getPrice();", "function getListPriceOfCourt($input){\n $list_price = [];\n $hour_start = 0;\n $hour_end = 0;\n\n if($input['type'] == 'contract'){\n if($input['hour_start'] >= 0){\n $limit_hour = $input['hour_start'] + $input['hour_length'] <24 ? 4: (int)(24 - $input['hour_start']- 4);\n $hour_start = $input['hour_start'];\n $hour_end = $input['hour_start'] + $limit_hour;\n }else{\n $limit_hour = $input['hour_start'] + $input['hour_length'] <24 ? 4: (int)(24 - $input['hour_start']- 4);\n $hour_start = $input['hour_start'];\n $hour_end = $input['hour_start'] + $limit_hour;\n }\n }else\n {\n $limit_hour = $input['hour_start'] + $input['hour_length'] <= 24 ? 4 : (int)(24 - $input['hour_start']- 4);\n $hour_start = $input['hour_start'];\n $hour_end = $input['hour_start'] + $limit_hour;\n }\n\n for($i = $hour_start; $i<= $hour_end; $i++) {\n $input['hour_start'] = $i;\n $calPrice = getPriceForBooking($input);\n $calPrice['hour_start'] = $i;\n $calPrice['hour_length'] = $input['hour_length'];\n $list_price[] = $calPrice;\n }\n return $list_price;\n }", "function getFromDbPrice($mysqli){\n $array_price_fun = array(array());\n\n\n $sqlPrice = \"SELECT name, price ,description FROM Price\";\n\n $resultPrice = $mysqli->query($sqlPrice);\n\n $array_price_fun[0][0] = $resultPrice->num_rows;\n\n $i = 1 ;\n\n if ($resultPrice->num_rows > 0) {\n // output data of each row\n while($row = $resultPrice->fetch_assoc()) {\n\n $array_price_fun[$i][0] = $row[\"name\"];\n $array_price_fun[$i][1] = $row[\"price\"];\n $array_price_fun[$i][2] = $row[\"description\"];\n\n $i = $i +1 ;\n\n }\n }\n\n return $array_price_fun ;\n\n}", "abstract public function getPrice();", "function price(){\n\n\t\t$total = 0; //initialize to 0 lest error\n\n\t\tglobal $con;\n\n\t\t$ip=getIP();\n\n\t\t$sel_price = \"select * from cart where ip_add='$ip'\"; //get price from what is in the cart for whoevers ip address\n\n\t\t$run_price = mysqli_query($con, $sel_price);\n\n\t\twhile ($p_price = mysqli_fetch_array($run_price)){\n\n\t\t\t$pro_id = $p_price['p_id'];\n\n\t\t\t$pro_price = \"select * from products where product_id='$pro_id'\";\n\n\t\t\t$run_pro_price = mysqli_query($con, $pro_price);\n\n\t\t\t//link to the products table to get prices\n\t\t\twhile($pp_price = mysqli_fetch_array($run_pro_price)){\n\n\t\t\t\t$product_price = array($pp_price['product_price']);\n\t\t\t\t//array to get all the prices in one\n\n\t\t\t\t$values = array_sum($product_price);\n\n\t\t\t\t$total +=$values; //sum\n\n\t\t\t}\n\t\t}\n\n\t\techo \"Ksh\" . $total;\n\n\t}", "function get_price_rate($price)\n { \n $rtn = array();\n foreach ( $price as $key=>$item)\n { // cost\n if($item['rate_type']==2 && $item['customer_level_id']==0)\n $rtn['cost']=$item['zone']; \n //contract\n if($item['rate_type']==1 && $item['customer_level_id']==0)\n $rtn['contract']=$item['zone']; \n //customer L0\n if($item['rate_type']==3 && $item['customer_level_id']==1)\n $rtn['1']=$item['zone']; \n //customer L1\n if($item['rate_type']==3 && $item['customer_level_id']==2)\n $rtn['2']=$item['zone']; \n //customer L2\n if($item['rate_type']==3 && $item['customer_level_id']==3)\n $rtn['3']=$item['zone']; \n //customer L3\n if($item['rate_type']==3 && $item['customer_level_id']==4)\n $rtn['4']=$item['zone']; \n //customer L4\n if($item['rate_type']==3 && $item['customer_level_id']==5)\n $rtn['5']=$item['zone']; \n\n\n\n } \n return $rtn;\n }", "public function get_visible_price_data() : array {\n\t\treturn [\n\t\t\t'price_data' => [\n\t\t\t\t'min_price' => $this->get_min_price(),\n\t\t\t\t'max_price' => $this->get_max_price(),\n\t\t\t\t'min_discount_price' => $this->get_disc_min_price(),\n\t\t\t\t'max_discount_price' => $this->get_disc_max_price(),\n\t\t\t\t'currency_code' => $this->get_currency_code(),\n\t\t\t\t'discount_percent' => $this->get_discount_percentage(),\n\t\t\t],\n\t\t];\n\t}", "function allOptionCombos($input) {\n $result = array();\n $prices = array();\n $final = array();\n\n while (list($key, $values) = each($input)) {\n\n if (empty($values)) {\n continue;\n }\n if (empty($result)) {\n foreach($values as $value) {\n $result[] = array($key => $value);\n }\n }\n else {\n\n $append = array();\n\n foreach($result as &$product) {\n\n $product[$key] = array_shift($values);\n $copy = $product;\n foreach($values as $item) {\n $copy[$key] = $item;\n $append[] = $copy;\n }\n array_unshift($values, $product[$key]);\n }\n $result = array_merge($result, $append);\n }\n }\n\n foreach($result as $key => $res) {\n\n \t\t foreach($res as $opt) {\n\t \tif(strpos($opt, ';') !== false) {\n\t \t\t$price = explode(\";\", $opt);\n\t \t\t$prices[$key][0] = $prices[$key][0]+$price[1];\n\t \t}\n\t \telse {\n\t \t\t$prices[$key][0] = $prices[$key][0]+0;\n\t \t}\n\t }\n\n }\n\n $final['results'] = $result;\n $final['prices'] = $prices;\n\n return $final;\n}", "public function process_file_prices() {\n\t\tini_set('memory_limit', \"1048M\");\n\t\t// load config\n\t\t$this->load->config('retailer_file');\n\t\t$cfg = $this->config->item('retailer_file');\n\n\t\t$config = $cfg['inventory_prices'];\n\t\t$useFirstSheet = TRUE;\n\n\t\t// Get all rows into array\n\t\t$this->fileoperations->set_upload_lib_config_value(\"allowed_types\", 'xls|xlsx|csv');\n\t\t$this->fileoperations->add_folder_to_uploads_dir('storeinventory');\n\t\t$uploadResult = $this->fileoperations->upload('import_file', TRUE, './web');\n\n\t\t$fileInfo = $this->fileoperations->file_info;\n\t\trequire_once('./lib/phpExcel/PHPExcel.php');\n\t\trequire_once('./lib/phpExcel/PHPExcel/IOFactory.php');\n\n\t\t$xls = @PHPExcel_IOFactory::load($fileInfo['file_path'] . $fileInfo['file_name']);\n\n\t\t$result = array();\n\t\tforeach ($xls->getWorksheetIterator() as $worksheet) {\n\t\t\t$title = $worksheet->getTitle();\n\t\t\tif ($useFirstSheet) {\n\t\t\t\t$title = 'first|sheet';\n\t\t\t\t$useFirstSheet = FALSE;\n\t\t\t}\n\n\t\t\tif (!isset($config['worksheets'][$title])) {\n\t\t\t\tcontinue;\n\t\t\t} else {\n\t\t\t\t$worksheetConfig = $config['worksheets'][$title];\n\t\t\t\t$lastAlpha = array_merge($worksheetConfig['price_columns'],array_merge($worksheetConfig['cost_price_columns']), array_keys($worksheetConfig['identify_columns']));\n\t\t\t\tasort($lastAlpha);\n\t\t\t\t$lastAlpha = array_pop($lastAlpha);\n\t\t\t}\n\n\t\t\tforeach ($worksheet->getRowIterator() as $row) {\n\t\t\t\t$rowIndex = $row->getRowIndex();\n\t\t\t\t$cellIterator = $row->getCellIterator();\n\t\t\t\t$cellIterator->setIterateOnlyExistingCells(TRUE); // Loop all cells, even if it is not set\n\n\t\t\t\t$key = array();\n\t\t\t\t// Product price\n\t\t\t\t$price = null;\n\t\t\t\t// Product cost price\n\t\t\t\t$costPrice = null;\n\t\t\t\tforeach ($cellIterator as $cell) {\n\t\t\t\t\tif (!is_null($cell)) {\n\t\t\t\t\t\t$column = $cell->getColumn();\n\t\t\t\t\t\tif ($column > $lastAlpha) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (isset($worksheetConfig['identify_columns'][$column])) {\n\t\t\t\t\t\t\t$key[$worksheetConfig['identify_columns'][$column]] = $cell->getValue();\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Get product price\n\t\t\t\t\t\tif (in_array($column, $worksheetConfig['price_columns'])) {\n\t\t\t\t\t\t\t$p = $cell->getValue();\n\t\t\t\t\t\t\tif ($p !== '') {\n\t\t\t\t\t\t\t\tif (is_float($p)) {\n\t\t\t\t\t\t\t\t\t$p = (int)$p;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t$price += $p;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Get cost price\n\t\t\t\t\t\tif (in_array($column, $worksheetConfig['cost_price_columns'])) {\n\t\t\t\t\t\t\t$c = $cell->getValue();\n\t\t\t\t\t\t\tif ($c !== '') {\n\t\t\t\t\t\t\t\tif (is_float($c)) {\n\t\t\t\t\t\t\t\t\t$c = (int)$c;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t$costPrice += $c;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!empty($key)) {\n\t\t\t\t\t$key = json_encode($key);\n\t\t\t\t\tif (!empty($price) && $price !== null) {\n\t\t\t\t\t\t$result[$key]['price'] = $price;\n\t\t\t\t\t}\n\t\t\t\t\tif (!empty($costPrice) && $costPrice !== null) {\n\t\t\t\t\t\t$result[$key]['cost_price'] = $costPrice;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t$processedCount = 0;\n\t\tforeach ($result as $k => $v) {\n\t\t\t$k = json_decode($k, true);\n\t\t\tforeach ($k as $kk => $vv) {\n\t\t\t\t$k[$kk] = trim($vv);\n\t\t\t\t$k[$kk] = ltrim($vv, 0);\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\t$productGroup = ManagerHolder::get('ParameterGroup')->getOneWhere($k, 'id,product_id,bar_code');\n\t\t\t} catch (Exception $e) {\n\t\t\t\t$productGroup = array();\n\t\t\t}\n\n\t\t\t$entity = array();\n if ($productGroup) {\n\t $entity['product_group_id'] = $productGroup['id'];\n\t $entity['product_id'] = $productGroup['product_id'];\n\t $entity['bar_code'] = $productGroup['bar_code'];\n } else {\n\t $product = ManagerHolder::get('Product')->getOneWhere($k, 'id,bar_code,product_code');\n\t if ($product) {\n\t\t $entity['product_id'] = $product['id'];\n\t\t $entity['bar_code'] = $product['bar_code'];\n\t\t $entity['product_code'] = $product['product_code'];\n\t } else {\n\t\t continue;\n\t }\n }\n\t\t\tif (isset($v['price'])) {\n\t\t\t\tif (isset($entity['product_group_id'])) {\n\t\t\t\t\tManagerHolder::get('ParameterGroup')->updateById($entity['product_group_id'], 'price', $v['price']);\n\t\t\t\t}\n\t\t\t\tManagerHolder::get('Product')->updateById($entity['product_id'], 'price', $v['price']);\n\t\t\t}\n\t\t\tif (isset($v['cost_price'])) {\n\t\t\t\tManagerHolder::get('Product')->updateById($entity['product_id'], 'cost_price', $v['cost_price']);\n\t\t\t}\n\t\t\t$processedCount++;\n\t\t}\n\n\t\tManagerHolder::get('StoreInventory')->updateProductStatuses();\n\n\t\tif ($processedCount > 0) {\n\t\t\tset_flash_notice('Файл успешно обработан. Обновленно остатков: ' . $processedCount);\n\t\t} else {\n\t\t\tset_flash_error('Обновленно ' . $processedCount . ' остатков');\n\t\t}\n\n\t\t$this->redirectToReffer();\n\n\t}", "function GetPrice($symbol)\n{\n\t//google finance can only handle up to 100 quotes at a time so split up query then merge results\n\tif(count($symbol) > 100)\n\t{\n\t\t$retArr = array();\n\t\tfor($j=0; $j< count($symbol); $j +=100)\n\t\t{\n\t\t\t$arr = LookUpWithFormattedString(FormatString(array_slice($symbol, $j, 100)));\n\t\t\t$retArr = array_merge($retArr, $arr);\n\t\t}\n\t\treturn $retArr;\n\t}\n\telse\n\t\treturn LookUpWithFormattedString(FormatString($symbol));\n}", "public function retornaProdutos() {\n\n\t\t$produtos = $this->produtoModel->retornaProduto();\n\t\t\n\t\t$produtosComValor = array();\n\t\t\n\t\t$valorTotal = 0;\n\t\tforeach ($produtos as $key => $produto) {\n\t\t\t$valorParcial = $this->calculaValorProduto($produto->precoProduto, $produto->qtdeProduto);\n\t\t\t\n\t\t\t$produtos[$key]->valorParcialProduto = $valorParcial;\n\t\t\t\n\t\t\t$valorTotal += $valorParcial;\n\t\t}\n\n\t\t$produtosComValor['produtos'] = $produtos;\n\t\t$produtosComValor['total'] = number_format($valorTotal, 2, '.', '');\n\t\t\t\t\n\t\treturn $produtosComValor;\n\t}", "public function get() {\n $this->data = array(\n 101222 => array('label' => 'Awesome product', 'price' => 10.50, 'date_added' => '2012-02-01'),\n 101232 => array('label' => 'Not so awesome product', 'price' => 5.20, 'date_added' => '2012-03-20'),\n 101241 => array('label' => 'Pretty neat product', 'price' => 9.65, 'date_added' => '2012-04-15'),\n 101256 => array('label' => 'Freakishly cool product', 'price' => 12.55, 'date_added' => '2012-01-11'),\n 101219 => array('label' => 'Meh product', 'price' => 3.69, 'date_added' => '2012-06-11'),\n );\n }", "function &getAll()\r\n {\r\n $db =& eZDB::globalDatabase();\r\n \r\n $return_array = array();\r\n $currency_array = array();\r\n \r\n $db->array_query( $currency_array, \"SELECT ID FROM eZTrade_AlternativeCurrency ORDER BY Created\" );\r\n \r\n for ( $i=0; $i < count($currency_array); $i++ )\r\n {\r\n $return_array[$i] = new eZProductCurrency( $currency_array[$i][$db->fieldName( \"ID\" )], 0 );\r\n }\r\n \r\n return $return_array;\r\n }", "private function getProducts(): array\n {\n return $this->_type === 'price'\n ? $this->_priceProducts\n : $this->_stockProducts;\n }", "public function getJSONPrices()\n\t{\n\t\tif(!Storage::has('json/wristband/prices_size.json')) {\n // price array container.\n $prices = [];\n // get results.\n $priceList = $this->getPriceCodeAndName();\n \t\tif($priceList) {\n \t\t\tforeach($priceList as $key => $value) {\n \t\t\t\t$prices[strtolower($value->style_code)][$value->qty][$value->size_code] = $value->price;\n \t\t\t}\n \t\t}\n\t\t\t// generate and save .json file.\n\t\t\t Storage::put('json/wristband/prices_size.json', json_encode($prices));\n\t\t}\n\t\t// return data from .json file.\n\t\treturn json_decode(Storage::get('json/wristband/prices_size.json'), true);\n\t}", "private function _generateProductsData(){\n \n $products = $this->context->cart->getProducts();\n $pagseguro_items = array();\n \n $cont = 1;\n \n foreach ($products as $product) {\n \n $pagSeguro_item = new PagSeguroItem();\n $pagSeguro_item->setId($cont++);\n $pagSeguro_item->setDescription(Tools::truncate($product['name'], 255));\n $pagSeguro_item->setQuantity($product['quantity']);\n $pagSeguro_item->setAmount($product['price_wt']);\n $pagSeguro_item->setWeight($product['weight'] * 1000); // defines weight in gramas\n \n if ($product['additional_shipping_cost'] > 0)\n $pagSeguro_item->setShippingCost($product['additional_shipping_cost']);\n \n array_push($pagseguro_items, $pagSeguro_item);\n }\n \n return $pagseguro_items;\n }", "function getPricesAll($game_id, $round_number,$company_id){\r\n\t\t\t$prices=new Model_DbTable_Decisions_Mk_Prices();\r\n\t\t\t$result=$prices->getDecision($game_id, $company_id, $round_number);\r\n\t\t\treturn $result;\r\n\t\t}", "function listTestPrice() {\n\t\t$query = $this->db->query('SELECT a.*,b.* FROM '.$this->test_price_table.' AS a, '.$this->test_table.' AS b WHERE a.test_id=b.test_id AND a.status!=0');\n\t\treturn $query->result();\n\t}", "protected function _getItemsData()\n {\n if (Mage::app()->getStore()->getConfig(self::XML_PATH_RANGE_CALCULATION) == self::RANGE_CALCULATION_IMPROVED) {\n return $this->_getCalculatedItemsData();\n }\n\n $range = $this->getPriceRange();\n $dbRanges = $this->getRangeItemCounts($range);\n $data = array();\n\n if ($this->_filterValues) {\n foreach ($this->_filterValues as $fromPrice) {\n $index = (int) floor((round(($fromPrice) * 1, 2)) / $range) + 1;\n if (!isset($dbRanges[$index])) {\n $dbRanges[$index] = 0;\n }\n }\n }\n\n ksort($dbRanges);\n if (!empty($dbRanges)) {\n // $lastIndex = floor((round(($this->getMaxPriceInt()) * 1, 2)) / $range) + 1;\n $lastIndex = array_keys($dbRanges);\n $lastIndex = $lastIndex[count($lastIndex) - 1];\n\n foreach ($dbRanges as $index => $count) {\n $fromPrice = ($index == 1) ? '' : (($index - 1) * $range);\n $toPrice = ($index == $lastIndex) ? '' : ($index * $range);\n\n $data[$fromPrice] = array(\n 'label' => $this->_renderRangeLabel($fromPrice, $toPrice),\n 'value' => $fromPrice . '-' . $toPrice,\n 'count' => $count,\n 'selected' => (is_array($this->_filterValues) && in_array($fromPrice, $this->_filterValues))\n );\n }\n }\n\n return $data;\n }", "function builder_price() {\n\n $this->Item->recursive = 0;\n\n if( !isset($this->params['named']['limit']) ) {\n $this->paginate['limit'] = REPORT_LIMIT;\n $this->paginate['maxLimit'] = REPORT_LIMIT;\n }\n elseif( isset($this->params['named']['limit']) && $this->params['named']['limit'] != 'All' ) {\n $this->paginate['limit'] = isset($this->params['named']['limit']) ? $this->params['named']['limit'] : REPORT_LIMIT;\n $this->paginate['maxLimit'] = isset($this->params['named']['limit']) ? $this->params['named']['limit'] : REPORT_LIMIT;\n }\n else {\n $this->paginate['limit'] = 0;\n $this->paginate['maxLimit'] = 0;\n }\n $this->Prg->commonProcess();\n $this->paginate['conditions'] = $this->Item->parseCriteria($this->passedArgs);\n $this->paginate['conditions']['Item.base_item']['base_item'] = 0;\n\n $items = $this->paginate();\n $paginate = true;\n $legend = \"Items\";\n\n $this->set(compact('items', 'paginate', 'legend'));\n }", "public function mainform_get_quotes()\n\t{\n\t\t$quotes = $this->get_quotes();\n\t// process the quotes\n\t\tforeach($quotes as $key => &$value)\n\t\t{\n\t\t $tmp = (array) $value;\n\t\t $quotes[$key] = $tmp['price'];\n\t\t} \n\t\tksort($quotes);\n\t\t$data['quotes'] = $quotes;\n\t\treturn $quotes;\n\t}", "public static function GetProdutos(){\n self::$results = self::query(\"SELECT cdProduto, nomeProduto, descricao, precoUnitario, foto FROM tbProduto\");\n self::$resultRetorno = [];\n if (is_array(self::$results) || is_object(self::$results)){\n foreach(self::$results as $result){\n $result[3] = str_replace('.', ',', $result[3]);\n \n array_push(self::$resultRetorno, $result);\n\n }\n }\n return self::$resultRetorno;\n }", "function fetchOptionPrices($json, $optionType) {\n $data = \"\";\n $optionObjects = $json['optionChain']['result'][0]['options'][0][$optionType];\n\n foreach($optionObjects as $option) {\n // Price,Last,Bid,Ask,Open Int,Volume,IV\n $data .= $option['strike']['raw'] . \",\";\n $data .= $option['lastPrice']['raw'] . \",\";\n $data .= $option['bid']['raw'] . \",\";\n $data .= $option['ask']['raw'] . \",\";\n $data .= $option['openInterest']['raw'] . \",\";\n $data .= $option['volume']['raw'] . \",\";\n $data .= $option['impliedVolatility']['raw'] . \"\\n\";\n }\n return $data;\n}", "public function getProducts()\n {\n $products = [\n [\"name\" => \"Sledgehammer\", \"price\" => 125.75],\n [\"name\" => \"Axe\", \"price\" => 190.50],\n [\"name\" => \"Bandsaw\", \"price\" => 562.131],\n [\"name\" => \"Chisel\", \"price\" => 12.9],\n [\"name\" => \"Hacksaw\", \"price\" => 18.45],\n ];\n return $products;\n }", "public function dataProvider()\n {\n return [\n [\n new Money(10, 'EUR'),\n 'EUR',\n new Money(10, 'EUR'),\n ],\n [\n new Money(15, 'EUR'),\n 'SEK',\n new Money(15, 'EUR'),\n ],\n [\n new Money(1497, 'USD'),\n 'EUR',\n new Money(1000, 'EUR'),\n ],\n ];\n }", "protected function _getCalculatedItemsData()\n {\n /** @var $algorithmModel Mage_Catalog_Model_Layer_Filter_Price_Algorithm */\n $algorithmModel = Mage::getSingleton('catalog/layer_filter_price_algorithm');\n $collection = $this->getLayer()->getProductCollection()->clearPriceFilters();\n\n $minPrice = $collection->getMinPrice();\n $maxPrice = $collection->getMaxPrice();\n\n $appliedInterval = array($minPrice, $maxPrice);\n\n if ($appliedInterval\n && $collection->getPricesCount() <= $this->getIntervalDivisionLimit()\n ) {\n return array();\n }\n\n $algorithmModel->setPricesModel($this)->setStatistics(\n $minPrice,\n $maxPrice,\n $collection->getPriceStandardDeviation(),\n $collection->getPricesCount()\n );\n $collection->retrievePriceFilters();\n\n if ($appliedInterval) {\n if ($appliedInterval[0] == $appliedInterval[1] || $appliedInterval[1] === '0') {\n return array();\n }\n $algorithmModel->setLimits($appliedInterval[0], $appliedInterval[1]);\n }\n\n $items = array();\n foreach ($algorithmModel->calculateSeparators() as $separator) {\n $items[] = array(\n 'label' => $this->_renderRangeLabel($separator['from'], $separator['to']),\n 'value' => (($separator['from'] == 0) ? '' : $separator['from'])\n . '-' . $separator['to'],\n 'count' => $separator['count'],\n 'selected' => in_array($separator['from'], $this->_filterValues)\n );\n }\n\n return $items;\n }", "public function returnTicker(): array\n {\n $tickers = [];\n foreach ($this->request('returnTicker') as $pair => $response) {\n /* @var $ticker Ticker */\n $ticker = $this->factory(Ticker::class, $response);\n $ticker->pair = $pair;\n\n $tickers[$pair] = $ticker;\n }\n\n return $tickers;\n }", "public function returnCurrencies(): array\n {\n $currencies = [];\n foreach ($this->request('returnCurrencies') as $key => $response) {\n /* @var $currency Currency */\n $currencies[$key] = $this->factory(Currency::class, $response);\n }\n\n return $currencies;\n }", "public function get() {\n\t\t$this->data = array(\n\t\t\t101222 => array('label' => 'Awesome product', 'price' => 10.50, 'date_added' => '2012-02-01'),\n\t\t\t101232 => array('label' => 'Not so awesome product', 'price' => 5.20, 'date_added' => '2012-03-20'),\n\t\t\t101241 => array('label' => 'Pretty neat product', 'price' => 9.65, 'date_added' => '2012-04-15'),\n\t\t\t101256 => array('label' => 'Freakishly cool product', 'price' => 12.55, 'date_added' => '2012-01-11'),\n\t\t\t101219 => array('label' => 'Meh product', 'price' => 3.69, 'date_added' => '2012-06-11'),\n\t\t);\n\t}", "public function get_prices ( $sku_id )\n {\n $sql = \"SELECT * FROM `tbli_sku_mou_price_mapping` where sku_id=$sku_id Order by quantity\";\n $query = $this->db->query( $sql );\n return $query->result_array();\n }", "public function price(array $currencies): array\n {\n return $this->get('data/price', [\n 'fsym' => 'ARK',\n 'tsyms' => implode(',', $currencies),\n ]);\n }", "function getReportofTotal(){\r\n $inx = 0;\r\n $arrpack = array();\r\n $conn = getConnection();\r\n\r\n $stmt = $conn->prepare(\"SELECT B.idreservations, B.datebkd, G.gs_name, P.price, B.totalAmount, B.discount from packages P, booking B, guests G where B.idreservations = G.reservations_idreservations and B.packages_idpackages = P.idpackages\");\r\n \r\n $stmt->execute();\r\n\r\n $result = $stmt->get_result();\r\n\r\n if($result->num_rows > 0){\r\n while($row = $result->fetch_assoc()){\r\n\r\n $dte = $row['datebkd'];\r\n $pieces = explode(\"-\", $dte);\r\n $id = $row['idreservations'];\r\n $totString = $pieces[0] . $pieces[1] . $pieces[2] . \"-o-\" . $id;\r\n $arrpack[$inx][0] = $totString;\r\n $arrpack[$inx][1] = $row['gs_name'];\r\n $down = $row['price'];\r\n $second = $row['totalAmount'];\r\n $dic = $row['discount'];\r\n\r\n $totality = ($down*0.5) + ($second*((100 - $dic)/100));\r\n\r\n $arrpack[$inx][2] = $totality;\r\n $inx++;\r\n }\r\n }\r\n $conn->close(); \r\n\r\n return $arrpack;\r\n }", "public function testProductGetPrices()\n {\n $product = $this->find('product', 1);\n $prices = $product->getPrices();\n $price = $prices[0];\n \n $currencies = $this->findAll('currency');\n $dollarCurrency = $currencies[0];\n \n $money = Money::create(10, $dollarCurrency); \n \n $this->assertEquals(\n $money,\n $price\n );\n }", "function get_vehicles_by_price() {\n global $db;\n $query = 'SELECT * FROM vehicles\n ORDER BY price DESC';\n $statement = $db->prepare($query);\n $statement->execute();\n $vehicles = $statement->fetchAll();\n $statement->closeCursor();\n return $vehicles;\n }", "function cb_product_result($items)\r\n\t{\r\n\t\t$ret = array();\r\n\r\n\t\tforeach ($items as $i)\r\n\t\t{\r\n\t\t\t# Create a single copy of this product for return.\r\n\r\n\t\t\tif (empty($ret[$i['prod_id']])) $ret[$i['prod_id']] = $i;\r\n\r\n\t\t\tif (empty($ret[$i['prod_id']]['atrs'][$i['atr_id']]))\r\n\t\t\t\t$ret[$i['prod_id']]['atrs'][$i['atr_id']] = $i;\r\n\r\n\t\t\tif (empty($ret[$i['prod_id']]['atrs'][$i['atr_id']]['opts'][$i['opt_id']]))\r\n\t\t\t\t$ret[$i['prod_id']]['atrs'][$i['atr_id']]['opts'][$i['opt_id']] = $i;\r\n\t\t}\r\n\r\n\t\tforeach ($ret as &$v)\r\n\t\t\t$v = $this->product_props($v);\r\n\r\n\t\treturn $ret;\r\n\t}", "public function getMultipleData()\n\t{\n\t\t$calculatedData = $this->getCalculatedData();\n\t\t$items = [];\n\t\t$amountDealCurrencyId = \\CCrmCurrency::GetAccountCurrencyID();\n\n\t\t$config = [\n\t\t\t'title' => $this->getFormElement('label')->getValue()\n\t\t];\n\n\t\tif (!empty($calculatedData))\n\t\t{\n\t\t\t$calculateField = $this->getFormElement('calculate');\n\t\t\t$calculateValue = $calculateField ? $calculateField->getValue() : null;\n\n\t\t\t$shortModeField = $this->getFormElement('shortMode');\n\t\t\t$shortModeValue = $shortModeField ? $shortModeField->getValue() : false;\n\n\t\t\tswitch ($calculateValue)\n\t\t\t{\n\t\t\t\tcase self::WHAT_WILL_CALCULATE_DEAL_CONVERSION:\n\t\t\t\t\t$config['mode'] = 'singleData';\n\t\t\t\t\t$config['unitOfMeasurement'] = '%';\n\t\t\t\t\t$item['value'] = round($calculatedData['withoutGrouping'], 2);\n\t\t\t\t\t$item['color'] = '#9DCF00';\n\t\t\t\t\t$items[] = $item;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\t$itemCount = 0;\n\t\t\t\t\tforeach ($calculatedData as $key => $data)\n\t\t\t\t\t{\n\n\t\t\t\t\t\tif ($key === 'amount') //TODO: optimise calculating of amount values\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$item = [\n\t\t\t\t\t\t\t'label' => $data['title'],\n\t\t\t\t\t\t\t'value' => $data['value'],\n\t\t\t\t\t\t\t'color' => $data['color']\n\t\t\t\t\t\t];\n\n\n\n\t\t\t\t\t\tif ($calculateValue === self::WHAT_WILL_CALCULATE_DEAL_DATA_FOR_FUNNEL\n\t\t\t\t\t\t\t|| $calculateValue === self::WHAT_WILL_CALCULATE_SUCCESS_DEAL_DATA_FOR_FUNNEL\n\t\t\t\t\t\t)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif ($this->isConversionCalculateMode())\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$item['link'] = $this->getTargetUrl('/crm/deal/analytics/list/', [\n\t\t\t\t\t\t\t\t\t'STAGE_ID_FROM_SUPPOSED_HISTORY' => $key\n\t\t\t\t\t\t\t\t]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$item['link'] = $this->getTargetUrl('/crm/deal/analytics/list/', [\n\t\t\t\t\t\t\t\t\t'STAGE_ID_FROM_HISTORY' => $key\n\t\t\t\t\t\t\t\t]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$config['additionalValues']['firstAdditionalValue']['titleShort'] = Loc::getMessage(\n\t\t\t\t\t\t\t'CRM_REPORT_DEAL_HANDLER_DEAL_COUNT_SHORT_TITLE'\n\t\t\t\t\t\t);\n\t\t\t\t\t\t$item['additionalValues']['firstAdditionalValue'] = [\n\t\t\t\t\t\t\t'value' => $data['value']\n\t\t\t\t\t\t];\n\n\t\t\t\t\t\tif (isset($data['additionalValues']['sum']))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$amountDealCurrencyId = $data['additionalValues']['sum']['currencyId'];\n\t\t\t\t\t\t\t$config['additionalValues']['secondAdditionalValue']['titleShort'] = Loc::getMessage(\n\t\t\t\t\t\t\t\t'CRM_REPORT_DEAL_HANDLER_DEAL_SUM_SHORT_TITLE'\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t$item['additionalValues']['secondAdditionalValue'] = [\n\t\t\t\t\t\t\t\t'value' => \\CCrmCurrency::MoneyToString(\n\t\t\t\t\t\t\t\t\t$data['additionalValues']['sum']['VALUE'],\n\t\t\t\t\t\t\t\t\t$data['additionalValues']['sum']['currencyId']\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t'currencyId' => $data['additionalValues']['sum']['currencyId']\n\t\t\t\t\t\t\t];\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (isset($data['additionalValues']['avgSpentTime']))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$config['additionalValues']['thirdAdditionalValue']['titleShort'] = Loc::getMessage(\n\t\t\t\t\t\t\t\t'CRM_REPORT_DEAL_HANDLER_DEAL_SPENT_TIME_SHORT_TITLE'\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t$item['additionalValues']['thirdAdditionalValue'] = [\n\t\t\t\t\t\t\t\t'value' => $this->getFormattedPassTime(\n\t\t\t\t\t\t\t\t\t$data['additionalValues']['avgSpentTime']['VALUE']\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t];\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$stageSemanticId = \\CCrmDeal::GetSemanticID($key);\n\t\t\t\t\t\t$config['additionalValues']['forthAdditionalValue']['titleShort'] = Loc::getMessage(\n\t\t\t\t\t\t\t'CRM_REPORT_DEAL_HANDLER_DEAL_CONVERSION_SHORT_TITLE'\n\t\t\t\t\t\t);\n\t\t\t\t\t\t$item['additionalValues']['forthAdditionalValue'] = [\n\t\t\t\t\t\t\t'title' => PhaseSemantics::isLost($stageSemanticId) ?\n\t\t\t\t\t\t\t\t\t\t\tLoc::getMessage(\"CRM_REPORT_DEAL_HANDLER_DEAL_LOSSES_SHORT_TITLE\")\n\t\t\t\t\t\t\t\t\t\t\t: Loc::getMessage(\"CRM_REPORT_DEAL_HANDLER_DEAL_CONVERSION_SHORT_TITLE\"),\n\t\t\t\t\t\t\t'value' => $calculatedData['amount']['value'] ? round(\n\t\t\t\t\t\t\t\t($data['value'] / $calculatedData['amount']['value']) * 100,\n\t\t\t\t\t\t\t\t2\n\t\t\t\t\t\t\t) : 0,\n\t\t\t\t\t\t\t'unitOfMeasurement' => '%',\n\t\t\t\t\t\t\t'helpLink' => 'someLink',\n\t\t\t\t\t\t\t'helpInSlider' => true\n\t\t\t\t\t\t];\n\t\t\t\t\t\t//hidden conversion on first column\n\t\t\t\t\t\tif ($calculateValue !== self::WHAT_WILL_CALCULATE_SUCCESS_DEAL_DATA_FOR_FUNNEL && $itemCount < 1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tunset($item['additionalValues']['forthAdditionalValue']);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$itemCount++;\n\n\n\n\t\t\t\t\t\t$items[] = $item;\n\t\t\t\t\t}\n\n\t\t\t\t\t$calculateField = $this->getFormElement('calculate');\n\t\t\t\t\t$calculateValue = $calculateField ? $calculateField->getValue() : null;\n\n\t\t\t\t\t$config['titleShort'] = Loc::getMessage('CRM_REPORT_DEAL_HANDLER_DEAL_COUNT_SHORT_TITLE');\n\n\t\t\t\t\t$config['valuesAmount'] = [\n\t\t\t\t\t\t'firstAdditionalAmount' => [\n\t\t\t\t\t\t\t'title' => Loc::getMessage('CRM_REPORT_DEAL_HANDLER_DEAL_SUM_SHORT_TITLE'),\n\t\t\t\t\t\t\t'value' => \\CCrmCurrency::MoneyToString(\n\t\t\t\t\t\t\t\t$calculatedData['amount']['sum'],\n\t\t\t\t\t\t\t\t$amountDealCurrencyId\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t'targetUrl' => $this->getTargetUrl('/crm/deal/analytics/list/'),\n\t\t\t\t\t\t]\n\t\t\t\t\t];\n\n\t\t\t\t\tif ($calculatedData['amount']['successPassTime'] ?? false)\n\t\t\t\t\t{\n\t\t\t\t\t\t$config['valuesAmount']['secondAdditionalAmount'] = [\n\t\t\t\t\t\t\t'title' => Loc::getMessage('CRM_REPORT_DEAL_HANDLER_DEAL_PASS_AVG_TIME_SHORT_TITLE'),\n\t\t\t\t\t\t\t'value' => $this->getFormattedPassTime($calculatedData['amount']['successPassTime'])\n\t\t\t\t\t\t];\n\t\t\t\t\t}\n\n\t\t\t\t\tswitch ($calculateValue)\n\t\t\t\t\t{\n\t\t\t\t\t\tcase self::WHAT_WILL_CALCULATE_SUCCESS_DEAL_DATA_FOR_FUNNEL:\n\t\t\t\t\t\t\t$config['topAdditionalTitle'] = Loc::getMessage(\n\t\t\t\t\t\t\t\t'CRM_REPORT_DEAL_HANDLER_DEAL_CONVERSION_SHORT_TITLE'\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t$config['topAdditionalValue'] = !empty($items[0]['additionalValues']['forthAdditionalValue']['value'])\n\t\t\t\t\t\t\t\t? $items[0]['additionalValues']['forthAdditionalValue']['value'] : 0;\n\t\t\t\t\t\t\t$config['topAdditionalValueUnit'] = '%';\n\t\t\t\t\t\t\t$config['valuesAmount']['firstAdditionalAmount']['value'] =\n\t\t\t\t\t\t\t\t($items[0]['additionalValues']['secondAdditionalValue']['value'] ?? null)\n\t\t\t\t\t\t\t;\n\t\t\t\t\t\t\t//$config['valuesAmount']['secondAdditionalAmount']['value'] =\n\t\t\t\t\t\t\t// $items[0]['additionalValues']['thirdAdditionalValue']['value']\n\t\t\t\t\t\t\t//;\n\n\t\t\t\t\t\t\tif ($shortModeValue)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$config['mode'] = 'singleData';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tunset($config['valuesAmount']['thirdAdditionalAmount']);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\n\t\t$result = [\n\t\t\t'items' => $items,\n\t\t\t'config' => $config,\n\t\t];\n\n\t\treturn $result;\n\t}", "public function getListPrice()\n {\n return 0;\n }", "public function getListPrice()\n {\n return 0;\n }", "public function run()\n {\n ProductPrice::insert(\n \t[\n \t[\"product_id\" => 1,\n \t \"description\" => \"economical\",\n \t \"price\" => 10000\n \t],\n \t[\"product_id\" => 1,\n \t \"description\" => \"default\",\n \t \"price\" => 100000\n \t],\n \t[\"product_id\" => 1,\n \t \"description\" => \"plus\",\n \t \"price\" => 1000000\n \t],\n \t[\"product_id\" => 2,\n \t \"description\" => \"economical\",\n \t \"price\" => 10000\n \t],\n \t[\"product_id\" => 2,\n \t \"description\" => \"default\",\n \t \"price\" => 100000\n \t],\n \t[\"product_id\" => 2,\n \t \"description\" => \"plus\",\n \t \"price\" => 1000000\n \t],\n \t[\"product_id\" => 3,\n \t \"description\" => \"economical\",\n \t \"price\" => 10000\n \t],\n \t[\"product_id\" => 3,\n \t \"description\" => \"default\",\n \t \"price\" => 100000\n \t],\n \t[\"product_id\" => 3,\n \t \"description\" => \"plus\",\n \t \"price\" => 1000000\n \t],\n \t[\"product_id\" => 4,\n \t \"description\" => \"economical\",\n \t \"price\" => 10000\n \t],\n \t[\"product_id\" => 4,\n \t \"description\" => \"default\",\n \t \"price\" => 100000\n \t],\n \t[\"product_id\" => 4,\n \t \"description\" => \"plus\",\n \t \"price\" => 1000000\n \t],\n \t[\"product_id\" => 5,\n \t \"description\" => \"economical\",\n \t \"price\" => 10000\n \t],\n \t[\"product_id\" => 5,\n \t \"description\" => \"default\",\n \t \"price\" => 100000\n \t],\n \t[\"product_id\" => 5,\n \t \"description\" => \"plus\",\n \t \"price\" => 1000000\n \t]\n \t]);\n }", "public function bestPriceProvider()\n {\n return [\n [0, 100.0, 50.0, 50.0],\n [0, 100.0, 150.0, 100.0],\n [1, 100.0, 50.0, 50.0],\n [1, 100.0, 150.0, 100.0],\n [2, 100.0, 50.0, 100.0],\n [2, 100.0, 150.0, 150.0],\n [3, 100.0, 50.0, 100.0],\n [3, 100.0, 150.0, 150.0],\n [4, 100.0, 50.0, 50.0],\n [4, 100.0, 150.0, 100.0],\n [5, 100.0, 50.0, 50.0],\n [5, 100.0, 150.0, 100.0],\n ];\n }", "public function allprices() {\n $this->viewBuilder()->layout('default');\n \n \n $this->loadModel('Medicines');\n $this->loadModel('MedicineQuestions');\n $this->loadModel('QuestionCheckboxes');\n $this->loadModel('Orders');\n $this->loadModel('Orderdetails');\n $this->loadModel('Treatments');\n $this->loadModel('Pilprices');\n $this->loadModel('Pils');\n $this->loadModel('Reviews'); \n \n \n $treatment = $this->Treatments->find()\n ->select(['id','name','slug'])\n ->contain(['Pils' => function($q) { return $q->select(['Pils.id','Pils.tid','Pils.title','Pils.quantity','Pils.cost']); }])\n ->where(['Treatments.is_active' => 1])\n ->all()->toArray(); \n\n //pr($treatment); exit;\n\n $this->set(compact('treatment'));\n $this->set('_serialize', ['treatment']); \n \n \n }", "public function _get_plates_costs() {\n $this->db->select('orangeplate_price, blueplate_price, repaid_cost, inv_addcost, beigeplate_price');\n $this->db->from('ts_configs');\n $res=$this->db->get()->row_array();\n return $res;\n }", "private function getTierPriceStructure()\n {\n return [\n 'children' => [\n 'record' => [\n 'children' => [\n 'website_id' => [\n 'arguments' => [\n 'data' => [\n 'config' => [\n 'options' => $this->getWebsites(),\n 'value' => $this->getDefaultWebsite(),\n 'visible' => true,\n 'disabled' => false,\n ],\n ],\n ],\n ],\n 'price_value' => [\n 'children' => [\n 'price' => [\n 'arguments' => [\n 'data' => [\n 'config' => [\n 'addbefore' => $this->getStore()->getBaseCurrency()\n ->getCurrencySymbol(),\n ]\n ]\n ],\n ],\n 'value_type' => [\n 'arguments' => [\n 'data' => [\n 'options' => $this->productPriceOptions->toOptionArray(),\n ]\n ],\n ],\n ],\n ],\n ],\n ],\n ],\n ];\n }", "public function price_table() {\n\t\tif ( $this->coming_soon ) {\n\t\t\treturn;\n\t\t}\n\n\t\t$out[] = '<script>jQuery( document ).ready(function() {jQuery( \".edd-add-to-cart-label\" ).html( \"Choose\" );});</script>';\n\t\t$out[] = sprintf( '<!--Pricing Table Section--><section id=\"pricing\"><div class=\"container\">\n<div class=\"container\">%1s</div>', $this->purchase_cta());\n\t\t$i = 1;\n\t\tforeach( $this->pricing() as $price ) {\n\t\t\t$out[] = sprintf(\n\t\t\t\t'<div class=\"col-lg-4 col-md-4 col-sm-12 col-xs-12 pricing-box\">\n\t\t\t\t\t<div id=\"price-%0s\" class=\"bggray price\">\n\t\t\t\t\t\t<div class=\"package\">%1s</div>\n\t\t\t\t\t\t<div class=\"divider\"></div>\n\t\t\t\t\t\t<div class=\"amount\">$%2s</div>\n\t\t\t\t\t\t<div class=\"duration\">%3s</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"featcontent\">\n\t\t\t\t\t\t%4s\n\t\t\t\t\t</div>\n\t\t\t\t</div>',\n\t\t\t\t$i,\n\t\t\t\t$price[ 'level' ],\n\t\t\t\t$price[ 'amount' ],\n\t\t\t\t$price[ 'sites' ],\n\t\t\t\t$price[ 'link' ]\n\t\t\t);\n\t\t\t$i++;\n\n\t\t}\n\n\t\t$out[] = '</div></section>';\n\n\t\treturn implode( '', $out );\n\n\t}", "private function extractPrices(OrderInterface $order): array\r\n {\r\n return array_fill(1, $order->getQuantity(), $order->getPrice());\r\n }", "public function makePrice(array & $rows)\n {\n if (empty($rows)) {\n return;\n }\n\n $articles = array_column($rows, 'article');\n\n $articles = array_map(function ($item) {\n settype($item, 'string');\n\n return preg_replace('/[^\\w+]/is', '', $item);\n }, $articles);\n\n $model = MongoModel::factory('Prices');\n $model->selectDB();\n\n $articles = array_unique($articles);\n array_reverse($articles, 1);\n $articles = array_reverse($articles);\n\n $priceRows = $model\n ->where('clear_article', 'in', $articles)\n ->find_all();\n\n if (empty($priceRows)) {\n foreach ($rows as $key => & $item) {\n $item['qty'] = 0;\n $item['price'] = 0;\n }\n\n return $rows;\n }\n\n $priceRows = array_combine(array_column($priceRows, 'clear_article'), $priceRows);\n\n foreach ($rows as $key => & $item) {\n $item['qty'] = (isset($priceRows[$item['clear_article']]['qty']) ? $priceRows[$item['clear_article']]['qty'] : 0);\n $item['price'] = (isset($priceRows[$item['clear_article']]['price']) ? $priceRows[$item['clear_article']]['price'] : 0);\n }\n\n return $rows;\n\n }", "public function prices()\n {\n return $this->hasMany(Price::class);\n }", "public function pricing() { \n $data['page'] = 'Pricing';\n $data['page_title'] = 'Pricing';\n $data['page_module'] = 'setting';\n $price_list= $this->Setting_Model-> getPurchaseTransactionById($this->session->userdata('user_id'));\n for($i=0;$i<count($price_list);$i++){\n\t\t\tif($price_list[$i]->stock_group_id == 3){\n\t\t\t\tif($price_list[$i]->category_id == 13){\n\t\t\t\t\t$price_list[$i]->product_name = $this->Masterdata_Model->getFarmImplementsModelById($price_list[$i]->sub_category_id, $price_list[$i]->product_id)->name.\" - \".$price_list[$i]->classification;\n\t\t\t\t} else {\n\t\t\t\t\t$price_list[$i]->product_name = $this->Masterdata_Model->getProductByCategoryAndSubcategory($price_list[$i]->category_id, $price_list[$i]->sub_category_id, $price_list[$i]->product_id)->name.\" - \".$price_list[$i]->classification;\n\t\t\t\t}\t\t\t\t\n\t\t\t} else if($price_list[$i]->stock_group_id == 2){\n $price_list[$i]->product_name = $this->Masterdata_Model->cropNameById($price_list[$i]->category_id, $price_list[$i]->sub_category_id, $price_list[$i]->product_id)->name.\" - \".$price_list[$i]->classification;\n\t\t\t} else {\t\t\t\t\t\t\t\t\n\t\t\t\tif($price_list[$i]->category_id == 3 || $price_list[$i]->category_id == 4 || $price_list[$i]->category_id == 5){\n\t\t\t\t\t$price_list[$i]->product_name = $this->Masterdata_Model->brandListBySuppliersById($price_list[$i]->category_id, $price_list[$i]->sub_category_id, $price_list[$i]->product_id)->name.\" - \".$price_list[$i]->classification;\n\t\t\t\t} else {\n\t\t\t\t\t$price_list[$i]->product_name = $this->Masterdata_Model->getProductByCategoryAndSubcategory($price_list[$i]->category_id, $price_list[$i]->sub_category_id, $price_list[$i]->product_id)->name.\" - \".$price_list[$i]->classification;\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t}\n $data['price_list']=$price_list;\n $this->load->view('setting/pricinglist', $data); \t \n\t}", "public function getPrice()\n {\n $db = new db_connector();\n $conn = $db->getConnection();\n\n $stmt = \"SELECT `Order List`.orderID, `Order List`.PQuantity, `Product`.PPrice, `Product`.PID\n FROM `Order List`\n LEFT JOIN `Product`\n ON `Order List`.productID = `Product`.PID\";\n\n $result5 = $conn->query($stmt);\n\n if($result5)\n {\n $price_array = array();\n\n while($price = $result5->fetch_assoc())\n {\n array_push($price_array, $price);\n }\n $total = 0;\n $curr = 0;\n for($x = 0; $x < count($price_array); $x ++)\n {\n // echo \"price array \" . $price_array[$x]['orderID'] . \"<br>\";\n // echo \"session order id \" . $_SESSION['orderID'] . \"<br>\";\n\n if($price_array[$x]['orderID'] == $_SESSION['orderID'])\n {\n\n // echo $price_array[$x]['orderID'];\n // echo $price_array[$x]['PQuantity'];\n\n $curr = ((float) $price_array[$x]['PPrice'] * (float) $price_array[$x]['PQuantity']);\n $total = $total + $curr;\n $curr = 0;\n }\n }\n echo \"$\" . $total;\n return $total;\n }\n }", "public function getAll(): PriceListCollectionTransfer;", "abstract function getPriceFromAPI($pair);", "function getLitecoinPrice()\r\n{\r\n\t // Fetch the current rate from MtGox\r\n\t$ch = curl_init('https://mtgox.com/api/0/data/ticker.php');\r\n\tcurl_setopt($ch, CURLOPT_REFERER, 'Mozilla/5.0 (compatible; MtGox PHP client; '.php_uname('s').'; PHP/'.phpversion().')');\r\n\tcurl_setopt($ch, CURLOPT_USERAGENT, \"CakeScript/0.1\");\r\n\tcurl_setopt($ch, CURLOPT_HEADER, 0);\r\n\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\r\n\tcurl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);\r\n\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);\r\n\t$mtgoxjson = curl_exec($ch);\r\n\tcurl_close($ch);\r\n\r\n\t// Decode from an object to array\r\n\t$output_mtgox = json_decode($mtgoxjson);\r\n\t$output_mtgox_1 = get_object_vars($output_mtgox);\r\n\t$mtgox_array = get_object_vars($output_mtgox_1['ticker']);\r\n\r\n\techo '\r\n\t\t\t<ul>\r\n\t\t\t<li><strong>Last:</strong>&nbsp;&nbsp;', $mtgox_array['last'], '</li>\r\n\t\t\t<li><strong>High:</strong>&nbsp;', $mtgox_array['high'], '</li>\r\n\t\t\t<li><strong>Low:</strong>&nbsp;&nbsp;', $mtgox_array['low'], '</li>\r\n\t\t\t<li><strong>Avg:</strong>&nbsp;&nbsp;&nbsp;', $mtgox_array['avg'], '</li>\r\n\t\t\t<li><strong>Vol:</strong>&nbsp;&nbsp;&nbsp;&nbsp;', $mtgox_array['vol'], '</li>\r\n\t\t\t</ul>';\r\n}", "public function run()\n {\n $names = [\n 'ПЫЛЕСОС SAMSUNG VC18M31A0HP/EV',\n 'ХОЛОДИЛЬНИК LG GA-B379SLUL',\n 'СТРУЙНЫЙ МФУ EPSON L3101',\n 'КОЛОНКИ SVEN 312',\n 'ФИТНЕС БРАСЛЕТ XIAOMI MI SMART BAND 5',\n 'НАБОР ПОСУДЫ TEFAL COMFORT MAX NEW C973SB34 (11 ПРЕДМЕТОВ)',\n 'СТОЛОВЫЙ НАБОР LUMINARC ОКЕАН ЭКЛИПС 45 ПР. (L5110)',\n 'СМАРТФОН ОРРО RENO5 STARRY BLACK',\n 'СМАРТФОН APPLE IPHONE 12 256GB BLACK',\n 'СМАРТФОН APPLE IPHONE 12 PRO MAX 512GB GRAPHITE',\n 'СМАРТФОН VIVO X60 PRO BLUE',\n 'НОУТБУК APPLE MACBOOK PRO 16\" I9 2.3/16/1TB SSD SPACE GREY (MVVK2)',\n 'НОУТБУК ASUS ROG ZEPHYRUS GX701L (90NR03Q1-M02600)',\n 'КОМПЬЮТЕР ACER PREDATOR PO9-920 DG.E24MC.001',\n 'НАСТОЛЬНЫЙ КОМПЬЮТЕР APPLE MAC MINI I385UX MXNG2'];\n\n $prices=[51990,\n 199990,\n 70990,\n 3990,\n 17990,\n 45990,\n 24990,\n 219990,\n 549890,\n 859890,\n 369990,\n 1542990,\n 1399990,\n 2370990,\n 617990];\n\n for($i=0;$i<15;$i++)\n {\n $product = new Product();\n $product->name=$names[$i];\n $product->price=$prices[$i];\n if ($i==1 || $i==7 || $i==9 || $i==10 || $i==14)\n $product->image='storage/products/product_'.($i+1).'.png';\n else\n $product->image='storage/products/product_'.($i+1).'.jpg';\n $product->save();\n }\n }", "public function bestPriceCalculatedProvider()\n {\n return [\n [0, 500.0, 400.0, 350.0, 500.0],\n [0, 500.0, 400.0, 450.0, 500.0],\n [1, 500.0, 400.0, 350.0, 350.0],\n [1, 500.0, 400.0, 450.0, 400.0],\n [2, 500.0, 20.0, 15.0, 480.0],\n [2, 500.0, 20.0, 25.0, 475.0],\n [3, 500.0, 20.0, 15.0, 400.0],\n [3, 500.0, 20.0, 25.0, 375.0],\n [4, 500.0, 20.0, 15.0, 515.0],\n [4, 500.0, 20.0, 25.0, 520.0],\n [5, 500.0, 20.0, 15.0, 575.0],\n [5, 500.0, 20.0, 25.0, 600.0],\n ];\n }", "public function getPrice() {\n }", "public function queryGetPriceAndOldPrice($content){\n $vector = array();\n $dom = new DOMDocument();\n $dom->loadHTML(\"$content\");\n $xpath = new DOMXPath($dom);\n $atributoValue = \"tiempo-entrega-div\";\n $tag = \"div\";\n $consulta = \"//\".$tag.\"[@class='\".$atributoValue.\"']\";\n $objeto = $xpath->query($consulta);\n if ($objeto->length > 0){\n foreach($objeto as $tiempoEntrega){\n $itemType = $tiempoEntrega->nextSibling->nextSibling;\n $res = $itemType->getElementsByTagName(\"div\");\n if ($res->length > 0){\n foreach($res as $div){\n if ($div->hasAttribute(\"class\") && $div->getAttribute(\"class\") == \"price-box\"){\n $plist = $div->getElementsByTagName(\"p\");\n $contador = 0;\n if ($plist->length > 0){\n foreach($plist as $p){\n if ($p->hasAttribute(\"class\") && $p->getAttribute(\"class\") == \"old-price\"){\n $oldPrecio = $p->nodeValue;\n $oldPrecio = rtrim(ltrim($oldPrecio));\n //echo \"Precio antiguo: \".$oldPrecio.\"<br>\";\n $vector[\"Wholesale price\"] = $oldPrecio;\n }else if ($p->hasAttribute(\"class\") && $p->getAttribute(\"class\") == \"special-price\"){\n $precio = $p->nodeValue;\n //echo \"Precio: \".$precio.\"<br>\";\n $precio = rtrim(ltrim($precio));\n $vector[\"Price\"] = $precio;\n }\n $contador++;\n }\n }\n }\n }\n }\n }\n }\n return $vector;\n }", "public function fetchCoffeeShops(){\n // $endPrice = $this->_request['endPrice'] != \"undefined\" ? intval ($this->_request['endPrice']) : -1;\n \n\n $sql = \"select distinct * from coffee_shops cf join city c on cf.CityId = c.CityID \";\n // if($startPrice!=\"undefined\")\n // {\n // $sql.=\" where cf.start_price>=$startPrice \";\n // if($endPrice != -1 )\n // $sql.=\" and cf.end_price<=$endPrice\";\n // }\n $rows = $this->executeGenericDQLQuery($sql);\n $coffeeShops = array();\n for($i=0;$i<sizeof($rows);$i++)\n {\n\n\n $coffeeShops[$i]['Name'] =($rows[$i]['Name'] == null || $rows[$i]['Name'] ==\"null\") ? \"No Data Available\" : $rows[$i]['Name'] ;\n $coffeeShops[$i]['Address'] =($rows[$i]['Address'] == null || $rows[$i]['Address'] ==\"null\") ? \"No Data Available\" : $rows[$i]['Address'] ;\n $coffeeShops[$i]['content'] =($rows[$i]['content'] == null || $rows[$i]['content'] ==\"null\") ? \"No Data Available\" : $rows[$i]['content'] ;\n $coffeeShops[$i]['Phone1'] =($rows[$i]['Phone1'] == null || $rows[$i]['Phone1'] ==\"null\") ? \"No Data Available\" : $rows[$i]['Phone1'] ;\n $coffeeShops[$i]['Phone2'] =($rows[$i]['Phone2'] == null || $rows[$i]['Phone2'] ==\"null\") ? \"No Data Available\" : $rows[$i]['Phone2'] ;\n $coffeeShops[$i]['Phone3'] =($rows[$i]['Phone3'] == null || $rows[$i]['Phone3'] ==\"null\") ? \"No Data Available\" : $rows[$i]['Phone3'] ;\n $coffeeShops[$i]['Mobile'] =($rows[$i]['Mobile'] == null || $rows[$i]['Mobile'] ==\"null\") ? \"No Data Available\" : $rows[$i]['Mobile'] ;\n $coffeeShops[$i]['Website'] =($rows[$i]['Website'] == null || $rows[$i]['Website'] ==\"null\") ? \"No Data Available\" : $rows[$i]['Website'] ;\n $coffeeShops[$i]['Category'] =($rows[$i]['Category'] == null) ? 0 : $rows[$i]['Category'] ;\n $coffeeShops[$i]['Facilities'] =$this->getFacilitiesByIds($rows[$i]['Facilities']);\n $coffeeShops[$i]['CityId'] =$rows[$i]['CityId'] ;\n $coffeeShops[$i]['icon_image'] =($rows[$i]['icon_image'] == null || $rows[$i]['icon_image'] ==\"null\") ? \"img/not_found.jpg\" : $rows[$i]['icon_image'] ;\n $coffeeShops[$i]['home_image'] =($rows[$i]['home_image'] == null || $rows[$i]['home_image'] ==\"null\") ? \"img/not_found.jpg\" : $rows[$i]['home_image'] ;\n \n \n \n \n }\n $this->response($this->json($coffeeShops), 200);\n\n }", "protected function getUnitTimePricesForEachResource($resources, $LABpricingid, $id_cient, $id_space) {\n $pricingModel = new BkNightWE();\n $pricingInfo = $pricingModel->getPricing($LABpricingid, $id_space);\n //echo \"getUnitTimePricesForEachResource 1 <br>\";\n //$tarif_name = $pricingInfo['tarif_name'];\n if(! array_key_exists('tarif_unique', $pricingInfo)){return Array();}\n $tarif_unique = $pricingInfo['tarif_unique'];\n $tarif_nuit = $pricingInfo['tarif_night'];\n $tarif_we = $pricingInfo['tarif_we'];\n $night_start = $pricingInfo['night_start'];\n $night_end = $pricingInfo['night_end'];\n $we_array1 = explode(\",\", $pricingInfo['choice_we']);\n $we_array = array();\n for ($s = 0; $s < count($we_array1); $s++) {\n if ($we_array1[$s] > 0) {\n $we_array[] = $s + 1;\n }\n }\n\n $timePrices = array();\n $modelRessourcePricing = new BkPrice();\n $modelRessourcePricingOwner = new BkOwnerPrice();\n foreach ($resources as $resource) {\n // get the time prices\n\n $timePrices[$resource[\"id\"]][\"tarif_unique\"] = $tarif_unique;\n $timePrices[$resource[\"id\"]][\"tarif_night\"] = $tarif_nuit;\n $timePrices[$resource[\"id\"]][\"tarif_we\"] = $tarif_we;\n $timePrices[$resource[\"id\"]][\"night_end\"] = $night_end;\n $timePrices[$resource[\"id\"]][\"night_start\"] = $night_start;\n $timePrices[$resource[\"id\"]][\"we_array\"] = $we_array;\n\n $pday = $modelRessourcePricingOwner->getDayPrice($resource[\"id\"], $id_cient);\n if ($pday >= 0) {\n $timePrices[$resource[\"id\"]][\"price_day\"] = $pday;\n } else {\n $timePrices[$resource[\"id\"]][\"price_day\"] = $modelRessourcePricing->getDayPrice($resource[\"id\"], $LABpricingid); //Tarif jour pour l'utilisateur selectionne\n }\n\n $pnight = $modelRessourcePricingOwner->getNightPrice($resource[\"id\"], $id_cient);\n if ($pnight >= 0) {\n $timePrices[$resource[\"id\"]][\"price_night\"] = $pnight;\n } else {\n $timePrices[$resource[\"id\"]][\"price_night\"] = $modelRessourcePricing->getNightPrice($resource[\"id\"], $LABpricingid); //Tarif nuit pour l'utilisateur selectionne\n }\n\n $pwe = $modelRessourcePricingOwner->getWePrice($resource[\"id\"], $id_cient);\n if ($pwe >= 0) {\n $timePrices[$resource[\"id\"]][\"price_we\"] = $pwe;\n } else {\n $timePrices[$resource[\"id\"]][\"price_we\"] = $modelRessourcePricing->getWePrice($resource[\"id\"], $LABpricingid); //Tarif w-e pour l'utilisateur selectionne\n }\n }\n return $timePrices;\n }", "private function parse_total(){\n\t\t$production_formats = new \\gcalc\\db\\production\\formats();\n\t\t$product_constructor_name = '\\gcalc\\db\\product\\\\' . str_replace( '-', '_', $this->get_slug() );\n\t\t$product_constructor_exists = class_exists( $product_constructor_name );\n\t\t$product_constructor_cost_equasion_exists = $product_constructor_exists ? method_exists( $product_constructor_name, 'get_calc_data' ) : false;\n\n\n\n\t\t/*\n\t\tEquasion can be stored in product constructor or formats array.\n\t\tFormats array is a temporary means to keep data so product constructor is a preferred way\n\t\t */\n\t\t$total_cost_equasion = \n\t\t\t$product_constructor_cost_equasion_exists ? \n\t\t\t\t$product_constructor_name::get_calc_data( )\n\t\t\t\t: $production_formats->get_total_cost_equasion( $this->get_product_id() );\n\n\t\t$total_cost_equasion_string = $total_cost_equasion['equasion'];\n\n\t\t$total_cost_equasion = $total_cost_equasion_string;\n\t\t$total_pcost_equasion = $total_cost_equasion_string;\n\n\t\t\n\t\t/**\n\t\t * Keeps selling prices of used processes\n\t\t * @var array\n\t\t */\n\t\t$total_cost_array = array();\n\t\t/**\n\t\t * Keeps production costs of used processes\n\t\t * @var array\n\t\t */\n\t\t$total_pcost_array = array();\n\t\t/**\n\t\t * Keeps markups of used proceses\n\t\t * @var array\n\t\t */\n\t\t$total_markup_array = array();\n\t\t/**\n\t\t * All used in calculation formats\n\t\t * @var array\n\t\t */\n\t\t$used_formats_array = array();\n\t\t/**\n\t\t * All used in calculation media\t\t \n\t\t * @var array\n\t\t */\n\t\t$used_media_array = array();\n\n\t\t//checking credentials for data filter\t\t\n\t\t$credetials = $this->login();\n\t\t$al = $credetials['access_level'];\n\n\t\tforeach ($this->done as $key => $value) {\t\n\t\t\tif ( preg_match( '/'.$value->total['name'].'/', $total_cost_equasion_string )) {\n\t\t\t\t$total_cost_equasion = str_replace($value->total['name'], $value->total['total_price'], $total_cost_equasion);\t\t\t\t\t\t\n\t\t\t\t$total_pcost_equasion = str_replace($value->total['name'], $value->total['production_cost'], $total_pcost_equasion);\t\t\n\n\t\t\t\t$total_cost_array[ $value->total['name'] ] = $value->total['total_price'];\n\t\t\t\t$total_pcost_array[ $value->total['name'] ] = $value->total['production_cost'];\n\t\t\t\t$total_markup_array[ $value->total['name'] ] = $value->total['markup'];\n\t\t\t}\t\n\n\t\t\t//used formats total\n\t\t\tif ( preg_match( '/_format/', $value->total['name'] )) {\n\t\t\t\t$production_format_pieces = $value->total['extended']['production_format']['pieces'];\n\t\t\t\t$common_format_name = $value->total['extended']['production_format']['common_format']['name'];\n\t\t\t\t$common_format_width = $value->total['extended']['production_format']['common_format']['width'];\n\t\t\t\t$common_format_height = $value->total['extended']['production_format']['common_format']['height'];\n\n\t\t\t\t$production_format_format = $value->total['extended']['production_format']['format'];\n\t\t\t\t$production_format_width = $value->total['extended']['production_format']['width'];\n\t\t\t\t$production_format_height = $value->total['extended']['production_format']['height'];\n\t\t\t\t\n\t\t\t\t/*\n\t\t\t\t* Filtering data\n\t\t\t\t*/\n\t\t\t\tif ( $al > 0) {\n\t\t\t\t\t\n\t\t\t\t\tif ($al > 5) { // admin, master only\n\t\t\t\t\t\t\n\t\t\t\t\t\t$format_str = $production_format_pieces .' '. __('slots', 'gcalc') .' '. $common_format_name .'('.$common_format_width.'x'.$common_format_height.')' \n\t\t\t\t\t\t\t.' @ '. $production_format_format.'('.$production_format_width.'x'.$production_format_height.')';\n\n\t\t\t\t\t} else { // no data for account, inner\n\t\t\t\t\t\t$format_str = '';\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\n\t\t\t\t} else { // 0 - anonymous\n\t\t\t\t\t$format_str = $common_format_width.'x'.$common_format_height;\n\n\t\t\t\t}\n\n\n\t\t\t\t$used_formats_array[ $value->total['name'] ] = $format_str;\n\t\t\t}\n\t\t\t\n\t\t\t//used papers total\n\t\t\tif ( preg_match( '/_paper/', $value->total['name'] )) {\n\t\t\t\t$sheet_cost = $value->total['extended']['sheet_cost'];\n\t\t\t\t$sheets_quantity = $value->total['extended']['sheets_quantity'];\n\t\t\t\t$paper_price_per_kg = $value->total['extended']['paper']['price_per_kg'];\n\t\t\t\t$paper_label = $value->total['extended']['paper']['label'];\t\t\t\t\n\t\t\t\t$paper_thickness = $value->total['extended']['paper']['thickness'];\n\n\t\t\t\t/*\n\t\t\t\t* Filtering data\n\t\t\t\t*/\n\t\t\t\tif ( $al > 0) {\n\t\t\t\t\tif ($al > 5) { // admin, master only\n\t\t\t\t\t\t\n\t\t\t\t\t\t$media_str = $sheets_quantity .' x ' . $paper_label . ' (' . $paper_thickness . 'mm)'\n\t\t\t\t\t\t.' @ ' . $sheet_cost . ' PLN / '. __('sheet','gcalc') .' (' . $paper_price_per_kg . '/kg) ';\n\n\t\t\t\t\t} else { // no data for account, inner\n\t\t\t\t\t\t$media_str = '';\t\n\t\t\t\t\t}\n\t\t\t\t} else { // 0 - anonymous\n\t\t\t\t\t$media_str = $paper_label;\n\n\t\t\t\t}\n\n\t\t\t\t$used_media_array[ $value->total['name'] ] = $media_str;\n\n\t\t\t}\n\t\t}\n\t\teval('$total_cost_ = ' . $total_cost_equasion . ';');\n\t\teval('$total_pcost_ = ' . $total_pcost_equasion . ';');\n\n\t\t$average_markup = count($total_markup_array) > 0 ? array_sum( $total_markup_array ) / count($total_markup_array) : 1;\n\n\n\n\n\t\t$total_ = array(\n\t\t\t'equasion' => $total_cost_equasion_string,\t\t\t\n\t\t\t'used_formats' => $used_formats_array,\n\t\t\t'used_media' => $used_media_array,\n\n\t\t\t'total_markup' => $total_markup_array,\n\t\t\t'total_cost_equasion' => $total_cost_array,\n\t\t\t'total_pcost_equasion' => $total_pcost_array,\n\t\t\t\n\t\t\t'average_markup' => ( ( $total_cost_ - $total_pcost_ ) / $total_pcost_ ) + 1, \n\t\t\t'total_cost_' => $total_cost_,\n\t\t\t'total_pcost_' => $total_pcost_\n\t\t);\n\n\t\t\t\t/*\n\t\t\t\t* Filtering total data\n\t\t\t\t*/\n\t\t\t\tif ( $al > 0) {\n\t\t\t\t\tif ($al > 5) { // admin, master only\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\n\t\t\t\t\t} else { // no data for account, inner\n\t\t\t\t\t\t\n\t\t\t\t\t\tunset($total_['used_formats']);\n\t\t\t\t\t\tunset($total_['used_media']);\n\t\t\t\t\t}\n\t\t\t\t} else { // 0 - anonymous\n\t\t\t\t\t$media_str = $paper_label;\n\n\t\t\t\t}\n\n\n\t\t$total_ = $this->merge_children_totals( $total_ );\n\t\t$this->total_ = $total_;\n\n\t}", "public function index()\n {\n $products = ProductPrice::all();\n return response()->json($products);\n }", "function getAllRates($interval) {\n\n\t\tforeach ( $this->lConf['productDetails'] as $uid => $val ) {\n\t\t\t// get all prices for given UID and given dates\n\t\t\t$this->lConf['productDetails'][$uid]['prices'] = tx_abbooking_div::getPrices($uid, $interval);\n\t\t}\n\n\t\treturn 0;\n\t}", "public function getPrice()\n {\n }", "public function getPrice()\n {\n }", "static private function explodeGoods($list, $priceMul = 1)\n {\n Log::info('explodeGoods goods=' . print_r($list, 1));\n\n $goods = [];\n if ($res['result'] = true) {\n foreach ($list['avail_sh'] as $avail) {\n $goodsInfo = $list['goods_list'][$avail['goods_id']] ?? [\n 'company_id' => '',\n 'company_name' => '',\n 'num' => ''\n ];\n\n if ($goodsInfo['company_name'] == '' || $goodsInfo['num'] == '') {\n continue;\n }\n\n $goodsNameList = $list['goods_name_list'][$avail['goods_name_id']] ?? [\n 'goods_name_long_ru' => 'деталь',\n 'goods_name_short_ru' => 'деталь'\n ];\n\n $goods[$avail['goods_internal_id']] = [\n 'id' => $avail['goods_internal_id'],\n 'goods_id' => $goodsInfo['goods_id'],\n //'model_id' => $modelId,\n 'company_id' => $goodsInfo['company_id'],\n 'goods_supplier_sh_id' => $avail['goods_supplier_sh_id'],\n 'supplier_point_id' => $avail['supplier_point_id'],\n 'company_name' => $goodsInfo['company_name'],\n 'num' => $goodsInfo['num'],\n 'comment' => $avail['comment'],\n 'avail' => $avail['count_avail'],\n 'wearout' => $avail['wearout'],\n 'price' => $avail['price_reseller'] * $priceMul,\n 'name_long' => $goodsNameList['goods_name_long_ru'],\n 'name_short' => $goodsNameList['goods_name_short_ru'],\n 'supplier' => $list['supplier_point_list'][$avail['supplier_point_id']] ?? [],\n 'img' => $list['image_sh_list'][$avail['goods_supplier_sh_id']] ?? []\n ];\n }\n }\n\n return $goods;\n }", "public function getDataArray(){\n return array($this->item_id,$this->name,$this->count,$this->price);\n }" ]
[ "0.7853604", "0.7341315", "0.6972715", "0.6847626", "0.6838348", "0.68021685", "0.67966944", "0.6779894", "0.67739385", "0.67273486", "0.67111254", "0.66631174", "0.6647399", "0.66168714", "0.65676874", "0.65658265", "0.6527574", "0.64007694", "0.63462967", "0.63235766", "0.6290048", "0.62805444", "0.62430686", "0.62011576", "0.6192436", "0.6190446", "0.61860967", "0.6154365", "0.6124606", "0.6090941", "0.60748166", "0.60231745", "0.5984571", "0.5984571", "0.5984571", "0.5984571", "0.59832805", "0.5982747", "0.5976789", "0.5975931", "0.59750164", "0.5969237", "0.5968566", "0.5968424", "0.5962528", "0.5960886", "0.5947111", "0.59449375", "0.5942685", "0.5935077", "0.59292096", "0.59243745", "0.5894135", "0.5870512", "0.5869717", "0.58581585", "0.5842971", "0.5839247", "0.583798", "0.5834713", "0.58106565", "0.5809931", "0.5809814", "0.5805438", "0.580412", "0.5791996", "0.5788367", "0.5777911", "0.57572776", "0.575606", "0.5748323", "0.5746913", "0.5746913", "0.5744978", "0.57432014", "0.57387435", "0.57288307", "0.57272255", "0.5719288", "0.5698281", "0.5695684", "0.56940085", "0.5693551", "0.56823456", "0.5678256", "0.56762767", "0.56754285", "0.5675099", "0.5672714", "0.5671097", "0.5668802", "0.5667171", "0.5664364", "0.56492543", "0.5643451", "0.56248015", "0.5615798", "0.5615798", "0.561209", "0.56047964" ]
0.7117997
2
Returns the list of all stock list contents
private function getStockListContents(): array { $list = $this->stocklistID; $this->db->select('i.eve_iditem as id, i.name as name, i.volume as vol'); $this->db->from('itemlist il'); $this->db->join('itemcontents ic', 'ic.itemlist_iditemlist = il.iditemlist'); $this->db->join('item i', 'i.eve_iditem = ic.item_eve_iditem'); $this->db->where('il.iditemlist', $list); $query = $this->db->get(); $result = $query->result(); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function read_stocks() {\n return $this->yahooStock->getQuotes();\n }", "public function view_list(){\n\t\treturn view(mProvider::$view_prefix.mProvider::$view_prefix_priv.'stock');\n\t}", "public function all() {\n $stmt = $this->pdo->query('SELECT id, symbol, company '\n . 'FROM stocks '\n . 'ORDER BY symbol');\n $stocks = [];\n while ($row = $stmt->fetch(\\PDO::FETCH_ASSOC)) {\n $stocks[] = [\n 'id' => $row['id'],\n 'symbol' => $row['symbol'],\n 'company' => $row['company']\n ];\n }\n return $stocks;\n }", "public function load_stocks() {\n\t\t\t$res = $this->Restaurant_model->loading_stocks();\n\t\t\techo $res;\n\t\t}", "public function getlistServiceAction()\n {\n $buzz = $this->container->get('buzz');\n\n $browser = $buzz->getBrowser('dolibarr');\n $response = $browser->get('/product/list/?api_key=712f3b895ada9274714a881c2859b617');\n\n $contentList = json_decode($response->getContent());\n\n return $contentList;\n }", "public function getList();", "public function getList();", "public function getAllList(){\n $collection = new Db\\Collection($this->getProductTable());\n return $collection->load();\n }", "public function index()\n {\n return Stock::get();\n }", "public function getList()\n {\n return $this->get(self::_LIST);\n }", "public function getItemsList(){\n return $this->_get(4);\n }", "public function list()\n {\n return $this->repo->getAll();\n ;\n }", "public function getList()\n {\n return $this->list;\n }", "public function getList()\n {\n return $this->list;\n }", "public function getList()\n {\n return $this->list;\n }", "public function getList() {\n return $this->list;\n }", "public function listAll();", "public function listAll();", "public function list();", "public function list();", "public function list();", "public function getList() {\n\t\t\tif (is_null($this->arList)) $this->load(); \n\t\t\treturn $this->arList; \n\t\t}", "public function items() {\n return $this->list;\n }", "public function getList ()\n {\n return $this->_list;\n }", "public function getList()\n {\n return $this->_list;\n }", "public function getAll()\n {\n return $this->list;\n }", "public abstract function get_lists();", "public function getEntriesList(){\n return $this->_get(2);\n }", "public function getCreditmemoWarehouseList();", "public function getList()\r\n\t{\r\n\t\treturn $this->data;\r\n\t}", "protected function getStockItemsCollection()\n {\n return $this->getWarehouseHelper()\n ->getCatalogInventoryHelper()\n ->getStockItemCollection($this->getProductId(), true);\n }", "abstract public function getList();", "public function getStock();", "public function getListStockTransferOrders()\n {\n return isset($this->listStockTransferOrders) ? $this->listStockTransferOrders : null;\n }", "public function getInfoList() {\n return $this->_get(10);\n }", "public function getList()\n {\n return parent::getList();\n }", "public static function all()\n {\n return self::$list;\n }", "public function getContentList() {\r\n\t\tif (!$this->read) {\r\n\t\t\t$this->open();\r\n\t\t\t$this->readContent();\r\n\t\t}\r\n\t\treturn $this->contentList;\r\n\t}", "public function getList()\n {\n $list = new \\BearFramework\\DataList();\n foreach ($this->data as $addon) {\n $list[] = clone($addon);\n }\n return $list;\n }", "function lists() {\n $params = array();\n return $this->callServer(\"lists\", $params);\n }", "public function getList()\r\n {\r\n return $this->data;\r\n }", "public function stock_history(){\n\t\treturn $stock_info = $this->db->select('*')\n\t\t ->from('store')\n\t\t ->where('isactive',1)\n\t\t ->get()\n\t\t ->result();\n\t}", "function getAllLists()\n {\n $stmt = self::$_db->prepare(\"SELECT * FROM list\");\n $stmt->execute();\n return $stmt->fetchAll(PDO::FETCH_ASSOC);\n }", "public function getInfoList() {\n return $this->_get(3);\n }", "public function getList() {\n\t\treturn $this->find('list', array(\n\t\t\t'contain' => false,\n\t\t\t'cache' => $this->alias . '::' . __FUNCTION__\n\t\t));\n\t}", "public function all()\n {\n return $this->refresh()->getItems();\n }", "function list_data() {\r\n\r\n $list_data = $this->Master_Stock_model->get_details()->result();\r\n $result = array();\r\n $before='';\r\n foreach ($list_data as $data) {\r\n $result[] = $this->_make_item_row($data,$before);\r\n $before=$data->name;\r\n }\r\n echo json_encode(array(\"data\" => $result));\r\n }", "public function getList() {\n\t\treturn parent::get();\n\t}", "public function getContents()\n {\n $all = $this->redis->zRange('prd', 0, -1);\n\n return array_map(function($i)\n {\n return unserialize($i);\n }, $all);\n }", "public function lists();", "public function getList()\n {\n }", "public static function getList(){\n return self::all();\n }", "public function getInfoList() {\n return $this->_get(11);\n }", "public function getInfoList() {\n return $this->_get(7);\n }", "public function getInfoList() {\n return $this->_get(7);\n }", "public static function getDataList () { return self::getList('data'); }", "public function getInfoList() {\n return $this->_get(21);\n }", "function getStockItemModel() {\n\t\t\treturn $this->getCatalogInventoryHelper( )->getStockItem( $this->getStockId( ) );\n\t\t}", "public function getList()\n {\n return $this->model->getList();\n }", "public function listItems()\n {\n return null;\n }", "public function list_cache()\n {\n $result = $this->_db->find('all');\n\n $return_list = array();\n $ttl_expiry = time() - $this->_cacheTTL;\n\n foreach ($result as $i => $cache_item) {\n $expired = false;\n $ttl = $cache_item[$this->_db->name]['created'];\n\n if ($ttl < $ttl_expiry) {\n $expired = true;\n }\n\n $return_list[] = array(\n 'item_name' => $cache_item[$this->_db->name]['request_hash'],\n 'contents' => $cache_item[$this->_db->name]['request_response'],\n 'location' => $cache_item[$this->_db->name]['request_hash'],\n 'ttl' => $ttl,\n 'expired' => $expired\n );\n }\n\n return $return_list;\n }", "function get_songs() { \n\n\t\t/* Get the Current Playlist */\n\t\t//echo $this->XBMCCmd(\"getcurrentplaylist\");\n\t\t$playlist = $this->aXBMCCmd(\"getplaylistcontents\",\"0\");\n\t\t\n\t\tforeach ($playlist as $entry) { \n\t\t\t$data = array();\n\n\t\t\t/* Required Elements */\n\t\t\t$data['id'] = get_song_id_from_file(trim(substr($entry,strrpos($entry,\"/\")+1)));\n\t\t\t$data['raw'] = '';\n\t\t\t\n\n\t\t\t/* Optional Elements */\n\t\t\t$song = new Song($data['id']);\n\t\t\t$song->format_song();\n\t\t\t$data['name']\t= $song->f_artist . \" - \" . $song->f_title;\n\n\t\t\t$results[] = $data;\n\n\t\t} // foreach playlist items \n\n\t\treturn $results;\n\n\t}", "function listContent()\n\t{\n\t\tif (!$this->isOpen)\n\t\t\treturn false;\n\n\t\t$content = array();\n\n\t\t$i = 0;\n\t\twhile ($curFile = $this->zip->statIndex($i++))\n\t\t\t$content[] = $curFile['name'];\n\t\treturn $content;\n\t}", "public function getInfoList() {\n return $this->_get(6);\n }", "public function listContent()\n {\n return $this->tarArchive->listContent();\n }", "public function getList() {\n \treturn array(\"id\" => $this->id,\n \"name\" => $this->name);\n\t}", "static public function getList() {\n\t\t$mComponentcache=new Maerdo_Model_Componentcache();\n\t\t$result=$mComponentcache->fetchAll();\n\t\treturn($result);\n\t}", "public function getItems(): array\n\t{\n\t\treturn $this->storage->all();\n\t}", "public function inventory()\n\t{\n\t\t$list = array();\n\n\t\tif (count($this->items) > 0)\n\t\t{\n\t\t\tforeach ($this->items as $item)\n\t\t\t{\n\t\t\t\t$list[] = array(\n\t\t\t\t\t'id' => $item->id,\n\t\t\t\t\t'name' => $item->name(),\n\t\t\t\t\t'price' => $item->parameter,\n\t\t\t\t\t'img' => $item->img(),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn $list;\n\t}", "public function getItemList()\r\n {\r\n return $this->item_list;\r\n }", "public function getItems()\n\t{\n\t\t// Get a storage key.\n\t\t$store = $this->getStoreId('getItems');\n\t\n\t\t// Try to load the data from internal storage.\n\t\tif (!empty($this->cache[$store]))\n\t\t{\n\t\t\treturn $this->cache[$store];\n\t\t}\n\t\n\t\t// Load the list items.\n\t\t$items = parent::getItems();\n\t\n\t\t// If emtpy or an error, just return.\n\t\tif (empty($items))\n\t\t{\n\t\t\treturn array();\n\t\t}\n\t\t// Add the items to the internal cache.\n\t\t$this->cache[$store] = $items;\n\t\n\t\treturn $this->cache[$store];\n\t}", "function getList()\n {\n $stmt = \"SELECT\n nws_id,\n nws_title,\n nws_status\n FROM\n \" . APP_DEFAULT_DB . \".\" . APP_TABLE_PREFIX . \"news\n ORDER BY\n nws_title ASC\";\n $res = DB_Helper::getInstance()->getAll($stmt, DB_FETCHMODE_ASSOC);\n if (PEAR::isError($res)) {\n Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);\n return \"\";\n } else {\n // get the list of associated projects\n for ($i = 0; $i < count($res); $i++) {\n $res[$i]['projects'] = implode(\", \", array_values(self::getAssociatedProjects($res[$i]['nws_id'])));\n }\n return $res;\n }\n }", "public function retrieveAllList()\n {\n if ($list = $this->memcache->get('API::' . $this->numInstance . '::referentiel')) {\n return json_decode($list, true);\n } else {\n $list = $this->refIdRepository->findAllAsArray();\n $this->memcache->set(\n 'API::' . $this->numInstance . '::referentiel',\n json_encode($list),\n 0,\n 86400\n );\n return $list;\n }\n }", "public function getProductList()\n {\n return $this->_call('catalog_product.list', '');\n }", "public function getList() {\n\t\treturn Cgn_Module_Manager_File::getListStatic();\n\t}", "public function all()\n {\n return $this->getCartSession();\n }", "public function index()\n {\n $stocks = Stock::all();\n\n return view('admin.stock.index')\n ->with('stocks', $stocks);\n }", "public function getQuotesList( $symbols ) {\n if ( is_string( $symbols ) ) {\n $symbols = array( $symbols );\n }\n $query = \"select * from yahoo.finance.quoteslist where symbol in ('\" . implode( \"','\", $symbols ) . \"')\";\n\n return $this->execQuery( $query );\n }", "public function renderList()\n\t{\n $this->toolbar_title = $this->l('Inventory reports');\n \n if (Tools::isSubmit('id_container') && Tools::getValue('id_container') > 0)\n self::$currentIndex .= '&id_container='.(int)Tools::getValue('id_container');\n\n\t\t// Détermination de l'id container. Si aucun sélectionné, on prend le premier\n\t\tif (($id_container = $this->getCurrentValue('id_container')) == false)\n\t\t{\n\t\t\t$id_container = (int)Inventory::getFirstId();\n\t\t\t$this->tpl_list_vars['id_container'] = $id_container;\n\t\t}\n \n // get total stock gap of inventory\n $total_stock_gap = InventoryProduct::getTotalStockGap($id_container);\n \n\t\t $this->tpl_list_vars['total_gap'] = Tools::displayPrice($total_stock_gap);\n \n\t\t// Query\n\t\t$this->_select = '\n IF(a.id_warehouse = -1, \"'. html_entity_decode($this->l('No warehouse')) .'\",a.id_warehouse) as id_warehouse,\n\t\t\t\t\tpl.name as name,\n\t\t\t\t\tp.reference,\n\t\t\t\t\tsmrl.name as reason,\n\t\t\t\t\tsmr.sign, (\n\t\t\t\t\ta.qte_after - a.qte_before) as gap,\n\t\t\t\t\t(\n\t\t\t\t\t\tSELECT ps.product_supplier_reference\n\t\t\t\t\t\tFROM '._DB_PREFIX_.'product_supplier ps\n\t\t\t\t\t\tWHERE ps.id_product = a.id_product\n\t\t\t\t\t\tAND ps.id_product_attribute = 0\n\t\t\t\t\t\tLIMIT 1\n\t\t\t\t\t)as first_supplier_ref ';\n\t\t$this->_join = 'INNER JOIN '._DB_PREFIX_.'product_lang pl ON (a.id_product = pl.id_product AND pl.id_lang = '.(int)$this->context->language->id.')\n\t\t\t\tINNER JOIN '._DB_PREFIX_.'product p ON a.id_product = p.id_product\n\t\t\t\tINNER JOIN '._DB_PREFIX_.'stock_mvt_reason_lang smrl ON (a.id_mvt_reason = smrl.id_stock_mvt_reason AND smrl.id_lang = '.(int)$this->context->language->id.')\n\t\t\t\tINNER JOIN '._DB_PREFIX_.'stock_mvt_reason smr ON a.id_mvt_reason = smr.id_stock_mvt_reason\n\t\t\t\tINNER JOIN '._DB_PREFIX_.'erpip_inventory i ON a.id_erpip_inventory = i.id_erpip_inventory';\n\t\t$this->_where = 'AND i.id_erpip_inventory = '.$id_container;\n\t\t$this->_order = 'a.id_erpip_inventory_product DESC';\n\t\t$this->_group = 'GROUP BY a.id_erpip_inventory_product';\n\n\t\t// Envoi valeurs à la vue\n\t\t$this->tpl_list_vars['containers'] = Inventory::getContainers();\n\n\t\t$list = parent::renderList();\n\t\treturn $list;\n\t}", "public function getList(): array\n {\n return $this->openerp_jsonrpc->callWithoutCredential(self::getPath('get_list'));\n }", "function listContent()\n {\n }", "public static function getItemShopList()\n {\n $key = self::getCacheKey('getItemShopList');\n\n if (!$result = Bll_Cache::get($key)) {\n $_dalItem = self::getDalItem();\n $result = $_dalItem->getItemShopList();\n\n if ($result) {\n Bll_Cache::set($key, $result, Bll_Cache::LIFE_TIME_MAX);\n }\n }\n\n return $result;\n }", "function getList() {\n $query = $this->db->query('SELECT * FROM `all_list`');\n return $query->result_array();\n //return $query->result();\n }", "public function indexAction()\n {\n $em = $this->getDoctrine()->getManager();\n\n $stocks = $em->getRepository('IschaBackOfficeBundle:Stock')->findAll();\n\n return $this->render('stock/index.html.twig', array(\n 'stocks' => $stocks,\n ));\n }", "public function _list()\n {\n return header_list();\n }", "public function actionIndex()\n {\n $searchModel = new StockSearch();\n $dataProvider = $searchModel->search(Yii::$app->request->queryParams);\n\n return $this->render('index', [\n 'searchModel' => $searchModel,\n 'dataProvider' => $dataProvider,\n ]);\n }", "public function getVariantStocks()\n {\n return $this->getProductStocks()\n ->joinWith('stock');\n }", "public static function getAllEntries() {\n global $_module;\n\n $result = lC_Product_variants_Admin::getAllEntries($_GET[$_module]);\n $result['rpcStatus'] = RPC_STATUS_SUCCESS;\n\n echo json_encode($result);\n }", "public function getList()\n {\n return $this->info;\n }", "public function getStockItem()\n\t\t{\n\t\t\t$this->layout = \"index\";\n\t\t\t$this->set('title', 'Stock Items (Linnworks API)');\n\t\t}", "public function getList()\n {\n \treturn $this->model->where('is_base', '=', 0)->get();\n }", "public function getOrderList()\n {\n }", "public function getList() {\n\t\treturn null;\n\t}", "public function index()\n {\n return $this->sendResponse(StockArchive::join('service_items', 'stock_archives.service_id', '=', 'service_items.id')\n ->where('stock_archives.client_id', auth('api')->user()->id)\n ->select('stock_archives.uuid', 'service_items.name AS service_name', 'stock_archives.name AS name', 'stock_archives.description', 'stock_archives.photo', 'stock_archives.expires_at', 'stock_archives.created')\n ->get()\n ->toArray(),'Список акций');\n }", "public function getAll()\n {\n \tif(!$this->isEmpty()){\n \t\treturn $this->items;\n \t}\n }", "public function listing();", "public function index()\n {\n $reactifs = Reactif::limit(5)->get();\n $vaccins = Vaccin::limit(5)->get();\n $echantillons = Echantillon::limit(5)->get();\n $substances = Substancespures::limit(5)->get();\n return view('stocks.index', compact('reactifs', 'vaccins', 'echantillons', 'substances'));\n }", "public function getList() {\n\t return array(\"id\" => $this->id,\n \t \"name\" => $this->title);\n\t}", "public function getAllList_Price()\n {\n try\n {\n // Создаем новый запрс\n $db = $this->getDbo();\n $query = $db->getQuery(true);\n\n $query->select('a.*');\n $query->from('`#__gm_ceiling_components_option` AS a');\n $query->select('CONCAT( component.title , \\' \\', a.title ) AS full_name');\n $query->select('component.id AS component_id');\n $query->select('component.title AS component_title');\n $query->select('component.unit AS component_unit');\n $query->join('RIGHT', '`#__gm_ceiling_components` AS component ON a.component_id = component.id');\n\n $db->setQuery($query);\n $return = $db->loadObjectList();\n return $return;\n }\n catch(Exception $e)\n {\n Gm_ceilingHelpersGm_ceiling::add_error_in_log($e->getMessage(), __FILE__, __FUNCTION__, func_get_args());\n }\n }", "public function getStockStatus()\n {\n\t\t$cache=Yii::app()->cache;\n $stockstatuses=$cache->get('a_stockstatuses_'.Yii::app()->session['language']);\n if($stockstatuses===false)\n {\n\t\t\t$criteria = new CDbCriteria;\n\t\t\t$criteria->condition='t.id_language=\"'.Yii::app()->session['language'].'\"';\n $stockstatuses=StockStatus::model()->findAll($criteria);\n $cache->set('a_stockstatuses_'.Yii::app()->session['language'],$stockstatuses , Yii::app()->config->getData('CONFIG_WEBSITE_CACHE_LIFE_TIME'), new CDbCacheDependency('SELECT concat(MAX(date_modified),\"-\",count(id_stock_status)) as date_modified FROM {{stock_status}}'));\n }\n return $stockstatuses;\t\n }" ]
[ "0.735539", "0.7155176", "0.7109039", "0.6581265", "0.6550308", "0.64300275", "0.64300275", "0.64100283", "0.64042234", "0.6404084", "0.6393538", "0.63809395", "0.63797426", "0.63797426", "0.63797426", "0.63650626", "0.6364002", "0.6364002", "0.63457245", "0.63457245", "0.63457245", "0.6339385", "0.6338746", "0.6334879", "0.6331526", "0.63208526", "0.6300608", "0.6273918", "0.62711215", "0.6266735", "0.6261287", "0.62594086", "0.62488914", "0.62342197", "0.62305635", "0.6220437", "0.6197154", "0.61851996", "0.61699927", "0.61604124", "0.61589164", "0.61521804", "0.6147611", "0.6122204", "0.611807", "0.61115503", "0.6102366", "0.6090906", "0.6089123", "0.6078388", "0.60481817", "0.60477036", "0.60328484", "0.6029759", "0.6029759", "0.6029534", "0.60203475", "0.6010683", "0.6002123", "0.6002098", "0.599058", "0.59840494", "0.59698683", "0.5963813", "0.5960748", "0.59578633", "0.5944565", "0.59442955", "0.5928744", "0.5927392", "0.5909545", "0.5908984", "0.5906491", "0.5905779", "0.5905529", "0.59024096", "0.59000105", "0.5897295", "0.58954424", "0.5888093", "0.58838", "0.58811575", "0.5878108", "0.58726865", "0.58663917", "0.5864091", "0.5863867", "0.58631283", "0.58588415", "0.58577067", "0.5852658", "0.58494085", "0.5846628", "0.58454615", "0.58441967", "0.5838883", "0.5838085", "0.58341104", "0.5829059", "0.5826012" ]
0.7995536
0
Fetches price data from CREST for an item
private function getCrestData(int $item_id, int $station_id, string $order_type): float { $regionID = $this->getRegionID($station_id)->id; $url = "https://crest-tq.eveonline.com/market/" . $regionID . "/orders/" . $order_type . "/?type=https://crest-tq.eveonline.com/inventory/types/" . $item_id . "/"; //$context = stream_context_create(array('http' => array('header'=>'Connection: close\r\n'))); /*$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $result = json_decode(curl_exec($ch), true);*/ $result = json_decode(file_get_contents($url), true); $array_prices = []; for ($i = 0; $i < count($result['items']); $i++) { // only fetch orders FROM the designated stationID if ($result['items'][$i]['location']['id_str'] == $station_id) { array_push($array_prices, $result['items'][$i]['price']); } } if ($order_type == 'buy') { if (!empty($array_prices)) { $price = max($array_prices); } else { $price = 0; } } else if ($order_type == 'sell') { if (!empty($array_prices)) { $price = min($array_prices); } else { $price = 0; } } return $price; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abstract public function getPrice();", "public function getPriceFromDatabase()\n {\n }", "public function getPrices()\n {\n }", "public function getPrice();", "public function getPrice();", "public function getPrice();", "public function getPrice();", "private function fetchIt($item) {\n $book_id = $item->book_id;\n $book_title = $item->book_title;\n $book_author = $item->book_author === null ? \"\" : $item->book_author;\n $book_editor = $item->book_editor === null ? \"\" : $item->book_editor;\n $book_image = $item->book_image === null ? \"\" : $item->book_image;\n $book_state = $item->book_state;\n $cycle = $item->cycle;\n $classe = $item->classe;\n $book_unit_prise = $item->book_unit_prise;\n $book_stock_quantity = $item->book_stock_quantity;\n $b = new Book();\n return $b->setData($book_id, $book_title, $book_author, $book_editor, $book_image,\n $book_state, $cycle, $classe, $book_unit_prise, $book_stock_quantity);\n }", "protected function findPrice()\n\t{\n\t\trequire_once(TL_ROOT . '/system/modules/isotope/providers/ProductPriceFinder.php');\n\n\t\t$arrPrice = ProductPriceFinder::findPrice($this);\n\n\t\t$this->arrData['price'] = $arrPrice['price'];\n\t\t$this->arrData['tax_class'] = $arrPrice['tax_class'];\n\t\t$this->arrCache['from_price'] = $arrPrice['from_price'];\n\t\t$this->arrCache['minimum_quantity'] = $arrPrice['min'];\n\n\t\t// Add \"price_tiers\" to attributes, so the field is available in the template\n\t\tif ($this->hasAdvancedPrices())\n\t\t{\n\t\t\t$this->arrAttributes[] = 'price_tiers';\n\n\t\t\t// Add \"price_tiers\" to variant attributes, so the field is updated through ajax\n\t\t\tif ($this->hasVariantPrices())\n\t\t\t{\n\t\t\t\t$this->arrVariantAttributes[] = 'price_tiers';\n\t\t\t}\n\n\t\t\t$this->arrCache['price_tiers'] = $arrPrice['price_tiers'];\n\t\t}\n\t}", "function price( )\n {\n if ( $this->State_ == \"Dirty\" )\n $this->get( $this->ID );\n\n return $this->Price;\n }", "public function getPrice() {\n }", "public function getPrice() {\n return $this->item->getPrice();\n }", "function getPrice($id,$rdvtype){\r global $bdd;\r\r $req4=$bdd->prepare(\"select * from packs where idpack=? \");\r $req4->execute(array($id));\r while($ar = $req4->fetch()){\r if($rdvtype == 'visio'){return $ar['prvisio'];}else if($rdvtype == 'public'){return $ar['prpublic'];}else if($rdvtype == 'domicile'){return $ar['prdomicile'];}\r }\r\r return 200;\r}", "public function getPrice()\n {\n }", "public function getPrice()\n {\n }", "public function getPrice()\n {\n return $this->get(self::_PRICE);\n }", "function getPrice()\n {\n return $this->price;\n }", "abstract function getPriceFromAPI($pair);", "public function getItemsPrice()\n {\n return [10,20,54];\n }", "function get_item($item_id)\n\t{\n\t\tglobal $conn;\n\n\t\t$query=\"SELECT * FROM list_items WHERE item_id='$item_id' \";\n\t\t$result=mysqli_query($conn,$query);\n\n\t\t$item_data=\"\";\n\t\t\n\t\twhile($row = mysqli_fetch_array( $result))\n\t\t{\n\t\t\t$daily_price=$row['daily_rate'];\n\t\t\t$weekly_price=$row['weekly_rate'];\n\t\t\t$weekend_price=$row['weekend_rate'];\n\t\t\t$monthly_price=$row['monthly_rate'];\n\t\t\t$bond_price=$row['bond_rate'];\n\n\t\t\tif($daily_price=='0.00'){$daily_price=\"NA\";}\n\t\t\tif($weekly_price=='0.00'){$weekly_price=\"NA\";}\n\t\t\tif($weekend_price=='0.00'){$weekend_price=\"NA\";}\n\t\t\tif($monthly_price=='0.00'){$monthly_price=\"NA\";}\n\t\t\tif($bond_price=='0.00'){$bond_price=\"NA\";}\n\n\t\t\t$extra=array(\n\t\t\t\t'item_id'\t=>\t$row['item_id'],\n\t\t\t\t'item_pictures'\t=>\t$row['item_pictures'],\n\t\t\t\t'item_description'\t=>\t$row['item_description'],\n\t\t\t\t'item_name'\t=>\t$row['item_name'],\n\t\t\t\t'extra_option'\t=>\t$row['extra_option'],\t\t\t\t\n\t\t\t\t'user_id'\t=>\t$row['user_id'],\t\t\t\t\n\t\t\t\t'total_views'\t=>\t$row['total_views'],\t\t\t\t\n\t\t\t\t'cat_name'\t=>\t$row['cat_name'],\n\t\t\t\t'isLive'\t=>\t$row['isLive'],\n\t\t\t\t'user_name'\t=>\t$row['user_name'],\n\t\t\t\t'daily_rate'\t=>\t$daily_price,\n\t\t\t\t'weekly_rate'\t=>\t$weekly_price,\n\t\t\t\t'weekend_rate'\t=>\t$weekend_price,\n\t\t\t\t'monthly_rate'\t=>\t$monthly_price,\n\t\t\t\t'bond_rate'\t=>\t$bond_price\n\t\t\t);\n\t\t\t$item_data[]=$extra;\n\n\t\t}\n\n\t\tif(mysqli_query($conn, $query)){\n\t\t\t$response=array(\n\t\t\t\t'status' => 1,\n\t\t\t\t'items' => $item_data\t\t\t\t\t\t\n\t\t\t);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t//insertion failure\n\t\t\t$response=array(\n\t\t\t\t'status' => 0,\n\t\t\t\t'status_message' =>'Item Details not found!!!'\t\t\t\n\t\t\t);\n\t\t}\n\t\theader('Content-Type: application/json');\n\t\techo json_encode($response);\n\t}", "function getItemPrice($storeId = null, $merchant_id = null, $catId = null, $itemId = null, $sizeId = null) {\n App::import('Model', 'Item');\n $this->Item = new Item();\n $this->ItemPrice->bindModel(\n array('belongsTo' => array(\n 'Size' => array(\n 'className' => 'Size',\n 'foreignKey' => 'size_id',\n 'conditions' => array('Size.is_active' => 1, 'Size.is_deleted' => 0, 'Size.store_id' => $storeId),\n 'order' => array('Size.id ASC')\n ),\n 'StoreTax' => array(\n 'className' => 'StoreTax',\n 'foreignKey' => 'store_tax_id',\n 'conditions' => array('StoreTax.is_active' => 1, 'StoreTax.is_deleted' => 0, 'StoreTax.store_id' => $storeId)\n )\n )));\n $this->Item->bindModel(\n array('hasOne' => array(\n 'ItemPrice' => array(\n 'className' => 'ItemPrice',\n 'foreignKey' => 'item_id',\n 'type' => 'INNER',\n 'conditions' => array('ItemPrice.is_active' => 1, 'ItemPrice.is_deleted' => 0, 'ItemPrice.store_id' => $storeId, 'ItemPrice.size_id' => $sizeId),\n 'order' => array('ItemPrice.position ASC')\n ),\n )\n ));\n $checkItem = $this->Item->find('first', array('conditions' => array('Item.store_id' => $storeId, 'Item.merchant_id' => $merchant_id, 'Item.is_deleted' => 0, 'Item.id' => $itemId, 'Item.category_id' => $catId, 'Item.is_active' => 1), 'fields' => array('id', 'name', 'description', 'units', 'is_seasonal_item', 'start_date', 'end_date', 'is_deliverable', 'preference_mandatory', 'default_subs_price'), 'recursive' => 3));\n \n if (!empty($checkItem['ItemPrice']['Size'])) {\n $default_price = $checkItem['ItemPrice']['price'];\n $intervalPrice = 0;\n $intervalPrice = $this->getTimeIntervalPrice($itemId, $sizeId, $storeId);\n if (!empty($intervalPrice['IntervalPrice'])) {\n $default_price = $intervalPrice['IntervalPrice']['price'];\n }\n }else{\n $default_price= $checkItem['ItemPrice']['price'];\n }\n return $default_price;\n }", "public function get_price(){\n\t\treturn $this->price;\n\t}", "function get_price( $force_refresh=false ){\r\n\t\tif( $force_refresh || $this->price == 0 ){\r\n\t\t\t//get the ticket, clculate price on spaces\r\n\t\t\t$this->price = $this->get_ticket()->get_price() * $this->spaces;\r\n\t\t}\r\n\t\treturn apply_filters('em_booking_get_prices',$this->price,$this);\r\n\t}", "public function getPrice(): string;", "function getAmazonProductsPriceByArtNr($item, $amazonAccountsSites)\n{\n\t$from = 'prpos';\n\t$select = '*';\n\t$addWhere = \"\n\t\tArtNr = '\" . $item[\"MPN\"] . \"'\n\t\tAND LST_NR = '\" . $amazonAccountsSites[\"pricelist\"] . \"'\";\n\t$prposResult = SQLSelect($from, $select, $addWhere, 0, 0, 1, 'shop', __FILE__, __LINE__);\n\t$price = round($prposResult[\"POS_0_WERT\"] * 1.19, 2);\n\n //\tEinzelne Bremsbelege als Satz ausweisen\n if ($item[\"GART\"] == 82 && stristr($item[\"MPN\"], '/2') === false) {\n $price = round($price * 2, 2);\n }\n return $price;\n}", "public function getPrice()\n {\n return $this->price;\n }", "public function getPrice()\n {\n return $this->price;\n }", "public function getPrice()\n\t{\n\t\t$item = InvoiceItem::where('description', $this->description)\n\t\t\t->orderBy('updated_at', 'DESC')\n\t\t\t->first();\n\n\t\treturn is_null($item) ? 0 : $item->price;\n\t}", "public function testProductGetPrices()\n {\n $product = $this->find('product', 1);\n $prices = $product->getPrices();\n $price = $prices[0];\n \n $currencies = $this->findAll('currency');\n $dollarCurrency = $currencies[0];\n \n $money = Money::create(10, $dollarCurrency); \n \n $this->assertEquals(\n $money,\n $price\n );\n }", "public function getPrice()\n {\n $price = Cache::tags([$this->exchange])->get($this->pair, function () {\n return $this->getPriceFromAPI($this->pair);\n });\n return $price;\n }", "public function getPrice(){ return $this->price_rur; }", "final public function call_rental_price_api($cart_item): object {\n\t\t$product_id = $cart_item['product_id'];\n\t\t$sku = get_post_meta( $product_id, '_sku', true );\n\t\t$itemsQuantity = $cart_item['quantity'];\n\t\t// echo \"<pre>\";print_r($cart_item);echo \"</pre>\";\n\t\tif(isset($cart_item['wrp_date_range'])){\n\t\t\t$wrp_date_range = $cart_item['wrp_date_range'];\n\t\t\t$start_arr \t\t=\texplode(' ',$wrp_date_range['date_start']); \n\t\t\t$start \t\t\t=\t$start_arr[0].'T'.$start_arr[1];\n\t\t\t$end_arr \t\t=\texplode(' ',$wrp_date_range['date_end']); \n\t\t\t$end \t\t\t= \t$end_arr[0].'T'.$end_arr[1];\n\t\t}else{\n\t\t\t$start \t= date('Y-m-d') ;\n\t\t\t$end \t= date(\"Y-m-d\", strtotime(\"+ 1 day\"));\n\t\t}\n\t\t\t\n\t\t$endpoint = get_option('endpoint_url'); \n\t\t$post_url = $endpoint.'/calcPrices';\t\n\t\t$body = array( 'items' => array(array('start' => $start,\n\t\t\t\t\t\t'end'=>$end,\n\t\t\t\t\t\t'sku' => $sku,\n\t\t\t\t\t\t'qty' => ''.$itemsQuantity.'')));\n\n\t $request = new WP_Http();\n\t $response = $request->post( $post_url, array( 'body' => json_encode($body) ) );\t \n\t // $response['response']['code'] = 200;\n\t if($response['response']['code'] == 200){\n\t \t// process responce here..\n\t \t/*$response['body'] ='\n\t\t\t \t{\n\t\t\t\t \"items\": [\n\t\t\t\t {\n\t\t\t\t \"start\": \"2019-05-01T07:00:00.000Z\",\n\t\t\t\t \"end\": \"2019-05-07T03:00:00.000Z\",\n\t\t\t\t \"sku\": \"GD3\",\n\t\t\t\t \"qty\": 1,\n\t\t\t\t \"dur\": 14.00,\n\t\t\t\t \"periodCode\": \"Day\",\n\t\t\t\t \"periodName\": \"Day\",\n\t\t\t\t \"amount\": 210.00,\n\t\t\t\t \"avQty\": 5\n\t\t\t\t }\n\t\t\t\t ]\n\t\t\t\t}\n\t\t\t';*/\n\n\t\t\t\n\t\t\t$price_array = json_decode($response['body']);\n\t\t\t$rentalPrice = $price_array->items[0];\n\t\t\treturn $rentalPrice;\n\t }\n\t else{\n\t \treturn (object) array();\n\t }\t\n\t}", "public function getPrice(){\n return $this->price;\n }", "public function getProductPrice()\n {\n }", "public function getPrice()\n {\n return $this->object->Price;\n }", "function getStartPrice($_DATA)\n { \n $dp=$this->dp; \n \n $nodeId = $_DATA['objId']; //$this->utf8Urldecode($_DATA['objId']);\n $q= \"SELECT START_OF_DAY_PRICE FROM imk_II WHERE ISIN_CODE = '$nodeId'\";\n\n $dp->setQuery($q);\n $price = $dp->loadResult();\n \n return $price;\n }", "public function actionGetProductPrice($id=null)\n {\n $userData = User::find()->andFilterWhere(['u_id' => $id])->andWhere(['IS NOT', 'u_mws_seller_id', null])->all();\n\n foreach ($userData as $user) {\n \\Yii::$app->data->getMwsDetails($user->u_mws_seller_id, $user->u_mws_auth_token);\n $models = FbaAllListingData::find()->andWhere(['created_by' => $user->u_id])->all(); //->andWhere(['status' => 'Active'])\n\n foreach ($models as $model) {\n if ($model->seller_sku) {\n $productDetails = \\Yii::$app->api->getProductCompetitivePrice($model->seller_sku);\n if ($productDetails) {\n $model->buybox_price = $productDetails;\n if ($model->save(false)) {\n echo $model->asin1 . \" is Updated.\";\n }\n }\n }\n sleep(3);\n }\n }\n }", "public function getPrice(){\n return $this->price;\n }", "public function getPrice(){\n return $this->price;\n }", "public function getPrice(){\n }", "public function getPrice(){\n }", "public function resolvePrice();", "function high_price(){\n\n\tglobal $con;\t\n\t$get_hprice = \"SELECT * FROM items ORDER BY item_pice DESC\";\n\t$run_hprice = mysql_query($get_hprice);\t\n\tshow_item($run_hprice);\n\n}", "public function fetchPrice($sku){\n\t\ttry{\n\n $result = json_decode($this->getProduct($sku),true);\n\n foreach ($result['custom_attributes'] as $value) {\n if($value['attribute_code'] == 'url_key'){\n $result['url_path'] = $value['value'];\n }\n }\n\n\t return array(\n 'name' => $result['name'],\n 'price' => $result['price'],\n 'url' => $this->urlPath.'/'.$result['url_path'].\".html\"\n );\n\t\t\t} catch(Exception $e){\n\t\t\t\tthrow new CHttpException(400,Yii::t('yii','Product does no exist'));\n\t\t\t\treturn;\n\t\t\t}\n }", "public function getPrice(): float;", "public function getPrice(): float;", "public function getPrice()\r\n {\r\n return $this->price;\r\n }", "function sale_price() {\n\t\treturn $this->_apptivo_sale_price;\n\t}", "public function getPriceAll()\n { \n $collection = $this->PostCollectionFactory->create();\n /*$a = $collection->getPrice();*/\n foreach ($collection as $key => $value) {\n $value->getPrice();\n }\n return $value->getPrice();\n }", "public function getAllList_Price()\n {\n try\n {\n // Создаем новый запрс\n $db = $this->getDbo();\n $query = $db->getQuery(true);\n\n $query->select('a.*');\n $query->from('`#__gm_ceiling_components_option` AS a');\n $query->select('CONCAT( component.title , \\' \\', a.title ) AS full_name');\n $query->select('component.id AS component_id');\n $query->select('component.title AS component_title');\n $query->select('component.unit AS component_unit');\n $query->join('RIGHT', '`#__gm_ceiling_components` AS component ON a.component_id = component.id');\n\n $db->setQuery($query);\n $return = $db->loadObjectList();\n return $return;\n }\n catch(Exception $e)\n {\n Gm_ceilingHelpersGm_ceiling::add_error_in_log($e->getMessage(), __FILE__, __FUNCTION__, func_get_args());\n }\n }", "function setItem_price($price){\n $this->item_price = $price;\n }", "protected function _getProductData() {\n\n\n $cat_id = Mage::getModel('catalog/layer')->getCurrentCategory()->getId();\n $category = Mage::getModel('catalog/category')->load($cat_id);\n $data['event'] = 'product';\n\n $finalPrice = $this->getFinalPriceDiscount();\n if($finalPrice):\n $google_tag_params = array();\n $google_tag_params['ecomm_prodid'] = $this->getProduct()->getSku();\n $google_tag_params['name'] = $this->getProduct()->getName();\n $google_tag_params['brand'] = $this->getProduct()->getBrand();\n $google_tag_params['ecomm_pagetype'] = 'product';\n $google_tag_params['ecomm_category'] = $category->getName();\n $google_tag_params['ecomm_totalvalue'] = (float)$this->formatNumber($finalPrice);\n \n $customer = Mage::getSingleton('customer/session');\n if ($customer->getCustomerId()){\n $google_tag_params['user_id'] = (string) $customer->getCustomerId(); \n }\n if($this->IsReturnedCustomer()){\n $google_tag_params['returnCustomer'] = 'true';\n }\n else {\n $google_tag_params['returnCustomer'] = 'false';\n }\n\n $data['google_tag_params'] = $google_tag_params;\n\n /* Facebook Conversion API Code */\n $custom_data = array(\n \"content_name\" => $this->getProduct()->getName(),\n \"content_ids\" => [$this->getProduct()->getSku()],\n \"content_category\" => $category->getName(),\n \"content_type\" => \"product\",\n \"value\" => (float)$this->formatNumber($finalPrice),\n \"currency\" => \"BRL\"\n );\n $this->createFacebookRequest(\"ViewContent\", [], [], $custom_data);\n /* End Facebook Conversion API Code */\n\n endif;\n\n return $data;\n }", "public function get_prices()\n\t{\n\t\t$product_price_old = 0;\n\t\t$product_price_sale = 0;\n\t\t$price = 0;\n\t\t$eco = 0;\n\t\t$taxes = 0;\n\t\t$dataoc = isset($this->request->post['dataoc']) ? $this->request->post['dataoc'] : '';\n\n\t\tif (!empty($dataoc)) {\n\t\t\t$dataoc = str_replace('&quot;', '\"', $dataoc);\n\t\t\t$json = @json_decode($dataoc, true);\n\t\t\t$product_quantity = isset($json['quantity']) ? $json['quantity'] : 0;\n\t\t\t$product_id_oc = isset($json['product_id_oc']) ? $json['product_id_oc'] : 0;\n\t\t\tif ($product_id_oc == 0) $product_id_oc = isset($json['_product_id_oc']) ? $json['_product_id_oc'] : 0;\n\n\t\t\t// get options\n\t\t\t$options = isset($json['option_oc']) ? $json['option_oc'] : array();\n\t\t\tforeach ($options as $key => $value) {\n\t\t\t\tif ($value == null || empty($value)) unset($options[$key]);\n\t\t\t}\n\n\t\t\t// get all options of product\n\t\t\t$options_temp = $this->get_options_oc($product_id_oc);\n\n\t\t\t// Calc price for ajax\n\t\t\tforeach ($options_temp as $value) {\n\t\t\t\tforeach ($options as $k => $option_val) {\n\t\t\t\t\tif ($k == $value['product_option_id']) {\n\t\t\t\t\t\tif ($value['type'] == 'checkbox' && is_array($option_val) && count($option_val) > 0) {\n\t\t\t\t\t\t\tforeach ($option_val as $val) {\n\t\t\t\t\t\t\t\tforeach ($value['product_option_value'] as $op) {\n\t\t\t\t\t\t\t\t\t// calc price\n\t\t\t\t\t\t\t\t\tif ($val == $op['product_option_value_id']) {\n\t\t\t\t\t\t\t\t\t\tif ($op['price_prefix'] == $this->minus) $price -= isset($op['price_no_tax']) ? $op['price_no_tax'] : 0;\n\t\t\t\t\t\t\t\t\t\telse $price += isset($op['price_no_tax']) ? $op['price_no_tax'] : 0;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} elseif ($value['type'] == 'radio' || $value['type'] == 'select') {\n\t\t\t\t\t\t\tforeach ($value['product_option_value'] as $op) {\n\t\t\t\t\t\t\t\tif ($option_val == $op['product_option_value_id']) {\n\t\t\t\t\t\t\t\t\tif ($op['price_prefix'] == $this->minus) $price -= isset($op['price_no_tax']) ? $op['price_no_tax'] : 0;\n\t\t\t\t\t\t\t\t\telse $price += isset($op['price_no_tax']) ? $op['price_no_tax'] : 0;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// the others have not price, so don't need calc\n\t\t\t\t\t}\n\t\t\t\t\t// if not same -> return.\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$product_prices = $this->get_product_price($product_id_oc, $product_quantity);\n\t\t\t$product_price_old = isset($product_prices['price_old']) ? $product_prices['price_old'] : 0;\n\t\t\t$product_price_sale = isset($product_prices['price_sale']) ? $product_prices['price_sale'] : 0;\n\t\t\t$enable_taxes = $this->config->get('tshirtecommerce_allow_taxes');\n\t\t\tif ($enable_taxes === null || $enable_taxes == 1) {\n\t\t\t\t$taxes = isset($product_prices['taxes']) ? $product_prices['taxes'] : 0;\n\t\t\t\t$eco = isset($product_prices['eco']) ? $product_prices['eco'] : 0;\n\t\t\t} else {\n\t\t\t\t$taxes = 0;\n\t\t\t\t$eco = 0;\n\t\t\t}\n\t\t\t\n\t\t} // do nothing when empty/blank\n\n\t\t// return price for ajax\n\t\techo @json_encode(array(\n\t\t\t'price' => $price, \n\t\t\t'price_old' => $product_price_old, \n\t\t\t'price_sale' => $product_price_sale, \n\t\t\t'taxes' => $taxes,\n\t\t\t'eco' => $eco\n\t\t));\n\t\treturn;\n\t}", "function get_price($name)\r\n{\r\n //Read data from DB table\r\n\r\n $servername = \"localhost\";\r\n $dbname = \"webservices\";\r\n $username = \"root\";\r\n $password = \"\";\r\n\r\n\r\n // Create connection\r\n $conn = new mysqli($servername, $username, $password, $dbname);\r\n // Check connection\r\n if ($conn->connect_error) {\r\n die(\"Connection failed: \" . $conn->connect_error);\r\n } \r\n\t\r\n\r\n \r\n $sql = \"SELECT price, make, model, year FROM vehicles_pinefalls where make ='$name' order by price asc limit 1\";\r\n $result = $conn->query($sql);\r\n\r\n $info=mysqli_fetch_array($result,MYSQLI_ASSOC);\r\n\r\n return $info;\r\n}", "public function getPrice()\n {\n return $this->price;\n }", "public function getPrice()\n {\n return $this->price;\n }", "public function getPrice()\n {\n return $this->price;\n }", "public function getPrice()\n {\n return $this->price;\n }", "public function getPrice()\n {\n return $this->price;\n }", "public function getPrice()\n {\n return $this->price;\n }", "public function getPrice()\n {\n return $this->price;\n }", "public function getPrice()\n {\n return $this->price;\n }", "public function getPrice()\n {\n return $this->price;\n }", "public function getPrice()\n {\n return $this->price;\n }", "public function getPrice()\n {\n return $this->price;\n }", "public function getPrice()\n {\n return $this->price;\n }", "public function getPrice()\n {\n return $this->price;\n }", "public function getPrice()\n {\n return $this->price;\n }", "public function getPrice()\n {\n return $this->price;\n }", "public function getPrice()\n {\n return $this->price;\n }", "public function getPrice()\n {\n return $this->price;\n }", "public function retrieve($item);", "function getLitecoinPrice()\r\n{\r\n\t // Fetch the current rate from MtGox\r\n\t$ch = curl_init('https://mtgox.com/api/0/data/ticker.php');\r\n\tcurl_setopt($ch, CURLOPT_REFERER, 'Mozilla/5.0 (compatible; MtGox PHP client; '.php_uname('s').'; PHP/'.phpversion().')');\r\n\tcurl_setopt($ch, CURLOPT_USERAGENT, \"CakeScript/0.1\");\r\n\tcurl_setopt($ch, CURLOPT_HEADER, 0);\r\n\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\r\n\tcurl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);\r\n\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);\r\n\t$mtgoxjson = curl_exec($ch);\r\n\tcurl_close($ch);\r\n\r\n\t// Decode from an object to array\r\n\t$output_mtgox = json_decode($mtgoxjson);\r\n\t$output_mtgox_1 = get_object_vars($output_mtgox);\r\n\t$mtgox_array = get_object_vars($output_mtgox_1['ticker']);\r\n\r\n\techo '\r\n\t\t\t<ul>\r\n\t\t\t<li><strong>Last:</strong>&nbsp;&nbsp;', $mtgox_array['last'], '</li>\r\n\t\t\t<li><strong>High:</strong>&nbsp;', $mtgox_array['high'], '</li>\r\n\t\t\t<li><strong>Low:</strong>&nbsp;&nbsp;', $mtgox_array['low'], '</li>\r\n\t\t\t<li><strong>Avg:</strong>&nbsp;&nbsp;&nbsp;', $mtgox_array['avg'], '</li>\r\n\t\t\t<li><strong>Vol:</strong>&nbsp;&nbsp;&nbsp;&nbsp;', $mtgox_array['vol'], '</li>\r\n\t\t\t</ul>';\r\n}", "function getPrice($ms3Oid, $forQty = 1, $qty = 1, $variant = null) {\n\t\t$markt = $this->market;\n\t\t$userperm = $this->getUserRights();\n\n\t\t// Custom price\n\t\t$price = $this->custom->getPrice($ms3Oid, $forQty, $qty, $markt, $userperm, $variant);\n\t\tif ($price !== null) {\n\t\t\treturn $price;\n\t\t}\n\n\t\t// Simple price\n\t\t$pid = $this->getProdIdForMs3Oid($ms3Oid);\n\t\t$fid = $this->dbutils->getFeatureIdByName($this->conf['product_price_feature_name']);\n\t\tif ($fid != 0) {\n\t\t\t$price = $this->dbutils->getProductValue($pid, $fid, \"NUMBER\");\n\t\t\t$price = doubleval($price);\n\t\t\tif ($price !== null && $price !== '') {\n\t\t\t\treturn $price;\n\t\t\t}\n\t\t}\n\n\t\t// Do normal price finding\n\t\tif ($markt) {\n\t\t\t$markt = \"= '\" . $markt . \"'\";\n\t\t} else {\n\t\t\t$markt = 'IS NULL';\n\t\t}\n\t\tif ($userperm) {\n\t\t\tforeach ($userperm as $perm) {\n\t\t\t\t$usersql .= \"'\" . $perm . \"', \";\n\t\t\t}\n\t\t\t$usersql = substr($usersql, 0, -2);\n\t\t\t$rs = $this->db->exec_SELECTquery(\"Price\", \"ShopPrices\", \"ProductAsimOID = '\" . $ms3Oid . \"' AND Market \" . $markt . \" AND User in (\" . $usersql . \") AND StartQty <= \" . $forQty, '' .\n\t\t\t\t\t\"StartQty DESC\", \"1\");\n\t\t}\n\t\tif ($rs) {\n\t\t\t$row = $this->db->sql_fetch_row($rs);\n\t\t\tif (!$row) {\n\t\t\t\t$rs = $this->db->exec_SELECTquery(\"Price\", \"ShopPrices\", \"ProductAsimOID = '\" . $ms3Oid . \"' AND Market \" . $markt . \" AND User IS NULL AND StartQty <= \" . $forQty, '', \"StartQty DESC\", \"1\");\n\t\t\t\tif ($rs) {\n\t\t\t\t\t$row = $this->db->sql_fetch_row($rs);\n\t\t\t\t}\n\t\t\t}\n\t\t\t$this->db->sql_free_result($rs);\n\t\t\t$price = $row[0];\n\t\t}\n\t\treturn $price * $qty;\n\t}", "public function queryGetPriceAndOldPrice($content){\n $vector = array();\n $dom = new DOMDocument();\n $dom->loadHTML(\"$content\");\n $xpath = new DOMXPath($dom);\n $atributoValue = \"tiempo-entrega-div\";\n $tag = \"div\";\n $consulta = \"//\".$tag.\"[@class='\".$atributoValue.\"']\";\n $objeto = $xpath->query($consulta);\n if ($objeto->length > 0){\n foreach($objeto as $tiempoEntrega){\n $itemType = $tiempoEntrega->nextSibling->nextSibling;\n $res = $itemType->getElementsByTagName(\"div\");\n if ($res->length > 0){\n foreach($res as $div){\n if ($div->hasAttribute(\"class\") && $div->getAttribute(\"class\") == \"price-box\"){\n $plist = $div->getElementsByTagName(\"p\");\n $contador = 0;\n if ($plist->length > 0){\n foreach($plist as $p){\n if ($p->hasAttribute(\"class\") && $p->getAttribute(\"class\") == \"old-price\"){\n $oldPrecio = $p->nodeValue;\n $oldPrecio = rtrim(ltrim($oldPrecio));\n //echo \"Precio antiguo: \".$oldPrecio.\"<br>\";\n $vector[\"Wholesale price\"] = $oldPrecio;\n }else if ($p->hasAttribute(\"class\") && $p->getAttribute(\"class\") == \"special-price\"){\n $precio = $p->nodeValue;\n //echo \"Precio: \".$precio.\"<br>\";\n $precio = rtrim(ltrim($precio));\n $vector[\"Price\"] = $precio;\n }\n $contador++;\n }\n }\n }\n }\n }\n }\n }\n return $vector;\n }", "public function getSonyPrice($url) {\n try {\n $price = null;\n\n if ($this->isBlocked($url)) {\n echo \"<div style='color: red'>URL no disponible</div><br>\";\n } else {\n $crawler = $this->client->request('GET', $url);\n\n // Precio actual\n $elements = $crawler->filter('.skuBestPrice')->each(function ($node) {\n return $node->text();\n });\n\n if (count($elements) < 1) {\n // Precio regular\n $elements = $crawler->filter('.skuListPrice')->each(function ($node) {\n return $node->text();\n });\n }\n\n $price = (isset($elements[0])) ? $this->cleanPrice($elements[0]) : null;\n }\n\n return $price;\n } catch (Exception $ex) {\n echo \"<br><div style='color: red;'>\" . $ex->getMessage() . \" \" . $ex->getLine() . \" \" . $ex->getFile() . \"</div><br>\";\n }\n }", "public function getSearsPrice($url) {\n try {\n $price = null;\n\n if ($this->isBlocked($url)) {\n echo \"<div style='color: red'>URL no disponible</div><br>\";\n } else {\n $crawler = $this->client->request('GET', $url);\n\n // Precio actual\n $elements = $crawler->filter('.precio')->each(function ($node) {\n return $node->text();\n });\n\n if (count($elements) < 1) {\n // Precio regular\n $elements = $crawler->filter('.precio_secundario')->each(function ($node) {\n return $node->text();\n });\n }\n\n $price = (isset($elements[0])) ? $this->cleanPrice($elements[0]) : null;\n }\n\n return $price;\n } catch (Exception $ex) {\n echo \"<br><div style='color: red;'>\" . $ex->getMessage() . \" \" . $ex->getLine() . \" \" . $ex->getFile() . \"</div><br>\";\n }\n }", "function get_price($pid){\n\t$products = \"scart_products\"; // products table\n\t$serial = \"bookid\"; // products key\n\t$result=mysql_query(\"select price from $products where $serial=$pid\")\n or die (\"Query '$products' and '$pid' failed with error message: \\\"\" . mysql_error () . '\"');\n\t$row=mysql_fetch_array($result);\n\treturn $row['price']; // products price\n}", "public function selsplpriceAction() \n\t{\n\t\t$post_add_data = $this->getRequest()->getParams();\n\t\t$special_price_id = $post_add_data['id'];\n\t\t$product_id = $post_add_data['product_id'];\n\t\t$data = Mage::getModel('specialprice/specialpricedate')->get_sel_special_price_data($special_price_id);\t\t\n\t\t$data['special_price_from_date'] = date('d-m-Y', strtotime($data['special_price_from_date']));\n\t\t$data['special_price_to_date'] \t = date('d-m-Y', strtotime($data['special_price_to_date']));\t\t\n\t\t$data['special_price'] \t \t\t = substr($data['special_price'], 0, -2);\n\t\t\n\t\t$_data = array('data' => $data,'success' => 200 );\n\t\t$this->getResponse()->setBody(json_encode($_data));\n\t}", "function calculatePrice( &$item ) {\r\n\t\r\n\tglobal $db, $site;\r\n\t\r\n\t$resultPrice = $basePrice = $item['price'];\r\n\t\r\n\t$pricing = $db->getAll( 'select * from '. ATTRPRICING_TABLE.\" where product_id='$item[id]' and site_key='$site'\" );\r\n\t\r\n\tforeach ( $pricing as $pidx=>$price ) {\r\n\t\t\r\n\t\t$match = true;\r\n\t\t\r\n\t\tif ( $item['attributes'] )\r\n\t\tforeach( $item['attributes'] as $attr_id=>$attr ) {\r\n\t\t\t\r\n\t\t\t$values = $db->getRow( 'select value1, value2 from '. ATTRPRICEVALUES_TABLE.\" where price_id='$price[id]' and attr_id='$attr_id'\" );\r\n\t\t\t\r\n\t\t\tif ( !$values )\r\n\t\t\t\tcontinue;\r\n\t\t\t\t\r\n\t\t\t$value1 = $values['value1'];\r\n\t\t\t$value2 = $values['value2'];\r\n\t\t\t$value = $attr['value'];\r\n\t\t\r\n\t\t\tswitch( $attr['type'] ) {\r\n\t\t\t\tcase 'number':\r\n/*\t\t\t\t\tif ( strlen( $value1 ) )\r\n\t\t\t\t\t\t$match &= $value >= $value1;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\tif ( strlen( $value2 ) )\r\n\t\t\t\t\t\t$match &= $value <= $value2;\r\n\t\t\t\t\tbreak;\r\n*/\t\t\t\t\t\r\n\t\t\t\tcase 'single-text':\r\n\t\t\t\tcase 'multi-text':\r\n\t\t\t\tcase 'date':\r\n\t\t\t\tdefault:\r\n\t\t\t\t\t$match &= $value == $value1;\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tif ( $match ) {\r\n\t\t\t$resultPrice = getPriceValue( $price, $basePrice );\r\n\t\t}\r\n\t}\r\n\t\r\n\treturn $resultPrice;\r\n\t\r\n}", "public function getPriceInfo()\n {\n return $this->price_info;\n }", "public function getCostcoPrice($url) {\n try {\n $price = null;\n\n if ($this->isBlocked($url)) {\n echo \"<div style='color: red'>URL no disponible</div><br>\";\n } else {\n $crawler = $this->client->request('GET', $url);\n\n // Precio actual\n $elements = $crawler->filter('.productdetail_inclprice')->each(function ($node) {\n return $node->text();\n });\n\n if (count($elements) < 1) {\n // Precio regular\n $elements = $crawler->filter('.productdetail_exclprice')->each(function ($node) {\n return $node->text();\n });\n }\n\n $price = $this->specialCostcoPrice($elements[0]);\n }\n\n return $price;\n } catch (Exception $ex) {\n echo \"<br><div style='color: red;'>\" . $ex->getMessage() . \" \" . $ex->getLine() . \" \" . $ex->getFile() . \"</div><br>\";\n }\n }", "public function getPrice()\n\t{\n\t\treturn $this->price;\n\t}", "public function getSorianaPrice($url) {\n try {\n $price = null;\n\n if ($this->isBlocked($url)) {\n echo \"<div style='color: red'>URL no disponible</div><br>\";\n } else {\n $crawler = $this->client->request('GET', $url);\n\n // Precio actual\n $elements = $crawler->filter('.sale-price')->each(function ($node) {\n return $node->text();\n });\n\n if (count($elements) < 1) {\n // Precio regular\n $elements = $crawler->filter('.original-price')->each(function ($node) {\n return $node->text();\n });\n }\n\n if (count($elements) < 1) {\n // Precio regular\n $elements = $crawler->filter('.big-price')->each(function ($node) {\n return $node->text();\n });\n }\n\n $price = (isset($elements[0])) ? $this->cleanPrice($elements[0]) : null;\n }\n\n return $price;\n } catch (Exception $ex) {\n echo \"<br><div style='color: red;'>\" . $ex->getMessage() . \" \" . $ex->getLine() . \" \" . $ex->getFile() . \"</div><br>\";\n }\n }", "public function item_setprice($item)\n {\n if ($item['product_type'] != 2 || $item['product_payment'] != 'prepay') return;\n\n $db = db(config('db'));\n\n if ($_POST)\n {\n $db -> beginTrans();\n\n switch ($item['objtype'])\n {\n case 'room':\n $data = $this -> _format_room_price($item);\n\n // close old price\n $where = \"`supply`='EBK' AND `supplyid`=:sup AND `payment`=3 AND `hotel`=:hotel AND `room`=:room AND `date`>=:start AND `date`<=:end\";\n $condition = array(':sup'=>$item['pid'], ':hotel'=>$item['objpid'], ':room'=>$item['id'], ':start'=>$_POST['start'], ':end'=>$_POST['end']);\n $rs = $db -> prepare(\"UPDATE `ptc_hotel_price_date` SET `close`=1, `price`=0 WHERE {$where}\") -> execute($condition);\n if ($rs === false)\n json_return(null, 6, '保存失败,请重试');\n\n if ($data)\n {\n $data = array_values($data);\n list($column, $sql, $value) = array_values(insert_array($data));\n\n $_columns = update_column(array_keys($data[0]));\n $rs = $db -> prepare(\"INSERT INTO `ptc_hotel_price_date` {$column} VALUES {$sql} ON DUPLICATE KEY UPDATE {$_columns};\") -> execute($value); //var_dump($rs); exit;\n if (false == $rs)\n {\n $db -> rollback();\n json_return(null, 7, '数据保存失败,请重试~');\n }\n }\n break;\n\n case 'auto':\n $data = $this -> _format_auto_price($item);\n\n // close old price\n $where = \"`auto`=:auto AND `date`>=:start AND `date`<=:end\";\n $condition = array(':auto'=>$item['objpid'], ':start'=>$_POST['start'], ':end'=>$_POST['end']);\n $rs = $db -> prepare(\"UPDATE `ptc_auto_price_date` SET `close`=1, `price`=0 WHERE {$where}\") -> execute($condition);\n if ($rs === false)\n json_return(null, 6, '保存失败,请重试');\n\n if ($data)\n {\n $data = array_values($data);\n list($column, $sql, $value) = array_values(insert_array($data));\n\n $_columns = update_column(array_keys($data[0]));\n $rs = $db -> prepare(\"INSERT INTO `ptc_auto_price_date` {$column} VALUES {$sql} ON DUPLICATE KEY UPDATE {$_columns};\") -> execute($value); //var_dump($rs); exit;\n if (false == $rs)\n {\n $db -> rollback();\n json_return(null, 7, '数据保存失败,请重试~');\n }\n }\n break;\n }\n\n if (false === $db -> commit())\n json_return(null, 9, '数据保存失败,请重试~');\n else\n json_return($rs);\n }\n\n $month = !empty($_GET['month']) ? $_GET['month'] : date('Y-m');\n\n $first = strtotime($month.'-1');\n $first_day = date('N', $first);\n\n $start = $first_day == 7 ? $first : $first - $first_day * 86400;\n $end = $start + 41 * 86400;\n\n switch ($item['objtype'])\n {\n case 'room':\n $_date = $db -> prepare(\"SELECT `key`,`date`,`price`,`breakfast`,`allot`,`sold`,`filled`,`standby`,`close` FROM `ptc_hotel_price_date` WHERE `supply`='EBK' AND `supplyid`=:sup AND `hotel`=:hotel AND `room`=:room AND `date`>=:start AND `date`<=:end AND `close`=0\")\n -> execute(array(':sup'=>$item['pid'], ':hotel'=>$item['objpid'], ':room'=>$item['id'], ':start'=>$start, ':end'=>$end));\n break;\n\n case 'auto':\n $_date = $db -> prepare(\"SELECT `key`,`date`,`price`,`child`,`baby`,`allot`,`sold`,`filled`,`close` FROM `ptc_auto_price_date` WHERE `auto`=:auto AND `date`>=:start AND `date`<=:end AND `close`=0\")\n -> execute(array(':auto'=>$item['objpid'], ':start'=>$start, ':end'=>$end));\n break;\n }\n\n $date = array();\n foreach ($_date as $v)\n {\n $date[$v['date']] = $v;\n }\n unset($_date);\n\n include dirname(__FILE__).'/product/price_'.$item['objtype'].'.tpl.php';\n }", "public function getPrice()\n {\n return parent::getPrice();\n }", "function item_get()\n {\n $key = $this->get('id');\n $result = $this->supplies->get($key);\n if ($result != null)\n $this->response($result, 200);\n else\n $this->response(array('error' => 'Supplies item not found!'), 404);\n }", "function get_price($of, $to)\n {\n $price = $this->call_api('/v1/public/' . $of . $to . '/marketsummary');\n return $price->lastTradedPrice;\n }", "public function getOfficeDepotPrice($url) {\n try {\n $price = null;\n\n if ($this->isBlocked($url)) {\n echo \"<div style='color: red'>URL no disponible</div><br>\";\n } else {\n $crawler = $this->client->request('GET', $url);\n\n // Precio actual\n $elements = $crawler->filter('.big-price')->each(function ($node) {\n return $node->text();\n });\n\n if (count($elements) < 1) {\n // Precio regular\n $elements = $crawler->filter('.discountedPrice')->each(function ($node) {\n return $node->text();\n });\n }\n\n if (count($elements) < 1) {\n // Precio regular\n $elements = $crawler->filter('.pricebefore ')->each(function ($node) {\n return $node->text();\n });\n }\n\n $price = (isset($elements[0])) ? $this->cleanPrice($elements[0]) : null;\n }\n\n return $price;\n } catch (Exception $ex) {\n echo \"<br><div style='color: red;'>\" . $ex->getMessage() . \" \" . $ex->getLine() . \" \" . $ex->getFile() . \"</div><br>\";\n }\n }", "function low_price(){\n\tglobal $con;\t\n\t$get_lprice = \"SELECT * FROM items ORDER BY item_pice ASC\";\n\t$run_lprice = mysql_query($get_lprice);\t\n\tshow_item($run_lprice);\n\n}", "public function getElektraPrice($url) {\n try {\n $price = null;\n\n if ($this->isBlocked($url)) {\n echo \"<div style='color: red'>URL no disponible</div><br>\";\n } else {\n $crawler = $this->client->request('GET', $url);\n\n // Precio actual\n $elements = $crawler->filter('.skuBestPrice')->each(function ($node) {\n return $node->text();\n });\n\n if (count($elements) < 1) {\n // Precio regular\n $elements = $crawler->filter('.skuListPrice')->each(function ($node) {\n return $node->text();\n });\n }\n\n $price = (isset($elements[0])) ? $this->cleanPrice($elements[0]) : null;\n }\n\n return $price;\n } catch (Exception $ex) {\n echo \"<br><div style='color: red;'>\" . $ex->getMessage() . \" \" . $ex->getLine() . \" \" . $ex->getFile() . \"</div><br>\";\n }\n }", "public function getPrice() {\n return $this->price;\n}", "public function getsingle($item_id){\n $resource = Mage::getSingleton('core/resource');\n \n /**\n * Retrieve the read connection\n */\n $readConnection = $resource->getConnection('core_read');\n \n $table = $resource->getTableName('core/config_data');\n \n /**\n * Set the product ID\n */\n \n $query = \"SELECT value FROM \" . $table . \" WHERE path='ebay/settings/app_name'\"; \n \n \n /**\n * Execute the query and store the results in $results\n */\n $results = $readConnection->fetchAll($query);\n \n /**\n * Print out the results\n */\n ;\n\n\n $passurl=\"http://open.api.ebay.com/shopping?callname=GetSingleItem&responseencoding=XML&appid=\".$results[0]['value'].\"&siteid=77&version=515&ItemID=\".$item_id.\"&IncludeSelector=Variations,Description,Details,ItemSpecifics,ShippingCosts,QuantitySold,Quantity\";\n \n $responseXml= file_get_contents($passurl);\n \n $responseDoc = new DomDocument();\n $responseDoc->loadXML($responseXml);\n \n \n $des = $responseDoc->getElementsByTagName('Description')->item(0)->nodeValue;\n $soldqty = $responseDoc->getElementsByTagName('QuantitySold')->item(0)->nodeValue;\n $qty = $responseDoc->getElementsByTagName('Quantity')->item(0)->nodeValue;\n \n $itemSpecific = $responseDoc->getElementsByTagName('ItemSpecifics')->item(0);\n $listElements = $itemSpecific->getElementsByTagName('NameValueList');\n $i=0;\n foreach($listElements as $listElement){\n $name=$listElement->getElementsByTagName('Name')->item(0)->nodeValue;\n $value=$listElement->getElementsByTagName('Value')->item(0)->nodeValue;\n $m = Mage::getModel('catalog/resource_eav_attribute')\n ->loadByCode('catalog_product',$name);\n\n if(null===$m->getId()) { $this->createAttribute($name, $name, \"text\", \"simple\"); }\n $name_value_list[$i]=array($name,$value);\n $i++;\n }//for each attribute\n \n $name_value_list=$name_value_list;\n \n /*---------------------------import variation------------------- */\n $option=$option_label=array();\n if($responseDoc->getElementsByTagName('Variation')){\n $variation_list = $responseDoc->getElementsByTagName('Variation');\n }\n $i=0;\n foreach($variation_list as $variation){\n $listElements = $variation->getElementsByTagName('NameValueList');\n $j=0;\n foreach($listElements as $listElement){\n $name=$listElement->getElementsByTagName('Name')->item(0)->nodeValue;\n $value=$listElement->getElementsByTagName('Value')->item(0)->nodeValue;\n $option[$j][$i]=$value; \n $option_label[$j]=$name;\n $j++;\n }\n \n $i++;\n }\n $data_arr1['option']=$option;\n $data_arr1['option_label']= $option_label;\n \n /*--------------------------------end------------------------- */\n \n \n $picture_url= $responseDoc->getElementsByTagName('PictureURL');\n $z=0;\n foreach ($picture_url as $p){\n $p_url[$z]=$p->nodeValue;\n $z++;\n break;\n }\n \n if(empty($p_url)){\n $p_url[0]='http://thumbs.ebaystatic.com/pict/3193577262_3.jpg';\n }\n \n $days = $responseDoc->getElementsByTagName('HandlingTime')->item(0)->nodeValue;\n if(!empty($p_url)){\n $importDir = Mage::getBaseDir('media') . DS . 'import' . DS;\n $i=0;\n foreach($p_url as $p){\n $content=@file_get_contents($p);\n $save = $item_id .$i. '.jpg'; \n $path[$i]=$importDir.''.$save;\n @file_put_contents($path[$i],$content);\n $i++;\n }//each photos\n \n $result['description'] = $des;\n $result['soldqty'] = $soldqty;\n $result['qty'] = $qty;\n $result['path'] = $path;\n $result['name_value_list'] = $name_value_list;\n $result['option'] = $option;\n $result['option_label'] = $option_label;\n \n return $result;\n \n }//if photos \n }", "public function getStock();", "public function getCoppelPrice($url) {\n try {\n $price = null;\n\n if ($this->isBlocked($url)) {\n echo \"<div style='color: red'>URL no disponible</div><br>\";\n } else {\n $crawler = $this->client->request('GET', $url);\n\n // Precio actual\n $elements = $crawler->filter('.pcontado')->each(function ($node) {\n return $node->text();\n });\n\n if (count($elements) < 1) {\n // Precio regular\n $elements = $crawler->filter('.p_oferta')->each(function ($node) {\n return $node->text();\n });\n }\n\n $price = (isset($elements[0])) ? $this->cleanPrice($elements[0]) : null;\n }\n\n return $price;\n } catch (Exception $ex) {\n echo \"<br><div style='color: red;'>\" . $ex->getMessage() . \" \" . $ex->getLine() . \" \" . $ex->getFile() . \"</div><br>\";\n }\n }", "function get_vehicles_by_price() {\n global $db;\n $query = 'SELECT * FROM vehicles\n ORDER BY price DESC';\n $statement = $db->prepare($query);\n $statement->execute();\n $vehicles = $statement->fetchAll();\n $statement->closeCursor();\n return $vehicles;\n }", "public function getTickerPrice($symbol = NULL);", "public function getPriceInformation() {\n $fields = array('priceInformation' => array(\n 'priceHeader' => 'header',\n 'price',\n 'acquisitionTerms',\n ));\n $result = TingOpenformatMethods::parseFields($this->_getDetails(), $fields);\n return $result;\n }", "public function get_price() {\n $query = $this->db->query(\"SELECT * FROM price \");\n\n if ($query) {\n return $query->result_array();\n }\n }", "function ppt_resources_get_usd_stocks($data)\n{\n// return $data;\n if (!isset($data['year'])) {\n return services_error('Year is not defined!', 500);\n }\n\n $year = $data['year'];\n $accounts = [];\n // If there is no uid sent with the api so get the current user id.\n if (isset($data['uid'])) {\n $uid = $data['uid'];\n } else {\n global $user;\n $uid = $user->uid;\n }\n $countries = array();\n if (isset($data['countries'])) {\n $countries = $data['countries'];\n }\n $reps = array();\n if (isset($data['reps'])) {\n $reps = $data['reps'];\n }\n\n $user = user_load($uid);\n\n // Check if user selected accounts.\n if (isset($data['accounts'])) {\n $accounts = $data['accounts'];\n } else {\n $accounts = ppt_resources_get_role_accounts($user, $countries);\n }\n\n $products = [];\n // Check if user selected products.\n if (isset($data['products'])) {\n $products = get_products_dosages($data['products']);\n } else {\n // If the user is rep.\n if (is_rep($user)) {\n $products = get_products_for_current_user($uid);\n } else {\n $products = get_products_for_accounts($accounts);\n }\n }\n//return entity_metadata_wrapper('field_collection_item', 18045);\n $entries = get_entries($accounts, $products, NULL, $reps);\n $entries_records = get_entries_records_for_year($entries, $year, 'consumption_stock_entry');\n $reports = sum_records_per_field($entries_records, 'field_product', TRUE);\n return $reports;\n}" ]
[ "0.6550962", "0.64609826", "0.62417775", "0.62176245", "0.62176245", "0.62176245", "0.62176245", "0.6149448", "0.60590553", "0.5986089", "0.59851027", "0.5950699", "0.5928766", "0.59156924", "0.59156924", "0.58955336", "0.58878803", "0.5870106", "0.5859944", "0.58471614", "0.58389616", "0.5835909", "0.58328444", "0.5816677", "0.58034396", "0.57954127", "0.57954127", "0.5786461", "0.57841015", "0.5778583", "0.5765124", "0.57634056", "0.575388", "0.5747106", "0.5721262", "0.5685726", "0.5682953", "0.5680241", "0.5680241", "0.56762767", "0.56762767", "0.5670931", "0.56660587", "0.56531894", "0.562316", "0.562316", "0.56164277", "0.5615765", "0.5608806", "0.5605368", "0.5596486", "0.55888057", "0.55879956", "0.558709", "0.5583927", "0.5583927", "0.5583927", "0.5583927", "0.5583927", "0.5583927", "0.5583927", "0.5583927", "0.5583927", "0.5583927", "0.5583927", "0.5583927", "0.5583927", "0.5583927", "0.5583927", "0.5583927", "0.5583927", "0.5581492", "0.55809796", "0.5573334", "0.55684304", "0.55678487", "0.5567815", "0.5565329", "0.5563882", "0.55608773", "0.5556808", "0.5549169", "0.55401427", "0.55287904", "0.55171496", "0.5510977", "0.5503534", "0.5501146", "0.5499149", "0.5498456", "0.5492736", "0.5492561", "0.5490649", "0.549055", "0.5490299", "0.5469895", "0.54577464", "0.5448653", "0.54460853", "0.54442453" ]
0.6338504
2
Returns the region ID from the provided station
public function getRegionID(int $station_id): stdClass { $this->db->select('r.eve_idregion as id'); $this->db->from('region r'); $this->db->join('system sys', 'sys.region_eve_idregion = r.eve_idregion'); $this->db->join('station st', 'st.system_eve_idsystem = sys.eve_idsystem'); $this->db->where('st.eve_idstation', $station_id); $query = $this->db->get(); $result = $query->row(); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getId_region()\n {\n if (!isset($this->iid_region) && !$this->bLoaded) {\n $this->DBCarregar();\n }\n return $this->iid_region;\n }", "public function getRegionId()\n {\n return $this->getShippingAddress()->getRegionId();\n }", "public function getStationID(string $station_name)\n {\n if (substr($station_name, 0, 11) === \"TRADE HUB: \") {\n $station_name = substr($station_name, 11);\n }\n\n $this->db->select('eve_idstation');\n $this->db->where('name', $station_name);\n $query = $this->db->get('station');\n\n if ($query->num_rows() != 0) {\n $result = $query->row();\n } else {\n $result = false;\n }\n\n return $result;\n }", "protected function resolveRegion()\n {\n return $this->address->hasData('region') ? 'region' : 'region_id';\n }", "function getRegion()\n {\n if (!isset($this->sregion) && !$this->bLoaded) {\n $this->DBCarregar();\n }\n return $this->sregion;\n }", "function getRegion()\n {\n if (!isset($this->sregion) && !$this->bLoaded) {\n $this->DBCarregar();\n }\n return $this->sregion;\n }", "function getRegion_stgr()\n {\n if (!isset($this->sregion_stgr) && !$this->bLoaded) {\n $this->DBCarregar();\n }\n return $this->sregion_stgr;\n }", "function get_region_id($link, $data) // Colorize: green\n { // Colorize: green\n return get_property_value($link, $data, \"region_id\"); // Colorize: green\n }", "public function getRegion()\n {\n return isset($this->region) ? $this->region : '';\n }", "public function getRegion(): string\n {\n return $this->result->region_name;\n }", "public static function region() {\n\t\treturn static::randomElement(static::$regionNames);\n\t}", "public function getSvrId()\n {\n return $this->get(self::_SVR_ID);\n }", "public static function getRegion()\n\t{\n\t\t$region = self::$region;\n\n\t\t// parse region from endpoint if not specific\n\t\tif (empty($region)) {\n\t\t\tif (preg_match(\"/s3[.-](?:website-|dualstack\\.)?(.+)\\.amazonaws\\.com/i\",self::$endpoint,$match) !== 0 && strtolower($match[1]) !== \"external-1\") {\n\t\t\t\t$region = $match[1];\n\t\t\t}\n\t\t}\n\n\t\treturn empty($region) ? 'us-east-1' : $region;\n\t}", "function getDatosId_region()\n {\n $nom_tabla = $this->getNomTabla();\n $oDatosCampo = new core\\DatosCampo(array('nom_tabla' => $nom_tabla, 'nom_camp' => 'id_region'));\n $oDatosCampo->setEtiqueta(_(\"id_region\"));\n $oDatosCampo->setTipo('ver');\n return $oDatosCampo;\n }", "public function getStateId();", "public function getStateId();", "public function getRegion() {\n\t\treturn $this->region;\n\t}", "public function getMainRegion($regionID) {\n\t if($regionID>0){\n\t foreach ($this->arRegions as $val){\n\t if($regionID==$val[\"GeoRegionId\"]){\n\t if( $val[\"GeoRegionType\"]==\"City\" || $val[\"GeoRegionType\"]==\"Village\" ) return $val[\"GeoRegionId\"];\n\t else {\n\t $cityReg=$this->getCityByRegion($val[\"GeoRegionId\"]);\n\t if($cityReg>0) return $cityReg;\n\t else return $val[\"GeoRegionId\"];\n\t }\n\t }\n\t }\n\t }\n\t else return 0;\n\t}", "public function getRegion()\n {\n return $this->region;\n }", "public function getRegion()\n {\n return $this->region;\n }", "public function getRegion()\n {\n return $this->region;\n }", "public function getRegion()\n {\n return $this->region;\n }", "public function getRegion()\n {\n return $this->region;\n }", "public function getRegion()\n {\n return $this->region;\n }", "function get_segment_id() : string {\n\tif ( defined( 'ALTIS_SEGMENT_ID' ) ) {\n\t\treturn ALTIS_SEGMENT_ID;\n\t}\n\treturn SEGMENT_ID;\n}", "public function getRegionCode()\n {\n return $this->getShippingAddress()->getRegionCode();\n }", "protected function setStationID(){\n\t\t$result = array(\"ss_id\",\"ss_id\");\n\t\treturn $result;\n\t}", "protected function setStationID(){\n\t\t$result = array(\"ss_id\",\"ss_id\");\n\t\treturn $result;\n\t}", "private function whichStation() {\n\t\t$stations = @file(Flight::get(\"pathStation\"),FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);\n\t\tif (count($stations) >=1 && $stations ) {\n\t\t\t$x = '';\n\t\t\tforeach ($stations as $st) {\n\t\t\t\tif (substr($st,0,1) == '1') {\n\t\t\t\t\t$x = substr($st,1);\n\t\t\t\t\t$x = explode(\" #\",$x);\n\t\t\t\t\t$x = $x[0];\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ($x == '') {$x = Flight::get(\"defaultStation\");}\n\t\t}\n\t\telse $x = (Flight::get(\"defaultStation\"));\n\t\treturn trim($x);\n\t}", "function getSTID(){\n return $this->STID;\n }", "protected function srid()\n {\n $this->match(Lexer::T_SRID);\n $this->match(Lexer::T_EQUALS);\n $this->match(Lexer::T_INTEGER);\n\n $srid = $this->lexer->value();\n\n $this->match(Lexer::T_SEMICOLON);\n\n return $srid;\n }", "public function getShardByRegion($region)\n\t{\n\t\tforeach($this->info as $shard) {\n\t\t\tif($shard->slug == $region)\n\t\t\t\treturn $shard;\n\t\t}\n\t\treturn null;\n\t}", "public function getStation()\n {\n return $this->station;\n }", "public function getRegionInstance()\n\t{\n\t\tif (!$this->_regionInstance) {\n\t\t\t$this->_regionInstance = Mage::getSingleton('fvets_salesrep/region');\n\t\t}\n\t\treturn $this->_regionInstance;\n\t}", "public function getRegion() \n {\n return $this->region;\n }", "public function getPinToSiteRegion() {\n return @$this->attributes['pin_to_site_region'];\n }", "function GetPrimaryregion()\n\t{\n\t\t$primaryregion = new primaryRegion();\n\t\treturn $primaryregion->Get($this->primaryregionId);\n\t}", "public function nonceStation() { return $this->_m_nonceStation; }", "public function getCurrentSeasonId()\n {\n $currentSeason = $this->db->query(\"SELECT id, seizoen as season FROM intra_seizoen ORDER BY id DESC LIMIT 1;\")->fetch();\n return $currentSeason[\"id\"];\n }", "public function region()\n\t{\n\t\tif(file_exists(__DIR__.'../../../../../../config/irfa/hari_libur.php') && function_exists('app')){\n\n\t\t\treturn strtoupper(config('irfa.hari_libur.region'));\n\n\t\t} else {\n\n\t\t\trequire(__DIR__.'../../../config/hari_libur.php');\n\n\t\t\treturn strtoupper($conf['region']);\n\t\t}\n\t}", "public function getRegion() : ?string ;", "public function getStudentId() {\n\t\tpreg_match ( '/\\d{9}/', $this->transcript, $ID ); // this will get the SID of the student\n\n\t\tif (count ( $ID ) > 0) {\n\t\t\t\t\n\t\t\t// $key= mt_rand ( MIN_KEY, MAX_KEY ); // will append a random key to the SI\n\t\t\treturn $ID [0]; // . strval($key);\n\t\t} else\n\t\t\treturn null;\n\t}", "function getIsoByState($state)\n{\n\tif (!empty($state) && is_string($state))\n\t{\n\t\t$tbl = _DB_PREFIX_.'state';\n\t\t$q = \"SELECT * from $tbl WHERE iso_code ='$state'\";\n\t\t$q = Db::getInstance()->ExecuteS($q);\n\t\tif (!empty($q))\n\t\t{\n\t\t\t$id = $q[0]['id_state'];\n\t\t\treturn ($id);\n\t\t}\n\t}\n\treturn '';\n}", "public function getRegion(): RegionInterface;", "public function getStateMachineId();", "public function getStation()\n {\n return $this->_station;\n }", "function getID() \n {\n return $this->getValueByFieldName( 'statevar_id' );\n }", "public function getStoneId()\n {\n return $this->get(self::_STONE_ID);\n }", "function getNombre_region()\n {\n if (!isset($this->snombre_region) && !$this->bLoaded) {\n $this->DBCarregar();\n }\n return $this->snombre_region;\n }", "public function getLocationId(): int\n {\n return $this->location->getId();\n }", "public function getStationById($stationId){\n return $this->stationRequest->getStationById($stationId);\n }", "public function getRackspaceRegion() {\n return @$this->attributes['rackspace_region'];\n }", "public function getSeasonId();", "public function getRegion(): ?string\n {\n return $this->_region;\n }", "public function selectStation($station) {\n\t\t$stations = @file(Flight::get(\"pathStation\"),FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);\n\t\tif (count($stations) >=1 && $stations ) {\n\t\t\t$i=0;\n\t\t\t$x = [];\n\t\t\tforeach ($stations as $st) {\n\t\t\t\tif ($station == $i) {$x[] = '1'.substr($st,1);}\n\t\t\t\telse {$x[] = '0'.substr($st,1);}\n\t\t\t\t$i++;\n\t\t\t}\n\t\t\t$str = implode(\"\\n\", $x);\n\t\t\tfile_put_contents(Flight::get(\"pathStation\"), $str);\n\t\t\t// if radio is running, restart it with new station\n\t\t\tif (self::isAudioRunning()) {\n\t\t\t\tself::stopRadio();\n\t\t\t\tself::startRadio();\n\t\t\t}\n\t\t\tFlight::json(array('Status' => 'OK','Station' => $station));\n\t\t}\n\t\telse Flight::json(array('Status' => \"KO\", 'station' => 'Not Found'));\n\t}", "function lookupRegionByCity($city){\n\t$data = M('georegion');\n\tif(strlen($city)>0){\n\t\t$condition = Array('citylist' => Array('like', '%'.$city.'%'));\n\t\tif($region = $data->where($condition)->find()){\n\t\t\treturn $region['id'];\n\t\t}\n\t\telse\n\t\t\treturn '0';\n\t}\n\treturn false;\n}", "function v1_get_id_insarpixel($dd_sar_id, $number) {\n\t\n\t// If parameters are empty\n\tif (empty($dd_sar_id) || empty($number)) {\n\t\treturn NULL;\n\t}\n\t\n\t// Connect to DB\n\tinclude \"php/include/db_connect.php\";\n\t\n\t// Create SQL query\n\t$sql=\"SELECT dd_srd_id FROM dd_srd WHERE dd_sar_id='\".mysql_real_escape_string($dd_sar_id).\"' AND dd_srd_numb='\".mysql_real_escape_string($number).\"'\";\n\t\n\t// Query DB\n\t$result=mysql_query($sql) or die(mysql_error());\n\t\n\t// Get result\n\t$row=mysql_fetch_array($result);\n\t\n\treturn $row['dd_srd_id'];\n\t\n}", "protected function get_station( ) {\n// This function is never called. It is here for completeness of documentation.\n\n if (strlen($this->current_group_text) == 4) {\n $this->wxInfo['STATION'] = $this->current_group_text;\n $this->current_ptr++;\n }\n $this->current_group++;\n }", "public function getLocationid()\n {\n return $this->locationId;\n }", "function getLocationIdOfTile($tile)\n {\n if ($tile['location'] != 'locslot') {\n throw new BgaVisibleSystemException(\"Tile is not on the board. Please report this.\");\n }\n $tile_slot_id = $tile['location_arg'];\n return floor((int)$tile_slot_id / 100); // the invers of ($loc_id * 100 + 1|2|3)\n }", "public function getPriorityRegionId()\n {\n return $this->priorityRegionId;\n }", "public function getIdentifier()\n {\n $configID = $this->get_config() ? $this->get_config()->ID : 1;\n return ucfirst($this->get_mode()) . \"Site\" . $configID;\n }", "protected function getRegion($row, $col)\n {\n\t$region = 0 ;\n\t$sqrt = sqrt($this->size) ;\n\t\n\t// Identify which part of the grid the row belong to\n $row_region = ceil(($row / $this->size) * $sqrt) ;\n\n // Identify which part of the grid the column belongs to\n\t$col_region = ceil(($col / $this->size) * $sqrt) ;\n\n // Identify region number\n $region = (($row_region - 1) * $sqrt) + $col_region ;\n\treturn (int) $region ;\n }", "public function getRegisterId()\n {\n return (isset($this->segments()[3]) ? $this->segments()[3] : null);\n }", "public function region() {\n\t\tif(is_null($this->region))\n\t\t\tthrow new DataAuthenticatorException('Region must be set.');\n\t\treturn $this->region;\n\t}", "public function getLocationId()\n {\n return $this->location_id;\n }", "public function getLocationId()\n {\n return $this->location_id;\n }", "public function getRegion()\n {\n return $this->getShippingAddress()->getRegion();\n }", "public function getSpaceId();", "public function getRegion()\n {\n return $this->hasOne(Regions::class, ['id' => 'region_id']);\n }", "public function getRegion($region) {\n $session = $this->getSession();\n $regionObj = $session->getPage()->find('region', $region);\n if (!$regionObj) {\n throw new \\Exception(sprintf('No region \"%s\" found on the page %s.', $region, $session->getCurrentUrl()));\n }\n return $regionObj;\n }", "public function getServiceDistrictId()\n {\n return $this->service_district_id;\n }", "public function getLocationId()\n {\n return $this->locationId;\n }", "public function getLocationId()\n {\n return $this->locationId;\n }", "public function getRegionName()\n {\n return $this->regionName;\n }", "abstract public function getIdent();", "abstract public function regionISOCode();", "static function set_region($i_state){\n\t\t$south = array(\"TX\",\"OK\",\"AR\",\"LA\",\"MS\");\n\t\t$central = array(\"IA\",\"MN\",\"KS\",\"IL\",\"MO\",\"SD\",\"ND\",\"WI\",\"NE\");\n\t\t$northeast = array();\n\t\t$southeast = array(\"TN\",\"FL\",\"NC\",\"SC\",\"AL\",\"GA\");\n\t\t$west = array(\"CA\",\"NM\",\"AZ\",\"ID\",\"MT\",\"NV\",\"OR\",\"WA\",\"WY\",\"UT\",\"CO\");\n\t\t$region = \"\";\n\t\tif(in_array($i_state, $south))$region = \"S\";\n\t\tif(in_array($i_state, $west))$region = \"W\";\n\t\tif(in_array($i_state, $central))$region = \"C\";\n\t\tif(in_array($i_state, $southeast))$region = \"SE\";\n\t\tif($region == \"\")$region = \"NE\";\n\t\t\n\t\treturn $region;\n\t}", "private function region($region){\n return '&region=' . $region;\n }", "function setId_region($iid_region = '')\n {\n $this->iid_region = $iid_region;\n }", "private function generateId() {\n $count = $this->getRowCount($this->tableName) + 1;\n $id = \"ST\" . str_pad($count, 4, '0', STR_PAD_LEFT);\n return $id;\n }", "public function getDisplaySvrId()\n {\n return $this->get(self::_DISPLAY_SVR_ID);\n }", "public function getReservationId()\n {\n return $this->reservation_id;\n }", "public static function getRegion($region_id)\n {\n $database = DatabaseFactory::getFactory()->getConnection();\n\n $sql = \"SELECT region_id, region_name FROM region WHERE region_id = :region_id LIMIT 1\";\n $query = $database->prepare($sql);\n $query->execute(array(':region_id' => $region_id));\n\n // fetch() is the PDO method that gets a single result\n return $query->fetch();\n }", "public function getSessionRegion()\n {\n return Mage::getSingleton('core/session')->getData($this->_sessionRequestRegionKey);\n }", "function getRegion($region_id,$db_handle){\n $result=$db_handle->runQuery('select region_name from global_region where region_id=\\''.$region_id.'\\'');//returns null if empty resultset\n if (is_null($result)){\n \treturn 'region_name not found.';\n }else{\n \t// var_dump($result[0]);\n \treturn $result[0]['region_name'];\n }\n}", "public function getAllStationsByRegion($region){\n return $this->stationRequest->getAllStationByRegion($region);\n }", "public function getRegion($regionId)\r\n\t{\r\n $regionService = new Base_Model_ObtorLib_App_Core_Catalog_Service_Region();\r\n $regionInfo = $regionService->getRegion($regionId); \r\n return $regionInfo;\r\n\t}", "private function get_student_id($param = '')\r\n\t{\r\n\t\treturn $this->db->get_where('students', array('npm' => $param))->row('student_id');\r\n\t}", "function SECT_ID(){\n\t\tglobal $_CON;\n\t\tif(isset($_GET['this_sect'])){\n\t\t\t$_CLASSID = mysqli_real_escape_string($_CON, $_GET['this_sect']);\n\t\treturn $_CLASSID;\n\t\t}\n\t}", "public function getReservationID()\n {\n return $this->reservationID;\n }", "function getSCID() {\n $svnid = '$Rev$';\n $scid = substr($svnid, 6);\n return intval(substr($scid, 0, strlen($scid) - 2));\n}", "public function getSegmentID()\n {\n return isset($this->SegmentID) ? $this->SegmentID : null;\n }", "public function getStoreId(){\r\n\t\t$this->store_id = getValue(\"SELECT store_id FROM tbl_car_to_store WHERE car_id = \".$this->car_id.\" AND store_id!=0\");\r\n\t\treturn $this->store_id;\t\r\n\t}", "public function getNearestStation() {\n return $this->get(self::NEAREST_STATION);\n }", "public function getClubstaticId($segment, $query)\n\t{\n\t\tif ($this->noIDs)\n\t\t{\n\t\t\treturn (int) array_search($segment, $this->clubs);\n\t\t}\n\t\t\n\t\treturn (int) $segment;\n\t}", "public function getRegionCode() : ?string\n {\n return $this->regionCode;\n }", "public function getStationByName($stationName){\n return $this->stationRequest->getStationByName($stationName);\n }", "private function _getCurrentStoreId()\n {\n $storeName = Mage::app()->getRequest()->getParam('store');\n\n if (!$storeName) {\n $website = Mage::app()->getRequest()->getParam('website');\n return $this->_getHelper()->getStoreIdByWebsite($website);\n }\n return $this->_getHelper()->getStoreIdByStoreCode($storeName);\n }", "public function getStoreId(){\n return $this->_getData(self::STORE_ID);\n }" ]
[ "0.6629912", "0.64900887", "0.61547905", "0.6060793", "0.59956", "0.59956", "0.585744", "0.5765551", "0.57334065", "0.5697013", "0.5693873", "0.56701523", "0.56606203", "0.56243885", "0.54742205", "0.54742205", "0.54712766", "0.5457892", "0.5449097", "0.5449097", "0.5449097", "0.5449097", "0.5449097", "0.5449097", "0.5442081", "0.54241973", "0.54184556", "0.54184556", "0.5400797", "0.53739417", "0.53700596", "0.536263", "0.5356742", "0.53385216", "0.5337215", "0.53094536", "0.5290965", "0.5286831", "0.5272416", "0.5268082", "0.5264374", "0.5247044", "0.5242644", "0.5232296", "0.52293396", "0.52254105", "0.52204216", "0.5208187", "0.5203455", "0.519781", "0.5195395", "0.51544875", "0.51542073", "0.5142148", "0.5142147", "0.512071", "0.5119427", "0.5108477", "0.5103117", "0.5101289", "0.5094525", "0.5084775", "0.5079976", "0.50791705", "0.50721425", "0.5070641", "0.5070641", "0.50663054", "0.50542414", "0.50478953", "0.503398", "0.50308514", "0.5024352", "0.5024352", "0.5023742", "0.50232977", "0.5022065", "0.5018708", "0.5009303", "0.50058293", "0.50009227", "0.49953806", "0.49934584", "0.49907997", "0.49869606", "0.4983306", "0.4973512", "0.4969776", "0.49687928", "0.49664205", "0.4964701", "0.49596006", "0.49530736", "0.4948458", "0.49445033", "0.4938222", "0.49317008", "0.49294296", "0.4919985", "0.49177444" ]
0.74810696
0
Gets the stock list name from an id
private function getStockListName(int $stocklist): stdClass { $this->db->select('name'); $this->db->where('iditemlist', $stocklist); $query = $this->db->get('itemlist'); $result = $query->row(); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getItemNameByStockId($id,$d = 1){\n\t\t$sql = \"SELECT * FROM `item` WHERE `id` = $id\";\n\t \t$result = $this->conn->query($sql);\n\t \twhile($row = mysqli_fetch_assoc($result)){\n\t\t\t\n\t\t\t$sqlItemType = \"SELECT * FROM `item_type` WHERE `id` = \".$row['itemTypeId'].\"\";\n\t\t\t$resultItemType = $this->conn->query($sqlItemType);\n\t\t\t$rowItn = mysqli_fetch_assoc($resultItemType);\n\t\t $name =$rowItn['name'].\"-\".$row['name'];\n\t \t}\n\t\tif($d == 0){\n\t\t\treturn($name);\n\t\t}else{\n\t\t\techo($name);\n\t\t}\n\t\t\n\t}", "function getNameFromId($id='') {\n\t\tif(!$id) return '';\n\t\t$result = $this->select('name',\"`store_id` = '\".$this->store_id.\"' AND id = '$id'\");\n\t\tif($result) return $result[0]['name'];\n\t\treturn '';\n\t}", "function getNameForId($id, $dbh=null) {\r\n if (is_null($dbh)) $dbh = connect_to_database();\r\n $sql = \"SELECT name FROM stock WHERE id = ($id)\";\r\n $sth = make_query($dbh, $sql);\r\n $results = get_all_rows($sth);\r\n if ($results) {\r\n return $results[0]['name'];\r\n }\r\n}", "static function get_name($id) {\r\n\t\t\tif (trim($id)=='') {\r\n\t\t\t\treturn '';\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t$all = self::get_all();\r\n\t\t\treturn $all[$id][0];\r\n\t\t}", "static function getNameOf ($id)\n {\n return get (self::$NAMES, $id, false);\n }", "function getProductNameFromId($dbc, $id)\n{\n\t$id = cleanString($dbc, $id);\n\t\n\t$q = \"SELECT NAME FROM PRODUCTS WHERE ID = '$id'\";\n\t$r = mysqli_query($dbc, $q);\n\t\n\tif(mysqli_num_rows($r) == 1)\n\t{\n\t\tlist($productName) = mysqli_fetch_array($r);\n\t\treturn $productName;\n\t}else{\n\t\treturn false;\n\t}\n}", "public function getPlaylistName($id) {\n\t\t$conn\t\t= $this->connect();\n\t\t$collection\t= $conn->snapstate->playlists;\n\t\t$query\t\t= array('_id' => new \\MongoID($id));\n\t\t$cursor\t\t= $collection->find($query);\n\t\t$resultArray= array();\n\t\twhile($cursor->hasNext())\n\t\t{\n\t\t\t$resultArray\t= $cursor->getNext();\n\t\t}\n\t\treturn $resultArray;\n\t}", "public function listProductname($id){\n try{\n $sql = \"select id_product, product_name from product where id_product = ?\";\n $stm = $this->pdo->prepare($sql);\n $stm->execute([$id]);\n\n $result = $stm->fetch();\n } catch (Exception $e){\n $this->log->insert($e->getMessage(), 'Inventory|listProduct');\n $result = 2;\n }\n return $result;\n }", "public function getListeName()\n\t{\n\t\treturn substr($this->getLogicalId(), strpos($this->getLogicalId(),\"_\")+2, 1).\" - \".parent::getName();\n\t}", "public function getPlaylistName($playlistID);", "function basel_compare_get_field_name_by_id( $id ) {\n\t\t$fields = array(\n\t\t\t'description' => esc_html__( 'Description', 'basel' ),\n\t\t\t'sku' => esc_html__( 'Sku', 'basel' ),\n\t\t\t'availability' => esc_html__( 'Availability', 'basel' ),\n\t\t\t'weight' => esc_html__( 'Weight', 'basel' ),\n\t\t\t'dimensions' => esc_html__( 'Dimensions', 'basel' ),\n\t\t);\n\n\t\treturn isset( $fields[ $id ] ) ? $fields[ $id ] : '';\n\t}", "public static function getName($id)\n {\n $n = DB::Aowow()->selectRow('\n SELECT\n t.name,\n l.*\n FROM\n item_template t,\n locales_item l\n WHERE\n t.entry = ?d AND\n t.entry = l.entry',\n $id\n );\n return Util::localizedString($n, 'name');\n }", "function get_service_name($id){\n $answer=$GLOBALS['connect']->query(\"SELECT name FROM SERVICES WHERE id='$id'\");\n $data=$answer->fetch();\n return $data[\"name\"];\n }", "public static function getStopName($id){\n return self::getStop($id)->data->attributes->name;\n }", "public function tag_name($id)\n\t{\n\t\treturn $this->connection()->get(\"element/$id/name\");\n\t}", "public function getname($name_id, $apikey)\n { \n \n // $result = $this->mysqli->query(\"SELECT name FROM tbl_logger_multigr WHERE `name_id`='$name_id' AND `apikey`='$apikey'\");\n $result = $this->mysqli->query(\"SELECT name FROM tbl_logger_multigr WHERE `name_id`='$name_id' \");\n if ($result->num_rows != 1) { err_sql($_SERVER['PHP_SELF'],$this->mysqli->error,'No multigraph name with this name_id:'.$name_id); }\n \n $result = $result->fetch_array();\n return $result['name'];\n }", "static function getName($id) {\n $campaign = self::get($id);\n if (count($campaign)>0) return $campaign['name'];\n return '';\n }", "function entityName( $id ) ;", "public static function getName($id)\n\t{\n\t\treturn FrontendModel::getDB()->getVar('SELECT tag FROM tags WHERE id = ?;', (int) $id);\n\t}", "public function showStock($id)\n\t{\n\t\treturn $this->stock->where('id',$id)->first();\n\t}", "public function getName($id)\n\t{\n\t\t// iterate over the data until we find the one we want\n\t\tforeach ($this->data as $record)\n\t\t\tif ($record['code'] == $id)\n\t\t\t\treturn $record['name'];\n\t\treturn null;\n\t}", "private function getStopReadableName($stop_id): string\n {\n $url = 'https://api-v3.mbta.com/stops/' . $stop_id;\n\n $client = \\Drupal::httpClient();\n $request = $client->get($url)->getBody()->getContents();\n $name = json_decode($request, true)['data']['attributes']['description'];\n return $name;\n }", "function rawpheno_function_getstockid($stock_name, $project_name) {\n // Calling all modules implementing hook_rawpheno_AGILE_stock_name_alter():\n drupal_alter('rawpheno_AGILE_stock_name', $stock_name, $project_name);\n\n // Limit the search to project organism.\n $result = chado_query(\n \"SELECT stock_id FROM {stock} WHERE name = :name LIMIT 1\",\n array(':name' => $stock_name)\n );\n\n return ($result) ? $result->fetchField() : 0;\n}", "public function get_name( $id ){\n\t\t\n\t\t$term = get_term( $id , $this->get_slug() );\n\t\t\n\t\tif ( $term ){\n\t\t\t\n\t\t\treturn $term->name;\n\t\t\t\n\t\t} else {\n\t\t\t\n\t\t\treturn '';\n\t\t\t\n\t\t} // end if\n\t\t\n\t}", "function list_get($id) {\n\n //$id = $this->get('id');\n\n if (!$id) {\n\n $this->response(\"No item ID specified!\", 400);\n\n exit;\n }\n\n $list = $this->List_model->getListById($id);\n\n if ($list) {\n\n //$list = $this->appendItems($list);\n //Put owner's name instead of user ID\n //$list['owner'] = $this->User_model->getName($list['owner'])['name'];\n unset($list['owner']);\n\n $this->response($list, 200);\n\n exit;\n } else {\n\n $this->response(\"Invalid ID\", 404);\n\n exit;\n }\n }", "function Product_lookup_name_by_id($product_id) {\n\t// Create call\n\t$call = new xmlrpcmsg('Product.lookup_name_by_id', array(new xmlrpcval($product_id, \"int\")));\n\n\t// Do call and return value\n\treturn do_call($call);\n}", "function ArchiveName($id) {\n\t\trequire './db.hndlr.php';\n\n\t\t$stmnt = 'SELECT zipname FROM archive WHERE archv_id = ? ;';\n\t\t$query = $db->prepare($stmnt);\n\t\t$param = [$id];\n\t\t$query->execute($param);\n\t\t$count = $query->rowCount();\n\t\tif ($count > 0) {\n\t\t\tforeach ($query as $data) {\n\t\t\t\treturn $data['zipname'];\n\t\t\t}\n\t\t}\n\t}", "public static function getSybTypeName($id){\n $arr = [\n self::TYPE_HOTEL => 'Готель',\n self::TYPE_APARTMENT => 'Апартаменти',\n ];\n\n return $arr[$id];\n }", "function getSupplierById($id){\n\t$suppierarr = getRowAsArray(\"SELECT suppliername FROM suppliers WHERE id='\".$id.\"' \");\n\t\n\treturn $suppierarr['suppliername'];\n}", "public function getId(): string\n {\n return $this->name;\n }", "function get_clinic_name($id = null)\n {\n if (empty($id)) {\n $id = Cookie::get('clinic') || 1;\n }\n return Clinics::findOrNew($id)->name;\n }", "public function getName()\n {\n return $this->id;\n }", "function tep_get_manufacturers_name($id) {\n $mquery = tep_db_query(\"select manufacturers_name from manufacturers where manufacturers_id = '\".$id.\"'\");\n $mresult = tep_db_fetch_array($mquery);\n\n return $mresult['manufacturers_name'];\n}", "public function name()\n\t{\n\t\treturn $this->lang->words['stock'];\n\t}", "public function getItemName();", "public function findNameProd($id){\n return Product::where('id',$id)->first()->name;\n }", "static function getFishName($reader_id){\n return GoFishFishes::model()->findByAttributes(array('reader' => $reader_id))->name;\n }", "function getIdForName($name, $dbh=null) {\r\n if (is_null($dbh)) $dbh = connect_to_database();\r\n $sql = \"SELECT id FROM stock WHERE LOWER(name) = LOWER('$name')\";\r\n $sth = make_query($dbh, $sql);\r\n $results = get_all_rows($sth);\r\n if ($results) {\r\n return $results[0]['id'];\r\n }\r\n }", "public function getBrandName($id){\n $this->db->select('b_name');\n $this->db->where('id',$id, FALSE);\n $result = $this->db->get('brand');\n return $result->row()->b_name;\n }", "public function genreName($id)\n {\n return Group::find($id)->name;\n }", "private function getModuleNameById($id = 'all')\n\t{\n\t\t$db = Factory::getDBO();\n\t\t$query = $db->getQuery(true);\n\n\t\t$query->select($db->quoteName(array('id','title')));\n\t\t$query->from($db->quoteName('#__modules'));\n\t\t$query->where($db->quoteName('published') . ' = 1');\n\t\t$query->where($db->quoteName('client_id') . ' = 0');\n\n\t\tif ($id !== 'all')\n\t\t{\n\t\t\t$query->where($db->quoteName('id') . ' = ' . (int) $id);\n\t\t}\n\n\t\t$db->setQuery($query);\n\n\t\tif ($id !== 'all')\n\t\t{\n\t\t\treturn $db->loadObject();\n\t\t}\n\n\t\treturn $db->loadObjectList();\n\t}", "public function getItemNamebyPartyId()\n {\n \n if (!empty($_GET['partyIds'])) {\n $purchaseListHtml = '';\n\n $getItemNameData = \n DB::select('SELECT * FROM item_master WHERE is_deleted_status = \"N\" AND party_id = '.$_GET['partyIds'].' ORDER BY name ASC');\n\n if (!empty($getItemNameData)) {\n\n $itemCatListHtmls = '<option value=\"\"> Select Item Name</option>';\n foreach ($getItemNameData as $itemData) {\n $purchaseListHtml .= '<option value=\"'.$itemData->id.'\"';\n $purchaseListHtml .= '>'.$itemData->name.'</option>';\n } \n echo $itemCatListHtmls.$purchaseListHtml; \n \n } else {\n\n echo 0; \n\n }\n\n\n }\n }", "function get_short_name_circuit($id){\n\t/*Pre: - */\t\n\t\tglobal $connection;\n\t\t\n\t\t$query = \"SELECT c.short_name FROM circuit c WHERE c.id_circuit = '$id'\";\n\t\t$result_query = mysql_query($query, $connection) or my_error('GET_SHORT_NAME_CIRCUIT-> '.mysql_errno($connection).\": \".mysql_error($connection), 1);\n\t\t\n\t\treturn extract_row($result_query)->short_name;\t\t\t\n\t}", "protected static function get_internal_status_name_from_id ($id) \n\t{\n\t\t$query = tep_db_query(\"SELECT orders_status_name FROM \". TABLE_ORDERS_STATUS . \" WHERE orders_status_id = \". intval($id));\n\t\t$status = tep_db_fetch_array($query);\n\t\treturn $status['orders_status_name'];\n\t}", "function get_gov_name($id)\n{\n $con = mysqli_connect('localhost','root','','bloodbank');\n mysqli_query($con,'SET CHARACTER SET utf8');\n mysqli_query($con,' DEFAULT COLLATE utf8_general_ci');\n $select_govern_name_with_id = mysqli_fetch_all(mysqli_query($con, \"Select * from governorate where id=\".$id.\" \"), MYSQLI_ASSOC);\n\n return $select_govern_name_with_id[0]['name'];\n}", "function cat_id_to_name($id) {\r\n\tforeach((array)(get_categories()) as $category) {\r\n \tif ($id == $category->cat_ID) { return $category->cat_name; break; }\r\n\t}\r\n}", "public function get_name() {\n\t\treturn 'ih_elementor_list_item';\n\t}", "function buildername($id)\n{\n\t$buildername=mysql_fetch_array(mysql_query(\"select company_name from manage_property_builder where p_bid='$id'\"));\n\treturn $buildername['company_name'];\n\t}", "private function getNames($strId, $strDefaultName = \"\") {\n $strUri = PubChemFinder::REST_DEF_URI . \"cid/\" . $strId . \"/synonyms/\" . IFinder::REST_FORMAT_JSON;\n $mixDecoded = JsonDownloader::getJsonFromUri($strUri);\n if ($mixDecoded === false || !isset($mixDecoded)) {\n return $strDefaultName;\n }\n foreach ($mixDecoded['InformationList']['Information'][0]['Synonym'] as $strSynonym) {\n return $strSynonym;\n }\n return $strDefaultName;\n }", "function getName($id){\n\t\tglobal $connection;\n\n\t\t$sql=\"SELECT * FROM users WHERE id='{$id}'\";\n\t\t$query=mysqli_query($connection, $sql);\n\t\t$name=NULL;\n\n\t\tif(mysqli_num_rows($query)==1){\n\t\t\twhile($row=mysqli_fetch_array($query)){\n\t\t\t\t$name=$row['name'];\n\t\t\t}\n\t\t}\n\t\treturn $name;\n\t}", "function tep_get_products_name($product_id, $language = '') {\n global $languages_id;\n\n if (empty($language)) $language = $languages_id;\n\n $product_query = tep_db_query(\"select products_name from \" . TABLE_PRODUCTS_DESCRIPTION . \" where products_id = '\" . (int)$product_id . \"' and language_id = '\" . (int)$language . \"'\");\n $product = tep_db_fetch_array($product_query);\n\n return $product['products_name'];\n }", "public function get_id_code_name($id)\n {\n if($id==\"\"){\n $slct_qry=\"SELECT course_id,course_code,course_title FROM courses WHERE course_deleted='0'\";\n $exe_qry=mysqli_query($GLOBALS['con'],$slct_qry) or die(mysqli_error($GLOBALS['con']));\n } else {\n $slct_qry=\"SELECT course_id,course_code,course_title FROM courses WHERE course_id = $id AND course_deleted='0'\";\n $exe_qry=mysqli_query($GLOBALS['con'],$slct_qry) or die(mysqli_error($GLOBALS['con']));\n }\n return $exe_qry;\n }", "function tep_get_manufacturers_name($manufacturers_id) {\n\t$manufactures_query = tep_db_query(\"select manufacturers_name from \" . TABLE_MANUFACTURERS . \" where manufacturers_id = '\" . (int)$manufacturers_id . \"'\");\n\t$manufactures = tep_db_fetch_array($manufactures_query);\n\treturn $manufactures['manufacturers_name'];\n}", "function getArtworkArtistName($conn, $id) {\n $query = \"SELECT artwork_artist_name FROM artwork_artist WHERE artwork_artist_id = ${id}\";\n $result = mysqli_query($conn, $query);\n if ($result) {\n $row = mysqli_fetch_assoc($result);\n return $row['artwork_artist_name'];\n } else {\n return 0;\n }\n }", "public static function getBlockName($id)\n\t{\n\t}", "public static function getNameById($id_state)\n {\n }", "public function getIdstock()\r\n {\r\n return $this->idstock;\r\n }", "public function getListId();", "public function getNameproducts($id)\n {\n //? find id\n $product = Product::find($id);\n\n if (is_null($product))\n return '';\n\n return $product->product_name;\n }", "static public function getNameById($id) {\n\t\t$mAction=new Maerdo_Model_Action();\n\t\t$result=$mAction->find($id);\n\t\treturn($result->name);\n\t}", "public static function get_category_name($id){\n $res = DB::select(DB_COLUMN_CATEGORY_NAME)\n ->from(DB_TABLE_CATEGORY)\n ->where(DB_COLUMN_CATEGORY_ID, $id)\n ->and_where(DB_COLUMN_CATEGORY_DELETE_FLAG, 0)\n ->execute();\n $arr = $res->as_array();\n return $arr[0][\"name\"];\n }", "public static function getTripName($id){\n return self::getTrip($id)->data->attributes->name;\n }", "function NameCatalogo($id)\n {\n $role = Catalogo::select('nombres')->where('id',$id)->first();\n return $role->nombres;\n }", "public abstract static function getListID();", "public function getStickerByName($album_id, $ref) {\n $query = \"SELECT\n st.id,\n st.ident,\n st.name,\n st.team_album_id,\n st.url\n FROM \" . $this->__schema . \".sticker st\n WHERE st.name ILIKE '%\" . $ref . \"%'\"\n . \" AND st.album_id = \" . $this->db()->quote($album_id);\n $stickers = $this->db()->getRow($query);\n if ($stickers) {\n return (array)$stickers['id'];\n }\n return NULL;\n }", "public function getPortfolioTypeName($id) {\n\t\t$query = \"SELECT name FROM portfolio_type WHERE id = :id;\";\n\t\t$statement = $this->adapter->createStatement($query);\n\t\t$statement->prepare($query);\n\t\t$result = $statement->execute(array('id' => $id));\n\n\t\t$resultSet = new ResultSet();\n\t\t$resultSet = $resultSet->initialize($result)->toArray();\n\t\tif (count($resultSet) > 0) {\n\t\t\treturn $resultSet[0]['name'];\n\t\t} else {\n\t\t\treturn '';\n\t\t}\n\t}", "private function getComponentName($id)\n {\n if ($id === 0) {\n return '';\n }\n if (array_key_exists($id, $this->componentCache)) {\n return $this->componentCache[$id];\n }\n\n $component = getContents($this->getURI() . '/api/v1/components/' . $id);\n $component = json_decode($component);\n if ($component === null) {\n return '';\n }\n return $component->data->name;\n }", "public static function item($id)\n\t\t\t{\n\t\t\t$models=self::model()->findAll(array(\n\t\t 'condition'=>'object_id=:id',\n\t\t 'params'=>array(':id'=>$id),\n\t\t 'order'=>'object_id ASC',));\n\t\t\t\n\t\t\t$items = t(\"None\");\n\t\t\t\n\t\t\tif(count($models)>0){ \n foreach($models as $model) {\n $items = $model->object_name;\n } \n\t \t} \n\t\t\t\treturn $items;\n\t\t\t}", "function getCategoryName($id){\n\t\t$conn \t= connectDB();\n\t\t$sth \t= $conn -> prepare(\"\tSELECT name\n\t\t\t\t\t\t\t\t\t\tFROM `category`\n\t\t\t\t\t\t\t\t\t\tWHERE `id` = ?\");\n\t\t$sth \t-> execute(array($id));\n\n\t\treturn \t$sth;\n\t}", "public static function get($id) {\n // Set the predefined list that can be mapped\n self::$types = [\n 0 => 'Légkondícionáló',\n 1 => 'WC',\n 2 => 'Napelem',\n 3 => 'Kert',\n ];\n\n return (isset(self::$types[$id])) ? self::$types[$id] : ' - ';\n }", "function getGroupName($id=0) {\n return getOne(\"SELECT group_name FROM `group` WHERE id = ?\",[$id]);\n}", "public function getProductName($id=''){\r\n if($id != ''){\r\n $res = $this->CI->DatabaseModel->access_database('ts_products','select','',array('prod_id'=>$id));\r\n if(!empty($res)) {\r\n $prodd = $res[0]['prod_urlname'] != '' ? $res[0]['prod_urlname'] : $res[0]['prod_name'] ;\r\n $p = strtolower($prodd);\r\n $p = str_replace(' ','-',$p);\r\n $p = preg_replace('!-+!', '-', $p);\r\n return $p.'/';\r\n }\r\n else {\r\n return '/';\r\n }\r\n }\r\n else {\r\n return '/';\r\n }\r\n die();\r\n\t}", "function getLabelFromId($id) {\n return 'field_'.$id;\n }", "public function getDocumentName($id)\n {\n $documentName = Yii::app()->db->createCommand('\n SELECT a.name, a.path,a.typeArchive, a.link\n FROM archives AS a \n INNER JOIN archive_session AS s ON a.idArchive = s.idArchive\n WHERE s.idSession = :idSession')\n ->bindValues(array(':idSession' => $id))\n ->queryAll();\n return $documentName;\n }", "function display_player_name($id) {\n\t\n\tglobal $zurich;\n\t\n\t/* softbot's ids are preceded by * in the log; remove this */\n\tif ($id{0} == '*') {\n\t\t$robot = true;\n\t\t$id = substr($id, 1);\n\t}\n\telse $robot = false;\n\t\n\tswitch($id) {\n\t\tcase 'water_utility': $colour = \"#0000ff\"; break; /* blueberry */\n\t\tcase 'waste_water_utility': $colour = \"#804000\"; break; /* mocha */\n\t\tcase 'housing_assoc_1': $colour = \"#ff6666\"; break; /* salmon */\n\t\tcase 'housing_assoc_2': $colour = \"#800040\"; break; /* maroon */\n\t\tcase 'manufacturer_1': $colour = \"#808000\"; break; /* asparagus */\n\t\tcase 'manufacturer_2': $colour = \"#008040\"; break; /* moss */\n\t\tcase 'politician': $colour = \"#ff8000\"; break; /* tangerine */\n\t\tcase 'bank': $colour = \"#ff66cc\"; break; /* carnation */\n\t\tdefault: $colour = \"#000000\"; break; /* black */\n\t}\n\t\n\t/* translate between id and name for player ids */\n\tforeach ($zurich->players as $p) {\n\t\tif ($id == $p->id) {\n\t\t\t$name = $p->name;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (!isset($name)) $name = $id;\n\tif ($robot) $name = strtolower($name);\n\t\t\n\treturn \"<font color=$colour>$name</font>\";\n}", "public function getNameOfCoursebyId($id)\n {\n $courses = TableRegistry::getTableLocator()->get('Courses');\n $courses = $courses->find('all')->where(['id' => $id]);\n foreach($courses as $course){\n $course = $course->name;\n echo $course;\n }\n }", "function getIngrediente($id){\n\tif($id == 1) return \"Pepperoni\";\n\tif($id == 2) return \"Aceitunas\";\n\tif($id == 3) return \"Carne\";\n}", "public static function getList($id) {\n $list = R::load('list', $id);\n return $list->id ? $list : null;\n }", "function getFeatureName($square_id) {\n\twriteLog(\"getFeatureName(): Square ID: \" . $square_id);\t\n\t\n\treturn getFeatureAttribute($square_id, \"name\");\n\t\t\n}", "public function getPanelNameById($id)\n\t{\n\t\t$data = array();\n\t\t$query = \"select * from six_panel where id=\".$id.' LIMIT 1';\n\t\t$result = $this->dbh->prepare($query);\n\t\t$result->execute();\n\t\t$row = $result->fetch();\n\t\treturn $row['panel_name'];\n\t}", "function get_user_name_by_id($id = 0) {\r\n\r\n\t\t$field = 'name';\r\n\r\n\t\t$users = $this->users_model->get_users_by_id($id, $field);\r\n\r\n\t\t$result = $users['name'];\r\n\r\n\t\treturn $result;\r\n\r\n\t}", "function name_from_id($nfi_table, $nfi_id, $nfi_id_col, $nfi_name_col){\r\n\t\tglobal $conn;\r\n\t\t$sql_quary = \"SELECT * FROM \".$nfi_table.\" WHERE \".$nfi_id_col.\"='\".$nfi_id.\"';\";\r\n\t\t$sql = $conn->prepare($sql_quary);\r\n\t\t$sql->execute();\r\n\t\t\t\r\n\t\t$numRows = $sql->fetchAll();\r\n\t\t\tif(count($numRows)>0){\r\n\t\t\t\tforeach($numRows as $row){\r\n\t\t\t\t\treturn $row[$nfi_name_col];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t}", "function getPackName($id){\r global $bdd;\r $req4=$bdd->prepare(\"select * from packs where idpack=? \");\r $req4->execute(array($val));\r while($ar = $req4->fetch()){return $ar['packname'];}\r return 1;\r}", "public function get_group_name ($id)\n\t\t{\n\t\t\t$sql = \"SELECT name FROM group_list \n\t\t\t\t\tWHERE id =:id\n\t\t\t\t\tAND status = 'enabled'\";\n\t\t\t$check_query = PDO::prepare($sql);\n\t\t\t$check_query->execute(['id'=>$id]);\n\t\t\t// echo print_r($check_query->errorInfo());\n\t\t\treturn $record_array = $check_query->fetch(PDO::FETCH_ASSOC)['name'];\n\t\t}", "public static function find_company_name( $id )\n {\n try{\n\n $company = Company::where( 'id' , $id )->first();\n\n return $company['name'];\n }\n catch ( Exception $e){\n return 'Not Found';\n }\n }", "function nameguild($id_guild){\n return $this->find()\n ->select(['name'])\n ->where(['id' => $id_guild])\n ->toArray();\n }", "function get_menu_name($menu_id)\n\t\t\t {\n\t\t\t \n\t\t\t \t$this->db->select('*');\n\t\t\t\t\t\n\t\t\t\t$this->db->where('id',$menu_id);\n\n\t\t\t\t$query\t=\t\t$this->db->get('oxm_menu');\n\t\t\t\t\n\t\t\t\t$temp=$query->row();\n\t\t\t\t\n\t\t\t\treturn $temp->menu_name;\n\t\t\t\t\n\t\t\t}", "public function getName($id, $tableName, $lan) {\n //pr($lan);\n $nameData='';\n $tableEntity = TableRegistry::get($tableName);\n $data = $tableEntity->find()\n ->select(['id', 'name'])\n ->where(['id' => $id])\n ->first();\n if(!empty($data->name)){\n $dataNm = json_decode($data->name,TRUE);\n }\n if(!empty($dataNm[$lan])){\n \n \n //pr($dataNm);\n $nameData = $dataNm[$lan];\n // pr($nameData);\n }elseif(!empty($dataNm['en_US'])){\n $nameData = $dataNm['en_US'];\n } \n return $nameData;\n }", "function objGetNameFromId($dbh, $id, $get=\"name\")\r\n{\r\n\tglobal $g_obj_cache;\r\n\r\n\tif ($g_obj_cache)\r\n\t{\r\n\t\tif (isset($g_obj_cache[$dbh->dbname][$id][$get]))\r\n\t\t\treturn $g_obj_cache[$dbh->dbname][$id][$get];\r\n\t}\r\n\telse\r\n\t{\r\n\t\tif (!isset($g_obj_cache[$dbh->dbname]))\r\n\t\t\t$g_obj_cache[$dbh->dbname] = array();\r\n\r\n\t\t$result = $dbh->Query(\"select id, name, title from app_object_types order by title\");\r\n\t\t$num = $dbh->GetNumberRows($result);\r\n\t\tfor ($i = 0; $i < $num; $i++)\r\n\t\t{\r\n\t\t\t$row = $dbh->GetRow($result, $i);\r\n\t\t\t$g_obj_cache[$dbh->dbname][$row['id']] = array(\"name\"=>$row['name'], \"title\"=>$row['title'], \"id\"=>$row['id']);\r\n\t\t}\r\n\t\t$dbh->FreeResults($result);\r\n\r\n\t\tif (isset($g_obj_cache[$dbh->dbname][$id][$get]))\r\n\t\t\treturn $g_obj_cache[$dbh->dbname][$id][$get];\r\n\t}\r\n\r\n\treturn \"\";\r\n}", "public static function location_name($id) {\n \n $city = Location::model()->findByPK($id);\n return $city->name;\n }", "function getGameNameById($game_id){\r\n\t\t\t$game=$this->fetchRow('id = '.$game_id)->toArray();\r\n\t\t\treturn $game['name'];\r\n\t\t}", "public function getStockById($id)\n {\n $stock = stock::where('id',$id)\n ->first();\n\n if ($stock) {\n return $this->generalResponse(true,200,'success', null,$stock);\n } else {\n return $this->generalResponse(false,404,'stock not found', null,null);\n }\n }", "function getStoreName($store_id) {\n\t\n\t\taddToDebugLog(\"getStoreName(), Function Entry - supplied parameters: Store ID: \" . $store_id . \", INFO\");\n\t\n\t\t$sql = \"SELECT store_name FROM hackcess.store where store_id = \" . $store_id . \";\";\n\t\t$result = search($sql);\n\t\n\t\treturn $result[0][0];\n\t\n\t}", "public static function getByID ($_id) {\n\t$label_arr = self::getLabel(\"id\",$_id);\n\treturn $label_arr[0];\n }", "function snameList()\r\n{\r\n\t// --------- GLOBALIZE ---------\r\n\tglobal $db;\r\n\t// --------- CONVERT TO INT ---------\r\n\t$id = intval(GET_INC('id'));\r\n\t// --------- GET LIST ---------\r\n\t$db->connDB();\r\n\t$db->query(\"SELECT station FROM bus_circuit WHERE id={$id};\");\r\n\t$res = $db->fetch_array();\r\n\t$res = explode(',',$res['station']);\r\n\t// first write?\r\n\t$fw = true;\r\n\tforeach ( $res as $v )\r\n\t{\r\n\t\tif ( !$fw )\r\n\t\t{\r\n\t\t\techo ';';\r\n\t\t}else{\r\n\t\t\t$fw = false;\r\n\t\t}\r\n\t\techo $v;\r\n\t\techo '&';\r\n\t\t$db->free();\r\n\t\t$db->query(\"SELECT name FROM bus_sname WHERE id={$v} AND is_primary=1;\");\r\n\t\t$r = $db->fetch_array();\r\n\t\techo $r['name'];\r\n\t}\r\n\t$db->closeDB();\r\n}", "public function giveNomeCatEvent($id){\r\n $id = self::$conn->real_escape_string($id);\r\n $query = \"SELECT nome FROM \".$this->tables['categTable'].\r\n \" WHERE id = $id\";\r\n\t\t$result = self::$conn->query($query);\r\n if(!$result || $result->num_rows != 1)\r\n return ''; \r\n $row = $result->fetch_array(MYSQLI_NUM);\r\n return $row[0];\r\n }", "public function getNameMall($language,$id = null)\n { \t \t \t\n \tif($id != null) { \t\t\n \t\t$data = ShopingMall::where(['shop_id'=>$id])->first(['shop_name_'.$language]);\t \n\t return $this->common->env_json($data);\n \t}else{\n\t\t\t\n \t\t$data = ShopingMall::all(['shop_name_'.$language]);\n \t\treturn $this->common->env_json($data);\n \t}\t\t\n }", "function getSongName($conn, $songID) {\n $query = \"SELECT song_name FROM song WHERE song_id = ${songID}\";\n $result = mysqli_query($conn, $query);\n if ($result) {\n return mysqli_fetch_assoc($result)['song_name'];\n } else {\n // error\n return NULL;\n }\n }", "function exibirApiLancamentosNome($id){\n $id = preg_split(\"/[\\s,]+/\", $id);\n\n $data = Buscar::exibirProdutosLancamentosNome($id);\n return $data ->toArray();\n }", "function getName($id, $query) {\n\n\t\tglobal $db, $f;\n\n\t\t$strSQL\t\t= \"SELECT\n\t\t\t\t\tnama \n\t\t\t\t FROM\n\t\t\t\t \ttbl_\".$query.\" \n\t\t\t\t WHERE\n\t\t\t\t \tid = $id\";\n\n\t\t$result = $db->Execute($strSQL);\n\t\tif (!$result) print $db->ErrorMsg();\n\t\t$row \t= $result->FetchRow();\n\n\t\t$nama\t= $row[$f->fmtCase('nama')];\n\n\t\treturn $nama;\n\t}" ]
[ "0.76825345", "0.695547", "0.6925249", "0.69032276", "0.6808097", "0.64262277", "0.6421025", "0.63527554", "0.6321052", "0.6314064", "0.63008636", "0.62511563", "0.61229604", "0.61223763", "0.6080972", "0.60486585", "0.603643", "0.60333353", "0.6031105", "0.6027406", "0.60169196", "0.5994036", "0.59811455", "0.5941966", "0.5917768", "0.58871824", "0.5886481", "0.58518046", "0.58462626", "0.5824153", "0.58185804", "0.5810616", "0.57952654", "0.5789209", "0.5775334", "0.5767609", "0.5724337", "0.5714659", "0.571391", "0.5695357", "0.569397", "0.5686756", "0.56858903", "0.5679556", "0.56787026", "0.56731814", "0.5664506", "0.56617063", "0.5650658", "0.56455266", "0.56451154", "0.5644833", "0.56325155", "0.56247395", "0.56214124", "0.56194866", "0.5619339", "0.56123626", "0.55968904", "0.55934197", "0.5593115", "0.55889755", "0.5583878", "0.55786145", "0.5575518", "0.5575349", "0.5569777", "0.5567943", "0.5554001", "0.5553997", "0.55530924", "0.5550205", "0.55482286", "0.55477387", "0.5538052", "0.5534404", "0.5527341", "0.5523913", "0.5522993", "0.5517857", "0.5515329", "0.55118877", "0.5506785", "0.54980147", "0.5493515", "0.548793", "0.54876566", "0.54872435", "0.54851437", "0.5481145", "0.5480665", "0.5466168", "0.54645437", "0.54643446", "0.5464316", "0.54622936", "0.5453336", "0.54528147", "0.54498106", "0.5431057" ]
0.65905905
5
Returns the character name from an id
private function getCharacterName(int $id_character): string { $this->db->select('name'); $this->db->where('eve_idcharacter', $id_character); $query = $this->db->get('characters'); $result = $query->row()->name; return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static function get_name($id) {\r\n\t\t\tif (trim($id)=='') {\r\n\t\t\t\treturn '';\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t$all = self::get_all();\r\n\t\t\treturn $all[$id][0];\r\n\t\t}", "function getCharacter($id) {\n try {\n $item = $this->perform_query_one_param(\"SELECT name from characters WHERE id = ?\", \"i\", strval($id));\n return mysqli_fetch_array($item);\n } catch(Exception $ex) {\n $this->print_error_message(\"Error in getting Character by ID : \".$id);\n return null;\n }\n }", "static function getNameOf ($id)\n {\n return get (self::$NAMES, $id, false);\n }", "function getCharacter($id) {\n $conn = databaseConn();\n\n $query = $conn->prepare(\"SELECT * FROM characters WHERE id = :id\");\n $query->execute([':id' => $_GET['id']]);\n \n return $query->fetch();\n }", "function getNameFromId($id='') {\n\t\tif(!$id) return '';\n\t\t$result = $this->select('name',\"`store_id` = '\".$this->store_id.\"' AND id = '$id'\");\n\t\tif($result) return $result[0]['name'];\n\t\treturn '';\n\t}", "public static function get_character_by_id($id) {\n\t\t$result = DB::table('characters')\n\t\t\t\t->where('deleted', 0)\n\t\t\t\t->where('id', $id)\n\t\t\t\t->get();\n\n\t\treturn $result[0];\n\t}", "static function getName($id) {\n $campaign = self::get($id);\n if (count($campaign)>0) return $campaign['name'];\n return '';\n }", "function get_user_name_by_id($id = 0) {\r\n\r\n\t\t$field = 'name';\r\n\r\n\t\t$users = $this->users_model->get_users_by_id($id, $field);\r\n\r\n\t\t$result = $users['name'];\r\n\r\n\t\treturn $result;\r\n\r\n\t}", "static public function getNameById($id) {\n\t\t$mAction=new Maerdo_Model_Action();\n\t\t$result=$mAction->find($id);\n\t\treturn($result->name);\n\t}", "function dev_get_title_from_id( $id ) {\n\treturn ucwords( str_replace( array( '-', '_' ), ' ', $id ) );\n}", "function getUsername($id)\n{\n\tglobal $db;\n\n\t$ret = $db->query('select user_name from users where user_id=' . $id);\n\n\tif(count($ret) == 1)\n\t\treturn decode($ret[0]['user_name']);\n\telse\n\t\treturn '';\n}", "function getName($id){\n\t\tglobal $connection;\n\n\t\t$sql=\"SELECT * FROM users WHERE id='{$id}'\";\n\t\t$query=mysqli_query($connection, $sql);\n\t\t$name=NULL;\n\n\t\tif(mysqli_num_rows($query)==1){\n\t\t\twhile($row=mysqli_fetch_array($query)){\n\t\t\t\t$name=$row['name'];\n\t\t\t}\n\t\t}\n\t\treturn $name;\n\t}", "function entityName( $id ) ;", "public function getColorCodeName($id){\n\t\t$sql = \"select name from sy_color_codes where id=?\";\n\t\t$SyColorCode = $this->runRequest($sql, array($id));\n\t\tif ($SyColorCode->rowCount() == 1){\n\t\t\t$tmp = $SyColorCode->fetch();\n\t\t\treturn $tmp[0]; // get the first line of the result\n\t\t}\n\t\telse{\n\t\t\treturn \"\";\t\n\t\t}\n\t}", "public function getName($id)\n\t{\n\t\t// iterate over the data until we find the one we want\n\t\tforeach ($this->data as $record)\n\t\t\tif ($record['code'] == $id)\n\t\t\t\treturn $record['name'];\n\t\treturn null;\n\t}", "public static function getMemberName($id){\n\t\t$db = DemoDB::getConnection();\n $sql = \"SELECT first_name,last_name\n FROM member\n WHERE id = :id\";\n $stmt = $db->prepare($sql);\n $stmt->bindValue(\":id\", $id);\n $ok = $stmt->execute();\n if ($ok) {\n return $stmt->fetch(PDO::FETCH_ASSOC);\n }\n\t}", "public static function get_category_name($id){\n $res = DB::select(DB_COLUMN_CATEGORY_NAME)\n ->from(DB_TABLE_CATEGORY)\n ->where(DB_COLUMN_CATEGORY_ID, $id)\n ->and_where(DB_COLUMN_CATEGORY_DELETE_FLAG, 0)\n ->execute();\n $arr = $res->as_array();\n return $arr[0][\"name\"];\n }", "function cat_id_to_name($id) {\r\n\tforeach((array)(get_categories()) as $category) {\r\n \tif ($id == $category->cat_ID) { return $category->cat_name; break; }\r\n\t}\r\n}", "public function _convertToNameFormat($id)\n\t{\n\t\treturn preg_replace('/\\.([A-Za-z0-9_\\-]+)/', '[$1]', $id);\n\t}", "public function getCustomerName(int $id): string {\n return \"Get customer name by id = {$id}\";\n }", "function display_player_name($id) {\n\t\n\tglobal $zurich;\n\t\n\t/* softbot's ids are preceded by * in the log; remove this */\n\tif ($id{0} == '*') {\n\t\t$robot = true;\n\t\t$id = substr($id, 1);\n\t}\n\telse $robot = false;\n\t\n\tswitch($id) {\n\t\tcase 'water_utility': $colour = \"#0000ff\"; break; /* blueberry */\n\t\tcase 'waste_water_utility': $colour = \"#804000\"; break; /* mocha */\n\t\tcase 'housing_assoc_1': $colour = \"#ff6666\"; break; /* salmon */\n\t\tcase 'housing_assoc_2': $colour = \"#800040\"; break; /* maroon */\n\t\tcase 'manufacturer_1': $colour = \"#808000\"; break; /* asparagus */\n\t\tcase 'manufacturer_2': $colour = \"#008040\"; break; /* moss */\n\t\tcase 'politician': $colour = \"#ff8000\"; break; /* tangerine */\n\t\tcase 'bank': $colour = \"#ff66cc\"; break; /* carnation */\n\t\tdefault: $colour = \"#000000\"; break; /* black */\n\t}\n\t\n\t/* translate between id and name for player ids */\n\tforeach ($zurich->players as $p) {\n\t\tif ($id == $p->id) {\n\t\t\t$name = $p->name;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (!isset($name)) $name = $id;\n\tif ($robot) $name = strtolower($name);\n\t\t\n\treturn \"<font color=$colour>$name</font>\";\n}", "public function get_name( $id ){\n\t\t\n\t\t$term = get_term( $id , $this->get_slug() );\n\t\t\n\t\tif ( $term ){\n\t\t\t\n\t\t\treturn $term->name;\n\t\t\t\n\t\t} else {\n\t\t\t\n\t\t\treturn '';\n\t\t\t\n\t\t} // end if\n\t\t\n\t}", "public function tag_name($id)\n\t{\n\t\treturn $this->connection()->get(\"element/$id/name\");\n\t}", "function getUserName($id){\n\t$crud = new CRUD();\n\t$crud->connect();\n\n\t$crud->sql(\"select * from users where userid='{$id}'\");\n\t$r = $crud->getResult();\n\tforeach($r as $rs){\n\t\treturn $rs['username'].\" \".$rs['usertype'];\n\t}\n\t$crud->disconnect();\n}", "public function getId(): string\n {\n return $this->name;\n }", "public static function getName($id)\n\t{\n\t\treturn FrontendModel::getDB()->getVar('SELECT tag FROM tags WHERE id = ?;', (int) $id);\n\t}", "public static function getName($id)\n {\n $n = DB::Aowow()->selectRow('\n SELECT\n t.name,\n l.*\n FROM\n item_template t,\n locales_item l\n WHERE\n t.entry = ?d AND\n t.entry = l.entry',\n $id\n );\n return Util::localizedString($n, 'name');\n }", "function getChallengeName($challenge_id) {\n $challenges = challenges();\n return $challenges[$challenge_id]['name'];\n}", "function getIdentifier();", "function getIdentifier();", "public function getIdentifier();", "public function getIdentifier();", "public function getIdentifier();", "public function getIdentifier();", "public function getIdentifier();", "public function getIdentifier();", "public function getIdentifier();", "public function getIdentifier();", "public function getIdentifier();", "public static function getSybTypeName($id){\n $arr = [\n self::TYPE_HOTEL => 'Готель',\n self::TYPE_APARTMENT => 'Апартаменти',\n ];\n\n return $arr[$id];\n }", "public function getTeamNameByID($id){\n $sqlQuery = \"SELECT teamName FROM Teams T\n WHERE T.teamID = :teamID\";\n\n $statement = $this->_dbHandle->prepare($sqlQuery);\n $statement->bindValue(\":teamID\", $id, PDO::PARAM_INT);\n $statement->execute();\n $this->_dbInstance->destruct();\n\n $r = '';\n while ($row = $statement->fetch(PDO::FETCH_ASSOC)){\n $r = $row['teamName'];\n }\n\n return $r;\n }", "function get_client_name($id){\n $answer=$GLOBALS['connect']->query(\"SELECT name, firstName FROM USERS WHERE id='$id'\");\n $data=$answer->fetch();\n return $data[\"name\"].\" \".$data[\"firstName\"];\n\n }", "function extension_id2char($a_extensionid)\n\t{\n\t\tswitch($a_extensionid) \n\t\t{\n \t\t\tcase 2063 : return('bik');\n\t\t\t\t\t\t break;\n \t\tcase 2061 : return('ssf');\n\t\t\t\t\t\t break;\n \t\tcase 2060\t: return('utw');\n\t\t\t\t\t\t break;\n \t\tcase 2059\t: return('4pc');\n\t\t\t\t\t\t break;\n \t\tcase 2056\t: return('jrl');\n\t\t\t\t\t\t break;\n \t\tcase 2055\t: return('utg');\n\t\t\t\t\t\t break;\n \t\tcase 2054\t: return('btg');\n\t\t\t\t\t\t break;\n \t\tcase 2053\t: return('pwk');\n\t\t\t\t\t\t break;\n \t\tcase 2052\t: return('dwk');\n\t\t\t\t\t\t break;\n \t\tcase 2051\t: return('utm');\n\t\t\t\t\t\t break;\n \t\tcase 2050\t: return('btm');\n\t\t\t\t\t\t break;\n \t\tcase 2049\t: return('ccs');\n\t\t\t\t\t\t break;\n \t\tcase 2048\t: return('css');\n\t\t\t\t\t\t break;\n \t\tcase 2047\t: return('gui');\n\t\t\t\t\t\t break;\n \t\tcase 2046\t: return('gic');\n\t\t\t\t\t\t break;\n \t\tcase 2045\t: return('dft');\n\t\t\t\t\t\t break;\n \t\tcase 2044\t: return('utp');\n\t\t\t\t\t\t break;\n \t\tcase 2043\t: return('btp');\n\t\t\t\t\t\t break;\n \t\tcase 2042\t: return('utd');\n\t\t\t\t\t\t break;\n \t\tcase 2041\t: return('btd');\n\t\t\t\t\t\t break;\n \t\tcase 2040\t: return('ute');\n\t\t\t\t\t\t break;\n \t\tcase 2039\t: return('bte');\n\t\t\t\t\t\t break;\n \t\tcase 2038\t: return('fac');\n\t\t\t\t\t\t break;\n \t\tcase 2037\t: return('gff');\n\t\t\t\t\t\t break;\n \t\tcase 2036\t: return('ltr');\n\t\t\t\t\t\t break;\n \t\tcase 2035\t: return('uts');\n\t\t\t\t\t\t break;\n \t\tcase 2034\t: return('bts');\n\t\t\t\t\t\t break;\n \t\tcase 2033\t: return('dds');\n\t\t\t\t\t\t break;\n \t\tcase 2030\t: return('itp');\n\t\t\t\t\t\t break;\n \t\tcase 2029\t: return('dlg');\n\t\t\t\t\t\t break;\n \t\tcase 2023\t: return('git');\n\t\t\t\t\t\t break;\n \t\tcase 2032\t: return('utt');\n\t\t\t\t\t\t break;\n \t\tcase 2031\t: return('btt');\n\t\t\t\t\t\t break;\n \t\tcase 2027\t: return('utc');\n\t\t\t\t\t\t break;\n \t\tcase 2026\t: return('btc');\n\t\t\t\t\t\t break;\n \t\tcase 2025\t: return('uti');\n\t\t\t\t\t\t break;\n \t\tcase 2024\t: return('bti');\n\t\t\t\t\t\t break;\n \t\tcase 9\t : return('mpg');\n\t\t\t\t\t\t break;\n \t\tcase 2018\t: return('tlk');\n\t\t\t\t\t\t break;\n \t\tcase 2017\t: return('2da');\n\t\t\t\t\t\t break;\n \t\tcase 2005\t: return('fnt');\n\t\t\t\t\t\t break;\n \t\tcase 6\t : return('plt');\n\t\t\t\t\t\t break;\n \t\tcase 2016\t: return('wok');\n\t\t\t\t\t\t break;\n \t\tcase 2015\t: return('bic');\n\t\t\t\t\t\t break;\n \t\tcase 2014\t: return('ifo');\n\t\t\t\t\t\t break;\n \t\tcase 2013\t: return('set');\n\t\t\t\t\t\t break;\n \t\tcase 2012\t: return('are');\n\t\t\t\t\t\t break;\n \t\tcase 2010\t: return('ncs');\n\t\t\t\t\t\t break;\n \t\tcase 2009\t: return('nss');\n\t\t\t\t\t\t break;\n \t\tcase 2008\t: return('slt');\n\t\t\t\t\t\t break;\n \t\tcase 2003\t: return('thg');\n\t\t\t\t\t\t break;\n \t\tcase 2007\t: return('lua');\n\t\t\t\t\t\t break;\n \t\tcase 2002\t: return('mdl');\n\t\t\t\t\t\t break;\n \t\tcase 2001\t: return('tex');\n\t\t\t\t\t\t break;\n \t\tcase 2000\t: return('plh');\n\t\t\t\t\t\t break;\n \t\tcase 9998\t: return('bif');\n\t\t\t\t\t\t break;\n \t\tcase 9999\t: return('key');\n\t\t\t\t\t\t break;\n \t\tcase 2022\t: return('txi');\n\t\t\t\t\t\t break;\n \t\tcase 10\t\t: return('txt');\n\t\t\t\t\t\t break;\n \t\tcase 7\t : return('ini');\n\t\t\t\t\t\t break;\n \t\tcase 4\t : return('wav');\n\t\t\t\t\t\t break;\n \t\tcase 3\t : return('tga');\n\t\t\t\t\t\t break;\n \t\tcase 2\t : return('mve');\n\t\t\t\t\t\t break;\n \t\tcase 1\t : return('bmp');\n\t\t\t\t\t\t break;\n \t\tcase 0\t : return('res');\t\t\n\t\t\t\t\t\t break;\n\t\t\tdefault\t\t: return(-1);\n\t\t} /* end switch id */\n\t}", "public function getIdentifier() {}", "public function getIdentifier() {}", "public function getIdentifier() {}", "public function getIdentifier() {}", "public function getIdentifier() {}", "public function getIdentifier() {}", "public function getIdentifier() {}", "public function getIdentifier() {}", "public function userIdToUserName(int $id): string\n {\n return (string)$id;\n }", "public function show($id)\n {\n return Characteres::find($id);\n }", "function getSafenameFromId($challenge_id) {\n $challenges = challenges();\n return $challenges[$challenge_id]['safename'];\n}", "function getCategoryName($id){\n\t\t$conn \t= connectDB();\n\t\t$sth \t= $conn -> prepare(\"\tSELECT name\n\t\t\t\t\t\t\t\t\t\tFROM `category`\n\t\t\t\t\t\t\t\t\t\tWHERE `id` = ?\");\n\t\t$sth \t-> execute(array($id));\n\n\t\treturn \t$sth;\n\t}", "public function giveNomeCatEvent($id){\r\n $id = self::$conn->real_escape_string($id);\r\n $query = \"SELECT nome FROM \".$this->tables['categTable'].\r\n \" WHERE id = $id\";\r\n\t\t$result = self::$conn->query($query);\r\n if(!$result || $result->num_rows != 1)\r\n return ''; \r\n $row = $result->fetch_array(MYSQLI_NUM);\r\n return $row[0];\r\n }", "function get_short_name_circuit($id){\n\t/*Pre: - */\t\n\t\tglobal $connection;\n\t\t\n\t\t$query = \"SELECT c.short_name FROM circuit c WHERE c.id_circuit = '$id'\";\n\t\t$result_query = mysql_query($query, $connection) or my_error('GET_SHORT_NAME_CIRCUIT-> '.mysql_errno($connection).\": \".mysql_error($connection), 1);\n\t\t\n\t\treturn extract_row($result_query)->short_name;\t\t\t\n\t}", "function getIdentifier() ;", "function getIdentifier() ;", "function getIdentifier() ;", "public function getStrId();", "public function getUsername($id);", "public static function getNameById($id_state)\n {\n }", "function getCategoryNameById($id = null){\n\t}", "function getUserNameById($id) {\n global $conn;\n $name = \"\";\n $sql = \"SELECT firstname, lastname FROM users WHERE user_id=\" . $id;\n $result = $conn->query($sql);\n if($result->num_rows > 0) {\n while($row = $result->fetch_assoc()) {\n $name = $row[\"firstname\"] . \" \" . $row[\"lastname\"];\n }\n }\n return $name;\n }", "protected function getTypeName($id) {\n\t\t$beerType = M('beer_type', 'ac_')->where(array('id' => $id))->find();\n\t\treturn $beerType;\n\t}", "public function getName()\n {\n return $this->id;\n }", "public function get_id_code_name($id)\n {\n if($id==\"\"){\n $slct_qry=\"SELECT course_id,course_code,course_title FROM courses WHERE course_deleted='0'\";\n $exe_qry=mysqli_query($GLOBALS['con'],$slct_qry) or die(mysqli_error($GLOBALS['con']));\n } else {\n $slct_qry=\"SELECT course_id,course_code,course_title FROM courses WHERE course_id = $id AND course_deleted='0'\";\n $exe_qry=mysqli_query($GLOBALS['con'],$slct_qry) or die(mysqli_error($GLOBALS['con']));\n }\n return $exe_qry;\n }", "function getGameNameById($game_id){\r\n\t\t\t$game=$this->fetchRow('id = '.$game_id)->toArray();\r\n\t\t\treturn $game['name'];\r\n\t\t}", "function name_from_id($nfi_table, $nfi_id, $nfi_id_col, $nfi_name_col){\r\n\t\tglobal $conn;\r\n\t\t$sql_quary = \"SELECT * FROM \".$nfi_table.\" WHERE \".$nfi_id_col.\"='\".$nfi_id.\"';\";\r\n\t\t$sql = $conn->prepare($sql_quary);\r\n\t\t$sql->execute();\r\n\t\t\t\r\n\t\t$numRows = $sql->fetchAll();\r\n\t\t\tif(count($numRows)>0){\r\n\t\t\t\tforeach($numRows as $row){\r\n\t\t\t\t\treturn $row[$nfi_name_col];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t}", "public function getMemberNameById($id)\n {\n $adapter = $this->getConnection();\n $select = $adapter->select()\n ->from($this->getMainTable(), 'name')\n ->where('member_id = :member_id');\n $binds = ['member_id' => (int)$id];\n return $adapter->fetchOne($select, $binds);\n }", "function mk_cIDcName($hID){\n\t$sqlTags = \"SELECT Codename, CharID FROM ma_Characters where UserID = {$hID};\";\n\t$result = mysqli_query(IDB::conn(), $sqlTags) or die(trigger_error(mysqli_error(IDB::conn()), E_USER_ERROR));\n\n\tif (mysqli_num_rows($result) > 0)//at least one record!\n\t{//show results\n\n\t\t$count = 0;\n\t\t$aar = [];\n\n\t\twhile ($row = mysqli_fetch_assoc($result))\n\t\t{//dbOut() function is a 'wrapper' designed to strip slashes, etc. of data leaving db\n\t\t\t$cID \t\t = $row['CharID'];\n\t\t\t$cName \t\t\t= $row['Codename'];\n\t\t\t#nl2br($cOverivew)\n\n\t\t\t#make needed array of cID and cName\n\t\t\t$aar[$cID]['cName'] = $cName;\n\n\t\t\t#$aar[$cID]['overview'] = [$cOverView];\n\t\t}\n\t\t#return an array of links with tooltips\n\t\treturn $aar;\n\t}\n\t@mysqli_free_result($result);\n}", "function getCountryNameById($id){\n\t\t \n\t\t $this->sql = \"SELECT * from countries where id=$id\";\n\t\t\t if($this->query()){\n\t\t\t\t return $this->loadAssoc();\n\t\t\t }\n\t\t}", "public static function getCustomerNameByID($id){\n\t\t$sql = \"\n\t\t\tSELECT CONCAT(c.first_name, ' ', c.last_name) AS customer_name\n\t\t\tFROM customer AS c\n\t\t\tWHERE id = :id\n\t\t\t\";\n\n\t\t$sql_values = [\n\t\t\t':id' => $id\n\t\t];\n\n\t\t// Make a PDO statement\n\t\t$statement = DB::prepare($sql);\n\n\t\t// Execute\n\t\tDB::execute($statement, $sql_values);\n\n\t\t// Get all the results of the statement into an array\n\t\t$results = $statement->fetch();\n\n\t\treturn $results;\n\t}", "public function userIdToUserName(int $id): string\n {\n if (extension_loaded('posix')) {\n if (!$output = posix_getpwuid($id)) {\n throw Exceptional::InvalidArgument(\n $id . ' is not a valid user id'\n );\n }\n\n return $output['name'];\n }\n\n exec('getent passwd ' . escapeshellarg((string)$id), $output);\n\n if (isset($output[0])) {\n $parts = explode(':', $output[0]);\n\n if (null !== ($output = array_shift($parts))) {\n return $output;\n }\n }\n\n throw Exceptional::Runtime(\n 'Unable to extract owner name'\n );\n }", "function getNameById($id){\n\t$query=mysql_query(\"SELECT concat(firstname,' ',lastname) as name FROM users WHERE id='\".$id.\"' \");\n\t$name=mysql_result($query,\"name\");\n\t\n\treturn $name;\n}", "public function getIdentifier(): string;", "public function getIdentifier(): string;", "private function usernameGet($id)\n {\n $this->db->select('username');\n //where $id = GUID\n $this->db->where('GUID', $id);\n //from the users table\n $query = $this->db->get('users');\n\n foreach ($query->result() as $row) \n {\n $username = $row->username;\n }\n return $username;\n }", "public static function getTripName($id){\n return self::getTrip($id)->data->attributes->name;\n }", "public function getName ($id)\n\t{\n\t\t$id = intval($id);\n\t\t\n\t if (empty($id)) throw new Exception('user id is empty!');\n\t\n\t $mtag = \"usersName{$id}\";\n\t\t\n\t\t$data = $this->ci->bms->checkCacheData($mtag);\n\t\t\n\t\tif ($data === false)\n\t\t{\n\t $this->ci->db->select('firstName, lastName');\n\t $this->ci->db->from('users');\n\t $this->ci->db->where('deleted', 0);\n\t $this->ci->db->where('id', $id);\n\t\n\t $query = $this->ci->db->get();\n\t\n\t $results = $query->result();\n\t\n\t $data = \"{$results[0]->firstName} {$results[0]->lastName}\";\n\t\t}\n\t\t\n\t\t$this->ci->bms->saveCacheData($mtag, $data);\n\t\n\t return $data;\n\t\n\t}", "function getName($id, $query) {\n\n\t\tglobal $db, $f;\n\n\t\t$strSQL\t\t= \"SELECT\n\t\t\t\t\tnama \n\t\t\t\t FROM\n\t\t\t\t \ttbl_\".$query.\" \n\t\t\t\t WHERE\n\t\t\t\t \tid = $id\";\n\n\t\t$result = $db->Execute($strSQL);\n\t\tif (!$result) print $db->ErrorMsg();\n\t\t$row \t= $result->FetchRow();\n\n\t\t$nama\t= $row[$f->fmtCase('nama')];\n\n\t\treturn $nama;\n\t}", "function getUsername($id) { // Returns name of user with given id\n\t$id = intval($id);\n\treturn(dbFirstResult(\"SELECT username FROM users WHERE id=$id\"));\n}", "public function getUsername($id) \n {\n return $this->usernameGet($id);\n }", "public static function getNameUserById($id){\n $name = User::select('name')->where('id','=',$id)->get();\n return $name[0]->name;\n }", "public function getNameID()\n {\n return $this->nameID;\n }", "function get_clinic_name($id = null)\n {\n if (empty($id)) {\n $id = Cookie::get('clinic') || 1;\n }\n return Clinics::findOrNew($id)->name;\n }", "function getLabelFromId($id) {\n return 'field_'.$id;\n }", "function find_name_by_id($user_id,$connection)\n {\n $salt_string = \"@!\";\n $query = \"SELECT name FROM users WHERE user_id = $user_id\";\n $result = mysqli_query($connection,$query);\n if($result)\n {\n $row = mysqli_fetch_assoc($result);\n return chop($row['name'],$salt_string);\n }\n }", "public function getName()\t\t\t{ return $this->charXMLObj->character->attributes()->name; }", "private function getComponentName($id)\n {\n if ($id === 0) {\n return '';\n }\n if (array_key_exists($id, $this->componentCache)) {\n return $this->componentCache[$id];\n }\n\n $component = getContents($this->getURI() . '/api/v1/components/' . $id);\n $component = json_decode($component);\n if ($component === null) {\n return '';\n }\n return $component->data->name;\n }", "public function getShortCodeFromId(string $id): string\n {\n $shortCode = base_convert($id, 10, 36);\n $this->insertShortCodeInDb($id, $shortCode);\n return $shortCode;\n }", "public function getNameOfCoursebyId($id)\n {\n $courses = TableRegistry::getTableLocator()->get('Courses');\n $courses = $courses->find('all')->where(['id' => $id]);\n foreach($courses as $course){\n $course = $course->name;\n echo $course;\n }\n }", "function get_service_name($id){\n $answer=$GLOBALS['connect']->query(\"SELECT name FROM SERVICES WHERE id='$id'\");\n $data=$answer->fetch();\n return $data[\"name\"];\n }", "public abstract function getIdentifier();", "function getProductNameFromId($dbc, $id)\n{\n\t$id = cleanString($dbc, $id);\n\t\n\t$q = \"SELECT NAME FROM PRODUCTS WHERE ID = '$id'\";\n\t$r = mysqli_query($dbc, $q);\n\t\n\tif(mysqli_num_rows($r) == 1)\n\t{\n\t\tlist($productName) = mysqli_fetch_array($r);\n\t\treturn $productName;\n\t}else{\n\t\treturn false;\n\t}\n}", "public function getTeacherName($id)\n {\n\t\t$db = $this->getDbo();\n\t\t$query = $db->getQuery(true)\n\t\t\t->select('CONCAT(a.firstname, \\' \\', a.lastname) AS teachername')\n\t\t\t->from('#__cooltouraman_teacher AS a')\n\t\t\t->where('id ='. $id);\n\t\t\t\n\t\t$db->setQuery($query);\n\t\t\n\t\treturn $db->loadResult();\n }", "public function getCharacterByID($ID) { return isset($this->Characters[$ID]) ? $this->Characters[$ID] : NULL; }", "static private function getClassNameFromId($id) {\n list($className, $rest) = explode(self::ID_CLASS_NAME_SEPARATOR, $id, 2);\n return $className;\n }", "public static function getNameById($id) {\n $stm = Famework_Registry::getDb()->prepare('SELECT name FROM user_groups WHERE id = :id LIMIT 1');\n $stm->bindParam(':id', $id, PDO::PARAM_INT);\n $stm->execute();\n\n $res = $stm->fetch();\n\n if (!empty($res)) {\n return $res['name'];\n }\n\n return NULL;\n }" ]
[ "0.7704027", "0.74475336", "0.7283829", "0.7243234", "0.7015801", "0.69534355", "0.69315755", "0.6859769", "0.6760725", "0.6686248", "0.66808677", "0.65932286", "0.6590633", "0.65726006", "0.65688515", "0.6528733", "0.65205944", "0.6519239", "0.65012133", "0.6500837", "0.64877886", "0.6482439", "0.6452809", "0.6404645", "0.6386228", "0.6370105", "0.6369811", "0.6361205", "0.6344939", "0.6344939", "0.6333513", "0.6333513", "0.6333513", "0.6333513", "0.6333513", "0.6333513", "0.6333513", "0.6333513", "0.6333513", "0.63198656", "0.6315238", "0.6307855", "0.6302216", "0.62801534", "0.62801534", "0.62786984", "0.62786984", "0.62786984", "0.62786984", "0.62786984", "0.6278433", "0.6267625", "0.626527", "0.6261403", "0.62562513", "0.6255986", "0.62546635", "0.6250513", "0.6250513", "0.6249911", "0.6232187", "0.6231085", "0.62295073", "0.62272805", "0.6225961", "0.62175554", "0.6214588", "0.6213576", "0.62019396", "0.6199216", "0.61966443", "0.6192478", "0.6190692", "0.61841327", "0.6179445", "0.61604327", "0.6147896", "0.6147896", "0.6135023", "0.6133097", "0.61297524", "0.61217374", "0.6120013", "0.6119333", "0.61004114", "0.6098993", "0.6098056", "0.60824215", "0.60816664", "0.60802895", "0.6074363", "0.6068161", "0.6062431", "0.60594976", "0.6055966", "0.60520786", "0.6044903", "0.60364157", "0.6022159", "0.6022034" ]
0.79088765
0
/ done hhh by
public function updateCategorie($categorie) { return Categorie::whereId($categorie->id)->update($categorie->all()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function process() ;", "private function _i() {\n }", "function handle() ;", "function processData() ;", "private function j() {\n }", "final function velcom(){\n }", "function complete();", "abstract protected function _process();", "abstract protected function _process();", "public function boleta()\n\t{\n\t\t//\n\t}", "abstract protected function _run();", "abstract protected function _run();", "public function done();", "abstract public function run() ;", "function run()\r\n {\r\n }", "public function serch()\n {\n }", "function flush() ;", "function flush() ;", "function fix() ;", "function execute()\r\n\t{\r\n\t\t\r\n\t}", "protected function _process() {}", "protected function _process() {}", "protected function _process() {}", "protected function _process() {}", "public function helper()\n\t{\n\t\n\t}", "protected function _exec()\n {\n }", "function commit() ;", "public function oops () {\n }", "function process() {\n return 0;\n }", "public function nadar()\n {\n }", "public function hapus_toko(){\n\t}", "private function __() {\n }", "function fileNeedsProcessing() ;", "function run();", "function run();", "public function temporality();", "public function AggiornaPrezzi(){\n\t}", "function generate() ;", "abstract function run();", "public function pasaje_abonado();", "function yy_r66(){ $this->_retvalue = []; }", "protected abstract function perform_next();", "protected function finish() {}", "abstract protected function process();", "abstract protected function process();", "abstract protected function process();", "abstract protected function process();", "function getFinal()\n {\n }", "public function work(): void;", "function thaw() {\n //$this->get_lock();\n\n $vals = $this->that->get_value($this->id, $this->name);\n eval(sprintf(\";%s\",$vals));\n }", "function main()\n{\n //getRequestidhl();\n\t //getRequestidlap();\n\t getRequestidpl();\n\n\t\n}", "function process() {\r\n }", "function yy_r54(){ $this->_retvalue = array(); }", "function work()\n {\n }", "public function paroleAction() {\n\t\t \t\t\t\t\n\t\t\n\t}", "function lcs()\n {\n }", "abstract protected function _preProcess();", "public static function main(){\n\t\t\t\n\t\t}", "function yy_r18(){ $this->_retvalue = new SQL\\BeginTransaction($this->yystack[$this->yyidx + 0]->minor); }", "public function complete();", "public function complete();", "function __flop(&$tmp) {\r\r\n\t\tasido::trigger_abstract_error(\r\r\n\t\t\t__CLASS__,\r\r\n\t\t\t__FUNCTION__\r\r\n\t\t\t);\r\r\n\t\t}", "public function main()\r\n {\r\n \r\n }", "function movenext(){\n\t\t\n\t\tif ($this->debug) echo \"Fetching next record ... \";\n\t $this->record = @mysql_fetch_array($this->rstemp);\n\t $status = is_array($this->record);\n\t\t\n\t\tif ($this->debug && $status) echo \"OK <br>\\n\\n\";\n\t\telseif ($this->debug) echo \"EOF <br>\\n\\n\";\n\t\t\n\t return($status);\n\t}", "abstract public function run();", "abstract public function run();", "abstract public function run();", "abstract public function run();", "abstract public function run();", "abstract public function run();", "abstract public function run();", "abstract public function run();", "public function masodik()\n {\n }", "function hitungDenda(){\n\n return 0;\n }", "function update_end()\n {\n }", "public function work()\n {\n }", "function count() ;", "public function run()\n\t{\n\t\t//\n\t}", "abstract public function put__do_process ();", "public function main()\n\t{\n\t}", "public function elso()\n {\n }", "protected function _refine() {\n\n\t}", "protected function _postExec()\n {\n }", "function extract()\n {\n }", "public function processJOb() {\n \t\t//update staus for cron job to processed when done or error if erored out \n \t}", "public function proceed();", "public function liberar() {}", "function yy_r97(){ \n $this->_retvalue = $this->yystack[$this->yyidx + -3]->minor; $this->yystack[$this->yyidx + -3]->minor->values($this->yystack[$this->yyidx + -1]->minor); \n if ($this->yystack[$this->yyidx + 0]->minor) $this->_retvalue->onDuplicate($this->yystack[$this->yyidx + 0]->minor);\n }", "function finish(){\r\n\t}", "function ret2code2text() {\n\t$this->chapitre(\"Return to .TEXT\");\n\t$this->titre(\"Outrepasser une authentification -> return to text\");\n\t$this->ssTitre(\"Exec Our Programme\");\n\t$this->requette(\"$this->file_path '0123456789' \");\n\t$this->pause();\n\t$this->requette(\"$this->file_path AAAABBBBCCCC\");\n\t$this->requette(\"$this->file_path AAAABBBBCCCCDDDDABCD\");\n\t$this->article(\".Text\", \"La zone text contient les instructions du programme. \n\t\t\tCette région est en lecture seule. \n\t\t\tElle est partagée entre tous les processus qui exécutent le même fichier binaire. \n\t\t\tUne tentative d'écriture dans cette partie provoque une erreur segmentation violation. -> segfault, cette zone n'est pas influençables par l'ASLR ni NX.\");\n\t$this->pause();\n\n\t$this->bin2text2size();$this->pause();\n\t$this->bin2text2content();$this->pause();\n\t$this->titre(\"Adresse de la fonction secret\");\n\t$ret = trim($this->req_ret_str(\"$this->file_path AAAAAAAA | grep '0x' | cut -d : -f 2\"));\n\t$this->ssTitre(\"Via gdb\");\n\t$this->requette(\"gdb -q --batch -ex \\\"print &secret\\\" $this->file_path\");\n\t$this->requette(\"gdb -q --batch -ex \\\"info symbol $ret\\\" $this->file_path\");\n\t$this->ssTitre(\"Via nm\");\t$this->requette(\"nm $this->file_path | grep secret\");\n\t$this->ssTitre(\"Via le script source\");$this->requette(\"$this->file_path AAAAAAAA\");\n\t$this->pause();\n\t$overflow = $this->bin2fuzzeling(\"\");$this->pause();\n\t// $offset_eip = trouve_offset($this->file_path,$overflow) ;\n\t$offset_eip = $this->bin2offset4eip($overflow);\n\t$this->ssTitre(\"ESP & EBP\");\n\t// diff_esp_ebp();pause(); // ok\n\t$ret = $this->hex2rev_32($ret);\n\t$query = \"$this->file_path `python -c print'\\\"A\\\"*$offset_eip+\\\"$ret\\\"'`\";\n\t$this->ssTitre(\"Sous Linux 32 Bits\");\n\t$this->ssTitre(\"Exec Programme\");\n\t$this->requette(\"$this->file_path 123456\");\n\t$this->ssTitre(\"Exec Programme with our payload \");\n\t$this->cmd(\"localhost\", $query);\n\t$this->article(\"Note\", \"Dot it a la main,php recoit un signal segfault du prog qui a lance d'ou l'arret de l'execution de la commande system -> on test en cmd\");\n\t$this->pause();\n\t$this->notify(\"End .text\");\n}", "protected function done()\n {\n }", "public function emitirSom()\n {\n }", "function next();", "function j_jj($h1) {\r\n if ($h1 === 'o') {\r\n $duplo1 = 'j';\r\n return $duplo1;\r\n }\r\n }", "public function done(){\n\t\t$this->done=true;\n\t}", "public function trasnaction(){\n\n\t}", "public function next();", "public function next();", "public function next();", "public function next();", "function yy_r20(){ $this->_retvalue = new SQL\\CommitTransaction($this->yystack[$this->yyidx + 0]->minor); }" ]
[ "0.6063656", "0.56434315", "0.562995", "0.55353796", "0.55331266", "0.55166864", "0.5393416", "0.5362532", "0.5362532", "0.53378415", "0.53342456", "0.53342456", "0.5323301", "0.5292983", "0.5290777", "0.528153", "0.5267139", "0.5267139", "0.52497953", "0.52299744", "0.522844", "0.522844", "0.522844", "0.522844", "0.52170014", "0.5199665", "0.51915175", "0.5190889", "0.5169397", "0.51583105", "0.51338977", "0.51304686", "0.5105612", "0.5087908", "0.5087908", "0.5082353", "0.5080981", "0.50764596", "0.50756615", "0.50718045", "0.50503975", "0.5050271", "0.5044299", "0.50412834", "0.50412834", "0.50412834", "0.50412834", "0.50298536", "0.50297046", "0.5028395", "0.50267494", "0.5024418", "0.50226355", "0.50164825", "0.50039196", "0.49998495", "0.4997901", "0.49762046", "0.49680215", "0.49611992", "0.49611992", "0.494707", "0.4937504", "0.49281567", "0.492503", "0.492503", "0.492503", "0.492503", "0.492503", "0.492503", "0.492503", "0.492503", "0.49226633", "0.49216145", "0.49098334", "0.49051973", "0.4903648", "0.49036336", "0.48976266", "0.48869514", "0.48828295", "0.48816097", "0.48772758", "0.48768073", "0.48671192", "0.4867075", "0.48654363", "0.48588252", "0.48472202", "0.48456186", "0.48455814", "0.48418146", "0.483742", "0.48358095", "0.48316765", "0.48275843", "0.4825371", "0.4825371", "0.4825371", "0.4825371", "0.481898" ]
0.0
-1
Return the credential that are mandatory.
private function getCredentials(AuthenticateRequest $request) { return [ 'email' => $request->input('email'), 'password' => $request->input('password'), ]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getCredential ()\n\t{\n\t\t$retVal = null;\n\t\tif ($this->isConsole()) {\n\t\t\t$retVal = MO_CONSOLE_CREDENTIAL;\n\t\t} elseif(!defined('MO_IS_CONSOLE')) {\n\t\t\t$retVal = parent::getCredential();\n\t\t}\n\t\treturn $retVal;\n\t}", "public function getCredential();", "public function credential()\n {\n return $this->credentials();\n }", "public function getCredential()\n {\n $activeCredentials = $this->getCredentials()->where(['status' => Credential::STATUS_ACTIVE]);\n\n $count = $activeCredentials->count();\n\n if ($count > 1) {\n //Use credential usage statistics to determinate most less used credential\n try {\n $statData = Yii::$app->statistic->get(\n 'times_credentials_used',\n date('Y-m-d'),\n date('Y-m-d'),\n [['content_provider_id' => $this->id]]\n );\n } catch (Exception $e) {\n return $activeCredential->one();\n }\n\n $cred = null;\n $minUsage = INF;\n foreach ($activeCredentials->each() as $activeCredential) {\n $found = false;\n foreach ($statData as $data) {\n if ($activeCredential->id == $data['credential_id']) {\n $found = true;\n if ($data['times_used'] < $minUsage) {\n $minUsage = $data['times_used'];\n $cred = $activeCredential;\n break;\n }\n }\n }\n if (!$found) {\n //No statistic found on usage of this credential, so it was not used yet.\n return $activeCredential;\n }\n }\n\n return $cred;\n } else if ($count == 1) {\n return $activeCredentials->one();\n } else {\n return null;\n }\n /*\n Pick random credential\n if ($count > 0) {\n return $activeCredentials[rand(0, $count - 1)];\n } else {\n return null;\n }*/\n }", "public function getCredentials()\n {\n return '';\n }", "public function getCredentials()\n {\n return '';\n\n }", "public function getCredential()\r\n {\r\n return $this->credential;\r\n }", "public function getCredential(): string\n {\n return $this->credential;\n }", "abstract public function getCredentials();", "public function getKeyCredentials()\n {\n if (array_key_exists(\"keyCredentials\", $this->_propDict)) {\n return $this->_propDict[\"keyCredentials\"];\n } else {\n return null;\n }\n }", "public function getCredentials(): ?object;", "private static function get_credentials($credential_key = null) {\r\n\t\t\t$credentials = self::get_settings('credentials');\r\n\r\n\t\t\treturn empty($credentials) ? false :\r\n\t\t\t\t\t\t(is_null($credential_key) ? $credentials :\r\n\t\t\t\t\t\t\t(isset($credentials[$credential_key]) ? $credentials[$credential_key] : false));\r\n\t\t}", "abstract public function credentials();", "public function credential()\n {\n return $this->morphOne(Credential::class, 'credentialable');\n }", "public function getUserCredential()\n {\n return $this->userCredentials;\n }", "public function getCredentials()\n { return $this->get('credentials'); }", "public function getCredentials() {\r\n\t\t\r\n\t\treturn $this->_credentials;\r\n\t\t\r\n\t}", "public function getProjectCreationMailCredentials() {\n\n if (!isset(Yii::app()->params['googlePlayProjectCreation_mailCredentials']))\n return null;\n\n if (!isset(Yii::app()->params['googlePlayProjectCreation_mailCredentials']['host']))\n return null;\n\n if (!isset(Yii::app()->params['googlePlayProjectCreation_mailCredentials']['user']))\n return null;\n\n if (!isset(Yii::app()->params['googlePlayProjectCreation_mailCredentials']['pass']))\n return null;\n\n return Yii::app()->params['googlePlayProjectCreation_mailCredentials'];\n }", "private static function has_credentials() {\r\n\t\t\t$credentials = self::get_credentials();\r\n\r\n\t\t\treturn is_array($credentials)\r\n\t\t\t\t\t&& isset($credentials['api-key'])\r\n\t\t\t\t\t&& isset($credentials['email'])\r\n\t\t\t\t\t&& isset($credentials['id'])\r\n\t\t\t\t\t&& !empty($credentials['api-key'])\r\n\t\t\t\t\t&& !empty($credentials['email'])\r\n\t\t\t\t\t&& !empty($credentials['id']);\r\n\t\t}", "protected function validCredentials(){\n $valid_credentials = !empty($this->consumerKey);\n $valid_credentials = ($valid_credentials && !empty($this->consumerSecret));\n $valid_credentials = ($valid_credentials && $this->consumerKey === variable_get('ebs_consumer_key', '')); \n $valid_credentials = ($valid_credentials && $this->consumerSecret === variable_get('ebs_consumer_secret', ''));\n \n return $valid_credentials;\n }", "private function _allowCredentials(): string\n {\n return ($this->config['AllowCredentials']) ? 'true' : 'false';\n }", "function acapi_get_creds() {\n $user = acapi_get_option('email');\n $pass = acapi_get_option('key');\n if (empty($user) || empty($pass)) {\n return drush_set_error('ACAPI_CREDS_MISSING', dt('Email and api key required; specify --email/--key or run drush ac-api-login'));\n }\n return \"$user:$pass\";\n}", "public function getMandatory();", "public function getCredentials()\n\t{\n\t\treturn $this->credentials;\n\t}", "public function getCredentials()\n {\n return $this->credentials;\n }", "public function getCredentials()\n {\n return $this->credentials;\n }", "private function getCredentials()\n {\n $basic = base64_encode(Settings::$username . ':' . Settings::$password);\n// $basic = base64_encode($this->user_id . ':' . $this->password);\n return $basic;\n }", "public function retrieveAuthCredentials()\n\t{\n\t\t// Since PHP saves the HTTP Password in a bunch of places, we have to be able to test for all of them\n\t\t$username = $password = NULL;\n\t\t\n\t\t// mod_php\n\t\tif (isset($_SERVER['PHP_AUTH_USER'])) \n\t\t{\n\t\t $username = (isset($_SERVER['PHP_AUTH_USER'])) ? $_SERVER['PHP_AUTH_USER'] : NULL;\n\t\t $password = (isset($_SERVER['PHP_AUTH_PW'])) ? $_SERVER['PHP_AUTH_PW'] : NULL;\n\t\t}\n\n\t\t// most other servers\n\t\telseif ($_SERVER['HTTP_AUTHENTICATION'])\n\t\t{\n\t\t\tif (strpos(strtolower($_SERVER['HTTP_AUTHENTICATION']),'basic') === 0)\n\t\t\t{\n\t\t\t\tlist($username,$password) = explode(':',base64_decode(substr($_SERVER['HTTP_AUTHENTICATION'], 6)));\n\t\t\t}\n\t\t}\n\t\t\n\t\t// Check them - if they're null a/o empty, they're invalid.\n\t\tif ( is_null($username) OR is_null($password) OR empty($username) OR empty($password))\n\t\t\treturn FALSE;\n\t\telse\n\t\t\treturn array('username' => $username, 'password' => $password);\n\t}", "public function getCredentials() {\n\t\treturn $this->_credentials;\n\t}", "public function firstParty() {\r\n return $this->personal_access_client || $this->password_client;\r\n }", "protected function getCredentials()\n {\n $user = $this->options[\"USER\"];\n $password = $this->options[\"PASS\"];\n // 1BIS : encoded?\n if ($user == \"\" && isSet($this->options[\"ENCODED_CREDENTIALS\"])) {\n list($user,$password) = AJXP_Safe::getCredentialsFromEncodedString($this->options[\"ENCODED_CREDENTIALS\"]);\n }\n // 2. Try from session\n if ($user==\"\" && isSet($this->options[\"USE_SESSION_CREDENTIALS\"]) ) {\n $safeCred = AJXP_Safe::loadCredentials();\n if ($safeCred !== false) {\n $user = $safeCred[\"user\"];\n $password = $safeCred[\"password\"];\n } else {\n throw new Exception(\"Session credential are empty! Did you forget to check the Set Session Credential in the Authentication configuration panel?\");\n }\n }\n return array($user, $password);\n }", "static public function getcredencial() {\n try {\n $sql = 'SELECT credencial.id, credencial.nombre FROM credencial';\n return dataBaseClass::getInstance()->query($sql)->fetchAll(PDO::FETCH_ASSOC);\n } catch (PDOException $e) {\n return $e;\n }\n }", "public function getCredentials()\n {\n return $this->provider . '_' . $this->oAuthId;\n }", "private function credentialByRequest()\n {\n $isSandboxed = $this->isSandboxed();\n\n $clientIdKey = $isSandboxed ? Storable::OPTION_CLIENT_ID_SANDBOX : Storable::OPTION_CLIENT_ID;\n $clientSecretKey = $isSandboxed ? Storable::OPTION_SECRET_ID_SANDBOX : Storable::OPTION_SECRET_ID;\n\n $clientIdKey = Storable::OPTION_PREFIX . $clientIdKey;\n $clientSecretKey = Storable::OPTION_PREFIX . $clientSecretKey;\n\n $clientId = (string)filter_input(INPUT_POST, $clientIdKey, FILTER_SANITIZE_STRING);\n $clientSecret = (string)filter_input(INPUT_POST, $clientSecretKey, FILTER_SANITIZE_STRING);\n\n return new Credential($clientId, $clientSecret);\n }", "public function getPasswordCredentials()\n {\n if (array_key_exists(\"passwordCredentials\", $this->_propDict)) {\n return $this->_propDict[\"passwordCredentials\"];\n } else {\n return null;\n }\n }", "function canDisplayCredentials()\n\t{\n\t\treturn env('SHOW_CREDENTIALS','false') == 'true';\n\t}", "public function getCredentials()\n {\n if ($this->login) return array( $this->login, $this->password);\n\n //Using static PureBilling as fallback\n if (class_exists('\\PureBilling') && \\PureBilling::getPrivateKey()) {\n return array('api', \\PureBilling::getPrivateKey());\n }\n }", "public function getCredential($key)\n {\n switch ($key)\n {\n case 'id':\n return $this->id;\n break;\n case 'username':\n return $this->username;\n break;\n case 'email':\n return $this->email;\n break;\n case 'image':\n return $this->image;\n break;\n default:\n return isset($this->details[$key])?$this->details[$key]:'Wrong key';\n break;\n }\n }", "protected function credentials(Request $request)\n\t{\n\t return $request->only($this->username(), 'password');\n\t}", "protected function getCredentialForToggle($field)\n\t{\n\t\t$security = $this->getSecurityValue($field, array());\n\t\treturn isset($security['is_secure']) && $security['is_secure'] && isset($security['credentials']) ? $security['credentials'] : array();\n\t}", "protected function getCredentialObject()\n {\n if(isset($this->credential))\n return $this->credential;\n\n $this->credential = new Credential;\n return $this->credential;\n }", "public function read_credentials(){\n $query='SELECT * FROM '.$this->table.' WHERE name=? and password=?';\n\n $stmt = $this->conn->prepare($query);\n\n \n $stmt->bindparam(1,$this->name);\n $stmt->bindparam(2,$this->password);\n\n $stmt->execute();\n\n $row = $stmt->fetch(PDO::FETCH_ASSOC);\n $this->name=$row['name'];\n $this->email=$row['email'];\n $this->status=$row['status'];\n\n if($stmt->execute()) {\n return true;\n }\n \n // Print error \n printf(\"Error: %s.\\n\", \"invalid user\");\n \n return false;\n \n \n }", "protected function credentials(Request $request)\n {\n return $request->only('email', 'password');\n }", "protected function credentials(Request $request)\n {\n return $request->only('email', 'password');\n }", "public function areSMSAPICredentialProvided()\n {\n $this->setQuery( 'areSMSAPICredentialProvided' );\n\n return $this->execute();\n }", "function auth_prerequisite()\n{\n db_prerequisite();\n\n $auth = _cfg('auth');\n\n if (isset($auth['table']) && $auth['table'] &&\n isset($auth['fields']['id']) && $auth['fields']['id'] &&\n isset($auth['fields']['role']) && $auth['fields']['role']) {\n return $auth;\n } else {\n _header(400);\n throw new \\InvalidArgumentException('Required to configure <code class=\"inline\">$lc_auth</code> in <code class=\"inline\">/inc/config.php</code>.');\n }\n}", "public function getRequireLogin()\n {\n return $this->requireLogin;\n }", "public function maybe_received_credentials() {\n\t\tif ( ! is_admin() || ! is_user_logged_in() ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Require the nonce.\n\t\tif ( empty( $_GET['wc_ppec_ips_admin_nonce'] ) || empty( $_GET['env'] ) ) {\n\t\t\treturn false;\n\t\t}\n\t\t$env = in_array( $_GET['env'], array( 'live', 'sandbox' ) ) ? $_GET['env'] : 'live';\n\n\t\t// Verify the nonce.\n\t\tif ( ! wp_verify_nonce( $_GET['wc_ppec_ips_admin_nonce'], 'wc_ppec_ips' ) ) {\n\t\t\twp_die( __( 'Invalid connection request', 'woocommerce-gateway-paypal-express-checkout' ) );\n\t\t}\n\n\t\twc_gateway_ppec_log( sprintf( '%s: returned back from IPS flow with parameters: %s', __METHOD__, print_r( $_GET, true ) ) );\n\n\t\t// Check if error.\n\t\tif ( ! empty( $_GET['error'] ) ) {\n\t\t\t$error_message = ! empty( $_GET['error_message'] ) ? $_GET['error_message'] : '';\n\t\t\twc_gateway_ppec_log( sprintf( '%s: returned back from IPS flow with error: %s', __METHOD__, $error_message ) );\n\n\t\t\t$this->_redirect_with_messages( __( 'Sorry, Easy Setup encountered an error. Please try again.', 'woocommerce-gateway-paypal-express-checkout' ) );\n\t\t}\n\n\t\t// Make sure credentials present in query string.\n\t\tforeach ( array( 'api_style', 'api_username', 'api_password', 'signature' ) as $param ) {\n\t\t\tif ( empty( $_GET[ $param ] ) ) {\n\t\t\t\twc_gateway_ppec_log( sprintf( '%s: returned back from IPS flow but missing parameter %s', __METHOD__, $param ) );\n\n\t\t\t\t$this->_redirect_with_messages( __( 'Sorry, Easy Setup encountered an error. Please try again.', 'woocommerce-gateway-paypal-express-checkout' ) );\n\t\t\t}\n\t\t}\n\n\t\t$creds = new WC_Gateway_PPEC_Client_Credential_Signature(\n\t\t\t$_GET['api_username'],\n\t\t\t$_GET['api_password'],\n\t\t\t$_GET['signature']\n\t\t);\n\n\t\t$error_msgs = array();\n\t\ttry {\n\t\t\t$payer_id = wc_gateway_ppec()->client->test_api_credentials( $creds, $env );\n\n\t\t\tif ( ! $payer_id ) {\n\t\t\t\t$this->_redirect_with_messages( __( 'Easy Setup was able to obtain your API credentials, but was unable to verify that they work correctly. Please make sure your PayPal account is set up properly and try Easy Setup again.', 'woocommerce-gateway-paypal-express-checkout' ) );\n\t\t\t}\n\t\t} catch ( PayPal_API_Exception $ex ) {\n\t\t\t$error_msgs[] = array(\n\t\t\t\t'warning' => __( 'Easy Setup was able to obtain your API credentials, but an error occurred while trying to verify that they work correctly. Please try Easy Setup again.', 'woocommerce-gateway-paypal-express-checkout' ),\n\t\t\t);\n\t\t}\n\n\t\t$error_msgs[] = array(\n\t\t\t'success' => __( 'Success! Your PayPal account has been set up successfully.', 'woocommerce-gateway-paypal-express-checkout' ),\n\t\t);\n\n\t\tif ( ! empty( $error_msgs ) ) {\n\t\t\twc_gateway_ppec_log( sprintf( '%s: returned back from IPS flow: %s', __METHOD__, print_r( $error_msgs, true ) ) );\n\t\t}\n\n\t\t// Save credentials to settings API\n\t\t$settings_array = (array) get_option( 'woocommerce_ppec_paypal_settings', array() );\n\n\t\tif ( 'live' === $env ) {\n\t\t\t$settings_array['environment'] = 'live';\n\t\t\t$settings_array['api_username'] = $creds->get_username();\n\t\t\t$settings_array['api_password'] = $creds->get_password();\n\t\t\t$settings_array['api_signature'] = is_callable( array( $creds, 'get_signature' ) ) ? $creds->get_signature() : '';\n\t\t\t$settings_array['api_certificate'] = is_callable( array( $creds, 'get_certificate' ) ) ? $creds->get_certificate() : '';\n\t\t\t$settings_array['api_subject'] = $creds->get_subject();\n\t\t} else {\n\t\t\t$settings_array['environment'] = 'sandbox';\n\t\t\t$settings_array['sandbox_api_username'] = $creds->get_username();\n\t\t\t$settings_array['sandbox_api_password'] = $creds->get_password();\n\t\t\t$settings_array['sandbox_api_signature'] = is_callable( array( $creds, 'get_signature' ) ) ? $creds->get_signature() : '';\n\t\t\t$settings_array['sandbox_api_certificate'] = is_callable( array( $creds, 'get_certificate' ) ) ? $creds->get_certificate() : '';\n\t\t\t$settings_array['sandbox_api_subject'] = $creds->get_subject();\n\t\t}\n\n\t\tupdate_option( 'woocommerce_ppec_paypal_settings', $settings_array );\n\n\t\t$this->_redirect_with_messages( $error_msgs );\n\t}", "protected function getCredentials(Request $request)\n \n {\n //if ('active' != false){\n return [\n 'email' => $request->input('email'),\n 'password' => $request->input('password')\n //'active' => 1\n ];\n }", "protected function getCredential($credentials, $credential)\n {\n $value = Arr::get($credentials, $credential);\n if (substr($value, 0, 1) === '{') {\n return;\n }\n\n return $value !== null ? $value : $this->command->option($credential);\n }", "public function canManageCredentials()\n {\n return true;\n }", "protected function getCredentials(Request $request)\n {\n return $request->only('email', 'password');\n }", "public function getCredentials()\n {\n $credentials = parent::getCredentials();\n\n unset($credentials['password']);\n\n return $credentials;\n }", "protected function credentials(Request $request)\n {\n return $request->only('email');\n }", "public function shouldAllowCredentials(): bool {\n return $this->configuration['allow_credentials'];\n }", "public function determineMissingFields()\n {\n $missing = array();\n\n foreach ($this->_requiredParams AS $param)\n {\n if (!isset($this->_queryParameters[$param]) || strlen($this->_queryParameters[$param]) === 0)\n {\n $missing[] = $param;\n }\n }\n\n if (empty($this->_username)) {\n $missing[] = 'USER';\n }\n\n if (empty($this->_password)) {\n $missing[] = 'PWD';\n }\n\n if (empty($this->_signature)) {\n $missing[] = 'SIGNATURE1';\n }\n\n return $missing;\n }", "public function getCredentialsName()\n {\n //Return Credential name\n return is_null($this->credentialsName) ? config('personality-insights.default_credentials') : $this->credentialsName;\n }", "public function analisarCredito()\n {\n return false;\n }", "public function getCredentials() {\n\t\t\n\t\treturn $this->_getResponse(self::URL_USERS_VERIFY_CREDENTIALS, $this->_query);\n\t}", "public function getCredentialsInformation()\n {\n $email = $this->getConfigData('email');\n $token = $this->getConfigData('token');\n $credentials = new PagSeguroAccountCredentials($email, $token);\n\n return $credentials;\n }", "protected function getCredentials(): array\n {\n return [\n 'auth_corpid' => $this->authCorpid,\n 'permanent_code' => $this->permanentCode,\n ];\n }", "static function getNecessaryInfo($username)\r\n\t{\r\n\t\t$username = funcs::check_input($username);\r\n\r\n\t\t$sql = \"SELECT \".TABLE_MEMBER_PASSWORD.\", \".TABLE_MEMBER_VALIDATION.\"\r\n\t\t\t\tFROM \".TABLE_MEMBER.\"\r\n\t\t\t\tWHERE \".TABLE_MEMBER_USERNAME.\"='\".$username.\"'\";\r\n\t\t$rec = DBconnect::assoc_query_1D($sql);\r\n\r\n\t\treturn $rec;\r\n\t}", "public function requestAuth()\n {\n return null;\n }", "protected function getCredentials()\n {\n if (empty($this->username) || empty($this->password)) {\n throw new \\Exception('Basic authentication requires a $username & $password property.');\n }\n\n return [$this->username, $this->password];\n }", "public function attestationExcludedCredentials(): array;", "public function readCredentials()\n {\n $apiId = !empty($_POST['connection']['appId']) ? $_POST['connection']['appId'] : '';\n $apiUsername = !empty($_POST['connection']['apiUsername']) ? $_POST['connection']['apiUsername'] : '';\n $apiPassword = !empty($_POST['connection']['apiPassword']) ? $_POST['connection']['apiPassword'] : '';\n\n if (empty($apiId) || empty($apiUsername) || empty($apiPassword)) {\n return $this->error('You must provide a valid iContact AppID/Username/Password');\n }\n\n $this->setCredentials($_POST['connection']);\n\n $result = $this->testConnection();\n\n if ($result !== true) {\n return $this->error('Could not connect to iContact: ' . $result);\n }\n\n /**\n * finally, save the connection details\n */\n $this->save();\n $this->success('iContact connected successfully');\n }", "function getauthorized() {\r\n\r\n $db = JFactory::getDBO();\r\n $query = \"SELECT id,email,api,transaction_key,mode FROM #__em_authorized_settings\r\n WHERE id = 1\";\r\n $db->setQuery($query);\r\n $result = $db->loadObject();\r\n\r\n return $result;\r\n }", "public function getStripeCredentials()\n {\n $publishable_key = $this->settings()->where('name', 'publishable_key')->get()->first();\n $secret_key = $this->settings()->where('name', 'secret_key')->get()->first();\n\n if ($publishable_key && $secret_key) {\n return new StripeCredentials($secret_key->value, $publishable_key->value);\n }\n\n return null;\n }", "function get_object_credentials() {\n\t\treturn array(\n\t\t\t'host' => $this->host,\n\t\t\t'port' => $this->port,\n\t\t\t'dbname' => $this->dbName,\n\t\t\t'user' => $this->user,\n\t\t\t'password' => $this->passwd\n\t\t);\n\t}", "function validateApiCredentials() { \n if( $this->options['api_type'] == \"\" || $this->options['api_path'] == \"\" ) {\n $this->error_handler( 'Repository url not valid' );\n } elseif($this->options['username'] == \"\") {\n $this->error_handler( 'Username Required' );\n } else if($this->options['password'] == \"\") {\n $this->error_handler( 'Password Required' );\n }\n }", "public function getAuthenticationAvailable();", "public function getGoogleCloudStorageCredentialsJson() {\n return @$this->attributes['google_cloud_storage_credentials_json'];\n }", "function credentials() {\n\t\t return array(PHPLM_DBHOST, PHPLM_DBUSER, PHPLM_DBPASS);\n\t\t}", "function is_validated($username = null, $password = null){\n return validate_cred($username, $password);\n}", "private function generateCredentials()\n {\n $key = $this->engine->config->get('roamtechapi.client_id');\n $secret = $this->engine->config->get('roamtechapi.client_secret');\n\n return [\n 'client_id' => $key,\n 'client_secret' => $secret,\n 'grant_type' => 'client_credentials'\n ];\n }", "public function getCredential($id)\n {\n $res = $this->db->select(\"SELECT * FROM `{$this->domainCredential}` WHERE itemName()='{$id}' AND status='1'\", array('ConsistentRead' => 'true'));\n $this->logErrors($res);\n if(isset($res->body->SelectResult->Item))\n return self::normalizeCredential($res->body->SelectResult->Item);\n else\n return false;\n }", "public function create()\n\t{\t\n\t\t$rules = array(\n\t\t\t\t'name' \t\t=> 'required',\n\t\t\t\t'username' \t=> 'required',\n\t\t\t\t'password' \t=> 'required',\n\t\t\t\t'type'\t\t=> 'required'\n\t\t\t);\n\n\t\t$validator = Validator::make($data = Input::all(), $rules);\n\n\t\tif ($validator->fails()) {\n\t\t\treturn Redirect::back()->withErrors($validator)->withInput();\n\t\t}\n\n\t\t$credential \t\t\t\t= new Credential;\n\t\t$credential->user_id \t\t= Auth::id();\n\t\t$credential->project_id \t= Input::get('project_id');\n\t\t$credential->name \t\t\t= Input::get('name');\n\t\t$credential->username \t\t= Input::get('username');\n\t\t$credential->password \t\t= Input::get('password');\t\t\n\n\t\tif (Input::get('type') == \"server\") {\t\t\t\t\t\t\n\t\t\t$credential->type \t\t= true;\t\t\t\n\t\t\t$credential->hostname \t= Input::get('hostname');\n\t\t\t$credential->port \t\t= Input::get('port');\t\t\t\n\t\t\t\n\t\t}else{\n\t\t\t$credential->type \t\t= false;\t\n\t\t\t$credential->hostname \t= \"\";\n\t\t\t$credential->port \t\t= \"\";\n\t\t}\n\t\t$credential->save();\n\t\treturn Redirect::back();\t\t\t\t\t\t\n\t}", "public function getCredentials()\n {\n return $this->hasMany(Credential::className(), ['id' => 'credential_id'])\n ->viaTable('{{%content_providers_credentials}}', ['content_provider_id' => 'id']);\n }", "function getCredentials($name) {\n $arr_vcap_services = json_decode((string)$_ENV['VCAP_SERVICES']);\n\n foreach ($arr_vcap_services as $type) {\n foreach ($type as $value) {\n if ($value->name == $name) {\n return $value->credentials;\n }\n }\n }\n\n return false;\n}", "public static function checkCredentials()\n {\n static $result = null;\n\n if ($result === null) {\n // Get merchant settings\n $merchantSettings = self::getMerchantSettings();\n\n $result = (is_array($merchantSettings) && !empty($merchantSettings['result']) && self::isValidResponse($merchantSettings));\n if ($result) {\n self::$merchantSettings = $merchantSettings;\n }\n }\n\n return $result;\n }", "public function allCredentialDescriptors(): array;", "protected function credentials(Request $request)\n {\n return $request->only(\n 'email', 'password', 'password_confirmation', 'token'\n );\n }", "protected function credentials(Request $request)\n {\n return $request->only($this->username(), $this->password());\n }", "protected function credentials(Request $request)\n {\n return $request->only($this->username(), 'password');\n }", "protected function credentials(Request $request)\n {\n return $request->only($this->username(), 'password');\n }", "protected function credentials(Request $request)\n {\n return $request->only($this->username(), 'password');\n }", "protected function credentials(Request $request)\n {\n return $request->only($this->username(), 'password');\n }", "protected function credentials(Request $request)\n {\n // return $request->only($this->username(), 'password');\n $credentials = $request->only($this->username(), 'password'); \n $credentials['active'] = 1; \n return $credentials;\n }", "public function accountDetailsNotFilledIn()\n {\n return (empty(Mage::getStoreConfig('easywebshopsms/api_connection/api_host'))\n || empty(Mage::getStoreConfig('easywebshopsms/api_connection/api_user'))\n || empty(Mage::getStoreConfig('easywebshopsms/api_connection/api_pass'))\n || empty(Mage::getStoreConfig('easywebshopsms/api_connection/api_port'))\n );\n }", "private function getCreds()\n {\n $store = Craft::$app->request->getQueryParam('store');\n $suffix = $store ? '_'.$store : '';\n if (!$url = getenv('SHOPIFY_URL'.$suffix)) {\n throw new Exception('Missing SHOPIFY_URL');\n }\n if (!$token = (getenv('SHOPIFY_ADMIN_API_ACCESS_TOKEN'.$suffix) ?:\n getenv('SHOPIFY_API_PASSWORD'.$suffix))) {\n throw new Exception('Missing SHOPIFY_ADMIN_API_ACCESS_TOKEN');\n }\n return [$url, $token];\n }", "protected function credentials(Request $request)\n {\n return $request->only($this->username());\n }", "protected function credentials(Request $request)\n {\n return $request->only($this->username());\n }", "protected function credentials(Request $request)\n {\n return $request->only(\n 'email',\n 'password',\n 'password_confirmation',\n 'token'\n );\n }", "protected function getCredentials(): array\n {\n return [\n 'suite_id' => $this->app['config']['suite_id'],\n 'suite_secret' => $this->app['config']['suite_secret'],\n 'suite_ticket' => $this->app['suite_ticket']->getTicket(),\n ];\n }", "private function isCorrectCredentials ()\n {\n\n try {\n $this->httpClient->request (\"GET\", \"http://livescore-api.com/api-client/users/pair.json?key=\" . $this->apiKey . \"&secret=\" . $this->apiSecret);\n } catch (ClientException $e) {\n $response = json_decode ((string) $e->getResponse ()->getBody (), true);\n\n throw new WrongAPICredentialsException($response['error'], $e->getResponse ()->getStatusCode ());\n }\n }", "function getDbCredentials()\n{ \n return getSettings()['database'];\n}", "private function getRequiredFields()\n\t{\n\t\treturn $this->endpointRequiredFields;\n\t}", "function wpcr_stc_get_credentials($force_check = false) {\n\t// cache the results in the session so we don't do this over and over\n\tif (!$force_check && $_SESSION['wpcr_stc_credentials']) return $_SESSION['wpcr_stc_credentials'];\n\n\t$_SESSION['wpcr_stc_credentials'] = wpcr_stc_do_request('http://twitter.com/account/verify_credentials');\n\n\treturn $_SESSION['wpcr_stc_credentials'];\n}", "public function getRepositoryCredentials()\n {\n // Check for repository credentials\n $repository = $this->credentials->getCurrentRepository();\n $repositoryCredentials = $repository->toArray();\n\n // If we didn't specify a login/password ask for both the first time\n $rules = $this->rules['repository'];\n if ($repository->needsCredentials()) {\n // Else assume the repository is passwordless and only ask again for username\n $rules += ['username' => true, 'password' => true];\n }\n\n // Gather credentials\n $credentials = $this->gatherCredentials($rules, $repositoryCredentials, 'repository');\n\n // Save them to local storage and runtime configuration\n $this->localStorage->set('credentials', $credentials);\n foreach ($credentials as $key => $credential) {\n $this->config->set('scm.'.$key, $credential);\n }\n }", "public function getPermitProperties()\n {\n return $this->permitProperties;\n }", "public function getCredentials(Request $request)\n {\n }" ]
[ "0.67553794", "0.6733583", "0.65361834", "0.6522885", "0.6404021", "0.63979226", "0.6375345", "0.6369883", "0.6301049", "0.62015104", "0.6109007", "0.60724336", "0.6036436", "0.6004592", "0.59602237", "0.59460306", "0.59386134", "0.59190834", "0.59130734", "0.58905697", "0.5844248", "0.5839462", "0.5839017", "0.5811566", "0.5787315", "0.5787315", "0.5762153", "0.5752316", "0.572244", "0.5685175", "0.5679095", "0.56784594", "0.5663312", "0.56034493", "0.5593617", "0.558696", "0.5567459", "0.55649215", "0.5556536", "0.5547154", "0.55279124", "0.55093545", "0.54883826", "0.54883826", "0.54750216", "0.5457477", "0.545663", "0.5454313", "0.54383796", "0.5433381", "0.54217255", "0.54118735", "0.53834534", "0.5375337", "0.5369628", "0.53559935", "0.535568", "0.5330938", "0.5326664", "0.53215504", "0.5319715", "0.5299239", "0.52498984", "0.5243402", "0.5230737", "0.52279043", "0.52277404", "0.5224225", "0.5218958", "0.5212435", "0.5210214", "0.5205839", "0.520147", "0.5199742", "0.519889", "0.5197485", "0.5193919", "0.51802677", "0.5167675", "0.5160107", "0.5157989", "0.5145908", "0.51450217", "0.5141608", "0.5141608", "0.5141608", "0.5141608", "0.51389825", "0.5122371", "0.5101812", "0.5101559", "0.5101559", "0.5083612", "0.5083473", "0.50802284", "0.50656277", "0.50634056", "0.5059306", "0.50468844", "0.5045685", "0.50411075" ]
0.0
-1
For internal only. DO NOT USE IT.
public function deserialize($param) { if ($param === null) { return; } if (array_key_exists("Id",$param) and $param["Id"] !== null) { $this->Id = $param["Id"]; } if (array_key_exists("ComponentName",$param) and $param["ComponentName"] !== null) { $this->ComponentName = $param["ComponentName"]; } if (array_key_exists("ComponentType",$param) and $param["ComponentType"] !== null) { $this->ComponentType = $param["ComponentType"]; } if (array_key_exists("Homepage",$param) and $param["Homepage"] !== null) { $this->Homepage = $param["Homepage"]; } if (array_key_exists("Description",$param) and $param["Description"] !== null) { $this->Description = $param["Description"]; } if (array_key_exists("RequestId",$param) and $param["RequestId"] !== null) { $this->RequestId = $param["RequestId"]; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function __init__() { }", "private function __() {\n }", "protected function init() {}", "protected function init() {}", "protected function init() {}", "protected function init() {}", "protected function init() {}", "protected function init() {}", "protected function init() {}", "protected function init() {}", "protected function init() {}", "protected function init() {}", "protected function init() {}", "protected function init() {}", "private function __construct()\t{}", "private function init()\n\t{\n\t\treturn;\n\t}", "final private function __construct() {}", "final private function __construct() {}", "final private function __construct(){\r\r\n\t}", "final private function __construct() {\n\t\t\t}", "final private function __construct() { }", "final private function __construct() { }", "final private function __construct() { }", "private function _i() {\n }", "protected function fixSelf() {}", "protected function fixSelf() {}", "protected final function __construct() {}", "protected function initialize() {}", "protected function initialize() {}", "protected function initialize() {}", "protected function initialize() {}", "protected function init()\n\t{\n\t\t\n\t}", "private function __construct() {\r\n\t\r\n\t}", "private function __construct() {\r\n\t\t\r\n\t}", "protected function init() {return;}", "final private function __construct()\n\t{\n\t}", "private function __construct () {}", "final private function __construct()\n {\n }", "private final function __construct() {}", "public function __init(){}", "public function helper()\n\t{\n\t\n\t}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct() {}", "private function __construct()\n\t{\n\t\t\n\t}" ]
[ "0.6265989", "0.61516386", "0.5989965", "0.5989965", "0.5989965", "0.5989965", "0.5989498", "0.5989498", "0.5989498", "0.5989498", "0.5989498", "0.5989498", "0.5988486", "0.5988486", "0.5949007", "0.5939891", "0.59164286", "0.59164286", "0.5870319", "0.5867028", "0.5855363", "0.5855363", "0.5855363", "0.57975173", "0.5796267", "0.5796267", "0.57805836", "0.57503694", "0.57503694", "0.57503694", "0.57503694", "0.57456875", "0.57415456", "0.5712637", "0.57024145", "0.56940687", "0.5680332", "0.5674347", "0.5667742", "0.56398326", "0.5638334", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.5626583", "0.56257844", "0.5623449", "0.5623449", "0.5610503" ]
0.0
-1
Change the collation of all tables in the database, even those with a different prefix than your Joomla installation.
public function changeCollation($newCollation = 'utf8_general_ci') { // Make sure we have at least MySQL 4.1.2 $db = $this->container->db; $old_collation = $db->getCollation(); if ($old_collation == 'N/A (mySQL < 4.1.2)') { // We can't change the collation on MySQL versions earlier than 4.1.2 return false; } // Change the collation of the database itself $this->changeDatabaseCollation($newCollation); // Change the collation of each table $tables = $db->getTableList(); // No tables to convert...? if (empty($tables)) { return true; } foreach ($tables as $tableName) { $this->changeTableCollation($tableName, $newCollation); } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function myPear_set_collation(){\n $needed = False;\n if (!$needed) return;\n $c_set = 'utf8';\n $d_col = 'utf8_unicode_ci';\n myPear_db()->qquery(\"ALTER SCHEMA \".myPear_db()->Database.\" DEFAULT CHARACTER SET $c_set DEFAULT COLLATE $d_col\",True);\n foreach(myPear_db()->getTables() as $table){\n b_debug::xxx($table.\"------------------------------------------------\");\n myPear_db()->qquery(\"ALTER TABLE $table CONVERT TO CHARACTER SET $c_set COLLATE $d_col\",True);\n $q = myPear_db()->qquery(\"SHOW COLUMNS FROM $table\",cnf_dev);\n while($r = $this->next_record($q)){\n if (preg_match('/(char|text)/i',strToLower($r['Type']))){\n\tb_debug::xxx($r['Field']);\n\tmyPear_db()->qquery(sprintf(\"ALTER TABLE `%s` CHANGE `%s` `%s` %s CHARACTER SET $c_set COLLATE $d_col %s NULL\",\n\t\t\t\t $r['Field'],$r['Field'],$r['Type'],(strToLower($r['Null']) == 'yes' ? '' : 'NOT')),\n\t\t\t True);\n\t\n }\n }\n }\n}", "function db_change_charset_for_tables($charset = 'utf8', $collate='utf8_general_ci', $data = true){ \n \n if(!trim($charset) || !trim($collate)){\n echo 'No charset selected';\n return;\n }\n \n $CI = &get_instance();\n $query_show_tables = 'SELECT table_name FROM information_schema.tables WHERE table_schema = DATABASE()';//'SHOW TABLES';\n $query_col_collation = 'SHOW FULL COLUMNS FROM %s';\n $tables = $CI->db->query($query_show_tables)->result();\n if(!empty($tables)){\n $CI->db->query(sprintf('SET foreign_key_checks = 0'));\n foreach($tables as $table){\n $table = (array) $table;\n if( isset($table['table_name']) && trim($table['table_name'])){\n $query_collation_generated = sprintf($query_col_collation, $table['table_name']);\n $result_before = $CI->db->query($query_collation_generated)->result();\n db_show_table_column_collations($result_before, $table['table_name']);\n $CI->db->query(sprintf('ALTER TABLE %s CONVERT TO CHARACTER SET '.$charset.' COLLATE '.$collate, $table['table_name']));\n $result_after = $CI->db->query($query_collation_generated)->result();\n db_show_table_column_collations($result_after, $table['table_name'], true);\n }\n }\n $CI->db->query(sprintf('SET foreign_key_checks = 1'));\n }\n \n}", "public function updateTables()\n {\n $prefix = $this->getPrefix();\n $charset = $this->wpdb->get_charset_collate();\n\n foreach ($this->config['tables'] as $table => $createStatement) {\n $sql = str_replace(\n ['{prefix}', '{charset}'],\n [$prefix, $charset],\n $createStatement\n );\n dbDelta($sql);\n }\n }", "private function getCharsetCollate() {\n global $wpdb;\n $this->charsetCollate = $wpdb->get_charset_collate();\n }", "function convert_utf8($echo_results = false)\n\t{\n\t\tglobal $db, $dbname, $table_prefix;\n\n\t\t$db->sql_return_on_error(true);\n\n\t\t$sql = \"ALTER DATABASE {$db->sql_escape($dbname)}\n\t\t\tCHARACTER SET utf8\n\t\t\tDEFAULT CHARACTER SET utf8\n\t\t\tCOLLATE utf8_bin\n\t\t\tDEFAULT COLLATE utf8_bin\";\n\t\t$db->sql_query($sql);\n\n\t\t$sql = \"SHOW TABLES\";\n\t\t$result = $db->sql_query($sql);\n\t\twhile ($row = $db->sql_fetchrow($result))\n\t\t{\n\t\t\t// This assignment doesn't work...\n\t\t\t//$table = $row[0];\n\n\t\t\t$current_item = each($row);\n\t\t\t$table = $current_item['value'];\n\t\t\treset($row);\n\n\t\t\t$sql = \"ALTER TABLE {$db->sql_escape($table)}\n\t\t\t\tDEFAULT CHARACTER SET utf8\n\t\t\t\tCOLLATE utf8_bin\";\n\t\t\t$db->sql_query($sql);\n\n\t\t\tif (!empty($echo_results))\n\t\t\t{\n\t\t\t\techo(\"&bull;&nbsp;Table&nbsp;<b style=\\\"color: #dd2222;\\\">$table</b> converted to UTF-8<br />\\n\");\n\t\t\t}\n\n\t\t\t$sql = \"SHOW FIELDS FROM {$db->sql_escape($table)}\";\n\t\t\t$result_fields = $db->sql_query($sql);\n\n\t\t\twhile ($row_fields = $db->sql_fetchrow($result_fields))\n\t\t\t{\n\t\t\t\t// These assignments don't work...\n\t\t\t\t/*\n\t\t\t\t$field_name = $row_fields[0];\n\t\t\t\t$field_type = $row_fields[1];\n\t\t\t\t$field_null = $row_fields[2];\n\t\t\t\t$field_key = $row_fields[3];\n\t\t\t\t$field_default = $row_fields[4];\n\t\t\t\t$field_extra = $row_fields[5];\n\t\t\t\t*/\n\n\t\t\t\t$field_name = $row_fields['Field'];\n\t\t\t\t$field_type = $row_fields['Type'];\n\t\t\t\t$field_null = $row_fields['Null'];\n\t\t\t\t$field_key = $row_fields['Key'];\n\t\t\t\t$field_default = $row_fields['Default'];\n\t\t\t\t$field_extra = $row_fields['Extra'];\n\n\t\t\t\t// Let's remove BLOB and BINARY for now...\n\t\t\t\t//if ((strpos(strtolower($field_type), 'char') !== false) || (strpos(strtolower($field_type), 'text') !== false) || (strpos(strtolower($field_type), 'blob') !== false) || (strpos(strtolower($field_type), 'binary') !== false))\n\t\t\t\tif ((strpos(strtolower($field_type), 'char') !== false) || (strpos(strtolower($field_type), 'text') !== false))\n\t\t\t\t{\n\t\t\t\t\t//$sql_fields = \"ALTER TABLE {$db->sql_escape($table)} CHANGE \" . $db->sql_escape($field_name) . \" \" . $db->sql_escape($field_name) . \" \" . $db->sql_escape($field_type) . \" CHARACTER SET utf8 COLLATE utf8_bin\";\n\n\t\t\t\t\t$sql_fields = \"ALTER TABLE {$db->sql_escape($table)} CHANGE \" . $db->sql_escape($field_name) . \" \" . $db->sql_escape($field_name) . \" \" . $db->sql_escape($field_type) . \" CHARACTER SET utf8 COLLATE utf8_bin \" . (($field_null != 'YES') ? \"NOT \" : \"\") . \"NULL DEFAULT \" . (($field_default != 'None') ? ((!empty($field_default) || !is_null($field_default)) ? (is_string($field_default) ? (\"'\" . $db->sql_escape($field_default) . \"'\") : $field_default) : (($field_null != 'YES') ? \"''\" : \"NULL\")) : \"''\");\n\t\t\t\t\t$db->sql_query($sql_fields);\n\n\t\t\t\t\tif (!empty($echo_results))\n\t\t\t\t\t{\n\t\t\t\t\t\techo(\"\\t&nbsp;&nbsp;&raquo;&nbsp;Field&nbsp;<b style=\\\"color: #4488aa;\\\">$field_name</b> (in table <b style=\\\"color: #009900;\\\">$table</b>) converted to UTF-8<br />\\n\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!empty($echo_results))\n\t\t\t{\n\t\t\t\techo(\"<br />\\n\");\n\t\t\t\tflush();\n\t\t\t}\n\t\t}\n\n\t\t$db->sql_return_on_error(false);\n\t\treturn true;\n\t}", "private function _convertContentToUTF($prefix, $table)\n {\n\n try {\n $query = 'SET NAMES latin1';\n $this->_db->getConnection()->exec($query);\n\n }catch (\\Exception $e) {\n Analog::log(\n 'Cannot SET NAMES on table `' . $table . '`. ' .\n $e->getMessage(),\n Analog::ERROR\n );\n }\n\n try {\n $select = new \\Zend_Db_Select($this->_db);\n $select->from($table);\n\n $result = $select->query();\n\n $descr = $this->_db->describeTable($table);\n\n $pkeys = array();\n foreach ( $descr as $field ) {\n if ( $field['PRIMARY'] == 1 ) {\n $pos = $field['PRIMARY_POSITION'];\n $pkeys[$pos] = $field['COLUMN_NAME'];\n }\n }\n\n if ( count($pkeys) == 0 ) {\n //no primary key! How to do an update without that?\n //Prior to 0.7, l10n and dynamic_fields tables does not\n //contains any primary key. Since encoding conversion is done\n //_before_ the SQL upgrade, we'll have to manually\n //check these ones\n if (preg_match('/' . $prefix . 'dynamic_fields/', $table) !== 0 ) {\n $pkeys = array(\n 'item_id',\n 'field_id',\n 'field_form',\n 'val_index'\n );\n } else if ( preg_match('/' . $prefix . 'l10n/', $table) !== 0 ) {\n $pkeys = array(\n 'text_orig',\n 'text_locale'\n );\n } else {\n //not a know case, we do not perform any update.\n throw new \\Exception(\n 'Cannot define primary key for table `' . $table .\n '`, aborting'\n );\n }\n }\n\n $r = $result->fetchAll();\n foreach ( $r as $row ) {\n $data = array();\n $where = array();\n\n //build where\n foreach ( $pkeys as $k ) {\n $where[] = $k . ' = ' . $this->_db->quote($row->$k);\n }\n\n //build data\n foreach ( $row as $key => $value ) {\n $data[$key] = $value;\n }\n\n //finally, update data!\n $this->_db->update(\n $table,\n $data,\n $where\n );\n }\n } catch (\\Exception $e) {\n Analog::log(\n 'An error occured while converting contents to UTF-8 for table ' .\n $table . ' (' . $e->getMessage() . ')',\n Analog::ERROR\n );\n }\n }", "private function charset()\n\t{\n\t\tif (isset($this->_conf['charset']) AND $this->_conf['charset'] != '')\n\t\t{\n\t\t\tif (isset($this->_conf['collation']) AND $this->_conf['collation'] != '')\n\t\t\t{\n\t\t\t\t$this->_con->exec('SET NAMES '.$this->_conf['charset'].' COLLATE '.$this->_conf['collation']);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->_con->exec('SET NAMES '.$this->_conf['charset']);\n\t\t\t}\n\t\t}\n\t}", "public static function setupMultilingual()\n {\n $db = JFactory::getDbo();\n $query = $db->getQuery(true);\n $languages = self::getLanguages();\n if (count($languages)) {\n //states table\n $db->setQuery(\"SHOW COLUMNS FROM #__osrs_states\");\n $fields = $db->loadObjectList();\n if (count($fields) > 0) {\n $fieldArr = array();\n for ($i = 0; $i < count($fields); $i++) {\n $field = $fields[$i];\n $fieldname = $field->Field;\n $fieldArr[$i] = $fieldname;\n }\n }\n foreach ($languages as $language) {\n #Process for #__osrs_states table\n $prefix = $language->sef;\n if (!in_array('state_name_' . $prefix, $fieldArr)) {\n $fieldName = 'state_name_' . $prefix;\n $sql = \"ALTER TABLE `#__osrs_states` ADD `$fieldName` VARCHAR( 255 );\";\n $db->setQuery($sql);\n $db->execute();\n }\n }\n\n //cities table\n $db->setQuery(\"SHOW COLUMNS FROM #__osrs_cities\");\n $fields = $db->loadObjectList();\n if (count($fields) > 0) {\n $fieldArr = array();\n for ($i = 0; $i < count($fields); $i++) {\n $field = $fields[$i];\n $fieldname = $field->Field;\n $fieldArr[$i] = $fieldname;\n }\n }\n foreach ($languages as $language) {\n #Process for #__osrs_cities table\n $prefix = $language->sef;\n if (!in_array('city_' . $prefix, $fieldArr)) {\n $fieldName = 'city_' . $prefix;\n $sql = \"ALTER TABLE `#__osrs_cities` ADD `$fieldName` VARCHAR( 255 );\";\n $db->setQuery($sql);\n $db->execute();\n }\n }\n\n\n\t\t\t//cities table\n $db->setQuery(\"SHOW COLUMNS FROM #__osrs_countries\");\n $fields = $db->loadObjectList();\n if (count($fields) > 0) {\n $fieldArr = array();\n for ($i = 0; $i < count($fields); $i++) {\n $field = $fields[$i];\n $fieldname = $field->Field;\n $fieldArr[$i] = $fieldname;\n }\n }\n foreach ($languages as $language) {\n #Process for #__osrs_countries table\n $prefix = $language->sef;\n if (!in_array('country_name_' . $prefix, $fieldArr)) {\n $fieldName = 'country_name_' . $prefix;\n $sql = \"ALTER TABLE `#__osrs_countries` ADD `$fieldName` VARCHAR( 255 );\";\n $db->setQuery($sql);\n $db->execute();\n }\n }\n\n //tags table\n $db->setQuery(\"SHOW COLUMNS FROM #__osrs_tags\");\n $fields = $db->loadObjectList();\n if (count($fields) > 0) {\n $fieldArr = array();\n for ($i = 0; $i < count($fields); $i++) {\n $field = $fields[$i];\n $fieldname = $field->Field;\n $fieldArr[$i] = $fieldname;\n }\n }\n foreach ($languages as $language) {\n #Process for #__osrs_emails table\n $prefix = $language->sef;\n //$fields = array_keys($db->getTableColumns('#__osrs_emails'));\n if (!in_array('keyword_' . $prefix, $fieldArr)) {\n $fieldName = 'keyword_' . $prefix;\n $sql = \"ALTER TABLE `#__osrs_tags` ADD `$fieldName` VARCHAR( 255 );\";\n $db->setQuery($sql);\n $db->execute();\n }\n }\n\n\n //emails table\n $db->setQuery(\"SHOW COLUMNS FROM #__osrs_emails\");\n $fields = $db->loadObjectList();\n if (count($fields) > 0) {\n $fieldArr = array();\n for ($i = 0; $i < count($fields); $i++) {\n $field = $fields[$i];\n $fieldname = $field->Field;\n $fieldArr[$i] = $fieldname;\n }\n }\n foreach ($languages as $language) {\n #Process for #__osrs_emails table\n $prefix = $language->sef;\n //$fields = array_keys($db->getTableColumns('#__osrs_emails'));\n if (!in_array('email_title_' . $prefix, $fieldArr)) {\n $fieldName = 'email_title_' . $prefix;\n $sql = \"ALTER TABLE `#__osrs_emails` ADD `$fieldName` VARCHAR( 255 );\";\n $db->setQuery($sql);\n $db->execute();\n\n $fieldName = 'email_content_' . $prefix;\n $sql = \"ALTER TABLE `#__osrs_emails` ADD `$fieldName` TEXT NULL;\";\n $db->setQuery($sql);\n $db->execute();\n }\n }\n\n //categories table\n $db->setQuery(\"SHOW COLUMNS FROM #__osrs_categories\");\n $fields = $db->loadObjectList();\n if (count($fields) > 0) {\n $fieldArr = array();\n for ($i = 0; $i < count($fields); $i++) {\n $field = $fields[$i];\n $fieldname = $field->Field;\n $fieldArr[$i] = $fieldname;\n }\n }\n foreach ($languages as $language) {\n #Process for #__osrs_categories table\n $prefix = $language->sef;\n if (!in_array('category_name_' . $prefix, $fieldArr)) {\n $fieldName = 'category_name_' . $prefix;\n $sql = \"ALTER TABLE `#__osrs_categories` ADD `$fieldName` VARCHAR( 255 );\";\n $db->setQuery($sql);\n $db->execute();\n\n $fieldName = 'category_alias_' . $prefix;\n $sql = \"ALTER TABLE `#__osrs_categories` ADD `$fieldName` VARCHAR( 255 );\";\n $db->setQuery($sql);\n $db->execute();\n\n $fieldName = 'category_description_' . $prefix;\n $sql = \"ALTER TABLE `#__osrs_categories` ADD `$fieldName` TEXT NULL;\";\n $db->setQuery($sql);\n $db->execute();\n }\n }\n\n\n //amenities table\n $db->setQuery(\"SHOW COLUMNS FROM #__osrs_amenities\");\n $fields = $db->loadObjectList();\n if (count($fields) > 0) {\n $fieldArr = array();\n for ($i = 0; $i < count($fields); $i++) {\n $field = $fields[$i];\n $fieldname = $field->Field;\n $fieldArr[$i] = $fieldname;\n }\n }\n foreach ($languages as $language) {\n #Process for #__osrs_amenities table\n $prefix = $language->sef;\n if (!in_array('amenities_' . $prefix, $fieldArr)) {\n $fieldName = 'amenities_' . $prefix;\n $sql = \"ALTER TABLE `#__osrs_amenities` ADD `$fieldName` VARCHAR( 255 );\";\n $db->setQuery($sql);\n $db->execute();\n }\n }\n\n //field group table\n $db->setQuery(\"SHOW COLUMNS FROM #__osrs_fieldgroups\");\n $fields = $db->loadObjectList();\n if (count($fields) > 0) {\n $fieldArr = array();\n for ($i = 0; $i < count($fields); $i++) {\n $field = $fields[$i];\n $fieldname = $field->Field;\n $fieldArr[$i] = $fieldname;\n }\n }\n foreach ($languages as $language) {\n #Process for #__osrs_amenities table\n $prefix = $language->sef;\n if (!in_array('group_name_' . $prefix, $fieldArr)) {\n $fieldName = 'group_name_' . $prefix;\n $sql = \"ALTER TABLE `#__osrs_fieldgroups` ADD `$fieldName` VARCHAR( 255 );\";\n $db->setQuery($sql);\n $db->execute();\n }\n }\n\n //extra field table\n $db->setQuery(\"SHOW COLUMNS FROM #__osrs_extra_fields\");\n $fields = $db->loadObjectList();\n if (count($fields) > 0) {\n $fieldArr = array();\n for ($i = 0; $i < count($fields); $i++) {\n $field = $fields[$i];\n $fieldname = $field->Field;\n $fieldArr[$i] = $fieldname;\n }\n }\n foreach ($languages as $language) {\n #Process for #__osrs_amenities table\n $prefix = $language->sef;\n if (!in_array('field_label_' . $prefix, $fieldArr)) {\n $fieldName = 'field_label_' . $prefix;\n $sql = \"ALTER TABLE `#__osrs_extra_fields` ADD `$fieldName` VARCHAR( 255 );\";\n $db->setQuery($sql);\n $db->execute();\n\n $fieldName = 'field_description_' . $prefix;\n $sql = \"ALTER TABLE `#__osrs_extra_fields` ADD `$fieldName` TEXT NULL;\";\n $db->setQuery($sql);\n $db->execute();\n }\n }\n\n\n //field group table\n $db->setQuery(\"SHOW COLUMNS FROM #__osrs_extra_field_options\");\n $fields = $db->loadObjectList();\n if (count($fields) > 0) {\n $fieldArr = array();\n for ($i = 0; $i < count($fields); $i++) {\n $field = $fields[$i];\n $fieldname = $field->Field;\n $fieldArr[$i] = $fieldname;\n }\n }\n foreach ($languages as $language) {\n #Process for #__osrs_amenities table\n $prefix = $language->sef;\n if (!in_array('field_option_' . $prefix, $fieldArr)) {\n $fieldName = 'field_option_' . $prefix;\n $sql = \"ALTER TABLE `#__osrs_extra_field_options` ADD `$fieldName` VARCHAR( 255 );\";\n $db->setQuery($sql);\n $db->execute();\n }\n }\n\n //osrs_property_field_value table\n $db->setQuery(\"SHOW COLUMNS FROM #__osrs_property_field_value\");\n $fields = $db->loadObjectList();\n if (count($fields) > 0) {\n $fieldArr = array();\n for ($i = 0; $i < count($fields); $i++) {\n $field = $fields[$i];\n $fieldname = $field->Field;\n $fieldArr[$i] = $fieldname;\n }\n }\n foreach ($languages as $language) {\n #Process for #__osrs_amenities table\n $prefix = $language->sef;\n if (!in_array('value_' . $prefix, $fieldArr)) {\n $fieldName = 'value_' . $prefix;\n $sql = \"ALTER TABLE `#__osrs_property_field_value` ADD `$fieldName` VARCHAR( 255 );\";\n $db->setQuery($sql);\n $db->execute();\n }\n }\n\n //types table\n $db->setQuery(\"SHOW COLUMNS FROM #__osrs_types\");\n $fields = $db->loadObjectList();\n if (count($fields) > 0) {\n $fieldArr = array();\n for ($i = 0; $i < count($fields); $i++) {\n $field = $fields[$i];\n $fieldname = $field->Field;\n $fieldArr[$i] = $fieldname;\n }\n }\n foreach ($languages as $language) {\n #Process for #__osrs_amenities table\n $prefix = $language->sef;\n if (!in_array('type_name_' . $prefix, $fieldArr)) {\n $fieldName = 'type_name_' . $prefix;\n $sql = \"ALTER TABLE `#__osrs_types` ADD `$fieldName` VARCHAR( 255 );\";\n $db->setQuery($sql);\n $db->execute();\n\n $fieldName = 'type_alias_' . $prefix;\n $sql = \"ALTER TABLE `#__osrs_types` ADD `$fieldName` VARCHAR( 255 );\";\n $db->setQuery($sql);\n $db->execute();\n }\n }\n\n\n //properties table\n $db->setQuery(\"SHOW COLUMNS FROM #__osrs_properties\");\n $fields = $db->loadObjectList();\n if (count($fields) > 0) {\n $fieldArr = array();\n for ($i = 0; $i < count($fields); $i++) {\n $field = $fields[$i];\n $fieldname = $field->Field;\n $fieldArr[$i] = $fieldname;\n }\n }\n foreach ($languages as $language) {\n #Process for #__osrs_properties table\n $prefix = $language->sef;\n if (!in_array('pro_name_' . $prefix, $fieldArr)) {\n $fieldName = 'pro_name_' . $prefix;\n $sql = \"ALTER TABLE `#__osrs_properties` ADD `$fieldName` VARCHAR( 255 );\";\n $db->setQuery($sql);\n $db->execute();\n\n $fieldName = 'pro_alias_' . $prefix;\n $sql = \"ALTER TABLE `#__osrs_properties` ADD `$fieldName` VARCHAR( 255 );\";\n $db->setQuery($sql);\n $db->execute();\n }\n if (!in_array('address_' . $prefix, $fieldArr)) {\n $fieldName = 'address_' . $prefix;\n $sql = \"ALTER TABLE `#__osrs_properties` ADD `$fieldName` VARCHAR( 255 );\";\n $db->setQuery($sql);\n $db->execute();\n }\n\t\t\t\tif (!in_array('price_text_' . $prefix, $fieldArr)) {\n $fieldName = 'price_text_' . $prefix;\n $sql = \"ALTER TABLE `#__osrs_properties` ADD `$fieldName` VARCHAR( 255 );\";\n $db->setQuery($sql);\n $db->execute();\n }\n if (!in_array('pro_small_desc_' . $prefix, $fieldArr)) {\n $fieldName = 'pro_small_desc_' . $prefix;\n $sql = \"ALTER TABLE `#__osrs_properties` ADD `$fieldName` TEXT NULL;\";\n $db->setQuery($sql);\n $db->execute();\n\n $fieldName = 'pro_full_desc_' . $prefix;\n $sql = \"ALTER TABLE `#__osrs_properties` ADD `$fieldName` TEXT NULL;\";\n $db->setQuery($sql);\n $db->execute();\n }\n if (!in_array('metadesc_' . $prefix, $fieldArr)) {\n $fieldName = 'metadesc_' . $prefix;\n $sql = \"ALTER TABLE `#__osrs_properties` ADD `$fieldName` VARCHAR (255) DEFAULT '' NOT NULL;\";\n $db->setQuery($sql);\n $db->execute();\n\n $fieldName = 'metakey_' . $prefix;\n $sql = \"ALTER TABLE `#__osrs_properties` ADD `$fieldName` VARCHAR (255) DEFAULT '' NOT NULL;\";\n $db->setQuery($sql);\n $db->execute();\n }\n\t\t\t\tif (!in_array('pro_browser_title_' . $prefix, $fieldArr)) {\n $fieldName = 'pro_browser_title_' . $prefix;\n $sql = \"ALTER TABLE `#__osrs_properties` ADD `$fieldName` VARCHAR( 255 ) DEFAULT '' NOT NULL;\";\n $db->setQuery($sql);\n $db->execute();\n }\n }\n\n //types table\n $db->setQuery(\"SHOW COLUMNS FROM #__osrs_agents\");\n $fields = $db->loadObjectList();\n if (count($fields) > 0) {\n $fieldArr = array();\n for ($i = 0; $i < count($fields); $i++) {\n $field = $fields[$i];\n $fieldname = $field->Field;\n $fieldArr[$i] = $fieldname;\n }\n }\n foreach ($languages as $language) {\n #Process for #__osrs_amenities table\n $prefix = $language->sef;\n if (!in_array('bio_' . $prefix, $fieldArr)) {\n $fieldName = 'bio_' . $prefix;\n $sql = \"ALTER TABLE `#__osrs_agents` ADD `$fieldName` TEXT NULL;\";\n $db->setQuery($sql);\n $db->execute();\n }\n }\n\n\n //companies table\n $db->setQuery(\"SHOW COLUMNS FROM #__osrs_companies\");\n $fields = $db->loadObjectList();\n if (count($fields) > 0) {\n $fieldArr = array();\n for ($i = 0; $i < count($fields); $i++) {\n $field = $fields[$i];\n $fieldname = $field->Field;\n $fieldArr[$i] = $fieldname;\n }\n }\n foreach ($languages as $language) {\n #Process for #__osrs_amenities table\n $prefix = $language->sef;\n if (!in_array('company_description_' . $prefix, $fieldArr)) {\n $fieldName = 'company_description_' . $prefix;\n $sql = \"ALTER TABLE `#__osrs_companies` ADD `$fieldName` TEXT NULL;\";\n $db->setQuery($sql);\n $db->execute();\n }\n }\n\n }\n }", "private function changeTableCollation($tableName, $newCollation, $changeColumns = true)\n\t{\n\t\t$db = $this->container->db;\n\t\t$collationParts = explode('_', $newCollation);\n\t\t$charset = $collationParts[0];\n\n\t\t// Change the collation of the table itself.\n\t\t$this->query(sprintf(\n\t\t\t\"ALTER TABLE %s CONVERT TO CHARACTER SET %s COLLATE %s\",\n\t\t\t$db->qn($tableName),\n\t\t\t$charset,\n\t\t\t$newCollation\n\t\t));\n\n\t\t// Are we told not to bother with text columns?\n\t\tif (!$changeColumns)\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\t// Convert each text column\n\t\ttry\n\t\t{\n\t\t\t$columns = $db->getTableColumns($tableName, false);\n\t\t}\n\t\tcatch (RuntimeException $e)\n\t\t{\n\t\t\t$columns = [];\n\t\t}\n\n\t\t// The table is broken or MySQL cannot report any columns for it. Early return.\n\t\tif (!is_array($columns) || empty($columns))\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\t$modifyColumns = [];\n\n\t\tforeach ($columns as $col)\n\t\t{\n\t\t\t// Make sure we are redefining only columns which do support a collation\n\t\t\tif (empty($col->Collation))\n\t\t\t{\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$modifyColumns[] = sprintf(\"MODIFY COLUMN %s %s %s %s COLLATE %s\",\n\t\t\t\t$db->qn($col->Field),\n\t\t\t\t$col->Type,\n\t\t\t\t(strtoupper($col->Null) == 'YES') ? 'NULL' : 'NOT NULL',\n\t\t\t\tis_null($col->Default) ? '' : sprintf('DEFAULT %s', $db->q($col->Default)),\n\t\t\t\t$newCollation\n\t\t\t);\n\t\t}\n\n\t\t// No text columns to modify? Return immediately.\n\t\tif (empty($modifyColumns))\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\t// Issue an ALTER TABLE statement which modifies all text columns.\n\t\t$this->query(sprintf(\n\t\t\t'ALTER TABLE %s %s',\n\t\t\t$db->qn($tableName),\n\t\t\timplode(', ', $modifyColumns\n\t\t\t)));\n\t}", "function upgrade_373_mysql() { # MySQL only\n $table_domain = table_by_key ('domain');\n $table_mailbox = table_by_key('mailbox');\n\n $all_sql = explode(\"\\n\", trim(\"\n ALTER TABLE `$table_domain` CHANGE `description` `description` VARCHAR( 255 ) {UTF-8} NOT NULL\n ALTER TABLE `$table_mailbox` CHANGE `name` `name` VARCHAR( 255 ) {UTF-8} NOT NULL\n \"));\n\n foreach ($all_sql as $sql) {\n $result = db_query_parsed($sql);\n }\n}", "public function setDatabaseCharsetAndCollation($options = array()) {\n $sql = 'ALTER DATABASE `'. $this->_dbName .'`\n CHARACTER SET '. db::CHARSET .'\n COLLATE '. db::COLLATION;\n\n return $this->execute($sql, $options);\n }", "private function changeDatabaseCollation($newCollation)\n\t{\n\t\t$db = $this->container->db;\n\t\t$collationParts = explode('_', $newCollation);\n\t\t$charset = $collationParts[0];\n\t\t$dbName = $this->container->platform->getConfig()->get('db');\n\n\t\t$this->query(sprintf(\n\t\t\t\"ALTER DATABASE %s CHARACTER SET = %s COLLATE = %s\",\n\t\t\t$db->qn($dbName),\n\t\t\t$charset,\n\t\t\t$newCollation\n\t\t));\n\t}", "public static function setCharsetEncoding () {\r\n\t\tif ( self::$instance == null ) {\r\n\t\t\tself::getInstance ();\r\n\t\t}\r\n\t\tself::$instance->exec (\r\n\t\t\t\"SET NAMES 'utf8';\r\n\t\t\tSET character_set_connection=utf8;\r\n\t\t\tSET character_set_client=utf8;\r\n\t\t\tSET character_set_results=utf8\" );\r\n\t}", "function set_content_columns($table_name) {\n\t\t\t$this->content_columns = $this->content_columns_all = self::$db->table_info($table_name);\n\t\t\t$table_name_i18n = $table_name.$this->i18n_table_suffix;\n\n\t\t\tif($this->is_i18n && self::$db->table_exists($table_name_i18n)) {\n\t\t\t\t$reserved_columns = $this->i18n_reserved_columns;\n\t\t\t\t$this->content_columns_i18n = $i18n_columns = self::$db->table_info($table_name_i18n);\n\t\t\t\t$this->content_columns_all = array_merge($this->content_columns, $i18n_columns);\n\n\t\t\t\tforeach($i18n_columns as $key => $col) {\n\t\t\t\t\tif(in_array($col['name'], $reserved_columns)) {\n\t\t\t\t\t\tunset($i18n_columns[$key]);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$this->i18n_column_names[] = $col['name'];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$this->i18n_table = $table_name_i18n;\n\t\t\t} else {\n\t\t\t\t$this->is_i18n = false;\n\t\t\t}\n\t\t}", "public function up(Schema $schema) : void\n {\n $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \\'mysql\\'.');\n\n $sql = \"CREATE FUNCTION `remove_accents`(`str` TEXT)\"\n .\" RETURNS text\"\n .\" LANGUAGE SQL\"\n .\" DETERMINISTIC\"\n .\" NO SQL\"\n .\" SQL SECURITY INVOKER\"\n .\" COMMENT ''\"\n .\" BEGIN\"\n .\"\"\n .\" SET str = REPLACE(str,'Š','S');\"\n .\" SET str = REPLACE(str,'š','s');\"\n .\" SET str = REPLACE(str,'Ð','Dj');\"\n .\" SET str = REPLACE(str,'Ž','Z');\"\n .\" SET str = REPLACE(str,'ž','z');\"\n .\" SET str = REPLACE(str,'À','A');\"\n .\" SET str = REPLACE(str,'Á','A');\"\n .\" SET str = REPLACE(str,'Â','A');\"\n .\" SET str = REPLACE(str,'Ã','A');\"\n .\" SET str = REPLACE(str,'Ä','A');\"\n .\" SET str = REPLACE(str,'Å','A');\"\n .\" SET str = REPLACE(str,'Æ','A');\"\n .\" SET str = REPLACE(str,'Ç','C');\"\n .\" SET str = REPLACE(str,'È','E');\"\n .\" SET str = REPLACE(str,'É','E');\"\n .\" SET str = REPLACE(str,'Ê','E');\"\n .\" SET str = REPLACE(str,'Ë','E');\"\n .\" SET str = REPLACE(str,'Ì','I');\"\n .\" SET str = REPLACE(str,'Í','I');\"\n .\" SET str = REPLACE(str,'Î','I');\"\n .\" SET str = REPLACE(str,'Ï','I');\"\n .\" SET str = REPLACE(str,'Ñ','N');\"\n .\" SET str = REPLACE(str,'Ò','O');\"\n .\" SET str = REPLACE(str,'Ó','O');\"\n .\" SET str = REPLACE(str,'Ô','O');\"\n .\" SET str = REPLACE(str,'Õ','O');\"\n .\" SET str = REPLACE(str,'Ö','O');\"\n .\" SET str = REPLACE(str,'Ø','O');\"\n .\" SET str = REPLACE(str,'Ù','U');\"\n .\" SET str = REPLACE(str,'Ú','U');\"\n .\" SET str = REPLACE(str,'Û','U');\"\n .\" SET str = REPLACE(str,'Ü','U');\"\n .\" SET str = REPLACE(str,'Ý','Y');\"\n .\" SET str = REPLACE(str,'Þ','B');\"\n .\" SET str = REPLACE(str,'ß','Ss');\"\n .\" SET str = REPLACE(str,'à','a');\"\n .\" SET str = REPLACE(str,'á','a');\"\n .\" SET str = REPLACE(str,'â','a');\"\n .\" SET str = REPLACE(str,'ã','a');\"\n .\" SET str = REPLACE(str,'ä','a');\"\n .\" SET str = REPLACE(str,'å','a');\"\n .\" SET str = REPLACE(str,'æ','a');\"\n .\" SET str = REPLACE(str,'ç','c');\"\n .\" SET str = REPLACE(str,'è','e');\"\n .\" SET str = REPLACE(str,'é','e');\"\n .\" SET str = REPLACE(str,'ê','e');\"\n .\" SET str = REPLACE(str,'ë','e');\"\n .\" SET str = REPLACE(str,'ì','i');\"\n .\" SET str = REPLACE(str,'í','i');\"\n .\" SET str = REPLACE(str,'î','i');\"\n .\" SET str = REPLACE(str,'ï','i');\"\n .\" SET str = REPLACE(str,'ð','o');\"\n .\" SET str = REPLACE(str,'ñ','n');\"\n .\" SET str = REPLACE(str,'ò','o');\"\n .\" SET str = REPLACE(str,'ó','o');\"\n .\" SET str = REPLACE(str,'ô','o');\"\n .\" SET str = REPLACE(str,'õ','o');\"\n .\" SET str = REPLACE(str,'ö','o');\"\n .\" SET str = REPLACE(str,'ø','o');\"\n .\" SET str = REPLACE(str,'ù','u');\"\n .\" SET str = REPLACE(str,'ú','u');\"\n .\" SET str = REPLACE(str,'û','u');\"\n .\" SET str = REPLACE(str,'ý','y');\"\n .\" SET str = REPLACE(str,'ý','y');\"\n .\" SET str = REPLACE(str,'þ','b');\"\n .\" SET str = REPLACE(str,'ÿ','y');\"\n .\" SET str = REPLACE(str,'ƒ','f');\"\n .\" RETURN str;\"\n .\" END\"\n ;\n \n $this->addSql($sql);\n }", "final public function setUTF() {\n mysqli_query($this->resourceId,\"SET NAMES 'utf8'\");\n }", "function maybe_convert_table_to_utf8mb4($table)\n {\n }", "function db_upgrade_all($iOldDBVersion) {\n /// This function does anything necessary to upgrade\n /// older versions to match current functionality\n global $modifyoutput;\n Yii::app()->loadHelper('database');\n\n $sUserTemplateRootDir = Yii::app()->getConfig('usertemplaterootdir');\n $sStandardTemplateRootDir = Yii::app()->getConfig('standardtemplaterootdir');\n echo str_pad(gT('The LimeSurvey database is being upgraded').' ('.date('Y-m-d H:i:s').')',14096).\".<br /><br />\". gT('Please be patient...').\"<br /><br />\\n\";\n\n $oDB = Yii::app()->getDb();\n $oDB->schemaCachingDuration=0; // Deactivate schema caching\n $oTransaction = $oDB->beginTransaction();\n try\n {\n if ($iOldDBVersion < 111)\n {\n // Language upgrades from version 110 to 111 because the language names did change\n\n $aOldNewLanguages=array('german_informal'=>'german-informal',\n 'cns'=>'cn-Hans',\n 'cnt'=>'cn-Hant',\n 'pt_br'=>'pt-BR',\n 'gr'=>'el',\n 'jp'=>'ja',\n 'si'=>'sl',\n 'se'=>'sv',\n 'vn'=>'vi');\n foreach ($aOldNewLanguages as $sOldLanguageCode=>$sNewLanguageCode)\n {\n alterLanguageCode($sOldLanguageCode,$sNewLanguageCode);\n }\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>111),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 112) {\n // New size of the username field (it was previously 20 chars wide)\n $oDB->createCommand()->alterColumn('{{users}}','users_name',\"string(64) NOT NULL\");\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>112),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 113) {\n //Fixes the collation for the complete DB, tables and columns\n\n if (Yii::app()->db->driverName=='mysql')\n {\n $sDatabaseName=getDBConnectionStringProperty('dbname');\n fixMySQLCollations();\n modifyDatabase(\"\",\"ALTER DATABASE `$sDatabaseName` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;\");echo $modifyoutput; flush();@ob_flush();\n }\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>113),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 114) {\n $oDB->createCommand()->alterColumn('{{saved_control}}','email',\"string(320) NOT NULL\");\n $oDB->createCommand()->alterColumn('{{surveys}}','adminemail',\"string(320) NOT NULL\");\n $oDB->createCommand()->alterColumn('{{users}}','email',\"string(320) NOT NULL\");\n $oDB->createCommand()->insert('{{settings_global}}',array('stg_name'=>'SessionName','stg_value'=>randomChars(64,'ABCDEFGHIJKLMNOPQRSTUVWXYZ!\"$%&/()=?`+*~#\",;.:abcdefghijklmnopqrstuvwxyz123456789')));\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>114),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 126) {\n\n addColumn('{{surveys}}','printanswers',\"string(1) default 'N'\");\n addColumn('{{surveys}}','listpublic',\"string(1) default 'N'\");\n\n upgradeSurveyTables126();\n upgradeTokenTables126();\n\n // Create quota table\n $oDB->createCommand()->createTable('{{quota}}',array(\n 'id' => 'pk',\n 'sid' => 'integer',\n 'qlimit' => 'integer',\n 'name' => 'string',\n 'action' => 'integer',\n 'active' => 'integer NOT NULL DEFAULT 1'\n ));\n\n // Create quota_members table\n $oDB->createCommand()->createTable('{{quota_members}}',array(\n 'id' => 'pk',\n 'sid' => 'integer',\n 'qid' => 'integer',\n 'quota_id' => 'integer',\n 'code' => 'string(5)'\n ));\n $oDB->createCommand()->createIndex('sid','{{quota_members}}','sid,qid,quota_id,code',true);\n\n\n // Create templates_rights table\n $oDB->createCommand()->createTable('{{templates_rights}}',array(\n 'uid' => 'integer NOT NULL',\n 'folder' => 'string NOT NULL',\n 'use' => 'integer',\n 'PRIMARY KEY (uid, folder)'\n ));\n\n // Create templates table\n $oDB->createCommand()->createTable('{{templates}}',array(\n 'folder' => 'string NOT NULL',\n 'creator' => 'integer NOT NULL',\n 'PRIMARY KEY (folder)'\n ));\n\n // Rename Norwegian language codes\n alterLanguageCode('no','nb');\n\n addColumn('{{surveys}}','htmlemail',\"string(1) default 'N'\");\n addColumn('{{surveys}}','tokenanswerspersistence',\"string(1) default 'N'\");\n addColumn('{{surveys}}','usecaptcha',\"string(1) default 'N'\");\n addColumn('{{surveys}}','bounce_email','text');\n addColumn('{{users}}','htmleditormode',\"string(7) default 'default'\");\n addColumn('{{users}}','superadmin',\"integer NOT NULL default '0'\");\n addColumn('{{questions}}','lid1',\"integer NOT NULL default '0'\");\n\n alterColumn('{{conditions}}','value',\"string\",false,'');\n alterColumn('{{labels}}','title',\"text\");\n\n $oDB->createCommand()->update('{{users}}',array('superadmin'=>1),\"create_survey=1 AND create_user=1 AND move_user=1 AND delete_user=1 AND configurator=1\");\n $oDB->createCommand()->update('{{conditions}}',array('method'=>'=='),\"(method is null) or method='' or method='0'\");\n\n dropColumn('{{users}}','move_user');\n\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>126),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 127) {\n modifyDatabase(\"\",\"create index answers_idx2 on {{answers}} (sortorder)\"); echo $modifyoutput;\n modifyDatabase(\"\",\"create index assessments_idx2 on {{assessments}} (sid)\"); echo $modifyoutput;\n modifyDatabase(\"\",\"create index assessments_idx3 on {{assessments}} (gid)\"); echo $modifyoutput;\n modifyDatabase(\"\",\"create index conditions_idx2 on {{conditions}} (qid)\"); echo $modifyoutput;\n modifyDatabase(\"\",\"create index conditions_idx3 on {{conditions}} (cqid)\"); echo $modifyoutput;\n modifyDatabase(\"\",\"create index groups_idx2 on {{groups}} (sid)\"); echo $modifyoutput;\n modifyDatabase(\"\",\"create index question_attributes_idx2 on {{question_attributes}} (qid)\"); echo $modifyoutput;\n modifyDatabase(\"\",\"create index questions_idx2 on {{questions}} (sid)\"); echo $modifyoutput;\n modifyDatabase(\"\",\"create index questions_idx3 on {{questions}} (gid)\"); echo $modifyoutput;\n modifyDatabase(\"\",\"create index questions_idx4 on {{questions}} (type)\"); echo $modifyoutput;\n modifyDatabase(\"\",\"create index quota_idx2 on {{quota}} (sid)\"); echo $modifyoutput;\n modifyDatabase(\"\",\"create index saved_control_idx2 on {{saved_control}} (sid)\"); echo $modifyoutput;\n modifyDatabase(\"\",\"create index user_in_groups_idx1 on {{user_in_groups}} (ugid, uid)\"); echo $modifyoutput;\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>127),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 128) {\n upgradeTokens128();\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>128),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 129) {\n addColumn('{{surveys}}','startdate',\"datetime\");\n addColumn('{{surveys}}','usestartdate',\"string(1) NOT NULL default 'N'\");\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>129),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 130)\n {\n addColumn('{{conditions}}','scenario',\"integer NOT NULL default '1'\");\n $oDB->createCommand()->update('{{conditions}}',array('scenario'=>'1'),\"(scenario is null) or scenario=0\");\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>130),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 131)\n {\n addColumn('{{surveys}}','publicstatistics',\"string(1) NOT NULL default 'N'\");\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>131),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 132)\n {\n addColumn('{{surveys}}','publicgraphs',\"string(1) NOT NULL default 'N'\");\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>132),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 133)\n {\n addColumn('{{users}}','one_time_pw','binary');\n // Add new assessment setting\n addColumn('{{surveys}}','assessments',\"string(1) NOT NULL default 'N'\");\n // add new assessment value fields to answers & labels\n addColumn('{{answers}}','assessment_value',\"integer NOT NULL default '0'\");\n addColumn('{{labels}}','assessment_value',\"integer NOT NULL default '0'\");\n // copy any valid codes from code field to assessment field\n switch (Yii::app()->db->driverName){\n case 'mysql':\n case 'mysqli':\n $oDB->createCommand(\"UPDATE {{answers}} SET assessment_value=CAST(`code` as SIGNED) where `code` REGEXP '^-?[0-9]+$'\")->execute();\n $oDB->createCommand(\"UPDATE {{labels}} SET assessment_value=CAST(`code` as SIGNED) where `code` REGEXP '^-?[0-9]+$'\")->execute();\n // copy assessment link to message since from now on we will have HTML assignment messages\n $oDB->createCommand(\"UPDATE {{assessments}} set message=concat(replace(message,'/''',''''),'<br /><a href=\\\"',link,'\\\">',link,'</a>')\")->execute();\n break;\n case 'sqlsrv':\n case 'dblib':\n case 'mssql':\n try{\n $oDB->createCommand(\"UPDATE {{answers}} SET assessment_value=CAST([code] as int) WHERE ISNUMERIC([code])=1\")->execute();\n $oDB->createCommand(\"UPDATE {{labels}} SET assessment_value=CAST([code] as int) WHERE ISNUMERIC([code])=1\")->execute();\n } catch(Exception $e){};\n // copy assessment link to message since from now on we will have HTML assignment messages\n alterColumn('{{assessments}}','link',\"text\",false);\n alterColumn('{{assessments}}','message',\"text\",false);\n $oDB->createCommand(\"UPDATE {{assessments}} set message=replace(message,'/''','''')+'<br /><a href=\\\"'+link+'\\\">'+link+'</a>'\")->execute();\n break;\n case 'pgsql':\n $oDB->createCommand(\"UPDATE {{answers}} SET assessment_value=CAST(code as integer) where code ~ '^[0-9]+'\")->execute();\n $oDB->createCommand(\"UPDATE {{labels}} SET assessment_value=CAST(code as integer) where code ~ '^[0-9]+'\")->execute();\n // copy assessment link to message since from now on we will have HTML assignment messages\n $oDB->createCommand(\"UPDATE {{assessments}} set message=replace(message,'/''','''')||'<br /><a href=\\\"'||link||'\\\">'||link||'</a>'\")->execute();\n break;\n default: die('Unknown database type');\n }\n // activate assessment where assessment rules exist\n $oDB->createCommand(\"UPDATE {{surveys}} SET assessments='Y' where sid in (SELECT sid FROM {{assessments}} group by sid)\")->execute();\n // add language field to assessment table\n addColumn('{{assessments}}','language',\"string(20) NOT NULL default 'en'\");\n // update language field with default language of that particular survey\n $oDB->createCommand(\"UPDATE {{assessments}} SET language=(select language from {{surveys}} where sid={{assessments}}.sid)\")->execute();\n // drop the old link field\n dropColumn('{{assessments}}','link');\n\n // Add new fields to survey language settings\n addColumn('{{surveys_languagesettings}}','surveyls_url',\"string\");\n addColumn('{{surveys_languagesettings}}','surveyls_endtext','text');\n // copy old URL fields ot language specific entries\n $oDB->createCommand(\"UPDATE {{surveys_languagesettings}} set surveyls_url=(select url from {{surveys}} where sid={{surveys_languagesettings}}.surveyls_survey_id)\")->execute();\n // drop old URL field\n dropColumn('{{surveys}}','url');\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>133),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 134)\n {\n // Add new tokens setting\n addColumn('{{surveys}}','usetokens',\"string(1) NOT NULL default 'N'\");\n addColumn('{{surveys}}','attributedescriptions','text');\n dropColumn('{{surveys}}','attribute1');\n dropColumn('{{surveys}}','attribute2');\n upgradeTokenTables134();\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>134),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 135)\n {\n alterColumn('{{question_attributes}}','value','text');\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>135),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 136) //New Quota Functions\n {\n addColumn('{{quota}}','autoload_url',\"integer NOT NULL default 0\");\n // Create quota table\n $aFields = array(\n 'quotals_id' => 'pk',\n 'quotals_quota_id' => 'integer NOT NULL DEFAULT 0',\n 'quotals_language' => \"string(45) NOT NULL default 'en'\",\n 'quotals_name' => 'string',\n 'quotals_message' => 'text NOT NULL',\n 'quotals_url' => 'string',\n 'quotals_urldescrip' => 'string',\n );\n $oDB->createCommand()->createTable('{{quota_languagesettings}}',$aFields);\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>136),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 137) //New Quota Functions\n {\n addColumn('{{surveys_languagesettings}}','surveyls_dateformat',\"integer NOT NULL default 1\");\n addColumn('{{users}}','dateformat',\"integer NOT NULL default 1\");\n $oDB->createCommand()->update('{{surveys}}',array('startdate'=>NULL),\"usestartdate='N'\");\n $oDB->createCommand()->update('{{surveys}}',array('expires'=>NULL),\"useexpiry='N'\");\n dropColumn('{{surveys}}','useexpiry');\n dropColumn('{{surveys}}','usestartdate');\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>137),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 138) //Modify quota field\n {\n alterColumn('{{quota_members}}','code',\"string(11)\");\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>138),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 139) //Modify quota field\n {\n upgradeSurveyTables139();\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>139),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 140) //Modify surveys table\n {\n addColumn('{{surveys}}','emailresponseto','text');\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>140),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 141) //Modify surveys table\n {\n addColumn('{{surveys}}','tokenlength','integer NOT NULL default 15');\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>141),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 142) //Modify surveys table\n {\n upgradeQuestionAttributes142();\n $oDB->createCommand()->alterColumn('{{surveys}}','expires',\"datetime\");\n $oDB->createCommand()->alterColumn('{{surveys}}','startdate',\"datetime\");\n $oDB->createCommand()->update('{{question_attributes}}',array('value'=>0),\"value='false'\");\n $oDB->createCommand()->update('{{question_attributes}}',array('value'=>1),\"value='true'\");\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>142),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 143)\n {\n addColumn('{{questions}}','parent_qid','integer NOT NULL default 0');\n addColumn('{{answers}}','scale_id','integer NOT NULL default 0');\n addColumn('{{questions}}','scale_id','integer NOT NULL default 0');\n addColumn('{{questions}}','same_default','integer NOT NULL default 0');\n dropPrimaryKey('answers');\n addPrimaryKey('answers', array('qid','code','language','scale_id'));\n\n $aFields = array(\n 'qid' => \"integer NOT NULL default 0\",\n 'scale_id' => 'integer NOT NULL default 0',\n 'sqid' => 'integer NOT NULL default 0',\n 'language' => 'string(20) NOT NULL',\n 'specialtype' => \"string(20) NOT NULL default ''\",\n 'defaultvalue' => 'text',\n );\n $oDB->createCommand()->createTable('{{defaultvalues}}',$aFields);\n addPrimaryKey('defaultvalues', array('qid','specialtype','language','scale_id','sqid'));\n\n // -Move all 'answers' that are subquestions to the questions table\n // -Move all 'labels' that are answers to the answers table\n // -Transscribe the default values where applicable\n // -Move default values from answers to questions\n upgradeTables143();\n\n dropColumn('{{answers}}','default_value');\n dropColumn('{{questions}}','lid');\n dropColumn('{{questions}}','lid1');\n\n $aFields = array(\n 'sesskey' => \"string(64) NOT NULL DEFAULT ''\",\n 'expiry' => \"datetime NOT NULL\",\n 'expireref' => \"string(250) DEFAULT ''\",\n 'created' => \"datetime NOT NULL\",\n 'modified' => \"datetime NOT NULL\",\n 'sessdata' => 'text'\n );\n $oDB->createCommand()->createTable('{{sessions}}',$aFields);\n addPrimaryKey('sessions',array('sesskey'));\n $oDB->createCommand()->createIndex('sess2_expiry','{{sessions}}','expiry');\n $oDB->createCommand()->createIndex('sess2_expireref','{{sessions}}','expireref');\n // Move all user templates to the new user template directory\n echo \"<br>\".sprintf(gT(\"Moving user templates to new location at %s...\"),$sUserTemplateRootDir).\"<br />\";\n $hTemplateDirectory = opendir($sStandardTemplateRootDir);\n $aFailedTemplates=array();\n // get each entry\n while($entryName = readdir($hTemplateDirectory)) {\n if (!in_array($entryName,array('.','..','.svn')) && is_dir($sStandardTemplateRootDir.DIRECTORY_SEPARATOR.$entryName) && !isStandardTemplate($entryName))\n {\n if (!rename($sStandardTemplateRootDir.DIRECTORY_SEPARATOR.$entryName,$sUserTemplateRootDir.DIRECTORY_SEPARATOR.$entryName))\n {\n $aFailedTemplates[]=$entryName;\n };\n }\n }\n if (count($aFailedTemplates)>0)\n {\n echo \"The following templates at {$sStandardTemplateRootDir} could not be moved to the new location at {$sUserTemplateRootDir}:<br /><ul>\";\n foreach ($aFailedTemplates as $sFailedTemplate)\n {\n echo \"<li>{$sFailedTemplate}</li>\";\n }\n echo \"</ul>Please move these templates manually after the upgrade has finished.<br />\";\n }\n // close directory\n closedir($hTemplateDirectory);\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>143),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 145)\n {\n addColumn('{{surveys}}','savetimings',\"string(1) NULL default 'N'\");\n addColumn('{{surveys}}','showXquestions',\"string(1) NULL default 'Y'\");\n addColumn('{{surveys}}','showgroupinfo',\"string(1) NULL default 'B'\");\n addColumn('{{surveys}}','shownoanswer',\"string(1) NULL default 'Y'\");\n addColumn('{{surveys}}','showqnumcode',\"string(1) NULL default 'X'\");\n addColumn('{{surveys}}','bouncetime','integer');\n addColumn('{{surveys}}','bounceprocessing',\"string(1) NULL default 'N'\");\n addColumn('{{surveys}}','bounceaccounttype',\"string(4)\");\n addColumn('{{surveys}}','bounceaccounthost',\"string(200)\");\n addColumn('{{surveys}}','bounceaccountpass',\"string(100)\");\n addColumn('{{surveys}}','bounceaccountencryption',\"string(3)\");\n addColumn('{{surveys}}','bounceaccountuser',\"string(200)\");\n addColumn('{{surveys}}','showwelcome',\"string(1) default 'Y'\");\n addColumn('{{surveys}}','showprogress',\"string(1) default 'Y'\");\n addColumn('{{surveys}}','allowjumps',\"string(1) default 'N'\");\n addColumn('{{surveys}}','navigationdelay',\"integer default 0\");\n addColumn('{{surveys}}','nokeyboard',\"string(1) default 'N'\");\n addColumn('{{surveys}}','alloweditaftercompletion',\"string(1) default 'N'\");\n\n\n $aFields = array(\n 'sid' => \"integer NOT NULL\",\n 'uid' => \"integer NOT NULL\",\n 'permission' => 'string(20) NOT NULL',\n 'create_p' => \"integer NOT NULL default 0\",\n 'read_p' => \"integer NOT NULL default 0\",\n 'update_p' => \"integer NOT NULL default 0\",\n 'delete_p' => \"integer NOT NULL default 0\",\n 'import_p' => \"integer NOT NULL default 0\",\n 'export_p' => \"integer NOT NULL default 0\"\n );\n $oDB->createCommand()->createTable('{{survey_permissions}}',$aFields);\n addPrimaryKey('survey_permissions', array('sid','uid','permission'));\n\n upgradeSurveyPermissions145();\n\n // drop the old survey rights table\n $oDB->createCommand()->dropTable('{{surveys_rights}}');\n\n // Add new fields for email templates\n addColumn('{{surveys_languagesettings}}','email_admin_notification_subj',\"string\");\n addColumn('{{surveys_languagesettings}}','email_admin_responses_subj',\"string\");\n addColumn('{{surveys_languagesettings}}','email_admin_notification',\"text\");\n addColumn('{{surveys_languagesettings}}','email_admin_responses',\"text\");\n\n //Add index to questions table to speed up subquestions\n $oDB->createCommand()->createIndex('parent_qid_idx','{{questions}}','parent_qid');\n\n addColumn('{{surveys}}','emailnotificationto',\"text\");\n\n upgradeSurveys145();\n dropColumn('{{surveys}}','notification');\n alterColumn('{{conditions}}','method',\"string(5)\",false,'');\n\n $oDB->createCommand()->renameColumn('{{surveys}}','private','anonymized');\n $oDB->createCommand()->update('{{surveys}}',array('anonymized'=>'N'),\"anonymized is NULL\");\n alterColumn('{{surveys}}','anonymized',\"string(1)\",false,'N');\n\n //now we clean up things that were not properly set in previous DB upgrades\n $oDB->createCommand()->update('{{answers}}',array('answer'=>''),\"answer is NULL\");\n $oDB->createCommand()->update('{{assessments}}',array('scope'=>''),\"scope is NULL\");\n $oDB->createCommand()->update('{{assessments}}',array('name'=>''),\"name is NULL\");\n $oDB->createCommand()->update('{{assessments}}',array('message'=>''),\"message is NULL\");\n $oDB->createCommand()->update('{{assessments}}',array('minimum'=>''),\"minimum is NULL\");\n $oDB->createCommand()->update('{{assessments}}',array('maximum'=>''),\"maximum is NULL\");\n $oDB->createCommand()->update('{{groups}}',array('group_name'=>''),\"group_name is NULL\");\n $oDB->createCommand()->update('{{labels}}',array('code'=>''),\"code is NULL\");\n $oDB->createCommand()->update('{{labelsets}}',array('label_name'=>''),\"label_name is NULL\");\n $oDB->createCommand()->update('{{questions}}',array('type'=>'T'),\"type is NULL\");\n $oDB->createCommand()->update('{{questions}}',array('title'=>''),\"title is NULL\");\n $oDB->createCommand()->update('{{questions}}',array('question'=>''),\"question is NULL\");\n $oDB->createCommand()->update('{{questions}}',array('other'=>'N'),\"other is NULL\");\n\n alterColumn('{{answers}}','answer',\"text\",false);\n alterColumn('{{answers}}','assessment_value','integer',false , '0');\n alterColumn('{{assessments}}','scope',\"string(5)\",false , '');\n alterColumn('{{assessments}}','name',\"text\",false);\n alterColumn('{{assessments}}','message',\"text\",false);\n alterColumn('{{assessments}}','minimum',\"string(50)\",false , '');\n alterColumn('{{assessments}}','maximum',\"string(50)\",false , '');\n // change the primary index to include language\n if (Yii::app()->db->driverName=='mysql') // special treatment for mysql because this needs to be in one step since an AUTOINC field is involved\n {\n modifyPrimaryKey('assessments', array('id', 'language'));\n }\n else\n {\n dropPrimaryKey('assessments');\n addPrimaryKey('assessments',array('id','language'));\n }\n\n\n alterColumn('{{conditions}}','cfieldname',\"string(50)\",false , '');\n dropPrimaryKey('defaultvalues');\n alterColumn('{{defaultvalues}}','specialtype',\"string(20)\",false , '');\n addPrimaryKey('defaultvalues', array('qid','specialtype','language','scale_id','sqid'));\n\n alterColumn('{{groups}}','group_name',\"string(100)\",false , '');\n alterColumn('{{labels}}','code',\"string(5)\",false , '');\n dropPrimaryKey('labels');\n alterColumn('{{labels}}','language',\"string(20)\",false , 'en');\n addPrimaryKey('labels', array('lid', 'sortorder', 'language'));\n alterColumn('{{labelsets}}','label_name',\"string(100)\",false , '');\n alterColumn('{{questions}}','parent_qid','integer',false ,'0');\n alterColumn('{{questions}}','title',\"string(20)\",false , '');\n alterColumn('{{questions}}','question',\"text\",false);\n try { setTransactionBookmark(); $oDB->createCommand()->dropIndex('questions_idx4','{{questions}}'); } catch(Exception $e) { rollBackToTransactionBookmark();}\n\n alterColumn('{{questions}}','type',\"string(1)\",false , 'T');\n try{ $oDB->createCommand()->createIndex('questions_idx4','{{questions}}','type');} catch(Exception $e){};\n alterColumn('{{questions}}','other',\"string(1)\",false , 'N');\n alterColumn('{{questions}}','mandatory',\"string(1)\");\n alterColumn('{{question_attributes}}','attribute',\"string(50)\");\n alterColumn('{{quota}}','qlimit','integer');\n\n $oDB->createCommand()->update('{{saved_control}}',array('identifier'=>''),\"identifier is NULL\");\n alterColumn('{{saved_control}}','identifier',\"text\",false);\n $oDB->createCommand()->update('{{saved_control}}',array('access_code'=>''),\"access_code is NULL\");\n alterColumn('{{saved_control}}','access_code',\"text\",false);\n alterColumn('{{saved_control}}','email',\"string(320)\");\n $oDB->createCommand()->update('{{saved_control}}',array('ip'=>''),\"ip is NULL\");\n alterColumn('{{saved_control}}','ip',\"text\",false);\n $oDB->createCommand()->update('{{saved_control}}',array('saved_thisstep'=>''),\"saved_thisstep is NULL\");\n alterColumn('{{saved_control}}','saved_thisstep',\"text\",false);\n $oDB->createCommand()->update('{{saved_control}}',array('status'=>''),\"status is NULL\");\n alterColumn('{{saved_control}}','status',\"string(1)\",false , '');\n $oDB->createCommand()->update('{{saved_control}}',array('saved_date'=>'1980-01-01 00:00:00'),\"saved_date is NULL\");\n alterColumn('{{saved_control}}','saved_date',\"datetime\",false);\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>''),\"stg_value is NULL\");\n alterColumn('{{settings_global}}','stg_value',\"string\",false , '');\n\n alterColumn('{{surveys}}','admin',\"string(50)\");\n $oDB->createCommand()->update('{{surveys}}',array('active'=>'N'),\"active is NULL\");\n\n alterColumn('{{surveys}}','active',\"string(1)\",false , 'N');\n\n alterColumn('{{surveys}}','startdate',\"datetime\");\n alterColumn('{{surveys}}','adminemail',\"string(320)\");\n alterColumn('{{surveys}}','anonymized',\"string(1)\",false , 'N');\n\n alterColumn('{{surveys}}','faxto',\"string(20)\");\n alterColumn('{{surveys}}','format',\"string(1)\");\n alterColumn('{{surveys}}','language',\"string(50)\");\n alterColumn('{{surveys}}','additional_languages',\"string\");\n alterColumn('{{surveys}}','printanswers',\"string(1)\",true , 'N');\n alterColumn('{{surveys}}','publicstatistics',\"string(1)\",true , 'N');\n alterColumn('{{surveys}}','publicgraphs',\"string(1)\",true , 'N');\n alterColumn('{{surveys}}','assessments',\"string(1)\",true , 'N');\n alterColumn('{{surveys}}','usetokens',\"string(1)\",true , 'N');\n alterColumn('{{surveys}}','bounce_email',\"string(320)\");\n alterColumn('{{surveys}}','tokenlength','integer',true , 15);\n\n $oDB->createCommand()->update('{{surveys_languagesettings}}',array('surveyls_title'=>''),\"surveyls_title is NULL\");\n alterColumn('{{surveys_languagesettings}}','surveyls_title',\"string(200)\",false);\n alterColumn('{{surveys_languagesettings}}','surveyls_endtext',\"text\");\n alterColumn('{{surveys_languagesettings}}','surveyls_url',\"string\");\n alterColumn('{{surveys_languagesettings}}','surveyls_urldescription',\"string\");\n alterColumn('{{surveys_languagesettings}}','surveyls_email_invite_subj',\"string\");\n alterColumn('{{surveys_languagesettings}}','surveyls_email_remind_subj',\"string\");\n alterColumn('{{surveys_languagesettings}}','surveyls_email_register_subj',\"string\");\n alterColumn('{{surveys_languagesettings}}','surveyls_email_confirm_subj',\"string\");\n alterColumn('{{surveys_languagesettings}}','surveyls_dateformat','integer',false , 1);\n\n $oDB->createCommand()->update('{{users}}',array('users_name'=>''),\"users_name is NULL\");\n $oDB->createCommand()->update('{{users}}',array('full_name'=>''),\"full_name is NULL\");\n alterColumn('{{users}}','users_name',\"string(64)\",false , '');\n alterColumn('{{users}}','full_name',\"string(50)\",false);\n alterColumn('{{users}}','lang',\"string(20)\");\n alterColumn('{{users}}','email',\"string(320)\");\n alterColumn('{{users}}','superadmin','integer',false , 0);\n alterColumn('{{users}}','htmleditormode',\"string(7)\",true,'default');\n alterColumn('{{users}}','dateformat','integer',false , 1);\n try{\n setTransactionBookmark();\n $oDB->createCommand()->dropIndex('email','{{users}}');\n }\n catch(Exception $e)\n {\n // do nothing\n rollBackToTransactionBookmark();\n }\n\n $oDB->createCommand()->update('{{user_groups}}',array('name'=>''),\"name is NULL\");\n $oDB->createCommand()->update('{{user_groups}}',array('description'=>''),\"description is NULL\");\n alterColumn('{{user_groups}}','name',\"string(20)\",false);\n alterColumn('{{user_groups}}','description',\"text\",false);\n\n try { $oDB->createCommand()->dropIndex('user_in_groups_idx1','{{user_in_groups}}'); } catch(Exception $e) {}\n try { addPrimaryKey('user_in_groups', array('ugid','uid')); } catch(Exception $e) {}\n\n addColumn('{{surveys_languagesettings}}','surveyls_numberformat',\"integer NOT NULL DEFAULT 0\");\n\n $oDB->createCommand()->createTable('{{failed_login_attempts}}',array(\n 'id' => \"pk\",\n 'ip' => 'string(37) NOT NULL',\n 'last_attempt' => 'string(20) NOT NULL',\n 'number_attempts' => \"integer NOT NULL\"\n ));\n upgradeTokens145();\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>145),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 146) //Modify surveys table\n {\n upgradeSurveyTimings146();\n // Fix permissions for new feature quick-translation\n try { setTransactionBookmark(); $oDB->createCommand(\"INSERT into {{survey_permissions}} (sid,uid,permission,read_p,update_p) SELECT sid,owner_id,'translations','1','1' from {{surveys}}\")->execute(); echo $modifyoutput; flush();@ob_flush();} catch(Exception $e) { rollBackToTransactionBookmark();}\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>146),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 147)\n {\n addColumn('{{users}}','templateeditormode',\"string(7) NOT NULL default 'default'\");\n addColumn('{{users}}','questionselectormode',\"string(7) NOT NULL default 'default'\");\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>147),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 148)\n {\n addColumn('{{users}}','participant_panel',\"integer NOT NULL default 0\");\n\n $oDB->createCommand()->createTable('{{participants}}',array(\n 'participant_id' => 'string(50) NOT NULL',\n 'firstname' => 'string(40) default NULL',\n 'lastname' => 'string(40) default NULL',\n 'email' => 'string(80) default NULL',\n 'language' => 'string(40) default NULL',\n 'blacklisted' => 'string(1) NOT NULL',\n 'owner_uid' => \"integer NOT NULL\"\n ));\n addPrimaryKey('participants', array('participant_id'));\n\n $oDB->createCommand()->createTable('{{participant_attribute}}',array(\n 'participant_id' => 'string(50) NOT NULL',\n 'attribute_id' => \"integer NOT NULL\",\n 'value' => 'string(50) NOT NULL'\n ));\n addPrimaryKey('participant_attribute', array('participant_id','attribute_id'));\n\n $oDB->createCommand()->createTable('{{participant_attribute_names}}',array(\n 'attribute_id' => 'autoincrement',\n 'attribute_type' => 'string(4) NOT NULL',\n 'visible' => 'string(5) NOT NULL',\n 'PRIMARY KEY (attribute_id,attribute_type)'\n ));\n\n $oDB->createCommand()->createTable('{{participant_attribute_names_lang}}',array(\n 'attribute_id' => 'integer NOT NULL',\n 'attribute_name' => 'string(30) NOT NULL',\n 'lang' => 'string(20) NOT NULL'\n ));\n addPrimaryKey('participant_attribute_names_lang', array('attribute_id','lang'));\n\n $oDB->createCommand()->createTable('{{participant_attribute_values}}',array(\n 'attribute_id' => 'integer NOT NULL',\n 'value_id' => 'pk',\n 'value' => 'string(20) NOT NULL'\n ));\n\n $oDB->createCommand()->createTable('{{participant_shares}}',array(\n 'participant_id' => 'string(50) NOT NULL',\n 'share_uid' => 'integer NOT NULL',\n 'date_added' => 'datetime NOT NULL',\n 'can_edit' => 'string(5) NOT NULL'\n ));\n addPrimaryKey('participant_shares', array('participant_id','share_uid'));\n\n $oDB->createCommand()->createTable('{{survey_links}}',array(\n 'participant_id' => 'string(50) NOT NULL',\n 'token_id' => 'integer NOT NULL',\n 'survey_id' => 'integer NOT NULL',\n 'date_created' => 'datetime NOT NULL'\n ));\n addPrimaryKey('survey_links', array('participant_id','token_id','survey_id'));\n // Add language field to question_attributes table\n addColumn('{{question_attributes}}','language',\"string(20)\");\n upgradeQuestionAttributes148();\n fixSubquestions();\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>148),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 149)\n {\n $aFields = array(\n 'id' => 'integer',\n 'sid' => 'integer',\n 'parameter' => 'string(50)',\n 'targetqid' => 'integer',\n 'targetsqid' => 'integer'\n );\n $oDB->createCommand()->createTable('{{survey_url_parameters}}',$aFields);\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>149),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 150)\n {\n addColumn('{{questions}}','relevance','TEXT');\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>150),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 151)\n {\n addColumn('{{groups}}','randomization_group',\"string(20) NOT NULL default ''\");\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>151),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 152)\n {\n $oDB->createCommand()->createIndex('question_attributes_idx3','{{question_attributes}}','attribute');\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>152),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 153)\n {\n $oDB->createCommand()->createTable('{{expression_errors}}',array(\n 'id' => 'pk',\n 'errortime' => 'string(50)',\n 'sid' => 'integer',\n 'gid' => 'integer',\n 'qid' => 'integer',\n 'gseq' => 'integer',\n 'qseq' => 'integer',\n 'type' => 'string(50)',\n 'eqn' => 'text',\n 'prettyprint' => 'text'\n ));\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>153),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 154)\n {\n $oDB->createCommand()->addColumn('{{groups}}','grelevance',\"text\");\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>154),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 155)\n {\n addColumn('{{surveys}}','googleanalyticsstyle',\"string(1)\");\n addColumn('{{surveys}}','googleanalyticsapikey',\"string(25)\");\n try { setTransactionBookmark(); $oDB->createCommand()->renameColumn('{{surveys}}','showXquestions','showxquestions');} catch(Exception $e) { rollBackToTransactionBookmark();}\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>155),\"stg_name='DBVersion'\");\n }\n\n\n if ($iOldDBVersion < 156)\n {\n try\n {\n $oDB->createCommand()->dropTable('{{survey_url_parameters}}');\n }\n catch(Exception $e)\n {\n // do nothing\n }\n $oDB->createCommand()->createTable('{{survey_url_parameters}}',array(\n 'id' => 'pk',\n 'sid' => 'integer NOT NULL',\n 'parameter' => 'string(50) NOT NULL',\n 'targetqid' => 'integer',\n 'targetsqid' => 'integer'\n ));\n\n $oDB->createCommand()->dropTable('{{sessions}}');\n if (Yii::app()->db->driverName=='mysql')\n {\n $oDB->createCommand()->createTable('{{sessions}}',array(\n 'id' => 'string(32) NOT NULL',\n 'expire' => 'integer',\n 'data' => 'longtext'\n ));\n }\n else\n {\n $oDB->createCommand()->createTable('{{sessions}}',array(\n 'id' => 'string(32) NOT NULL',\n 'expire' => 'integer',\n 'data' => 'text'\n ));\n }\n\n addPrimaryKey('sessions', array('id'));\n addColumn('{{surveys_languagesettings}}','surveyls_attributecaptions',\"TEXT\");\n addColumn('{{surveys}}','sendconfirmation',\"string(1) default 'Y'\");\n\n upgradeSurveys156();\n\n // If a survey has an deleted owner, re-own the survey to the superadmin\n $oDB->schema->refresh();\n Survey::model()->refreshMetaData();\n $surveys = Survey::model();\n $surveys = $surveys->with(array('owner'))->findAll();\n foreach ($surveys as $row)\n {\n if (!isset($row->owner->attributes))\n {\n Survey::model()->updateByPk($row->sid,array('owner_id'=>1));\n }\n }\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>156),\"stg_name='DBVersion'\");\n $oTransaction->commit();\n $oTransaction=$oDB->beginTransaction();\n }\n\n if ($iOldDBVersion < 157)\n {\n // MySQL DB corrections\n try { setTransactionBookmark(); $oDB->createCommand()->dropIndex('questions_idx4','{{questions}}'); } catch(Exception $e) { rollBackToTransactionBookmark();}\n\n alterColumn('{{answers}}','assessment_value','integer',false , '0');\n dropPrimaryKey('answers');\n alterColumn('{{answers}}','scale_id','integer',false , '0');\n addPrimaryKey('answers', array('qid','code','language','scale_id'));\n alterColumn('{{conditions}}','method',\"string(5)\",false , '');\n alterColumn('{{participants}}','owner_uid','integer',false);\n alterColumn('{{participant_attribute_names}}','visible','string(5)',false);\n alterColumn('{{questions}}','type',\"string(1)\",false , 'T');\n alterColumn('{{questions}}','other',\"string(1)\",false , 'N');\n alterColumn('{{questions}}','mandatory',\"string(1)\");\n alterColumn('{{questions}}','scale_id','integer',false , '0');\n alterColumn('{{questions}}','parent_qid','integer',false ,'0');\n\n alterColumn('{{questions}}','same_default','integer',false , '0');\n alterColumn('{{quota}}','qlimit','integer');\n alterColumn('{{quota}}','action','integer');\n alterColumn('{{quota}}','active','integer',false , '1');\n alterColumn('{{quota}}','autoload_url','integer',false , '0');\n alterColumn('{{saved_control}}','status',\"string(1)\",false , '');\n try { setTransactionBookmark(); alterColumn('{{sessions}}','id',\"string(32)\",false); } catch(Exception $e) { rollBackToTransactionBookmark();}\n alterColumn('{{surveys}}','active',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','anonymized',\"string(1)\",false,'N');\n alterColumn('{{surveys}}','format',\"string(1)\");\n alterColumn('{{surveys}}','savetimings',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','datestamp',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','usecookie',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','allowregister',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','allowsave',\"string(1)\",false , 'Y');\n alterColumn('{{surveys}}','autonumber_start','integer' ,false, '0');\n alterColumn('{{surveys}}','autoredirect',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','allowprev',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','printanswers',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','ipaddr',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','refurl',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','publicstatistics',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','publicgraphs',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','listpublic',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','htmlemail',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','sendconfirmation',\"string(1)\",false , 'Y');\n alterColumn('{{surveys}}','tokenanswerspersistence',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','assessments',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','usecaptcha',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','usetokens',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','tokenlength','integer',false, '15');\n alterColumn('{{surveys}}','showxquestions',\"string(1)\", true , 'Y');\n alterColumn('{{surveys}}','showgroupinfo',\"string(1) \", true , 'B');\n alterColumn('{{surveys}}','shownoanswer',\"string(1) \", true , 'Y');\n alterColumn('{{surveys}}','showqnumcode',\"string(1) \", true , 'X');\n alterColumn('{{surveys}}','bouncetime','integer');\n alterColumn('{{surveys}}','showwelcome',\"string(1)\", true , 'Y');\n alterColumn('{{surveys}}','showprogress',\"string(1)\", true , 'Y');\n alterColumn('{{surveys}}','allowjumps',\"string(1)\", true , 'N');\n alterColumn('{{surveys}}','navigationdelay','integer', false , '0');\n alterColumn('{{surveys}}','nokeyboard',\"string(1)\", true , 'N');\n alterColumn('{{surveys}}','alloweditaftercompletion',\"string(1)\", true , 'N');\n alterColumn('{{surveys}}','googleanalyticsstyle',\"string(1)\");\n\n alterColumn('{{surveys_languagesettings}}','surveyls_dateformat','integer',false , 1);\n try { setTransactionBookmark(); alterColumn('{{survey_permissions}}','sid',\"integer\",false); } catch(Exception $e) { rollBackToTransactionBookmark();}\n try { setTransactionBookmark(); alterColumn('{{survey_permissions}}','uid',\"integer\",false); } catch(Exception $e) { rollBackToTransactionBookmark();}\n alterColumn('{{survey_permissions}}','create_p', 'integer',false , '0');\n alterColumn('{{survey_permissions}}','read_p', 'integer',false , '0');\n alterColumn('{{survey_permissions}}','update_p','integer',false , '0');\n alterColumn('{{survey_permissions}}','delete_p' ,'integer',false , '0');\n alterColumn('{{survey_permissions}}','import_p','integer',false , '0');\n alterColumn('{{survey_permissions}}','export_p' ,'integer',false , '0');\n\n alterColumn('{{survey_url_parameters}}','targetqid' ,'integer');\n alterColumn('{{survey_url_parameters}}','targetsqid' ,'integer');\n\n alterColumn('{{templates_rights}}','use','integer',false );\n\n alterColumn('{{users}}','create_survey','integer',false, '0');\n alterColumn('{{users}}','create_user','integer',false, '0');\n alterColumn('{{users}}','participant_panel','integer',false, '0');\n alterColumn('{{users}}','delete_user','integer',false, '0');\n alterColumn('{{users}}','superadmin','integer',false, '0');\n alterColumn('{{users}}','configurator','integer',false, '0');\n alterColumn('{{users}}','manage_template','integer',false, '0');\n alterColumn('{{users}}','manage_label','integer',false, '0');\n alterColumn('{{users}}','dateformat','integer',false, 1);\n alterColumn('{{users}}','participant_panel','integer',false , '0');\n alterColumn('{{users}}','parent_id','integer',false);\n try { setTransactionBookmark(); alterColumn('{{surveys_languagesettings}}','surveyls_survey_id',\"integer\",false); } catch(Exception $e) { rollBackToTransactionBookmark(); }\n alterColumn('{{user_groups}}','owner_id',\"integer\",false);\n dropPrimaryKey('user_in_groups');\n alterColumn('{{user_in_groups}}','ugid',\"integer\",false);\n alterColumn('{{user_in_groups}}','uid',\"integer\",false);\n\n // Additional corrections for Postgres\n try{ setTransactionBookmark(); $oDB->createCommand()->createIndex('questions_idx3','{{questions}}','gid');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); $oDB->createCommand()->createIndex('conditions_idx3','{{conditions}}','cqid');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); $oDB->createCommand()->createIndex('questions_idx4','{{questions}}','type');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); $oDB->createCommand()->dropIndex('user_in_groups_idx1','{{user_in_groups}}');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); $oDB->createCommand()->dropIndex('{{user_name_key}}','{{users}}');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); $oDB->createCommand()->createIndex('users_name','{{users}}','users_name',true);} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); addPrimaryKey('user_in_groups', array('ugid','uid'));} catch(Exception $e) { rollBackToTransactionBookmark(); };\n\n alterColumn('{{participant_attribute}}','value',\"string(50)\", false);\n try{ setTransactionBookmark(); alterColumn('{{participant_attribute_names}}','attribute_type',\"string(4)\", false);} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); dropColumn('{{participant_attribute_names_lang}}','id');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); addPrimaryKey('participant_attribute_names_lang',array('attribute_id','lang'));} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); $oDB->createCommand()->renameColumn('{{participant_shares}}','shared_uid','share_uid');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n alterColumn('{{participant_shares}}','date_added',\"datetime\", false);\n alterColumn('{{participants}}','firstname',\"string(40)\");\n alterColumn('{{participants}}','lastname',\"string(40)\");\n alterColumn('{{participants}}','email',\"string(80)\");\n alterColumn('{{participants}}','language',\"string(40)\");\n alterColumn('{{quota_languagesettings}}','quotals_name',\"string\");\n try{ setTransactionBookmark(); alterColumn('{{survey_permissions}}','sid','integer',false); } catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); alterColumn('{{survey_permissions}}','uid','integer',false); } catch(Exception $e) { rollBackToTransactionBookmark(); };\n alterColumn('{{users}}','htmleditormode',\"string(7)\",true,'default');\n\n // Sometimes the survey_links table was deleted before this step, if so\n // we recreate it (copied from line 663)\n if (!tableExists('{survey_links}')) {\n $oDB->createCommand()->createTable('{{survey_links}}',array(\n 'participant_id' => 'string(50) NOT NULL',\n 'token_id' => 'integer NOT NULL',\n 'survey_id' => 'integer NOT NULL',\n 'date_created' => 'datetime NOT NULL'\n ));\n addPrimaryKey('survey_links', array('participant_id','token_id','survey_id'));\n }\n alterColumn('{{survey_links}}','date_created',\"datetime\",true);\n alterColumn('{{saved_control}}','identifier',\"text\",false);\n alterColumn('{{saved_control}}','email',\"string(320)\");\n alterColumn('{{surveys}}','adminemail',\"string(320)\");\n alterColumn('{{surveys}}','bounce_email',\"string(320)\");\n alterColumn('{{users}}','email',\"string(320)\");\n\n try{ setTransactionBookmark(); $oDB->createCommand()->dropIndex('assessments_idx','{{assessments}}');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); $oDB->createCommand()->createIndex('assessments_idx3','{{assessments}}','gid');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n\n try{ setTransactionBookmark(); $oDB->createCommand()->dropIndex('ixcode','{{labels}}');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); $oDB->createCommand()->dropIndex('{{labels_ixcode_idx}}','{{labels}}');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); $oDB->createCommand()->createIndex('labels_code_idx','{{labels}}','code');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n\n\n\n if (Yii::app()->db->driverName=='pgsql')\n {\n try{ setTransactionBookmark(); $oDB->createCommand(\"ALTER TABLE ONLY {{user_groups}} ADD PRIMARY KEY (ugid); \")->execute;} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); $oDB->createCommand(\"ALTER TABLE ONLY {{users}} ADD PRIMARY KEY (uid); \")->execute;} catch(Exception $e) { rollBackToTransactionBookmark(); };\n }\n\n // Additional corrections for MSSQL\n alterColumn('{{answers}}','answer',\"text\",false);\n alterColumn('{{assessments}}','name',\"text\",false);\n alterColumn('{{assessments}}','message',\"text\",false);\n alterColumn('{{defaultvalues}}','defaultvalue',\"text\");\n alterColumn('{{expression_errors}}','eqn',\"text\");\n alterColumn('{{expression_errors}}','prettyprint',\"text\");\n alterColumn('{{groups}}','description',\"text\");\n alterColumn('{{groups}}','grelevance',\"text\");\n alterColumn('{{labels}}','title',\"text\");\n alterColumn('{{question_attributes}}','value',\"text\");\n alterColumn('{{questions}}','preg',\"text\");\n alterColumn('{{questions}}','help',\"text\");\n alterColumn('{{questions}}','relevance',\"text\");\n alterColumn('{{questions}}','question',\"text\",false);\n alterColumn('{{quota_languagesettings}}','quotals_quota_id',\"integer\",false);\n alterColumn('{{quota_languagesettings}}','quotals_message',\"text\",false);\n alterColumn('{{saved_control}}','refurl',\"text\");\n alterColumn('{{saved_control}}','access_code',\"text\",false);\n alterColumn('{{saved_control}}','ip',\"text\",false);\n alterColumn('{{saved_control}}','saved_thisstep',\"text\",false);\n alterColumn('{{saved_control}}','saved_date',\"datetime\",false);\n alterColumn('{{surveys}}','attributedescriptions',\"text\");\n alterColumn('{{surveys}}','emailresponseto',\"text\");\n alterColumn('{{surveys}}','emailnotificationto',\"text\");\n\n alterColumn('{{surveys_languagesettings}}','surveyls_description',\"text\");\n alterColumn('{{surveys_languagesettings}}','surveyls_welcometext',\"text\");\n alterColumn('{{surveys_languagesettings}}','surveyls_email_invite',\"text\");\n alterColumn('{{surveys_languagesettings}}','surveyls_email_remind',\"text\");\n alterColumn('{{surveys_languagesettings}}','surveyls_email_register',\"text\");\n alterColumn('{{surveys_languagesettings}}','surveyls_email_confirm',\"text\");\n alterColumn('{{surveys_languagesettings}}','surveyls_attributecaptions',\"text\");\n alterColumn('{{surveys_languagesettings}}','email_admin_notification',\"text\");\n alterColumn('{{surveys_languagesettings}}','email_admin_responses',\"text\");\n alterColumn('{{surveys_languagesettings}}','surveyls_endtext',\"text\");\n alterColumn('{{user_groups}}','description',\"text\",false);\n\n\n\n alterColumn('{{conditions}}','value','string',false,'');\n alterColumn('{{participant_shares}}','can_edit',\"string(5)\",false);\n\n alterColumn('{{users}}','password',\"binary\",false);\n dropColumn('{{users}}','one_time_pw');\n addColumn('{{users}}','one_time_pw','binary');\n\n\n $oDB->createCommand()->update('{{question_attributes}}',array('value'=>'1'),\"attribute = 'random_order' and value = '2'\");\n\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>157),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 158)\n {\n LimeExpressionManager::UpgradeConditionsToRelevance();\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>158),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 159)\n {\n alterColumn('{{failed_login_attempts}}', 'ip', \"string(40)\",false);\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>159),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 160)\n {\n alterLanguageCode('it','it-informal');\n alterLanguageCode('it-formal','it');\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>160),\"stg_name='DBVersion'\");\n }\n if ($iOldDBVersion < 161)\n {\n addColumn('{{survey_links}}','date_invited','datetime NULL default NULL');\n addColumn('{{survey_links}}','date_completed','datetime NULL default NULL');\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>161),\"stg_name='DBVersion'\");\n }\n if ($iOldDBVersion < 162)\n {\n /* Fix participant db types */\n alterColumn('{{participant_attribute}}', 'value', \"text\", false);\n alterColumn('{{participant_attribute_names_lang}}', 'attribute_name', \"string(255)\", false);\n alterColumn('{{participant_attribute_values}}', 'value', \"text\", false);\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>162),\"stg_name='DBVersion'\");\n }\n if ($iOldDBVersion < 163)\n {\n //Replace by <script type=\"text/javascript\" src=\"{TEMPLATEURL}template.js\"></script> by {TEMPLATEJS}\n\n $replacedTemplate=replaceTemplateJS();\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>163),\"stg_name='DBVersion'\");\n\n }\n\n if ($iOldDBVersion < 164)\n {\n upgradeTokens148(); // this should have bee done in 148 - that's why it is named this way\n // fix survey tables for missing or incorrect token field\n upgradeSurveyTables164();\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>164),\"stg_name='DBVersion'\");\n\n // Not updating settings table as upgrade process takes care of that step now\n }\n\n if ($iOldDBVersion < 165)\n {\n $oDB->createCommand()->createTable('{{plugins}}', array(\n 'id' => 'pk',\n 'name' => 'string NOT NULL',\n 'active' => 'boolean'\n ));\n $oDB->createCommand()->createTable('{{plugin_settings}}', array(\n 'id' => 'pk',\n 'plugin_id' => 'integer NOT NULL',\n 'model' => 'string',\n 'model_id' => 'integer',\n 'key' => 'string',\n 'value' => 'text'\n ));\n alterColumn('{{surveys_languagesettings}}','surveyls_url',\"text\");\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>165),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 166)\n {\n $oDB->createCommand()->renameTable('{{survey_permissions}}', '{{permissions}}');\n dropPrimaryKey('permissions');\n alterColumn('{{permissions}}', 'permission', \"string(100)\", false);\n $oDB->createCommand()->renameColumn('{{permissions}}','sid','entity_id');\n alterColumn('{{permissions}}', 'entity_id', \"string(100)\", false);\n addColumn('{{permissions}}','entity',\"string(50)\");\n $oDB->createCommand(\"update {{permissions}} set entity='survey'\")->query();\n addColumn('{{permissions}}','id','pk');\n $oDB->createCommand()->createIndex('idxPermissions','{{permissions}}','entity_id,entity,permission,uid',true);\n\n upgradePermissions166();\n dropColumn('{{users}}','create_survey');\n dropColumn('{{users}}','create_user');\n dropColumn('{{users}}','delete_user');\n dropColumn('{{users}}','superadmin');\n dropColumn('{{users}}','configurator');\n dropColumn('{{users}}','manage_template');\n dropColumn('{{users}}','manage_label');\n dropColumn('{{users}}','participant_panel');\n $oDB->createCommand()->dropTable('{{templates_rights}}');\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>166),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 167)\n {\n addColumn('{{surveys_languagesettings}}', 'attachments', 'text');\n addColumn('{{users}}', 'created', 'datetime');\n addColumn('{{users}}', 'modified', 'datetime');\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>167),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 168)\n {\n addColumn('{{participants}}', 'created', 'datetime');\n addColumn('{{participants}}', 'modified', 'datetime');\n addColumn('{{participants}}', 'created_by', 'integer');\n $oDB->createCommand('update {{participants}} set created_by=owner_uid')->query();\n alterColumn('{{participants}}', 'created_by', \"integer\", false);\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>168),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 169)\n {\n // Add new column for question index options.\n addColumn('{{surveys}}', 'questionindex', 'integer not null default 0');\n // Set values for existing surveys.\n $oDB->createCommand(\"update {{surveys}} set questionindex = 0 where allowjumps <> 'Y'\")->query();\n $oDB->createCommand(\"update {{surveys}} set questionindex = 1 where allowjumps = 'Y'\")->query();\n\n // Remove old column.\n dropColumn('{{surveys}}', 'allowjumps');\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>169),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 170)\n {\n // renamed advanced attributes fields dropdown_dates_year_min/max\n $oDB->createCommand()->update('{{question_attributes}}',array('attribute'=>'date_min'),\"attribute='dropdown_dates_year_min'\");\n $oDB->createCommand()->update('{{question_attributes}}',array('attribute'=>'date_max'),\"attribute='dropdown_dates_year_max'\");\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>170),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 171)\n {\n try {\n dropColumn('{{sessions}}','data');\n }\n catch (Exception $e) {\n \n }\n switch (Yii::app()->db->driverName){\n case 'mysql':\n case 'mysqli':\n addColumn('{{sessions}}', 'data', 'longbinary');\n break;\n case 'sqlsrv':\n case 'dblib':\n case 'mssql':\n addColumn('{{sessions}}', 'data', 'VARBINARY(MAX)');\n break;\n case 'pgsql':\n addColumn('{{sessions}}', 'data', 'BYTEA');\n break;\n default: die('Unknown database type');\n }\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>171),\"stg_name='DBVersion'\");\n }\n if ($iOldDBVersion < 172)\n {\n switch (Yii::app()->db->driverName){\n case 'pgsql':\n // Special treatment for Postgres as it is too dumb to convert a string to a number without explicit being told to do so ... seriously?\n alterColumn('{{permissions}}', 'entity_id', \"INTEGER USING (entity_id::integer)\", false);\n break;\n case 'sqlsrv':\n case 'dblib':\n case 'mssql':\n try{ setTransactionBookmark(); $oDB->createCommand()->dropIndex('permissions_idx2','{{permissions}}');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); $oDB->createCommand()->dropIndex('idxPermissions','{{permissions}}');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n alterColumn('{{permissions}}', 'entity_id', \"INTEGER\", false);\n $oDB->createCommand()->createIndex('permissions_idx2','{{permissions}}','entity_id,entity,permission,uid',true);\n break;\n default:\n alterColumn('{{permissions}}', 'entity_id', \"INTEGER\", false);\n }\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>172),\"stg_name='DBVersion'\");\n }\n if ($iOldDBVersion < 173)\n {\n addColumn('{{participant_attribute_names}}','defaultname',\"string(50) NOT NULL default ''\");\n upgradeCPDBAttributeDefaultNames173();\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>173),\"stg_name='DBVersion'\");\n }\n if ($iOldDBVersion < 174)\n {\n alterColumn('{{participants}}', 'email', \"string(254)\");\n alterColumn('{{saved_control}}', 'email', \"string(254)\");\n alterColumn('{{surveys}}', 'adminemail', \"string(254)\");\n alterColumn('{{surveys}}', 'bounce_email', \"string(254)\");\n switch (Yii::app()->db->driverName){\n case 'sqlsrv':\n case 'dblib':\n case 'mssql': dropUniqueKeyMSSQL('email','{{users}}');\n }\n alterColumn('{{users}}', 'email', \"string(254)\");\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>174),\"stg_name='DBVersion'\");\n }\n if ($iOldDBVersion < 175)\n {\n switch (Yii::app()->db->driverName){\n case 'pgsql':\n // Special treatment for Postgres as it is too dumb to convert a boolean to a number without explicit being told to do so\n alterColumn('{{plugins}}', 'active', \"INTEGER USING (active::integer)\", false);\n break;\n default:\n alterColumn('{{plugins}}', 'active', \"integer\",false,'0');\n }\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>175),\"stg_name='DBVersion'\");\n }\n if ($iOldDBVersion < 176)\n {\n upgradeTokens176();\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>176),\"stg_name='DBVersion'\");\n }\n if ($iOldDBVersion < 177)\n {\n if ( Yii::app()->getConfig('auth_webserver') === true ) {\n // using auth webserver, now activate the plugin with default settings.\n if (!class_exists('Authwebserver', false)) {\n $plugin = Plugin::model()->findByAttributes(array('name'=>'Authwebserver'));\n if (!$plugin) {\n $plugin = new Plugin();\n $plugin->name = 'Authwebserver';\n $plugin->active = 1;\n $plugin->save();\n $plugin = App()->getPluginManager()->loadPlugin('Authwebserver', $plugin->id);\n $aPluginSettings = $plugin->getPluginSettings(true);\n $aDefaultSettings = array();\n foreach ($aPluginSettings as $key => $settings) {\n if (is_array($settings) && array_key_exists('current', $settings) ) {\n $aDefaultSettings[$key] = $settings['current'];\n }\n }\n $plugin->saveSettings($aDefaultSettings);\n } else {\n $plugin->active = 1;\n $plugin->save();\n }\n }\n }\n upgradeSurveys177();\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>177),\"stg_name='DBVersion'\");\n }\n if ($iOldDBVersion < 178)\n {\n if (Yii::app()->db->driverName=='mysql' || Yii::app()->db->driverName=='mysqli')\n {\n modifyPrimaryKey('questions', array('qid','language'));\n }\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>178),\"stg_name='DBVersion'\");\n }\n if ($iOldDBVersion < 179)\n {\n upgradeSurveys177(); // Needs to be run again to make sure\n upgradeTokenTables179();\n alterColumn('{{participants}}', 'email', \"string(254)\", false);\n alterColumn('{{participants}}', 'firstname', \"string(150)\", false);\n alterColumn('{{participants}}', 'lastname', \"string(150)\", false);\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>179),\"stg_name='DBVersion'\");\n }\n if ($iOldDBVersion < 180)\n {\n $aUsers = User::model()->findAll();\n $aPerm = array(\n 'entity_id' => 0,\n 'entity' => 'global',\n 'uid' => 0,\n 'permission' => 'auth_db',\n 'create_p' => 0,\n 'read_p' => 1,\n 'update_p' => 0,\n 'delete_p' => 0,\n 'import_p' => 0,\n 'export_p' => 0\n );\n\n foreach ($aUsers as $oUser)\n {\n if (!Permission::model()->hasGlobalPermission('auth_db','read',$oUser->uid))\n {\n $oPermission = new Permission;\n foreach ($aPerm as $k => $v)\n {\n $oPermission->$k = $v;\n }\n $oPermission->uid = $oUser->uid;\n $oPermission->save();\n }\n }\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>180),\"stg_name='DBVersion'\");\n \n }\n if ($iOldDBVersion < 181)\n {\n upgradeTokenTables181();\n upgradeSurveyTables181();\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>181),\"stg_name='DBVersion'\");\n } \n if ($iOldDBVersion < 182)\n {\n fixKCFinder182();\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>182),\"stg_name='DBVersion'\");\n } \n $oTransaction->commit();\n // Activate schema caching\n $oDB->schemaCachingDuration=3600;\n // Load all tables of the application in the schema\n $oDB->schema->getTables();\n // clear the cache of all loaded tables\n $oDB->schema->refresh();\n }\n catch(Exception $e)\n {\n $oTransaction->rollback();\n // Activate schema caching\n $oDB->schemaCachingDuration=3600;\n // Load all tables of the application in the schema\n $oDB->schema->getTables();\n // clear the cache of all loaded tables\n $oDB->schema->refresh();\n echo '<br /><br />'.gT('An non-recoverable error happened during the update. Error details:').\"<p>\".htmlspecialchars($e->getMessage()).'</p><br />';\n return false;\n }\n fixLanguageConsistencyAllSurveys();\n echo '<br /><br />'.sprintf(gT('Database update finished (%s)'),date('Y-m-d H:i:s')).'<br /><br />';\n return true;\n}", "public function getDbCollation()\r\n {\r\n return $this->db_collation;\r\n }", "public function get_charset_collate()\n {\n }", "public function setPrefixFromDB(){\n foreach($this->getTables() as $table){\n $prefix = explode('_', $table);\n if(isset($prefix[1])){\n if($this->prefix==$prefix[0]) break;\n else $this->prefix = $prefix[0];\n }\n }\n }", "protected function updateBaseTablePrefix()\n {\n //Do nothing since this is the single-site class\n }", "public function convertTableCharsetAndCollation($table, $options = array()) {\n // mysql - postgresql\n $sql = 'ALTER TABLE `'. $table .'`\n CONVERT TO CHARACTER SET '. db::CHARSET .'\n COLLATE '. db::COLLATION;\n\n return $this->execute($sql, $options);\n }", "function testACLMigrationEncoding()\n \t{\n \t\trequire_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_xipt'.DS.'install'.DS.'helper.php');\n \t\tXiptHelperInstall::_migration460();\n \t\t$this->_DBO->addTable('#__xipt_aclrules');\n \t}", "public function convertToUTF($prefix = null, $content_only = false)\n {\n\n if ( $prefix === null ) {\n $prefix = PREFIX_DB;\n }\n\n try {\n $this->_db->beginTransaction();\n\n $tables = $this->getTables($prefix);\n\n foreach ($tables as $table) {\n if ( $content_only === false ) {\n //Change whole table charset\n //CONVERT TO instruction will take care of each fields,\n //but converting data stay our problem.\n $query = 'ALTER TABLE ' . $table .\n ' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci';\n\n $this->_db->getConnection()->exec($query);\n Analog::log(\n 'Charset successfully changed for table `' . $table .'`',\n Analog::DEBUG\n );\n }\n\n //Data conversion\n if ( $table != $prefix . 'pictures' ) {\n $this->_convertContentToUTF($prefix, $table);\n }\n }\n $this->_db->commit();\n } catch (\\Exception $e) {\n $this->_db->rollBack();\n Analog::log(\n 'An error occured while converting to utf table ' .\n $table . ' (' . $e->getMessage() . ')',\n Analog::ERROR\n );\n }\n }", "public function setCollate($collate)\n\t{\n\t\t$this->collate = $collate;\n\t}", "function caldera_forms_pro_db_delta_1(){\n\trequire_once( ABSPATH . 'wp-admin/includes/upgrade.php' );\n\tglobal $wpdb;\n\t$charset_collate = '';\n\n\tif ( ! empty( $wpdb->charset ) ) {\n\t\t$charset_collate = \"DEFAULT CHARACTER SET $wpdb->charset\";\n\t}\n\n\tif ( ! empty( $wpdb->collate ) ) {\n\t\t$charset_collate .= \" COLLATE $wpdb->collate\";\n\t}\n\t$table = \"CREATE TABLE `\" . $wpdb->prefix . \"cf_pro_messages` (\n\t\t\t`ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,\n\t\t\t`cfp_id` bigint(20) unsigned DEFAULT NULL,\n\t\t\t`entry_id` bigint(20) unsigned DEFAULT NULL,\n\t\t\t`hash` varchar(255) DEFAULT NULL,\n\t\t\t`type` varchar(255) DEFAULT NULL,\n\t\t\tPRIMARY KEY ( `ID` )\n\t\t\t) \" . $charset_collate . \";\";\n\n\tdbDelta( $table );\n\n\n}", "public function getUpSQL()\n {\n return array (\n 'cungfoo' => '\n# This is a fix for InnoDB in MySQL >= 4.1.x\n# It \"suspends judgement\" for fkey relationships until are tables are set.\nSET FOREIGN_KEY_CHECKS = 0;\n\nALTER TABLE `destination_i18n`\n ADD `seo_title` VARCHAR(255) DEFAULT \\'\\' AFTER `active_locale`,\n ADD `seo_description` TEXT AFTER `seo_title`;\n\nALTER TABLE `metadata_i18n`\n ADD `seo_title` VARCHAR(255) DEFAULT \\'\\' AFTER `accroche`,\n ADD `seo_description` TEXT AFTER `seo_title`;\n\nALTER TABLE `destination_i18n`\n ADD `seo_h1` VARCHAR(255) DEFAULT \\'\\' AFTER `seo_description`,\n ADD `seo_keywords` TEXT AFTER `seo_h1`;\n\nALTER TABLE `metadata_i18n`\n ADD `seo_h1` VARCHAR(255) DEFAULT \\'\\' AFTER `seo_description`,\n ADD `seo_keywords` TEXT AFTER `seo_h1`;\n\nALTER TABLE `destination_i18n` CHANGE `seo_title` `seo_title` VARCHAR(255);\n\nALTER TABLE `destination_i18n` CHANGE `seo_h1` `seo_h1` VARCHAR(255);\n\nALTER TABLE `metadata_i18n` CHANGE `seo_title` `seo_title` VARCHAR(255);\n\nALTER TABLE `metadata_i18n` CHANGE `seo_h1` `seo_h1` VARCHAR(255);\n\nCREATE TABLE `seo`\n(\n `id` INTEGER(5) NOT NULL AUTO_INCREMENT,\n `table_ref` VARCHAR(255) NOT NULL,\n PRIMARY KEY (`id`)\n) ENGINE=InnoDB;\n\nCREATE TABLE `seo_i18n`\n(\n `id` INTEGER(5) NOT NULL,\n `locale` VARCHAR(5) DEFAULT \\'fr\\' NOT NULL,\n `seo_title` VARCHAR(255),\n `seo_description` TEXT,\n `seo_h1` VARCHAR(255),\n `seo_keywords` TEXT,\n PRIMARY KEY (`id`,`locale`),\n CONSTRAINT `seo_i18n_FK_1`\n FOREIGN KEY (`id`)\n REFERENCES `seo` (`id`)\n ON DELETE CASCADE\n) ENGINE=InnoDB;\n\nALTER TABLE `activite_i18n`\n ADD `seo_title` VARCHAR(255) AFTER `active_locale`,\n ADD `seo_description` TEXT AFTER `seo_title`,\n ADD `seo_h1` VARCHAR(255) AFTER `seo_description`,\n ADD `seo_keywords` TEXT AFTER `seo_h1`;\n\nALTER TABLE `avantage_i18n`\n ADD `seo_title` VARCHAR(255) AFTER `active_locale`,\n ADD `seo_description` TEXT AFTER `seo_title`,\n ADD `seo_h1` VARCHAR(255) AFTER `seo_description`,\n ADD `seo_keywords` TEXT AFTER `seo_h1`;\n\nALTER TABLE `baignade_i18n`\n ADD `seo_title` VARCHAR(255) AFTER `active_locale`,\n ADD `seo_description` TEXT AFTER `seo_title`,\n ADD `seo_h1` VARCHAR(255) AFTER `seo_description`,\n ADD `seo_keywords` TEXT AFTER `seo_h1`;\n\nALTER TABLE `bon_plan_categorie_i18n`\n ADD `seo_title` VARCHAR(255) AFTER `active_locale`,\n ADD `seo_description` TEXT AFTER `seo_title`,\n ADD `seo_h1` VARCHAR(255) AFTER `seo_description`,\n ADD `seo_keywords` TEXT AFTER `seo_h1`;\n\nALTER TABLE `bon_plan_i18n`\n ADD `seo_title` VARCHAR(255) AFTER `active_locale`,\n ADD `seo_description` TEXT AFTER `seo_title`,\n ADD `seo_h1` VARCHAR(255) AFTER `seo_description`,\n ADD `seo_keywords` TEXT AFTER `seo_h1`;\n\nALTER TABLE `categorie_i18n`\n ADD `seo_title` VARCHAR(255) AFTER `active_locale`,\n ADD `seo_description` TEXT AFTER `seo_title`,\n ADD `seo_h1` VARCHAR(255) AFTER `seo_description`,\n ADD `seo_keywords` TEXT AFTER `seo_h1`;\n\nALTER TABLE `category_type_hebergement_i18n`\n ADD `seo_title` VARCHAR(255) AFTER `active_locale`,\n ADD `seo_description` TEXT AFTER `seo_title`,\n ADD `seo_h1` VARCHAR(255) AFTER `seo_description`,\n ADD `seo_keywords` TEXT AFTER `seo_h1`;\n\nALTER TABLE `departement_i18n`\n ADD `seo_title` VARCHAR(255) AFTER `active_locale`,\n ADD `seo_description` TEXT AFTER `seo_title`,\n ADD `seo_h1` VARCHAR(255) AFTER `seo_description`,\n ADD `seo_keywords` TEXT AFTER `seo_h1`;\n\nALTER TABLE `edito_i18n`\n ADD `seo_title` VARCHAR(255) AFTER `active_locale`,\n ADD `seo_description` TEXT AFTER `seo_title`,\n ADD `seo_h1` VARCHAR(255) AFTER `seo_description`,\n ADD `seo_keywords` TEXT AFTER `seo_h1`;\n\nALTER TABLE `etablissement_i18n`\n ADD `seo_title` VARCHAR(255) AFTER `active_locale`,\n ADD `seo_description` TEXT AFTER `seo_title`,\n ADD `seo_h1` VARCHAR(255) AFTER `seo_description`,\n ADD `seo_keywords` TEXT AFTER `seo_h1`;\n\nALTER TABLE `event_i18n`\n ADD `seo_title` VARCHAR(255) AFTER `active_locale`,\n ADD `seo_description` TEXT AFTER `seo_title`,\n ADD `seo_h1` VARCHAR(255) AFTER `seo_description`,\n ADD `seo_keywords` TEXT AFTER `seo_h1`;\n\nALTER TABLE `idee_weekend_i18n`\n ADD `seo_title` VARCHAR(255) AFTER `active_locale`,\n ADD `seo_description` TEXT AFTER `seo_title`,\n ADD `seo_h1` VARCHAR(255) AFTER `seo_description`,\n ADD `seo_keywords` TEXT AFTER `seo_h1`;\n\nALTER TABLE `mise_en_avant_i18n`\n ADD `seo_title` VARCHAR(255) AFTER `active_locale`,\n ADD `seo_description` TEXT AFTER `seo_title`,\n ADD `seo_h1` VARCHAR(255) AFTER `seo_description`,\n ADD `seo_keywords` TEXT AFTER `seo_h1`;\n\nALTER TABLE `multimedia_etablissement_i18n`\n ADD `seo_title` VARCHAR(255) AFTER `active_locale`,\n ADD `seo_description` TEXT AFTER `seo_title`,\n ADD `seo_h1` VARCHAR(255) AFTER `seo_description`,\n ADD `seo_keywords` TEXT AFTER `seo_h1`;\n\nALTER TABLE `multimedia_type_hebergement_i18n`\n ADD `seo_title` VARCHAR(255) AFTER `active_locale`,\n ADD `seo_description` TEXT AFTER `seo_title`,\n ADD `seo_h1` VARCHAR(255) AFTER `seo_description`,\n ADD `seo_keywords` TEXT AFTER `seo_h1`;\n\nALTER TABLE `pays_i18n`\n ADD `seo_title` VARCHAR(255) AFTER `active_locale`,\n ADD `seo_description` TEXT AFTER `seo_title`,\n ADD `seo_h1` VARCHAR(255) AFTER `seo_description`,\n ADD `seo_keywords` TEXT AFTER `seo_h1`;\n\nALTER TABLE `personnage_i18n`\n ADD `seo_title` VARCHAR(255) AFTER `active_locale`,\n ADD `seo_description` TEXT AFTER `seo_title`,\n ADD `seo_h1` VARCHAR(255) AFTER `seo_description`,\n ADD `seo_keywords` TEXT AFTER `seo_h1`;\n\nALTER TABLE `point_interet_i18n`\n ADD `seo_title` VARCHAR(255) AFTER `active_locale`,\n ADD `seo_description` TEXT AFTER `seo_title`,\n ADD `seo_h1` VARCHAR(255) AFTER `seo_description`,\n ADD `seo_keywords` TEXT AFTER `seo_h1`;\n\nALTER TABLE `region_i18n`\n ADD `seo_title` VARCHAR(255) AFTER `active_locale`,\n ADD `seo_description` TEXT AFTER `seo_title`,\n ADD `seo_h1` VARCHAR(255) AFTER `seo_description`,\n ADD `seo_keywords` TEXT AFTER `seo_h1`;\n\nALTER TABLE `region_ref_i18n`\n ADD `seo_title` VARCHAR(255) AFTER `active_locale`,\n ADD `seo_description` TEXT AFTER `seo_title`,\n ADD `seo_h1` VARCHAR(255) AFTER `seo_description`,\n ADD `seo_keywords` TEXT AFTER `seo_h1`;\n\nALTER TABLE `service_complementaire_i18n`\n ADD `seo_title` VARCHAR(255) AFTER `active_locale`,\n ADD `seo_description` TEXT AFTER `seo_title`,\n ADD `seo_h1` VARCHAR(255) AFTER `seo_description`,\n ADD `seo_keywords` TEXT AFTER `seo_h1`;\n\nALTER TABLE `situation_geographique_i18n`\n ADD `seo_title` VARCHAR(255) AFTER `active_locale`,\n ADD `seo_description` TEXT AFTER `seo_title`,\n ADD `seo_h1` VARCHAR(255) AFTER `seo_description`,\n ADD `seo_keywords` TEXT AFTER `seo_h1`;\n\nALTER TABLE `tag_i18n`\n ADD `seo_title` VARCHAR(255) AFTER `active_locale`,\n ADD `seo_description` TEXT AFTER `seo_title`,\n ADD `seo_h1` VARCHAR(255) AFTER `seo_description`,\n ADD `seo_keywords` TEXT AFTER `seo_h1`;\n\nALTER TABLE `thematique_i18n`\n ADD `seo_title` VARCHAR(255) AFTER `active_locale`,\n ADD `seo_description` TEXT AFTER `seo_title`,\n ADD `seo_h1` VARCHAR(255) AFTER `seo_description`,\n ADD `seo_keywords` TEXT AFTER `seo_h1`;\n\nALTER TABLE `theme_i18n`\n ADD `seo_title` VARCHAR(255) AFTER `active_locale`,\n ADD `seo_description` TEXT AFTER `seo_title`,\n ADD `seo_h1` VARCHAR(255) AFTER `seo_description`,\n ADD `seo_keywords` TEXT AFTER `seo_h1`;\n\nALTER TABLE `type_hebergement_capacite_i18n`\n ADD `seo_title` VARCHAR(255) AFTER `active_locale`,\n ADD `seo_description` TEXT AFTER `seo_title`,\n ADD `seo_h1` VARCHAR(255) AFTER `seo_description`,\n ADD `seo_keywords` TEXT AFTER `seo_h1`;\n\nALTER TABLE `type_hebergement_i18n`\n ADD `seo_title` VARCHAR(255) AFTER `active_locale`,\n ADD `seo_description` TEXT AFTER `seo_title`,\n ADD `seo_h1` VARCHAR(255) AFTER `seo_description`,\n ADD `seo_keywords` TEXT AFTER `seo_h1`;\n\nALTER TABLE `ville_i18n`\n ADD `seo_title` VARCHAR(255) AFTER `active_locale`,\n ADD `seo_description` TEXT AFTER `seo_title`,\n ADD `seo_h1` VARCHAR(255) AFTER `seo_description`,\n ADD `seo_keywords` TEXT AFTER `seo_h1`;\n\nALTER TABLE `vos_vacances_i18n`\n ADD `seo_title` VARCHAR(255) AFTER `active_locale`,\n ADD `seo_description` TEXT AFTER `seo_title`,\n ADD `seo_h1` VARCHAR(255) AFTER `seo_description`,\n ADD `seo_keywords` TEXT AFTER `seo_h1`;\n\nCREATE TABLE `demande_identifiant_i18n`\n(\n `id` INTEGER NOT NULL,\n `locale` VARCHAR(5) DEFAULT \\'fr\\' NOT NULL,\n `seo_title` VARCHAR(255),\n `seo_description` TEXT,\n `seo_h1` VARCHAR(255),\n `seo_keywords` TEXT,\n PRIMARY KEY (`id`,`locale`),\n CONSTRAINT `demande_identifiant_i18n_FK_1`\n FOREIGN KEY (`id`)\n REFERENCES `demande_identifiant` (`id`)\n ON DELETE CASCADE\n) ENGINE=InnoDB;\n\nCREATE TABLE `top_camping_i18n`\n(\n `id` INTEGER NOT NULL,\n `locale` VARCHAR(5) DEFAULT \\'fr\\' NOT NULL,\n `seo_title` VARCHAR(255),\n `seo_description` TEXT,\n `seo_h1` VARCHAR(255),\n `seo_keywords` TEXT,\n PRIMARY KEY (`id`,`locale`),\n CONSTRAINT `top_camping_i18n_FK_1`\n FOREIGN KEY (`id`)\n REFERENCES `top_camping` (`id`)\n ON DELETE CASCADE\n) ENGINE=InnoDB;\n\nCREATE TABLE `demande_annulation_i18n`\n(\n `id` INTEGER NOT NULL,\n `locale` VARCHAR(5) DEFAULT \\'fr\\' NOT NULL,\n `seo_title` VARCHAR(255),\n `seo_description` TEXT,\n `seo_h1` VARCHAR(255),\n `seo_keywords` TEXT,\n PRIMARY KEY (`id`,`locale`),\n CONSTRAINT `demande_annulation_i18n_FK_1`\n FOREIGN KEY (`id`)\n REFERENCES `demande_annulation` (`id`)\n ON DELETE CASCADE\n) ENGINE=InnoDB;\n\nINSERT INTO seo (id, table_ref) VALUES (1, \\'pays\\');\nINSERT INTO seo (id, table_ref) VALUES (2, \\'region\\');\nINSERT INTO seo (id, table_ref) VALUES (3, \\'departement\\');\nINSERT INTO seo (id, table_ref) VALUES (4, \\'ville\\');\nINSERT INTO seo (id, table_ref) VALUES (5, \\'destination\\');\nINSERT INTO seo (id, table_ref) VALUES (6, \\'etablissement\\');\nINSERT INTO seo (id, table_ref) VALUES (7, \\'bon_plan\\');\nINSERT INTO seo (id, table_ref) VALUES (8, \\'top_camping\\');\nINSERT INTO seo (id, table_ref) VALUES (9, \\'poi\\');\nINSERT INTO seo (id, table_ref) VALUES (10, \\'event\\');\nINSERT INTO seo (id, table_ref) VALUES (11, \\'bon_plan_categorie\\');\nINSERT INTO seo (id, table_ref) VALUES (12, \\'category_type_hebergement\\');\nINSERT INTO seo (id, table_ref) VALUES (13, \\'type_hebergement_capacite\\');\nINSERT INTO seo (id, table_ref) VALUES (14, \\'type_hebergement\\');\nINSERT INTO seo (id, table_ref) VALUES (15, \\'region_ref\\');\nINSERT INTO seo_i18n (id, locale, seo_title, seo_description, seo_h1, seo_keywords) VALUES (1, \\'fr\\', \\'Camping %pays% pas cher\\', \\'Vacances directes : découvrez nos offres de location de mobil home pas cher en %pays% pour des vacances ensoleillés en camping et réserver en ligne.\\', \\'Camping en %item% pas cher\\', \\'\\');\nINSERT INTO seo_i18n (id, locale, seo_title, seo_description, seo_h1, seo_keywords) VALUES (1, \\'de\\', \\'günstiger Campingplatz %pays%\\', \\'Vacances Directes: Entdecken Sie unsere günstigen Angebote für die Vermietung von Wohnwagen in %pays% für einen sonnigen Urlaub auf dem Campingplatz und buchen Sie online.\\', \\'Günstig campen in %item%\\', \\'\\');\nINSERT INTO seo_i18n (id, locale, seo_title, seo_description, seo_h1, seo_keywords) VALUES (2, \\'fr\\', \\'Location mobil home %region% pas cher, camping %region%\\', \\'Réserver en ligne vos futures vacances dans la région %region% en %pays% avec Vacances directes (location de mobil-homes pas cher en camping).\\', \\'Location mobil home %item%\\', \\'\\');\nINSERT INTO seo_i18n (id, locale, seo_title, seo_description, seo_h1, seo_keywords) VALUES (2, \\'de\\', \\'Günstige Vermietung von Wohnwagen %region%, Campingplatz %region%\\', \\'Buchen Sie Ihren künftigen Urlaub in der Region %region% in %pays% mit Vacances Directes online (günstige Vermietung von Wohnwagen auf dem Campingplatz).\\', \\'Vermietung Wohnwagen %item%\\', \\'\\');\nINSERT INTO seo_i18n (id, locale, seo_title, seo_description, seo_h1, seo_keywords) VALUES (3, \\'fr\\', \\'Location mobil home %departement% pas cher, camping %departement%\\', \\'Réserver en ligne vos futures vacances dans le département %departement% en %pays% avec Vacances directes (location de mobil-homes pas cher en camping).\\', \\'Location mobil home %item%\\', \\'\\');\nINSERT INTO seo_i18n (id, locale, seo_title, seo_description, seo_h1, seo_keywords) VALUES (3, \\'de\\', \\'Vermietung von günstigen Mobilhomes %departement%, Camping %departement%\\', \\'Reservieren Sie Ihren nächsten Urlaub online im Departement %departement% in %pays% mit Vacanes directes (Vermietung von günstigen Camping-Mobilhomes).\\', \\'Vermietungsangebot Mobilhome %item%\\', \\'\\');\nINSERT INTO seo_i18n (id, locale, seo_title, seo_description, seo_h1, seo_keywords) VALUES (4, \\'fr\\', \\'Camping %ville% pas cher, location mobil home %ville% pas cher\\', \\'Découvrez l\\'\\'ensemble des campings à %ville% (%region%) proposés par Vacances Directes (location de mobil home pas cher) et réserver votre séjour en ligne.\\', \\'Camping %item% pas cher (location mobil home)\\', \\'\\');\nINSERT INTO seo_i18n (id, locale, seo_title, seo_description, seo_h1, seo_keywords) VALUES (4, \\'de\\', \\'Günstiger Campingplatz %ville%, günstige Vermietung von Wohnwagen %ville%\\', \\'Entdecken Sie alle von Vacances Directes (günstige Vermietung von Wohnwagen) angebotenen Campingplätze in %ville% (%region%) und buchen Sie Ihren Aufenthalt online.\\', \\'Günstig campen %item% (Vermietung Wohnwagen)\\', \\'\\');\nINSERT INTO seo_i18n (id, locale, seo_title, seo_description, seo_h1, seo_keywords) VALUES (5, \\'fr\\', \\'Camping en %destination% pas cher\\', \\'Vacances directes : découvrez nos offres de location de mobil home pas cher en %pays% pour des vacances ensoleillés en camping et réserver en ligne.\\', \\'Camping en %item% pas cher\\', \\'\\');\nINSERT INTO seo_i18n (id, locale, seo_title, seo_description, seo_h1, seo_keywords) VALUES (5, \\'de\\', \\'Günstiger Campingplatz in %destination%\\', \\'Vacances Directes: Entdecken Sie alle unsere Angebote für die günstige Vermietung von Wohnwagen in %pays% für einen sonnigen Urlaub auf dem Campingplatz und buchen Sie online.\\', \\'Günstiger Campingplatz in %item%\\', \\'\\');\nINSERT INTO seo_i18n (id, locale, seo_title, seo_description, seo_h1, seo_keywords) VALUES (6, \\'fr\\', \\'Camping %nom%, camping %ville%\\', \\'Avec Vacances Directes, réserver en ligne votre futur séjour dans le camping %nom% : un camping %nbEtoiles% avec piscine à %ville%.\\', \\'Camping %ville%\\', \\'\\');\nINSERT INTO seo_i18n (id, locale, seo_title, seo_description, seo_h1, seo_keywords) VALUES (6, \\'de\\', \\'Campingplatz %nom%, Campingplatz %ville%\\', \\'Buchen Sie Ihren künftigen Urlaub auf dem Campingplatz %nom% mit Vacances Directes online: ein %nbEtoiles% Campingplatz mit Swimmingpool in %ville%.\\', \\'Campingplatz %ville%\\', \\'\\');\nINSERT INTO seo_i18n (id, locale, seo_title, seo_description, seo_h1, seo_keywords) VALUES (7, \\'fr\\', \\'Camping %bonPlan%, location mobil-homes %bonPlan%\\', \\'Découvrez toutes nos offres de camping : \"%bonPlan%\" et réservez en ligne vos futures vacances sur le site Vacances Directes.\\', \\'\\', \\'\\');\nINSERT INTO seo_i18n (id, locale, seo_title, seo_description, seo_h1, seo_keywords) VALUES (7, \\'de\\', \\'Campingplatz %bonPlan%, Vermietung Wohnwagen %bonPlan%\\', \\'Entdecken Sie alle unsere Campingangebote: \"%bonPlan%\" und buchen Sie Ihren künftigen Urlaub auf der Internetseite Vacances Directes online.\\', \\'\\', \\'\\');\nINSERT INTO seo_i18n (id, locale, seo_title, seo_description, seo_h1, seo_keywords) VALUES (8, \\'fr\\', \\'Top camping France, top destination vacances\\', \\'Découvrez notre top 10 des destinations pour des vacances en campings réussies avec Vacances Directes, le spécialiste de la location de mobil-home.\\', \\'\\', \\'\\');\nINSERT INTO seo_i18n (id, locale, seo_title, seo_description, seo_h1, seo_keywords) VALUES (8, \\'de\\', \\'Top Campingplätze Frankreich, beste Urlaubsziele\\', \\'Entdecken Sie unsere 10 besten Reiseziele für einen perfekten Campingurlaub mit Vacances Directes, der Spezialist für die Vermietung von Wohnwagen.\\', \\'\\', \\'\\');\nINSERT INTO seo_i18n (id, locale, seo_title, seo_description, seo_h1, seo_keywords) VALUES (9, \\'fr\\', \\'Visiter %poi% : %ville%\\', \\'%poi% à %ville%, venez visiter ce lieu et passez vos vacances dans nos campings à proximité avec Vacances Directes.\\', \\'\\', \\'\\');\nINSERT INTO seo_i18n (id, locale, seo_title, seo_description, seo_h1, seo_keywords) VALUES (9, \\'de\\', \\'%poi% besichtigen: %ville%\\', \\'%poi% in %ville%, besichtigen Sie diesen Ort und verbringen Sie Ihren Urlaub mit Vacances Directes auf unseren nahegelegenen Campingplätzen.\\', \\'\\', \\'\\');\nINSERT INTO seo_i18n (id, locale, seo_title, seo_description, seo_h1, seo_keywords) VALUES (10, \\'fr\\', \\'%event% : %ville%\\', \\'%event% à %ville%. Ne rater pas cet événement et passez vos vacances dans nos campings à proximité avec Vacances Directes.\\', \\'\\', \\'\\');\nINSERT INTO seo_i18n (id, locale, seo_title, seo_description, seo_h1, seo_keywords) VALUES (10, \\'de\\', \\'%event% : %ville%\\', \\'%event% in %ville%. Verpassen Sie nicht dieses Event und verbringen Sie Ihren Urlaub mit Vacances Directes auf unseren nahegelegenen Campingplätzen.\\', \\'\\', \\'\\');\nINSERT INTO seo_i18n (id, locale, seo_title, seo_description, seo_h1, seo_keywords) VALUES (11, \\'fr\\', \\'Camping %bonPlan%, location mobil-homes %bonPlan%\\', \\'Découvrez toutes nos offres de camping : \"%bonPlan%\" et réservez en ligne vos futures vacances sur le site Vacances Directes.\\', \\'\\', \\'\\');\nINSERT INTO seo_i18n (id, locale, seo_title, seo_description, seo_h1, seo_keywords) VALUES (11, \\'de\\', \\'Campingplatz %bonPlan%, Vermietung Wohnwagen %bonPlan%\\', \\'Entdecken Sie alle unsere Campingangebote: \"%bonPlan%\" und buchen Sie Ihren künftigen Urlaub auf der Internetseite Vacances Directes online.\\', \\'\\', \\'\\');\nINSERT INTO seo_i18n (id, locale, seo_title, seo_description, seo_h1, seo_keywords) VALUES (12, \\'fr\\', \\'Location %type% camping France, Italie, Espagne\\', \\'Vous souhaitez louer un(e) %type% pour vos futures vacances ? Découvrez tous nos campings proposant cet hébergement en France, en Espagne et en Italie.\\', \\'\\', \\'\\');\nINSERT INTO seo_i18n (id, locale, seo_title, seo_description, seo_h1, seo_keywords) VALUES (12, \\'de\\', \\'Vermietung %type% Campingplatz Frankreich, Italien, Spanien\\', \\'Sie möchten für Ihren künftigen Urlaub eine(n) %type% mieten? Entdecken Sie alle unsere Campingplätze, die diese Art Unterkunft in Frankreich, Spanien und Italien anbieten.\\', \\'\\', \\'\\');\nINSERT INTO seo_i18n (id, locale, seo_title, seo_description, seo_h1, seo_keywords) VALUES (13, \\'fr\\', \\'Location camping %type% France, Italie, Espagne\\', \\'Location de vacances pour %type% dans de nombreux campings de qualité en France, en Espagne et en Italie avec Vacances Directes.\\', \\'\\', \\'\\');\nINSERT INTO seo_i18n (id, locale, seo_title, seo_description, seo_h1, seo_keywords) VALUES (13, \\'de\\', \\'Vermietung Campingplatz %type% Frankreich, Italien, Spanien\\', \\'Urlaubsvermietung für %type% auf zahlreichen erstklassigen Campingplätzen in Frankreich, Spanien und Italien mit Vacances Directes.\\', \\'\\', \\'\\');\nINSERT INTO seo_i18n (id, locale, seo_title, seo_description, seo_h1, seo_keywords) VALUES (14, \\'fr\\', \\'Location %type% %personnes% personnes camping : %name%\\', \\'Passez vos prochaines vacances en %type% %name% dans de nombreux campings de qualité avec Vacances Directes.\\', \\'\\', \\'\\');\nINSERT INTO seo_i18n (id, locale, seo_title, seo_description, seo_h1, seo_keywords) VALUES (14, \\'de\\', \\'Vermietung %type% %personnes% Personen Campingplatz: %name%\\', \\'Verbringen Sie Ihren nächsten Urlaub mit Vacances Directes im %type% %name% auf zahlreichen erstklassigen Campingplätzen.\\', \\'\\', \\'\\');\nINSERT INTO seo_i18n (id, locale, seo_title, seo_description, seo_h1, seo_keywords) VALUES (15, \\'fr\\', \\'Location mobil home %region% pas cher, camping %region%\\', \\'Réserver en ligne vos futures vacances dans la région %region% en %pays% avec Vacances directes (location de mobil-homes pas cher en camping).\\', \\'Location mobil home %item%\\', \\'\\');\nINSERT INTO seo_i18n (id, locale, seo_title, seo_description, seo_h1, seo_keywords) VALUES (15, \\'de\\', \\'Location mobil home %region% pas cher, camping %region%\\', \\'Réserver en ligne vos futures vacances dans la région %region% en %pays% avec Vacances directes (location de mobil-homes pas cher en camping).\\', \\'Location mobil home %item%\\', \\'\\');\n\n# This restores the fkey checks, after having unset them earlier\nSET FOREIGN_KEY_CHECKS = 1;\n',\n);\n }", "public function setTableNames() {\n $caseFormat = $this->settingsAll['Model'][self::$meta_model]['tablecaseformat'];\n $aliasFormat = $this->settingsAll['Model'][self::$meta_model]['tablealiasformat'];\n foreach ($this->settingsAll as $k => $v) {\n # do not process __meta\n if (in_array($k, array(self::$meta))) {\n continue;\n }\n $tableName = $this->getRealTableName($caseFormat, $k);\n # settingsAll.k.this->meta.tablename\n # - genTable responsible for having tableName set\n $custom_set = null;\n if (isset($this->settingsAll[$k][self::$meta]['tablename'])) {\n $custom_set = $this->settingsAll[$k][self::$meta]['tablename'];\n }\n $this->log(\"setTableNames / style: {$caseFormat} / k: {$k} / tableName: {$tableName} / custom-set: \" . $custom_set);\n # set correct tablename as defined in schema, but do not override individual defaults\n if (!isset($this->settingsAll[$k][self::$meta]['tablename'])) {\n $this->settingsAll[$k][self::$meta]['tablename'] = $tableName;\n }\n # ALIAS\n $this->settingsAll[$k][self::$meta]['alias'] = $this->getTableAlias($aliasFormat, $k);\n }\n }", "public function getDownSQL()\n {\n return array (\n 'cungfoo' => '\n# This is a fix for InnoDB in MySQL >= 4.1.x\n# It \"suspends judgement\" for fkey relationships until are tables are set.\nSET FOREIGN_KEY_CHECKS = 0;\n\nDROP TABLE IF EXISTS `demande_identifiant_i18n`;\n\nDROP TABLE IF EXISTS `top_camping_i18n`;\n\nDROP TABLE IF EXISTS `demande_annulation_i18n`;\n\nALTER TABLE `activite_i18n` DROP `seo_title`;\n\nALTER TABLE `activite_i18n` DROP `seo_description`;\n\nALTER TABLE `activite_i18n` DROP `seo_h1`;\n\nALTER TABLE `activite_i18n` DROP `seo_keywords`;\n\nALTER TABLE `avantage_i18n` DROP `seo_title`;\n\nALTER TABLE `avantage_i18n` DROP `seo_description`;\n\nALTER TABLE `avantage_i18n` DROP `seo_h1`;\n\nALTER TABLE `avantage_i18n` DROP `seo_keywords`;\n\nALTER TABLE `baignade_i18n` DROP `seo_title`;\n\nALTER TABLE `baignade_i18n` DROP `seo_description`;\n\nALTER TABLE `baignade_i18n` DROP `seo_h1`;\n\nALTER TABLE `baignade_i18n` DROP `seo_keywords`;\n\nALTER TABLE `bon_plan_categorie_i18n` DROP `seo_title`;\n\nALTER TABLE `bon_plan_categorie_i18n` DROP `seo_description`;\n\nALTER TABLE `bon_plan_categorie_i18n` DROP `seo_h1`;\n\nALTER TABLE `bon_plan_categorie_i18n` DROP `seo_keywords`;\n\nALTER TABLE `bon_plan_i18n` DROP `seo_title`;\n\nALTER TABLE `bon_plan_i18n` DROP `seo_description`;\n\nALTER TABLE `bon_plan_i18n` DROP `seo_h1`;\n\nALTER TABLE `bon_plan_i18n` DROP `seo_keywords`;\n\nALTER TABLE `categorie_i18n` DROP `seo_title`;\n\nALTER TABLE `categorie_i18n` DROP `seo_description`;\n\nALTER TABLE `categorie_i18n` DROP `seo_h1`;\n\nALTER TABLE `categorie_i18n` DROP `seo_keywords`;\n\nALTER TABLE `category_type_hebergement_i18n` DROP `seo_title`;\n\nALTER TABLE `category_type_hebergement_i18n` DROP `seo_description`;\n\nALTER TABLE `category_type_hebergement_i18n` DROP `seo_h1`;\n\nALTER TABLE `category_type_hebergement_i18n` DROP `seo_keywords`;\n\nALTER TABLE `departement_i18n` DROP `seo_title`;\n\nALTER TABLE `departement_i18n` DROP `seo_description`;\n\nALTER TABLE `departement_i18n` DROP `seo_h1`;\n\nALTER TABLE `departement_i18n` DROP `seo_keywords`;\n\nALTER TABLE `edito_i18n` DROP `seo_title`;\n\nALTER TABLE `edito_i18n` DROP `seo_description`;\n\nALTER TABLE `edito_i18n` DROP `seo_h1`;\n\nALTER TABLE `edito_i18n` DROP `seo_keywords`;\n\nALTER TABLE `etablissement_i18n` DROP `seo_title`;\n\nALTER TABLE `etablissement_i18n` DROP `seo_description`;\n\nALTER TABLE `etablissement_i18n` DROP `seo_h1`;\n\nALTER TABLE `etablissement_i18n` DROP `seo_keywords`;\n\nALTER TABLE `event_i18n` DROP `seo_title`;\n\nALTER TABLE `event_i18n` DROP `seo_description`;\n\nALTER TABLE `event_i18n` DROP `seo_h1`;\n\nALTER TABLE `event_i18n` DROP `seo_keywords`;\n\nALTER TABLE `idee_weekend_i18n` DROP `seo_title`;\n\nALTER TABLE `idee_weekend_i18n` DROP `seo_description`;\n\nALTER TABLE `idee_weekend_i18n` DROP `seo_h1`;\n\nALTER TABLE `idee_weekend_i18n` DROP `seo_keywords`;\n\nALTER TABLE `mise_en_avant_i18n` DROP `seo_title`;\n\nALTER TABLE `mise_en_avant_i18n` DROP `seo_description`;\n\nALTER TABLE `mise_en_avant_i18n` DROP `seo_h1`;\n\nALTER TABLE `mise_en_avant_i18n` DROP `seo_keywords`;\n\nALTER TABLE `multimedia_etablissement_i18n` DROP `seo_title`;\n\nALTER TABLE `multimedia_etablissement_i18n` DROP `seo_description`;\n\nALTER TABLE `multimedia_etablissement_i18n` DROP `seo_h1`;\n\nALTER TABLE `multimedia_etablissement_i18n` DROP `seo_keywords`;\n\nALTER TABLE `multimedia_type_hebergement_i18n` DROP `seo_title`;\n\nALTER TABLE `multimedia_type_hebergement_i18n` DROP `seo_description`;\n\nALTER TABLE `multimedia_type_hebergement_i18n` DROP `seo_h1`;\n\nALTER TABLE `multimedia_type_hebergement_i18n` DROP `seo_keywords`;\n\nALTER TABLE `pays_i18n` DROP `seo_title`;\n\nALTER TABLE `pays_i18n` DROP `seo_description`;\n\nALTER TABLE `pays_i18n` DROP `seo_h1`;\n\nALTER TABLE `pays_i18n` DROP `seo_keywords`;\n\nALTER TABLE `personnage_i18n` DROP `seo_title`;\n\nALTER TABLE `personnage_i18n` DROP `seo_description`;\n\nALTER TABLE `personnage_i18n` DROP `seo_h1`;\n\nALTER TABLE `personnage_i18n` DROP `seo_keywords`;\n\nALTER TABLE `point_interet_i18n` DROP `seo_title`;\n\nALTER TABLE `point_interet_i18n` DROP `seo_description`;\n\nALTER TABLE `point_interet_i18n` DROP `seo_h1`;\n\nALTER TABLE `point_interet_i18n` DROP `seo_keywords`;\n\nALTER TABLE `region_i18n` DROP `seo_title`;\n\nALTER TABLE `region_i18n` DROP `seo_description`;\n\nALTER TABLE `region_i18n` DROP `seo_h1`;\n\nALTER TABLE `region_i18n` DROP `seo_keywords`;\n\nALTER TABLE `region_ref_i18n` DROP `seo_title`;\n\nALTER TABLE `region_ref_i18n` DROP `seo_description`;\n\nALTER TABLE `region_ref_i18n` DROP `seo_h1`;\n\nALTER TABLE `region_ref_i18n` DROP `seo_keywords`;\n\nALTER TABLE `service_complementaire_i18n` DROP `seo_title`;\n\nALTER TABLE `service_complementaire_i18n` DROP `seo_description`;\n\nALTER TABLE `service_complementaire_i18n` DROP `seo_h1`;\n\nALTER TABLE `service_complementaire_i18n` DROP `seo_keywords`;\n\nALTER TABLE `situation_geographique_i18n` DROP `seo_title`;\n\nALTER TABLE `situation_geographique_i18n` DROP `seo_description`;\n\nALTER TABLE `situation_geographique_i18n` DROP `seo_h1`;\n\nALTER TABLE `situation_geographique_i18n` DROP `seo_keywords`;\n\nALTER TABLE `tag_i18n` DROP `seo_title`;\n\nALTER TABLE `tag_i18n` DROP `seo_description`;\n\nALTER TABLE `tag_i18n` DROP `seo_h1`;\n\nALTER TABLE `tag_i18n` DROP `seo_keywords`;\n\nALTER TABLE `thematique_i18n` DROP `seo_title`;\n\nALTER TABLE `thematique_i18n` DROP `seo_description`;\n\nALTER TABLE `thematique_i18n` DROP `seo_h1`;\n\nALTER TABLE `thematique_i18n` DROP `seo_keywords`;\n\nALTER TABLE `theme_i18n` DROP `seo_title`;\n\nALTER TABLE `theme_i18n` DROP `seo_description`;\n\nALTER TABLE `theme_i18n` DROP `seo_h1`;\n\nALTER TABLE `theme_i18n` DROP `seo_keywords`;\n\nALTER TABLE `type_hebergement_capacite_i18n` DROP `seo_title`;\n\nALTER TABLE `type_hebergement_capacite_i18n` DROP `seo_description`;\n\nALTER TABLE `type_hebergement_capacite_i18n` DROP `seo_h1`;\n\nALTER TABLE `type_hebergement_capacite_i18n` DROP `seo_keywords`;\n\nALTER TABLE `type_hebergement_i18n` DROP `seo_title`;\n\nALTER TABLE `type_hebergement_i18n` DROP `seo_description`;\n\nALTER TABLE `type_hebergement_i18n` DROP `seo_h1`;\n\nALTER TABLE `type_hebergement_i18n` DROP `seo_keywords`;\n\nALTER TABLE `ville_i18n` DROP `seo_title`;\n\nALTER TABLE `ville_i18n` DROP `seo_description`;\n\nALTER TABLE `ville_i18n` DROP `seo_h1`;\n\nALTER TABLE `ville_i18n` DROP `seo_keywords`;\n\nALTER TABLE `vos_vacances_i18n` DROP `seo_title`;\n\nALTER TABLE `vos_vacances_i18n` DROP `seo_description`;\n\nALTER TABLE `vos_vacances_i18n` DROP `seo_h1`;\n\nALTER TABLE `vos_vacances_i18n` DROP `seo_keywords`;\n\nDROP TABLE IF EXISTS `seo`;\n\nDROP TABLE IF EXISTS `seo_i18n`;\n\nALTER TABLE `destination_i18n` CHANGE `seo_title` `seo_title` VARCHAR(255) DEFAULT \\'\\';\n\nALTER TABLE `destination_i18n` CHANGE `seo_h1` `seo_h1` VARCHAR(255) DEFAULT \\'\\';\n\nALTER TABLE `metadata_i18n` CHANGE `seo_title` `seo_title` VARCHAR(255) DEFAULT \\'\\';\n\nALTER TABLE `metadata_i18n` CHANGE `seo_h1` `seo_h1` VARCHAR(255) DEFAULT \\'\\';\n\nALTER TABLE `destination_i18n` DROP `seo_h1`;\n\nALTER TABLE `destination_i18n` DROP `seo_keywords`;\n\nALTER TABLE `metadata_i18n` DROP `seo_h1`;\n\nALTER TABLE `metadata_i18n` DROP `seo_keywords`;\n\nALTER TABLE `metadata_i18n` DROP `seo_title`;\n\nALTER TABLE `metadata_i18n` DROP `seo_description`;\n\nALTER TABLE `destination_i18n` DROP `seo_title`;\n\nALTER TABLE `destination_i18n` DROP `seo_description`;\n\n# This restores the fkey checks, after having unset them earlier\nSET FOREIGN_KEY_CHECKS = 1;\n',\n);\n }", "public static function determine_charset() {\n global $wpdb;\n $charset = '';\n\n if (!empty($wpdb->charset)) {\n $charset = \"DEFAULT CHARACTER SET {$wpdb->charset}\";\n\n if (!empty($wpdb->collate)) {\n $charset .= \" COLLATE {$wpdb->collate}\";\n }\n }\n return $charset;\n }", "function _wpsc_db_upgrade_11() {\n\t_wpsc_fix_united_kingdom();\n\t_wpsc_set_legacy_country_meta();\n}", "public function getTableTranslation()\n {\n return DATABASE_PREFIX . '_' . $this->translation . '_' . $this->_tableSurfix;\n }", "protected function cleanTableNames() {}", "public function getTableLanguage()\n {\n return DATABASE_PREFIX . '_' . $this->language . '_' . $this->_tableSurfix;\n }", "public static function update_1_0_6_shorten_table_names() {\n\t\tglobal $wpdb;\n\t\t// old table names format => new table names format.\n\t\t$table_rename_map = array(\n\t\t\t\"{$wpdb->prefix}woocommerce_postfinancecheckout_attribute_options\" => \"{$wpdb->prefix}wc_postfinancecheckout_attribute_options\",\n\t\t\t\"{$wpdb->prefix}woocommerce_postfinancecheckout_completion_job\" => \"{$wpdb->prefix}wc_postfinancecheckout_completion_job\",\n\t\t\t\"{$wpdb->prefix}woocommerce_postfinancecheckout_method_configuration\" => \"{$wpdb->prefix}wc_postfinancecheckout_method_config\",\n\t\t\t\"{$wpdb->prefix}woocommerce_postfinancecheckout_refund_job\" => \"{$wpdb->prefix}wc_postfinancecheckout_refund_job\",\n\t\t\t\"{$wpdb->prefix}woocommerce_postfinancecheckout_token_info\" => \"{$wpdb->prefix}wc_postfinancecheckout_token_info\",\n\t\t\t\"{$wpdb->prefix}woocommerce_postfinancecheckout_transaction_info\" => \"{$wpdb->prefix}wc_postfinancecheckout_transaction_info\",\n\t\t\t\"{$wpdb->prefix}woocommerce_postfinancecheckout_void_job\" => \"{$wpdb->prefix}wc_postfinancecheckout_void_job\",\n\t\t);\n\n\t\t// rollback table rename if there are issues.\n\t\t$wpdb->query( 'START TRANSACTION' );\n\n\t\tforeach ( $table_rename_map as $key => $value ) {\n\t\t\t// check old table exists.\n\t\t\t// phpcs:ignore\n\t\t\t$old_table_result = $wpdb->get_row( \"SHOW TABLES WHERE Tables_in_{$wpdb->dbname} = '{$key}'\" );\n\n\t\t\tif ( $old_table_result ) {\n\t\t\t\t// check new table doesn't exist, if it does there's a problem!\n\t\t\t\t// phpcs:ignore\n\t\t\t\t$new_table_result = $wpdb->get_row( \"SHOW TABLES WHERE Tables_in_{$wpdb->dbname} = '{$value}'\" );\n\n\t\t\t\tif ( ! $new_table_result ) {\n\t\t\t\t\t// phpcs:ignore\n\t\t\t\t\t$result = $wpdb->query( \"RENAME TABLE {$key} TO {$value}\" );\n\t\t\t\t\tif ( false === $result ) {\n\t\t\t\t\t\tthrow new Exception( $wpdb->last_error );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t$wpdb->query( 'COMMIT' );\n\t}", "public function __construct(){\n // Conectar no banco de dados\n mysql_connect(DBHOST, DBUSER, DBPASS) or die ('Erro ao conectar no banco: '. mysql_error());\n // Selecionar o banco \n mysql_select_db(DBNAME);\n \n $this->execQuery('SET character_set_connection=utf8');\n $this->execQuery('SET character_set_client=utf8');\n $this->execQuery('SET character_set_results=utf8');\n }", "public function getCollation()\n\t{\n\t\treturn false;\n\t}", "abstract protected function setCharset($charset, $collation);", "public function supports_collation()\n {\n }", "public function testCollation()\n {\n $statement = (new CreateTable($this->mockConnection));\n $return = $statement->charset(null, 'utf8_ci');\n $array = $statement->toArray();\n\n $this->assertInstanceOf(CreateTable::class, $return);\n $this->assertEquals([\n 'charset' => null,\n 'collate' => 'utf8_ci',\n ], $array);\n }", "abstract protected function encodingTables();", "public function updateAutoEncoding() {}", "private function upgrade_0_2_to_0_3()\n {\n $sql = \"ALTER TABLE {$this->config->dbTablePrefix}keyword\n ADD `lang` char(2) NOT NULL default 'en' AFTER `status`,\n ADD `lang_dir` char(3) NOT NULL default 'ltr' AFTER `modifydate`,\n ADD `format` varchar(20) NOT NULL default 'html' AFTER `description`,\n ADD KEY `lang` (`lang`)\";\n\n $this->model->dba->query($sql);\n\n $this->model->action('common','setConfigVar',\n array('data' => array('use_format' => 0,\n 'use_lang' => 0,\n 'default_format' => 'html',\n 'default_lang' => 'en'),\n 'module' => 'keyword') );\n }", "public function reloadTableNames() {\n\t\t$this->_loadTableNames();\n\t}", "public static function es_upgrade_database_for_3_3() {\n\t\tglobal $wpdb;\n\n\t\t$settings_to_rename = array(\n\t\t\t\t\t\t\t\t\t'es_c_fromname' \t\t=> 'ig_es_fromname',\n\t\t\t\t\t\t\t\t\t'es_c_fromemail' \t\t=> 'ig_es_fromemail',\n\t\t\t\t\t\t\t\t\t'es_c_mailtype' \t\t=> 'ig_es_emailtype',\n\t\t\t\t\t\t\t\t\t'es_c_adminmailoption' \t=> 'ig_es_notifyadmin',\n\t\t\t\t\t\t\t\t\t'es_c_adminemail' \t\t=> 'ig_es_adminemail',\n\t\t\t\t\t\t\t\t\t'es_c_adminmailsubject' => 'ig_es_admin_new_sub_subject',\n\t\t\t\t\t\t\t\t\t'es_c_adminmailcontant' => 'ig_es_admin_new_sub_content',\n\t\t\t\t\t\t\t\t\t'es_c_usermailoption' \t=> 'ig_es_welcomeemail',\n\t\t\t\t\t\t\t\t\t'es_c_usermailsubject' \t=> 'ig_es_welcomesubject',\n\t\t\t\t\t\t\t\t\t'es_c_usermailcontant' \t=> 'ig_es_welcomecontent',\n\t\t\t\t\t\t\t\t\t'es_c_optinoption' \t\t=> 'ig_es_optintype',\n\t\t\t\t\t\t\t\t\t'es_c_optinsubject' \t=> 'ig_es_confirmsubject',\n\t\t\t\t\t\t\t\t\t'es_c_optincontent' \t=> 'ig_es_confirmcontent',\n\t\t\t\t\t\t\t\t\t'es_c_optinlink' \t\t=> 'ig_es_optinlink',\n\t\t\t\t\t\t\t\t\t'es_c_unsublink' \t\t=> 'ig_es_unsublink',\n\t\t\t\t\t\t\t\t\t'es_c_unsubtext' \t\t=> 'ig_es_unsubcontent',\n\t\t\t\t\t\t\t\t\t'es_c_unsubhtml' \t\t=> 'ig_es_unsubtext',\n\t\t\t\t\t\t\t\t\t'es_c_subhtml' \t\t\t=> 'ig_es_successmsg',\n\t\t\t\t\t\t\t\t\t'es_c_message1' \t\t=> 'ig_es_suberror',\n\t\t\t\t\t\t\t\t\t'es_c_message2' \t\t=> 'ig_es_unsuberror',\n\t\t\t\t\t\t\t\t);\n\n\t\t$options_to_rename = array(\n\t\t\t\t\t\t\t\t\t'es_c_post_image_size' \t\t=> 'ig_es_post_image_size',\n\t\t\t\t\t\t\t\t\t'es_c_sentreport' \t\t\t=> 'ig_es_sentreport',\n\t\t\t\t\t\t\t\t\t'es_c_sentreport_subject' \t=> 'ig_es_sentreport_subject',\n\t\t\t\t\t\t\t\t\t'es_c_rolesandcapabilities' => 'ig_es_rolesandcapabilities',\n\t\t\t\t\t\t\t\t\t'es_c_cronurl' \t\t\t\t=> 'ig_es_cronurl',\n\t\t\t\t\t\t\t\t\t'es_cron_mailcount' \t\t=> 'ig_es_cron_mailcount',\n\t\t\t\t\t\t\t\t\t'es_cron_adminmail' \t\t=> 'ig_es_cron_adminmail',\n\t\t\t\t\t\t\t\t\t'es_c_emailsubscribers' \t=> 'ig_es_sync_wp_users',\n\t\t\t\t\t\t\t\t);\n\n\t\t// Rename options that were previously stored\n\t\tforeach ( $options_to_rename as $old_option_name => $new_option_name ) {\n\t\t\t$option_value = get_option( $old_option_name );\n\t\t\tif ( $option_value ) {\n\t\t\t\tupdate_option( $new_option_name, $option_value );\n\t\t\t\tdelete_option( $old_option_name );\n\t\t\t}\n\t\t}\n\n\t\t// Do not pull data for new users as there is no pluginconfig table created on activation\n\t\t$table_exists = $wpdb->query( \"SHOW TABLES LIKE '{$wpdb->prefix}es_pluginconfig'\" );\n\n\t\tif ( $table_exists > 0 ) {\n\t\t\t// Pull out ES settings data of existing users and move them to options table\n\t\t\t$settings_data = es_cls_settings::es_setting_select(1);\n\t\t\tif ( ! empty( $settings_data ) ) {\n\t\t\t\tforeach ( $settings_data as $name => $value ) {\n\t\t\t\t\tif( array_key_exists( $name, $settings_to_rename ) ){\n\t\t\t\t\t\tupdate_option( $settings_to_rename[ $name ], $value );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//Update User Roles Settings\n\t\t$es_c_rolesandcapabilities = get_option( 'ig_es_rolesandcapabilities', 'norecord' );\n\n\t\tif ( $es_c_rolesandcapabilities != 'norecord' ) {\n\t\t\t$remove_roles = array( 'es_roles_setting', 'es_roles_help' );\n\t\t\tforeach ( $es_c_rolesandcapabilities as $role_name => $role_value ) {\n\t\t\t\tif ( in_array( $role_name, $remove_roles ) ) {\n\t\t\t\t\tunset( $es_c_rolesandcapabilities[$role_name] );\n\t\t\t\t}\n\t\t\t}\n\t\t\tupdate_option( 'ig_es_rolesandcapabilities', $es_c_rolesandcapabilities );\n\t\t}\n\n\t\tupdate_option( 'current_sa_email_subscribers_db_version', '3.3' );\n\t}", "abstract protected function encodingTablesOrder();", "public function alterCharset($table, $charset = 'utf8', $collation = 'utf8_unicode_ci', $execute = true) {\r\n\t\t$sql = 'ALTER TABLE ' . $table . ' MODIFY' . \"\\n\";\r\n\t\t$sql .= 'CHARACTER SET ' . $charset;\r\n\t\t$sql .= 'COLLATE ' . $collation;\r\n\t\tif ($execute) {\r\n\t\t\t$this->exec($sql);\r\n\t\t}\r\n\t\treturn $sql;\r\n\t}", "public function getCharset(): string\n {\n $charsetCollate = '';\n\n $mySlqVersion = $this->getVariable('SELECT VERSION() as mysql_version');\n\n if (version_compare($mySlqVersion, '4.1.0', '>=')) {\n if (!empty($this->wpDatabase->charset)) {\n $charsetCollate = \"DEFAULT CHARACTER SET {$this->wpDatabase->charset}\";\n }\n\n if (!empty($this->wpDatabase->collate)) {\n $charsetCollate .= \" COLLATE {$this->wpDatabase->collate}\";\n }\n }\n\n return $charsetCollate;\n }", "public function autoSetTableNames()\n\t{\n\t\t$db = $this->getDatabaseInstance();\n\t\t$query = \"SHOW TABLE STATUS LIKE 'event\\_log%'\";\n\t\t\n\t\t$result = $db->prepare($query);\n\t\t$result->execute();\n\t\t\n\t\t$table_names = array();\n\t\twhile ($row = $result->fetch())\n\t\t{\n\t\t\tif (strcasecmp($row['Engine'], 'MRG_MyISAM'))\n\t\t\t{\n\t\t\t\t$table_names[] = $row['Name'];\n\t\t\t}\n\t\t}\n\t\t\n\t\trsort($table_names);\n\t\t\n\t\t$this->setTableNames($table_names);\n\t\tif (isset($table_names[0]))\n\t\t{\n\t\t\t$this->setTableName($table_names[0]);\n\t\t}\n\t}", "static function replaceDbPrefix($sql)\r\n{\r\n\t$app = JFactory::getApplication();\r\n\t$dbprefix = $app->getCfg('dbprefix');\r\n\treturn str_replace('#__',$dbprefix,$sql);\r\n}", "public function applyTcaForPreRegisteredTables() {}", "public function applyTcaForPreRegisteredTables()\n {\n $this->registerDefaultCategorizedTables();\n foreach ($this->registry as $tableName => $fields) {\n foreach ($fields as $fieldName => $_) {\n $this->applyTcaForTableAndField($tableName, $fieldName);\n }\n }\n }", "private function activateCreateAlterTables()\n {\n $PluginDbStructure = new \\RdDownloads\\App\\Models\\PluginDbStructure();\n $schemas = $PluginDbStructure->get();\n unset($PluginDbStructure);\n\n if (is_array($schemas) && !empty($schemas) && !is_null($this->getDbVersion())) {\n global $wpdb;\n // require file that needs for use dbDelta() function.\n require_once ABSPATH . '/wp-admin/includes/upgrade.php';\n\n foreach ($schemas as $index => $item) {\n if (isset($item['statement']) && isset($item['tablename'])) {\n $sql = str_replace('%TABLE%', $item['tablename'], $item['statement']);\n\n if (isset($item['is_multisite']) && $item['is_multisite'] === true) {\n // if set to multisite table then it will create prefix_sitenumber_tablename.\n $prefix = $wpdb->prefix;\n } else {\n // if set not to multisite then it will create prefix_tablename.\n $prefix = $wpdb->base_prefix;\n }\n\n $sql = str_replace('%PREFIX%', $prefix, $sql);\n dbDelta($sql);\n unset($sql);\n\n if (function_exists('maybe_convert_table_to_utf8mb4')) {\n maybe_convert_table_to_utf8mb4($prefix . $item['tablename']);\n }\n unset($prefix);\n }\n }// endforeach;\n unset($index, $item);\n }\n\n unset($schemas);\n }", "protected function getTableCollation(Connection $connection, $table, &$definition) {\n // Remove identifier quotes from the table name. See\n // \\Drupal\\mysql\\Driver\\Database\\mysql\\Connection::$identifierQuotes.\n $table = trim($connection->prefixTables('{' . $table . '}'), '\"');\n $query = $connection->query(\"SHOW TABLE STATUS WHERE NAME = :table_name\", [':table_name' => $table]);\n $data = $query->fetchAssoc();\n\n // Map the collation to a character set. For example, 'utf8mb4_general_ci'\n // (MySQL 5) or 'utf8mb4_0900_ai_ci' (MySQL 8) will be mapped to 'utf8mb4'.\n [$charset] = explode('_', $data['Collation'], 2);\n\n // Set `mysql_character_set`. This will be ignored by other backends.\n $definition['mysql_character_set'] = $charset;\n }", "private function do_fix_database() {\n\t\tglobal $wpdb, $wp_version, $utils;\n\t\t$global_schema_to_change = array(\n\t\t\t\t$wpdb->prefix.'commentmeta' => array(\n\t\t\t\t\t\"comment_id bigint(20) unsigned NOT NULL default '0'\",\n\t\t\t\t\t\"meta_key varchar(255) default NULL\",\n\t\t\t\t\t\"meta_value longtext\"\n\t\t\t\t),\n\t\t\t\t$wpdb->prefix.'comments' => array(\n\t\t\t\t\t\"comment_post_ID bigint(20) unsigned NOT NULL default '0'\",\n\t\t\t\t\t\"comment_author_email varchar(100) NOT NULL default ''\",\n\t\t\t\t\t\"comment_author_url varchar(200) NOT NULL default ''\",\n\t\t\t\t\t\"comment_author_IP varchar(100) NOT NULL default ''\",\n\t\t\t\t\t\"comment_date datetime NOT NULL default '0000-00-00 00:00:00'\",\n\t\t\t\t\t\"comment_date_gmt datetime NOT NULL default '0000-00-00 00:00:00'\",\n\t\t\t\t\t\"comment_karma int(11) NOT NULL default '0'\",\n\t\t\t\t\t\"comment_approved varchar(20) NOT NULL default '1'\",\n\t\t\t\t\t\"comment_agent varchar(255) NOT NULL default ''\",\n\t\t\t\t\t\"comment_type varchar(20) NOT NULL default ''\",\n\t\t\t\t\t\"comment_parent bigint(20) unsigned NOT NULL default '0'\",\n\t\t\t\t\t\"user_id bigint(20) unsigned NOT NULL default '0'\"\n\t\t\t\t),\n\t\t\t\t$wpdb->prefix.'links' => array(\n\t\t\t\t\t\"link_url varchar(255) NOT NULL default ''\",\n\t\t\t\t\t\"link_name varchar(255) NOT NULL default ''\",\n\t\t\t\t\t\"link_image varchar(255) NOT NULL default ''\",\n\t\t\t\t\t\"link_target varchar(25) NOT NULL default ''\",\n\t\t\t\t\t\"link_description varchar(255) NOT NULL default ''\",\n\t\t\t\t\t\"link_visible varchar(20) NOT NULL default 'Y'\",\n\t\t\t\t\t\"link_owner bigint(20) unsigned NOT NULL default '1'\",\n\t\t\t\t\t\"link_rating int(11) NOT NULL default '0'\",\n\t\t\t\t\t\"link_updated datetime NOT NULL default '0000-00-00 00:00:00'\",\n\t\t\t\t\t\"link_rel varchar(255) NOT NULL default ''\",\n\t\t\t\t\t\"link_notes mediumtext NOT NULL\",\n\t\t\t\t\t\"link_rss varchar(255) NOT NULL default ''\"\n\t\t\t\t),\n\t\t\t\t$wpdb->prefix.'options' => array(\n\t\t\t\t\t\"option_name varchar(64) NOT NULL default ''\",\n\t\t\t\t\t\"option_value longtext NOT NULL\",\n\t\t\t\t\t\"autoload varchar(20) NOT NULL default 'yes'\"\n\t\t\t\t),\n\t\t\t\t$wpdb->prefix.'postmeta' => array(\n\t\t\t\t\t\"post_id bigint(20) unsigned NOT NULL default '0'\",\n\t\t\t\t\t\"meta_key varchar(255) default NULL\",\n\t\t\t\t\t\"meta_value longtext\"\n\t\t\t\t),\n\t\t\t\t$wpdb->prefix.'posts' => array(\n\t\t\t\t\t\"post_author bigint(20) unsigned NOT NULL default '0'\",\n\t\t\t\t\t\"post_date datetime NOT NULL default '0000-00-00 00:00:00'\",\n\t\t\t\t\t\"post_date_gmt datetime NOT NULL default '0000-00-00 00:00:00'\",\n\t\t\t\t\t\"post_status varchar(20) NOT NULL default 'publish'\",\n\t\t\t\t\t\"comment_status varchar(20) NOT NULL default 'open'\",\n\t\t\t\t\t\"ping_status varchar(20) NOT NULL default 'open'\",\n\t\t\t\t\t\"post_password varchar(20) NOT NULL default ''\",\n\t\t\t\t\t\"post_name varchar(200) NOT NULL default ''\",\n\t\t\t\t\t\"post_modified datetime NOT NULL default '0000-00-00 00:00:00'\",\n\t\t\t\t\t\"post_modified_gmt datetime NOT NULL default '0000-00-00 00:00:00'\",\n\t\t\t\t\t\"post_content_filtered longtext NOT NULL\",\n\t\t\t\t\t\"post_parent bigint(20) unsigned NOT NULL default '0'\",\n\t\t\t\t\t\"guid varchar(255) NOT NULL default ''\",\n\t\t\t\t\t\"menu_order int(11) NOT NULL default '0'\",\n\t\t\t\t\t\"post_type varchar(20) NOT NULL default 'post'\",\n\t\t\t\t\t\"post_mime_type varchar(100) NOT NULL default ''\",\n\t\t\t\t\t\"comment_count bigint(20) NOT NULL default '0'\"\n\t\t\t\t),\n\t\t\t\t$wpdb->prefix.'term_relationships' => array(\n\t\t\t\t\t\"term_order int(11) NOT NULL default 0\"\n\t\t\t\t),\n\t\t\t\t$wpdb->prefix.'term_taxonomy' => array(\n\t\t\t\t\t\"taxonomy varchar(32) NOT NULL default ''\",\n\t\t\t\t\t\"description longtext NOT NULL\",\n\t\t\t\t\t\"parent bigint(20) unsigned NOT NULL default 0\",\n\t\t\t\t\t\"count bigint(20) NOT NULL default 0\"\n\t\t\t\t),\n\t\t\t\t$wpdb->prefix.'terms' => array(\n\t\t\t\t\t\"name varchar(200) NOT NULL default ''\",\n\t\t\t\t\t\"slug varchar(200) NOT NULL default ''\",\n\t\t\t\t\t\"term_group bigint(10) NOT NULL default 0\"\n\t\t\t\t),\n\t\t\t\t$wpdb->prefix.'users' => array(\n\t\t\t\t\t\"user_login varchar(60) NOT NULL default ''\",\n\t\t\t\t\t\"user_pass varchar(64) NOT NULL default ''\",\n\t\t\t\t\t\"user_nicename varchar(50) NOT NULL default ''\",\n\t\t\t\t\t\"user_email varchar(100) NOT NULL default ''\",\n\t\t\t\t\t\"user_url varchar(100) NOT NULL default ''\",\n\t\t\t\t\t\"user_registered datetime NOT NULL default '0000-00-00 00:00:00'\",\n\t\t\t\t\t\"user_activation_key varchar(60) NOT NULL default ''\",\n\t\t\t\t\t\"user_status int(11) NOT NULL default '0'\",\n\t\t\t\t\t\"display_name varchar(250) NOT NULL default ''\"\n\t\t\t\t),\n\t\t\t\t$wpdb->prefix.'usermeta' => array(\n\t\t\t\t\t\"user_id bigint(20) unsigned NOT NULL default '0'\",\n\t\t\t\t\t\"meta_key varchar(255) default NULL\",\n\t\t\t\t\t\"meta_value longtext\"\n\t\t\t\t)\n\t\t);\n\n\t\t$network_schema_to_change = array(\n\t\t\t\t$wpdb->prefix.'blog_versions' => array(\n\t\t\t\t\t\"blog_id bigint(20) NOT NULL default '0'\",\n\t\t\t\t\t\"db_version varchar(20) NOT NULL default ''\",\n\t\t\t\t\t\"last_updated datetime NOT NULL default '0000-00-00 00:00:00'\"\n\t\t\t\t),\n\t\t\t\t$wpdb->prefix.'blogs' => array(\n\t\t\t\t\t\"site_id bigint(20) NOT NULL default '0'\",\n\t\t\t\t\t\"domain varchar(200) NOT NULL default ''\",\n\t\t\t\t\t\"path varchar(100) NOT NULL default ''\",\n\t\t\t\t\t\"registered datetime NOT NULL default '0000-00-00 00:00:00'\",\n\t\t\t\t\t\"last_updated datetime NOT NULL default '0000-00-00 00:00:00'\",\n\t\t\t\t\t\"public tinyint(2) NOT NULL default '1'\",\n\t\t\t\t\t\"mature tinyint(2) NOT NULL default '0'\",\n\t\t\t\t\t\"spam tinyint(2) NOT NULL default '0'\",\n\t\t\t\t\t\"deleted tinyint(2) NOT NULL default '0'\",\n\t\t\t\t\t\"lang_id int(11) NOT NULL default '0'\"\n\t\t\t\t),\n\t\t\t\t$wpdb->prefix.'registration_log' => array(\n\t\t\t\t\t\"email varchar(255) NOT NULL default ''\",\n\t\t\t\t\t\"IP varchar(30) NOT NULL default ''\",\n\t\t\t\t\t\"blog_id bigint(20) NOT NULL default '0'\",\n\t\t\t\t\t\"date_registered datetime NOT NULL default '0000-00-00 00:00:00'\"\n\t\t\t\t),\n\t\t\t\t$wpdb->prefix.'signups' => array(\n\t\t\t\t\t\"domain varchar(200) NOT NULL default ''\",\n\t\t\t\t\t\"path varchar(100) NOT NULL default ''\",\n\t\t\t\t\t\"title longtext NOT NULL\",\n\t\t\t\t\t\"user_login varchar(60) NOT NULL default ''\",\n\t\t\t\t\t\"user_email varchar(100) NOT NULL default ''\",\n\t\t\t\t\t\"registered datetime NOT NULL default '0000-00-00 00:00:00'\",\n\t\t\t\t\t\"activated datetime NOT NULL default '0000-00-00 00:00:00'\",\n\t\t\t\t\t\"active tinyint(1) NOT NULL default '0'\",\n\t\t\t\t\t\"activation_key varchar(50) NOT NULL default ''\",\n\t\t\t\t\t\"meta longtext\"\n\t\t\t\t),\n\t\t\t\t$wpdb->prefix.'site' => array(\n\t\t\t\t\t\"domain varchar(200) NOT NULL default ''\",\n\t\t\t\t\t\"path varchar(100) NOT NULL default ''\"\n\t\t\t\t),\n\t\t\t\t$wpdb->prefix.'sitemeta' => array(\n\t\t\t\t\t\"site_id bigint(20) NOT NULL default '0'\",\n\t\t\t\t\t\"meta_key varchar(255) default NULL\",\n\t\t\t\t\t\"meta_value longtext\"\n\t\t\t\t),\n\t\t\t\t$wpdb->prefix.'users' => array(\n\t\t\t\t\t\"user_login varchar(60) NOT NULL default ''\",\n\t\t\t\t\t\"spam tinyint(2) NOT NULL default '0'\",\n\t\t\t\t\t\"deleted tinyint(2) NOT NULL default '0'\"\n\t\t\t\t)\n\t\t);\n\t\tif (version_compare($wp_version, '3.6', '<')) return false;\n\t\t$return_val = array();\n\t\t$queries = array();\n\t\t$results = $this->sanity_check();\n\t\tif ($results !== true) {\n\t\t\tif (!$this->maintenance_backup()) {\n\t\t\t\t$message = __('Can\\'t create backup file.', $domain);\n\t\t\t\treturn $message;\n\t\t\t}\n\t\t\t$tables = array_keys($results);\n\t\t\tforeach ($tables as $table) {\n\t\t\t\tif (key_exists($table, $global_schema_to_change)) {\n\t\t\t\t\t$queries = $global_schema_to_change[$table];\n\t\t\t\t}\n\t\t\t\tif (key_exists($table, $network_schema_to_change)) {\n\t\t\t\t\tif (!empty($queries)) {\n\t\t\t\t\t\t$queries = array_merge($queries, $network_schema_to_change[$table]);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$queries = $network_schema_to_change[$table];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tforeach ($queries as $query) {\n\t\t\t\t\t$sql = 'ALTER TABLE' . ' ' . $table . ' ' . 'CHANGE COLUMN' . ' ' . $query;\n\t\t\t\t\t$res = $wpdb->query($sql);\n\t\t\t\t\tif ($res === false) {\n\t\t\t\t\t\t$return_val[] = __('Failed: ', $domain) . $query;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t$message = __('Your database is OK. You don\\'t have to restore it.', $domain);\n\t\t\treturn $message;\n\t\t}\n\t\tif (empty($return_val)) {\n\t\t\t$message = __('Your database restoration is successfully finished!', $domain);\n\t\t\treturn $message;\n\t\t} else {\n\t\t\treturn $return_val;\n\t\t}\n\t}", "protected function collate(Table $table, Magic $column)\n {\n // TODO: Beberapa tipe kolom (seperti char, enum, set) belum didukung oleh rakit.\n // saat ini dukungan masih terbatas pada tipe kolom yang berbasis teks.\n if (in_array($column->type, ['string', 'text']) && $column->collate) {\n return ' CHARACTER SET ' . $column->collate;\n }\n }", "function wpdbfix() {\n\t\tglobal $wpdb;\n\t\t$wpdb->taxonomymeta = \"{$wpdb->prefix}taxonomymeta\";\n\t}", "private function set_charset() {\n\t\t//regresa bool\n\t\t$this->conn->set_charset(\"utf8\");\n\t}", "public function convertDatabaseToUTF8();", "function repairTables(){\n\tglobal $vc;\n\treturn mysqli_query($vc,\"REPAIR TABLE checkin,volunteer,volunteerlog,volunteertask;\")!=false;\n}", "protected function setTablePrefix()\n {\n }", "function convert_to_utf8($obj)\n{\n global $config;\n $ret = $obj;\n // wenn die Verbindung zur Datenbank nicht auf utf8 steht, dann muessen die Rückgaben in utf8 gewandelt werden,\n // da die Webseite utf8-kodiert ist\n if (!isset($config['mysql_can_change_encoding'])) {\n get_sql_encodings();\n }\n\n if ($config['mysql_can_change_encoding'] == false && $config['mysql_standard_character_set'] != 'utf8') {\n if (is_array($obj)) {\n foreach ($obj as $key => $val) {\n //echo \"<br> Wandle \" . $val . \" nach \";\n $obj[$key] = utf8_encode($val);\n //echo $obj[$key];\n }\n }\n if (is_string($obj)) {\n $obj = utf8_encode($obj);\n }\n $ret = $obj;\n }\n\n return $ret;\n}", "public function set_charset($dbh, $charset = \\null, $collate = \\null)\n {\n }", "public function compileAdminTables() {}", "protected function fixMultilingualPageRelations()\n {\n $this->connection->query(<<<'EOT'\nDELETE MultilingualPageRelations\nFROM MultilingualPageRelations\nLEFT JOIN MultilingualSections ON (\n (MultilingualPageRelations.mpLocale = CONCAT(MultilingualSections.msLanguage, '_', MultilingualSections.msCountry))\n OR\n (MultilingualPageRelations.mpLocale = MultilingualSections.msLanguage AND '' = MultilingualSections.msCountry)\n)\nWHERE MultilingualSections.cID IS NULL\nEOT\n );\n // Set the mpLanguage field where it's missing\n $this->connection->query(<<<'EOT'\nUPDATE MultilingualPageRelations\nSET mpLanguage = mpLocale\nWHERE mpLanguage = '' AND LOCATE('_', mpLocale) = 0\nEOT\n );\n $this->connection->query(<<<'EOT'\nUPDATE MultilingualPageRelations\nSET mpLanguage = LEFT(mpLocale, LOCATE('_', mpLocale) - 1)\nWHERE mpLanguage = '' AND LOCATE('_', mpLocale) > 1\nEOT\n );\n // Determine the map between locale and cID\n $locales = [];\n $rs = $this->connection->query('SELECT cID, msLanguage, msCountry FROM MultilingualSections');\n while (false !== ($row = $rs->fetch())) {\n $locales[$row['msLanguage'] . '_' . $row['msCountry']] = (int) $row['cID'];\n if ((string) $row['msLanguage'] === '') {\n $locales[$row['msLanguage']] = (int) $row['cID'];\n }\n }\n // Delete duplicated relations p\n $rs = $this->connection->query(<<<'EOT'\nSELECT\n mpRelationID, cID, GROUP_CONCAT(mpLocale SEPARATOR '|') as mpLocales\nFROM\n MultilingualPageRelations\nGROUP BY\n mpRelationID,\n cID\nHAVING\n LOCATE('|', mpLocales) > 0\nEOT\n );\n while (false !== ($row = $rs->fetch())) {\n $cID = (int) $row['cID'];\n $trail = null;\n $mpLocales = explode('|', $row['mpLocales']);\n foreach (explode('|', $row['mpLocales']) as $locale) {\n if (!isset($locales[$locale])) {\n $delete = true;\n } elseif ($locales[$locale] === $cID) {\n $delete = false;\n } else {\n if ($trail === null) {\n $trail = $this->getCollectionIdTrail($cID);\n }\n $delete = !in_array($locales[$locale], $trail, true);\n }\n if ($delete) {\n $this->connection->executeQuery('DELETE FROM MultilingualPageRelations WHERE mpRelationID = ? AND cID = ? AND mpLocale = ?', [$row['mpRelationID'], $cID, $locale]);\n }\n }\n }\n }", "function convert_to_latin1($obj)\n{\n global $config;\n $ret = $obj;\n // wenn die Verbindung zur Datenbank nicht auf utf8 steht, dann muessen die Rückgaben in utf8 gewandelt werden,\n // da die Webseite utf8-kodiert ist\n if ($config['mysql_can_change_encoding'] == false && $config['mysql_standard_character_set'] != 'utf8') {\n if (is_array($obj)) {\n foreach ($obj as $key => $val) {\n $obj[$key] = utf8_decode($val);\n }\n }\n if (is_string($obj)) {\n $obj = utf8_decode($obj);\n }\n $ret = $obj;\n }\n\n return $ret;\n}", "protected function provideTableClassNameMap(): void\n {\n $list = $this->tempMerge('tca.meta.classNameMap', 'tca.classNameMap');\n if (is_array($list)) {\n NamingUtil::$tcaTableClassNameMap = array_merge(NamingUtil::$tcaTableClassNameMap, $list);\n }\n }", "protected function migrateTables()\n {\n foreach ($this->tables as $table) {\n \\DB::getPdo()->exec(\"INSERT IGNORE INTO {$this->newDbName}.{$table} SELECT * FROM {$this->oldDbName}.{$table}\");\n }\n }", "public function getCollation()\n\t{\n\t\treturn $this->charset;\n\t}", "function ajan_core_get_table_prefix() {\n\tglobal $wpdb;\n\n\treturn apply_filters( 'ajan_core_get_table_prefix', $wpdb->base_prefix );\n}", "public static function update_schema(): void {\n\t\tglobal $wpdb;\n\n\t\t$table_name = static::table_name();\n\t\t$table_fields = static::FIELDS;\n\t\t$charset_collate = $wpdb->get_charset_collate();\n\n\t\t$sql = \"CREATE TABLE $table_name (\n\t\t\tid bigint(20) NOT NULL AUTO_INCREMENT,\n\t\t\t$table_fields\n\t\t\tPRIMARY KEY (id)\n\t\t) $charset_collate;\";\n\n\t\tif ( md5( $sql ) === get_option( static::TABLE . '_schemaver', '' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\trequire_once ABSPATH . 'wp-admin/includes/upgrade.php';\n\t\tdbDelta( $sql );\n\n\t\tupdate_option( static::TABLE . '_schemaver', md5( $sql ) );\n\t}", "protected function loadTables($connection)\n {\n $tables = $connection->executeS('\n SELECT t.TABLE_NAME, t.ENGINE, c.CHARACTER_SET_NAME, t.TABLE_COLLATION\n FROM information_schema.TABLES t\n LEFT JOIN information_schema.COLLATION_CHARACTER_SET_APPLICABILITY c ON (c.COLLATION_NAME = t.TABLE_COLLATION)\n WHERE t.TABLE_SCHEMA = ' . $this->database .\n $this->addTablesRestriction('t')\n );\n foreach ($tables as $row) {\n $table = new TableSchema($row['TABLE_NAME']);\n $table->setEngine($row['ENGINE']);\n $table->setCharset(new DatabaseCharset($row['CHARACTER_SET_NAME'], $row['TABLE_COLLATION']));\n $this->schema->addTable($table);\n }\n }", "function sql_set_charset($charset, $dbh=NULL) {\n global $MYSQL_HANDLER,$SQL_DBH;\n if (strpos($MYSQL_HANDLER[1], 'mysql') === 0) {\n switch(strtolower($charset)){\n case 'utf-8':\n case 'utf8':\n $charset = 'utf8';\n break;\n case 'utf8mb4':\n $charset = 'utf8mb4';\n break;\n case 'euc-jp':\n case 'ujis':\n $charset = 'ujis';\n break;\n case 'gb2312':\n $charset = 'gb2312';\n break;\n /*\n case 'shift_jis':\n case 'sjis':\n $charset = 'sjis';\n break;\n */\n default:\n $charset = 'latin1';\n break;\n }\n\n $db = ($dbh ? $dbh : sql_get_db());\n $mySqlVer = implode('.', array_map('intval', explode('.', sql_get_server_info($db))));\n if (version_compare($mySqlVer, '4.1.0', '>='))\n {\n $res = $db->exec(\"SET CHARACTER SET \" . $charset);\n }\n }\n return $res;\n }", "protected function fixDbOnUpdate()\n\t{\n\t\t$db = JFactory::getDBO();\n\n\t\t$query = \"SHOW COLUMNS FROM #__hierarchy_users\";\n\t\t$db->setQuery($query);\n\t\t$res = $db->loadColumn();\n\n\t\tif (!in_array('subuser_id', $res))\n\t\t{\n\t\t\t$query = \"ALTER TABLE #__hierarchy_users add column subuser_id int(11);\";\n\t\t\t$db->setQuery($query);\n\t\t\t$db->execute();\n\t\t}\n\t\t\n\t\tif (!in_array('client', $res))\n\t\t{\n\t\t\t$query = \"ALTER TABLE #__hierarchy_users add column client VARCHAR(255);\";\n\t\t\t$db->setQuery($query);\n\t\t\t$db->execute();\n\t\t}\n\n\t\tif (!in_array('client_id', $res))\n\t\t{\n\t\t\t$query = \"ALTER TABLE #__hierarchy_users add column client_id INT(11);\";\n\t\t\t$db->setQuery($query);\n\t\t\t$db->execute();\n\t\t}\n\n\t\tif (!in_array('state', $res))\n\t\t{\n\t\t\t$query = \"ALTER TABLE #__hierarchy_users add column state INT(11);\";\n\t\t\t$db->setQuery($query);\n\t\t\t$db->execute();\n\t\t}\n\n\t\tif (!in_array('note', $res))\n\t\t{\n\t\t\t$query = \"ALTER TABLE #__hierarchy_users add column note TEXT;\";\n\t\t\t$db->setQuery($query);\n\t\t\t$db->execute();\n\t\t}\n\n\t\t$query = \"ALTER TABLE #__hierarchy_users modify subuser_id int(11);\";\n\t\t$db->setQuery($query);\n\t\t$db->execute();\n\t}", "function database_set_charset($charset)\n {\n\t if( function_exists('mysql_set_charset') === TRUE )\n {\n\t return mysql_set_charset($charset, $this->database_connection);\n\t }\n else\n {\n\t return $this->database_query('SET NAMES \"'.$charset.'\"');\n\t }\n\t}", "protected function setUtf8Context()\n {\n $locale = 'en_US.UTF-8';\n setlocale(LC_ALL, $locale);\n putenv('LC_ALL=' . $locale);\n }", "function installDb()\n\t{\n\t\t// Table category\n\t\t$sql = 'DROP TABLE IF EXISTS '._DB_PREFIX_.'pl_blog_category';\n\t\tDb::getInstance()->Execute($sql);\n\t\t\n\t\t$sql = 'CREATE TABLE IF NOT EXISTS '._DB_PREFIX_.'pl_blog_category(\n\t\t\t\tid_pl_blog_category int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\tcategory_url nvarchar(1000) NULL,\n\t\t\t\tcategory_parent int(11) NULL,\n\t\t\t\tcategory_date_create datetime NULL,\n\t\t\t\tcategory_status boolean NULL,\n\t\t\t\tposition int(11) NULL,\n\t\t\t\tcategory_allow_comment bool NULL,\n\t\t\t\tPRIMARY KEY (id_pl_blog_category)\n\t\t\t\t)';\n\t\tDb::getInstance()->Execute($sql);\n\t\t\n\t\t$sql =' INSERT INTO '._DB_PREFIX_.'pl_blog_category(category_status, position) VALUES(1, 0) ';\n\t\tDb::getInstance()->Execute($sql);\n\n\t\t// Table category_lang\n\t\t$sql = 'DROP TABLE IF EXISTS '._DB_PREFIX_.'pl_blog_category_lang';\n\t\tDb::getInstance()->Execute($sql);\n\t\t\n\t\t$sql = 'CREATE TABLE IF NOT EXISTS '._DB_PREFIX_.'pl_blog_category_lang(\n\t\t\t\tid_pl_blog_category int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\tid_lang int(11) NOT NULL,\n\t\t\t\tcategory_name nvarchar(500) NULL,\n\t\t\t\tcategory_description nvarchar(2000) NULL,\n\t\t\t\tcategory_meta_title nvarchar(500) NULL,\n\t\t\t\tcategory_meta_description nvarchar(1000) NULL,\n\t\t\t\tcategory_meta_keywords nvarchar(1000) NULL,\n\t\t\t\tlink_rewrite nvarchar(1000) NULL,\n\t\t\t\tPRIMARY KEY(id_pl_blog_category, id_lang)\n\t\t\t\t)';\n\t\tDb::getInstance()->Execute($sql);\n\t\t\n\t\t$langs = Db::getInstance()->ExecuteS('SELECT * FROM '._DB_PREFIX_.'lang');\n\t\tforeach ($langs as $lang)\n\t\t{\n\t\t\t$sql = ' INSERT INTO '._DB_PREFIX_.'pl_blog_category_lang(id_pl_blog_category, id_lang, category_name) VALUES(1, '.$lang['id_lang'].',\"\") ';\n\t\t\tDb::getInstance()->Execute($sql);\n\t\t}\n\t\t\n\t\t/*Table post and post_lang*/\n\t\t// Table post\n\t\t$sql = 'DROP TABLE IF EXISTS '._DB_PREFIX_.'pl_blog_post';\n\t\tDb::getInstance()->Execute($sql);\n\t\t\n\t\t$sql = 'CREATE TABLE IF NOT EXISTS '._DB_PREFIX_.'pl_blog_post(\n\t\t\t\tid_pl_blog_post int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\tid_pl_blog_category int(11) NULL,\n\t\t\t\tid_pl_blog_tags int(11) NULL,\n\t\t\t\tpost_date_create TIMESTAMP NOT NULL, \n\t\t\t\tpost_allow_comment boolean NULL,\n\t\t\t\tpost_status boolean NULL,\n\t\t\t\tPRIMARY KEY(id_pl_blog_post)\n\t\t\t\t)';\n\t\tDb::getInstance()->Execute($sql);\n\t\t\n\t\t// Table post_lang\n\t\t$sql = 'DROP TABLE IF EXISTS '._DB_PREFIX_.'pl_blog_post_lang';\n\t\tDb::getInstance()->Execute($sql);\n\t\t\n\t\t$sql = 'CREATE TABLE IF NOT EXISTS '._DB_PREFIX_.'pl_blog_post_lang(\n\t\t\t\tid_pl_blog_post int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\tid_lang int(11) NOT NULL,\n\t\t\t\tpost_title nvarchar(2000) NULL,\n\t\t\t\tpost_description text NULL,\n\t\t\t\tpost_meta_title nvarchar(500) NULL,\n\t\t\t\tpost_meta_description nvarchar(1000) NULL,\n\t\t\t\tpost_meta_keywords nvarchar(1000) NULL,\n\t\t\t\tlink_rewrite nvarchar(1000) NULL,\n\t\t\t\tPRIMARY KEY(id_pl_blog_post, id_lang)\n\t\t\t\t)';\n\t\tDb::getInstance()->Execute($sql);\n\t\t\n\t\t/* Table post_tag */\n\t\t$sql = \"CREATE TABLE IF NOT EXISTS \"._DB_PREFIX_.\"pl_blog_post_tag(\n\t\t\t\tid_pl_blog_post int(11) NOT NULL,\n\t\t\t\tid_pl_tag int(11) NOT NULL,\n\t\t\t\tPRIMARY KEY (id_pl_blog_post, id_pl_tag)\n\t\t\t\t)\";\n\t\tDb::getInstance()->Execute($sql);\n\t\t\n\t\t/*Table comment and comment_lang*/\n\t\t// Table comment\n\t\t$sql = 'DROP TABLE IF EXISTS '._DB_PREFIX_.'pl_blog_comment';\n\t\tDb::getInstance()->Execute($sql);\n\t\t\n\t\t$sql = 'CREATE TABLE IF NOT EXISTS '._DB_PREFIX_.'pl_blog_comment(\n\t\t\t\tid_pl_blog_comment int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\tid_pl_blog_post int(11) NULL,\n\t\t\t\tcomment_author_name nvarchar(200) NULL,\n\t\t\t\tcomment_author_email nvarchar(200) NULL,\n\t\t\t\tcomment_date_create datetime NULL,\n\t\t\t\tcomment_status int(11) NULL,\n\t\t\t\tPRIMARY KEY(id_pl_blog_comment)\n\t\t\t\t)';\n\t\tDb::getInstance()->Execute($sql);\t\t\n\t\t\n\t\t// Table comment_lang\n\t\t$sql = 'DROP TABLE IF EXISTS '._DB_PREFIX_.'pl_blog_comment_lang';\n\t\tDb::getInstance()->Execute($sql);\n\t\t\n\t\t$sql = 'CREATE TABLE IF NOT EXISTS '._DB_PREFIX_.'pl_blog_comment_lang(\n\t\t\t\tid_pl_blog_comment int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\tid_lang int(11) NOT NULL,\n\t\t\t\tcomment_content nvarchar(7000) NULL,\n\t\t\t\tPRIMARY KEY(id_pl_blog_comment, id_lang)\n\t\t\t\t)';\n\t\tDb::getInstance()->Execute($sql);\t\t\n\t\t\n\t\t/* Table comment_status */\n\t\t$sql = 'DROP TABLE IF EXISTS '._DB_PREFIX_.'pl_blog_comment_status';\n\t\tDb::getInstance()->Execute($sql);\n\t\t\n\t\t$sql = 'CREATE TABLE IF NOT EXISTS '._DB_PREFIX_.'pl_blog_comment_status(\n\t\t\t\t\tid_pl_blog_comment_status int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\t\tname nvarchar(10) NOT NULL,\n\t\t\t\t\tPRIMARY KEY (id_pl_blog_comment_status)\n\t\t\t\t\t)';\n\t\tDb::getInstance()->Execute($sql);\n\t\t\n\t\t$comment_status_name = array('Pending', 'Approved' , 'Spam' );\n\t\tfor ($i = 0; $i < count($comment_status_name); $i++)\n\t\t{\n\t\t\t$sql = 'INSERT INTO '._DB_PREFIX_.'pl_blog_comment_status(name) VALUES(\"'.$comment_status_name[$i].'\")';\n\t\t\tDb::getInstance()->Execute($sql);\n\t\t}\n\t\t\n\t\t/* Table tags and tags_lang */\n\t\t// Table tags\n\t\t$sql = 'DROP TABLE IF EXISTS '._DB_PREFIX_.'pl_blog_tags';\n\t\tDb::getInstance()->Execute($sql);\n\t\t\n\t\t$sql = 'CREATE TABLE IF NOT EXISTS '._DB_PREFIX_.'pl_blog_tags(\n\t\t\t\tid_pl_blog_tags int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\ttags_url nvarchar(1000) NULL,\n\t\t\t\ttags_date_create datetime NULL,\n\t\t\t\tPRIMARY KEY(id_pl_blog_tags)\n\t\t\t\t)';\n\t\tDb::getInstance()->Execute($sql);\t\t\n\t\t\n\t\t$sql = \"INSERT INTO \"._DB_PREFIX_.\"pl_blog_tags (tags_url)\n\t\t\t\tVALUES('')\n\t\t\t \";\n\t\tDb::getInstance()->Execute($sql);\n\t\t\n\t\t// Table tags_lang\n\t\t$sql = 'DROP TABLE IF EXISTS '._DB_PREFIX_.'pl_blog_tags_lang';\n\t\tDb::getInstance()->Execute($sql);\n\t\t\n\t\t$sql = 'CREATE TABLE IF NOT EXISTS '._DB_PREFIX_.'pl_blog_tags_lang(\n\t\t\t\tid_pl_blog_tags int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\tid_lang int(11) NOT NULL,\n\t\t\t\ttags_name nvarchar(500) NULL,\n\t\t\t\ttags_description nvarchar(7000) NULL,\n\t\t\t\tPRIMARY KEY(id_pl_blog_tags, id_lang)\n\t\t\t\t)';\n\t\tDb::getInstance()->Execute($sql);\t\n\t\t\n\t\t$langs = Db::getInstance()->ExecuteS('SELECT * FROM '._DB_PREFIX_.'lang');\n\t\tforeach ($langs as $lang)\n\t\t{\n\t\t\t$id_lang = $lang['id_lang'];\n\t\t\t$sql = \"INSERT INTO \"._DB_PREFIX_.\"pl_blog_tags_lang (id_pl_blog_tags, id_lang, tags_name)\n\t\t\t\t\tVALUES(1, \".$id_lang.\", '')\n\t\t\t\t \";\n\t\t\tDb::getInstance()->Execute($sql);\n\t\t}\n\t\t\n\t\treturn true;\n\t}", "function wp_super_edit_install_db_tables() {\n\tglobal $wpdb, $wp_super_edit;\n\n\trequire_once( ABSPATH . 'wp-admin/includes/upgrade.php' );\n\n\tif ( !is_object( $wp_super_edit ) ) {\n\t\t$wp_super_edit = new wp_super_edit_admin();\n\t}\n\n\tif ( $wp_super_edit->is_installed ) return;\n\n\tif ( $wpdb->supports_collation() ) {\n\t\tif ( ! empty($wpdb->charset) )\n\t\t\t$charset_collate = \"DEFAULT CHARACTER SET $wpdb->charset\";\n\t\tif ( ! empty($wpdb->collate) )\n\t\t\t$charset_collate .= \" COLLATE $wpdb->collate\";\n\t}\n\n\t$install_sql=\"CREATE TABLE $wp_super_edit->db_options (\n\t id bigint(20) NOT NULL auto_increment,\n\t name varchar(60) NOT NULL,\n\t value text NOT NULL,\n\t PRIMARY KEY (id,name),\n\t UNIQUE KEY name (name)\n\t) $charset_collate;\n\tCREATE TABLE $wp_super_edit->db_plugins (\n\t id bigint(20) NOT NULL auto_increment,\n\t name varchar(60) NOT NULL,\n\t url text NOT NULL,\n\t nicename varchar(120) NOT NULL,\n\t description text NOT NULL,\n\t provider varchar(60) NOT NULL,\n\t status varchar(20) NOT NULL default 'no',\n\t callbacks varchar(120) NOT NULL,\n\t PRIMARY KEY (id,name),\n\t UNIQUE KEY name (name)\n\t) $charset_collate;\n\tCREATE TABLE $wp_super_edit->db_buttons (\n\t id bigint(20) NOT NULL auto_increment,\n\t name varchar(60) NOT NULL,\n\t nicename varchar(120) NOT NULL,\n\t description text NOT NULL,\n\t provider varchar(60) NOT NULL,\n\t plugin varchar(60) NOT NULL,\n\t status varchar(20) NOT NULL default 'no',\n\t PRIMARY KEY (id,name),\n\t UNIQUE KEY id (id)\n\t) $charset_collate;\n\tCREATE TABLE $wp_super_edit->db_users (\n\t id bigint(20) NOT NULL auto_increment,\n\t user_name varchar(60) NOT NULL,\n\t user_nicename varchar(60) NOT NULL,\n\t user_type text NOT NULL,\n\t editor_options text NOT NULL,\n\t PRIMARY KEY (id,user_name),\n\t UNIQUE KEY id (id)\n\t) $charset_collate;\";\n\t\n\tdbDelta($install_sql);\n\t\n\t$wp_super_edit->is_installed = true;\n\t\t\n}", "public function getCollationConnection()\r\n {\r\n return $this->collation_connection;\r\n }", "public function setBinaryCollation()\n {\n $this->isBinaryCollation = true;\n }", "static function set_table_prefix($tp) {\n\t\tself::$table_prefix = $tp;\n\t}", "public function db_changeTablePrefix( $table_prefix )\n\t{\n\t\tif ($table_prefix !== '?') {\n\t\t\t$this->table_prefix = $table_prefix;\n\t\t}\n\t}", "function alter_tables_if_required() {\r\n global $wpdb;\r\n $options = get_option('nus_altered_table');\r\n $altercolumns = false;\r\n if(!$options) {\r\n $altercolumns = true;\r\n }\r\n\r\n if($altercolumns) {\r\n $wpdb->query(\"ALTER TABLE \" . NUS_TEMP_TABLE .\" MODIFY nus_feed_id varchar(255) NOT NULL\");\r\n $wpdb->query(\"ALTER TABLE \" . NUS_TRACKER_TABLE .\" MODIFY nus_feed_id varchar(255) NOT NULL\");\r\n add_option('nus_altered_table', 'altered');\r\n }\r\n\r\n\r\n}", "public function change()\n {\n $table = $this->table('languages');\n $table->addColumn('is_rtl', 'boolean', [\n 'default' => false,\n 'null' => false,\n ]);\n $table->addColumn('trashed', 'datetime', [\n 'default' => null,\n 'null' => true,\n ]);\n $table->changeColumn('is_active', 'boolean', [\n 'default' => true,\n 'null' => false,\n ]);\n $table->renameColumn('short_code', 'code');\n $table->removeColumn('description');\n $table->update();\n }", "public function collateWord($word)\n {\n $trans = array(\n \"ą\" => \"a\",\n \"č\" => \"c\",\n \"ę\" => \"e\",\n \"ė\" => \"e\",\n \"į\" => \"i\",\n \"š\" => \"s\",\n \"ų\" => \"u\",\n \"ū\" => \"u\",\n \"ž\" => \"z\",\n \"Ą\" => \"A\",\n \"Č\" => \"C\",\n \"Ę\" => \"E\",\n \"Ė\" => \"E\",\n \"Į\" => \"I\",\n \"Š\" => \"S\",\n \"Ų\" => \"U\",\n \"Ū\" => \"U\",\n \"Ž\" => \"Z\",\n );\n\n return strtr($word, $trans);\n }", "protected function setUtf8Context()\n {\n setlocale(LC_ALL, $locale = 'en_US.UTF-8');\n putenv('LC_ALL=' . $locale);\n }", "protected function getDatabaseTables() {}", "private function setCharSet()\n {\n // preparing csConvObj\n if (!is_object($GLOBALS['TSFE']->csConvObj)) {\n if (is_object($GLOBALS['LANG'])) {\n $GLOBALS['TSFE']->csConvObj = $GLOBALS['LANG']->csConvObj;\n\n } else {\n $GLOBALS['TSFE']->csConvObj = Tx_Smarty_Service_Compatibility::makeInstance('t3lib_cs');\n }\n }\n\n // preparing renderCharset\n if (!is_object($GLOBALS['TSFE']->renderCharset)) {\n if (is_object($GLOBALS['LANG'])) {\n $GLOBALS['TSFE']->renderCharset = $GLOBALS['LANG']->charSet;\n\n } else {\n $GLOBALS['TSFE']->renderCharset = $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'];\n }\n }\n }", "function travel_map_install() {\n global $wpdb;\n $table_name = $wpdb->prefix . \"travelmap_countries\";\n\n $charset_collate = $wpdb->get_charset_collate();\n\n $sql = \"CREATE TABLE $table_name (\n id mediumint(9) NOT NULL AUTO_INCREMENT,\n time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,\n country varchar(100) DEFAULT '' NOT NULL,\n PRIMARY KEY (id)\n ) $charset_collate;\";\n\n require_once( ABSPATH . 'wp-admin/includes/upgrade.php');\n dbDelta( $sql );\n }", "protected function restoreCharsetForMailer(): void\n {\n global $phpmailer;\n\n $phpmailer->Encoding = $this->originPhpMailerCharset;\n\n \\remove_filter('wp_mail_charset', [$this, 'encodingHelperForMailer']);\n }", "function getStatus($table) {\n return mysql_query(sprintf('SELECT * FROM information_schema.`TABLES` T,information_schema.`COLLATION_CHARACTER_SET_APPLICABILITY` CCSA WHERE CCSA.collation_name = T.table_collation AND T.table_schema = \\'%s\\' AND T.table_name = \\'%s\\'', $this->config[\"database\"], $table));\n }", "protected function _getEncodingTable() {}", "protected function _getEncodingTable() {}", "protected function _getEncodingTable() {}", "private function restored_table($table, $import_table_prefix, $old_table_prefix, $engine = '') {\n\n\t\t$table_without_prefix = substr($table, strlen($import_table_prefix));\n\t\n\t\tif (isset($this->restore_this_table[$old_table_prefix.$table_without_prefix]) && !$this->restore_this_table[$old_table_prefix.$table_without_prefix]) return;\n\n\t\tglobal $wpdb, $updraftplus;\n\t\t\n\t\tif ($table == $import_table_prefix.UpdraftPlus_Options::options_table()) {\n\t\t\t// This became necessary somewhere around WP 4.5 - otherwise deleting and re-saving options stopped working\n\t\t\twp_cache_flush();\n\t\t\t$this->restore_configuration_bundle($table);\n\t\t}\n\n\t\tif (preg_match('/^([\\d+]_)?options$/', substr($table, strlen($import_table_prefix)), $matches)) {\n\t\t\t// The second prefix here used to have a '!$this->is_multisite' on it (i.e. 'options' table on non-multisite). However, the user_roles entry exists in the main options table on multisite too.\n\t\t\tif (($this->is_multisite && !empty($matches[1])) || $table == $import_table_prefix.'options') {\n\t\t\t\n\t\t\t\t$updraftplus->wipe_state_data();\n\t\t\t\n\t\t\t\t$mprefix = empty($matches[1]) ? '' : $matches[1];\n\n\t\t\t\t$new_table_name = $import_table_prefix.$mprefix.\"options\";\n\n\t\t\t\t// WordPress has an option name predicated upon the table prefix. Yuk.\n\t\t\t\tif ($import_table_prefix != $old_table_prefix) {\n\t\t\t\t\t$updraftplus->log(\"Table prefix has changed: changing options table field(s) accordingly (\".$mprefix.\"options)\");\n\t\t\t\t\t$print_line = sprintf(__('Table prefix has changed: changing %s table field(s) accordingly:', 'updraftplus'), 'option').' ';\n\t\t\t\t\tif (false === $wpdb->query(\"UPDATE $new_table_name SET option_name='${import_table_prefix}\".$mprefix.\"user_roles' WHERE option_name='${old_table_prefix}\".$mprefix.\"user_roles' LIMIT 1\")) {\n\t\t\t\t\t\t$print_line .= __('Error', 'updraftplus');\n\t\t\t\t\t\t$updraftplus->log(\"Error when changing options table fields: \".$wpdb->last_error);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$updraftplus->log(\"Options table fields changed OK\");\n\t\t\t\t\t\t$print_line .= __('OK', 'updraftplus');\n\t\t\t\t\t}\n\t\t\t\t\t$updraftplus->log($print_line, 'notice-restore');\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// Now deal with the situation where the imported database sets a new over-ride upload_path that is absolute - which may not be wanted\n\t\t\t\t$new_upload_path = $wpdb->get_row($wpdb->prepare(\"SELECT option_value FROM ${import_table_prefix}\".$mprefix.\"options WHERE option_name = %s LIMIT 1\", 'upload_path'));\n\t\t\t\t$new_upload_path = (is_object($new_upload_path)) ? $new_upload_path->option_value : '';\n\t\t\t\t// The danger situation is absolute and points somewhere that is now perhaps not accessible at all\n\n\t\t\t\tif (!empty($new_upload_path) && $new_upload_path != $this->prior_upload_path && (strpos($new_upload_path, '/') === 0) || preg_match('#^[A-Za-z]:[/\\\\\\]#', $new_upload_path)) {\n\n\t\t\t\t\t// $this->old_siteurl != untrailingslashit(site_url()) is not a perfect proxy for \"is a migration\" (other possibilities exist), but since the upload_path option should not exist since WP 3.5 anyway, the chances of other possibilities are vanishingly small\n\t\t\t\t\tif (!file_exists($new_upload_path) || $this->old_siteurl != $this->our_siteurl) {\n\n\t\t\t\t\t\tif (!file_exists($new_upload_path)) {\n\t\t\t\t\t\t\t$updraftplus->log_e(\"Uploads path (%s) does not exist - resetting (%s)\", $new_upload_path, $this->prior_upload_path);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$updraftplus->log_e(\"Uploads path (%s) has changed during a migration - resetting (to: %s)\", $new_upload_path, $this->prior_upload_path);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (false === $wpdb->query($wpdb->prepare(\"UPDATE ${import_table_prefix}\".$mprefix.\"options SET option_value='%s' WHERE option_name='upload_path' LIMIT 1\", array($this->prior_upload_path)))) {\n\t\t\t\t\t\t\t$updraftplus->log(__('Error', 'updraftplus'), 'notice-restore');\n\t\t\t\t\t\t\t$updraftplus->log(\"Error when changing upload path: \".$wpdb->last_error);\n\t\t\t\t\t\t\t$updraftplus->log(\"Failed\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// TODO:Do on all WPMU tables\n\t\t\t\tif ($table == $import_table_prefix.'options') {\n\t\t\t\t\t// Bad plugin that hard-codes path references - https://wordpress.org/plugins/custom-content-type-manager/\n\t\t\t\t\t$cctm_data = $wpdb->get_row($wpdb->prepare(\"SELECT option_value FROM $new_table_name WHERE option_name = %s LIMIT 1\", 'cctm_data'));\n\t\t\t\t\tif (!empty($cctm_data->option_value)) {\n\t\t\t\t\t\t$cctm_data = maybe_unserialize($cctm_data->option_value);\n\t\t\t\t\t\tif (is_array($cctm_data) && !empty($cctm_data['cache']) && is_array($cctm_data['cache'])) {\n\t\t\t\t\t\t\t$cctm_data['cache'] = array();\n\t\t\t\t\t\t\t$updraftplus->log_e(\"Custom content type manager plugin data detected: clearing option cache\");\n\t\t\t\t\t\t\tupdate_option('cctm_data', $cctm_data);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// Another - http://www.elegantthemes.com/gallery/elegant-builder/\n\t\t\t\t\t$elegant_data = $wpdb->get_row($wpdb->prepare(\"SELECT option_value FROM $new_table_name WHERE option_name = %s LIMIT 1\", 'et_images_temp_folder'));\n\t\t\t\t\tif (!empty($elegant_data->option_value)) {\n\t\t\t\t\t\t$dbase = basename($elegant_data->option_value);\n\t\t\t\t\t\t$wp_upload_dir = wp_upload_dir();\n\t\t\t\t\t\t$edir = $wp_upload_dir['basedir'];\n\t\t\t\t\t\tif (!is_dir($edir.'/'.$dbase)) @mkdir($edir.'/'.$dbase);// phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged\n\t\t\t\t\t\t$updraftplus->log_e(\"Elegant themes theme builder plugin data detected: resetting temporary folder\");\n\t\t\t\t\t\tupdate_option('et_images_temp_folder', $edir.'/'.$dbase);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// The gantry menu plugin sometimes uses too-long transient names, causing the timeout option to be missing; and hence the transient becomes permanent.\n\t\t\t\t// WP 3.4 onwards has $wpdb->delete(). But we support 3.2 onwards.\n\t\t\t\t$wpdb->query(\"DELETE FROM $new_table_name WHERE option_name LIKE '_transient_gantry-menu%' OR option_name LIKE '_transient_timeout_gantry-menu%'\");\n\n\t\t\t\t// Jetpack: see: https://wordpress.org/support/topic/issues-with-dev-site\n\t\t\t\tif ($this->old_siteurl != $this->our_siteurl) {\n\t\t\t\t\t$wpdb->query(\"DELETE FROM $new_table_name WHERE option_name = 'jetpack_options'\");\n\t\t\t\t}\n\n\t\t\t\t// if we are importing a single site into a multisite (which means we have the multisite add-on) we need to clear our saved options and crons to prevent unwanted backups\n\t\t\t\tif (isset($this->restore_options['updraftplus_migrate_blogname'])) {\n\t\t\t\t\t$wpdb->query(\"DELETE FROM {$import_table_prefix}{$mprefix}options WHERE option_name LIKE 'updraft_%'\");\n\t\t\t\t\t$crons = maybe_unserialize($wpdb->get_var(\"SELECT option_value FROM {$import_table_prefix}{$mprefix}options WHERE option_name = 'cron'\"));\n\t\t\t\t\tforeach ($crons as $timestamp => $cron) {\n\t\t\t\t\t\tif (!is_array($cron)) continue;\n\t\t\t\t\t\tforeach (array_keys($cron) as $key) {\n\t\t\t\t\t\t\tif (false !== strpos($key, 'updraft_')) unset($crons[$timestamp][$key]);\n\t\t\t\t\t\t\tif (empty($crons[$timestamp])) unset($crons[$timestamp]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t$crons = serialize($crons);\n\t\t\t\t\t$wpdb->query($wpdb->prepare(\"UPDATE {$import_table_prefix}{$mprefix}options SET option_value='%s' WHERE option_name='cron'\", $crons));\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} elseif ($import_table_prefix != $old_table_prefix && preg_match('/^([\\d+]_)?usermeta$/', substr($table, strlen($import_table_prefix)), $matches)) {\n\n\t\t\t// This table is not a per-site table, but per-install\n\n\t\t\t$updraftplus->log(\"Table prefix has changed: changing usermeta table field(s) accordingly\");\n\n\t\t\t$print_line = sprintf(__('Table prefix has changed: changing %s table field(s) accordingly:', 'updraftplus'), 'usermeta').' ';\n\n\t\t\t$errors_occurred = false;\n\n\t\t\tif (false === strpos($old_table_prefix, '_')) {\n\t\t\t\t// Old, slow way: do it row-by-row\n\t\t\t\t// By Jul 2015, doing this on the updraftplus.com database took 20 minutes on a slow test machine\n\t\t\t\t$old_prefix_length = strlen($old_table_prefix);\n\n\t\t\t\t$um_sql = \"SELECT umeta_id, meta_key \n\t\t\t\t\tFROM ${import_table_prefix}usermeta \n\t\t\t\t\tWHERE meta_key \n\t\t\t\t\tLIKE '\".str_replace('_', '\\_', $old_table_prefix).\"%'\";\n\t\t\t\t$meta_keys = $wpdb->get_results($um_sql);\n\n\t\t\t\tforeach ($meta_keys as $meta_key) {\n\t\t\t\t\t// Create new meta key\n\t\t\t\t\t$new_meta_key = $import_table_prefix . substr($meta_key->meta_key, $old_prefix_length);\n\t\t\t\t\t\n\t\t\t\t\t$query = \"UPDATE \" . $import_table_prefix . \"usermeta \n\t\t\t\t\t\tSET meta_key='\".$new_meta_key.\"' \n\t\t\t\t\t\tWHERE umeta_id=\".$meta_key->umeta_id;\n\n\t\t\t\t\tif (false === $wpdb->query($query)) $errors_occurred = true;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// New, fast way: do it in a single query\n\t\t\t\t$sql = \"UPDATE ${import_table_prefix}usermeta SET meta_key = REPLACE(meta_key, '$old_table_prefix', '${import_table_prefix}') WHERE meta_key LIKE '\".str_replace('_', '\\_', $old_table_prefix).\"%';\";\n\t\t\t\tif (false === $wpdb->query($sql)) $errors_occurred = true;\n\t\t\t}\n\n\t\t\tif ($errors_occurred) {\n\t\t\t\t$updraftplus->log(\"Error when changing usermeta table fields\");\n\t\t\t\t$print_line .= __('Error', 'updraftplus');\n\t\t\t} else {\n\t\t\t\t$updraftplus->log(\"Usermeta table fields changed OK\");\n\t\t\t\t$print_line .= __('OK', 'updraftplus');\n\t\t\t}\n\t\t\t$updraftplus->log($print_line, 'notice-restore');\n\n\t\t}\n\n\t\tdo_action('updraftplus_restored_db_table', $table, $import_table_prefix, $engine);\n\n\t\t// Re-generate permalinks. Do this last - i.e. make sure everything else is fixed up first.\n\t\tif ($table == $import_table_prefix.'options') $this->flush_rewrite_rules();\n\n\t}", "function get_sql_encodings()\n{\n global $config;\n unset($config['mysql_possible_character_sets']);\n if (!isset($config['dbconnection'])) {\n MSD_mysql_connect();\n }\n $erg = false;\n $config['mysql_standard_character_set'] = '';\n $config['mysql_possible_character_sets'] = array();\n\n if (!defined('MSD_MYSQL_VERSION')) {\n GetMySQLVersion();\n }\n $v = explode('.', MSD_MYSQL_VERSION);\n $config['mysql_can_change_encoding'] = false;\n if (($v[0] <= 4 && $v[1] < 1) || $v[0] <= 3) {\n // MySQL < 4.1\n $config['mysql_can_change_encoding'] = false;\n $sqlt = 'SHOW VARIABLES LIKE \\'character_set%\\'';\n $res = MSD_query($sqlt) or die(SQLError(\n $sqlt,\n ((is_object($GLOBALS[\"___mysqli_ston\"]))\n ? mysqli_error($GLOBALS[\"___mysqli_ston\"])\n : (($___mysqli_res\n = mysqli_connect_error()) ? $___mysqli_res : false))\n ));\n if ($res) {\n WHILE ($row = mysqli_fetch_row($res)) {\n if ($row[0] == 'character_set') {\n $config['mysql_standard_character_set'] = $row[1];\n if ($v[0] == 3) {\n $config['mysql_possible_character_sets'][0] = $row[1];\n }\n }\n\n if ($row[0] == 'character_sets' && $v[0] > 3) {\n $config['mysql_possible_character_sets'] = explode(' ', $row[1]);\n sort($config['mysql_possible_character_sets']);\n }\n }\n }\n } else {\n // MySQL-Version >= 4.1\n $config['mysql_can_change_encoding'] = true;\n $sqlt = 'SHOW CHARACTER SET';\n $res = MSD_query($sqlt) or die(SQLError(\n $sqlt,\n ((is_object($GLOBALS[\"___mysqli_ston\"]))\n ? mysqli_error($GLOBALS[\"___mysqli_ston\"])\n : (($___mysqli_res\n = mysqli_connect_error()) ? $___mysqli_res : false))\n ));\n\n if ($res) {\n WHILE ($row = mysqli_fetch_row($res)) {\n $config['mysql_possible_character_sets'][] = $row[0] . ' - ' . $row[1];\n }\n sort($config['mysql_possible_character_sets']);\n }\n\n $sqlt = 'SHOW VARIABLES LIKE \\'character_set_connection\\'';\n $res = MSD_query($sqlt) or die(SQLError(\n $sqlt,\n ((is_object($GLOBALS[\"___mysqli_ston\"]))\n ? mysqli_error($GLOBALS[\"___mysqli_ston\"])\n : (($___mysqli_res\n = mysqli_connect_error()) ? $___mysqli_res : false))\n ));\n\n if ($res) {\n WHILE ($row = mysqli_fetch_row($res)) {\n $config['mysql_standard_character_set'] = $row[1];\n }\n }\n }\n}", "function myPear_update26(){\n \n if (myPear_db()->tableExists('zzz_organizations')){\n if (myPear_db()->columnExists('org_nickname','zzz_organizations')){\n myPear_db()->qquery(\"ALTER TABLE `zzz_organizations` CHANGE `org_nickname` `org_code` VARCHAR(32) NULL\",1);\n myPear_db()->reset_cache();\n }\n \n if (!myPear_db()->columnExists('org_name_short','zzz_organizations')){\n myPear_db()->qquery(\"ALTER TABLE `zzz_organizations` ADD `org_name_short` VARCHAR(32) NOT NULL AFTER `org_name`\",1);\n myPear_db()->reset_cache();\n foreach(array('an' => 'AlbaNova',\n\t\t 'nordita'=> 'Nordita',\n\t\t 'fysikum'=> 'Fysikum',\n\t\t 'kth' => 'KTH',\n\t\t 'okc' => 'OKC',\n\t\t 'vh' => 'Vetenskapenshus',\n\t\t 'gu' => 'GU',\n\t\t ) as $org_code=>$org_name_short){\n\tmyPear_db()->qquery(\"UPDATE `zzz_organizations` SET org_name_short='$org_name_short' WHERE org_code='$org_code'\",1);\n\t\n }\n }\n }\n}", "public function set_table_vars() {\n\t\tglobal $wpdb;\n\n\t\t$this->table = $wpdb->prefix . self::TABLE_NAME;\n\t\t$this->ms_table = $wpdb->base_prefix . self::MS_TABLE_NAME;\n\n\t\t/* Register the snippet table names with WordPress */\n\t\t$wpdb->snippets = $this->table;\n\t\t$wpdb->ms_snippets = $this->ms_table;\n\n\t\t$wpdb->tables[] = self::TABLE_NAME;\n\t\t$wpdb->ms_global_tables[] = self::MS_TABLE_NAME;\n\t}", "public function convertTableToUTF8($name);" ]
[ "0.7594291", "0.7247959", "0.64067477", "0.63050836", "0.622661", "0.6192063", "0.6031515", "0.5881048", "0.58473426", "0.5770517", "0.5729425", "0.5726387", "0.5668958", "0.5657266", "0.5586653", "0.5548276", "0.55429673", "0.55290055", "0.55247784", "0.55203795", "0.54868776", "0.5467387", "0.54507047", "0.5386373", "0.53660566", "0.5323745", "0.53069687", "0.5294368", "0.5279524", "0.5263344", "0.5253792", "0.5236459", "0.5224227", "0.52241147", "0.522298", "0.5208492", "0.52070016", "0.5197707", "0.5185019", "0.51850027", "0.51800954", "0.5169311", "0.5164703", "0.51624715", "0.51586026", "0.515557", "0.51392746", "0.51389295", "0.513305", "0.51252776", "0.51017886", "0.5087278", "0.50799423", "0.50708556", "0.5036158", "0.5024206", "0.5009914", "0.5009381", "0.49908862", "0.49824694", "0.4962128", "0.49444455", "0.4919178", "0.48993137", "0.48958832", "0.4887207", "0.48774388", "0.48752403", "0.4875218", "0.48731777", "0.48703304", "0.48624364", "0.4850526", "0.4846798", "0.48417994", "0.48303998", "0.48286715", "0.48206994", "0.48129624", "0.48116744", "0.48049733", "0.4797427", "0.47951964", "0.47935873", "0.4791185", "0.47887704", "0.4775244", "0.47697023", "0.47695044", "0.4767893", "0.47666934", "0.47656998", "0.475139", "0.475139", "0.47508672", "0.47499526", "0.47361597", "0.47343868", "0.4734143", "0.47325826" ]
0.5535829
17
Execute a query against the site's database
private function query($query, $silentFail = true) { $db = $this->container->db; try { $db->setQuery($query)->execute(); } catch (RuntimeException $e) { if (!$silentFail) { throw $e; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function executeQuery($query);", "public function query();", "public function query();", "public function query();", "protected function execute_single_query(){\n\t\t$this -> open_connection();\n\t\t$this -> conn -> query($this -> query);\n\t\t$this -> close_connection();\n\t}", "public static function query();", "public function execute($query);", "function fvls_db_ExecuteQuery($sql){\n\t\tglobal $FLVS_db_link;\n\t\tif( !$FLVS_db_link instanceof MySQLi )\n\t\t\treturn false;\n\n\t\tif ( !($response = $FLVS_db_link->query( $sql ) ) ){\n\t\t\tif( defined('FVLS_DEVELOPER_MODE') && FVLS_DEVELOPER_MODE )\n\t\t\t echo \"FV Link Shortener Error: mySQL Query Error - $FLVS_db_link->error | $sql\\n\";\n\t\t\treturn false;\n\t\t}\n\n\t\treturn $response;\n\t}", "function tep_db_query($query){\n\t\tglobal $db;\n\t\treturn($db->Execute($query));\n\t}", "function query() {}", "protected abstract function executeQuery($query);", "protected abstract function executeQuery(Result $result);", "protected function execute_single_query() \n\t\t{\n \t\t\t$this->open_connection();\n \t\t\t$this->conn->query($this->query);\n \t\t\t$this->close_connection();\n\t\t}", "abstract public function query();", "abstract public function execute($query);", "function query_db($sql) {\n\t\treturn mysql_query($sql, $this -> dbc);\n\t}", "private function ExecuteQuery()\n\t{\n\t\tswitch($this->querytype)\n\t\t{\n\t\t\tcase \"SELECT\":\n\t\t\t{\n\t\t\t\t$this->stmt->execute();\n\t\t\t\t$this->querydata = $this->stmt->fetchAll(PDO::FETCH_ASSOC);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"INSERT\":\n\t\t\tcase \"UPDATE\":\n\t\t\t{\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\t$this->beginTransaction();\n\t\t\t\t\t$this->stmt->execute();\n\t\t\t\t\t$this->commit();\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcatch (PDOException $e)\n\t\t\t\t{\n\t\t\t\t\t$this->rollBack();\n\t\t\t\t\techo(\"Query failed: \" . $e->getMessage());\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public function executeQuery() {\r\n\t\t$query = $this->query;\r\n\t\t$query->matching($query->logicalAnd($this->queryConstraints));\r\n//$parser = \\TYPO3\\CMS\\Core\\Utility\\GeneralUtility::makeInstance('TYPO3\\\\CMS\\\\Extbase\\\\Persistence\\\\Generic\\\\Storage\\\\Typo3DbQueryParser'); \r\n//$queryParts = $parser->parseQuery($query); \r\n//\\TYPO3\\CMS\\Core\\Utility\\DebugUtility::debug($queryParts, 'Query Content');\r\n\t\t$queryResult = $query->execute()->toArray();\r\n\t\t$this->setSelectedPageUids($queryResult);\r\n\t\t$this->resetQuery(); \r\n\t\treturn $queryResult;\r\n\t}", "public static function query($sql);", "public function ExecuteQuery($query){\n\t\treturn $this->db_con->query($query);\n\t}", "public function query()\n\t{\n\t\t\n\t}", "function db_execute($query)\n {\n /*\n * Execute the Query\n */\n $this->varifysql($query[\"SQL\"]);\n return $this->get_conn()->query($query[\"SQL\"], PDO::FETCH_ASSOC);\n }", "function query(\\database $dbase){\n //\n //Get the sql string \n $sql=$this->to_str();\n //\n // Execute the $sql on columns to get the $result\n $dbase->query($sql);\n \n }", "private function RunBasicQuery() {\n // Prepare the Query\n $this->stmt = $this->db->prepare($this->sql);\n \n // Run the Query in the Database\n $this->stmt->execute();\n \n // Store the Number Of Rows Returned\n $this->num_rows = $this->stmt->rowCount();\n \n // Work with the results (as an array of objects)\n $this->rs = $this->stmt->fetchAll();\n \n // Free the statement\n $this->stmt->closeCursor(); \n }", "function execute_query($q)\n{\n\tglobal $spebs_db;\n\t$res = $spebs_db -> query($q);\n\tif($spebs_db->errno != 0)\n\t{\n\t\terror_log(\"QUERY EXECUTE error \".$spebs_db->errno.\": \".$spebs_db->error.\" (Q = \\\"$q\\\")\");\n\t\treturn false;\n\t}\n\treturn $res;\n}", "public function query($sql);", "public function query($sql);", "public function query($sql);", "public function query($sql);", "public static function query($query){\n if(!self::$connection){\n self::initDb();\n }\n\n return self::$connection->query($query);\n }", "abstract public function query($sql);", "public function run(){\n $sql = $this->sql();\n return $this->query($sql,$this->args);\n }", "function execQuery($query, $database)\n{\n include 'dbconfig.php';\n mysql_connect($_db_server,$_db_username,$_db_password) or die(mysql_error());\n mysql_select_db($database) or die(mysql_error());\n \n $data = mysql_query($query) or die(mysql_error());\n \n return $data;\n \n mysql_close();\n}", "public function execute($sql) {\n\t\tquery_db2($sql, true);\n\t}", "abstract function executeQuery($cons);", "function run_query($query) {\r\n\t \t$db = new Database();\r\n\t \t$queryResult = $db->run_query_internal($query);\r\n\t \treturn mysqli_query($db->getConnection(),$query);\r\n\t }", "public function executeQuery() \r\n\t{\r\n\t\t$Result = $this->objStatement->execute();\r\n\t\t\r\n\t\tif($Result)\r\n\t\t{\r\n\t\t\t$Result = new DatabaseStatement($this->objStatement);\r\n\t\t}\r\n\t\t\r\n\t\treturn $Result;\r\n\t}", "public function executeQuery($q){ $this->makeConnection();\n //check for SQL injection\n\n //execute query\n $results = $this->connection->query($q);\n\n return $results;\n\n }", "public static function execute()\n {\n if(DEBUG_QUERIES)\n {\n $start = microtime();\n }\n $r = self::$stmt->execute();\n if(DEBUG_QUERIES)\n {\n $elapsed = round(microtime() - $start, 4);\n isset(Core::$benchmark['db']['count']) ? Core::$benchmark['db']['count']++ : Core::$benchmark['db']['count'] = 1;\n isset(Core::$benchmark['db']['elapsed']) ? (Core::$benchmark['db']['elapsed']+$elapsed) : Core::$benchmark['db']['elapsed'] = $elapsed;\n }\n if(self::$stmt->errorCode() !== '00000')\n {\n trigger_error(json_encode(self::$stmt->errorInfo()));\n }\n return $r;\n }", "public function execute()\n {\n \tif ( $this->cur_query != \"\" )\n \t{\n \t\t$res = $this->query( $this->cur_query );\n \t}\n \t\n \t$this->cur_query \t= \"\";\n \t$this->is_shutdown \t= false;\n\n \treturn $res;\n }", "public function execute () {\n $this->query->execute();\n }", "public function query()\n {\n }", "public function query()\n {\n }", "public function execute($sql){\n\t $query = DB::query(Database::SELECT, $sql);\n\t return $query->execute($this->database);\n\t}", "function execSql($query) {\n if ($result = mysql_query($query, $this->linkDatabaseSrc)) {\n return $result;\n } else {\n return 0;\n }\n }", "public function executeQuery($sql){\n return DB::executeQuery($this->db, $sql);\n }", "function queryDb($query) {\n\tglobal $connection;\n\n\treturn mysqli_query($connection, $query);\n}", "public function execute($sql);", "public function execute($sql);", "public function execute()\n {\n return $this->query($this->sSql);\n }", "function query() {\n }", "abstract protected function doQuery( $sql );", "public static function query()\n {\n }", "function queryExecute($query) {\r\n\t\t\r\n\t\tif (strlen(trim($query)) < 0 ) {\r\n\t\t\ttrigger_error(\"Database encountered empty query string in queryExecute function\",E_ERROR);\r\n\t\t}\r\n\t\tif( !$this->connected ) \r\n\t\t\t$this->connect();\r\n\t\t\r\n\t\tif($this->socket->query($query) === true) {\r\n\t\t\t$this->recordsUpdated = $this->socket->affected_rows;\r\n\t\t}\r\n\t}", "public function query($query) {\n if(method_exists($this->db, 'query')) {\n return $this->db->query($query);\n } else {\n throw new Exception(__METHOD__ . \" not implemented\");\n }\n }", "private function executeQuery() {\n\t\t$recordset = $this->getConnection()->execute( $this );\n\t\t\n\t\tif( $recordset === false ) {\n\t\t\t$this->_recordset = array();\n\t\t} else {\n\t\t\t$this->_recordset = $recordset;\n\t\t}\n\n\t\t$this->_currentRow = 0;\n\t\t$this->isDirty( false );\n\t}", "private function execute() {\n $query = $this->db->query($this->sql);\n return $query->result();\n }", "abstract protected function _query($sql);", "public function execute(QueryObject $query);", "public function executeQuery($query) {\r\n\t\t\r\n\t\t$this->mdb2->connect();\r\n\t\t\t\t\r\n\t\t$ResultSet = $this->mdb2->query($query);\r\n\t\t\r\n\t\t$this->mdb2->disconnect();\r\n\t\t\r\n\t\tif (PEAR::isError($ResultSet)) {\r\n\t\t\tdie($ResultSet->getMessage() . \": \" . $query);\r\n\t\t}\r\n\t\t\r\n\t\treturn $ResultSet;\r\n\t\t\r\n\t}", "function query() {\r\n\t\t\t$args = func_get_args();\r\n\t\t\t$sql = array_shift($args);\r\n\t\t\tforeach ($args as $key => $value)\r\n\t\t\t\t$args[$key] = $this->clean($value);\r\n\t\t\treturn mysql_query(vsprintf($sql, $args));\r\n\t\t}", "private function query() {\n return ApplicationSql::query($this->_select, $this->_table, $this->_join, $this->_where, $this->_order, $this->_group, $this->_limit, $this->_offset);\n }", "function execQuery($query){\n\t\ttry {\n\t\t\t\n\t\t\t$pdo = db_init();\n\n\t\t\t$pdo->exec($query);\n\n\t\t} catch (PDOException $e) {\n\t\t\tlogging($_SERVER['PHP_SELF'] . \", 22, Error Executing Query:\". $e->getMessage() .\" ,\" . date(\"Y-m-d\") . \" \" . date(\"h:i:sa\"));\n\t\t}\n\t}", "public function execQuery($sql){\n return mysql_query($sql);\n }", "public function query($query);", "public function query($query);", "public function query($query);", "public function execute($sql){\r\n\t\t\tglobal $link;\r\n\t\t\tmysqli_query($link,$sql);\r\n\t\t}", "public function query($statement);", "public function execute() {\n\t\t\t$connection = \\Leap\\Core\\DB\\Connection\\Pool::instance()->get_connection($this->data_source);\n\t\t\tif ($this->before !== NULL) {\n\t\t\t\tcall_user_func_array($this->before, array($connection));\n\t\t\t}\n\t\t\t$connection->execute($this->command());\n\t\t\tif ($this->after !== NULL) {\n\t\t\t\tcall_user_func_array($this->after, array($connection));\n\t\t\t}\n\t\t}", "public function executeQuery($sql)\r\n\t{\r\n\t\t//return qocqal_query($sql);\r\n\t}", "public function execute($query)\n {\n }", "public function executeQuery($sql)\r\n\t{\r\n\t\t//return mysql_query($sql);\r\n\t}", "public function executeQuery($query) {\n\t\t$result = $this->connection->query($query);\n\t\t$this->rowsAffected = $this->connection->affected_rows;\n\t\t\t\n\t\tif(!$result) {\n\t\t\tthrow new DBException(\"Unable to execute query: \" . $query);\n\t\t}\n\t\treturn $result;\n\t}", "public abstract function execute($sql);", "function doQuery($query,$db='')\n\t{\n\n\t\tglobal $stats;\n\n\t\tif (DEBUG)\n\t\t{\n\t\t\t$stats['queries'][]\t= $query;\n\t\t\t$stats['querycount']\t= $stats['querycount']+1;\t// Number of queries\n\t\t}\n\n\t\t// change DB if neccessary\n\n\t\tif ($db!=='')\n\t\t\tselectDB($db);\n\n\t\t// perform query\n\n\t\t$result\t= @mssql_query($query);\n\n\t\tif (DEBUG)\n\t\t{\n\n\t\t\t$fh\t= @fopen(BASEDIR.'data'.DIRECTORY_SEPARATOR.'dblog.txt','a');\n\t\t\t@fputs($fh,$query.\"\\n\");\n\n\t\t\tif ($result !== true)\n\t\t\t{\n\n\t\t\t\t$error\t\t= mssql_get_last_message();\n\n\t\t\t\tif ((stristr($error,'Changed database context') === false) && (stristr($error,'Datenbankkontext wurde auf') === false))\n\t\t\t\t{\n\t\t\t\t\t@fputs($fh,\"\\n\".'ERROR: '.mssql_get_last_message().\"\\n\");\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t@fputs($fh,\"\\n\\n\".str_repeat('=',80).\"\\n\\n\\n\");\n\n\t\t\t@fclose($fh);\n\n\t\t}\n\n\t\t//\n\n\t\treturn $result;\n\n\t}", "public function ExecuteQuery($Query){\n\t\treturn $this->db->query($Query); \n\t}", "function query( $sql ){\n\t\tif( $this->db == null ){\n\t\t\treturn false;\n\t\t}\n\t\t$result = $this->db->query( $sql );\n\n\t\treturn $result;\n\t}", "function db_query($db_query) {\n\t\t$result = pg_query($this->db_connection,$db_query)\n\t\t\tor die(\"Query: $db_query <br /> Error: \".pg_last_error($this->db_connection).\"<br />\");\n\t\treturn $result;\n\t}", "protected function execute_single_query() {\n\t\tif($_POST) {\n\t\t\t$this->open_connection();\n\t\t\t$this->conn->query($this->query);\n\t\t\t\n\t\t} else {\n\t\t\t$this->mensaje = 'Metodo no permitido';\n\t\t}\n\t}", "function runQuery()\r\n\t\t{\r\n\t\tif(!$this->conn)\r\n\t\t\t{\r\n\t\t\t$this->createConnect();\r\n\t\t\t}\r\n\t\tif($this->query)\r\n\t\t\t{\r\n\t\t\t$this->errors=\"\";\r\n\t\t\t$this->query.=\";\";\r\n\t\t\t$this->result = mysql_query($this->query);\r\n\t\t\tif(mysql_affected_rows()>=0)\r\n\t\t\t\t{\r\n\t\t\t\tunset($this->query);\r\n\t\t\t\t}\r\n\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\techo \"<br>Error:<br>\";\r\n\t\t\t\t$debugging=debug_backtrace();\r\n\t\t\t\tforeach ($debugging as $debug)\r\n\t\t\t\t\t{\r\n\t\t\t\t\techo \"<b>File :</b> \".$debug[\"file\"].\"<br />\";\r\n\t\t\t\t\techo \"<b>Line :</b> \".$debug[\"line\"].\"<br />\";\r\n\t\t\t\t\techo \"<b>Function :</b> \".$debug[\"function\"].\"<br />\";\r\n\t\t\t\t\techo \"<b>Cause :</b> \".mysql_error().\"<br />\";\r\n\t\t\t\t\t}\r\n\t\t\t\techo \"<b>Query :</b> \".$this->query.\"<hr>\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\telse\r\n\t\t\t{\r\n\t\t\techo \"<br>-- NULL Query --\";\r\n\t\t\t}\r\n\t\tif (!is_resource($this->result))\r\n\t\t\t{\r\n\t\t\t$this->errors=mysql_error();\r\n\t\t\tif($this->transaction)\r\n\t\t\t\t{\r\n\t\t\t\t\t$this->transaction=FALSE;\r\n\t\t\t\t\t$this->query=\"ROLLBACK TRANSACTION\";\r\n\t\t\t\t\t$this->runQuery();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}", "function query(DBWrapper $db, $sql)\n {\n\n $db->query($sql);\n }", "abstract public function execute($sql);", "public function testRunASqlQuery(){\r\n $sql = \"Select * from orders;\";\r\n $db = new database;\r\n $db->connectToDatabase();\r\n $success = $db->runASqlQuery($sql);\r\n $this->assertEquals(true,$success);\r\n }", "public function executeQuery($query){\n\t\n $resultQuery = mysqli_query($this->link, $query) or die (\"Requete => PROBLEME\");\n return $resultQuery;\n }", "public function executeSQL($query){\n\t\t$this->lastQuery = $query;\t\t\n\t\tif($this->result = mysqli_query( $this->databaseLink,$query)){\n\t\t\tif (gettype($this->result) === 'object') {\n\t\t\t\t$this->records = @mysqli_num_rows($this->result);\n\t\t\t\t$this->affected = @mysqli_affected_rows($this->databaseLink);\n\t\t\t} else {\n\t\t\t\t$this->records = 0;\n\t\t\t\t$this->affected = 0;\n\t\t\t}\n\n\t\t\tif($this->records > 0){\n\t\t\t\t$this->arrayResults();\n\t\t\t\treturn $this->arrayedResult;\n\t\t\t}else{\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t}else{\n\t\t\t$this->lastError = mysql_error($this->databaseLink);\n\t\t\techo $this->lastError;\n\t\t\treturn false;\n\t\t}\n\t}", "function query($query) {\n\t\treturn $this->dbcr_query( $query, true );\n\t}", "public function ejecutar_una_consulta($query){\n $response=self::ConnectDB()->prepare($query);\n $response->execute();\n return $response;\n }", "function database_query($sql, $params = [])\n{\n\tglobal $database_connection;\n\t$stmt = $database_connection->prepare($sql);\n\t$stmt->execute($params);\n\treturn $stmt->fetchAll();\n}", "function query($query){\n return mysql_query($query, $this->connection);\n }", "function query($sql) {\n\t\t\treturn $this->db->query($sql);\n\t\t}", "public function queryDB($query)\n\t{\n\t\t$conn = mysql_connect($this -> server,$this -> user,$this -> password) or die(\"Unable to connect to MySQL server\");\n\t\tmysql_select_db($this -> database) or die( \"Unable to select database\");\n\t\t\n\t\t$result = mysql_query ($query) or die(\"Query failed: \".mysql_error());\n\t\treturn $result;\n\t\t\n\t\tmysql_close($conn);\n\t}", "private function runQuery($query) {\r\n\t\treturn mysql_query($query, $this->sql);\r\n\t}", "function query($sql) {\r\n\t\treturn $this->execute($sql);\r\n\r\n\t}", "private function query($query) {\n $result = $this->connection->query($query);\n if (!$result) {\n throw new DatabaseException(\"Error occurred processing SQL statement '$query': \"\n . $this->connection->error,\n $this->connection->errno);\n }\n\n return $result;\n }", "public function query(IQuery $query);", "function query($db,$value)\r\n\t\t{\r\n\t\t\tif (!isset($db) || empty($db)) $this->killClass();\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t$this->last_query[\"start_time\"] = $this->getmicrotime();\r\n\t\t\t\tif (!$this->result = mysql_query($value))\r\n\t\t\t\t{\r\n\t\t\t\t\t$db->printError(mysql_errno($db->linkID), mysql_error($db->linkID));\r\n\t\t\t\t}\r\n\t\t\t\t$lastError = mysql_errno($db->linkID);\r\n \t\t\t\tif ( $lastError > 0) {\r\n \t\t\t\t$lastError = $lastError;\r\n \t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t$this->last_query[\"end_time\"] = $this->getmicrotime();\r\n\t\t\t\t\r\n\t\t\t\t$this->affected_rows = mysql_affected_rows($db->linkID);\r\n\t\t\t\t$this->numrows = 0;\r\n\t\t\t\t$this->numfields = 0;\t\r\n\t\t\t\t\r\n\t\t\t\t//if (eregi(\"^SELECT\", $value) || eregi(\"^SHOW\", $value)) //milsoft changed to allow show commands as queries\r\n if (preg_match(\"/\\bSELECT\\b/i\", $value) || preg_match(\"/\\bSHOW\\b/i\", $value) ) //milsoft changed to allow show commands as queries\r\n\t\t\t\t{\r\n\t\t\t\t\t$this->numrows = @mysql_num_rows($this->result);\r\n\t\t\t\t\t$this->numfields = @mysql_num_fields($this->result);\r\n\t\t\t\t}\r\n\t\t\t\t$this->last_query[\"sql\"] = $value;\r\n\t\t\t}\r\n\t\t}", "public function execute();", "public function execute();", "public function execute();", "public function execute();" ]
[ "0.7103206", "0.6991545", "0.6991545", "0.6991545", "0.6889922", "0.68378663", "0.6793511", "0.67933494", "0.6786577", "0.6665675", "0.6648634", "0.6634909", "0.66291296", "0.66282505", "0.6572907", "0.65600806", "0.6555398", "0.6515222", "0.65101844", "0.6495862", "0.6484282", "0.64731497", "0.6469996", "0.64697415", "0.64639753", "0.6448813", "0.6448813", "0.6448813", "0.6448813", "0.64456326", "0.6417352", "0.641401", "0.63854575", "0.6358714", "0.63582057", "0.6347401", "0.6334002", "0.6330645", "0.6320274", "0.63164526", "0.63025284", "0.6293795", "0.6293795", "0.62890226", "0.62809324", "0.62719595", "0.6268877", "0.6260351", "0.6260351", "0.6259734", "0.6249711", "0.6241419", "0.6240492", "0.6221871", "0.6212112", "0.6175906", "0.61663616", "0.61647344", "0.61498386", "0.6148212", "0.614384", "0.61399984", "0.6135645", "0.61279106", "0.6121351", "0.6121351", "0.6121351", "0.6118457", "0.6109533", "0.6102532", "0.61018205", "0.60984373", "0.60965633", "0.60896486", "0.6084819", "0.6080988", "0.60670316", "0.6064645", "0.605656", "0.6050697", "0.60506344", "0.6046555", "0.6035771", "0.60333747", "0.60240597", "0.6008983", "0.6008644", "0.6001513", "0.59861726", "0.59846455", "0.5984231", "0.5976509", "0.5975987", "0.59589845", "0.5957054", "0.5954515", "0.5954301", "0.5951129", "0.5951129", "0.5951129", "0.5951129" ]
0.0
-1
Change the database collation. This tries to change the collation of the entire database, setting the default for newly created tables and columns. We have the reasonable expectation that this will fail on most live hosts.
private function changeDatabaseCollation($newCollation) { $db = $this->container->db; $collationParts = explode('_', $newCollation); $charset = $collationParts[0]; $dbName = $this->container->platform->getConfig()->get('db'); $this->query(sprintf( "ALTER DATABASE %s CHARACTER SET = %s COLLATE = %s", $db->qn($dbName), $charset, $newCollation )); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function myPear_set_collation(){\n $needed = False;\n if (!$needed) return;\n $c_set = 'utf8';\n $d_col = 'utf8_unicode_ci';\n myPear_db()->qquery(\"ALTER SCHEMA \".myPear_db()->Database.\" DEFAULT CHARACTER SET $c_set DEFAULT COLLATE $d_col\",True);\n foreach(myPear_db()->getTables() as $table){\n b_debug::xxx($table.\"------------------------------------------------\");\n myPear_db()->qquery(\"ALTER TABLE $table CONVERT TO CHARACTER SET $c_set COLLATE $d_col\",True);\n $q = myPear_db()->qquery(\"SHOW COLUMNS FROM $table\",cnf_dev);\n while($r = $this->next_record($q)){\n if (preg_match('/(char|text)/i',strToLower($r['Type']))){\n\tb_debug::xxx($r['Field']);\n\tmyPear_db()->qquery(sprintf(\"ALTER TABLE `%s` CHANGE `%s` `%s` %s CHARACTER SET $c_set COLLATE $d_col %s NULL\",\n\t\t\t\t $r['Field'],$r['Field'],$r['Type'],(strToLower($r['Null']) == 'yes' ? '' : 'NOT')),\n\t\t\t True);\n\t\n }\n }\n }\n}", "public function changeCollation($newCollation = 'utf8_general_ci')\n\t{\n\t\t// Make sure we have at least MySQL 4.1.2\n\t\t$db = $this->container->db;\n\t\t$old_collation = $db->getCollation();\n\n\t\tif ($old_collation == 'N/A (mySQL < 4.1.2)')\n\t\t{\n\t\t\t// We can't change the collation on MySQL versions earlier than 4.1.2\n\t\t\treturn false;\n\t\t}\n\n\t\t// Change the collation of the database itself\n\t\t$this->changeDatabaseCollation($newCollation);\n\n\t\t// Change the collation of each table\n\t\t$tables = $db->getTableList();\n\n\t\t// No tables to convert...?\n\t\tif (empty($tables))\n\t\t{\n\t\t\treturn true;\n\t\t}\n\n\t\tforeach ($tables as $tableName)\n\t\t{\n\t\t\t$this->changeTableCollation($tableName, $newCollation);\n\t\t}\n\n\t\treturn true;\n\t}", "public function setDatabaseCharsetAndCollation($options = array()) {\n $sql = 'ALTER DATABASE `'. $this->_dbName .'`\n CHARACTER SET '. db::CHARSET .'\n COLLATE '. db::COLLATION;\n\n return $this->execute($sql, $options);\n }", "public function setCollation($var)\n {\n GPBUtil::checkString($var, True);\n $this->collation = $var;\n\n return $this;\n }", "private function getCharsetCollate() {\n global $wpdb;\n $this->charsetCollate = $wpdb->get_charset_collate();\n }", "private function changeTableCollation($tableName, $newCollation, $changeColumns = true)\n\t{\n\t\t$db = $this->container->db;\n\t\t$collationParts = explode('_', $newCollation);\n\t\t$charset = $collationParts[0];\n\n\t\t// Change the collation of the table itself.\n\t\t$this->query(sprintf(\n\t\t\t\"ALTER TABLE %s CONVERT TO CHARACTER SET %s COLLATE %s\",\n\t\t\t$db->qn($tableName),\n\t\t\t$charset,\n\t\t\t$newCollation\n\t\t));\n\n\t\t// Are we told not to bother with text columns?\n\t\tif (!$changeColumns)\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\t// Convert each text column\n\t\ttry\n\t\t{\n\t\t\t$columns = $db->getTableColumns($tableName, false);\n\t\t}\n\t\tcatch (RuntimeException $e)\n\t\t{\n\t\t\t$columns = [];\n\t\t}\n\n\t\t// The table is broken or MySQL cannot report any columns for it. Early return.\n\t\tif (!is_array($columns) || empty($columns))\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\t$modifyColumns = [];\n\n\t\tforeach ($columns as $col)\n\t\t{\n\t\t\t// Make sure we are redefining only columns which do support a collation\n\t\t\tif (empty($col->Collation))\n\t\t\t{\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$modifyColumns[] = sprintf(\"MODIFY COLUMN %s %s %s %s COLLATE %s\",\n\t\t\t\t$db->qn($col->Field),\n\t\t\t\t$col->Type,\n\t\t\t\t(strtoupper($col->Null) == 'YES') ? 'NULL' : 'NOT NULL',\n\t\t\t\tis_null($col->Default) ? '' : sprintf('DEFAULT %s', $db->q($col->Default)),\n\t\t\t\t$newCollation\n\t\t\t);\n\t\t}\n\n\t\t// No text columns to modify? Return immediately.\n\t\tif (empty($modifyColumns))\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\t// Issue an ALTER TABLE statement which modifies all text columns.\n\t\t$this->query(sprintf(\n\t\t\t'ALTER TABLE %s %s',\n\t\t\t$db->qn($tableName),\n\t\t\timplode(', ', $modifyColumns\n\t\t\t)));\n\t}", "public function getDbCollation()\r\n {\r\n return $this->db_collation;\r\n }", "function db_change_charset_for_tables($charset = 'utf8', $collate='utf8_general_ci', $data = true){ \n \n if(!trim($charset) || !trim($collate)){\n echo 'No charset selected';\n return;\n }\n \n $CI = &get_instance();\n $query_show_tables = 'SELECT table_name FROM information_schema.tables WHERE table_schema = DATABASE()';//'SHOW TABLES';\n $query_col_collation = 'SHOW FULL COLUMNS FROM %s';\n $tables = $CI->db->query($query_show_tables)->result();\n if(!empty($tables)){\n $CI->db->query(sprintf('SET foreign_key_checks = 0'));\n foreach($tables as $table){\n $table = (array) $table;\n if( isset($table['table_name']) && trim($table['table_name'])){\n $query_collation_generated = sprintf($query_col_collation, $table['table_name']);\n $result_before = $CI->db->query($query_collation_generated)->result();\n db_show_table_column_collations($result_before, $table['table_name']);\n $CI->db->query(sprintf('ALTER TABLE %s CONVERT TO CHARACTER SET '.$charset.' COLLATE '.$collate, $table['table_name']));\n $result_after = $CI->db->query($query_collation_generated)->result();\n db_show_table_column_collations($result_after, $table['table_name'], true);\n }\n }\n $CI->db->query(sprintf('SET foreign_key_checks = 1'));\n }\n \n}", "public function setCollation($v)\n {\n if ($v !== null) {\n $v = (string) $v;\n }\n\n if ($this->collation !== $v) {\n $this->collation = $v;\n $this->modifiedColumns[BiblioTableMap::COL_COLLATION] = true;\n }\n\n return $this;\n }", "public function setDbCollation($db_collation)\r\n {\r\n $this->db_collation = $db_collation;\r\n\r\n return $this;\r\n }", "abstract protected function setCharset($charset, $collation);", "public function setCollate($collate)\n\t{\n\t\t$this->collate = $collate;\n\t}", "private function charset()\n\t{\n\t\tif (isset($this->_conf['charset']) AND $this->_conf['charset'] != '')\n\t\t{\n\t\t\tif (isset($this->_conf['collation']) AND $this->_conf['collation'] != '')\n\t\t\t{\n\t\t\t\t$this->_con->exec('SET NAMES '.$this->_conf['charset'].' COLLATE '.$this->_conf['collation']);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->_con->exec('SET NAMES '.$this->_conf['charset']);\n\t\t\t}\n\t\t}\n\t}", "public function setCollation($collation)\n {\n $collation = strtolower($collation);\n $charset = self::getCollationCharset($collation);\n if (is_null($charset)) {\n throw new RuntimeException(\"unknown collation '$collation'\");\n }\n if (!is_null($this->charset) &&\n $this->charset !== $charset\n ) {\n throw new RuntimeException(\"COLLATION '$collation' is not valid for CHARACTER SET '$charset'\");\n }\n $this->charset = $charset;\n $this->collation = $collation;\n }", "public function set_charset($dbh, $charset = \\null, $collate = \\null)\n {\n }", "public function alterCharset($table, $charset = 'utf8', $collation = 'utf8_unicode_ci', $execute = true) {\r\n\t\t$sql = 'ALTER TABLE ' . $table . ' MODIFY' . \"\\n\";\r\n\t\t$sql .= 'CHARACTER SET ' . $charset;\r\n\t\t$sql .= 'COLLATE ' . $collation;\r\n\t\tif ($execute) {\r\n\t\t\t$this->exec($sql);\r\n\t\t}\r\n\t\treturn $sql;\r\n\t}", "public function getDefaultCollation()\n {\n $collation = $this->config->get('database.preferred_collation');\n $collation = $this->normalizeCollation($collation);\n\n return $collation;\n }", "public function getCollation()\n {\n return $this->collation;\n }", "public function getCollation()\n {\n return $this->collation;\n }", "public function supports_collation()\n {\n }", "public function getCollation()\n\t{\n\t\treturn false;\n\t}", "public static function setCharsetEncoding () {\r\n\t\tif ( self::$instance == null ) {\r\n\t\t\tself::getInstance ();\r\n\t\t}\r\n\t\tself::$instance->exec (\r\n\t\t\t\"SET NAMES 'utf8';\r\n\t\t\tSET character_set_connection=utf8;\r\n\t\t\tSET character_set_client=utf8;\r\n\t\t\tSET character_set_results=utf8\" );\r\n\t}", "public static function determine_charset() {\n global $wpdb;\n $charset = '';\n\n if (!empty($wpdb->charset)) {\n $charset = \"DEFAULT CHARACTER SET {$wpdb->charset}\";\n\n if (!empty($wpdb->collate)) {\n $charset .= \" COLLATE {$wpdb->collate}\";\n }\n }\n return $charset;\n }", "public function getCollation()\n\t{\n\t\treturn $this->charset;\n\t}", "public function getCollation()\n {\n return $this->options->collation;\n }", "public function testCollation()\n {\n $statement = (new CreateTable($this->mockConnection));\n $return = $statement->charset(null, 'utf8_ci');\n $array = $statement->toArray();\n\n $this->assertInstanceOf(CreateTable::class, $return);\n $this->assertEquals([\n 'charset' => null,\n 'collate' => 'utf8_ci',\n ], $array);\n }", "public function get_charset_collate()\n {\n }", "public function convertTableCharsetAndCollation($table, $options = array()) {\n // mysql - postgresql\n $sql = 'ALTER TABLE `'. $table .'`\n CONVERT TO CHARACTER SET '. db::CHARSET .'\n COLLATE '. db::COLLATION;\n\n return $this->execute($sql, $options);\n }", "public function getCollationConnection()\r\n {\r\n return $this->collation_connection;\r\n }", "public function setCharset($charset, $collation)\n {\n // @todo - add support if needed\n return true;\n }", "public function setBinaryCollation()\n {\n $this->isBinaryCollation = true;\n }", "public function getCharset(): string\n {\n $charsetCollate = '';\n\n $mySlqVersion = $this->getVariable('SELECT VERSION() as mysql_version');\n\n if (version_compare($mySlqVersion, '4.1.0', '>=')) {\n if (!empty($this->wpDatabase->charset)) {\n $charsetCollate = \"DEFAULT CHARACTER SET {$this->wpDatabase->charset}\";\n }\n\n if (!empty($this->wpDatabase->collate)) {\n $charsetCollate .= \" COLLATE {$this->wpDatabase->collate}\";\n }\n }\n\n return $charsetCollate;\n }", "function getDefaultCollationForCharset($charset) {\n $row = DB::executeFirstRow(\"SHOW CHARACTER SET LIKE ?\", array($charset));\n \n if($row && isset($row['Default collation'])) {\n return $row['Default collation'];\n } else {\n throw new InvalidParamError('charset', $charset, \"Unknown MySQL charset '$charset'\");\n } // if\n }", "function database_set_charset($charset)\n {\n\t if( function_exists('mysql_set_charset') === TRUE )\n {\n\t return mysql_set_charset($charset, $this->database_connection);\n\t }\n else\n {\n\t return $this->database_query('SET NAMES \"'.$charset.'\"');\n\t }\n\t}", "public function isDefaultCollation()\n {\n if (is_null($this->charset)) {\n throw new LogicException(\"isDefaultCollation called when collation is unspecified\");\n }\n return $this->getCollation() === self::getCharsetDefaultCollation($this->charset);\n }", "private function setCharSet()\n {\n // preparing csConvObj\n if (!is_object($GLOBALS['TSFE']->csConvObj)) {\n if (is_object($GLOBALS['LANG'])) {\n $GLOBALS['TSFE']->csConvObj = $GLOBALS['LANG']->csConvObj;\n\n } else {\n $GLOBALS['TSFE']->csConvObj = Tx_Smarty_Service_Compatibility::makeInstance('t3lib_cs');\n }\n }\n\n // preparing renderCharset\n if (!is_object($GLOBALS['TSFE']->renderCharset)) {\n if (is_object($GLOBALS['LANG'])) {\n $GLOBALS['TSFE']->renderCharset = $GLOBALS['LANG']->charSet;\n\n } else {\n $GLOBALS['TSFE']->renderCharset = $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'];\n }\n }\n }", "protected function setUtf8Context()\n {\n $locale = 'en_US.UTF-8';\n setlocale(LC_ALL, $locale);\n putenv('LC_ALL=' . $locale);\n }", "protected function setUtf8Context()\n {\n setlocale(LC_ALL, $locale = 'en_US.UTF-8');\n putenv('LC_ALL=' . $locale);\n }", "final public function setUTF() {\n mysqli_query($this->resourceId,\"SET NAMES 'utf8'\");\n }", "public function getDatabaseCharsetAndCollation($options = array()) {\n $sql = 'SELECT default_character_set_name AS charset, default_collation_name AS collation\n FROM information_schema.SCHEMATA\n WHERE schema_name = \\''. $this->_dbName .'\\'';\n\n return $this->selectOne($sql, $options);\n }", "public function set_charset($charset)\n\t{\n\t\t// Make sure the database is connected\n\t\t$this->_connection OR $this->connect();\n\n\t\tif (self::$_set_names === TRUE)\n\t\t{\n\t\t\t// PHP is compiled against MySQL 4.x\n\t\t\t$status = (bool) $this->_connection->query('SET NAMES '.$this->quote($charset));\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// PHP is compiled against MySQL 5.x\n\t\t\t$status = $this->_connection->set_charset($charset);\n\t\t}\n\n\t\tif ($status === FALSE)\n\t\t{\n\t\t\tthrow new DatabaseException($this->_connection->error, $this->_connection->errno);\n\t\t}\n\t}", "function sql_set_charset($charset, $dbh=NULL) {\n global $MYSQL_HANDLER,$SQL_DBH;\n if (strpos($MYSQL_HANDLER[1], 'mysql') === 0) {\n switch(strtolower($charset)){\n case 'utf-8':\n case 'utf8':\n $charset = 'utf8';\n break;\n case 'utf8mb4':\n $charset = 'utf8mb4';\n break;\n case 'euc-jp':\n case 'ujis':\n $charset = 'ujis';\n break;\n case 'gb2312':\n $charset = 'gb2312';\n break;\n /*\n case 'shift_jis':\n case 'sjis':\n $charset = 'sjis';\n break;\n */\n default:\n $charset = 'latin1';\n break;\n }\n\n $db = ($dbh ? $dbh : sql_get_db());\n $mySqlVer = implode('.', array_map('intval', explode('.', sql_get_server_info($db))));\n if (version_compare($mySqlVer, '4.1.0', '>='))\n {\n $res = $db->exec(\"SET CHARACTER SET \" . $charset);\n }\n }\n return $res;\n }", "protected function setupDatabaseConnection()\n {\n $db = DBConnection::getInstance($this->config);\n\n $enc = property_exists($this->config, 'dbEncoding') ? $this->config->dbEncoding : 'utf8';\n $tz = property_exists($this->config, 'dbTimezone') ? $this->config->dbTimezone : '00:00';\n\n $db->query(\n sprintf('SET NAMES \"%s\"', $enc)\n );\n\n $db->query(\n sprintf('SET time_zone = \"%s\"', $tz)\n );\n }", "protected function getTableCollation(Connection $connection, $table, &$definition) {\n // Remove identifier quotes from the table name. See\n // \\Drupal\\mysql\\Driver\\Database\\mysql\\Connection::$identifierQuotes.\n $table = trim($connection->prefixTables('{' . $table . '}'), '\"');\n $query = $connection->query(\"SHOW TABLE STATUS WHERE NAME = :table_name\", [':table_name' => $table]);\n $data = $query->fetchAssoc();\n\n // Map the collation to a character set. For example, 'utf8mb4_general_ci'\n // (MySQL 5) or 'utf8mb4_0900_ai_ci' (MySQL 8) will be mapped to 'utf8mb4'.\n [$charset] = explode('_', $data['Collation'], 2);\n\n // Set `mysql_character_set`. This will be ignored by other backends.\n $definition['mysql_character_set'] = $charset;\n }", "public function setCollationConnection($collation_connection)\r\n {\r\n $this->collation_connection = $collation_connection;\r\n\r\n return $this;\r\n }", "public function normalizeCollation($collation)\n {\n return is_string($collation) && preg_match('/^\\w+$/', $collation) ? strtolower($collation) : '';\n }", "protected function restoreCharsetForMailer(): void\n {\n global $phpmailer;\n\n $phpmailer->Encoding = $this->originPhpMailerCharset;\n\n \\remove_filter('wp_mail_charset', [$this, 'encodingHelperForMailer']);\n }", "public function getCollation()\n {\n if (is_null($this->charset)) {\n throw new LogicException(\"getCollation called when collation is unspecified\");\n }\n if ($this->isBinaryCollation) {\n $collations = self::getCharsetCollations($this->charset);\n if (null !== $collations) {\n return $collations[count($collations) - 1];\n }\n }\n return $this->collation;\n }", "function db_upgrade_all($iOldDBVersion) {\n /// This function does anything necessary to upgrade\n /// older versions to match current functionality\n global $modifyoutput;\n Yii::app()->loadHelper('database');\n\n $sUserTemplateRootDir = Yii::app()->getConfig('usertemplaterootdir');\n $sStandardTemplateRootDir = Yii::app()->getConfig('standardtemplaterootdir');\n echo str_pad(gT('The LimeSurvey database is being upgraded').' ('.date('Y-m-d H:i:s').')',14096).\".<br /><br />\". gT('Please be patient...').\"<br /><br />\\n\";\n\n $oDB = Yii::app()->getDb();\n $oDB->schemaCachingDuration=0; // Deactivate schema caching\n $oTransaction = $oDB->beginTransaction();\n try\n {\n if ($iOldDBVersion < 111)\n {\n // Language upgrades from version 110 to 111 because the language names did change\n\n $aOldNewLanguages=array('german_informal'=>'german-informal',\n 'cns'=>'cn-Hans',\n 'cnt'=>'cn-Hant',\n 'pt_br'=>'pt-BR',\n 'gr'=>'el',\n 'jp'=>'ja',\n 'si'=>'sl',\n 'se'=>'sv',\n 'vn'=>'vi');\n foreach ($aOldNewLanguages as $sOldLanguageCode=>$sNewLanguageCode)\n {\n alterLanguageCode($sOldLanguageCode,$sNewLanguageCode);\n }\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>111),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 112) {\n // New size of the username field (it was previously 20 chars wide)\n $oDB->createCommand()->alterColumn('{{users}}','users_name',\"string(64) NOT NULL\");\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>112),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 113) {\n //Fixes the collation for the complete DB, tables and columns\n\n if (Yii::app()->db->driverName=='mysql')\n {\n $sDatabaseName=getDBConnectionStringProperty('dbname');\n fixMySQLCollations();\n modifyDatabase(\"\",\"ALTER DATABASE `$sDatabaseName` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;\");echo $modifyoutput; flush();@ob_flush();\n }\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>113),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 114) {\n $oDB->createCommand()->alterColumn('{{saved_control}}','email',\"string(320) NOT NULL\");\n $oDB->createCommand()->alterColumn('{{surveys}}','adminemail',\"string(320) NOT NULL\");\n $oDB->createCommand()->alterColumn('{{users}}','email',\"string(320) NOT NULL\");\n $oDB->createCommand()->insert('{{settings_global}}',array('stg_name'=>'SessionName','stg_value'=>randomChars(64,'ABCDEFGHIJKLMNOPQRSTUVWXYZ!\"$%&/()=?`+*~#\",;.:abcdefghijklmnopqrstuvwxyz123456789')));\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>114),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 126) {\n\n addColumn('{{surveys}}','printanswers',\"string(1) default 'N'\");\n addColumn('{{surveys}}','listpublic',\"string(1) default 'N'\");\n\n upgradeSurveyTables126();\n upgradeTokenTables126();\n\n // Create quota table\n $oDB->createCommand()->createTable('{{quota}}',array(\n 'id' => 'pk',\n 'sid' => 'integer',\n 'qlimit' => 'integer',\n 'name' => 'string',\n 'action' => 'integer',\n 'active' => 'integer NOT NULL DEFAULT 1'\n ));\n\n // Create quota_members table\n $oDB->createCommand()->createTable('{{quota_members}}',array(\n 'id' => 'pk',\n 'sid' => 'integer',\n 'qid' => 'integer',\n 'quota_id' => 'integer',\n 'code' => 'string(5)'\n ));\n $oDB->createCommand()->createIndex('sid','{{quota_members}}','sid,qid,quota_id,code',true);\n\n\n // Create templates_rights table\n $oDB->createCommand()->createTable('{{templates_rights}}',array(\n 'uid' => 'integer NOT NULL',\n 'folder' => 'string NOT NULL',\n 'use' => 'integer',\n 'PRIMARY KEY (uid, folder)'\n ));\n\n // Create templates table\n $oDB->createCommand()->createTable('{{templates}}',array(\n 'folder' => 'string NOT NULL',\n 'creator' => 'integer NOT NULL',\n 'PRIMARY KEY (folder)'\n ));\n\n // Rename Norwegian language codes\n alterLanguageCode('no','nb');\n\n addColumn('{{surveys}}','htmlemail',\"string(1) default 'N'\");\n addColumn('{{surveys}}','tokenanswerspersistence',\"string(1) default 'N'\");\n addColumn('{{surveys}}','usecaptcha',\"string(1) default 'N'\");\n addColumn('{{surveys}}','bounce_email','text');\n addColumn('{{users}}','htmleditormode',\"string(7) default 'default'\");\n addColumn('{{users}}','superadmin',\"integer NOT NULL default '0'\");\n addColumn('{{questions}}','lid1',\"integer NOT NULL default '0'\");\n\n alterColumn('{{conditions}}','value',\"string\",false,'');\n alterColumn('{{labels}}','title',\"text\");\n\n $oDB->createCommand()->update('{{users}}',array('superadmin'=>1),\"create_survey=1 AND create_user=1 AND move_user=1 AND delete_user=1 AND configurator=1\");\n $oDB->createCommand()->update('{{conditions}}',array('method'=>'=='),\"(method is null) or method='' or method='0'\");\n\n dropColumn('{{users}}','move_user');\n\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>126),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 127) {\n modifyDatabase(\"\",\"create index answers_idx2 on {{answers}} (sortorder)\"); echo $modifyoutput;\n modifyDatabase(\"\",\"create index assessments_idx2 on {{assessments}} (sid)\"); echo $modifyoutput;\n modifyDatabase(\"\",\"create index assessments_idx3 on {{assessments}} (gid)\"); echo $modifyoutput;\n modifyDatabase(\"\",\"create index conditions_idx2 on {{conditions}} (qid)\"); echo $modifyoutput;\n modifyDatabase(\"\",\"create index conditions_idx3 on {{conditions}} (cqid)\"); echo $modifyoutput;\n modifyDatabase(\"\",\"create index groups_idx2 on {{groups}} (sid)\"); echo $modifyoutput;\n modifyDatabase(\"\",\"create index question_attributes_idx2 on {{question_attributes}} (qid)\"); echo $modifyoutput;\n modifyDatabase(\"\",\"create index questions_idx2 on {{questions}} (sid)\"); echo $modifyoutput;\n modifyDatabase(\"\",\"create index questions_idx3 on {{questions}} (gid)\"); echo $modifyoutput;\n modifyDatabase(\"\",\"create index questions_idx4 on {{questions}} (type)\"); echo $modifyoutput;\n modifyDatabase(\"\",\"create index quota_idx2 on {{quota}} (sid)\"); echo $modifyoutput;\n modifyDatabase(\"\",\"create index saved_control_idx2 on {{saved_control}} (sid)\"); echo $modifyoutput;\n modifyDatabase(\"\",\"create index user_in_groups_idx1 on {{user_in_groups}} (ugid, uid)\"); echo $modifyoutput;\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>127),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 128) {\n upgradeTokens128();\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>128),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 129) {\n addColumn('{{surveys}}','startdate',\"datetime\");\n addColumn('{{surveys}}','usestartdate',\"string(1) NOT NULL default 'N'\");\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>129),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 130)\n {\n addColumn('{{conditions}}','scenario',\"integer NOT NULL default '1'\");\n $oDB->createCommand()->update('{{conditions}}',array('scenario'=>'1'),\"(scenario is null) or scenario=0\");\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>130),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 131)\n {\n addColumn('{{surveys}}','publicstatistics',\"string(1) NOT NULL default 'N'\");\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>131),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 132)\n {\n addColumn('{{surveys}}','publicgraphs',\"string(1) NOT NULL default 'N'\");\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>132),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 133)\n {\n addColumn('{{users}}','one_time_pw','binary');\n // Add new assessment setting\n addColumn('{{surveys}}','assessments',\"string(1) NOT NULL default 'N'\");\n // add new assessment value fields to answers & labels\n addColumn('{{answers}}','assessment_value',\"integer NOT NULL default '0'\");\n addColumn('{{labels}}','assessment_value',\"integer NOT NULL default '0'\");\n // copy any valid codes from code field to assessment field\n switch (Yii::app()->db->driverName){\n case 'mysql':\n case 'mysqli':\n $oDB->createCommand(\"UPDATE {{answers}} SET assessment_value=CAST(`code` as SIGNED) where `code` REGEXP '^-?[0-9]+$'\")->execute();\n $oDB->createCommand(\"UPDATE {{labels}} SET assessment_value=CAST(`code` as SIGNED) where `code` REGEXP '^-?[0-9]+$'\")->execute();\n // copy assessment link to message since from now on we will have HTML assignment messages\n $oDB->createCommand(\"UPDATE {{assessments}} set message=concat(replace(message,'/''',''''),'<br /><a href=\\\"',link,'\\\">',link,'</a>')\")->execute();\n break;\n case 'sqlsrv':\n case 'dblib':\n case 'mssql':\n try{\n $oDB->createCommand(\"UPDATE {{answers}} SET assessment_value=CAST([code] as int) WHERE ISNUMERIC([code])=1\")->execute();\n $oDB->createCommand(\"UPDATE {{labels}} SET assessment_value=CAST([code] as int) WHERE ISNUMERIC([code])=1\")->execute();\n } catch(Exception $e){};\n // copy assessment link to message since from now on we will have HTML assignment messages\n alterColumn('{{assessments}}','link',\"text\",false);\n alterColumn('{{assessments}}','message',\"text\",false);\n $oDB->createCommand(\"UPDATE {{assessments}} set message=replace(message,'/''','''')+'<br /><a href=\\\"'+link+'\\\">'+link+'</a>'\")->execute();\n break;\n case 'pgsql':\n $oDB->createCommand(\"UPDATE {{answers}} SET assessment_value=CAST(code as integer) where code ~ '^[0-9]+'\")->execute();\n $oDB->createCommand(\"UPDATE {{labels}} SET assessment_value=CAST(code as integer) where code ~ '^[0-9]+'\")->execute();\n // copy assessment link to message since from now on we will have HTML assignment messages\n $oDB->createCommand(\"UPDATE {{assessments}} set message=replace(message,'/''','''')||'<br /><a href=\\\"'||link||'\\\">'||link||'</a>'\")->execute();\n break;\n default: die('Unknown database type');\n }\n // activate assessment where assessment rules exist\n $oDB->createCommand(\"UPDATE {{surveys}} SET assessments='Y' where sid in (SELECT sid FROM {{assessments}} group by sid)\")->execute();\n // add language field to assessment table\n addColumn('{{assessments}}','language',\"string(20) NOT NULL default 'en'\");\n // update language field with default language of that particular survey\n $oDB->createCommand(\"UPDATE {{assessments}} SET language=(select language from {{surveys}} where sid={{assessments}}.sid)\")->execute();\n // drop the old link field\n dropColumn('{{assessments}}','link');\n\n // Add new fields to survey language settings\n addColumn('{{surveys_languagesettings}}','surveyls_url',\"string\");\n addColumn('{{surveys_languagesettings}}','surveyls_endtext','text');\n // copy old URL fields ot language specific entries\n $oDB->createCommand(\"UPDATE {{surveys_languagesettings}} set surveyls_url=(select url from {{surveys}} where sid={{surveys_languagesettings}}.surveyls_survey_id)\")->execute();\n // drop old URL field\n dropColumn('{{surveys}}','url');\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>133),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 134)\n {\n // Add new tokens setting\n addColumn('{{surveys}}','usetokens',\"string(1) NOT NULL default 'N'\");\n addColumn('{{surveys}}','attributedescriptions','text');\n dropColumn('{{surveys}}','attribute1');\n dropColumn('{{surveys}}','attribute2');\n upgradeTokenTables134();\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>134),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 135)\n {\n alterColumn('{{question_attributes}}','value','text');\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>135),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 136) //New Quota Functions\n {\n addColumn('{{quota}}','autoload_url',\"integer NOT NULL default 0\");\n // Create quota table\n $aFields = array(\n 'quotals_id' => 'pk',\n 'quotals_quota_id' => 'integer NOT NULL DEFAULT 0',\n 'quotals_language' => \"string(45) NOT NULL default 'en'\",\n 'quotals_name' => 'string',\n 'quotals_message' => 'text NOT NULL',\n 'quotals_url' => 'string',\n 'quotals_urldescrip' => 'string',\n );\n $oDB->createCommand()->createTable('{{quota_languagesettings}}',$aFields);\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>136),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 137) //New Quota Functions\n {\n addColumn('{{surveys_languagesettings}}','surveyls_dateformat',\"integer NOT NULL default 1\");\n addColumn('{{users}}','dateformat',\"integer NOT NULL default 1\");\n $oDB->createCommand()->update('{{surveys}}',array('startdate'=>NULL),\"usestartdate='N'\");\n $oDB->createCommand()->update('{{surveys}}',array('expires'=>NULL),\"useexpiry='N'\");\n dropColumn('{{surveys}}','useexpiry');\n dropColumn('{{surveys}}','usestartdate');\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>137),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 138) //Modify quota field\n {\n alterColumn('{{quota_members}}','code',\"string(11)\");\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>138),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 139) //Modify quota field\n {\n upgradeSurveyTables139();\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>139),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 140) //Modify surveys table\n {\n addColumn('{{surveys}}','emailresponseto','text');\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>140),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 141) //Modify surveys table\n {\n addColumn('{{surveys}}','tokenlength','integer NOT NULL default 15');\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>141),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 142) //Modify surveys table\n {\n upgradeQuestionAttributes142();\n $oDB->createCommand()->alterColumn('{{surveys}}','expires',\"datetime\");\n $oDB->createCommand()->alterColumn('{{surveys}}','startdate',\"datetime\");\n $oDB->createCommand()->update('{{question_attributes}}',array('value'=>0),\"value='false'\");\n $oDB->createCommand()->update('{{question_attributes}}',array('value'=>1),\"value='true'\");\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>142),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 143)\n {\n addColumn('{{questions}}','parent_qid','integer NOT NULL default 0');\n addColumn('{{answers}}','scale_id','integer NOT NULL default 0');\n addColumn('{{questions}}','scale_id','integer NOT NULL default 0');\n addColumn('{{questions}}','same_default','integer NOT NULL default 0');\n dropPrimaryKey('answers');\n addPrimaryKey('answers', array('qid','code','language','scale_id'));\n\n $aFields = array(\n 'qid' => \"integer NOT NULL default 0\",\n 'scale_id' => 'integer NOT NULL default 0',\n 'sqid' => 'integer NOT NULL default 0',\n 'language' => 'string(20) NOT NULL',\n 'specialtype' => \"string(20) NOT NULL default ''\",\n 'defaultvalue' => 'text',\n );\n $oDB->createCommand()->createTable('{{defaultvalues}}',$aFields);\n addPrimaryKey('defaultvalues', array('qid','specialtype','language','scale_id','sqid'));\n\n // -Move all 'answers' that are subquestions to the questions table\n // -Move all 'labels' that are answers to the answers table\n // -Transscribe the default values where applicable\n // -Move default values from answers to questions\n upgradeTables143();\n\n dropColumn('{{answers}}','default_value');\n dropColumn('{{questions}}','lid');\n dropColumn('{{questions}}','lid1');\n\n $aFields = array(\n 'sesskey' => \"string(64) NOT NULL DEFAULT ''\",\n 'expiry' => \"datetime NOT NULL\",\n 'expireref' => \"string(250) DEFAULT ''\",\n 'created' => \"datetime NOT NULL\",\n 'modified' => \"datetime NOT NULL\",\n 'sessdata' => 'text'\n );\n $oDB->createCommand()->createTable('{{sessions}}',$aFields);\n addPrimaryKey('sessions',array('sesskey'));\n $oDB->createCommand()->createIndex('sess2_expiry','{{sessions}}','expiry');\n $oDB->createCommand()->createIndex('sess2_expireref','{{sessions}}','expireref');\n // Move all user templates to the new user template directory\n echo \"<br>\".sprintf(gT(\"Moving user templates to new location at %s...\"),$sUserTemplateRootDir).\"<br />\";\n $hTemplateDirectory = opendir($sStandardTemplateRootDir);\n $aFailedTemplates=array();\n // get each entry\n while($entryName = readdir($hTemplateDirectory)) {\n if (!in_array($entryName,array('.','..','.svn')) && is_dir($sStandardTemplateRootDir.DIRECTORY_SEPARATOR.$entryName) && !isStandardTemplate($entryName))\n {\n if (!rename($sStandardTemplateRootDir.DIRECTORY_SEPARATOR.$entryName,$sUserTemplateRootDir.DIRECTORY_SEPARATOR.$entryName))\n {\n $aFailedTemplates[]=$entryName;\n };\n }\n }\n if (count($aFailedTemplates)>0)\n {\n echo \"The following templates at {$sStandardTemplateRootDir} could not be moved to the new location at {$sUserTemplateRootDir}:<br /><ul>\";\n foreach ($aFailedTemplates as $sFailedTemplate)\n {\n echo \"<li>{$sFailedTemplate}</li>\";\n }\n echo \"</ul>Please move these templates manually after the upgrade has finished.<br />\";\n }\n // close directory\n closedir($hTemplateDirectory);\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>143),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 145)\n {\n addColumn('{{surveys}}','savetimings',\"string(1) NULL default 'N'\");\n addColumn('{{surveys}}','showXquestions',\"string(1) NULL default 'Y'\");\n addColumn('{{surveys}}','showgroupinfo',\"string(1) NULL default 'B'\");\n addColumn('{{surveys}}','shownoanswer',\"string(1) NULL default 'Y'\");\n addColumn('{{surveys}}','showqnumcode',\"string(1) NULL default 'X'\");\n addColumn('{{surveys}}','bouncetime','integer');\n addColumn('{{surveys}}','bounceprocessing',\"string(1) NULL default 'N'\");\n addColumn('{{surveys}}','bounceaccounttype',\"string(4)\");\n addColumn('{{surveys}}','bounceaccounthost',\"string(200)\");\n addColumn('{{surveys}}','bounceaccountpass',\"string(100)\");\n addColumn('{{surveys}}','bounceaccountencryption',\"string(3)\");\n addColumn('{{surveys}}','bounceaccountuser',\"string(200)\");\n addColumn('{{surveys}}','showwelcome',\"string(1) default 'Y'\");\n addColumn('{{surveys}}','showprogress',\"string(1) default 'Y'\");\n addColumn('{{surveys}}','allowjumps',\"string(1) default 'N'\");\n addColumn('{{surveys}}','navigationdelay',\"integer default 0\");\n addColumn('{{surveys}}','nokeyboard',\"string(1) default 'N'\");\n addColumn('{{surveys}}','alloweditaftercompletion',\"string(1) default 'N'\");\n\n\n $aFields = array(\n 'sid' => \"integer NOT NULL\",\n 'uid' => \"integer NOT NULL\",\n 'permission' => 'string(20) NOT NULL',\n 'create_p' => \"integer NOT NULL default 0\",\n 'read_p' => \"integer NOT NULL default 0\",\n 'update_p' => \"integer NOT NULL default 0\",\n 'delete_p' => \"integer NOT NULL default 0\",\n 'import_p' => \"integer NOT NULL default 0\",\n 'export_p' => \"integer NOT NULL default 0\"\n );\n $oDB->createCommand()->createTable('{{survey_permissions}}',$aFields);\n addPrimaryKey('survey_permissions', array('sid','uid','permission'));\n\n upgradeSurveyPermissions145();\n\n // drop the old survey rights table\n $oDB->createCommand()->dropTable('{{surveys_rights}}');\n\n // Add new fields for email templates\n addColumn('{{surveys_languagesettings}}','email_admin_notification_subj',\"string\");\n addColumn('{{surveys_languagesettings}}','email_admin_responses_subj',\"string\");\n addColumn('{{surveys_languagesettings}}','email_admin_notification',\"text\");\n addColumn('{{surveys_languagesettings}}','email_admin_responses',\"text\");\n\n //Add index to questions table to speed up subquestions\n $oDB->createCommand()->createIndex('parent_qid_idx','{{questions}}','parent_qid');\n\n addColumn('{{surveys}}','emailnotificationto',\"text\");\n\n upgradeSurveys145();\n dropColumn('{{surveys}}','notification');\n alterColumn('{{conditions}}','method',\"string(5)\",false,'');\n\n $oDB->createCommand()->renameColumn('{{surveys}}','private','anonymized');\n $oDB->createCommand()->update('{{surveys}}',array('anonymized'=>'N'),\"anonymized is NULL\");\n alterColumn('{{surveys}}','anonymized',\"string(1)\",false,'N');\n\n //now we clean up things that were not properly set in previous DB upgrades\n $oDB->createCommand()->update('{{answers}}',array('answer'=>''),\"answer is NULL\");\n $oDB->createCommand()->update('{{assessments}}',array('scope'=>''),\"scope is NULL\");\n $oDB->createCommand()->update('{{assessments}}',array('name'=>''),\"name is NULL\");\n $oDB->createCommand()->update('{{assessments}}',array('message'=>''),\"message is NULL\");\n $oDB->createCommand()->update('{{assessments}}',array('minimum'=>''),\"minimum is NULL\");\n $oDB->createCommand()->update('{{assessments}}',array('maximum'=>''),\"maximum is NULL\");\n $oDB->createCommand()->update('{{groups}}',array('group_name'=>''),\"group_name is NULL\");\n $oDB->createCommand()->update('{{labels}}',array('code'=>''),\"code is NULL\");\n $oDB->createCommand()->update('{{labelsets}}',array('label_name'=>''),\"label_name is NULL\");\n $oDB->createCommand()->update('{{questions}}',array('type'=>'T'),\"type is NULL\");\n $oDB->createCommand()->update('{{questions}}',array('title'=>''),\"title is NULL\");\n $oDB->createCommand()->update('{{questions}}',array('question'=>''),\"question is NULL\");\n $oDB->createCommand()->update('{{questions}}',array('other'=>'N'),\"other is NULL\");\n\n alterColumn('{{answers}}','answer',\"text\",false);\n alterColumn('{{answers}}','assessment_value','integer',false , '0');\n alterColumn('{{assessments}}','scope',\"string(5)\",false , '');\n alterColumn('{{assessments}}','name',\"text\",false);\n alterColumn('{{assessments}}','message',\"text\",false);\n alterColumn('{{assessments}}','minimum',\"string(50)\",false , '');\n alterColumn('{{assessments}}','maximum',\"string(50)\",false , '');\n // change the primary index to include language\n if (Yii::app()->db->driverName=='mysql') // special treatment for mysql because this needs to be in one step since an AUTOINC field is involved\n {\n modifyPrimaryKey('assessments', array('id', 'language'));\n }\n else\n {\n dropPrimaryKey('assessments');\n addPrimaryKey('assessments',array('id','language'));\n }\n\n\n alterColumn('{{conditions}}','cfieldname',\"string(50)\",false , '');\n dropPrimaryKey('defaultvalues');\n alterColumn('{{defaultvalues}}','specialtype',\"string(20)\",false , '');\n addPrimaryKey('defaultvalues', array('qid','specialtype','language','scale_id','sqid'));\n\n alterColumn('{{groups}}','group_name',\"string(100)\",false , '');\n alterColumn('{{labels}}','code',\"string(5)\",false , '');\n dropPrimaryKey('labels');\n alterColumn('{{labels}}','language',\"string(20)\",false , 'en');\n addPrimaryKey('labels', array('lid', 'sortorder', 'language'));\n alterColumn('{{labelsets}}','label_name',\"string(100)\",false , '');\n alterColumn('{{questions}}','parent_qid','integer',false ,'0');\n alterColumn('{{questions}}','title',\"string(20)\",false , '');\n alterColumn('{{questions}}','question',\"text\",false);\n try { setTransactionBookmark(); $oDB->createCommand()->dropIndex('questions_idx4','{{questions}}'); } catch(Exception $e) { rollBackToTransactionBookmark();}\n\n alterColumn('{{questions}}','type',\"string(1)\",false , 'T');\n try{ $oDB->createCommand()->createIndex('questions_idx4','{{questions}}','type');} catch(Exception $e){};\n alterColumn('{{questions}}','other',\"string(1)\",false , 'N');\n alterColumn('{{questions}}','mandatory',\"string(1)\");\n alterColumn('{{question_attributes}}','attribute',\"string(50)\");\n alterColumn('{{quota}}','qlimit','integer');\n\n $oDB->createCommand()->update('{{saved_control}}',array('identifier'=>''),\"identifier is NULL\");\n alterColumn('{{saved_control}}','identifier',\"text\",false);\n $oDB->createCommand()->update('{{saved_control}}',array('access_code'=>''),\"access_code is NULL\");\n alterColumn('{{saved_control}}','access_code',\"text\",false);\n alterColumn('{{saved_control}}','email',\"string(320)\");\n $oDB->createCommand()->update('{{saved_control}}',array('ip'=>''),\"ip is NULL\");\n alterColumn('{{saved_control}}','ip',\"text\",false);\n $oDB->createCommand()->update('{{saved_control}}',array('saved_thisstep'=>''),\"saved_thisstep is NULL\");\n alterColumn('{{saved_control}}','saved_thisstep',\"text\",false);\n $oDB->createCommand()->update('{{saved_control}}',array('status'=>''),\"status is NULL\");\n alterColumn('{{saved_control}}','status',\"string(1)\",false , '');\n $oDB->createCommand()->update('{{saved_control}}',array('saved_date'=>'1980-01-01 00:00:00'),\"saved_date is NULL\");\n alterColumn('{{saved_control}}','saved_date',\"datetime\",false);\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>''),\"stg_value is NULL\");\n alterColumn('{{settings_global}}','stg_value',\"string\",false , '');\n\n alterColumn('{{surveys}}','admin',\"string(50)\");\n $oDB->createCommand()->update('{{surveys}}',array('active'=>'N'),\"active is NULL\");\n\n alterColumn('{{surveys}}','active',\"string(1)\",false , 'N');\n\n alterColumn('{{surveys}}','startdate',\"datetime\");\n alterColumn('{{surveys}}','adminemail',\"string(320)\");\n alterColumn('{{surveys}}','anonymized',\"string(1)\",false , 'N');\n\n alterColumn('{{surveys}}','faxto',\"string(20)\");\n alterColumn('{{surveys}}','format',\"string(1)\");\n alterColumn('{{surveys}}','language',\"string(50)\");\n alterColumn('{{surveys}}','additional_languages',\"string\");\n alterColumn('{{surveys}}','printanswers',\"string(1)\",true , 'N');\n alterColumn('{{surveys}}','publicstatistics',\"string(1)\",true , 'N');\n alterColumn('{{surveys}}','publicgraphs',\"string(1)\",true , 'N');\n alterColumn('{{surveys}}','assessments',\"string(1)\",true , 'N');\n alterColumn('{{surveys}}','usetokens',\"string(1)\",true , 'N');\n alterColumn('{{surveys}}','bounce_email',\"string(320)\");\n alterColumn('{{surveys}}','tokenlength','integer',true , 15);\n\n $oDB->createCommand()->update('{{surveys_languagesettings}}',array('surveyls_title'=>''),\"surveyls_title is NULL\");\n alterColumn('{{surveys_languagesettings}}','surveyls_title',\"string(200)\",false);\n alterColumn('{{surveys_languagesettings}}','surveyls_endtext',\"text\");\n alterColumn('{{surveys_languagesettings}}','surveyls_url',\"string\");\n alterColumn('{{surveys_languagesettings}}','surveyls_urldescription',\"string\");\n alterColumn('{{surveys_languagesettings}}','surveyls_email_invite_subj',\"string\");\n alterColumn('{{surveys_languagesettings}}','surveyls_email_remind_subj',\"string\");\n alterColumn('{{surveys_languagesettings}}','surveyls_email_register_subj',\"string\");\n alterColumn('{{surveys_languagesettings}}','surveyls_email_confirm_subj',\"string\");\n alterColumn('{{surveys_languagesettings}}','surveyls_dateformat','integer',false , 1);\n\n $oDB->createCommand()->update('{{users}}',array('users_name'=>''),\"users_name is NULL\");\n $oDB->createCommand()->update('{{users}}',array('full_name'=>''),\"full_name is NULL\");\n alterColumn('{{users}}','users_name',\"string(64)\",false , '');\n alterColumn('{{users}}','full_name',\"string(50)\",false);\n alterColumn('{{users}}','lang',\"string(20)\");\n alterColumn('{{users}}','email',\"string(320)\");\n alterColumn('{{users}}','superadmin','integer',false , 0);\n alterColumn('{{users}}','htmleditormode',\"string(7)\",true,'default');\n alterColumn('{{users}}','dateformat','integer',false , 1);\n try{\n setTransactionBookmark();\n $oDB->createCommand()->dropIndex('email','{{users}}');\n }\n catch(Exception $e)\n {\n // do nothing\n rollBackToTransactionBookmark();\n }\n\n $oDB->createCommand()->update('{{user_groups}}',array('name'=>''),\"name is NULL\");\n $oDB->createCommand()->update('{{user_groups}}',array('description'=>''),\"description is NULL\");\n alterColumn('{{user_groups}}','name',\"string(20)\",false);\n alterColumn('{{user_groups}}','description',\"text\",false);\n\n try { $oDB->createCommand()->dropIndex('user_in_groups_idx1','{{user_in_groups}}'); } catch(Exception $e) {}\n try { addPrimaryKey('user_in_groups', array('ugid','uid')); } catch(Exception $e) {}\n\n addColumn('{{surveys_languagesettings}}','surveyls_numberformat',\"integer NOT NULL DEFAULT 0\");\n\n $oDB->createCommand()->createTable('{{failed_login_attempts}}',array(\n 'id' => \"pk\",\n 'ip' => 'string(37) NOT NULL',\n 'last_attempt' => 'string(20) NOT NULL',\n 'number_attempts' => \"integer NOT NULL\"\n ));\n upgradeTokens145();\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>145),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 146) //Modify surveys table\n {\n upgradeSurveyTimings146();\n // Fix permissions for new feature quick-translation\n try { setTransactionBookmark(); $oDB->createCommand(\"INSERT into {{survey_permissions}} (sid,uid,permission,read_p,update_p) SELECT sid,owner_id,'translations','1','1' from {{surveys}}\")->execute(); echo $modifyoutput; flush();@ob_flush();} catch(Exception $e) { rollBackToTransactionBookmark();}\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>146),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 147)\n {\n addColumn('{{users}}','templateeditormode',\"string(7) NOT NULL default 'default'\");\n addColumn('{{users}}','questionselectormode',\"string(7) NOT NULL default 'default'\");\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>147),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 148)\n {\n addColumn('{{users}}','participant_panel',\"integer NOT NULL default 0\");\n\n $oDB->createCommand()->createTable('{{participants}}',array(\n 'participant_id' => 'string(50) NOT NULL',\n 'firstname' => 'string(40) default NULL',\n 'lastname' => 'string(40) default NULL',\n 'email' => 'string(80) default NULL',\n 'language' => 'string(40) default NULL',\n 'blacklisted' => 'string(1) NOT NULL',\n 'owner_uid' => \"integer NOT NULL\"\n ));\n addPrimaryKey('participants', array('participant_id'));\n\n $oDB->createCommand()->createTable('{{participant_attribute}}',array(\n 'participant_id' => 'string(50) NOT NULL',\n 'attribute_id' => \"integer NOT NULL\",\n 'value' => 'string(50) NOT NULL'\n ));\n addPrimaryKey('participant_attribute', array('participant_id','attribute_id'));\n\n $oDB->createCommand()->createTable('{{participant_attribute_names}}',array(\n 'attribute_id' => 'autoincrement',\n 'attribute_type' => 'string(4) NOT NULL',\n 'visible' => 'string(5) NOT NULL',\n 'PRIMARY KEY (attribute_id,attribute_type)'\n ));\n\n $oDB->createCommand()->createTable('{{participant_attribute_names_lang}}',array(\n 'attribute_id' => 'integer NOT NULL',\n 'attribute_name' => 'string(30) NOT NULL',\n 'lang' => 'string(20) NOT NULL'\n ));\n addPrimaryKey('participant_attribute_names_lang', array('attribute_id','lang'));\n\n $oDB->createCommand()->createTable('{{participant_attribute_values}}',array(\n 'attribute_id' => 'integer NOT NULL',\n 'value_id' => 'pk',\n 'value' => 'string(20) NOT NULL'\n ));\n\n $oDB->createCommand()->createTable('{{participant_shares}}',array(\n 'participant_id' => 'string(50) NOT NULL',\n 'share_uid' => 'integer NOT NULL',\n 'date_added' => 'datetime NOT NULL',\n 'can_edit' => 'string(5) NOT NULL'\n ));\n addPrimaryKey('participant_shares', array('participant_id','share_uid'));\n\n $oDB->createCommand()->createTable('{{survey_links}}',array(\n 'participant_id' => 'string(50) NOT NULL',\n 'token_id' => 'integer NOT NULL',\n 'survey_id' => 'integer NOT NULL',\n 'date_created' => 'datetime NOT NULL'\n ));\n addPrimaryKey('survey_links', array('participant_id','token_id','survey_id'));\n // Add language field to question_attributes table\n addColumn('{{question_attributes}}','language',\"string(20)\");\n upgradeQuestionAttributes148();\n fixSubquestions();\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>148),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 149)\n {\n $aFields = array(\n 'id' => 'integer',\n 'sid' => 'integer',\n 'parameter' => 'string(50)',\n 'targetqid' => 'integer',\n 'targetsqid' => 'integer'\n );\n $oDB->createCommand()->createTable('{{survey_url_parameters}}',$aFields);\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>149),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 150)\n {\n addColumn('{{questions}}','relevance','TEXT');\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>150),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 151)\n {\n addColumn('{{groups}}','randomization_group',\"string(20) NOT NULL default ''\");\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>151),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 152)\n {\n $oDB->createCommand()->createIndex('question_attributes_idx3','{{question_attributes}}','attribute');\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>152),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 153)\n {\n $oDB->createCommand()->createTable('{{expression_errors}}',array(\n 'id' => 'pk',\n 'errortime' => 'string(50)',\n 'sid' => 'integer',\n 'gid' => 'integer',\n 'qid' => 'integer',\n 'gseq' => 'integer',\n 'qseq' => 'integer',\n 'type' => 'string(50)',\n 'eqn' => 'text',\n 'prettyprint' => 'text'\n ));\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>153),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 154)\n {\n $oDB->createCommand()->addColumn('{{groups}}','grelevance',\"text\");\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>154),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 155)\n {\n addColumn('{{surveys}}','googleanalyticsstyle',\"string(1)\");\n addColumn('{{surveys}}','googleanalyticsapikey',\"string(25)\");\n try { setTransactionBookmark(); $oDB->createCommand()->renameColumn('{{surveys}}','showXquestions','showxquestions');} catch(Exception $e) { rollBackToTransactionBookmark();}\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>155),\"stg_name='DBVersion'\");\n }\n\n\n if ($iOldDBVersion < 156)\n {\n try\n {\n $oDB->createCommand()->dropTable('{{survey_url_parameters}}');\n }\n catch(Exception $e)\n {\n // do nothing\n }\n $oDB->createCommand()->createTable('{{survey_url_parameters}}',array(\n 'id' => 'pk',\n 'sid' => 'integer NOT NULL',\n 'parameter' => 'string(50) NOT NULL',\n 'targetqid' => 'integer',\n 'targetsqid' => 'integer'\n ));\n\n $oDB->createCommand()->dropTable('{{sessions}}');\n if (Yii::app()->db->driverName=='mysql')\n {\n $oDB->createCommand()->createTable('{{sessions}}',array(\n 'id' => 'string(32) NOT NULL',\n 'expire' => 'integer',\n 'data' => 'longtext'\n ));\n }\n else\n {\n $oDB->createCommand()->createTable('{{sessions}}',array(\n 'id' => 'string(32) NOT NULL',\n 'expire' => 'integer',\n 'data' => 'text'\n ));\n }\n\n addPrimaryKey('sessions', array('id'));\n addColumn('{{surveys_languagesettings}}','surveyls_attributecaptions',\"TEXT\");\n addColumn('{{surveys}}','sendconfirmation',\"string(1) default 'Y'\");\n\n upgradeSurveys156();\n\n // If a survey has an deleted owner, re-own the survey to the superadmin\n $oDB->schema->refresh();\n Survey::model()->refreshMetaData();\n $surveys = Survey::model();\n $surveys = $surveys->with(array('owner'))->findAll();\n foreach ($surveys as $row)\n {\n if (!isset($row->owner->attributes))\n {\n Survey::model()->updateByPk($row->sid,array('owner_id'=>1));\n }\n }\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>156),\"stg_name='DBVersion'\");\n $oTransaction->commit();\n $oTransaction=$oDB->beginTransaction();\n }\n\n if ($iOldDBVersion < 157)\n {\n // MySQL DB corrections\n try { setTransactionBookmark(); $oDB->createCommand()->dropIndex('questions_idx4','{{questions}}'); } catch(Exception $e) { rollBackToTransactionBookmark();}\n\n alterColumn('{{answers}}','assessment_value','integer',false , '0');\n dropPrimaryKey('answers');\n alterColumn('{{answers}}','scale_id','integer',false , '0');\n addPrimaryKey('answers', array('qid','code','language','scale_id'));\n alterColumn('{{conditions}}','method',\"string(5)\",false , '');\n alterColumn('{{participants}}','owner_uid','integer',false);\n alterColumn('{{participant_attribute_names}}','visible','string(5)',false);\n alterColumn('{{questions}}','type',\"string(1)\",false , 'T');\n alterColumn('{{questions}}','other',\"string(1)\",false , 'N');\n alterColumn('{{questions}}','mandatory',\"string(1)\");\n alterColumn('{{questions}}','scale_id','integer',false , '0');\n alterColumn('{{questions}}','parent_qid','integer',false ,'0');\n\n alterColumn('{{questions}}','same_default','integer',false , '0');\n alterColumn('{{quota}}','qlimit','integer');\n alterColumn('{{quota}}','action','integer');\n alterColumn('{{quota}}','active','integer',false , '1');\n alterColumn('{{quota}}','autoload_url','integer',false , '0');\n alterColumn('{{saved_control}}','status',\"string(1)\",false , '');\n try { setTransactionBookmark(); alterColumn('{{sessions}}','id',\"string(32)\",false); } catch(Exception $e) { rollBackToTransactionBookmark();}\n alterColumn('{{surveys}}','active',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','anonymized',\"string(1)\",false,'N');\n alterColumn('{{surveys}}','format',\"string(1)\");\n alterColumn('{{surveys}}','savetimings',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','datestamp',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','usecookie',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','allowregister',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','allowsave',\"string(1)\",false , 'Y');\n alterColumn('{{surveys}}','autonumber_start','integer' ,false, '0');\n alterColumn('{{surveys}}','autoredirect',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','allowprev',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','printanswers',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','ipaddr',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','refurl',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','publicstatistics',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','publicgraphs',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','listpublic',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','htmlemail',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','sendconfirmation',\"string(1)\",false , 'Y');\n alterColumn('{{surveys}}','tokenanswerspersistence',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','assessments',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','usecaptcha',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','usetokens',\"string(1)\",false , 'N');\n alterColumn('{{surveys}}','tokenlength','integer',false, '15');\n alterColumn('{{surveys}}','showxquestions',\"string(1)\", true , 'Y');\n alterColumn('{{surveys}}','showgroupinfo',\"string(1) \", true , 'B');\n alterColumn('{{surveys}}','shownoanswer',\"string(1) \", true , 'Y');\n alterColumn('{{surveys}}','showqnumcode',\"string(1) \", true , 'X');\n alterColumn('{{surveys}}','bouncetime','integer');\n alterColumn('{{surveys}}','showwelcome',\"string(1)\", true , 'Y');\n alterColumn('{{surveys}}','showprogress',\"string(1)\", true , 'Y');\n alterColumn('{{surveys}}','allowjumps',\"string(1)\", true , 'N');\n alterColumn('{{surveys}}','navigationdelay','integer', false , '0');\n alterColumn('{{surveys}}','nokeyboard',\"string(1)\", true , 'N');\n alterColumn('{{surveys}}','alloweditaftercompletion',\"string(1)\", true , 'N');\n alterColumn('{{surveys}}','googleanalyticsstyle',\"string(1)\");\n\n alterColumn('{{surveys_languagesettings}}','surveyls_dateformat','integer',false , 1);\n try { setTransactionBookmark(); alterColumn('{{survey_permissions}}','sid',\"integer\",false); } catch(Exception $e) { rollBackToTransactionBookmark();}\n try { setTransactionBookmark(); alterColumn('{{survey_permissions}}','uid',\"integer\",false); } catch(Exception $e) { rollBackToTransactionBookmark();}\n alterColumn('{{survey_permissions}}','create_p', 'integer',false , '0');\n alterColumn('{{survey_permissions}}','read_p', 'integer',false , '0');\n alterColumn('{{survey_permissions}}','update_p','integer',false , '0');\n alterColumn('{{survey_permissions}}','delete_p' ,'integer',false , '0');\n alterColumn('{{survey_permissions}}','import_p','integer',false , '0');\n alterColumn('{{survey_permissions}}','export_p' ,'integer',false , '0');\n\n alterColumn('{{survey_url_parameters}}','targetqid' ,'integer');\n alterColumn('{{survey_url_parameters}}','targetsqid' ,'integer');\n\n alterColumn('{{templates_rights}}','use','integer',false );\n\n alterColumn('{{users}}','create_survey','integer',false, '0');\n alterColumn('{{users}}','create_user','integer',false, '0');\n alterColumn('{{users}}','participant_panel','integer',false, '0');\n alterColumn('{{users}}','delete_user','integer',false, '0');\n alterColumn('{{users}}','superadmin','integer',false, '0');\n alterColumn('{{users}}','configurator','integer',false, '0');\n alterColumn('{{users}}','manage_template','integer',false, '0');\n alterColumn('{{users}}','manage_label','integer',false, '0');\n alterColumn('{{users}}','dateformat','integer',false, 1);\n alterColumn('{{users}}','participant_panel','integer',false , '0');\n alterColumn('{{users}}','parent_id','integer',false);\n try { setTransactionBookmark(); alterColumn('{{surveys_languagesettings}}','surveyls_survey_id',\"integer\",false); } catch(Exception $e) { rollBackToTransactionBookmark(); }\n alterColumn('{{user_groups}}','owner_id',\"integer\",false);\n dropPrimaryKey('user_in_groups');\n alterColumn('{{user_in_groups}}','ugid',\"integer\",false);\n alterColumn('{{user_in_groups}}','uid',\"integer\",false);\n\n // Additional corrections for Postgres\n try{ setTransactionBookmark(); $oDB->createCommand()->createIndex('questions_idx3','{{questions}}','gid');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); $oDB->createCommand()->createIndex('conditions_idx3','{{conditions}}','cqid');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); $oDB->createCommand()->createIndex('questions_idx4','{{questions}}','type');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); $oDB->createCommand()->dropIndex('user_in_groups_idx1','{{user_in_groups}}');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); $oDB->createCommand()->dropIndex('{{user_name_key}}','{{users}}');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); $oDB->createCommand()->createIndex('users_name','{{users}}','users_name',true);} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); addPrimaryKey('user_in_groups', array('ugid','uid'));} catch(Exception $e) { rollBackToTransactionBookmark(); };\n\n alterColumn('{{participant_attribute}}','value',\"string(50)\", false);\n try{ setTransactionBookmark(); alterColumn('{{participant_attribute_names}}','attribute_type',\"string(4)\", false);} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); dropColumn('{{participant_attribute_names_lang}}','id');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); addPrimaryKey('participant_attribute_names_lang',array('attribute_id','lang'));} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); $oDB->createCommand()->renameColumn('{{participant_shares}}','shared_uid','share_uid');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n alterColumn('{{participant_shares}}','date_added',\"datetime\", false);\n alterColumn('{{participants}}','firstname',\"string(40)\");\n alterColumn('{{participants}}','lastname',\"string(40)\");\n alterColumn('{{participants}}','email',\"string(80)\");\n alterColumn('{{participants}}','language',\"string(40)\");\n alterColumn('{{quota_languagesettings}}','quotals_name',\"string\");\n try{ setTransactionBookmark(); alterColumn('{{survey_permissions}}','sid','integer',false); } catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); alterColumn('{{survey_permissions}}','uid','integer',false); } catch(Exception $e) { rollBackToTransactionBookmark(); };\n alterColumn('{{users}}','htmleditormode',\"string(7)\",true,'default');\n\n // Sometimes the survey_links table was deleted before this step, if so\n // we recreate it (copied from line 663)\n if (!tableExists('{survey_links}')) {\n $oDB->createCommand()->createTable('{{survey_links}}',array(\n 'participant_id' => 'string(50) NOT NULL',\n 'token_id' => 'integer NOT NULL',\n 'survey_id' => 'integer NOT NULL',\n 'date_created' => 'datetime NOT NULL'\n ));\n addPrimaryKey('survey_links', array('participant_id','token_id','survey_id'));\n }\n alterColumn('{{survey_links}}','date_created',\"datetime\",true);\n alterColumn('{{saved_control}}','identifier',\"text\",false);\n alterColumn('{{saved_control}}','email',\"string(320)\");\n alterColumn('{{surveys}}','adminemail',\"string(320)\");\n alterColumn('{{surveys}}','bounce_email',\"string(320)\");\n alterColumn('{{users}}','email',\"string(320)\");\n\n try{ setTransactionBookmark(); $oDB->createCommand()->dropIndex('assessments_idx','{{assessments}}');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); $oDB->createCommand()->createIndex('assessments_idx3','{{assessments}}','gid');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n\n try{ setTransactionBookmark(); $oDB->createCommand()->dropIndex('ixcode','{{labels}}');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); $oDB->createCommand()->dropIndex('{{labels_ixcode_idx}}','{{labels}}');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); $oDB->createCommand()->createIndex('labels_code_idx','{{labels}}','code');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n\n\n\n if (Yii::app()->db->driverName=='pgsql')\n {\n try{ setTransactionBookmark(); $oDB->createCommand(\"ALTER TABLE ONLY {{user_groups}} ADD PRIMARY KEY (ugid); \")->execute;} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); $oDB->createCommand(\"ALTER TABLE ONLY {{users}} ADD PRIMARY KEY (uid); \")->execute;} catch(Exception $e) { rollBackToTransactionBookmark(); };\n }\n\n // Additional corrections for MSSQL\n alterColumn('{{answers}}','answer',\"text\",false);\n alterColumn('{{assessments}}','name',\"text\",false);\n alterColumn('{{assessments}}','message',\"text\",false);\n alterColumn('{{defaultvalues}}','defaultvalue',\"text\");\n alterColumn('{{expression_errors}}','eqn',\"text\");\n alterColumn('{{expression_errors}}','prettyprint',\"text\");\n alterColumn('{{groups}}','description',\"text\");\n alterColumn('{{groups}}','grelevance',\"text\");\n alterColumn('{{labels}}','title',\"text\");\n alterColumn('{{question_attributes}}','value',\"text\");\n alterColumn('{{questions}}','preg',\"text\");\n alterColumn('{{questions}}','help',\"text\");\n alterColumn('{{questions}}','relevance',\"text\");\n alterColumn('{{questions}}','question',\"text\",false);\n alterColumn('{{quota_languagesettings}}','quotals_quota_id',\"integer\",false);\n alterColumn('{{quota_languagesettings}}','quotals_message',\"text\",false);\n alterColumn('{{saved_control}}','refurl',\"text\");\n alterColumn('{{saved_control}}','access_code',\"text\",false);\n alterColumn('{{saved_control}}','ip',\"text\",false);\n alterColumn('{{saved_control}}','saved_thisstep',\"text\",false);\n alterColumn('{{saved_control}}','saved_date',\"datetime\",false);\n alterColumn('{{surveys}}','attributedescriptions',\"text\");\n alterColumn('{{surveys}}','emailresponseto',\"text\");\n alterColumn('{{surveys}}','emailnotificationto',\"text\");\n\n alterColumn('{{surveys_languagesettings}}','surveyls_description',\"text\");\n alterColumn('{{surveys_languagesettings}}','surveyls_welcometext',\"text\");\n alterColumn('{{surveys_languagesettings}}','surveyls_email_invite',\"text\");\n alterColumn('{{surveys_languagesettings}}','surveyls_email_remind',\"text\");\n alterColumn('{{surveys_languagesettings}}','surveyls_email_register',\"text\");\n alterColumn('{{surveys_languagesettings}}','surveyls_email_confirm',\"text\");\n alterColumn('{{surveys_languagesettings}}','surveyls_attributecaptions',\"text\");\n alterColumn('{{surveys_languagesettings}}','email_admin_notification',\"text\");\n alterColumn('{{surveys_languagesettings}}','email_admin_responses',\"text\");\n alterColumn('{{surveys_languagesettings}}','surveyls_endtext',\"text\");\n alterColumn('{{user_groups}}','description',\"text\",false);\n\n\n\n alterColumn('{{conditions}}','value','string',false,'');\n alterColumn('{{participant_shares}}','can_edit',\"string(5)\",false);\n\n alterColumn('{{users}}','password',\"binary\",false);\n dropColumn('{{users}}','one_time_pw');\n addColumn('{{users}}','one_time_pw','binary');\n\n\n $oDB->createCommand()->update('{{question_attributes}}',array('value'=>'1'),\"attribute = 'random_order' and value = '2'\");\n\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>157),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 158)\n {\n LimeExpressionManager::UpgradeConditionsToRelevance();\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>158),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 159)\n {\n alterColumn('{{failed_login_attempts}}', 'ip', \"string(40)\",false);\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>159),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 160)\n {\n alterLanguageCode('it','it-informal');\n alterLanguageCode('it-formal','it');\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>160),\"stg_name='DBVersion'\");\n }\n if ($iOldDBVersion < 161)\n {\n addColumn('{{survey_links}}','date_invited','datetime NULL default NULL');\n addColumn('{{survey_links}}','date_completed','datetime NULL default NULL');\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>161),\"stg_name='DBVersion'\");\n }\n if ($iOldDBVersion < 162)\n {\n /* Fix participant db types */\n alterColumn('{{participant_attribute}}', 'value', \"text\", false);\n alterColumn('{{participant_attribute_names_lang}}', 'attribute_name', \"string(255)\", false);\n alterColumn('{{participant_attribute_values}}', 'value', \"text\", false);\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>162),\"stg_name='DBVersion'\");\n }\n if ($iOldDBVersion < 163)\n {\n //Replace by <script type=\"text/javascript\" src=\"{TEMPLATEURL}template.js\"></script> by {TEMPLATEJS}\n\n $replacedTemplate=replaceTemplateJS();\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>163),\"stg_name='DBVersion'\");\n\n }\n\n if ($iOldDBVersion < 164)\n {\n upgradeTokens148(); // this should have bee done in 148 - that's why it is named this way\n // fix survey tables for missing or incorrect token field\n upgradeSurveyTables164();\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>164),\"stg_name='DBVersion'\");\n\n // Not updating settings table as upgrade process takes care of that step now\n }\n\n if ($iOldDBVersion < 165)\n {\n $oDB->createCommand()->createTable('{{plugins}}', array(\n 'id' => 'pk',\n 'name' => 'string NOT NULL',\n 'active' => 'boolean'\n ));\n $oDB->createCommand()->createTable('{{plugin_settings}}', array(\n 'id' => 'pk',\n 'plugin_id' => 'integer NOT NULL',\n 'model' => 'string',\n 'model_id' => 'integer',\n 'key' => 'string',\n 'value' => 'text'\n ));\n alterColumn('{{surveys_languagesettings}}','surveyls_url',\"text\");\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>165),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 166)\n {\n $oDB->createCommand()->renameTable('{{survey_permissions}}', '{{permissions}}');\n dropPrimaryKey('permissions');\n alterColumn('{{permissions}}', 'permission', \"string(100)\", false);\n $oDB->createCommand()->renameColumn('{{permissions}}','sid','entity_id');\n alterColumn('{{permissions}}', 'entity_id', \"string(100)\", false);\n addColumn('{{permissions}}','entity',\"string(50)\");\n $oDB->createCommand(\"update {{permissions}} set entity='survey'\")->query();\n addColumn('{{permissions}}','id','pk');\n $oDB->createCommand()->createIndex('idxPermissions','{{permissions}}','entity_id,entity,permission,uid',true);\n\n upgradePermissions166();\n dropColumn('{{users}}','create_survey');\n dropColumn('{{users}}','create_user');\n dropColumn('{{users}}','delete_user');\n dropColumn('{{users}}','superadmin');\n dropColumn('{{users}}','configurator');\n dropColumn('{{users}}','manage_template');\n dropColumn('{{users}}','manage_label');\n dropColumn('{{users}}','participant_panel');\n $oDB->createCommand()->dropTable('{{templates_rights}}');\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>166),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 167)\n {\n addColumn('{{surveys_languagesettings}}', 'attachments', 'text');\n addColumn('{{users}}', 'created', 'datetime');\n addColumn('{{users}}', 'modified', 'datetime');\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>167),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 168)\n {\n addColumn('{{participants}}', 'created', 'datetime');\n addColumn('{{participants}}', 'modified', 'datetime');\n addColumn('{{participants}}', 'created_by', 'integer');\n $oDB->createCommand('update {{participants}} set created_by=owner_uid')->query();\n alterColumn('{{participants}}', 'created_by', \"integer\", false);\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>168),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 169)\n {\n // Add new column for question index options.\n addColumn('{{surveys}}', 'questionindex', 'integer not null default 0');\n // Set values for existing surveys.\n $oDB->createCommand(\"update {{surveys}} set questionindex = 0 where allowjumps <> 'Y'\")->query();\n $oDB->createCommand(\"update {{surveys}} set questionindex = 1 where allowjumps = 'Y'\")->query();\n\n // Remove old column.\n dropColumn('{{surveys}}', 'allowjumps');\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>169),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 170)\n {\n // renamed advanced attributes fields dropdown_dates_year_min/max\n $oDB->createCommand()->update('{{question_attributes}}',array('attribute'=>'date_min'),\"attribute='dropdown_dates_year_min'\");\n $oDB->createCommand()->update('{{question_attributes}}',array('attribute'=>'date_max'),\"attribute='dropdown_dates_year_max'\");\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>170),\"stg_name='DBVersion'\");\n }\n\n if ($iOldDBVersion < 171)\n {\n try {\n dropColumn('{{sessions}}','data');\n }\n catch (Exception $e) {\n \n }\n switch (Yii::app()->db->driverName){\n case 'mysql':\n case 'mysqli':\n addColumn('{{sessions}}', 'data', 'longbinary');\n break;\n case 'sqlsrv':\n case 'dblib':\n case 'mssql':\n addColumn('{{sessions}}', 'data', 'VARBINARY(MAX)');\n break;\n case 'pgsql':\n addColumn('{{sessions}}', 'data', 'BYTEA');\n break;\n default: die('Unknown database type');\n }\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>171),\"stg_name='DBVersion'\");\n }\n if ($iOldDBVersion < 172)\n {\n switch (Yii::app()->db->driverName){\n case 'pgsql':\n // Special treatment for Postgres as it is too dumb to convert a string to a number without explicit being told to do so ... seriously?\n alterColumn('{{permissions}}', 'entity_id', \"INTEGER USING (entity_id::integer)\", false);\n break;\n case 'sqlsrv':\n case 'dblib':\n case 'mssql':\n try{ setTransactionBookmark(); $oDB->createCommand()->dropIndex('permissions_idx2','{{permissions}}');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n try{ setTransactionBookmark(); $oDB->createCommand()->dropIndex('idxPermissions','{{permissions}}');} catch(Exception $e) { rollBackToTransactionBookmark(); };\n alterColumn('{{permissions}}', 'entity_id', \"INTEGER\", false);\n $oDB->createCommand()->createIndex('permissions_idx2','{{permissions}}','entity_id,entity,permission,uid',true);\n break;\n default:\n alterColumn('{{permissions}}', 'entity_id', \"INTEGER\", false);\n }\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>172),\"stg_name='DBVersion'\");\n }\n if ($iOldDBVersion < 173)\n {\n addColumn('{{participant_attribute_names}}','defaultname',\"string(50) NOT NULL default ''\");\n upgradeCPDBAttributeDefaultNames173();\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>173),\"stg_name='DBVersion'\");\n }\n if ($iOldDBVersion < 174)\n {\n alterColumn('{{participants}}', 'email', \"string(254)\");\n alterColumn('{{saved_control}}', 'email', \"string(254)\");\n alterColumn('{{surveys}}', 'adminemail', \"string(254)\");\n alterColumn('{{surveys}}', 'bounce_email', \"string(254)\");\n switch (Yii::app()->db->driverName){\n case 'sqlsrv':\n case 'dblib':\n case 'mssql': dropUniqueKeyMSSQL('email','{{users}}');\n }\n alterColumn('{{users}}', 'email', \"string(254)\");\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>174),\"stg_name='DBVersion'\");\n }\n if ($iOldDBVersion < 175)\n {\n switch (Yii::app()->db->driverName){\n case 'pgsql':\n // Special treatment for Postgres as it is too dumb to convert a boolean to a number without explicit being told to do so\n alterColumn('{{plugins}}', 'active', \"INTEGER USING (active::integer)\", false);\n break;\n default:\n alterColumn('{{plugins}}', 'active', \"integer\",false,'0');\n }\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>175),\"stg_name='DBVersion'\");\n }\n if ($iOldDBVersion < 176)\n {\n upgradeTokens176();\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>176),\"stg_name='DBVersion'\");\n }\n if ($iOldDBVersion < 177)\n {\n if ( Yii::app()->getConfig('auth_webserver') === true ) {\n // using auth webserver, now activate the plugin with default settings.\n if (!class_exists('Authwebserver', false)) {\n $plugin = Plugin::model()->findByAttributes(array('name'=>'Authwebserver'));\n if (!$plugin) {\n $plugin = new Plugin();\n $plugin->name = 'Authwebserver';\n $plugin->active = 1;\n $plugin->save();\n $plugin = App()->getPluginManager()->loadPlugin('Authwebserver', $plugin->id);\n $aPluginSettings = $plugin->getPluginSettings(true);\n $aDefaultSettings = array();\n foreach ($aPluginSettings as $key => $settings) {\n if (is_array($settings) && array_key_exists('current', $settings) ) {\n $aDefaultSettings[$key] = $settings['current'];\n }\n }\n $plugin->saveSettings($aDefaultSettings);\n } else {\n $plugin->active = 1;\n $plugin->save();\n }\n }\n }\n upgradeSurveys177();\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>177),\"stg_name='DBVersion'\");\n }\n if ($iOldDBVersion < 178)\n {\n if (Yii::app()->db->driverName=='mysql' || Yii::app()->db->driverName=='mysqli')\n {\n modifyPrimaryKey('questions', array('qid','language'));\n }\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>178),\"stg_name='DBVersion'\");\n }\n if ($iOldDBVersion < 179)\n {\n upgradeSurveys177(); // Needs to be run again to make sure\n upgradeTokenTables179();\n alterColumn('{{participants}}', 'email', \"string(254)\", false);\n alterColumn('{{participants}}', 'firstname', \"string(150)\", false);\n alterColumn('{{participants}}', 'lastname', \"string(150)\", false);\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>179),\"stg_name='DBVersion'\");\n }\n if ($iOldDBVersion < 180)\n {\n $aUsers = User::model()->findAll();\n $aPerm = array(\n 'entity_id' => 0,\n 'entity' => 'global',\n 'uid' => 0,\n 'permission' => 'auth_db',\n 'create_p' => 0,\n 'read_p' => 1,\n 'update_p' => 0,\n 'delete_p' => 0,\n 'import_p' => 0,\n 'export_p' => 0\n );\n\n foreach ($aUsers as $oUser)\n {\n if (!Permission::model()->hasGlobalPermission('auth_db','read',$oUser->uid))\n {\n $oPermission = new Permission;\n foreach ($aPerm as $k => $v)\n {\n $oPermission->$k = $v;\n }\n $oPermission->uid = $oUser->uid;\n $oPermission->save();\n }\n }\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>180),\"stg_name='DBVersion'\");\n \n }\n if ($iOldDBVersion < 181)\n {\n upgradeTokenTables181();\n upgradeSurveyTables181();\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>181),\"stg_name='DBVersion'\");\n } \n if ($iOldDBVersion < 182)\n {\n fixKCFinder182();\n $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>182),\"stg_name='DBVersion'\");\n } \n $oTransaction->commit();\n // Activate schema caching\n $oDB->schemaCachingDuration=3600;\n // Load all tables of the application in the schema\n $oDB->schema->getTables();\n // clear the cache of all loaded tables\n $oDB->schema->refresh();\n }\n catch(Exception $e)\n {\n $oTransaction->rollback();\n // Activate schema caching\n $oDB->schemaCachingDuration=3600;\n // Load all tables of the application in the schema\n $oDB->schema->getTables();\n // clear the cache of all loaded tables\n $oDB->schema->refresh();\n echo '<br /><br />'.gT('An non-recoverable error happened during the update. Error details:').\"<p>\".htmlspecialchars($e->getMessage()).'</p><br />';\n return false;\n }\n fixLanguageConsistencyAllSurveys();\n echo '<br /><br />'.sprintf(gT('Database update finished (%s)'),date('Y-m-d H:i:s')).'<br /><br />';\n return true;\n}", "public function __construct(){\n // Conectar no banco de dados\n mysql_connect(DBHOST, DBUSER, DBPASS) or die ('Erro ao conectar no banco: '. mysql_error());\n // Selecionar o banco \n mysql_select_db(DBNAME);\n \n $this->execQuery('SET character_set_connection=utf8');\n $this->execQuery('SET character_set_client=utf8');\n $this->execQuery('SET character_set_results=utf8');\n }", "protected function collate(Table $table, Magic $column)\n {\n // TODO: Beberapa tipe kolom (seperti char, enum, set) belum didukung oleh rakit.\n // saat ini dukungan masih terbatas pada tipe kolom yang berbasis teks.\n if (in_array($column->type, ['string', 'text']) && $column->collate) {\n return ' CHARACTER SET ' . $column->collate;\n }\n }", "private static function getCharsetDefaultCollation($charset)\n {\n $collations = self::getCharsetCollations($charset);\n if (null !== $collations) {\n return $collations[0];\n }\n return null;\n }", "public function set_charset($cs) {\n $this->default_charset = $cs;\n }", "private function __construct()\n {\n try {\n $this->_pdo = new PDO(\"mysql:host=\" . HOST . \";dbname=\" . DB, USER, PASS);\n $this->_pdo->exec(\"set names \" . CHARSET);\n } catch(PDOException $e) {\n die($e->getMessage());\n }\n }", "private function set_charset() {\n\t\t//regresa bool\n\t\t$this->conn->set_charset(\"utf8\");\n\t}", "public function updateAutoEncoding() {}", "protected function check_safe_collation($query)\n {\n }", "function convert_utf8($echo_results = false)\n\t{\n\t\tglobal $db, $dbname, $table_prefix;\n\n\t\t$db->sql_return_on_error(true);\n\n\t\t$sql = \"ALTER DATABASE {$db->sql_escape($dbname)}\n\t\t\tCHARACTER SET utf8\n\t\t\tDEFAULT CHARACTER SET utf8\n\t\t\tCOLLATE utf8_bin\n\t\t\tDEFAULT COLLATE utf8_bin\";\n\t\t$db->sql_query($sql);\n\n\t\t$sql = \"SHOW TABLES\";\n\t\t$result = $db->sql_query($sql);\n\t\twhile ($row = $db->sql_fetchrow($result))\n\t\t{\n\t\t\t// This assignment doesn't work...\n\t\t\t//$table = $row[0];\n\n\t\t\t$current_item = each($row);\n\t\t\t$table = $current_item['value'];\n\t\t\treset($row);\n\n\t\t\t$sql = \"ALTER TABLE {$db->sql_escape($table)}\n\t\t\t\tDEFAULT CHARACTER SET utf8\n\t\t\t\tCOLLATE utf8_bin\";\n\t\t\t$db->sql_query($sql);\n\n\t\t\tif (!empty($echo_results))\n\t\t\t{\n\t\t\t\techo(\"&bull;&nbsp;Table&nbsp;<b style=\\\"color: #dd2222;\\\">$table</b> converted to UTF-8<br />\\n\");\n\t\t\t}\n\n\t\t\t$sql = \"SHOW FIELDS FROM {$db->sql_escape($table)}\";\n\t\t\t$result_fields = $db->sql_query($sql);\n\n\t\t\twhile ($row_fields = $db->sql_fetchrow($result_fields))\n\t\t\t{\n\t\t\t\t// These assignments don't work...\n\t\t\t\t/*\n\t\t\t\t$field_name = $row_fields[0];\n\t\t\t\t$field_type = $row_fields[1];\n\t\t\t\t$field_null = $row_fields[2];\n\t\t\t\t$field_key = $row_fields[3];\n\t\t\t\t$field_default = $row_fields[4];\n\t\t\t\t$field_extra = $row_fields[5];\n\t\t\t\t*/\n\n\t\t\t\t$field_name = $row_fields['Field'];\n\t\t\t\t$field_type = $row_fields['Type'];\n\t\t\t\t$field_null = $row_fields['Null'];\n\t\t\t\t$field_key = $row_fields['Key'];\n\t\t\t\t$field_default = $row_fields['Default'];\n\t\t\t\t$field_extra = $row_fields['Extra'];\n\n\t\t\t\t// Let's remove BLOB and BINARY for now...\n\t\t\t\t//if ((strpos(strtolower($field_type), 'char') !== false) || (strpos(strtolower($field_type), 'text') !== false) || (strpos(strtolower($field_type), 'blob') !== false) || (strpos(strtolower($field_type), 'binary') !== false))\n\t\t\t\tif ((strpos(strtolower($field_type), 'char') !== false) || (strpos(strtolower($field_type), 'text') !== false))\n\t\t\t\t{\n\t\t\t\t\t//$sql_fields = \"ALTER TABLE {$db->sql_escape($table)} CHANGE \" . $db->sql_escape($field_name) . \" \" . $db->sql_escape($field_name) . \" \" . $db->sql_escape($field_type) . \" CHARACTER SET utf8 COLLATE utf8_bin\";\n\n\t\t\t\t\t$sql_fields = \"ALTER TABLE {$db->sql_escape($table)} CHANGE \" . $db->sql_escape($field_name) . \" \" . $db->sql_escape($field_name) . \" \" . $db->sql_escape($field_type) . \" CHARACTER SET utf8 COLLATE utf8_bin \" . (($field_null != 'YES') ? \"NOT \" : \"\") . \"NULL DEFAULT \" . (($field_default != 'None') ? ((!empty($field_default) || !is_null($field_default)) ? (is_string($field_default) ? (\"'\" . $db->sql_escape($field_default) . \"'\") : $field_default) : (($field_null != 'YES') ? \"''\" : \"NULL\")) : \"''\");\n\t\t\t\t\t$db->sql_query($sql_fields);\n\n\t\t\t\t\tif (!empty($echo_results))\n\t\t\t\t\t{\n\t\t\t\t\t\techo(\"\\t&nbsp;&nbsp;&raquo;&nbsp;Field&nbsp;<b style=\\\"color: #4488aa;\\\">$field_name</b> (in table <b style=\\\"color: #009900;\\\">$table</b>) converted to UTF-8<br />\\n\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!empty($echo_results))\n\t\t\t{\n\t\t\t\techo(\"<br />\\n\");\n\t\t\t\tflush();\n\t\t\t}\n\t\t}\n\n\t\t$db->sql_return_on_error(false);\n\t\treturn true;\n\t}", "public function getCollation($table = NULL, $column = NULL) {\n // No table or column provided, then get info about\n // database (if exists) or server defaul collation.\n if (empty($table) && empty($column)) {\n // Database is defaulted from active connection.\n $options = $this->connection->getConnectionOptions();\n $database = $options['database'];\n if (!empty($database)) {\n // Default collation for specific table.\n $sql = \"SELECT CONVERT (varchar, DATABASEPROPERTYEX('$database', 'collation'))\";\n return $this->connection->query_direct($sql)->fetchField();\n }\n else {\n // Server default collation.\n $sql = \"SELECT SERVERPROPERTY ('collation') as collation\";\n return $this->connection->query_direct($sql)->fetchField();\n }\n }\n\n $sql = <<< EOF\n SELECT TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, COLLATION_NAME, DATA_TYPE\n FROM INFORMATION_SCHEMA.COLUMNS\n WHERE TABLE_SCHEMA = ':schema'\n AND TABLE_NAME = ':table'\n AND COLUMN_NAME = ':column'\nEOF;\n $params = [];\n $params[':schema'] = $this->defaultSchema;\n $params[':table'] = $table;\n $params[':column'] = $column;\n $result = $this->connection->query_direct($sql, $params)->fetchObject();\n return $result->COLLATION_NAME;\n }", "public function collateWord($word)\n {\n $trans = array(\n \"ą\" => \"a\",\n \"č\" => \"c\",\n \"ę\" => \"e\",\n \"ė\" => \"e\",\n \"į\" => \"i\",\n \"š\" => \"s\",\n \"ų\" => \"u\",\n \"ū\" => \"u\",\n \"ž\" => \"z\",\n \"Ą\" => \"A\",\n \"Č\" => \"C\",\n \"Ę\" => \"E\",\n \"Ė\" => \"E\",\n \"Į\" => \"I\",\n \"Š\" => \"S\",\n \"Ų\" => \"U\",\n \"Ū\" => \"U\",\n \"Ž\" => \"Z\",\n );\n\n return strtr($word, $trans);\n }", "protected function getCharsetConversion() {}", "function mb_convert_case($sourcestring, $mode, $encoding) {}", "public function testCharset()\n {\n $statement = (new CreateTable($this->mockConnection));\n $return = $statement->charset('utf8');\n $array = $statement->toArray();\n\n $this->assertInstanceOf(CreateTable::class, $return);\n $this->assertEquals([\n 'charset' => 'utf8',\n 'collate' => null,\n ], $array);\n }", "public function fixCharsets() {}", "public function setAsDefault() {\n\t\t// remove default flag from all languages\n\t\t$sql = \"UPDATE\twcf\".WCF_N.\"_language\n\t\t\tSET\tisDefault = ?\";\n\t\t$statement = WCF::getDB()->prepareStatement($sql);\n\t\t$statement->execute(array(\n\t\t\t0\n\t\t));\n\t\t\n\t\t// set current language as default language\n\t\t$this->update(array(\n\t\t\t'isDefault' => 1\n\t\t));\n\t\t\n\t\t$this->clearCache();\n\t}", "public function init_charset()\n {\n }", "private function set_locale() {\n\n if (function_exists('determine_locale')) {\n $locale = determine_locale();\n } else {\n // @todo Remove when start supporting WP 5.0 or later.\n $locale = is_admin() ? get_user_locale() : get_locale();\n }\n $locale = apply_filters('plugin_locale', $locale, 'careerfy-frame');\n \n unload_textdomain('careerfy-frame');\n load_textdomain('careerfy-frame', WP_LANG_DIR . '/plugins/careerfy-frame-' . $locale . '.mo');\n load_plugin_textdomain('careerfy-frame', false, dirname(dirname(plugin_basename(__FILE__))) . '/languages');\n }", "function database_encoding(){\r\n\t$default = \"WIN1252\";\r\n\tif(strlen($_SESSION[\"DATABASE_ENCODING\"]) === 0){\r\n\t\t$file_name = dirname($_SERVER[\"SCRIPT_FILENAME\"]).str_repeat(\"/..\", substr_count($_SERVER[\"SCRIPT_NAME\"], \"/\") - 2).\"/support/config.ini\";\r\n\t\tif(file_exists($file_name)){\r\n\t\t\t$ini = parse_ini_file($file_name);\r\n\t\t\tif(strlen($ini[\"dbenco\"]) > 0){\r\n\t\t\t\t$_SESSION[\"DATABASE_ENCODING\"] = $ini[\"dbenco\"];\r\n\t\t\t}else{\r\n\t\t\t\t$_SESSION[\"DATABASE_ENCODING\"] = $default;\r\n\t\t\t}\r\n\t\t}else{\r\n\t\t\t$_SESSION[\"DATABASE_ENCODING\"] = $default;\r\n\t\t}\r\n\t}\r\n\treturn strtoupper($_SESSION[\"DATABASE_ENCODING\"]);\r\n}", "public function setCharset($charset)\n {\n $charset = strtolower($charset);\n $defaultCollation = self::getCharsetDefaultCollation($charset);\n if (is_null($defaultCollation)) {\n throw new RuntimeException(\"unknown character set '$charset'\");\n }\n if (!is_null($this->charset) &&\n $this->charset !== $charset\n ) {\n throw new RuntimeException(\"Conflicting CHARACTER SET declarations\");\n }\n $this->charset = $charset;\n $this->collation = $defaultCollation;\n }", "public function __construct()\n {\n $this->charset = strtoupper('UTF-8');\n }", "protected function initDB() {\n $db = $this->settings['db'];\n $this->mysqli = new \\mysqli($db['host'], $db['user'], $db['pass'], $db['dbname']);\n $this->mysqli->query(\"SET NAMES 'utf8'\");\n }", "public function convCharset(array $data): array\n {\n $dbCharset = 'utf-8';\n if ($dbCharset != $this->indata['charset']) {\n $converter = GeneralUtility::makeInstance(CharsetConverter::class);\n foreach ($data as $k => $v) {\n $data[$k] = $converter->conv($v, strtolower($this->indata['charset']), $dbCharset);\n }\n }\n return $data;\n }", "function setCharset ($a_charset,$a_overwrite = false)\n\t{\n\t\tif (is_integer($this->doc->charset) or ($a_overwrite)) {\n\t\t\t$this->doc->charset = $a_charset;\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\treturn false;\n\t}", "protected static function resolveDefaultEncoding() {}", "function set_encoding($encoding=\"\")\r\n {\r\n if(\"\" == $encoding)\r\n $encoding = $this->encoding;\r\n $sql = \"SET SESSION character_set_database = \" . $encoding; //'character_set_database' MySQL server variable is [also] to parse file with rigth encoding\r\n $res = @mysql_query($sql);\r\n return mysql_error();\r\n }", "public function change()\n {\n $table = $this->table('languages');\n $table->addColumn('is_rtl', 'boolean', [\n 'default' => false,\n 'null' => false,\n ]);\n $table->addColumn('trashed', 'datetime', [\n 'default' => null,\n 'null' => true,\n ]);\n $table->changeColumn('is_active', 'boolean', [\n 'default' => true,\n 'null' => false,\n ]);\n $table->renameColumn('short_code', 'code');\n $table->removeColumn('description');\n $table->update();\n }", "public function up(Schema $schema) : void\n {\n $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \\'mysql\\'.');\n\n $sql = \"CREATE FUNCTION `remove_accents`(`str` TEXT)\"\n .\" RETURNS text\"\n .\" LANGUAGE SQL\"\n .\" DETERMINISTIC\"\n .\" NO SQL\"\n .\" SQL SECURITY INVOKER\"\n .\" COMMENT ''\"\n .\" BEGIN\"\n .\"\"\n .\" SET str = REPLACE(str,'Š','S');\"\n .\" SET str = REPLACE(str,'š','s');\"\n .\" SET str = REPLACE(str,'Ð','Dj');\"\n .\" SET str = REPLACE(str,'Ž','Z');\"\n .\" SET str = REPLACE(str,'ž','z');\"\n .\" SET str = REPLACE(str,'À','A');\"\n .\" SET str = REPLACE(str,'Á','A');\"\n .\" SET str = REPLACE(str,'Â','A');\"\n .\" SET str = REPLACE(str,'Ã','A');\"\n .\" SET str = REPLACE(str,'Ä','A');\"\n .\" SET str = REPLACE(str,'Å','A');\"\n .\" SET str = REPLACE(str,'Æ','A');\"\n .\" SET str = REPLACE(str,'Ç','C');\"\n .\" SET str = REPLACE(str,'È','E');\"\n .\" SET str = REPLACE(str,'É','E');\"\n .\" SET str = REPLACE(str,'Ê','E');\"\n .\" SET str = REPLACE(str,'Ë','E');\"\n .\" SET str = REPLACE(str,'Ì','I');\"\n .\" SET str = REPLACE(str,'Í','I');\"\n .\" SET str = REPLACE(str,'Î','I');\"\n .\" SET str = REPLACE(str,'Ï','I');\"\n .\" SET str = REPLACE(str,'Ñ','N');\"\n .\" SET str = REPLACE(str,'Ò','O');\"\n .\" SET str = REPLACE(str,'Ó','O');\"\n .\" SET str = REPLACE(str,'Ô','O');\"\n .\" SET str = REPLACE(str,'Õ','O');\"\n .\" SET str = REPLACE(str,'Ö','O');\"\n .\" SET str = REPLACE(str,'Ø','O');\"\n .\" SET str = REPLACE(str,'Ù','U');\"\n .\" SET str = REPLACE(str,'Ú','U');\"\n .\" SET str = REPLACE(str,'Û','U');\"\n .\" SET str = REPLACE(str,'Ü','U');\"\n .\" SET str = REPLACE(str,'Ý','Y');\"\n .\" SET str = REPLACE(str,'Þ','B');\"\n .\" SET str = REPLACE(str,'ß','Ss');\"\n .\" SET str = REPLACE(str,'à','a');\"\n .\" SET str = REPLACE(str,'á','a');\"\n .\" SET str = REPLACE(str,'â','a');\"\n .\" SET str = REPLACE(str,'ã','a');\"\n .\" SET str = REPLACE(str,'ä','a');\"\n .\" SET str = REPLACE(str,'å','a');\"\n .\" SET str = REPLACE(str,'æ','a');\"\n .\" SET str = REPLACE(str,'ç','c');\"\n .\" SET str = REPLACE(str,'è','e');\"\n .\" SET str = REPLACE(str,'é','e');\"\n .\" SET str = REPLACE(str,'ê','e');\"\n .\" SET str = REPLACE(str,'ë','e');\"\n .\" SET str = REPLACE(str,'ì','i');\"\n .\" SET str = REPLACE(str,'í','i');\"\n .\" SET str = REPLACE(str,'î','i');\"\n .\" SET str = REPLACE(str,'ï','i');\"\n .\" SET str = REPLACE(str,'ð','o');\"\n .\" SET str = REPLACE(str,'ñ','n');\"\n .\" SET str = REPLACE(str,'ò','o');\"\n .\" SET str = REPLACE(str,'ó','o');\"\n .\" SET str = REPLACE(str,'ô','o');\"\n .\" SET str = REPLACE(str,'õ','o');\"\n .\" SET str = REPLACE(str,'ö','o');\"\n .\" SET str = REPLACE(str,'ø','o');\"\n .\" SET str = REPLACE(str,'ù','u');\"\n .\" SET str = REPLACE(str,'ú','u');\"\n .\" SET str = REPLACE(str,'û','u');\"\n .\" SET str = REPLACE(str,'ý','y');\"\n .\" SET str = REPLACE(str,'ý','y');\"\n .\" SET str = REPLACE(str,'þ','b');\"\n .\" SET str = REPLACE(str,'ÿ','y');\"\n .\" SET str = REPLACE(str,'ƒ','f');\"\n .\" RETURN str;\"\n .\" END\"\n ;\n \n $this->addSql($sql);\n }", "function setCharsetHandler($method = \"none\", $php, $sql) {\n\t\t$this->_charsetMethod = $method;\n\t\t$this->_charsetPhp = $php;\n\t\t$this->_charsetSql = $sql;\n\t}", "function setEncoding($enc) {\n\t\treturn $this->_execute('SET NAMES ' . $enc) != false;\n\t}", "public function setCharset($charset)\n {\n $this->charset = strtoupper($charset);\n }", "function alt_name($db_name)\n{\n switch ($db_name) {\n case\"c_america\":\n $db_name = \"General Central America\";\n break;\n default:\n $db_name = str_replace(\"_\", \" \", $db_name);\n }\n return $db_name;\n}", "public function __construct() {\r\n\t\t\tparent::__construct(\"localhost\", \"user\", \"password\", \"dbname\", 3306, \"/var/run/mysqld/mysqld.sock\");\r\n\t\t\t$this->set_charset(\"utf8\");\r\n\t\t}", "function _wpsc_db_upgrade_11() {\n\t_wpsc_fix_united_kingdom();\n\t_wpsc_set_legacy_country_meta();\n}", "function DBM ( $cDBConnStr=null, $cEncoding=null )\n{\n if ( is_string($cEncoding) ) $this->_Encoding = $cEncoding;\n if ( is_string($cDBConnStr) ) $this->connectDB($cDBConnStr);\n}", "public function setCharset($charset) {\n\t\tif($charset == self::CHARSET_ISO){\n\t\t\t$this->charset = self::CHARSET_ISO;\n\t\t} else {\n\t\t\t$this->charset = self::CHARSET_UTF;\n\t\t}\n\t}", "public function setConnectionOverride(\\codename\\core\\database $db) {\r\n $this->db = $db;\r\n }", "public function getTableCharsetAndCollation($table, $options = array()) {\n $sql = 'SELECT CCSA.character_set_name AS charset, CCSA.collation_name AS collation\n FROM information_schema.`TABLES` T, information_schema.`COLLATION_CHARACTER_SET_APPLICABILITY` CCSA\n WHERE CCSA.collation_name = T.table_collation\n AND T.table_schema = \\''. $this->_dbName .'\\' AND T.table_name = \\''. $table .'\\'';\n\n return $this->selectOne($sql, $options);\n }", "public function setConnectionCharset($connectionCharset = 'utf8')\n {\n $this->disconnectIfConnected();\n $this->connectionCharset = $connectionCharset;\n }", "public function SetCharacterSetName($argCharacterSetName)\r\n {\r\n $this->checkDatabaseManager();\r\n return $this->_DatabaseHandler->set_charset($argCharacterSetName);\r\n }", "#[Pure]\n public static function mbConvertCase(string $string, int $mode, ?string $encoding): string\n {\n return mb_convert_case($string, $mode, $encoding);\n }", "public function restore_previous_locale()\n {\n }", "private function initDB(){\n $sql = \"\n CREATE SCHEMA IF NOT EXISTS `\".$this->_database.\"` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ;\n USE `\".$this->_database.\"` ;\n \";\n try {\n $dbh = new PDO(\"mysql:host=$this->_host\", $this->_username, $this->_password,array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));\n $dbh->exec($sql)\n or die(print_r($dbh->errorInfo(), true));\n } catch (PDOException $e) {\n $err_data = array('stmt'=>'on init');\n Helper_Error::setError( Helper_Error::ERROR_TYPE_DB , $e->getMessage() , $err_data , $e->getCode() );\n die(\"DB init ERROR: \". $e->getMessage());\n }\n }", "function setEncoding($enc) {\n\t\tif (!in_array($enc, array(\"UTF-8\", \"UTF-16\", \"UTF-16le\", \"UTF-16be\"))) {\n\t\t\treturn false;\n\t\t}\n\t\treturn $this->_execute(\"PRAGMA encoding = \\\"{$enc}\\\"\") !== false;\n\t}", "function setDoXmlUtf8Encoding($value)\n {\n $this->_props['DoXmlUtf8Encoding'] = $value;\n }", "function downcase(){\n\t\treturn $this->_copy(Translate::Lower($this->toString(),$this->getEncoding()));\n\t}", "public static function getCurrentCharset() {}", "public function getCharset()\n {\n return $this->_db->getOption('charset');\n }", "public function setDefaultCwd() {\n $connConf = $this->getConnectionModel();\n $dn = $connConf->getBaseDN();\n if(!$dn) // no BaseDN given, guess the Base dir\n $dn = $this->helper->suggestBaseDNFromName($connConf->getBindDN());\n $this->setBaseDN($dn);\n $this->setCwd($dn);\n }", "public function restore_current_locale()\n {\n }", "public static function setup_db()\r\n {\r\n $installed_ver = get_option( CART_CONVERTER . \"_db_version\" );\r\n\r\n // prevent create table when re-active plugin\r\n if ( $installed_ver != CART_CONVERTER_DB_VERSION ) {\r\n CartModel::setup_db();\r\n EmailModel::setup_db();\r\n //MailTemplateModel::setup_db();\r\n \r\n add_option( CART_CONVERTER . \"_db_version\", CART_CONVERTER_DB_VERSION );\r\n }\r\n }" ]
[ "0.7151892", "0.650667", "0.6472632", "0.6377463", "0.62235487", "0.6222845", "0.6212017", "0.61897814", "0.61086476", "0.6026438", "0.5995577", "0.59861034", "0.5937779", "0.56593704", "0.5590652", "0.5557284", "0.55048525", "0.5492732", "0.5492732", "0.54765594", "0.5465356", "0.54519373", "0.5451702", "0.542365", "0.54205513", "0.54092366", "0.5359347", "0.52089655", "0.51899666", "0.5178149", "0.5102489", "0.5052022", "0.49800688", "0.49326277", "0.492956", "0.49229535", "0.4873972", "0.48707774", "0.48582423", "0.4807516", "0.4782024", "0.4768368", "0.4760641", "0.4748569", "0.47207683", "0.47078598", "0.47060665", "0.46949783", "0.46756917", "0.4592143", "0.45918426", "0.45516372", "0.45490852", "0.4544465", "0.4543614", "0.45367622", "0.4520627", "0.44804522", "0.44522455", "0.43925503", "0.43920043", "0.43818286", "0.4379919", "0.43701997", "0.43655175", "0.43625423", "0.4347402", "0.43460137", "0.43378425", "0.43331385", "0.4332855", "0.43309656", "0.43284336", "0.4312142", "0.4301175", "0.42947724", "0.4290933", "0.42697576", "0.42587158", "0.4255355", "0.42522526", "0.42305118", "0.42290002", "0.42246342", "0.42236575", "0.4213973", "0.42066935", "0.41833234", "0.4178508", "0.41771516", "0.41647342", "0.4157916", "0.4153239", "0.4151574", "0.41502655", "0.41482794", "0.41466424", "0.41454208", "0.41444644", "0.41437006" ]
0.713068
1
Changes the collation of a table and its text columns
private function changeTableCollation($tableName, $newCollation, $changeColumns = true) { $db = $this->container->db; $collationParts = explode('_', $newCollation); $charset = $collationParts[0]; // Change the collation of the table itself. $this->query(sprintf( "ALTER TABLE %s CONVERT TO CHARACTER SET %s COLLATE %s", $db->qn($tableName), $charset, $newCollation )); // Are we told not to bother with text columns? if (!$changeColumns) { return; } // Convert each text column try { $columns = $db->getTableColumns($tableName, false); } catch (RuntimeException $e) { $columns = []; } // The table is broken or MySQL cannot report any columns for it. Early return. if (!is_array($columns) || empty($columns)) { return; } $modifyColumns = []; foreach ($columns as $col) { // Make sure we are redefining only columns which do support a collation if (empty($col->Collation)) { continue; } $modifyColumns[] = sprintf("MODIFY COLUMN %s %s %s %s COLLATE %s", $db->qn($col->Field), $col->Type, (strtoupper($col->Null) == 'YES') ? 'NULL' : 'NOT NULL', is_null($col->Default) ? '' : sprintf('DEFAULT %s', $db->q($col->Default)), $newCollation ); } // No text columns to modify? Return immediately. if (empty($modifyColumns)) { return; } // Issue an ALTER TABLE statement which modifies all text columns. $this->query(sprintf( 'ALTER TABLE %s %s', $db->qn($tableName), implode(', ', $modifyColumns ))); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function myPear_set_collation(){\n $needed = False;\n if (!$needed) return;\n $c_set = 'utf8';\n $d_col = 'utf8_unicode_ci';\n myPear_db()->qquery(\"ALTER SCHEMA \".myPear_db()->Database.\" DEFAULT CHARACTER SET $c_set DEFAULT COLLATE $d_col\",True);\n foreach(myPear_db()->getTables() as $table){\n b_debug::xxx($table.\"------------------------------------------------\");\n myPear_db()->qquery(\"ALTER TABLE $table CONVERT TO CHARACTER SET $c_set COLLATE $d_col\",True);\n $q = myPear_db()->qquery(\"SHOW COLUMNS FROM $table\",cnf_dev);\n while($r = $this->next_record($q)){\n if (preg_match('/(char|text)/i',strToLower($r['Type']))){\n\tb_debug::xxx($r['Field']);\n\tmyPear_db()->qquery(sprintf(\"ALTER TABLE `%s` CHANGE `%s` `%s` %s CHARACTER SET $c_set COLLATE $d_col %s NULL\",\n\t\t\t\t $r['Field'],$r['Field'],$r['Type'],(strToLower($r['Null']) == 'yes' ? '' : 'NOT')),\n\t\t\t True);\n\t\n }\n }\n }\n}", "function db_change_charset_for_tables($charset = 'utf8', $collate='utf8_general_ci', $data = true){ \n \n if(!trim($charset) || !trim($collate)){\n echo 'No charset selected';\n return;\n }\n \n $CI = &get_instance();\n $query_show_tables = 'SELECT table_name FROM information_schema.tables WHERE table_schema = DATABASE()';//'SHOW TABLES';\n $query_col_collation = 'SHOW FULL COLUMNS FROM %s';\n $tables = $CI->db->query($query_show_tables)->result();\n if(!empty($tables)){\n $CI->db->query(sprintf('SET foreign_key_checks = 0'));\n foreach($tables as $table){\n $table = (array) $table;\n if( isset($table['table_name']) && trim($table['table_name'])){\n $query_collation_generated = sprintf($query_col_collation, $table['table_name']);\n $result_before = $CI->db->query($query_collation_generated)->result();\n db_show_table_column_collations($result_before, $table['table_name']);\n $CI->db->query(sprintf('ALTER TABLE %s CONVERT TO CHARACTER SET '.$charset.' COLLATE '.$collate, $table['table_name']));\n $result_after = $CI->db->query($query_collation_generated)->result();\n db_show_table_column_collations($result_after, $table['table_name'], true);\n }\n }\n $CI->db->query(sprintf('SET foreign_key_checks = 1'));\n }\n \n}", "public function convertTableCharsetAndCollation($table, $options = array()) {\n // mysql - postgresql\n $sql = 'ALTER TABLE `'. $table .'`\n CONVERT TO CHARACTER SET '. db::CHARSET .'\n COLLATE '. db::COLLATION;\n\n return $this->execute($sql, $options);\n }", "public function setCollate($collate)\n\t{\n\t\t$this->collate = $collate;\n\t}", "public function alterCharset($table, $charset = 'utf8', $collation = 'utf8_unicode_ci', $execute = true) {\r\n\t\t$sql = 'ALTER TABLE ' . $table . ' MODIFY' . \"\\n\";\r\n\t\t$sql .= 'CHARACTER SET ' . $charset;\r\n\t\t$sql .= 'COLLATE ' . $collation;\r\n\t\tif ($execute) {\r\n\t\t\t$this->exec($sql);\r\n\t\t}\r\n\t\treturn $sql;\r\n\t}", "private function getCharsetCollate() {\n global $wpdb;\n $this->charsetCollate = $wpdb->get_charset_collate();\n }", "public function testCollation()\n {\n $statement = (new CreateTable($this->mockConnection));\n $return = $statement->charset(null, 'utf8_ci');\n $array = $statement->toArray();\n\n $this->assertInstanceOf(CreateTable::class, $return);\n $this->assertEquals([\n 'charset' => null,\n 'collate' => 'utf8_ci',\n ], $array);\n }", "public function setBinaryCollation()\n {\n $this->isBinaryCollation = true;\n }", "public function get_charset_collate()\n {\n }", "abstract protected function setCharset($charset, $collation);", "private function charset()\n\t{\n\t\tif (isset($this->_conf['charset']) AND $this->_conf['charset'] != '')\n\t\t{\n\t\t\tif (isset($this->_conf['collation']) AND $this->_conf['collation'] != '')\n\t\t\t{\n\t\t\t\t$this->_con->exec('SET NAMES '.$this->_conf['charset'].' COLLATE '.$this->_conf['collation']);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->_con->exec('SET NAMES '.$this->_conf['charset']);\n\t\t\t}\n\t\t}\n\t}", "public function supports_collation()\n {\n }", "protected function collate(Table $table, Magic $column)\n {\n // TODO: Beberapa tipe kolom (seperti char, enum, set) belum didukung oleh rakit.\n // saat ini dukungan masih terbatas pada tipe kolom yang berbasis teks.\n if (in_array($column->type, ['string', 'text']) && $column->collate) {\n return ' CHARACTER SET ' . $column->collate;\n }\n }", "function set_content_columns($table_name) {\n\t\t\t$this->content_columns = $this->content_columns_all = self::$db->table_info($table_name);\n\t\t\t$table_name_i18n = $table_name.$this->i18n_table_suffix;\n\n\t\t\tif($this->is_i18n && self::$db->table_exists($table_name_i18n)) {\n\t\t\t\t$reserved_columns = $this->i18n_reserved_columns;\n\t\t\t\t$this->content_columns_i18n = $i18n_columns = self::$db->table_info($table_name_i18n);\n\t\t\t\t$this->content_columns_all = array_merge($this->content_columns, $i18n_columns);\n\n\t\t\t\tforeach($i18n_columns as $key => $col) {\n\t\t\t\t\tif(in_array($col['name'], $reserved_columns)) {\n\t\t\t\t\t\tunset($i18n_columns[$key]);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$this->i18n_column_names[] = $col['name'];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$this->i18n_table = $table_name_i18n;\n\t\t\t} else {\n\t\t\t\t$this->is_i18n = false;\n\t\t\t}\n\t\t}", "protected function getTableCollation(Connection $connection, $table, &$definition) {\n // Remove identifier quotes from the table name. See\n // \\Drupal\\mysql\\Driver\\Database\\mysql\\Connection::$identifierQuotes.\n $table = trim($connection->prefixTables('{' . $table . '}'), '\"');\n $query = $connection->query(\"SHOW TABLE STATUS WHERE NAME = :table_name\", [':table_name' => $table]);\n $data = $query->fetchAssoc();\n\n // Map the collation to a character set. For example, 'utf8mb4_general_ci'\n // (MySQL 5) or 'utf8mb4_0900_ai_ci' (MySQL 8) will be mapped to 'utf8mb4'.\n [$charset] = explode('_', $data['Collation'], 2);\n\n // Set `mysql_character_set`. This will be ignored by other backends.\n $definition['mysql_character_set'] = $charset;\n }", "private function changeDatabaseCollation($newCollation)\n\t{\n\t\t$db = $this->container->db;\n\t\t$collationParts = explode('_', $newCollation);\n\t\t$charset = $collationParts[0];\n\t\t$dbName = $this->container->platform->getConfig()->get('db');\n\n\t\t$this->query(sprintf(\n\t\t\t\"ALTER DATABASE %s CHARACTER SET = %s COLLATE = %s\",\n\t\t\t$db->qn($dbName),\n\t\t\t$charset,\n\t\t\t$newCollation\n\t\t));\n\t}", "public function changeCollation($newCollation = 'utf8_general_ci')\n\t{\n\t\t// Make sure we have at least MySQL 4.1.2\n\t\t$db = $this->container->db;\n\t\t$old_collation = $db->getCollation();\n\n\t\tif ($old_collation == 'N/A (mySQL < 4.1.2)')\n\t\t{\n\t\t\t// We can't change the collation on MySQL versions earlier than 4.1.2\n\t\t\treturn false;\n\t\t}\n\n\t\t// Change the collation of the database itself\n\t\t$this->changeDatabaseCollation($newCollation);\n\n\t\t// Change the collation of each table\n\t\t$tables = $db->getTableList();\n\n\t\t// No tables to convert...?\n\t\tif (empty($tables))\n\t\t{\n\t\t\treturn true;\n\t\t}\n\n\t\tforeach ($tables as $tableName)\n\t\t{\n\t\t\t$this->changeTableCollation($tableName, $newCollation);\n\t\t}\n\n\t\treturn true;\n\t}", "public function setDatabaseCharsetAndCollation($options = array()) {\n $sql = 'ALTER DATABASE `'. $this->_dbName .'`\n CHARACTER SET '. db::CHARSET .'\n COLLATE '. db::COLLATION;\n\n return $this->execute($sql, $options);\n }", "public function getCollation()\n\t{\n\t\treturn false;\n\t}", "private function _convertContentToUTF($prefix, $table)\n {\n\n try {\n $query = 'SET NAMES latin1';\n $this->_db->getConnection()->exec($query);\n\n }catch (\\Exception $e) {\n Analog::log(\n 'Cannot SET NAMES on table `' . $table . '`. ' .\n $e->getMessage(),\n Analog::ERROR\n );\n }\n\n try {\n $select = new \\Zend_Db_Select($this->_db);\n $select->from($table);\n\n $result = $select->query();\n\n $descr = $this->_db->describeTable($table);\n\n $pkeys = array();\n foreach ( $descr as $field ) {\n if ( $field['PRIMARY'] == 1 ) {\n $pos = $field['PRIMARY_POSITION'];\n $pkeys[$pos] = $field['COLUMN_NAME'];\n }\n }\n\n if ( count($pkeys) == 0 ) {\n //no primary key! How to do an update without that?\n //Prior to 0.7, l10n and dynamic_fields tables does not\n //contains any primary key. Since encoding conversion is done\n //_before_ the SQL upgrade, we'll have to manually\n //check these ones\n if (preg_match('/' . $prefix . 'dynamic_fields/', $table) !== 0 ) {\n $pkeys = array(\n 'item_id',\n 'field_id',\n 'field_form',\n 'val_index'\n );\n } else if ( preg_match('/' . $prefix . 'l10n/', $table) !== 0 ) {\n $pkeys = array(\n 'text_orig',\n 'text_locale'\n );\n } else {\n //not a know case, we do not perform any update.\n throw new \\Exception(\n 'Cannot define primary key for table `' . $table .\n '`, aborting'\n );\n }\n }\n\n $r = $result->fetchAll();\n foreach ( $r as $row ) {\n $data = array();\n $where = array();\n\n //build where\n foreach ( $pkeys as $k ) {\n $where[] = $k . ' = ' . $this->_db->quote($row->$k);\n }\n\n //build data\n foreach ( $row as $key => $value ) {\n $data[$key] = $value;\n }\n\n //finally, update data!\n $this->_db->update(\n $table,\n $data,\n $where\n );\n }\n } catch (\\Exception $e) {\n Analog::log(\n 'An error occured while converting contents to UTF-8 for table ' .\n $table . ' (' . $e->getMessage() . ')',\n Analog::ERROR\n );\n }\n }", "public function getDbCollation()\r\n {\r\n return $this->db_collation;\r\n }", "abstract protected function encodingTables();", "public function setCollation($var)\n {\n GPBUtil::checkString($var, True);\n $this->collation = $var;\n\n return $this;\n }", "public function set_charset($dbh, $charset = \\null, $collate = \\null)\n {\n }", "public function getCollation()\n\t{\n\t\treturn $this->charset;\n\t}", "public function getCollation()\n {\n return $this->collation;\n }", "public function getCollation()\n {\n return $this->collation;\n }", "public function setCollation($v)\n {\n if ($v !== null) {\n $v = (string) $v;\n }\n\n if ($this->collation !== $v) {\n $this->collation = $v;\n $this->modifiedColumns[BiblioTableMap::COL_COLLATION] = true;\n }\n\n return $this;\n }", "function convert_utf8($echo_results = false)\n\t{\n\t\tglobal $db, $dbname, $table_prefix;\n\n\t\t$db->sql_return_on_error(true);\n\n\t\t$sql = \"ALTER DATABASE {$db->sql_escape($dbname)}\n\t\t\tCHARACTER SET utf8\n\t\t\tDEFAULT CHARACTER SET utf8\n\t\t\tCOLLATE utf8_bin\n\t\t\tDEFAULT COLLATE utf8_bin\";\n\t\t$db->sql_query($sql);\n\n\t\t$sql = \"SHOW TABLES\";\n\t\t$result = $db->sql_query($sql);\n\t\twhile ($row = $db->sql_fetchrow($result))\n\t\t{\n\t\t\t// This assignment doesn't work...\n\t\t\t//$table = $row[0];\n\n\t\t\t$current_item = each($row);\n\t\t\t$table = $current_item['value'];\n\t\t\treset($row);\n\n\t\t\t$sql = \"ALTER TABLE {$db->sql_escape($table)}\n\t\t\t\tDEFAULT CHARACTER SET utf8\n\t\t\t\tCOLLATE utf8_bin\";\n\t\t\t$db->sql_query($sql);\n\n\t\t\tif (!empty($echo_results))\n\t\t\t{\n\t\t\t\techo(\"&bull;&nbsp;Table&nbsp;<b style=\\\"color: #dd2222;\\\">$table</b> converted to UTF-8<br />\\n\");\n\t\t\t}\n\n\t\t\t$sql = \"SHOW FIELDS FROM {$db->sql_escape($table)}\";\n\t\t\t$result_fields = $db->sql_query($sql);\n\n\t\t\twhile ($row_fields = $db->sql_fetchrow($result_fields))\n\t\t\t{\n\t\t\t\t// These assignments don't work...\n\t\t\t\t/*\n\t\t\t\t$field_name = $row_fields[0];\n\t\t\t\t$field_type = $row_fields[1];\n\t\t\t\t$field_null = $row_fields[2];\n\t\t\t\t$field_key = $row_fields[3];\n\t\t\t\t$field_default = $row_fields[4];\n\t\t\t\t$field_extra = $row_fields[5];\n\t\t\t\t*/\n\n\t\t\t\t$field_name = $row_fields['Field'];\n\t\t\t\t$field_type = $row_fields['Type'];\n\t\t\t\t$field_null = $row_fields['Null'];\n\t\t\t\t$field_key = $row_fields['Key'];\n\t\t\t\t$field_default = $row_fields['Default'];\n\t\t\t\t$field_extra = $row_fields['Extra'];\n\n\t\t\t\t// Let's remove BLOB and BINARY for now...\n\t\t\t\t//if ((strpos(strtolower($field_type), 'char') !== false) || (strpos(strtolower($field_type), 'text') !== false) || (strpos(strtolower($field_type), 'blob') !== false) || (strpos(strtolower($field_type), 'binary') !== false))\n\t\t\t\tif ((strpos(strtolower($field_type), 'char') !== false) || (strpos(strtolower($field_type), 'text') !== false))\n\t\t\t\t{\n\t\t\t\t\t//$sql_fields = \"ALTER TABLE {$db->sql_escape($table)} CHANGE \" . $db->sql_escape($field_name) . \" \" . $db->sql_escape($field_name) . \" \" . $db->sql_escape($field_type) . \" CHARACTER SET utf8 COLLATE utf8_bin\";\n\n\t\t\t\t\t$sql_fields = \"ALTER TABLE {$db->sql_escape($table)} CHANGE \" . $db->sql_escape($field_name) . \" \" . $db->sql_escape($field_name) . \" \" . $db->sql_escape($field_type) . \" CHARACTER SET utf8 COLLATE utf8_bin \" . (($field_null != 'YES') ? \"NOT \" : \"\") . \"NULL DEFAULT \" . (($field_default != 'None') ? ((!empty($field_default) || !is_null($field_default)) ? (is_string($field_default) ? (\"'\" . $db->sql_escape($field_default) . \"'\") : $field_default) : (($field_null != 'YES') ? \"''\" : \"NULL\")) : \"''\");\n\t\t\t\t\t$db->sql_query($sql_fields);\n\n\t\t\t\t\tif (!empty($echo_results))\n\t\t\t\t\t{\n\t\t\t\t\t\techo(\"\\t&nbsp;&nbsp;&raquo;&nbsp;Field&nbsp;<b style=\\\"color: #4488aa;\\\">$field_name</b> (in table <b style=\\\"color: #009900;\\\">$table</b>) converted to UTF-8<br />\\n\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!empty($echo_results))\n\t\t\t{\n\t\t\t\techo(\"<br />\\n\");\n\t\t\t\tflush();\n\t\t\t}\n\t\t}\n\n\t\t$db->sql_return_on_error(false);\n\t\treturn true;\n\t}", "public function modifyTable() {\n $table = $this->getTable();\n\n $table->addColumn([\n 'name' => $this->getParameter('table_column'),\n 'type' => 'VARCHAR'\n ]);\n }", "public function change()\n {\n $table = $this->table('languages');\n $table->addColumn('is_rtl', 'boolean', [\n 'default' => false,\n 'null' => false,\n ]);\n $table->addColumn('trashed', 'datetime', [\n 'default' => null,\n 'null' => true,\n ]);\n $table->changeColumn('is_active', 'boolean', [\n 'default' => true,\n 'null' => false,\n ]);\n $table->renameColumn('short_code', 'code');\n $table->removeColumn('description');\n $table->update();\n }", "public function applyTcaForPreRegisteredTables() {}", "public function getCollation()\n {\n return $this->options->collation;\n }", "public function updateTables()\n {\n $prefix = $this->getPrefix();\n $charset = $this->wpdb->get_charset_collate();\n\n foreach ($this->config['tables'] as $table => $createStatement) {\n $sql = str_replace(\n ['{prefix}', '{charset}'],\n [$prefix, $charset],\n $createStatement\n );\n dbDelta($sql);\n }\n }", "protected function process_field_charsets($data, $table)\n {\n }", "function maybe_convert_table_to_utf8mb4($table)\n {\n }", "public function getCollationConnection()\r\n {\r\n return $this->collation_connection;\r\n }", "final public function setUTF() {\n mysqli_query($this->resourceId,\"SET NAMES 'utf8'\");\n }", "private function changeCarrierConfigurationValueColumnTypeToText(): void\n {\n $carrierConfigurationTable = Table::withPrefix(Table::TABLE_CARRIER_CONFIGURATION);\n $query = \"ALTER TABLE $carrierConfigurationTable MODIFY value TEXT;\";\n\n $this->db->execute($query);\n }", "abstract protected function encodingTablesOrder();", "public static function setCharsetEncoding () {\r\n\t\tif ( self::$instance == null ) {\r\n\t\t\tself::getInstance ();\r\n\t\t}\r\n\t\tself::$instance->exec (\r\n\t\t\t\"SET NAMES 'utf8';\r\n\t\t\tSET character_set_connection=utf8;\r\n\t\t\tSET character_set_client=utf8;\r\n\t\t\tSET character_set_results=utf8\" );\r\n\t}", "function alterSchema($compare, $table = null) {\n\t\tif (!is_array($compare)) {\n\t\t\treturn false;\n\t\t}\n\t\t$out = '';\n\t\t$colList = array();\n\t\tforeach ($compare as $curTable => $types) {\n\t\t\t$indexes = $tableParameters = $colList = array();\n\t\t\tif (!$table || $table == $curTable) {\n\t\t\t\t$out .= 'ALTER TABLE ' . $this->fullTableName($curTable) . \" \\n\";\n\t\t\t\tforeach ($types as $type => $column) {\n\t\t\t\t\tif (isset($column['indexes'])) {\n\t\t\t\t\t\t$indexes[$type] = $column['indexes'];\n\t\t\t\t\t\tunset($column['indexes']);\n\t\t\t\t\t}\n\t\t\t\t\tif (isset($column['tableParameters'])) {\n\t\t\t\t\t\t$tableParameters[$type] = $column['tableParameters'];\n\t\t\t\t\t\tunset($column['tableParameters']);\n\t\t\t\t\t}\n\t\t\t\t\tswitch ($type) {\n\t\t\t\t\t\tcase 'add':\n\t\t\t\t\t\t\tforeach ($column as $field => $col) {\n\t\t\t\t\t\t\t\t$col['name'] = $field;\n\t\t\t\t\t\t\t\t$alter = 'ADD ' . $this->buildColumn($col);\n\t\t\t\t\t\t\t\tif (isset($col['after'])) {\n\t\t\t\t\t\t\t\t\t$alter .= ' AFTER ' . $this->name($col['after']);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t$colList[] = $alter;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'drop':\n\t\t\t\t\t\t\tforeach ($column as $field => $col) {\n\t\t\t\t\t\t\t\t$col['name'] = $field;\n\t\t\t\t\t\t\t\t$colList[] = 'DROP ' . $this->name($field);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'change':\n\t\t\t\t\t\t\tforeach ($column as $field => $col) {\n\t\t\t\t\t\t\t\tif (!isset($col['name'])) {\n\t\t\t\t\t\t\t\t\t$col['name'] = $field;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t$colList[] = 'CHANGE ' . $this->name($field) . ' ' . $this->buildColumn($col);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$colList = array_merge($colList, $this->_alterIndexes($curTable, $indexes));\n\t\t\t\t$colList = array_merge($colList, $this->_alterTableParameters($curTable, $tableParameters));\n\t\t\t\t$out .= \"\\t\" . join(\",\\n\\t\", $colList) . \";\\n\\n\";\n\t\t\t}\n\t\t}\n\t\treturn $out;\n\t}", "protected function check_safe_collation($query)\n {\n }", "public function convertTableToUTF8($name);", "private function setCharSet()\n {\n // preparing csConvObj\n if (!is_object($GLOBALS['TSFE']->csConvObj)) {\n if (is_object($GLOBALS['LANG'])) {\n $GLOBALS['TSFE']->csConvObj = $GLOBALS['LANG']->csConvObj;\n\n } else {\n $GLOBALS['TSFE']->csConvObj = Tx_Smarty_Service_Compatibility::makeInstance('t3lib_cs');\n }\n }\n\n // preparing renderCharset\n if (!is_object($GLOBALS['TSFE']->renderCharset)) {\n if (is_object($GLOBALS['LANG'])) {\n $GLOBALS['TSFE']->renderCharset = $GLOBALS['LANG']->charSet;\n\n } else {\n $GLOBALS['TSFE']->renderCharset = $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'];\n }\n }\n }", "public function getTableCharsetAndCollation($table, $options = array()) {\n $sql = 'SELECT CCSA.character_set_name AS charset, CCSA.collation_name AS collation\n FROM information_schema.`TABLES` T, information_schema.`COLLATION_CHARACTER_SET_APPLICABILITY` CCSA\n WHERE CCSA.collation_name = T.table_collation\n AND T.table_schema = \\''. $this->_dbName .'\\' AND T.table_name = \\''. $table .'\\'';\n\n return $this->selectOne($sql, $options);\n }", "public function updateAutoEncoding() {}", "function encode_trans3($text,$table_file='gb2big5') {\n // $str = fread($fp,strlen($table_file.'.table')); \n // fclose($fp); \n $max=strlen($text)-1; \n for($i=0;$i<$max;$i++) { \n $h=ord($text[$i]); \n if($h>=160) { \n $l=ord($text[$i+1]); \n if($h==161 && $l==64) { \n $text[$i]=' '; \n $text[++$i]=' '; \n }else{ \n $pos = ($h-160)*510+($l-1)*2; \n $text[$i]=$str[$pos]; \n $text[++$i]=$str[$pos+1]; \n } \n } \n } \n return $text; \n}", "function changeColumn($table, $oldCol, $newCol, $type=false);", "public function setCollation($collation)\n {\n $collation = strtolower($collation);\n $charset = self::getCollationCharset($collation);\n if (is_null($charset)) {\n throw new RuntimeException(\"unknown collation '$collation'\");\n }\n if (!is_null($this->charset) &&\n $this->charset !== $charset\n ) {\n throw new RuntimeException(\"COLLATION '$collation' is not valid for CHARACTER SET '$charset'\");\n }\n $this->charset = $charset;\n $this->collation = $collation;\n }", "public function collateWord($word)\n {\n $trans = array(\n \"ą\" => \"a\",\n \"č\" => \"c\",\n \"ę\" => \"e\",\n \"ė\" => \"e\",\n \"į\" => \"i\",\n \"š\" => \"s\",\n \"ų\" => \"u\",\n \"ū\" => \"u\",\n \"ž\" => \"z\",\n \"Ą\" => \"A\",\n \"Č\" => \"C\",\n \"Ę\" => \"E\",\n \"Ė\" => \"E\",\n \"Į\" => \"I\",\n \"Š\" => \"S\",\n \"Ų\" => \"U\",\n \"Ū\" => \"U\",\n \"Ž\" => \"Z\",\n );\n\n return strtr($word, $trans);\n }", "function testACLMigrationEncoding()\n \t{\n \t\trequire_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_xipt'.DS.'install'.DS.'helper.php');\n \t\tXiptHelperInstall::_migration460();\n \t\t$this->_DBO->addTable('#__xipt_aclrules');\n \t}", "public function convertDatabaseToUTF8();", "public function up(Schema $schema) : void\n {\n $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \\'mysql\\'.');\n\n $sql = \"CREATE FUNCTION `remove_accents`(`str` TEXT)\"\n .\" RETURNS text\"\n .\" LANGUAGE SQL\"\n .\" DETERMINISTIC\"\n .\" NO SQL\"\n .\" SQL SECURITY INVOKER\"\n .\" COMMENT ''\"\n .\" BEGIN\"\n .\"\"\n .\" SET str = REPLACE(str,'Š','S');\"\n .\" SET str = REPLACE(str,'š','s');\"\n .\" SET str = REPLACE(str,'Ð','Dj');\"\n .\" SET str = REPLACE(str,'Ž','Z');\"\n .\" SET str = REPLACE(str,'ž','z');\"\n .\" SET str = REPLACE(str,'À','A');\"\n .\" SET str = REPLACE(str,'Á','A');\"\n .\" SET str = REPLACE(str,'Â','A');\"\n .\" SET str = REPLACE(str,'Ã','A');\"\n .\" SET str = REPLACE(str,'Ä','A');\"\n .\" SET str = REPLACE(str,'Å','A');\"\n .\" SET str = REPLACE(str,'Æ','A');\"\n .\" SET str = REPLACE(str,'Ç','C');\"\n .\" SET str = REPLACE(str,'È','E');\"\n .\" SET str = REPLACE(str,'É','E');\"\n .\" SET str = REPLACE(str,'Ê','E');\"\n .\" SET str = REPLACE(str,'Ë','E');\"\n .\" SET str = REPLACE(str,'Ì','I');\"\n .\" SET str = REPLACE(str,'Í','I');\"\n .\" SET str = REPLACE(str,'Î','I');\"\n .\" SET str = REPLACE(str,'Ï','I');\"\n .\" SET str = REPLACE(str,'Ñ','N');\"\n .\" SET str = REPLACE(str,'Ò','O');\"\n .\" SET str = REPLACE(str,'Ó','O');\"\n .\" SET str = REPLACE(str,'Ô','O');\"\n .\" SET str = REPLACE(str,'Õ','O');\"\n .\" SET str = REPLACE(str,'Ö','O');\"\n .\" SET str = REPLACE(str,'Ø','O');\"\n .\" SET str = REPLACE(str,'Ù','U');\"\n .\" SET str = REPLACE(str,'Ú','U');\"\n .\" SET str = REPLACE(str,'Û','U');\"\n .\" SET str = REPLACE(str,'Ü','U');\"\n .\" SET str = REPLACE(str,'Ý','Y');\"\n .\" SET str = REPLACE(str,'Þ','B');\"\n .\" SET str = REPLACE(str,'ß','Ss');\"\n .\" SET str = REPLACE(str,'à','a');\"\n .\" SET str = REPLACE(str,'á','a');\"\n .\" SET str = REPLACE(str,'â','a');\"\n .\" SET str = REPLACE(str,'ã','a');\"\n .\" SET str = REPLACE(str,'ä','a');\"\n .\" SET str = REPLACE(str,'å','a');\"\n .\" SET str = REPLACE(str,'æ','a');\"\n .\" SET str = REPLACE(str,'ç','c');\"\n .\" SET str = REPLACE(str,'è','e');\"\n .\" SET str = REPLACE(str,'é','e');\"\n .\" SET str = REPLACE(str,'ê','e');\"\n .\" SET str = REPLACE(str,'ë','e');\"\n .\" SET str = REPLACE(str,'ì','i');\"\n .\" SET str = REPLACE(str,'í','i');\"\n .\" SET str = REPLACE(str,'î','i');\"\n .\" SET str = REPLACE(str,'ï','i');\"\n .\" SET str = REPLACE(str,'ð','o');\"\n .\" SET str = REPLACE(str,'ñ','n');\"\n .\" SET str = REPLACE(str,'ò','o');\"\n .\" SET str = REPLACE(str,'ó','o');\"\n .\" SET str = REPLACE(str,'ô','o');\"\n .\" SET str = REPLACE(str,'õ','o');\"\n .\" SET str = REPLACE(str,'ö','o');\"\n .\" SET str = REPLACE(str,'ø','o');\"\n .\" SET str = REPLACE(str,'ù','u');\"\n .\" SET str = REPLACE(str,'ú','u');\"\n .\" SET str = REPLACE(str,'û','u');\"\n .\" SET str = REPLACE(str,'ý','y');\"\n .\" SET str = REPLACE(str,'ý','y');\"\n .\" SET str = REPLACE(str,'þ','b');\"\n .\" SET str = REPLACE(str,'ÿ','y');\"\n .\" SET str = REPLACE(str,'ƒ','f');\"\n .\" RETURN str;\"\n .\" END\"\n ;\n \n $this->addSql($sql);\n }", "private function set_charset() {\n\t\t//regresa bool\n\t\t$this->conn->set_charset(\"utf8\");\n\t}", "public function testSetTypeFullText()\r\n\t{\r\n\r\n\t\t// Create index\r\n\t\t$index = new Index();\r\n\t\t$index->TABLE_NAME = 'table2';\r\n\t\t$index->TABLE_SCHEMA = 'indextest';\r\n\t\t$index->INDEX_NAME = 'newname';\r\n\t\t$index->setType('FULLTEXT');\r\n\r\n\t\t// Add new column\r\n\t\t$columns = $index->columns;\r\n\t\t$col = new IndexColumn();\r\n\t\t$col->COLUMN_NAME = 'pk';\r\n\t\t$columns[] = $col;\r\n\t\t$col = new IndexColumn();\r\n\t\t$col->COLUMN_NAME = 'varchar';\r\n\t\t$col->SUB_PART = 10;\r\n\t\t$columns[] = $col;\r\n\t\t$index->columns = $columns;\r\n\r\n\t\t// Try saving\r\n\t\t$index->save();\r\n\r\n\t\t// Reload index and load index columns\r\n\t\t$index->refresh();\r\n\t\t$cols = IndexColumn::model()->findAllByAttributes(\r\n\t\tarray(\r\n\t\t'TABLE_SCHEMA' => $index->TABLE_SCHEMA,\r\n\t\t 'TABLE_NAME' => $index->TABLE_NAME, \r\n\t\t 'INDEX_NAME' => $index->INDEX_NAME\r\n\t\t));\r\n\r\n\t\t// Check properties\r\n\t\t$this->assertEquals('newname', $index->INDEX_NAME);\r\n\t\t$this->assertEquals('FULLTEXT', $index->getType());\r\n\r\n\t}", "public static function toUtf16Be($table, $string, $ignore = false, $translit = false) {}", "function dmlChangeColumnType () {\r\n\t\t// Create connection\r\n\t\t$conn = new mysqli($GLOBALS['servername'], $GLOBALS['username'], $GLOBALS['password'], $GLOBALS['dbname']);\r\n\t\t// Check connection\r\n\t\tif ($conn->connect_error) {\r\n\t\t\tdie(\"Connection failed: \" . $conn->connect_error);\r\n\t\t} \r\n\r\n\t\t$sql = \"ALTER TABLE tbldmlmapcontent MODIFY CntField7 MEDIUMTEXT\";\r\n\r\n\t\tif ($conn->query($sql) === TRUE) {\r\n\t\t\techo 1;\r\n\t\t} else {\r\n\t\t\techo 0;\r\n\t\t}\r\n\t\t\r\n\t\t$conn->close();\r\n\t}", "abstract protected function _getEncodingTable();", "private static function normalize($text) {\n return strtr($text, self::$normalizeTable);\n }", "function ReInitTableColumns()\n {\n if ($this->debug_mode)\n echo $this->ClassName . \"::ReInitTableColumns();\" . \"<HR>\";\n foreach ($this->form_fields as $prefix => $form) {\n foreach ($form as $i => $field) {\n foreach ($field as $param => $value) {\n //if found database parameters\n if (strpos($param, \"dbfield_\") !== false) {\n $columnparam = substr($param, strlen(\"dbfield_\"), strlen($param));\n $this->Storage->setColumnParameter($field[\"field_name\"], trim($columnparam), $value);\n }\n }\n }\n }\n }", "public function convCharset(array $data): array\n {\n $dbCharset = 'utf-8';\n if ($dbCharset != $this->indata['charset']) {\n $converter = GeneralUtility::makeInstance(CharsetConverter::class);\n foreach ($data as $k => $v) {\n $data[$k] = $converter->conv($v, strtolower($this->indata['charset']), $dbCharset);\n }\n }\n return $data;\n }", "protected function charset(Table $table, Magic $column)\n {\n if (in_array($column->type, ['string', 'text']) && $column->charset) {\n return ' CHARACTER SET ' . $column->charset;\n }\n }", "public static function columns(Blueprint $table)\n {\n $table->string(config('translatable.db.columns.langcode'))->nullable();\n $table->uuid(config('translatable.db.columns.translation_uuid'))->nullable();\n\n $table->index(static::getDefaultColumns());\n }", "protected function _getEncodingTable() {}", "protected function _getEncodingTable() {}", "protected function _getEncodingTable() {}", "public function setUnaltered()\n {\n $this->alteredColumns = [];\n }", "public function testCharset()\n {\n $statement = (new CreateTable($this->mockConnection));\n $return = $statement->charset('utf8');\n $array = $statement->toArray();\n\n $this->assertInstanceOf(CreateTable::class, $return);\n $this->assertEquals([\n 'charset' => 'utf8',\n 'collate' => null,\n ], $array);\n }", "public function applyTcaForPreRegisteredTables()\n {\n $this->registerDefaultCategorizedTables();\n foreach ($this->registry as $tableName => $fields) {\n foreach ($fields as $fieldName => $_) {\n $this->applyTcaForTableAndField($tableName, $fieldName);\n }\n }\n }", "protected function _doColumns()\n {\n global $prefs;\n\n // Turba's columns pref\n $abooks = explode(\"\\n\", $prefs->getValue('columns'));\n if (is_array($abooks) && !empty($abooks[0])) {\n $new_prefs = array();\n $cnt = count($abooks);\n for ($i = 0; $i < $cnt; ++$i) {\n $colpref = explode(\"\\t\", $abooks[$i]);\n $colpref[0] = $this->_updateShareName($colpref[0]);\n $abooks[$i] = implode(\"\\t\", $colpref);\n }\n $prefs->setValue('columns', implode(\"\\n\", $abooks));\n }\n }", "function __alter_table($table, $alterdefs)\r\n{\r\n global $g_current_db;\r\n\r\n $sql = \"SELECT sql,name,type FROM sqlite_master WHERE tbl_name = '\" . $table . \"' ORDER BY type DESC\";\r\n $result = sqlite_query($g_current_db, $sql);\r\n\r\n if (($result === false) || (sqlite_num_rows($result) <= 0)) {\r\n trigger_error('no such table: ' . $table, E_USER_WARNING);\r\n return false;\r\n }\r\n // ------------------------------------- Build the queries\r\n $row = sqlite_fetch_array($result);\r\n $tmpname = 't' . time();\r\n $origsql = trim(preg_replace(\"/[\\s]+/\", \" \", str_replace(\",\", \", \", preg_replace(\"/[\\(]/\", \"( \", $row['sql'], 1))));\r\n $createtemptableSQL = 'CREATE TEMPORARY ' . substr(trim(preg_replace(\"'\" . $table . \"'\", $tmpname, $origsql, 1)), 6);\r\n $origsql = substr($origsql, 0, strlen($origsql)-1); // chops the ) at end\r\n $createindexsql = array();\r\n $i = 0;\r\n $defs = preg_split(\"/[,]+/\", $alterdefs, -1, PREG_SPLIT_NO_EMPTY);\r\n $prevword = $table;\r\n $oldcols = preg_split(\"/[,]+/\", substr(trim($createtemptableSQL), strpos(trim($createtemptableSQL), '(') + 1), -1, PREG_SPLIT_NO_EMPTY);\r\n $oldcols = preg_split(\"/[,]+/\", substr(trim($origsql), strpos(trim($origsql), '(') + 1), -1, PREG_SPLIT_NO_EMPTY);\r\n $newcols = array();\r\n\r\n for($i = 0;$i < sizeof($oldcols);$i++) {\r\n $colparts = preg_split(\"/[\\s]+/\", $oldcols[$i], -1, PREG_SPLIT_NO_EMPTY);\r\n $oldcols[$i] = $colparts[0];\r\n $newcols[$colparts[0]] = $colparts[0];\r\n }\r\n\r\n $newcolumns = '';\r\n $oldcolumns = '';\r\n reset($newcols);\r\n\r\n while (list($key, $val) = each($newcols)) {\r\n $newcolumns .= ($newcolumns?', ':'') . $val;\r\n $oldcolumns .= ($oldcolumns?', ':'') . $key;\r\n }\r\n\r\n $copytotempsql = 'INSERT INTO ' . $tmpname . '(' . $newcolumns . ') SELECT ' . $oldcolumns . ' FROM ' . $table;\r\n $dropoldsql = 'DROP TABLE ' . $table;\r\n $createtesttableSQL = $createtemptableSQL;\r\n\r\n $newname = \"\";\r\n\r\n foreach($defs as $def) {\r\n $defparts = preg_split(\"/[\\s]+/\", $def, -1, PREG_SPLIT_NO_EMPTY);\r\n $action = strtolower($defparts[0]);\r\n\r\n switch ($action) {\r\n case 'add':\r\n\r\n if (sizeof($defparts) <= 2) {\r\n /**\r\n * * mySQL gives no such user_warning\r\n * trigger_error('near \"' . $defparts[0] . ($defparts[1]?' ' . $defparts[1]:'') . '\": SQLITE syntax error', E_USER_WARNING);\r\n *\r\n * //\r\n */\r\n return false;\r\n }\r\n $createtesttableSQL = substr($createtesttableSQL, 0, strlen($createtesttableSQL)-1) . ',';\r\n for($i = 1;$i < sizeof($defparts);$i++)\r\n $createtesttableSQL .= ' ' . $defparts[$i];\r\n $createtesttableSQL .= ')';\r\n break;\r\n\r\n case 'change':\r\n\r\n if (sizeof($defparts) <= 2) {\r\n trigger_error('near \"' . $defparts[0] . ($defparts[1]?' ' . $defparts[1]:'') . ($defparts[2]?' ' . $defparts[2]:'') . '\": SQLITE syntax error', E_USER_WARNING);\r\n return false;\r\n }\r\n if ($severpos = strpos($createtesttableSQL, ' ' . $defparts[1] . ' ')) {\r\n if ($newcols[$defparts[1]] != $defparts[1]) {\r\n trigger_error('unknown column \"' . $defparts[1] . '\" in \"' . $table . '\"', E_USER_WARNING);\r\n return false;\r\n }\r\n $newcols[$defparts[1]] = $defparts[2];\r\n $nextcommapos = strpos($createtesttableSQL, ',', $severpos);\r\n $insertval = '';\r\n for($i = 2;$i < sizeof($defparts);$i++)\r\n $insertval .= ' ' . $defparts[$i];\r\n if ($nextcommapos)\r\n $createtesttableSQL = substr($createtesttableSQL, 0, $severpos) . $insertval . substr($createtesttableSQL, $nextcommapos);\r\n else\r\n $createtesttableSQL = substr($createtesttableSQL, 0, $severpos - (strpos($createtesttableSQL, ',')?0:1)) . $insertval . ')';\r\n } else {\r\n trigger_error('unknown column \"' . $defparts[1] . '\" in \"' . $table . '\"', E_USER_WARNING);\r\n return false;\r\n }\r\n break;\r\n\r\n case 'drop';\r\n\r\n if (sizeof($defparts) < 2) {\r\n trigger_error('near \"' . $defparts[0] . ($defparts[1]?' ' . $defparts[1]:'') . '\": SQLITE syntax error', E_USER_WARNING);\r\n return false;\r\n }\r\n /**\r\n * if ($severpos = strpos($createtesttableSQL, ' ' . $defparts[1] . ' ')) {\r\n * could end with , or ) if no type!!!!\r\n *\r\n * //\r\n */\r\n if (($severpos = strpos($createtesttableSQL, ' ' . $defparts[1] . ' ')) || ($severpos = strpos($createtesttableSQL, ' ' . $defparts[1] . ',')) || ($severpos = strpos($createtesttableSQL, ' ' . $defparts[1] . ')'))) {\r\n $nextcommapos = strpos($createtesttableSQL, ',', $severpos);\r\n if ($nextcommapos)\r\n $createtesttableSQL = substr($createtesttableSQL, 0, $severpos) . substr($createtesttableSQL, $nextcommapos + 1);\r\n else\r\n $createtesttableSQL = substr($createtesttableSQL, 0, $severpos - (strpos($createtesttableSQL, ',')?0:1)) . ')';\r\n unset($newcols[$defparts[1]]);\r\n /* RUBEM */ $createtesttableSQL = str_replace(\",)\", \")\", $createtesttableSQL);\r\n } else {\r\n trigger_error('unknown column \"' . $defparts[1] . '\" in \"' . $table . '\"', E_USER_WARNING);\r\n return false;\r\n }\r\n break;\r\n\r\n case 'rename'; // RUBEM\r\n if (sizeof($defparts) < 2) {\r\n trigger_error('near \"' . $defparts[0] . ($defparts[1]?' ' . $defparts[1]:'') . '\": SQLITE syntax error', E_USER_WARNING);\r\n return false;\r\n }\r\n $newname = $defparts[2];\r\n break;\r\n\r\n default:\r\n\r\n trigger_error('near \"' . $prevword . '\": SQLITE syntax error', E_USER_WARNING);\r\n return false;\r\n } // switch\r\n $prevword = $defparts[sizeof($defparts)-1];\r\n } // foreach\r\n // This block of code generates a test table simply to verify that the columns specifed are valid\r\n // in an sql statement. This ensures that no reserved words are used as columns, for example\r\n sqlite_query($g_current_db, $createtesttableSQL);\r\n $err = sqlite_last_error($g_current_db);\r\n if ($err) {\r\n trigger_error(\"Invalid SQLITE code block: \" . sqlite_error_string($err) . \"\\n\", E_USER_WARNING);\r\n return false;\r\n }\r\n $droptempsql = 'DROP TABLE ' . $tmpname;\r\n sqlite_query($g_current_db, $droptempsql);\r\n // End test block\r\n // Is it a Rename?\r\n if (strlen($newname) > 0) {\r\n // $table = preg_replace(\"/([a-z]_)[a-z_]*/i\", \"\\\\1\" . $newname, $table);\r\n // what do want with the regex? the expression should be [a-z_]! hans\r\n // why not just\r\n $table = $newname;\r\n }\r\n $createnewtableSQL = 'CREATE ' . substr(trim(preg_replace(\"'\" . $tmpname . \"'\", $table, $createtesttableSQL, 1)), 17);\r\n\r\n $newcolumns = '';\r\n $oldcolumns = '';\r\n reset($newcols);\r\n\r\n while (list($key, $val) = each($newcols)) {\r\n $newcolumns .= ($newcolumns?', ':'') . $val;\r\n $oldcolumns .= ($oldcolumns?', ':'') . $key;\r\n }\r\n $copytonewsql = 'INSERT INTO ' . $table . '(' . $newcolumns . ') SELECT ' . $oldcolumns . ' FROM ' . $tmpname;\r\n // ------------------------------------- Perform the actions\r\n if (sqlite_query($g_current_db, $createtemptableSQL) === false) return false; //create temp table\r\n if (sqlite_query($g_current_db, $copytotempsql) === false) return false; //copy to table\r\n if (sqlite_query($g_current_db, $dropoldsql) === false) return false; //drop old table\r\n if (sqlite_query($g_current_db, $createnewtableSQL) === false) return false; //recreate original table\r\n if (sqlite_query($g_current_db, $copytonewsql) === false) return false; //copy back to original table\r\n if (sqlite_query($g_current_db, $droptempsql) === false) return false; //drop temp table\r\n return true;\r\n}", "public function change()\n {\n\t\t$table=$this->table('comp_front_sources')\n\t\t\t\t\t->addColumn('main_title','string',array('null'=>true,'default'=>'标题','comment'=>'主标题'))\n\t\t\t\t\t->addColumn('sub_title','string',array('null'=>true,'comment'=>'副标题'))\n\t\t\t\t\t->addColumn('main_pic','string',array('null'=>true,'comment'=>'主要图片'))\n\t\t\t\t\t->addColumn('secondary_pic','string',array('null'=>true,'comment'=>'次要图片'))\n\t\t\t\t\t->addColumn('main_content','string',array('null'=>true,'default'=>'暂时没有内容','comment'=>'主要内容'))\n\t\t\t\t\t->addColumn('secondary_content','string',array('null'=>true,'comment'=>'次要内容'))\n\t\t\t\t\t->addColumn('main_figure','string',array('null'=>true,'comment'=>'主要数值'))\n\t\t\t\t\t->addColumn('secondary_figure','string',array('null'=>true,'comment'=>'次要数值'))\n\t\t\t\t\t->addColumn('parameter','string',array('null'=>true,'comment'=>'参数'))\n\t\t\t\t\t->addColumn('category','string',array('null'=>true,'default'=>'未分类','comment'=>'分类'))\n\t\t\t\t\t->addColumn('description','string',array('null'=>true,'comment'=>'备注'))\n\t\t\t\t\t->addColumn('created_at','integer', array('null'=>true))\n\t\t\t\t\t->save();\n\t}", "public static function determine_charset() {\n global $wpdb;\n $charset = '';\n\n if (!empty($wpdb->charset)) {\n $charset = \"DEFAULT CHARACTER SET {$wpdb->charset}\";\n\n if (!empty($wpdb->collate)) {\n $charset .= \" COLLATE {$wpdb->collate}\";\n }\n }\n return $charset;\n }", "protected function getCharsetConversion() {}", "public function compileAdminTables() {}", "public function tableModify()\n {\n }", "public function tableModify()\n {\n }", "public function tableModify()\n {\n }", "public function tableModify()\n {\n }", "abstract public function tableColumns();", "protected function applyTcaForTableAndField($tableName, $fieldName)\n {\n $this->addTcaColumn($tableName, $fieldName, $this->registry[$tableName][$fieldName]);\n $this->addToAllTCAtypes($tableName, $fieldName, $this->registry[$tableName][$fieldName]);\n }", "abstract public function setUTF();", "function UTF8FixWin1252Chars($text){\r\n // (ignoring Windows-1252 chars from 80 to 9F) use this function to fix it.\r\n // See: http://en.wikipedia.org/wiki/Windows-1252\r\n return str_replace(array_keys(self::$brokenUtf8ToUtf8), array_values(self::$brokenUtf8ToUtf8), $text);\r\n }", "function revert_table() {\r\n $this->_table = $this->_table_org;\r\n $this->_table_org = NULL;\r\n }", "public function fixCharsets() {}", "public function setEncryptedText($text)\n {\n $this->_encryptedText = $text . \"\";//force it to be a string\n }", "public function change()\n {\n $table = $this->table('questions');\n $table->addColumn('lang_type_id', 'integer', [\n 'default' => null,\n 'limit' => 11,\n 'null' => false,\n ]);\n \n $table->addColumn('title', 'string', [\n 'default' => null,\n 'limit' => 150,\n 'null' => false,\n ]);\n $table->addColumn('resolved', 'boolean', [\n 'default' => false,\n 'null' => true,\n ]);\n $table->addColumn('pv', 'biginteger', [\n 'default' => null,\n 'limit' => 20,\n 'null' => false,\n ]);\n $table->addColumn('created_at', 'datetime', [\n 'default' => null,\n 'null' => false,\n ]);\n $table->addColumn('updated_at', 'datetime', [\n 'default' => null,\n 'null' => false,\n ]);\n \n $table->addIndex([\n 'lang_type_id',\n ], [\n 'name' => 'BY_LANG_TYPE_ID',\n 'unique' => false,\n ]);\n \n // テーブル定義上は\n // titleがユニークになっていないのは移行前システムに同名タイトルがあった為\n $table->addIndex([\n 'title',\n ], [\n 'name' => 'BY_TITLE',\n 'unique' => false,\n ]);\n $table->create();\n }", "function ifx_textasvarchar($mode)\n{\n}", "public function getCollation()\n {\n if (is_null($this->charset)) {\n throw new LogicException(\"getCollation called when collation is unspecified\");\n }\n if ($this->isBinaryCollation) {\n $collations = self::getCharsetCollations($this->charset);\n if (null !== $collations) {\n return $collations[count($collations) - 1];\n }\n }\n return $this->collation;\n }", "static function setUpColumns($columns)\n {\n $columns->id = Column::AUTO_ID;\n $columns->type = Column::STRING;\n $columns->text = Column::STRING + Column::NOT_NULL;\n }", "public function change()\n {\n $table = $this->table('calendars');\n $hasSource = $table->hasColumn('calendar_source');\n $hasSourceId = $table->hasColumn('calendar_source_id');\n\n if ($hasSource) {\n $table->renameColumn('calendar_source', 'source');\n }\n\n if ($hasSourceId) {\n $table->renameColumn('calendar_source_id', 'source_id');\n }\n }", "public function change() {\n\t\t$this->table('countries')\n\t\t\t->addColumn('name', 'string', [\n\t\t\t\t'default' => null,\n\t\t\t\t'limit' => 64,\n\t\t\t\t'null' => false,\n\t\t\t])\n\t\t\t->addColumn('ori_name', 'string', [\n\t\t\t\t'default' => null,\n\t\t\t\t'limit' => 64,\n\t\t\t\t'null' => false,\n\t\t\t])\n\t\t\t->addColumn('continent_id', 'integer', [\n\t\t\t\t'default' => null,\n\t\t\t\t'limit' => 10,\n\t\t\t\t'null' => true,\n\t\t\t\t'signed' => false,\n\t\t\t])\n\t\t\t->addColumn('iso2', 'string', [\n\t\t\t\t'default' => null,\n\t\t\t\t'limit' => 2,\n\t\t\t\t'null' => false,\n\t\t\t])\n\t\t\t->addColumn('iso3', 'string', [\n\t\t\t\t'default' => null,\n\t\t\t\t'limit' => 3,\n\t\t\t\t'null' => false,\n\t\t\t])\n\t\t\t->addColumn('phone_code', 'string', [\n\t\t\t\t'default' => null,\n\t\t\t\t'limit' => 20,\n\t\t\t\t'null' => true,\n\t\t\t])\n\t\t\t->addColumn('eu_member', 'boolean', [\n\t\t\t\t'comment' => 'Member of the EU',\n\t\t\t\t'default' => false,\n\t\t\t\t'limit' => null,\n\t\t\t\t'null' => false,\n\t\t\t])\n\t\t\t->addColumn('zip_length', 'tinyinteger', [\n\t\t\t\t'comment' => 'if > 0 validate on this length',\n\t\t\t\t'default' => '0',\n\t\t\t\t'limit' => null,\n\t\t\t\t'null' => false,\n\t\t\t\t'signed' => false,\n\t\t\t])\n\t\t\t->addColumn('zip_regexp', 'string', [\n\t\t\t\t'default' => null,\n\t\t\t\t'limit' => 190,\n\t\t\t\t'null' => true,\n\t\t\t])\n\t\t\t->addColumn('sort', 'integer', [\n\t\t\t\t'default' => '0',\n\t\t\t\t'limit' => null,\n\t\t\t\t'null' => false,\n\t\t\t\t'signed' => false,\n\t\t\t])\n\t\t\t->addColumn('lat', 'float', [\n\t\t\t\t'comment' => 'latitude',\n\t\t\t\t'default' => null,\n\t\t\t\t'null' => true,\n\t\t\t\t'precision' => 10,\n\t\t\t\t'scale' => 6,\n\t\t\t])\n\t\t\t->addColumn('lng', 'float', [\n\t\t\t\t'comment' => 'longitude',\n\t\t\t\t'default' => null,\n\t\t\t\t'null' => true,\n\t\t\t\t'precision' => 10,\n\t\t\t\t'scale' => 6,\n\t\t\t])\n\t\t\t->addColumn('address_format', 'string', [\n\t\t\t\t'default' => null,\n\t\t\t\t'limit' => 190,\n\t\t\t\t'null' => true,\n\t\t\t])\n\t\t\t->addColumn('timezone_offset', 'string', [\n\t\t\t\t'default' => null,\n\t\t\t\t'limit' => 255,\n\t\t\t\t'null' => true,\n\t\t\t])\n\t\t\t->addColumn('status', 'tinyinteger', [\n\t\t\t\t'default' => '0',\n\t\t\t\t'limit' => null,\n\t\t\t\t'null' => false,\n\t\t\t\t'signed' => false,\n\t\t\t])\n\t\t\t->addColumn('modified', 'datetime', [\n\t\t\t\t'default' => null,\n\t\t\t\t'limit' => null,\n\t\t\t\t'null' => false,\n\t\t\t])\n\t\t\t->addIndex(\n\t\t\t\t[\n\t\t\t\t\t'iso2',\n\t\t\t\t],\n\t\t\t\t['unique' => true],\n\t\t\t)\n\t\t\t->addIndex(\n\t\t\t\t[\n\t\t\t\t\t'iso3',\n\t\t\t\t],\n\t\t\t\t['unique' => true],\n\t\t\t)\n\t\t\t->create();\n\n\t\t// ALTER TABLE `countries` ADD `timezone_offset` VARCHAR(255) NULL AFTER `phone_code`;\n\t\t// ALTER TABLE `countries` CHANGE `country_code` `phone_code` VARCHAR(20) NULL DEFAULT NULL;\n\t}", "public function change()\n {\n $table = $this->table('places', ['comment' => 'Adresní místa z celé ČR']);\n $table\n ->addColumn('adm', 'integer',\n ['comment' => 'Kód ADM', 'signed' => false])\n ->addColumn('code', 'integer',\n ['comment' => 'Kód obce', 'signed' => false])\n ->addColumn('name', 'string', ['comment' => 'Název obce'])\n ->addColumn('momc_code', 'integer',\n ['comment' => 'Kód MOMC', 'signed' => false])\n ->addColumn('momc_name', 'string', ['comment' => 'Název MOMC'])\n ->addColumn('mop_code', 'integer',\n ['comment' => 'Kód MOP', 'signed' => false])\n ->addColumn('mop_name', 'string', ['comment' => 'Název MOP'])\n ->addColumn('district_code', 'integer',\n ['comment' => 'Kód části obce', 'signed' => false])\n ->addColumn('district_name', 'string',\n ['comment' => 'Název části obce'])\n ->addColumn('street_code', 'integer',\n ['comment' => 'Kód ulice', 'signed' => false])\n ->addColumn('street_name', 'string', ['comment' => 'Název ulice'])\n ->addColumn('so_type', 'string', ['comment' => 'Typ SO'])\n ->addColumn('house_number', 'integer',\n ['comment' => 'Číslo domovní', 'signed' => false])\n ->addColumn('orientation_number', 'integer',\n ['comment' => 'Číslo orientační', 'signed' => false])\n ->addColumn('orientation_number_mark', 'string',\n ['comment' => 'Znak čísla orientačního'])\n ->addColumn('zip', 'string',\n ['comment' => 'PSČ', 'signed' => false, 'limit' => 5])\n ->addColumn('y', 'decimal',\n ['comment' => 'Souřadnice Y', 'signed' => false, 'precision' => 2])\n ->addColumn('x', 'decimal',\n ['comment' => 'Souřadnice X', 'signed' => false, 'precision' => 2])\n ->addColumn('valid_from', 'datetime', ['comment' => 'Platí Od'])\n ->addIndex(['adm'], ['unique' => true, 'name' => 'idx_adm'])\n ->addIndex(['code'], ['name' => 'idx_code'])\n ->addIndex(['name'], ['name' => 'idx_name'])\n ->addIndex(['street_name'], ['name' => 'idx_stret_name'])\n ->addIndex(['house_number'], ['name' => 'idx_house_number'])\n ->addIndex(['orientation_number'],\n ['name' => 'idx_orientation_number'])\n ->addIndex(['zip'], ['name' => 'idx_zip'])\n ->create();\n }", "function upgrade_373_mysql() { # MySQL only\n $table_domain = table_by_key ('domain');\n $table_mailbox = table_by_key('mailbox');\n\n $all_sql = explode(\"\\n\", trim(\"\n ALTER TABLE `$table_domain` CHANGE `description` `description` VARCHAR( 255 ) {UTF-8} NOT NULL\n ALTER TABLE `$table_mailbox` CHANGE `name` `name` VARCHAR( 255 ) {UTF-8} NOT NULL\n \"));\n\n foreach ($all_sql as $sql) {\n $result = db_query_parsed($sql);\n }\n}", "public function setDbCollation($db_collation)\r\n {\r\n $this->db_collation = $db_collation;\r\n\r\n return $this;\r\n }", "function getStatus($table) {\n return mysql_query(sprintf('SELECT * FROM information_schema.`TABLES` T,information_schema.`COLLATION_CHARACTER_SET_APPLICABILITY` CCSA WHERE CCSA.collation_name = T.table_collation AND T.table_schema = \\'%s\\' AND T.table_name = \\'%s\\'', $this->config[\"database\"], $table));\n }", "public function change()\n {\n $table = $this->table('libros');\n $table->addColumn('autor', 'string', [\n 'default' => null,\n 'limit' => 100,\n 'null' => true,\n ]);\n $table->addColumn('titulo', 'string', [\n 'default' => null,\n 'limit' => 150,\n 'null' => true,\n ]);\n $table->addColumn('traductor', 'string', [\n 'default' => null,\n 'limit' => 100,\n 'null' => true,\n ]);\n $table->addColumn('ciudad', 'string', [\n 'default' => null,\n 'limit' => 50,\n 'null' => true,\n ]);\n $table->addColumn('anio_edicion', 'integer', [\n 'default' => null,\n 'null' => true,\n ]);\n $table->addColumn('edicion', 'string', [\n 'default' => null,\n 'limit' => 10,\n 'null' => true,\n ]);\n $table->addColumn('primera_edicion', 'integer', [\n 'default' => null,\n 'null' => true,\n ]);\n $table->addColumn('editorial', 'string', [\n 'default' => null,\n 'limit' => 50,\n 'null' => true,\n ]);\n $table->addColumn('tema_id', 'integer', [\n 'default' => null,\n 'null' => true,\n ]);\n $table->addColumn('tipo', 'string', [\n 'default' => null,\n 'limit' => 10,\n 'null' => true,\n ]);\n $table->addColumn('topografia', 'string', [\n 'default' => null,\n 'limit' => 15,\n 'null' => true,\n ]);\n $table->addColumn('paginas', 'integer', [\n 'default' => null,\n 'null' => true,\n ]);\n $table->addColumn('tomos', 'integer', [\n 'default' => null,\n 'null' => true,\n ]);\n $table->addColumn('idioma', 'string', [\n 'default' => null,\n 'limit' => 20,\n 'null' => true,\n ]);\n $table->addColumn('observaciones', 'text', [\n 'default' => null,\n 'null' => true,\n ]);\n $table->addColumn('baja', 'boolean', [\n 'default' => null,\n 'null' => true,\n ]);\n $table->addColumn('created', 'datetime', [\n 'default' => null,\n 'null' => false,\n ]);\n $table->addColumn('modified', 'datetime', [\n 'default' => null,\n 'null' => false,\n ]);\n\n $table->create();\n\n $current_timestamp = Carbon::now();\n // Inserta artículos de la base de datos antigua\n $this->execute('insert into libros (id, autor, titulo, traductor, ciudad, anio_edicion, edicion, primera_edicion, editorial, tema_id, tipo, topografia, paginas, tomos, idioma, observaciones, baja, created, modified) select id, lAutor, lTitulo, lTraductor, lCiudad, lAnioEdicion, lEdicion, lPrimeraEdicion, lEditorial, subtema_id+30, lTipo, lTopografia, lPaginas, lTomos, lIdioma, lObservaciones, lBaja, \"' . $current_timestamp . '\", \"' . $current_timestamp . '\" from old_libros');\n }", "protected function _configureColumns()\n {\n if (empty($this->columns)) {\n $this->guessColumns();\n }\n $this->_sourceColumns = $this->columns;;\n\n $columnsByKey = [];\n foreach ($this->columns as $column) {\n $columnKey = $this->_getColumnKey($column);\n for ($j = 0; true; $j++) {\n $suffix = ($j) ? '_' . $j : '';\n $columnKey .= $suffix;\n if (!array_key_exists($columnKey, $columnsByKey)) {\n break;\n }\n }\n $columnsByKey[$columnKey] = $column;\n }\n\n $this->columns = $columnsByKey;\n }", "public function init_charset()\n {\n }" ]
[ "0.7225204", "0.64697546", "0.63308394", "0.62432265", "0.611616", "0.59739697", "0.59668046", "0.58810216", "0.5865719", "0.5856473", "0.58330935", "0.5819369", "0.5788201", "0.57836914", "0.56409466", "0.56126976", "0.5595682", "0.55862087", "0.557636", "0.55612856", "0.5530835", "0.53785765", "0.5371444", "0.5352284", "0.5345891", "0.5327567", "0.5327567", "0.5299112", "0.5235607", "0.52040166", "0.51511794", "0.51254964", "0.510455", "0.5097957", "0.5063663", "0.5061109", "0.50216484", "0.5004108", "0.4950723", "0.49438372", "0.4937679", "0.49248937", "0.4903516", "0.4883613", "0.48815766", "0.48746303", "0.48628935", "0.48627758", "0.4859666", "0.48587325", "0.485547", "0.4826017", "0.4821206", "0.4801561", "0.47595334", "0.4757074", "0.47551546", "0.4752201", "0.47517553", "0.47511894", "0.47509706", "0.47395015", "0.4727548", "0.46904963", "0.46691284", "0.46690044", "0.46690044", "0.46658623", "0.4645043", "0.46356687", "0.46330833", "0.46187353", "0.46113122", "0.4609371", "0.46078676", "0.459991", "0.4576208", "0.4576208", "0.4576208", "0.4576208", "0.45485052", "0.45394528", "0.45180216", "0.45162", "0.45147386", "0.45145357", "0.45091376", "0.45064455", "0.45043686", "0.4499416", "0.44818434", "0.44817713", "0.44663036", "0.44577456", "0.44539264", "0.44421908", "0.4441443", "0.4440433", "0.44337666", "0.4432583" ]
0.6970929
1
Here we we can map our mockup to our hotels mapper class
protected function setUp() { $this->hotelMapperService = new HotelMapperService(); $this->jsonHotels = json_encode($this->getHotelsRequestExample()); $this->mappedHotels = $this->hotelMapperService->mapJsonToHotels($this->jsonHotels); $this->sort = new Sort($this->mappedHotels); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testFormatHotelData(){\n $reflection = new \\ReflectionClass(get_class($this->advertiserA));\n $data = $this->mockResponseA();\n $method = $reflection->getMethod('formatHotelData');\n $method->setAccessible(true);\n $result = $method->invokeArgs($this->advertiserA, [\n $data['hotels']\n ]);\n\n $roomMappers = $result[0]->getRooms();\n $taxMappers = $roomMappers[0]->getTaxes();\n $this->assertContainsOnlyInstancesOf(HotelMapper::class, $result);\n $this->assertContainsOnlyInstancesOf(RoomMapper::class, $roomMappers);\n $this->assertContainsOnlyInstancesOf(TaxMapper::class, $taxMappers);\n }", "public function setUp()\n\t{\t\t\n\t\t$this->postMapper = phpDataMapper_TestHelper::mapper('Blogs', 'PostMapper');\n\t\t$this->dogMapper = phpDataMapper_TestHelper::mapper('Dogs', 'DogMapper');\n\t}", "function setUp() {\n\n $this->oResolver= new reflection\\ResolverByReflection(new reflection\\resolveInterfaceByName\\ResolveInterfaceByNameFirstLetter());\n $aMap=array();\n $oL0ClassOne=&new layer0\\ClassOne(\" <b>Text Passed to The Instance created manually layer0->ClassOne</b>\");\n $aMap['layer2\\ClassOne']=&$oL0ClassOne;\n //$this->oResolverWithMap= new reflection\\ResolverByReflection(new reflection\\resolveInterfaceByName\\ResolveInterfaceByNameFirstLetter(),);\n\n }", "abstract protected function defineMapping();", "protected abstract function map();", "public function __construct() {\n // Replaced two mappers with the MapperAspect\n //$this->userCatalogMapper = new UserCatalogMapper();\n //$this->electronicCatalogMapper = new ElectronicCatalogMapper();\n }", "public function map()\n {\n $this->mapApiRoutes();\n\n $this->mapWebRoutes();\n $this->mapUserRoutes();\n $this->mapTrainingRoutes();\n $this->mapTrainingModeRoutes();\n $this->mapTrainingSystemRoutes();\n $this->mapTrainingBrandRoutes();\n $this->mapTrainingTypeRoutes();\n $this->mapTrainingAudienceRoutes();\n $this->mapTrainingTargetRoutes();\n $this->mapTrainingUserRoutes();\n $this->mapTrainingHistoryRoutes();\n $this->mapReportsRoutes();\n $this->mapTopPerformanceRoutes();\n }", "public function __construct($hotel)\n {\n $this->hotel = $hotel;\n }", "public function getHotels(): Collection;", "public function map()\n {\n $this->mapApiRoutes();\n\n $this->mapWebRoutes();\n $this->mapArticleRoutes();\n $this->mapVideoRoutes();\n $this->mapProductRoutes();\n $this->mapHarvestRoutes();\n $this->mapUserRoutes();\n $this->mapCategoryRoutes();\n $this->mapRegionRoutes();\n $this->mapUnitRoutes();\n $this->mapOrderRoutes();\n $this->mapLandRoutes();\n $this->mapBannerRoutes();\n $this->mapAdminRoutes();\n\n //\n }", "abstract public function map($data);", "public function run()\n {\n $hotels = [\n [\n 'name' => 'Hemus',\n 'location' => 'Vraca',\n 'description' => ' Luxurious hotel.',\n 'image' => 'https://q-cf.bstatic.com/images/hotel/max1024x768/177/177875901.jpg'\n ],\n [\n 'name' => 'Body M-Travel',\n 'location' => 'Vraca',\n 'description' => ' New hotel.',\n 'image' => 'https://q-cf.bstatic.com/images/hotel/max1024x768/930/93023850.jpg'\n ],\n [\n 'name' => 'Hotel Leva',\n 'location' => 'Vraca',\n 'description' => 'New luxurious hotel.',\n 'image' => 'https://r-cf.bstatic.com/images/hotel/max1024x768/147/147985319.jpg'\n ]\n ];\n\n foreach ($hotels as $hotel) {\n Hotel::create(array(\n 'name' => $hotel['name'],\n 'location' => $hotel['location'],\n 'description' => $hotel['description'],\n 'image' => $hotel['image']\n ));\n }\n }", "public function initOverworldGlitches() {\n\t\t$this->locations[\"Brewery\"]->setRequirements(function($locations, $items) {\n\t\t\treturn $items->has('MoonPearl');\n\t\t});\n\n\t\t$this->locations[\"Hammer Pegs\"]->setRequirements(function($locations, $items) {\n\t\t\treturn $items->has('Hammer') && $items->has('MoonPearl')\n\t\t\t\t&& ($items->canLiftDarkRocks()\n\t\t\t\t\t|| ($items->has('PegasusBoots')\n\t\t\t\t\t\t&& $this->world->getRegion('North East Dark World')->canEnter($locations, $items)));\n\t\t});\n\n\t\t$this->locations[\"Bumper Cave\"]->setRequirements(function($locations, $items) {\n\t\t\treturn $items->has('MoonPearl')\n\t\t\t\t&& ($items->has('PegasusBoots')\n\t\t\t\t\t\t|| ($items->canLiftRocks() && $items->has('Cape')));\n\t\t});\n\n\t\t$this->locations[\"Blacksmith\"]->setRequirements(function($locations, $items) {\n\t\t\treturn $items->has('MoonPearl') && $items->canLiftDarkRocks();\n\t\t});\n\n\t\t$this->locations[\"Purple Chest\"]->setRequirements(function($locations, $items) {\n\t\t\treturn $locations[\"Blacksmith\"]->canAccess($items)\n\t\t\t\t&& ($items->has(\"MoonPearl\")\n\t\t\t\t\t&& ($items->canLiftDarkRocks()\n\t\t\t\t\t\t|| ($items->has('PegasusBoots')\n\t\t\t\t\t\t\t&& $this->world->getRegion('North East Dark World')->canEnter($locations, $items))));\n\t\t});\n\n\t\t$this->can_enter = function($locations, $items) {\n\t\t\treturn $items->has('RescueZelda')\n\t\t\t\t&& (($items->has('MoonPearl')\n\t\t\t\t\t&& ($items->canLiftDarkRocks()\n\t\t\t\t\t\t|| ($items->has('Hammer') && $items->canLiftRocks())\n\t\t\t\t\t\t|| ($items->has('DefeatAgahnim') && $items->has('Hookshot')\n\t\t\t\t\t\t\t\t&& ($items->has('Hammer') || $items->canLiftRocks() || $items->has('Flippers')))))\n\t\t\t\t\t|| (($items->has('MagicMirror') || ($items->has('PegasusBoots') && $items->has('MoonPearl')))\n\t\t\t\t\t\t&& $this->world->getRegion('West Death Mountain')->canEnter($locations, $items)));\n\t\t};\n\n\t\treturn $this;\n\t}", "protected function set_mappers() {\n\t\t//Simple product mapping\n\t\t$this->generator->addMapper(\n\t\t\tfunction (\n\t\t\t\tarray $sf_product, \\ShoppingFeed\\Feed\\Product\\Product $product\n\t\t\t) {\n\t\t\t\t$sf_product = reset( $sf_product );\n\t\t\t\t/** @var Product $sf_product */\n\t\t\t\t$product->setReference( $sf_product->get_sku() );\n\t\t\t\t$product->setName( $sf_product->get_name() );\n\t\t\t\t$product->setPrice( $sf_product->get_price() );\n\n\t\t\t\tif ( ! empty( $sf_product->get_ean() ) ) {\n\t\t\t\t\t$product->setGtin( $sf_product->get_ean() );\n\t\t\t\t}\n\n\t\t\t\t$product->setQuantity( $sf_product->get_quantity() );\n\n\t\t\t\tif ( ! empty( $sf_product->get_link() ) ) {\n\t\t\t\t\t$product->setLink( $sf_product->get_link() );\n\t\t\t\t}\n\t\t\t\tif ( ! empty( $sf_product->get_discount() ) ) {\n\t\t\t\t\t$product->addDiscount( $sf_product->get_discount() );\n\t\t\t\t}\n\t\t\t\tif ( ! empty( $sf_product->get_image_main() ) ) {\n\t\t\t\t\t$product->setMainImage( $sf_product->get_image_main() );\n\t\t\t\t}\n\n\t\t\t\tif ( ! empty( $sf_product->get_full_description() ) || ! empty( $sf_product->get_short_description() ) ) {\n\t\t\t\t\t$product->setDescription( $sf_product->get_full_description(), $sf_product->get_short_description() );\n\t\t\t\t}\n\n\t\t\t\tif ( ! empty( $sf_product->get_brand_name() ) ) {\n\t\t\t\t\t$product->setBrand( $sf_product->get_brand_name(), $sf_product->get_brand_link() );\n\t\t\t\t}\n\n\t\t\t\tif ( ! empty( $sf_product->get_weight() ) ) {\n\t\t\t\t\t$product->setWeight( $sf_product->get_weight() );\n\t\t\t\t}\n\n\t\t\t\tif ( ! empty( $sf_product->get_category_name() ) ) {\n\t\t\t\t\t$product->setCategory( $sf_product->get_category_name(), $sf_product->get_category_link() );\n\t\t\t\t}\n\n\t\t\t\tif ( ! empty( $sf_product->get_attributes() ) ) {\n\t\t\t\t\t$product->setAttributes( $sf_product->get_attributes() );\n\t\t\t\t}\n\n\t\t\t\tif ( ! empty( $sf_product->get_shipping_methods() ) ) {\n\t\t\t\t\tforeach ( $sf_product->get_shipping_methods() as $shipping_method ) {\n\t\t\t\t\t\t$product->addShipping( $shipping_method['cost'], $shipping_method['description'] );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t$images = $sf_product->get_images();\n\t\t\t\tif ( ! empty( $images ) ) {\n\t\t\t\t\t$product->setAdditionalImages( $sf_product->get_images() );\n\t\t\t\t}\n\n\t\t\t\t$extra_fields = $sf_product->get_extra_fields();\n\t\t\t\tif ( ! empty( $extra_fields ) ) {\n\t\t\t\t\tforeach ( $extra_fields as $field ) {\n\t\t\t\t\t\tif ( empty( $field['name'] ) ) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$product->setAttribute( $field['name'], $field['value'] );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\t\t);\n\n\t\t//Product with variations mapping\n\t\t$this->generator->addMapper(\n\t\t\tfunction (\n\t\t\t\tarray $sf_product, \\ShoppingFeed\\Feed\\Product\\Product $product\n\t\t\t) {\n\t\t\t\t$sf_product = reset( $sf_product );\n\t\t\t\t/** @var Product $sf_product */\n\n\t\t\t\tif ( empty( $sf_product->get_variations() ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tforeach ( $sf_product->get_variations() as $sf_product_variation ) {\n\t\t\t\t\t$variation = $product->createVariation();\n\n\t\t\t\t\t$variation\n\t\t\t\t\t\t->setReference( $sf_product_variation['sku'] )\n\t\t\t\t\t\t->setPrice( $sf_product_variation['price'] )\n\t\t\t\t\t\t->setQuantity( $sf_product_variation['quantity'] )\n\t\t\t\t\t\t->setGtin( $sf_product_variation['ean'] );\n\n\t\t\t\t\tif ( ! empty( $sf_product_variation['attributes'] ) ) {\n\t\t\t\t\t\t$variation\n\t\t\t\t\t\t\t->setAttributes( $sf_product_variation['attributes'] );\n\t\t\t\t\t}\n\t\t\t\t\tif ( ! empty( $sf_product_variation['discount'] ) ) {\n\t\t\t\t\t\t$variation\n\t\t\t\t\t\t\t->addDiscount( $sf_product_variation['discount'] );\n\t\t\t\t\t}\n\t\t\t\t\tif ( ! empty( $sf_product_variation['image_main'] ) ) {\n\t\t\t\t\t\t$variation\n\t\t\t\t\t\t\t->setMainImage( $sf_product_variation['image_main'] );\n\t\t\t\t\t}\n\t\t\t\t\t$variation_images = $sf_product->get_variation_images( $sf_product_variation['id'] );\n\t\t\t\t\tif ( ! empty( $variation_images ) ) {\n\t\t\t\t\t\t$variation->setAdditionalImages( $variation_images );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}", "abstract protected function getMapping();", "abstract protected function getMapping();", "function __construct() {\n $this->map = array();\n }", "public function getDataMapper() {}", "abstract protected function buildMap();", "public function run()\n {\n $faker = Faker\\Factory::create();\n\n $hotel_types = HotelType::all();\n $company_ids = Company::pluck('id')->all();\n\n foreach ($company_ids as $company_id)\n {\n $num_hotels = $faker->numberBetween(1,4);\n\n for ($i = 0; $i < $num_hotels; ++$i)\n {\n Hotel::create([\n 'company_id' => $company_id,\n 'type_id' => $hotel_types[$faker->numberBetween($min = 0, $max = sizeof($hotel_types) - 1)]->id,\n 'name' => $faker->company(),\n 'country' => $faker->country(),\n 'city' => $faker->city(),\n 'address' => $faker->address(),\n 'postal' => $faker->postcode(),\n 'phone' => $faker->phoneNumber(),\n 'fax' => $faker->phoneNumber(),\n 'email' => $faker->companyEmail(),\n 'rating' => ($faker->numberBetween($min = 0, $max = 50) / 10),\n 'longitude' => $faker->longitude(),\n 'latitude' => $faker->latitude(),\n ]);\n }\n }\n }", "public function __construct() {\n\t\t$this\n\t\t\t->calculateMaxTargets()\n\t\t\t->generateMap()\n\t\t\t->populateMap();\n\t}", "function __construct() {\n\t\t$this->map_data = array();\n\t}", "public function testMap2()\n\t{\n\t\tTestReflection::invoke($this->_state, 'set', 'content.type', 'tag');\n\t\t$a = TestReflection::invoke($this->_instance, 'map', 1, array(5), true);\n\t\t$this->assertEquals(true, $a);\n\n\t\tTestReflection::invoke($this->_state, 'set', 'tags.content_id', '1');\n\t\t$actual = TestReflection::invoke($this->_instance, 'getList');\n\n\t\t$this->assertEquals(1, count($actual));\n\t}", "private function setup() {\n foreach($this->fighters as $i => $fighter) {\n $this->fighters[$i]->instance_id = $i;\n $this->fighter_current = $this->fighters[$i];\n if(!$fighter->abilities) {\n }\n else {\n foreach($fighter->abilities as $ability) {\n if($ability->type == 'passive') {\n $this->useAbility($ability->name);\n }\n }\n }\n }\n $this->fighter_current = $this->fighters[0];\n //TODO: decide start user here\n }", "public function map($mapper);", "public function setUp()\n {\n parent::setUp();\n \n $this->mapper = app()->make(Mapper::class);\n }", "public function testBuildHotel()\n {\n $dbo = new SqlStorage();\n $hotel = new Hotel($dbo);\n $hotel->buildHotel();\n $rooms = new Room($dbo);\n $this->assertCount(4, $rooms->listAllRooms());\n }", "public function autopapperTest($mapper) {\n// $product->setName(\"proudct name\");\n// $product->setFirstname(\"firstname\");\n// $product->setLastname(\"\");\n// $product->setPrice(\"123\");\n //$mapper = new mapper();\n //$product = $this->provider->Product()->find('58aef52f29c39f1413000029');\n// $product->setName(\"proudct name\");\n// get mapper\n // $mapper = $this->container->get('bcc_auto_mapper.mapper');\n// create default map\n $mapper->createMap('AppBundle\\Document\\Profile', 'AppBundle\\Shared\\DTO\\ProductDTO');\n\n// create objects\n $source = new Product();\n $source->firstname = 'Symfony2 developer';\n $destination = new ProductDTO();\n\n// map\n $mapper->map($source, $destination);\n\n echo $destination->description; // outputs 'Symfony2 developer'\n\n exit;\n\n $user = $this->repoProvider->Users()->find($dto->id);\n $this->repoProvider->flush(MapperHelper::getMapper()->dtoToDoc($dto, $user));\n }", "public function getMapping() {}", "public function testMap()\n {\n $subTotalExBonus = $this->salaryRowRepository->getSubTotalPerDayExclBonusBySalaryId(1);\n $subTotalBonus = $this->salaryRowRepository->getSubTotalPerDayBonusBySalaryId(1);\n $subTotalInclBonus = $this->salaryRowRepository->getSubTotalPerDayInclBonusBySalaryId(1);\n\n $salary = SalaryModelMapper::toModelWithSubTotal(\n $this->salaryModel,\n $subTotalExBonus,\n $subTotalBonus,\n $subTotalInclBonus\n );\n\n $this->assertInstanceOf(Collection::class, $salary->getSalaryDays());\n $this->assertInstanceOf(SalaryDayModel::class, $salary->getSalaryDays()->first());\n }", "public function createHotelInstance($hotelAttributes): Hotel\n {\n return (new Hotel)\n ->setName($hotelAttributes['hotel'])\n ->setProvider(static::PROVIDER_NAME)\n ->setFare($hotelAttributes['hotelFare'])\n ->setRate($hotelAttributes['hotelRate'])\n ->setAmenities(explode(',', $hotelAttributes['roomAmenities']));\n }", "abstract protected function getMapper(): MapperInterface;", "protected function getExtractorRegistry() {}", "protected function initLocations(){}", "public function run(Faker $faker){\n\n\n $items = [\n ['id' => 1, 'name' => 'Sunset Key West Resort','description'=>'','rating'=>rand(1,5),'address'=> $faker->address,'image' => 'hotel-'.rand(1,9).'.jpeg'],\n ['id' => 2, 'name' => 'Miami Beach Resort Club','description'=>'','rating'=>rand(1,5),'address'=>$faker->address,'image' => 'hotel-'.rand(1,9).'.jpeg'],\n ['id' => 3, 'name' => 'Best Bay Resort','description'=>'','rating'=>rand(1,5),'address'=>$faker->address,'image' => 'hotel-'.rand(1,9).'.jpeg'],\n ['id' => 4, 'name' => 'Daytona Club Resort','description'=>'','rating'=>rand(1,5),'address'=>$faker->address,'image' => 'hotel-'.rand(1,9).'.jpeg'],\n ['id' => 5, 'name' => 'Miami Private Bay Resort','description'=>'','rating'=>rand(1,5),'address'=>$faker->address,'image' => 'hotel-'.rand(1,9).'.jpeg']\n ];\n\n foreach ($items as $item) {\n \\App\\Hotel::create($item);\n }\n }", "abstract public function map(Router $router);", "public function setUp() {\n $this->cut= newinstance('peer.net.NameserverLookup', array(), '{\n protected $results= array();\n\n public function addLookup($ip, $type= \"ip\") {\n $this->results[]= array($type => $ip);\n }\n\n protected function _nativeLookup($what, $type) {\n return $this->results;\n }\n }');\n }", "public static function getHotels($hotels) {\n $hotelsColeccion = new ArrayCollection();\n\n // Valida que existan hoteles\n if(count($hotels) >= Generalkeys::NUMBER_ONE){\n // Itera los hoteles encontrados\n foreach($hotels as $hotel){\n // Se crea un nuevo objeto para colocal la informacion de cada uno de los hoteles como array\n $hotelTO = new HotelTO();\n\n //Se anexa la informacion\n $hotelTO->setId($hotel['id']);\n $hotelTO->setNombreHotel($hotel['nombrehotel']);\n $hotelTO->setDescripcion(StringUtils::cutText($hotel['descripcion'], Generalkeys::NUMBER_ZERO, Generalkeys::NUMBER_TWO_HUNDRED, Generalkeys::COLILLA_TEXT, Generalkeys::CIERRE_HTML_P));\n $tarifa = self::getTotalRate($hotel['tarifa'], $hotel['ish'], $hotel['markup'], $hotel['iva'], $hotel['fee'], $hotel['aplicaimpuesto']);\n $hotelTO->setTarifa(number_format(ceil($tarifa)));\n $hotelTO->setSimboloMoneda($hotel['simbolo']);\n $hotelTO->setEstrellas($hotel['estrellas']);\n // Valida imagen hotel si es null coloca imagen not found de lo contrario coloca la imagen\n if(is_null($hotel['imagen'])){\n $hotelTO->setPrincipalImage(Generalkeys::PATH_IMAGE_NOT_FOUND);\n }else{\n $hotelTO->setPrincipalImage($hotel['imagen']);\n }\n\n //Se agrega el objeto a la coleccion\n $hotelsColeccion->add($hotelTO);\n }\n }\n return $hotelsColeccion;\n }", "protected function setUp() {\n $this->object = new InformationPackageMap;\n }", "protected function _setupMapperArray()\n\t{\n\t\t$this->mapperArray = array();\n\t\t\n\t\t$this->mapperArray['property_id'] = 'properties_id';\n\t\t$this->mapperArray['sort_order'] = 'sort_order';\n\t\t\n\t\t$this->mapperArray['name'] = 'properties_name';\n\t\t$this->mapperArray['admin_name'] = 'properties_admin_name';\n\t}", "private function mapElements(){\n $aux = '';\n if(!empty($this->category_list)){\n foreach($this->category_list as $c) {\n $category = new Category();\n $category->loadTaggedElement($c);\n $aux[] = $category; \n }\n $this->category_list = $aux;\n }\n $aux = '';\n if(!empty($this->user_category_list)) {\n foreach($this->user_category_list as $u) {\n $user_category = new Category();\n $user_category->loadTaggedElement($u);\n $aux[] = $user_category;\n }\n $this->user_category_list = $aux;\n } \n $aux = '';\n if(!empty($this->entity_list)){\n foreach($this->entity_list as $e) {\n $entity = new Entity();\n $entity->loadTaggedElement($e);\n $aux[] = $entity;\n }\n $this->entity_list = $aux;\n }\n $aux = '';\n if(!empty($this->concept_list)){\n foreach($this->concept_list as $c) {\n $concept = new Concept();\n $concept->loadTaggedElement($c);\n $aux[] = $concept;\n }\n $this->concept_list = $aux;\n }\n $aux = '';\n if(!empty($this->time_expression_list)){\n foreach($this->time_expression_list as $t)\n $aux[] = new TimeExpression($t);\n $this->time_expression_list = $aux;\n }\n $aux = '';\n if(!empty($this->money_expression_list)){\n foreach($this->money_expression_list as $m)\n $aux[] = new MoneyExpression($m);\n $this->money_expression_list = $aux;\n }\n $aux = '';\n if(!empty($this->uri_list)){\n foreach($this->uri_list as $u)\n $aux[] = new URI($u);\n $this->uri_list = $aux;\n }\n $aux = '';\n if(!empty($this->phone_expression_list)){\n foreach($this->phone_expression_list as $p)\n $aux[] = new PhoneExpression($p);\n $this->phone_expression_list = $aux;\n } \n $aux = '';\n if(!empty($this->quotation_list)){\n foreach($this->quotation_list as $p)\n $aux[] = new Quotation($p);\n $this->quotation_list = $aux;\n } \n $aux = '';\n if(!empty($this->issue_list)) {\n foreach($this->issue_list as $i)\n $aux[] = new Issue($i);\n $this->issue_list = $aux;\n }\n }", "private function setupMapping()\n {\n $this->mapping = array();\n $fields = array();\n\n $aliases = array_keys($this->getJoinSettings());\n\n foreach ($aliases as $i => $alias) {\n $fields = array_merge($fields, $this->mapAlias($alias));\n }\n\n $this->mapping['fields'] = array_replace_recursive($fields, $this->getCustomMapping());\n $this->mapping['joins'] = $this->getJoinSettings();\n }", "function __construct () {\n parent::__construct();\n\n $temp = json_decode ($this -> planes -> all (), true);\n \n $ap = -1;\n \n // Iterate through each record in associate array and check if type matches plane in fleet\n // assigns a plane to the fleet if it's name matches the selected planes\n foreach ($temp as $key => $record) {\n $check = false;\n if (!empty ($record[\"id\"])) {\n $check = true;\n switch ($record[\"id\"]) {\n case \"avanti\" :\n break;\n case \"caravan\" :\n break;\n default :\n $check = false;\n }\n if ($check) {\n ++$ap;\n $this -> data[\"a$ap\"] = $record;\n }\n }\n }\n \n\n }", "public function __construct(HotelRepository $hotelRepository) {\n $this->hotelRepository = $hotelRepository;\n }", "public static function loadStrapper() {\n\t\t\n\t}", "abstract protected function initializeMappedTypes();", "public function setUp()\n {\n $this->VenusFuelDepot = new VenusFuelDepot();\n }", "public function map()\n {\n //panel\n $this->mapPanelRoutes();\n //auth\n $this->mapAuthRoutes();\n //almacen\n $this->mapInventoryRoutes();\n //contabilidad\n $this->mapAccountingRoutes();\n //Recursos Humanos\n $this->mapHumanResourceRoutes();\n //ventas\n $this->mapSaleRoutes();\n\n $this->mapApiRoutes();\n\n //\n }", "public function run()\n {\n for ($x = 1; $x < 6; $x++) {\n factory(Geolocation::class, 1)->create([\n 'taggable_id' => $x,\n 'taggable_type' => 'JobSeeker',\n ]);\n }\n\n for ($x = 1; $x < 11; $x++) {\n factory(Geolocation::class, 1)->create([\n 'taggable_id' => $x,\n 'taggable_type' => 'Job',\n ]);\n }\n\n for ($x = 1; $x < 6; $x++) {\n factory(Geolocation::class, 1)->create([\n 'taggable_id' => $x,\n 'taggable_type' => 'Company',\n ]);\n }\n }", "public function output(){\n // then use ExpandManiPulator::union($hotelsArray)\n }", "protected function get_class_mapper() {\n\t\t$class_mapper = array();\n\n\t\t/*\n\t\t * rsvp\n\t\t * @link https://indieweb.org/rsvp\n\t\t */\n\t\t$class_mapper['rsvp'] = 'rsvp';\n\n\t\t/*\n\t\t * invite\n\t\t * @link https://indieweb.org/invitation\n\t\t */\n\t\t$class_mapper['invitee'] = 'invite';\n\n\t\t/*\n\t\t * repost\n\t\t * @link https://indieweb.org/repost\n\t\t */\n\t\t$class_mapper['repost'] = 'repost';\n\t\t$class_mapper['repost-of'] = 'repost';\n\n\t\t/*\n\t\t * likes\n\t\t * @link https://indieweb.org/likes\n\t\t */\n\t\t$class_mapper['like'] = 'like';\n\t\t$class_mapper['like-of'] = 'like';\n\n\t\t/*\n\t\t * favorite\n\t\t * @link https://indieweb.org/favorite\n\t\t */\n\t\t$class_mapper['favorite'] = 'favorite';\n\t\t$class_mapper['favorite-of'] = 'favorite';\n\n\t\t/*\n\t\t * bookmark\n\t\t * @link https://indieweb.org/bookmark\n\t\t */\n\t\t$class_mapper['bookmark'] = 'bookmark';\n\t\t$class_mapper['bookmark-of'] = 'bookmark';\n\n\t\t/*\n\t\t * tag\n\t\t * @link https://indieweb.org/tag\n\t\t */\n\t\t$class_mapper['tag-of'] = 'tag';\n\t\t$class_mapper['category'] = 'tag';\n\n\t\t/*\n\t\t * read\n\t\t * @link https://indieweb.org/read\n\t\t */\n\t\t$class_mapper['read-of'] = 'read';\n\t\t$class_mapper['read'] = 'read';\n\n\t\t/*\n\t\t * listen\n\t\t * @link https://indieweb.org/listen\n\t\t */\n\t\t$class_mapper['listen-of'] = 'listen';\n\t\t$class_mapper['listen'] = 'listen';\n\n\t\t/*\n\t\t * watch\n\t\t * @link https://indieweb.org/watch\n\t\t */\n\t\t$class_mapper['watch-of'] = 'watch';\n\t\t$class_mapper['watch'] = 'watch';\n\n\t\t/*\n\t\t * follow\n\t\t * @link https://indieweb.org/follow\n\t\t */\n\t\t$class_mapper['follow-of'] = 'follow';\n\n\t\t/*\n\t\t * replies\n\t\t * @link https://indieweb.org/replies\n\t\t */\n\t\t$class_mapper['in-reply-to'] = 'comment';\n\t\t$class_mapper['reply'] = 'comment';\n\t\t$class_mapper['reply-of'] = 'comment';\n\n\t\treturn apply_filters( 'webmention_mf2_class_mapper', $class_mapper );\n\t}", "function __construct()\n { parent::__construct('maps', 'animals');\n }", "public function setUp()\n {\n $this->locationRepository = $this->getMockBuilder(\n 'Elcodi\\Component\\Geo\\Repository\\LocationRepository'\n )\n ->disableOriginalConstructor()\n ->getMock();\n\n $this->locationToLocationDataTransformer = $this->getMockBuilder(\n 'Elcodi\\Component\\Geo\\Transformer\\LocationToLocationDataTransformer'\n )\n ->disableOriginalConstructor()\n ->getMock();\n\n $this->locationServiceProviderAdapter = new LocationServiceProviderAdapter(\n $this->locationRepository,\n $this->locationToLocationDataTransformer\n );\n }", "public function __construct()\n {\n $this->locationDAL = new LocationDAL();\n $this->locationAPI = new LocationAPI();\n $this->forecastDAL = new ForecastDAL();\n $this->forecastAPI = new ForecastAPI();\n }", "public function map()\n {\n $this->mapRoutes();\n\n $this->mapWebRoutes();\n\n //\n }", "public function run()\n {\n \n\n \\DB::table('hotels')->delete();\n \n \\DB::table('hotels')->insert(array (\n 0 => \n array (\n 'id' => 17,\n 'name' => 'Ellswerth Cuttings',\n 'email' => '[email protected]',\n 'phone' => '927-157-8145',\n 'address' => '105 Kropf Avenue',\n 'image' => 'https://images.pexels.com/photos/338504/pexels-photo-338504.jpeg?auto=compress&cs=tinysrgb&dpr=3&h=750&w=1260',\n 'longitude' => 74.4084733,\n 'latitude' => 31.5689437,\n 'created_at' => NULL,\n 'updated_at' => NULL,\n ),\n 1 => \n array (\n 'id' => 18,\n 'name' => 'Wilton Bacchus',\n 'email' => '[email protected]',\n 'phone' => '822-299-5316',\n 'address' => '5120 Schiller Crossing',\n 'image' => 'https://images.pexels.com/photos/1458457/pexels-photo-1458457.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500',\n 'longitude' => 74.3975118,\n 'latitude' => 31.5565128,\n 'created_at' => NULL,\n 'updated_at' => NULL,\n ),\n 2 => \n array (\n 'id' => 19,\n 'name' => 'Moreen Autrie',\n 'email' => '[email protected]',\n 'phone' => '233-261-4295',\n 'address' => '360 Lakewood Circle',\n 'image' => 'https://images.pexels.com/photos/1386168/pexels-photo-1386168.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940',\n 'longitude' => 74.3993637,\n 'latitude' => 31.5573682,\n 'created_at' => NULL,\n 'updated_at' => NULL,\n ),\n 3 => \n array (\n 'id' => 20,\n 'name' => 'Joane Clerke',\n 'email' => '[email protected]',\n 'phone' => '854-315-8252',\n 'address' => '84 Vahlen Pass',\n 'image' => 'https://images.pexels.com/photos/2394446/pexels-photo-2394446.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500',\n 'longitude' => 74.4017972,\n 'latitude' => 31.5597671,\n 'created_at' => NULL,\n 'updated_at' => NULL,\n ),\n 4 => \n array (\n 'id' => 21,\n 'name' => 'Denice Mease',\n 'email' => '[email protected]',\n 'phone' => '419-336-9413',\n 'address' => '9293 Elgar Junction',\n 'image' => 'https://images.pexels.com/photos/2540653/pexels-photo-2540653.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940',\n 'longitude' => 74.3945268,\n 'latitude' => 31.5649515,\n 'created_at' => NULL,\n 'updated_at' => NULL,\n ),\n 5 => \n array (\n 'id' => 22,\n 'name' => 'Maximo Macieiczyk',\n 'email' => '[email protected]',\n 'phone' => '988-774-0374',\n 'address' => '8122 Loeprich Lane',\n 'image' => 'https://images.pexels.com/photos/3285716/pexels-photo-3285716.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500',\n 'longitude' => 74.4040478,\n 'latitude' => 31.5666545,\n 'created_at' => NULL,\n 'updated_at' => NULL,\n ),\n 6 => \n array (\n 'id' => 23,\n 'name' => 'Rhoda Spittal',\n 'email' => '[email protected]',\n 'phone' => '525-639-9885',\n 'address' => '450 Farmco Crossing',\n 'image' => 'https://images.pexels.com/photos/3075763/pexels-photo-3075763.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940',\n 'longitude' => 74.4031113,\n 'latitude' => 31.5670675,\n 'created_at' => NULL,\n 'updated_at' => NULL,\n ),\n 7 => \n array (\n 'id' => 24,\n 'name' => 'Jerad Angliss',\n 'email' => '[email protected]',\n 'phone' => '180-109-8288',\n 'address' => '1470 Barnett Road',\n 'image' => 'https://images.pexels.com/photos/2867903/pexels-photo-2867903.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500',\n 'longitude' => 74.3923061,\n 'latitude' => 31.5684959,\n 'created_at' => NULL,\n 'updated_at' => NULL,\n ),\n 8 => \n array (\n 'id' => 25,\n 'name' => 'Polly Emblin',\n 'email' => '[email protected]',\n 'phone' => '273-767-5415',\n 'address' => '5053 Jenna Trail',\n 'image' => 'https://images.pexels.com/photos/1135380/pexels-photo-1135380.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940',\n 'longitude' => 74.398497,\n 'latitude' => 31.5698297,\n 'created_at' => NULL,\n 'updated_at' => NULL,\n ),\n 9 => \n array (\n 'id' => 26,\n 'name' => 'Avis Metzig',\n 'email' => '[email protected]',\n 'phone' => '928-979-1982',\n 'address' => '5609 Merchant Drive',\n 'image' => 'https://images.pexels.com/photos/164595/pexels-photo-164595.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940',\n 'longitude' => 74.4065071,\n 'latitude' => 31.5674701,\n 'created_at' => NULL,\n 'updated_at' => NULL,\n ),\n 10 => \n array (\n 'id' => 27,\n 'name' => 'Reed Sawdon',\n 'email' => '[email protected]',\n 'phone' => '595-196-9096',\n 'address' => '33 Quincy Court',\n 'image' => 'http://dummyimage.com/381x302.jpg/ff4444/ffffff',\n 'longitude' => 74.408151,\n 'latitude' => 31.5641786,\n 'created_at' => NULL,\n 'updated_at' => NULL,\n ),\n 11 => \n array (\n 'id' => 28,\n 'name' => 'Imogen Drinnan',\n 'email' => '[email protected]',\n 'phone' => '964-942-4423',\n 'address' => '185 Drewry Circle',\n 'image' => 'http://dummyimage.com/354x400.jpg/dddddd/000000',\n 'longitude' => 74.4025463,\n 'latitude' => 31.473741,\n 'created_at' => NULL,\n 'updated_at' => NULL,\n ),\n 12 => \n array (\n 'id' => 29,\n 'name' => 'Larisa Elmar',\n 'email' => '[email protected]',\n 'phone' => '421-960-2362',\n 'address' => '5981 4th Place',\n 'image' => 'http://dummyimage.com/323x369.jpg/5fa2dd/ffffff',\n 'longitude' => 74.4021603,\n 'latitude' => 31.4738106,\n 'created_at' => NULL,\n 'updated_at' => NULL,\n ),\n 13 => \n array (\n 'id' => 30,\n 'name' => 'Filberte Blaydon',\n 'email' => '[email protected]',\n 'phone' => '137-105-9645',\n 'address' => '0 Lukken Drive',\n 'image' => 'http://dummyimage.com/349x360.jpg/cc0000/ffffff',\n 'longitude' => 74.4016828,\n 'latitude' => 31.4735766,\n 'created_at' => NULL,\n 'updated_at' => NULL,\n ),\n 14 => \n array (\n 'id' => 31,\n 'name' => 'Felisha Siggins',\n 'email' => '[email protected]',\n 'phone' => '734-141-5835',\n 'address' => '7887 Ludington Alley',\n 'image' => 'http://dummyimage.com/305x368.jpg/cc0000/ffffff',\n 'longitude' => 74.4012708,\n 'latitude' => 31.4743586,\n 'created_at' => NULL,\n 'updated_at' => NULL,\n ),\n ));\n \n \n }", "public function run()\n {\n // Map Commodities\n $commodities_map = [\n 'Construction/Maintenance/Home' => Commodity::where('name', 'Construction/Maintenance')->first(),\n 'Business/Finance' => Commodity::where('name', 'Business/Finance')->first(),\n 'Real' => Commodity::where('name', 'Real Estate')->first(),\n 'Transportation/Travel' => Commodity::where('name', 'Transportation')->first(),\n 'Education/Training' => Commodity::where('name', 'Education/Training')->first(),\n 'Restaurant/Food' => Commodity::where('name', 'Restaurant/Food')->first(),\n 'Clothing/Apparel' => Commodity::where('name', 'Retail')->first(),\n 'Technology' => Commodity::where('name', 'Technology')->first(),\n 'Arts/Entertainment' => Commodity::where('name', 'Arts/Entertainment')->first(),\n 'Automotive' => Commodity::where('name', 'Automotive')->first(),\n 'Industrial' => Commodity::where('name', 'Industrial Goods/Services')->first(),\n 'Legal' => Commodity::where('name', 'Legal')->first(),\n 'Retail/Wholesale' => Commodity::where('name', 'Retail')->first(),\n 'Medical/Health' => Commodity::where('name', 'Medical/Healthcare')->first(),\n 'Wedding/Crafts' => Commodity::where('name', 'Wedding/Crafts')->first(),\n 'Babies/Children' => Commodity::where('name', 'Babies/Children')->first(),\n 'Hospitality' => Commodity::where('name', 'Hospitality')->first(),\n 'Insurance' => Commodity::where('name', 'Insurance')->first(),\n ];\n\n // Map Entrepreneur Categories\n $categories_map = [\n 'African American' => ECategory::where('name', 'Blackpreneur')->first(),\n 'Caucasian' => ECategory::where('name', 'Caucasianpreneur')->first(),\n 'Asian American' => ECategory::where('name', 'Asianpreneur')->first(),\n 'Latino American' => ECategory::where('name', 'Latinopreneur')->first(),\n 'Native American' => ECategory::where('name', 'Nativepreneur')->first(),\n ];\n\n\n // Log\n $log = new Logger('seeder');\n $log->pushHandler(new StreamHandler('logs/seeder.log', Logger::INFO));\n $log->info('Beginning IN business seed');\n\n // Counts\n $successful = 0;\n $failed = 0;\n\n // Parse CSV\n $csv = new parseCSV('database/seeds/data/IN_Business.csv');\n foreach ($csv->data as $key => $data) {\n $log->info('Importing '. $data['Company Name']);\n\n // Verify req'd fields\n if(\n !$data['Company Name'] || !$data['Physical Address'] ||\n !$data['City'] || !$data['State'] || !$data['Zip Code'] ||\n !$data['Commodity'] || !$data['Ethnicity'] || $data['Ethnicity'] === \"OTH\"\n ){\n $log->error('Fields missing, aborting import of row');\n $failed++;\n continue;\n }\n\n // Set values\n $business = new Business;\n $business->user_id = env('APP_SUPERUSER');\n $business->name = $data['Company Name'];\n $business->address = $data['Physical Address'];\n $business->address_two = \"\";\n $business->city = $data['City'];\n $business->state = $data['State'];\n $business->zip = $data['Zip Code'];\n $business->phone = $data['Phone'];\n $business->description = \"Certification Type: \".$data['Certification Type'];\n\n // Generate slug and geocode location\n $business->generateSlug();\n $geocode_result = $business->geocodeAddress();\n\n // If geocode fails, skip\n if(!$geocode_result){\n $log->error('Geocoding failed, aborting import of row');\n $failed++;\n continue;\n }\n\n // Create commodity association\n $log->info('Creating commidity association for '.$data['Commodity']);\n $commodity_name = explode(\" \", $data['Commodity'])[0];\n $commodity_link = new CommodityLink;\n $commodity_id = @$commodities_map[$commodity_name]->id;\n if(!$commodity_id){\n $log->error('Commodity type unknown, aborting import of row');\n $failed++;\n continue;\n }\n $commodity_link->commodity_id = $commodity_id;\n\n // Create entrepreneur category association\n $log->info('Creating category association for '.$data['Ethnicity']);\n $category_link = new ECategoryLink;\n $category_id = @$categories_map[$data['Ethnicity']]->id;\n if(!$category_id){\n $log->error('Category type unknown, aborting import of row');\n $failed++;\n continue;\n }\n $category_link->e_category_id = $category_id;\n\n // Save business and associations\n $log->info('Saving business and associations');\n $business->save();\n $business->e_categories()->save($category_link);\n $business->commodities()->save($commodity_link);\n\n $log->info('Record successfully imported!');\n $successful++;\n }\n $log->info(\"Import complete. $successful successfully imported, $failed failed.\");\n }", "public function getHotels(){\n\n if (isset($_GET) && !empty($_GET)) {\n\n $validUrl = $this->targetUrl.$this->getParameters(); // create full Url (target Url string + parameters String) \n\n $response = $this->getResponse($validUrl); //call function that sent request and return response & save the result in $response .\n\n return $this->responseHandler($response); // call function that checking the response ,and return array of offers .\n\n }else{\n return false; \n }\n }", "public function getVariantsMap()\n {\n $this->assertSame($this->mockVariantsMap, $this->abstractVariantFactory->getVariantsMap());\n }", "function iems_StageMap()\n {\n self::__construct();\n }", "private function _populate()\n {\n // populate Rgion\n foreach ($this->regionData as $region)\n {\n $this->region->create(\n $region['name'],\n $region['promotor_ID']\n );\n }\n \n // Populate branch\n foreach ($this->branchData as $branch)\n {\n $this->branch->create(\n $branch['name'],\n $branch['region_ID'],\n $branch['promotor_ID']\n );\n }\n\n // Popular Dealer \n foreach ($this->dealerData as $dealer)\n { \n $data = [\n 'region_ID' => $dealer['region_ID'],\n 'branch_ID' => $dealer['branch_ID'],\n 'dealer_account_ID' => $dealer['dealer_account_ID'],\n 'dealer_channel_ID' => $dealer['dealer_channel_ID'],\n 'dealer_type_ID' => $dealer['dealer_type_ID'],\n 'code' => $dealer['code'],\n 'name' => $dealer['name'],\n 'company' => $dealer['company'],\n 'address' => $dealer['address']\n ];\n\n $this->dealer->create($data);\n }\n\n foreach ($this->dealerChannelData as $dealerChannel)\n {\n $this->dealerChannel->create(\n $dealerChannel['name']\n );\n }\n\n // Populate dealer account\n foreach ($this->dealerAccountData as $dealerAccount)\n {\n $this->dealerAccount->create(\n $dealerAccount['name'],\n $dealerAccount['branch_ID'],\n $dealerAccount['promotor_ID']\n );\n }\n\n //Populate token\n foreach ($this->tokenData as $token)\n {\n $this->token->create(\n $token['dashboard_account_ID'],\n $token['token']\n );\n }\n\n // Populate promotor\n foreach ($this->promotorData as $promotor)\n { \n $this->promotor->create(\n $promotor['dealer_ID'],\n $promotor['phone'],\n $promotor['password'],\n $promotor['name'],\n $promotor['gender'],\n $promotor['type'],\n $promotor['parent_ID']\n );\n }\n\n // Populate report\n foreach ($this->reportData as $data)\n {\n return $this->report->create($data);\n\n }\n \n // Populate dashboard \n $accountIDs = [];\n\n foreach ($this->accountData as $account)\n {\n $accountIDs[] = $this->account->create(\n $account['email'],\n $account['name'],\n $account['last_access']\n );\n }\n\n return $accountIDs;\n }", "function unit_map_function(&$data, $maps) {\n // idia symbash/paradoxh me to attendance_gradebook_activities_map_function()\n // des to ekei comment gia ta spasmena FKs\n list($document_map, $link_category_map, $link_map, $ebook_map, $section_map, $subsection_map, $video_map, $videolink_map, $video_category_map, $lp_learnPath_map, $wiki_map, $assignments_map, $exercise_map, $forum_map, $forum_topic_map, $poll_map) = $maps;\n if ($data['type'] == 'videolinks') {\n $data['type'] == 'videolink';\n }\n if (isset($data['course_weekly_view_id'])) {\n $data['unit_id'] = $data['course_weekly_view_id'];\n unset($data['unit_id']);\n }\n $type = $data['type'];\n if ($type == 'doc') {\n $data['res_id'] = @$document_map[$data['res_id']];\n } elseif ($type == 'linkcategory') {\n $data['res_id'] = @$link_category_map[$data['res_id']];\n } elseif ($type == 'link') {\n $data['res_id'] = @$link_map[$data['res_id']];\n } elseif ($type == 'ebook') {\n $data['res_id'] = @$ebook_map[$data['res_id']];\n } elseif ($type == 'section') {\n $data['res_id'] = @$section_map[$data['res_id']];\n } elseif ($type == 'subsection') {\n $data['res_id'] = @$subsection_map[$data['res_id']];\n } elseif ($type == 'description') {\n $data['res_id'] = intval($data['res_id']);\n } elseif ($type == 'video') {\n $data['res_id'] = @$video_map[$data['res_id']];\n } elseif ($type == 'videolink') {\n $data['res_id'] = @$videolink_map[$data['res_id']];\n } elseif ($type == 'videolinkcategory') {\n $data['res_id'] = @$video_category_map[$data['res_id']];\n } elseif ($type == 'lp') {\n $data['res_id'] = @$lp_learnPath_map[$data['res_id']];\n } elseif ($type == 'wiki') {\n $data['res_id'] = @$wiki_map[$data['res_id']];\n } elseif ($type == 'work') {\n if (isset($assignments_map[$data['res_id']])) {\n $data['res_id'] = @$assignments_map[$data['res_id']];\n } else {\n $data['res_id'] = $assignments_map[0];\n }\n } elseif ($type == 'exercise') {\n if (isset($exercise_map[$data['res_id']])) {\n $data['res_id'] = @$exercise_map[$data['res_id']];\n } else {\n $data['res_id'] = $exercise_map[0];\n }\n } elseif ($type == 'forum') {\n $data['res_id'] = @$forum_map[$data['res_id']];\n } elseif ($type == 'topic') {\n $data['res_id'] = @$forum_topic_map[$data['res_id']];\n } elseif ($type == 'poll') {\n $data['res_id'] = @$poll_map[$data['res_id']];\n }\n return true;\n}", "public function useCustomMapper(MapperInterface $mapper): void;", "public function forge()\n {\n array_map(function($driver) {\n\n $driver = StringParser::sanitize($driver);\n\n $this->crucible->create(new Templates\\DriverClass($driver));\n\n }, $this->crucible->parameters->getDrivers());\n }", "public function map()\n {\n $this->mapServiceRoutes();\n }", "private function map_index() {\n\t\t// self::getRoute('Amarr','Jita');\n\t\tif (!isset($_GET['reg'])) {\n\t\t\t$jumps = db::query(\"SELECT DISTINCT `rfrom`.`name` as `fromName`, `rto`.`name` as `toName`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM `gates` as `g`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tJOIN `systems` as `from` ON (`g`.`from` = `from`.`id`)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tJOIN `systems` as `to` ON (`g`.`to` = `to`.`id`)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tJOIN `regions` as `rfrom` ON (`rfrom`.`id` = `from`.`regionID`)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tJOIN `regions` as `rto` ON (`rto`.`id` = `to`.`regionID`)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `rfrom`.`name` != `rto`.`name`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND `rfrom`.`id` NOT IN (10000004, 10000017, 10000019)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND `rto`.`id` NOT IN (10000004, 10000017, 10000019);\");\n\t\t\t$dots = db::query(\"SELECT `id`, `name`, `pos_x`, `pos_y`, `pos_z` FROM `regions` WHERE `id` < 11000000 AND `id` NOT IN (10000004, 10000017, 10000019);\");\n\t\t\tforeach ($jumps as $jump) {\n\t\t\t\t$routeDots[ $jump['fromName'] ][ $jump['toName'] ] = 1;\n\t\t\t}\n\t\t\t$map = array('dots' => $dots, 'jumps' => $jumps, 'routeDots' => $routeDots);\n\t\t} else {\n\t\t\t$map = universe::getRegionMap($_GET['reg']);\n\t\t}\n\t\t\n\t\t$regionList = db::query(\"SELECT `id`, `name` FROM `regions` WHERE `id` < 11000000 ORDER BY `name`;\");\n\t\t$regstr = '<select name=\"region\" id=\"mapRegion\"><option value=\"0\">&mdash;&mdash;&mdash;Выберите регион&mdash;&mdash;&mdash;</option>';\n\t\tforeach ($regionList as $region) {\n\t\t\tif ($region['name'] == @$_GET['reg']) $sel = 'selected';\n\t\t\t\telse $sel = '';\n\t\t\t$regstr .= '<option ' . $sel . ' value=\"' . $region['id'] . '\">' . $region['name'] . '</option>';\n\t\t}\n\t\t$regstr .= '</select>';\n\t\t$mainsupport = '\n\t\t\t<div id=\"control\">\n\t\t\t\t<div class=\"startx\"></div>\n\t\t\t\t<div class=\"x\"></div>\n\t\t\t\t<div class=\"starty\"></div>\n\t\t\t\t<div class=\"y\"></div>\n\t\t\t\t' . $regstr . '\n\t\t\t\t<input type=\"button\" value=\"Отрисовать\" id=\"drawMap\">\n\t\t\t\t<input type=\"button\" value=\"К карте вселенной\" id=\"resetMap\">\n\t\t\t</div>\n\t\t\t<input type=\"text\" class=\"systemSearch\" data-searchmod=\"info\" id=\"systemInfo\" placeholder=\"Информация о системе\" size=\"25\">\n\t\t\t<div id=\"strForMap\">' . json_encode($map) . '</div>\n\t\t\t';\n\t\t$maincontent = '\n\t\t\t<form id=\"pathfinder\" method=\"GET\">\n\t\t\t\t<input type=\"text\" class=\"systemSearch\" data-searchmod=\"path\" id=\"fromSystem\" name=\"from\" placeholder=\"Отправная точка\" autocomplete=\"off\">\n\t\t\t\t<input type=\"text\" class=\"systemSearch\" data-searchmod=\"path\" id=\"toSystem\" name=\"to\" placeholder=\"Пункт назначения\" autocomplete=\"off\">\n\t\t\t\t' . (isset($_GET['reg']) ? '<input type=\"hidden\" name=\"reg\" value=\"' . $_GET['reg'] . '\">' : '') . '\n\t\t\t\t<input type=\"submit\" id=\"submitPath\" disabled value=\"Проложить путь\">\n\t\t\t\t<div id=\"systemSearchVariants\" class=\"mapSSV\">ololo</div>\n\t\t\t</form>';\n\t\t\n\t\troot::$_ALL['maincaption'] = 'EVE Universe Map';\n\t\troot::$_ALL['mainsupport'] = $mainsupport;\n\t\troot::$_ALL['maincontent'] = $maincontent;\n\t\troot::$_ALL['backtrace'][] = 'initialized map/index';\n\t}", "function attemptMapping($input, $output)\r\n\t{\r\n\t\t//Copy pasted from AdapterAction\r\n\t\t$target = $output;\r\n $lpos = strrpos($target, \".\");\r\n if ($lpos === false) {\r\n $classname = $target;\r\n\t\t\t$uriclasspath = $target . \".php\";\r\n $classpath = $this->_basecp . $target . \".php\";\r\n } else {\r\n $classname = substr($target, $lpos + 1);\r\n $classpath = $this->_basecp . str_replace(\".\", \"/\", $target) . \".php\"; // removed to strip the basecp out of the equation here\r\n \t$uriclasspath = str_replace(\".\", \"/\", $target) . \".php\"; // removed to strip the basecp out of the equation here\r\n\t\t}\r\n\t\t\r\n\t\t//Let's try to instantiate the class\r\n\t\t\r\n\t\tchdir(dirname($classpath)); // now change to the directory of the classpath. Possible relative to gateway.php\r\n $fileIncluded = @include_once(\"./\" . basename($classpath)); // include the class file\r\n $fileExists = @file_exists(basename($classpath)); // see if the file exists\r\n \r\n if (!class_exists($classname)) { // Just make sure the class name is the same as the file name\r\n if ($fileExists) { // file exists probably with errors\r\n $ex = new AMFException(E_USER_ERROR, \"The mapped class {\" . $classname . \"} could not be loaded. The class file exists but may contain syntax errors.\", __FILE__, __LINE__);\r\n AMFException::throwException($this->bodyObj, $ex);\r\n return;\r\n } else {\r\n $ex = new AMFException(E_USER_ERROR, \"The mapped class {\" . $classname . \"} could not be found under the class path {\" . $classpath . \"}\", __FILE__, __LINE__);\r\n AMFException::throwException($this->bodyObj, $ex);\r\n return;\r\n } \r\n return $input;\r\n }\r\n else\r\n {\r\n\t\t\t//Instantiate new class\r\n\t\t\t$mapped = new $classname();\r\n\t\t\tif(is_array($input))\r\n\t\t\t{\r\n\t\t\t\tforeach($input as $key => $value)\r\n\t\t\t\t{\r\n\t\t\t\t\tif($key != '_explicitType')\r\n\t\t\t\t\t{\t\r\n\t\t\t\t\t\t//Input values\r\n\t\t\t\t\t\t$mapped->$key = $value;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn $mapped;\r\n\t\t}\r\n\t}", "protected function _initMap()\n {\n // admin >> system settings >> cron & urls >> map database fields\n\n $this->_tableMap['sl_candidate']['sl_candidatepk'] = array('controls' => array('is_key(%) || is_null(%)'));\n $this->_tableMap['sl_candidate']['date_created'] = array('controls'=>array('is_datetime(%)'),'type'=>'datetime');\n $this->_tableMap['sl_candidate']['created_by'] = array('controls'=>array('is_integer(%)'),'type'=>'int');\n $this->_tableMap['sl_candidate']['statusfk'] = array('controls'=>array('is_integer(%)'),'type'=>'int');\n $this->_tableMap['sl_candidate']['sex'] = array('controls'=> array('is_integer(%)'),'type'=>'int');\n $this->_tableMap['sl_candidate']['firstname'] = array('controls'=> array('!empty(%)'));\n $this->_tableMap['sl_candidate']['lastname'] = array('controls'=> array('!empty(%)'));\n $this->_tableMap['sl_candidate']['nationalityfk'] = array('controls'=>array('is_integer(%)'),'type'=>'int');\n $this->_tableMap['sl_candidate']['languagefk'] = array('controls'=>array('is_integer(%)'),'type'=>'int');\n $this->_tableMap['sl_candidate']['locationfk'] = array('controls'=>array('is_integer(%)'),'type'=>'int');\n $this->_tableMap['sl_candidate']['play_date'] = array('controls'=>array('empty(%) || is_datetime(%)'),'type'=>'datetime');\n $this->_tableMap['sl_candidate']['play_for'] = array('controls'=>array('is_null(%) || is_integer(%)'),'type'=>'int');\n $this->_tableMap['sl_candidate']['rating'] = array('controls'=>array('is_numeric(%)'),'type'=>'float');\n $this->_tableMap['sl_candidate']['date_birth'] = array('controls'=>array('(% == \"NULL\") || is_date(%)'),'type'=>'date');\n $this->_tableMap['sl_candidate']['is_birth_estimation'] = array('controls'=>array('is_integer(%)'),'type'=>'int');\n $this->_tableMap['sl_candidate']['is_client'] = array('controls'=>array('is_integer(%)'),'type'=>'int');\n $this->_tableMap['sl_candidate']['cpa'] = array('controls'=>array('is_integer(%)'),'type'=>'int');\n $this->_tableMap['sl_candidate']['mba'] = array('controls'=>array('is_integer(%)'),'type'=>'int');\n $this->_tableMap['sl_candidate']['skill_ag'] = array('controls'=>array(),'type'=>'int');\n $this->_tableMap['sl_candidate']['skill_ap'] = array('controls'=>array(),'type'=>'int');\n $this->_tableMap['sl_candidate']['skill_am'] = array('controls'=>array(),'type'=>'int');\n $this->_tableMap['sl_candidate']['skill_mp'] = array('controls'=>array(),'type'=>'int');\n $this->_tableMap['sl_candidate']['skill_in'] = array('controls'=>array(),'type'=>'int');\n $this->_tableMap['sl_candidate']['skill_ex'] = array('controls'=>array(),'type'=>'int');\n $this->_tableMap['sl_candidate']['skill_fx'] = array('controls'=>array(),'type'=>'int');\n $this->_tableMap['sl_candidate']['skill_ch'] = array('controls'=>array(),'type'=>'int');\n $this->_tableMap['sl_candidate']['skill_ed'] = array('controls'=>array(),'type'=>'int');\n $this->_tableMap['sl_candidate']['skill_pl'] = array('controls'=>array(),'type'=>'int');\n $this->_tableMap['sl_candidate']['skill_e'] = array('controls'=>array(),'type'=>'int');\n //sys fields\n $this->_tableMap['sl_candidate']['_sys_status'] = array('controls'=>array('is_integer(%)'),'type'=>'int');\n $this->_tableMap['sl_candidate']['_sys_redirect'] = array('controls'=>array('is_key(%) || is_null(%)'),'type'=>'int');\n\n\n $this->_tableMap['sl_candidate_profile']['sl_candidate_profilepk'] = array('controls'=>array('is_key(%)'),'type'=>'int','index' => 'pk');\n $this->_tableMap['sl_candidate_profile']['candidatefk'] = array('controls'=>array('is_integer(%)'),'type'=>'int');\n $this->_tableMap['sl_candidate_profile']['companyfk'] = array('controls'=>array('is_integer(%)'),'type'=>'int');\n $this->_tableMap['sl_candidate_profile']['date_created'] = array('controls'=>array('is_datetime(%)'),'type'=>'datetime');\n $this->_tableMap['sl_candidate_profile']['created_by'] = array('controls'=>array('is_integer(%)'),'type'=>'int');\n $this->_tableMap['sl_candidate_profile']['date_updated'] = array('controls'=>array('is_datetime(%)'),'type'=>'datetime');\n $this->_tableMap['sl_candidate_profile']['updated_by'] = array('controls'=>array('is_integer(%)'),'type'=>'int');\n $this->_tableMap['sl_candidate_profile']['managerfk'] = array('controls'=>array('is_integer(%)'),'type'=>'int');\n $this->_tableMap['sl_candidate_profile']['industryfk'] = array('controls'=>array('is_integer(%)'),'type'=>'int');\n $this->_tableMap['sl_candidate_profile']['occupationfk'] = array('controls'=>array('is_integer(%)'),'type'=>'int');\n $this->_tableMap['sl_candidate_profile']['title'] = array('controls' => array());\n $this->_tableMap['sl_candidate_profile']['department'] = array('controls' => array());\n $this->_tableMap['sl_candidate_profile']['keyword'] = array('controls' => array());\n $this->_tableMap['sl_candidate_profile']['grade'] = array('controls'=>array('is_integer(%)'),'type'=>'int');\n $this->_tableMap['sl_candidate_profile']['salary'] = array('controls'=>array('is_numeric(%) '),'type'=>'float');\n $this->_tableMap['sl_candidate_profile']['bonus'] = array('controls'=>array('is_numeric(%)'),'type'=>'float');\n $this->_tableMap['sl_candidate_profile']['profile_rating'] = array('controls'=>array('is_numeric(%)'),'type'=>'float');\n $this->_tableMap['sl_candidate_profile']['currency'] = array('controls' => array());\n $this->_tableMap['sl_candidate_profile']['currency_rate'] = array('controls'=>array('is_numeric(%)'),'type'=>'float');\n $this->_tableMap['sl_candidate_profile']['salary_search'] = array('controls'=>array('is_integer(%)'),'type'=>'int');\n $this->_tableMap['sl_candidate_profile']['target_low'] = array('controls'=>array('is_numeric(%)'),'type'=>'float');\n $this->_tableMap['sl_candidate_profile']['target_high'] = array('controls'=>array('is_numeric(%)'),'type'=>'float');\n\n $this->_tableMap['sl_candidate_profile']['_has_doc'] = array('controls'=>array());\n $this->_tableMap['sl_candidate_profile']['_in_play'] = array('controls'=>array());\n $this->_tableMap['sl_candidate_profile']['_pos_status'] = array('controls'=>array());\n $this->_tableMap['sl_candidate_profile']['uid'] = array('controls'=>array('!empty(%)'));\n $this->_tableMap['sl_candidate_profile']['_date_updated'] = array('controls'=>array());\n\n\n\n $this->_tableMap['sl_candidate_rm']['sl_candidate_rmpk'] = array('controls' => array('is_key(%) || is_null(%)'));\n $this->_tableMap['sl_candidate_rm']['loginfk'] = array('controls' => array('is_key(%)'));\n $this->_tableMap['sl_candidate_rm']['candidatefk'] = array('controls' => array('is_key(%)'));\n $this->_tableMap['sl_candidate_rm']['date_started'] = array('controls' => array('is_datetime(%)'));\n $this->_tableMap['sl_candidate_rm']['date_ended'] = array('controls' => array('is_datetime(%)'));\n $this->_tableMap['sl_candidate_rm']['date_expired'] = array('controls' => array('is_null(%) || is_datetime(%)'));\n $this->_tableMap['sl_candidate_rm']['nb_extended'] = array('controls' => array());\n\n\n\n\n $this->_tableMap['sl_company_rss']['sl_company_rsspk'] = array('controls' => array('is_key(%) || is_null(%)'));\n $this->_tableMap['sl_company_rss']['companyfk'] = array('controls' => array('is_key(%)'));\n $this->_tableMap['sl_company_rss']['date_created'] = array('controls' => array('is_datetime(%)'));\n $this->_tableMap['sl_company_rss']['nb_news'] = array('controls' => array());\n $this->_tableMap['sl_company_rss']['url'] = array('controls' => array());\n $this->_tableMap['sl_company_rss']['content'] = array('controls' => array());\n\n\n $this->_tableMap['sl_contact']['sl_contactpk'] = array('controls' => array());\n $this->_tableMap['sl_contact']['type'] = array('controls' => array('is_key(%)'));\n $this->_tableMap['sl_contact']['item_type'] = array('controls' => array('!empty(%)'));\n $this->_tableMap['sl_contact']['itemfk'] = array('controls' => array('is_key(%)'));\n $this->_tableMap['sl_contact']['date_create'] = array('controls' => array('is_null(%) || is_datetime(%)'));\n $this->_tableMap['sl_contact']['date_update'] = array('controls' => array('is_null(%) || is_datetime(%)'));\n $this->_tableMap['sl_contact']['loginfk'] = array('controls' => array('is_key(%)'));\n $this->_tableMap['sl_contact']['updated_by'] = array('controls' => array('is_null(%) || is_key(%)'));\n $this->_tableMap['sl_contact']['value'] = array('controls' => array('!empty(%)'));\n $this->_tableMap['sl_contact']['description'] = array('controls' => array());\n $this->_tableMap['sl_contact']['visibility'] = array('controls' => array('is_key(%)'));\n $this->_tableMap['sl_contact']['groupfk'] = array('controls' => array('is_integer(%)'));\n\n\n $this->_tableMap['sl_contact_visibility']['sl_contact_visibilitypk'] = array('controls' => array());\n $this->_tableMap['sl_contact_visibility']['sl_contactfk'] = array('controls' => array('is_integer(%)'));\n $this->_tableMap['sl_contact_visibility']['loginfk'] = array('controls' => array('is_integer(%)'));\n\n $this->_tableMap['sl_meeting']['sl_meetingpk'] = array('controls' => array());\n $this->_tableMap['sl_meeting']['date_created'] = array('controls' => array('is_datetime(%)'));\n $this->_tableMap['sl_meeting']['date_updated'] = array('controls' => array('is_null(%) || is_datetime(%)'));\n $this->_tableMap['sl_meeting']['date_meeting'] = array('controls' => array('is_datetime(%)'));\n $this->_tableMap['sl_meeting']['created_by'] = array('controls' => array('is_key(%)'));\n $this->_tableMap['sl_meeting']['candidatefk'] = array('controls' => array('is_key(%)'));\n $this->_tableMap['sl_meeting']['attendeefk'] = array('controls' => array('is_key(%)'));\n $this->_tableMap['sl_meeting']['type'] = array('controls' => array('is_key(%)'));\n $this->_tableMap['sl_meeting']['location'] = array('controls' => array());\n $this->_tableMap['sl_meeting']['description'] = array('controls' => array());\n $this->_tableMap['sl_meeting']['date_reminder1'] = array('controls' => array('is_null(%) || is_datetime(%)'));\n $this->_tableMap['sl_meeting']['date_reminder2'] = array('controls' => array('is_null(%) || is_datetime(%)'));\n $this->_tableMap['sl_meeting']['reminder_update'] = array('controls' => array('is_null(%) || is_datetime(%)'));\n $this->_tableMap['sl_meeting']['meeting_done'] = array('controls' => array('is_integer(%)'));\n $this->_tableMap['sl_meeting']['date_met'] = array('controls' => array());\n\n\n $this->_tableMap['sl_company']['sl_companypk'] = array('controls' => array());\n $this->_tableMap['sl_company']['date_created'] = array('controls' => array());\n $this->_tableMap['sl_company']['created_by'] = array('controls' => array());\n $this->_tableMap['sl_company']['company_owner'] = array('controls' => array());\n $this->_tableMap['sl_company']['date_updated'] = array('controls' => array());\n $this->_tableMap['sl_company']['updated_by'] = array('controls' => array());\n\n $this->_tableMap['sl_company']['level'] = array('controls' => array());\n $this->_tableMap['sl_company']['name'] = array('controls' => array());\n $this->_tableMap['sl_company']['corporate_name'] = array('controls' => array());\n $this->_tableMap['sl_company']['description'] = array('controls' => array());\n $this->_tableMap['sl_company']['address'] = array('controls' => array());\n $this->_tableMap['sl_company']['phone'] = array('controls' => array());\n $this->_tableMap['sl_company']['fax'] = array('controls' => array());\n $this->_tableMap['sl_company']['email'] = array('controls' => array());\n $this->_tableMap['sl_company']['website'] = array('controls' => array());\n\n $this->_tableMap['sl_company']['is_client'] = array('controls' => array());\n $this->_tableMap['sl_company']['is_nc_ok'] = array('controls' => array());\n $this->_tableMap['sl_company']['num_employee'] = array('controls' => array());\n\n $this->_tableMap['sl_company']['num_employee_japan'] = array('controls' => array());\n $this->_tableMap['sl_company']['num_employee_world'] = array('controls' => array());\n $this->_tableMap['sl_company']['num_branch_japan'] = array('controls' => array());\n $this->_tableMap['sl_company']['num_branch_world'] = array('controls' => array());\n $this->_tableMap['sl_company']['revenue'] = array('controls' => array());\n $this->_tableMap['sl_company']['hq'] = array('controls' => array());\n $this->_tableMap['sl_company']['hq_japan'] = array('controls' => array());\n\n\n $this->_tableMap['sl_attribute']['sl_attributepk'] = array('controls' => array());\n $this->_tableMap['sl_attribute']['type'] = array('controls' => array('!empty(%)'));\n $this->_tableMap['sl_attribute']['itemfk'] = array('controls' => array('is_key(%)'));\n $this->_tableMap['sl_attribute']['attributefk'] = array('controls' => array('is_key(%)'));\n $this->_tableMap['sl_attribute']['loginfk'] = array('controls' => array('is_key(%)'));\n $this->_tableMap['sl_attribute']['date_created'] = array('controls' => array('is_datetime(%)'));\n\n\n return true;\n }", "public function map() {\n\n $item = $this->item;\n $map = [];\n\n $map['id_inmueble'] = $item['id'];\n $map['referencia'] = $item['reference'];\n\n //Opcional Agency data\n $map['id_sucursal'] = ''; //site id?\n $map['propietario'] = '';\n $map['email_sucursal'] = '';\n $map['email_comercializadora'] = $this->config['email'];\n //Opcional\n\n $map['venta_01'] = $this->isSale() ? 1 : 0;\n $map['alquiler_01'] = $this->isRent() ? 1 : 0;\n $map['alquiler_opcion_venta_01'] = 0;\n $map['traspaso_01'] = $this->isTransfer() ? 1 : 0;\n $map['alquiler_temporada_01'] = 0;\n\n $map['precio_venta'] = $this->isSale() ? $item['price'] : 0;\n $map['precio_alquiler'] = $this->isRent() ? $item['price'] : 0;\n $map['precio_alquiler_opcion_compra'] = 0;\n $map['precio_traspaso'] = $this->isTransfer() ? $item['price'] : 0;\n $map['precio_alquiler_temporada'] = 0;\n\n list($tip_inm, $tipo, $tip_inm2, $subtipo) = $this->getTipos();\n $map['tipo'] = $tipo;\n $map['tip_inm'] = $tip_inm;\n $map['subtipo'] = $subtipo;\n $map['tip_inm2'] = $tip_inm2;\n\n list($provincia, $cod_prov) = $this->getProvincia();\n $map['provincia'] = $provincia;\n $map['cod_prov'] = $cod_prov;\n\n list($poblacion, $cod_pob) = $this->getPoblacion();\n $map['localidad'] = $poblacion;\n $map['cod_pob'] = $cod_pob;\n\n $map['ubicacion'] = $item['location']['address'];\n $map['cp'] = self::h($item['location']['zipcode']);\n\n list($zona, $cod_zona) = $this->getZone();\n $map['cod_zona'] = self::h($cod_zona);\n\n $map['banos'] = self::h($item['baths']);\n $map['aseos'] = self::h($item['toilettes']);\n $map['habitaciones'] = self::h($item['rooms']);\n\n $map['m2construidos'] = $item['size'] ? $this->convertSize($item['size']) : '';\n $map['m2utiles'] = $item['size_real'] ? $this->convertSize($item['size_real']) : '';\n $map['m2terraza'] = '';\n $map['m2jardin'] = '';\n $map['m2salon'] = '';\n\n $map['destacado'] = self::h($item['title'][$this->iso_lang]);\n $map['descripcion'] = self::h($item['description'][$this->iso_lang]);\n $map['calidades'] = '';\n $map['urbanizacion'] = '';\n $map['estadococina'] = '';\n $map['numeroplanta'] = '';\n $map['anoconstruccion'] = self::h($item['construction_year']);\n $map['gastoscomunidad'] = '';\n\n $map['garaje_01'] = self::b($item['features']['garage']);\n $map['terraza_01'] = self::b($item['features']['terrace']);\n $map['ascensor_01'] = self::b($item['features']['elevator']);\n $map['trastero_01'] = '';\n $map['piscina_01'] = self::b($item['features']['pool']);\n $map['buhardilla_01'] = '';\n $map['lavadero_01'] = '';\n $map['jardin_01'] = self::b($item['features']['garden']);\n $map['piscinacom_01'] = '';\n $map['eqdeportivos_01'] = '';\n $map['vistasalmar_01'] = '';\n $map['vistasalamontana_01'] = '';\n $map['vistasalaciudad_01'] = '';\n $map['cercatransportepub_01'] = '';\n $map['aireacondicionado_01'] = self::b($item['features']['air-conditioning']);\n $map['calefaccion_01'] = self::b($item['features']['heating']);\n $map['chimenea_01'] = '';\n $map['cocina_office'] = '';\n $map['despacho'] = '';\n $map['amueblado'] = self::b($item['features']['furnished']);\n $map['vigilancia'] = '';\n $map['escaparate'] = '';\n\n $map['m2_almacen'] = '';\n $map['m2_fachada'] = '';\n $map['centro_neg'] = '';\n $map['planta_diaf'] = '';\n $map['m2_terreno'] = $item['type'] == 'lot' ? $this->convertSize($item['size']) : '';\n $map['m2_industrial'] = $item['type'] == 'industrial' ? $this->convertSize($item['size']) : '';\n $map['m2_oficinas'] = '';\n $map['m_altura'] = '';\n $map['entrada_camion'] = '';\n $map['vestuarios'] = '';\n $map['edificable'] = '';\n $map['calif_energetica'] = self::h($item['ec']);\n $map['de_banco'] = '';\n\n $map['photos']['photo'] = $this->getImages();\n $map['videos'] = '';\n\n $map['videos_360']['video'] = $this->get_3d_url();\n\n $map['mapa']['latitud'] = self::h($item['location']['lat']);\n $map['mapa']['longitud'] = self::h($item['location']['lng']);\n $map['mapa']['zoom'] = 16; //14 15 16 17\n $map['mapa']['puntero'] = !empty($item['show_address']) && $item['show_address'] ? 1 : 0;\n\n $map['producto_premium'] = 0;\n $map['producto_destacado'] = 0;\n $map['producto_oportunidad'] = 0;\n\n return $map;\n }", "public function run()\n {\n factory(Employee::class , 100) \n -> make ()\n -> each(function ($emp) {\n\n $loca = Location::inRandomOrder() -> first();\n $emp -> location() -> associate($loca);\n\n $emp -> save();\n });\n }", "public function populate()\n {\n $places = $this->placeRepository->list()->get() ? $this->placeRepository->list()->get()->toArray():false;\n\n foreach ($places as $key => $place) {\n $mapper = config('api.mapper');\n $elements = collect(json_decode($this->apiService->get($place['query'])))\n ->pull($mapper['root']);\n\n if ($elements) {\n $geocodes = isset($elements->geocode) ? (array) $elements->geocode:[];\n\n if(!empty($geocodes)){\n\n $data = collect();\n\n foreach ($mapper['response']['fields'] as $key => $value) {\n \n if(isset($geocodes['center']->{$value}))\n $data->put($value, $geocodes['center']->{$value}); \n else\n $data->put($value, $geocodes[$value]);\n }\n\n $slug = $data->pull('slug');\n $result = $this->placeRepository->add(\n ['slug' => $slug],\n $data->toArray()\n );\n\n $recommendations = isset($elements->groups) ? (array) current($elements->groups): [];\n\n foreach ($recommendations['items'] as $recommendation) {\n \n $collection = collect();\n \n foreach ($mapper['response']['groups'] as $group) {\n\n $collection->put('place_id',$result->id);\n\n if(is_array($recommendation->venue->{$group}) || is_object($recommendation->venue->{$group}))\n $collection->put($group,json_encode($recommendation->venue->{$group})); \n else\n $collection->put($group,$recommendation->venue->{$group});\n }\n\n $id = $data->pull('id');\n $this->recommendationRepository->add(\n ['id' => $id],\n $collection->toArray()\n );\n }\n }\n }\n }\n\n return $places;\n }", "function map($pattern, $defaults=false, $requirements=false) {\n\t\t# parse pattern into regex\n\t\t$this->maps[] = new UsherMap($pattern, $defaults, $requirements);\n\t}", "public function instantiated(ObjectMapper $objectMapper): void;", "public function __construct()\n {\n $this->entity = $this->entity();\n $this->map = $this->map();\n $this->regex = $this->regex();\n }", "public function parse()\n {\n # define URL Endpoint\n $url = 'https://api.myjson.com/bins/tl0bp';\n\n # parsing this api json response\n // $hotels_json = file_get_contents($url);\n\n # this to hold hotels array, true param to decode it as an array\n # ['hotels'] because i want hotels data only so i get it from parsed json\n $hotels = json_decode(file_get_contents($url), true)['hotels'];\n\n # get hotels array from its object\n // $hotels = $hotels_obj['hotels'];\n\n # return this hotels array\n return $hotels;\n }", "public function __construct($hotel_id, $gender, $name, $address, $state, $city, $zip, $country, $phone, $fax, $email, $language )\n {\n\n $this->hotel_id = $hotel_id;\n\n $this->gender = $gender;\n\n $this->name = $name;\n\n $this->address = $address;\n\n $this->state = $state;\n\n $this->city = $city;\n\n $this->zip = $zip;\n\n $this->country = $country;\n\n $this->phone = $phone;\n\n $this->fax = $fax;\n\n $this->email = $email;\n\n $this->language = $language;\n \n }", "public function initalize()\n {\n parent::initalize();\n\n $this->locations[\"Ganon's Tower - DMs Room - Top Left\"]->setRequirements(function ($locations, $items) {\n return $items->has('Hammer')\n && $items->has('Hookshot')\n && ($items->has('MoonPearl') || $this->world->config('canDungeonRevive', false)\n || (\n ($this->world->config('canOneFrameClipOW', false)\n || ($this->world->config('canBootsClip', false)\n && $items->has('PegasusBoots'))) && (\n ($this->world->config('canBunnyRevive', false)\n && $items->canBunnyRevive($this->world)) || ($this->world->config('canOWYBA', false)\n && $items->hasABottle()))));\n });\n\n $this->locations[\"Ganon's Tower - DMs Room - Top Right\"]->setRequirements(function ($locations, $items) {\n return $items->has('Hammer')\n && $items->has('Hookshot')\n && ($items->has('MoonPearl') || $this->world->config('canDungeonRevive', false)\n || (\n ($this->world->config('canOneFrameClipOW', false)\n || ($this->world->config('canBootsClip', false)\n && $items->has('PegasusBoots'))) && (\n ($this->world->config('canBunnyRevive', false)\n && $items->canBunnyRevive($this->world)) || ($this->world->config('canOWYBA', false)\n && $items->hasABottle()))));\n });\n\n $this->locations[\"Ganon's Tower - DMs Room - Bottom Left\"]->setRequirements(function ($locations, $items) {\n return $items->has('Hammer')\n && $items->has('Hookshot')\n && ($items->has('MoonPearl') || $this->world->config('canDungeonRevive', false)\n || (\n ($this->world->config('canOneFrameClipOW', false)\n || ($this->world->config('canBootsClip', false)\n && $items->has('PegasusBoots'))) && (\n ($this->world->config('canBunnyRevive', false)\n && $items->canBunnyRevive($this->world)) || ($this->world->config('canOWYBA', false)\n && $items->hasABottle()))));\n });\n\n $this->locations[\"Ganon's Tower - DMs Room - Bottom Right\"]->setRequirements(function ($locations, $items) {\n return $items->has('Hammer')\n && $items->has('Hookshot')\n && ($items->has('MoonPearl') || $this->world->config('canDungeonRevive', false)\n || (\n ($this->world->config('canOneFrameClipOW', false)\n || ($this->world->config('canBootsClip', false)\n && $items->has('PegasusBoots'))) && (\n ($this->world->config('canBunnyRevive', false)\n && $items->canBunnyRevive($this->world)) || ($this->world->config('canOWYBA', false)\n && $items->hasABottle()))));\n });\n\n $this->locations[\"Ganon's Tower - Randomizer Room - Top Left\"]->setRequirements(function ($locations, $items) {\n return $items->has('Hammer')\n && $items->has('Hookshot')\n && (\n ($locations->itemInLocations(Item::get('BigKeyA2', $this->world), [\n \"Ganon's Tower - Randomizer Room - Top Right\",\n \"Ganon's Tower - Randomizer Room - Bottom Left\",\n \"Ganon's Tower - Randomizer Room - Bottom Right\",\n ])\n && $items->has('KeyA2', 3)) ||\n $items->has('KeyA2', 4)) && ($items->has('MoonPearl')\n || $this->world->config('canDungeonRevive', false)\n || (\n ($this->world->config('canOneFrameClipOW', false)\n || ($this->world->config('canBootsClip', false)\n && $items->has('PegasusBoots'))) && (\n ($this->world->config('canBunnyRevive', false)\n && $items->canBunnyRevive($this->world)) || ($this->world->config('canOWYBA', false)\n && $items->hasABottle()))));\n });\n\n $this->locations[\"Ganon's Tower - Randomizer Room - Top Right\"]->setRequirements(function ($locations, $items) {\n return $items->has('Hammer')\n && $items->has('Hookshot')\n && (\n ($locations->itemInLocations(Item::get('BigKeyA2', $this->world), [\n \"Ganon's Tower - Randomizer Room - Top Left\",\n \"Ganon's Tower - Randomizer Room - Bottom Left\",\n \"Ganon's Tower - Randomizer Room - Bottom Right\",\n ])\n && $items->has('KeyA2', 3)) ||\n $items->has('KeyA2', 4)) && ($items->has('MoonPearl')\n || $this->world->config('canDungeonRevive', false)\n || (\n ($this->world->config('canOneFrameClipOW', false)\n || ($this->world->config('canBootsClip', false)\n && $items->has('PegasusBoots'))) && (\n ($this->world->config('canBunnyRevive', false)\n && $items->canBunnyRevive($this->world)) || ($this->world->config('canOWYBA', false)\n && $items->hasABottle()))));\n });\n\n $this->locations[\"Ganon's Tower - Randomizer Room - Bottom Left\"]->setRequirements(function ($locations, $items) {\n return $items->has('Hammer')\n && $items->has('Hookshot')\n && (\n ($locations->itemInLocations(Item::get('BigKeyA2', $this->world), [\n \"Ganon's Tower - Randomizer Room - Top Right\",\n \"Ganon's Tower - Randomizer Room - Top Left\",\n \"Ganon's Tower - Randomizer Room - Bottom Right\",\n ])\n && $items->has('KeyA2', 3)) ||\n $items->has('KeyA2', 4)) && ($items->has('MoonPearl')\n || $this->world->config('canDungeonRevive', false)\n || (\n ($this->world->config('canOneFrameClipOW', false)\n || ($this->world->config('canBootsClip', false)\n && $items->has('PegasusBoots'))) && (\n ($this->world->config('canBunnyRevive', false)\n && $items->canBunnyRevive($this->world)) || ($this->world->config('canOWYBA', false)\n && $items->hasABottle()))));\n });\n\n $this->locations[\"Ganon's Tower - Randomizer Room - Bottom Right\"]->setRequirements(function ($locations, $items) {\n return $items->has('Hammer')\n && $items->has('Hookshot')\n && (\n ($locations->itemInLocations(Item::get('BigKeyA2', $this->world), [\n \"Ganon's Tower - Randomizer Room - Top Right\",\n \"Ganon's Tower - Randomizer Room - Top Left\",\n \"Ganon's Tower - Randomizer Room - Bottom Left\",\n ])\n && $items->has('KeyA2', 3)) ||\n $items->has('KeyA2', 4)) && ($items->has('MoonPearl')\n || $this->world->config('canDungeonRevive', false)\n || (\n ($this->world->config('canOneFrameClipOW', false)\n || ($this->world->config('canBootsClip', false)\n && $items->has('PegasusBoots'))) && (\n ($this->world->config('canBunnyRevive', false)\n && $items->canBunnyRevive($this->world)) || ($this->world->config('canOWYBA', false)\n && $items->hasABottle()))));\n });\n\n $this->locations[\"Ganon's Tower - Firesnake Room\"]->setRequirements(function ($locations, $items) {\n return $items->has('Hammer')\n && $items->has('Hookshot')\n && (\n (($locations->itemInLocations(Item::get('BigKeyA2', $this->world), [\n \"Ganon's Tower - Randomizer Room - Top Right\",\n \"Ganon's Tower - Randomizer Room - Top Left\",\n \"Ganon's Tower - Randomizer Room - Bottom Left\",\n \"Ganon's Tower - Randomizer Room - Bottom Right\",\n ])\n ||\n $locations[\"Ganon's Tower - Firesnake Room\"]->hasItem(Item::get('KeyA2', $this->world))) &&\n $items->has('KeyA2', 2)) || $items->has('KeyA2', 3)) && ($items->has('MoonPearl')\n || $this->world->config('canDungeonRevive', false)\n || (\n ($this->world->config('canOneFrameClipOW', false)\n || ($this->world->config('canBootsClip', false)\n && $items->has('PegasusBoots'))) && (\n ($this->world->config('canBunnyRevive', false)\n && $items->canBunnyRevive($this->world)) || ($this->world->config('canOWYBA', false)\n && $items->hasABottle()))));\n });\n\n $this->locations[\"Ganon's Tower - Map Chest\"]->setRequirements(function ($locations, $items) {\n return $items->has('Hammer')\n && ($items->has('Hookshot')\n || ($this->world->config('itemPlacement') !== 'basic'\n && $items->has('PegasusBoots'))) && (in_array(\n $locations[\"Ganon's Tower - Map Chest\"]->getItem(),\n [\n Item::get('BigKeyA2', $this->world),\n Item::get('KeyA2', $this->world)\n ]\n )\n ? $items->has('KeyA2', 3) : $items->has('KeyA2', 4)) && ($items->has('MoonPearl')\n || $this->world->config('canDungeonRevive', false)\n || (\n ($this->world->config('canOneFrameClipOW', false)\n || ($this->world->config('canBootsClip', false)\n && $items->has('PegasusBoots'))) && (\n ($this->world->config('canBunnyRevive', false)\n && $items->canBunnyRevive($this->world)) || ($this->world->config('canOWYBA', false)\n && $items->hasABottle()))));\n })->setAlwaysAllow(function ($item, $items) {\n return $this->world->config('accessibility') !== 'locations'\n && $item == Item::get('KeyA2', $this->world)\n && $items->has('KeyA2', 3);\n })->setFillRules(function ($item, $locations, $items) {\n return $this->world->config('accessibility') !== 'locations'\n || $item != Item::get('KeyA2', $this->world);\n });\n\n $this->locations[\"Ganon's Tower - Big Chest\"]->setRequirements(function ($locations, $items) {\n return $items->has('BigKeyA2')\n && $items->has('KeyA2', 3)\n && (\n ($items->has('Hammer')\n && $items->has('Hookshot')) || ($items->has('FireRod')\n && $items->has('CaneOfSomaria'))) && ($items->has('MoonPearl')\n || $this->world->config('canDungeonRevive', false)\n || (\n ($this->world->config('canOneFrameClipOW', false)\n || ($this->world->config('canBootsClip', false)\n && $items->has('PegasusBoots'))) && (\n ($this->world->config('canBunnyRevive', false)\n && $items->canBunnyRevive($this->world)) || ($this->world->config('canOWYBA', false)\n && $items->hasABottle()))));\n })->setFillRules(function ($item, $locations, $items) {\n return $item != Item::get('BigKeyA2', $this->world);\n });\n\n $this->locations[\"Ganon's Tower - Bob's Chest\"]->setRequirements(function ($locations, $items) {\n return (($items->has('Hammer')\n && $items->has('Hookshot')) || ($items->has('FireRod')\n && $items->has('CaneOfSomaria'))) && $items->has('KeyA2', 3)\n && ($items->has('MoonPearl') || $this->world->config('canDungeonRevive', false)\n || (\n ($this->world->config('canOneFrameClipOW', false)\n || ($this->world->config('canBootsClip', false)\n && $items->has('PegasusBoots'))) && (\n ($this->world->config('canBunnyRevive', false)\n && $items->canBunnyRevive($this->world)) || ($this->world->config('canOWYBA', false)\n && $items->hasABottle()))));\n });\n\n $this->locations[\"Ganon's Tower - Tile Room\"]->setRequirements(function ($locations, $items) {\n return $items->has('CaneOfSomaria')\n && ($items->has('MoonPearl') || $this->world->config('canDungeonRevive', false)\n || (\n ($this->world->config('canOneFrameClipOW', false)\n || ($this->world->config('canBootsClip', false)\n && $items->has('PegasusBoots'))) && (\n ($this->world->config('canBunnyRevive', false)\n && $items->canBunnyRevive($this->world)) || ($this->world->config('canOWYBA', false)\n && $items->hasABottle()))));\n });\n\n $this->locations[\"Ganon's Tower - Compass Room - Top Left\"]->setRequirements(function ($locations, $items) {\n return $items->has('FireRod')\n && $items->has('CaneOfSomaria')\n && (\n ($locations->itemInLocations(Item::get('BigKeyA2', $this->world), [\n \"Ganon's Tower - Compass Room - Top Right\",\n \"Ganon's Tower - Compass Room - Bottom Left\",\n \"Ganon's Tower - Compass Room - Bottom Right\",\n ])\n && $items->has('KeyA2', 3)) ||\n $items->has('KeyA2', 4)) && ($items->has('MoonPearl')\n || $this->world->config('canDungeonRevive', false)\n || (\n ($this->world->config('canOneFrameClipOW', false)\n || ($this->world->config('canBootsClip', false)\n && $items->has('PegasusBoots'))) && (\n ($this->world->config('canBunnyRevive', false)\n && $items->canBunnyRevive($this->world)) || ($this->world->config('canOWYBA', false)\n && $items->hasABottle()))));\n });\n\n $this->locations[\"Ganon's Tower - Compass Room - Top Right\"]->setRequirements(function ($locations, $items) {\n return $items->has('FireRod')\n && $items->has('CaneOfSomaria')\n && (\n ($locations->itemInLocations(Item::get('BigKeyA2', $this->world), [\n \"Ganon's Tower - Compass Room - Top Left\",\n \"Ganon's Tower - Compass Room - Bottom Left\",\n \"Ganon's Tower - Compass Room - Bottom Right\",\n ])\n && $items->has('KeyA2', 3)) ||\n $items->has('KeyA2', 4)) && ($items->has('MoonPearl')\n || $this->world->config('canDungeonRevive', false)\n || (\n ($this->world->config('canOneFrameClipOW', false)\n || ($this->world->config('canBootsClip', false)\n && $items->has('PegasusBoots'))) && (\n ($this->world->config('canBunnyRevive', false)\n && $items->canBunnyRevive($this->world)) || ($this->world->config('canOWYBA', false)\n && $items->hasABottle()))));\n });\n\n $this->locations[\"Ganon's Tower - Compass Room - Bottom Left\"]->setRequirements(function ($locations, $items) {\n return $items->has('FireRod')\n && $items->has('CaneOfSomaria')\n && (\n ($locations->itemInLocations(Item::get('BigKeyA2', $this->world), [\n \"Ganon's Tower - Compass Room - Top Right\",\n \"Ganon's Tower - Compass Room - Top Left\",\n \"Ganon's Tower - Compass Room - Bottom Right\",\n ]) && $items->has('KeyA2', 3)) || $items->has('KeyA2', 4)) && ($items->has('MoonPearl')\n || $this->world->config('canDungeonRevive', false)\n || (\n ($this->world->config('canOneFrameClipOW', false)\n || ($this->world->config('canBootsClip', false)\n && $items->has('PegasusBoots'))) && (\n ($this->world->config('canBunnyRevive', false)\n && $items->canBunnyRevive($this->world)) || ($this->world->config('canOWYBA', false)\n && $items->hasABottle()))));\n });\n\n $this->locations[\"Ganon's Tower - Compass Room - Bottom Right\"]->setRequirements(function ($locations, $items) {\n return $items->has('FireRod')\n && $items->has('CaneOfSomaria')\n && (\n ($locations->itemInLocations(Item::get('BigKeyA2', $this->world), [\n \"Ganon's Tower - Compass Room - Top Right\",\n \"Ganon's Tower - Compass Room - Top Left\",\n \"Ganon's Tower - Compass Room - Bottom Left\",\n ]) && $items->has('KeyA2', 3)) ||\n $items->has('KeyA2', 4)) && ($items->has('MoonPearl')\n || $this->world->config('canDungeonRevive', false)\n || (\n ($this->world->config('canOneFrameClipOW', false)\n || ($this->world->config('canBootsClip', false)\n && $items->has('PegasusBoots'))) && (\n ($this->world->config('canBunnyRevive', false)\n && $items->canBunnyRevive($this->world)) || ($this->world->config('canOWYBA', false)\n && $items->hasABottle()))));\n });\n\n $this->locations[\"Ganon's Tower - Big Key Chest\"]->setRequirements(function ($locations, $items) {\n return (($items->has('Hammer')\n && $items->has('Hookshot')) || ($items->has('FireRod')\n && $items->has('CaneOfSomaria'))) && $items->has('KeyA2', 3)\n && $this->boss_bottom->canBeat($items, $locations)\n && ($items->has('MoonPearl')\n || $this->world->config('canDungeonRevive', false)\n || (\n ($this->world->config('canOneFrameClipOW', false)\n || ($this->world->config('canBootsClip', false)\n && $items->has('PegasusBoots'))) && (\n ($this->world->config('canBunnyRevive', false)\n && $items->canBunnyRevive($this->world)) || ($this->world->config('canOWYBA', false)\n && $items->hasABottle()))));\n });\n\n $this->locations[\"Ganon's Tower - Big Key Room - Left\"]->setRequirements(function ($locations, $items) {\n return (($items->has('Hammer')\n && $items->has('Hookshot')) || ($items->has('FireRod')\n && $items->has('CaneOfSomaria'))) && $items->has('KeyA2', 3)\n && $this->boss_bottom->canBeat($items, $locations)\n && ($items->has('MoonPearl') || $this->world->config('canDungeonRevive', false)\n || (\n ($this->world->config('canOneFrameClipOW', false)\n || ($this->world->config('canBootsClip', false)\n && $items->has('PegasusBoots'))) && (\n ($this->world->config('canBunnyRevive', false)\n && $items->canBunnyRevive($this->world)) || ($this->world->config('canOWYBA', false)\n && $items->hasABottle()))));\n });\n\n $this->locations[\"Ganon's Tower - Big Key Room - Right\"]->setRequirements(function ($locations, $items) {\n return (($items->has('Hammer')\n && $items->has('Hookshot')) || ($items->has('FireRod')\n && $items->has('CaneOfSomaria'))) && $items->has('KeyA2', 3)\n && $this->boss_bottom->canBeat($items, $locations)\n && ($items->has('MoonPearl') || $this->world->config('canDungeonRevive', false)\n || (\n ($this->world->config('canOneFrameClipOW', false)\n || ($this->world->config('canBootsClip', false)\n && $items->has('PegasusBoots'))) && (\n ($this->world->config('canBunnyRevive', false)\n && $items->canBunnyRevive($this->world)) || ($this->world->config('canOWYBA', false)\n && $items->hasABottle()))));\n });\n\n $this->locations[\"Ganon's Tower - Mini Helmasaur Room - Left\"]->setRequirements(function ($locations, $items) {\n return $items->canShootArrows($this->world)\n && $items->canLightTorches()\n && $items->has('BigKeyA2')\n && $items->has('KeyA2', 3)\n && $this->boss_middle->canBeat($items, $locations)\n && ($items->has('MoonPearl') || $this->world->config('canDungeonRevive', false)\n || (\n ($this->world->config('canOneFrameClipOW', false)\n || ($this->world->config('canBootsClip', false)\n && $items->has('PegasusBoots'))) && (\n ($this->world->config('canBunnyRevive', false)\n && $items->canBunnyRevive($this->world)) || ($this->world->config('canOWYBA', false)\n && $items->hasABottle()))));\n })->setFillRules(function ($item, $locations, $items) {\n return $item != Item::get('BigKeyA2', $this->world);\n });\n\n $this->locations[\"Ganon's Tower - Mini Helmasaur Room - Right\"]->setRequirements(function ($locations, $items) {\n return $items->canShootArrows($this->world)\n && $items->canLightTorches()\n && $items->has('BigKeyA2')\n && $items->has('KeyA2', 3)\n && $this->boss_middle->canBeat($items, $locations)\n && ($items->has('MoonPearl') || $this->world->config('canDungeonRevive', false)\n || (\n ($this->world->config('canOneFrameClipOW', false)\n || ($this->world->config('canBootsClip', false)\n && $items->has('PegasusBoots'))) && (\n ($this->world->config('canBunnyRevive', false)\n && $items->canBunnyRevive($this->world)) || ($this->world->config('canOWYBA', false)\n && $items->hasABottle()))));\n })->setFillRules(function ($item, $locations, $items) {\n return $item != Item::get('BigKeyA2', $this->world);\n });\n\n $this->locations[\"Ganon's Tower - Pre-Moldorm Chest\"]->setRequirements(function ($locations, $items) {\n return $items->canShootArrows($this->world)\n && $items->canLightTorches()\n && $items->has('BigKeyA2')\n && $items->has('KeyA2', 3)\n && $this->boss_middle->canBeat($items, $locations)\n && ($items->has('MoonPearl') || $this->world->config('canDungeonRevive', false)\n || (\n ($this->world->config('canOneFrameClipOW', false)\n || ($this->world->config('canBootsClip', false)\n && $items->has('PegasusBoots'))) && (\n ($this->world->config('canBunnyRevive', false)\n && $items->canBunnyRevive($this->world)) || ($this->world->config('canOWYBA', false)\n && $items->hasABottle()))));\n })->setFillRules(function ($item, $locations, $items) {\n return $item != Item::get('BigKeyA2', $this->world);\n });\n\n $this->locations[\"Ganon's Tower - Moldorm Chest\"]->setRequirements(function ($locations, $items) {\n return $items->has('Hookshot')\n && $items->canShootArrows($this->world)\n && $items->canLightTorches()\n && $items->has('BigKeyA2')\n && $items->has('KeyA2', 4)\n && $this->boss_middle->canBeat($items, $locations)\n && $this->boss_top->canBeat($items, $locations)\n && ($items->has('MoonPearl') || $this->world->config('canDungeonRevive', false)\n || (\n ($this->world->config('canOneFrameClipOW', false)\n || ($this->world->config('canBootsClip', false)\n && $items->has('PegasusBoots'))) && (\n ($this->world->config('canBunnyRevive', false)\n && $items->canBunnyRevive($this->world)) || ($this->world->config('canOWYBA', false)\n && $items->hasABottle()))));\n })->setFillRules(function ($item, $locations, $items) {\n return $item != Item::get('KeyA2', $this->world)\n && $item != Item::get('BigKeyA2', $this->world);\n });\n\n $this->can_complete = function ($locations, $items) {\n return $this->canEnter($locations, $items)\n && $this->locations[\"Ganon's Tower - Moldorm Chest\"]->canAccess($items)\n && $this->boss->canBeat($items, $locations);\n };\n\n $this->prize_location->setRequirements($this->can_complete);\n\n $this->can_enter = function ($locations, $items) {\n return ($this->world->config('itemPlacement') !== 'basic'\n || (\n ($this->world->config('mode.weapons') === 'swordless'\n || $items->hasSword(2))\n && $items->hasHealth(12)\n && ($items->hasBottle(2)\n || $items->hasArmor()))) && ($this->world->config('canDungeonRevive', false)\n || ($this->world->config('canSuperBunny', false)\n && $items->has('MagicMirror')) ||\n $items->has('MoonPearl')\n || (\n ($this->world->config('canOneFrameClipOW', false)\n || ($this->world->config('canBootsClip', false)\n && $items->has('PegasusBoots'))) && (\n ($this->world->config('canBunnyRevive', false)\n && $items->canBunnyRevive($this->world)) || ($this->world->config('canOWYBA', false)\n && $items->hasABottle())))) && ($items->has('Crystal1')\n + $items->has('Crystal2')\n + $items->has('Crystal3')\n + $items->has('Crystal4')\n + $items->has('Crystal5')\n + $items->has('Crystal6')\n + $items->has('Crystal7')) >= $this->world->config('crystals.tower', 7)\n && $this->world->getRegion('North East Light World')->canEnter($locations, $items);\n };\n\n return $this;\n }", "abstract protected function setup();", "public function setUp()\n {\n $this->strPathToOutputData = create_temp_directory(__CLASS__);\n $this->strTmpDumpFile = \"DumpFile.tmp\";\n $this->strPathToData = test_data_path(\"andorra\", \"mif\", \"gis_osm_places_free_1.mif\");\n $this->strPathToStandardData = \"./data/testcase/\";\n $this->bUpdate = false;\n $this->iSpatialFilter[0] = 1.4; /*xmin*/\n $this->iSpatialFilter[1] = 42.4; /*ymin*/\n $this->iSpatialFilter[2] = 1.6; /*xmax*/\n $this->iSpatialFilter[3] = 42.6; /*ymax*/\n\n OGRRegisterAll();\n\n $this->hOGRSFDriver = OGRGetDriverByName(\"MapInfo File\");\n $this->assertNotNull(\n $this->hOGRSFDriver,\n \"Could not get MapInfo File driver\"\n );\n\n $this->hSrcDataSource = OGR_Dr_Open(\n $this->hOGRSFDriver,\n $this->strPathToData,\n $this->bUpdate\n );\n $this->assertNotNull(\n $this->hSrcDataSource,\n \"Could not open datasource \" . $this->strPathToData\n );\n\n $this->hLayer = OGR_DS_GetLayer($this->hSrcDataSource, 0);\n $this->assertNotNull($this->hLayer, \"Could not open source layer\");\n }", "public function test_next_map()\n {\n $this->assertSame('Al Basrah Insurgency v1', $this->btwServer->nextMap());\n }", "public function initOverworldGlitches() {\n\t\t$this->initNoMajorGlitches();\n\n\t\t$this->locations[\"[cave-018] Graveyard - top right grave\"]->setRequirements(function($locations, $items) {\n\t\t\treturn $items->has('PegasusBoots') && ($items->canLiftDarkRocks()\n\t\t\t\t|| ($items->has('MagicMirror') && $items->has('MoonPearl')));\n\t\t});\n\n\t\t$this->locations[\"Magic Bat\"]->setRequirements(function($locations, $items) {\n\t\t\treturn $items->has('Powder')\n\t\t\t\t&& ($items->has('Hammer')\n\t\t\t\t\t|| $items->has('PegasusBoots')\n\t\t\t\t\t|| ($items->has('MoonPearl') && $items->has('MagicMirror') && $items->canLiftDarkRocks()\n\t\t\t\t\t\t&& $this->world->getRegion('North West Dark World')->canEnter($locations, $items)));\n\t\t});\n\n\t\t$this->locations[\"Hobo\"]->setRequirements(function($locations, $items) {\n\t\t\treturn true;\n\t\t});\n\n\t\t$this->locations[\"Bombos Tablet\"]->setRequirements(function($locations, $items) {\n\t\t\treturn $items->has('BookOfMudora') && ($items->hasUpgradedSword()\n\t\t\t\t\t|| (config('game-mode') == 'swordless' && $items->has('Hammer')))\n\t\t\t\t&& ($items->has('PegasusBoots')\n\t\t\t\t\t|| ($items->has('MagicMirror') && $this->world->getRegion('South Dark World')->canEnter($locations, $items)));\n\t\t});\n\n\t\t$this->locations[\"King Zora\"]->setRequirements(function($locations, $items) {\n\t\t\treturn true;\n\t\t});\n\n\t\t$this->locations[\"Piece of Heart (south of Haunted Grove)\"]->setRequirements(function($locations, $items) {\n\t\t\treturn $items->has('PegasusBoots')\n\t\t\t\t|| ($items->has('MagicMirror') && $this->world->getRegion('South Dark World')->canEnter($locations, $items));\n\t\t});\n\n\t\t$this->locations[\"Piece of Heart (Graveyard)\"]->setRequirements(function($locations, $items) {\n\t\t\treturn $items->has('PegasusBoots')\n\t\t\t\t|| ($items->has('MagicMirror') && $items->has('MoonPearl')\n\t\t\t\t\t&& $this->world->getRegion('North West Dark World')->canEnter($locations, $items));\n\t\t});\n\n\t\t$this->locations[\"Piece of Heart (Desert - northeast corner)\"]->setRequirements(function($locations, $items) {\n\t\t\treturn $items->canLiftRocks()\n\t\t\t\t&& ($items->has('PegasusBoots')\n\t\t\t\t\t|| ($items->has('MagicMirror') && $this->world->getRegion('Mire')->canEnter($locations, $items)));\n\t\t});\n\n\t\t$this->locations[\"Piece of Heart (Lake Hylia)\"]->setRequirements(function($locations, $items) {\n\t\t\treturn $items->has('PegasusBoots')\n\t\t\t\t|| ($items->has('Flippers') && $items->has('MagicMirror')\n\t\t\t\t\t&& (($items->has('MoonPearl') && $this->world->getRegion('South Dark World')->canEnter($locations, $items))\n\t\t\t\t\t\t|| $this->world->getRegion('North East Dark World')->canEnter($locations, $items)));\n\t\t});\n\n\t\t$this->locations[\"Piece of Heart (Zora's River)\"]->setRequirements(function($locations, $items) {\n\t\t\treturn $items->has('Flippers')\n\t\t\t\t|| ($items->has('PegasusBoots') && $items->has('MoonPearl'));\n\t\t});\n\n\t\t$this->locations[\"Waterfall Fairy - Left\"]->setRequirements(function($locations, $items) {\n\t\t\treturn $items->has('Flippers') || $items->has('MoonPearl');\n\t\t});\n\n\t\t$this->locations[\"Waterfall Fairy - Right\"]->setRequirements(function($locations, $items) {\n\t\t\treturn $items->has('Flippers') || $items->has('MoonPearl');\n\t\t});\n\n\t\treturn $this;\n\t}", "function __construct() {\r\n\t\tfor($x=1; $x <= $this->map['width']; $x++):\r\n\t\t\tfor($y=1; $y <= $this->map['height']; $y++):\r\n\t\t\t\t$this->map['tiles'][$x][$y]['init'] = true;\r\n\t\t\tendfor;\r\n\t\tendfor;\t\t\r\n\t}", "public function hotel()\n {\n return $this->hasOne('App\\Hotels');\n }", "public function run()\n {\n $rooms = [\n [\n 'hotel_id' => '1',\n 'type' => 'Resort',\n 'description' => 'Universal-Parks',\n 'price' => '500',\n 'image' => 'https://funco.com/670/550/hotelpark'\n ],\n [\n 'hotel_id' => '2',\n 'type' => 'Inn',\n 'description' => 'Western-Cottage',\n 'price' => '55',\n 'image' => 'https://wintercottage.com/112/041/cottage'\n ],\n [\n 'hotel_id' => '3',\n 'type' => 'Suite',\n 'description' => 'Las-Vegas',\n 'price' => '900',\n 'image' => 'https://vegascasino.com/481/764/hotel-view'\n ],\n [\n 'hotel_id' => '4',\n 'type' => 'Budget-Inn',\n 'description' => 'Atlanta',\n 'price' => '100',\n 'image' => 'https://budgetinnatlanta.com/341/088/budget-room'\n ]\n ];\n\n foreach ($rooms as $room){\n Room::create(array(\n 'hotel_id' => $room['hotel_id'],\n 'type' => $room['type'],\n 'description' => $room['description'],\n 'price' => $room['price'],\n 'image' => $room['image']\n ));\n }\n }", "private function prepareDynamicMapping() {\n foreach ($this->getFieldMaping() as $field_mapping) {\n if ($this->isTranslatableField($field_mapping)) {\n\n $default_language_source = NULL;\n foreach ($this->getLanguages() as $language) {\n if ($language == NexteuropaNewsroomHelper::getDefaultLanguageUppercase()) {\n $default_language_source = $this->getXpathString();\n }\n else {\n $this->addNewsroomDefaultValueTamper($default_language_source);\n }\n\n if (!empty($field_mapping['query'])) {\n $this->addTranslatableQuery($field_mapping['query'], $language);\n }\n\n $this->addMapper($field_mapping, $language);\n }\n\n }\n else {\n $this->addTampers($field_mapping);\n if (!empty($field_mapping['query'])) {\n $this->addQuery($field_mapping['query']);\n }\n\n $this->addMapper($field_mapping);\n }\n }\n\n }", "public function getMappingTargets() {\n $targets = array(\n 'name' => array(\n 'name' => t('Title'),\n 'description' => t('The Waywire video title.'),\n ),\n 'magnify_externalid' => array(\n 'name' => t('Magnify External ID'),\n 'description' => t('The Waywire External ID (used to be called Magnify).'),\n ),\n 'updated' => array(\n 'name' => t('Updated'),\n 'description' => t('The date the video was updated.'),\n ),\n 'author_id' => array(\n 'name' => t('Author ID'),\n 'description' => t('The Waywire author ID.'),\n ),\n 'author_name' => array(\n 'name' => t('Author Name'),\n 'description' => t('The Waywire author name.'),\n ),\n 'author_uri' => array(\n 'name' => t('Author URI'),\n 'description' => t('The Waywire author uri.'),\n ),\n 'content' => array(\n 'name' => t('Content'),\n 'description' => t('The Waywire content.'),\n ),\n 'published' => array(\n 'name' => t('Published'),\n 'description' => t('The Waywire published date.'),\n ),\n 'media_width' => array(\n 'name' => t('Media Width'),\n 'description' => t('Video Width'),\n ),\n 'media_medium' => array(\n 'name' => t('Media Medium'),\n 'description' => t('Video Medium'),\n ),\n 'media_url' => array(\n 'name' => t('Media URL'),\n 'description' => t('Video URL'),\n ),\n 'media_type' => array(\n 'name' => t('Media Type'),\n 'description' => t('Video type'),\n ),\n 'media_height' => array(\n 'name' => t('Media Height'),\n 'description' => t('Video type'),\n ),\n 'media_duration' => array(\n 'name' => t('Media Duration'),\n 'description' => t('Video Duration'),\n ),\n 'link_self' => array(\n 'name' => t('Link Self'),\n 'description' => t('Link self'),\n ),\n 'link_alternative' => array(\n 'name' => t('Link Alternative'),\n 'description' => t('Link alternative'),\n ),\n 'link_author' => array(\n 'name' => t('Link Author'),\n 'description' => t('Link author'),\n ),\n 'categories' => array(\n 'name' => t('Categories'),\n 'description' => t('Tags'),\n ),\n 'guid' => array(\n 'name' => t('Magnify ID'),\n 'description' => t('The external GUID of the comment. E. g. the feed item GUID in the case of a syndication feed. May be unique.'),\n 'optional_unique' => TRUE,\n ),\n );\n\n self::loadMappers();\n $entity_type = $this->entityType();\n $bundle = $this->bundle();\n drupal_alter('feeds_processor_targets', $targets, $entity_type, $bundle);\n\n return $targets;\n }", "public function map()\n {\n $this->mapApiRoutes();\n\n $this->mapWebRoutes();\n\n //\n }", "public function run()\n {\n $map = Map::where('name', '佛门')->first();\n $npc = Npc::where('name', '大慧禅师')->first();\n\n $items = [\n [\n \"level\" => 1,\n \"open_level\" => 10,\n \"type\" => \"super\",\n \"description\" => \"受到天魔里、七星方寸、盘丝岭、镇元五庄的封系法术时,封印回合数减半\",\n \"name\" => \"星穹之力\"\n ],\n [\n \"level\" => 2,\n \"open_level\" => 30,\n \"type\" => \"super\",\n \"description\" => \"泽被苍生、止血的治疗量提高10%(仅在非玩家战斗中有效)\",\n \"name\" => \"青冥·Ⅰ\"\n ],\n [\n \"level\" => 2,\n \"open_level\" => 30,\n \"type\" => \"super\",\n \"description\" => \"罗汉金身、伽蓝战气的持续回合提高1回合(仅在非玩家战斗中有效)\",\n \"name\" => \"青冥·Ⅱ\"\n ],\n [\n \"level\" => 2,\n \"open_level\" => 30,\n \"type\" => \"super\",\n \"description\" => \"使用净世梵音时15%几率造成暴击(仅在非玩家战斗中有效)\",\n \"name\" => \"青冥·Ⅲ\"\n ],\n [\n \"level\" => 3,\n \"open_level\" => 60,\n \"type\" => \"super\",\n \"description\" => \"使用门派法术复活目标时,10%几率为其附加罗汉金身状态2回合\",\n \"name\" => \"蓝玉·Ⅰ\"\n ],\n [\n \"level\" => 3,\n \"open_level\" => 60,\n \"type\" => \"super\",\n \"description\" => \"使用门派法术复活目标时,若目标魔法低于25%,额外为其恢复自身等级*2.6的魔法值\",\n \"name\" => \"蓝玉·Ⅱ\"\n ],\n [\n \"level\" => 3,\n \"open_level\" => 60,\n \"type\" => \"super\",\n \"description\" => \"使用门派法术复活目标时,10%几率使目标携带的所有非封印状态回合数减1(最低回合数为1)\",\n \"name\" => \"蓝玉·Ⅲ\"\n ],\n [\n \"level\" => 4,\n \"open_level\" => 80,\n \"type\" => \"super\",\n \"description\" => \"使用门派的群体治疗法术时,6%几率造成暴击,每回合最多暴击一个\",\n \"name\" => \"橙光·Ⅰ\"\n ],\n [\n \"level\" => 4,\n \"open_level\" => 80,\n \"type\" => \"super\",\n \"description\" => \"使用治愈时,13%几率造成暴击;对伤势低于气血上限20%的目标使用时,暴击率翻倍\",\n \"name\" => \"橙光·Ⅱ\"\n ],\n [\n \"level\" => 4,\n \"open_level\" => 80,\n \"type\" => \"super\",\n \"description\" => \"使用止血时,13%几率造成暴击;对气血低于气血上限10%的目标使用时,暴击率翻倍\",\n \"name\" => \"橙光·Ⅲ\"\n ],\n [\n \"level\" => 5,\n \"open_level\" => 90,\n \"type\" => \"super\",\n \"description\" => \"星爆状态下若成功复活目标,则清除目标携带的所有非封印异常状态,并使其获得1回合的降生状态\",\n \"name\" => \"星爆\"\n ],\n [\n \"level\" => 6,\n \"open_level\" => 100,\n \"type\" => \"super\",\n \"description\" => \"使用伽蓝战气、罗汉金身、明王镇狱时,13%几率使选中目标的持续回合数加2\",\n \"name\" => \"紫电·Ⅰ\"\n ],\n [\n \"level\" => 6,\n \"open_level\" => 100,\n \"type\" => \"super\",\n \"description\" => \"使用伽蓝战气、罗汉金身、明王镇狱时,6%几率使选中目标的效果额外提升\",\n \"name\" => \"紫电·Ⅱ\"\n ],\n [\n \"level\" => 6,\n \"open_level\" => 100,\n \"type\" => \"super\",\n \"description\" => \"使用伽蓝战气、罗汉金身、明王镇狱时,13%几率返还消耗的魔法值\",\n \"name\" => \"紫电·Ⅲ\"\n ],\n [\n \"level\" => 7,\n \"open_level\" => 120,\n \"type\" => \"super\",\n \"description\" => \"若回合末自身处于死亡状态,20%几率为己方所有存活单位恢复气血和伤势,每场战斗只触发一次\",\n \"name\" => \"赤霄·Ⅰ\"\n ],\n [\n \"level\" => 7,\n \"open_level\" => 120,\n \"type\" => \"super\",\n \"description\" => \"若伽蓝战气、罗汉金身、明王镇狱被驱散时,10%几率令目标获得2回合的抗属性异常状态\",\n \"name\" => \"赤霄·Ⅱ\"\n ],\n [\n \"level\" => 7,\n \"open_level\" => 120,\n \"type\" => \"super\",\n \"description\" => \"人物触发自动保护宠物几率增加13%\",\n \"name\" => \"赤霄·Ⅲ\"\n ],\n ];\n\n $items = collect($items)->map(function ($item) use ($map, $npc) {\n return array_merge($item, [\n \"map_id\" => $map[\"id\"],\n \"npc_id\" => $npc[\"id\"],\n \"created_at\" => Carbon::now(),\n \"updated_at\" => Carbon::now(),\n ]);\n })\n ->toArray();\n\n Skill::insert($items);\n }", "public function map()\n {\n $this->mapApiRoutes();\n\n $this->mapWebRoutes();\n\n $this->mapCustomerRoutes();\n\n $this->mapInternalRoutes();\n\n $this->mapVendorRoutes();\n\n $this->mapWhiteGloveRoutes();\n\n $this->mapLocalRoutes();\n }", "function get_equipment($equipment_id){\n $equipment_index = get_equipment_index();\n\n if(!array_key_exists($equipment_id, $equipment_index)){\n return new Unequipped();\n }\n return new $equipment_index[$equipment_id]();\n }", "public function __construct()\n {\n $this->mapper = \\Lib\\DataMapper::instance();\n $this->product = new Product();\n }", "function setHotelId($hotel_id)\r\n\t{\r\n\t\t$this->_hotel_id\t= $hotel_id;\r\n\t\t$this->_data\t\t= null;\r\n\t\t$this->_hotels\t\t= null;\r\n\t}", "function setHotelId($hotel_id)\r\n\t{\r\n\t\t$this->_hotel_id\t= $hotel_id;\r\n\t\t$this->_data\t\t= null;\r\n\t\t$this->_hotels\t\t= null;\r\n\t}", "public function setup($params)\n {\n if ($this->env === \"local\") {\n $this->people = new Proxy($params);\n }\n\n // otherwise, get a regular search object\n else {\n $this->people = new Searcher($params, $this->env);\n }\n\n }", "protected function setUp() {\n $this->object = new OnlineLookupApiService();\n }", "abstract function setup();", "public function run()\n {\n $bestHotelsData = factory(BestHotel::class, 30)->make()->toArray();\n\n Storage::put('best_hotels.json', json_encode($bestHotelsData));\n\n $topHotelsData = factory(TopHotel::class, 30)->make()->toArray();\n\n Storage::put('top_hotels.json', json_encode($topHotelsData));\n }", "public function test_next_map()\n {\n $this->assertSame('Belaya AAS v1', $this->btwServer->nextMap());\n }", "protected function initalDriverProviders()\n {\n $this->driverProviderMap = [\n 'weibo' => __NAMESPACE__.'\\\\Providers\\\\WeiboProvider',\n 'wechat' => __NAMESPACE__.'\\\\Providers\\\\WechatProvider',\n 'qq' => __NAMESPACE__.'\\\\Providers\\\\QQProvider',\n 'github' => __NAMESPACE__.'\\\\Providers\\\\GithubProvider',\n 'facebook' => __NAMESPACE__.'\\\\Providers\\\\FacebookProvider',\n 'google' => __NAMESPACE__.'\\\\Providers\\\\GoogleProvider',\n ];\n }", "public function map()\n {\n $this->mapApiRoutes();\n\n $this->mapWebRoutes();\n\n //\n }" ]
[ "0.5979853", "0.57950884", "0.5720932", "0.56167114", "0.5592526", "0.5438802", "0.52496123", "0.52102596", "0.5202684", "0.51782334", "0.5174611", "0.5173758", "0.5150398", "0.5135128", "0.5122902", "0.5122902", "0.51078624", "0.5074306", "0.505704", "0.50191903", "0.50061023", "0.4937992", "0.49298695", "0.4925899", "0.49173915", "0.48929086", "0.48726845", "0.4871073", "0.48651105", "0.48575795", "0.48572204", "0.48472673", "0.48367494", "0.48334643", "0.4828412", "0.48230895", "0.48194245", "0.48144346", "0.48107007", "0.47983512", "0.47909912", "0.4768119", "0.4759709", "0.4757081", "0.47555733", "0.474407", "0.4731558", "0.47230887", "0.47210026", "0.47167408", "0.47134203", "0.47096127", "0.47064003", "0.47033533", "0.4697077", "0.46929625", "0.4677618", "0.4677448", "0.46552217", "0.46480662", "0.46463847", "0.4641356", "0.46337372", "0.46190232", "0.46156967", "0.46147653", "0.4613875", "0.4610961", "0.46098816", "0.46056357", "0.4602989", "0.4602886", "0.4599793", "0.45917404", "0.45905292", "0.45823726", "0.45744503", "0.45727295", "0.45637345", "0.45604277", "0.45521468", "0.45398274", "0.45375317", "0.4533255", "0.45303634", "0.45285213", "0.45268646", "0.4522135", "0.45159888", "0.45068663", "0.45066208", "0.45061523", "0.45061523", "0.45060304", "0.4505369", "0.45020124", "0.4500878", "0.44941476", "0.44940242", "0.448804" ]
0.6036583
0
Here we we test our response's structure and type when we sort by name
public function testSortByName() { $result=$this->sort->sortByName(); $result = $this->hotelMapperService->serialize($result); $this->assertInternalType('array',$result); foreach ($result as $i => $hotel) { $this->assertGreaterThan($result[$i+1]['name'],$hotel['name']); $this->assertArrayHasKey('name', $hotel); $this->assertArrayHasKey('price', $hotel); $this->assertArrayHasKey('city', $hotel); $this->assertArrayHasKey('availability', $hotel); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function sort_response($response_data)\n\t{\n\t\tasort($response_data);\n\t\treturn $response_data;\n\t}", "public function testOrderBy(): void\n {\n $request = new Request([\n 'orderBy' => 'status',\n ]);\n\n $this->assertEquals(['status', 'asc'], $request->orderBy());\n\n $request = new Request([]);\n $this->assertEquals(['id', 'asc'], $request->orderBy());\n\n $request = new Request([\n 'orderBy' => 'vehicle:owner.status',\n ]);\n\n $this->assertEquals(['vehicle', 'owner.status'], $request->orderBy());\n }", "public function testCategoryNameSorting()\n {\n echo \"\\n testCategoryNameSorting...\";\n $url = TestServiceAsReadOnly::$elasticsearchHost.$this->context.\"/category/cell_process/Name/asc/0/10000\";\n $response = $this->curl_get($url);\n //echo $response;\n $result = json_decode($response);\n if(isset($result->error))\n {\n echo \"\\nError in testCategoryNameSorting\";\n $this->assertTrue(false);\n }\n \n if(isset($result->hits->total) && $result->hits->total > 0)\n $this->assertTrue(true);\n else \n {\n $this->assertTrue(false);\n }\n }", "public function testFromOkResponse() : void {\n $bob = Record::fromName(\"bob\");\n $result = Result::fromResponse(Response::fromQueriedRecords(null, $bob));\n foreach ($result as $object) {\n $this->assertInstanceOf(SalesforceObject::class, $object);\n }\n\n $first = $result->first();\n $this->assertInstanceOf(SalesforceObject::class, $first);\n $this->assertEquals($bob[\"Id\"], $first->Id);\n $this->assertEquals($bob[\"Name\"], $first->Name);\n }", "public function testResponseGet()\n {\n $result = json_decode($this->body, true);\n\n $this->assertEquals($this->response->get('Model'), $result['Model']);\n $this->assertEquals($this->response->get('RequestId'), $result['RequestId']);\n $this->assertEquals($this->response->get('Inexistence'), null);\n $this->assertEquals($this->response->get('Inexistence', 'Inexistence'), 'Inexistence');\n }", "public function testWithSortListPost($name, $order)\n {\n $response = $this->jsonUser('GET', '/api/users/posts?sort='.$name);\n $data = json_decode($response->getContent());\n $arrayDesc = Post::orderBy($order, 'desc')->pluck($name)->toArray();\n for ($i = 1; $i <= 20; $i++) {\n $this->assertEquals($data->data[$i - 1]->$name, $arrayDesc[$i - 1]) ;\n }\n }", "public function testSuccessfulGetSortAttendants()\n {\n for ($i = 10000; $i < 10003; $i++) {\n $this->createData($i, '138000' . $i, 1);\n }\n for ($i = 10000; $i < 10003; $i++) {\n factory(Vote::class)->create([\n 'voter' => '138009' . $i,\n 'type' => Vote::TYPE_APP,\n 'user_id' => $i,\n ]);\n }\n $this->createData(10004, '13800010004', 0);\n $this->ajaxGet('/wap/' . self::ROUTE_PREFIX . '/approved/sort/list?page=1')\n ->seeJsonContains([\n 'code' => 0,\n ]);\n $result = json_decode($this->response->getContent(), true);\n $this->assertEquals(1, $result['pages']);\n $this->assertCount(3, $result['attendants']);\n }", "public function testPaginationAndESSorting()\n {\n $response = Article::search('*', [\n 'sort' => [\n 'title',\n ],\n ]);\n\n /*\n * Just so it's clear these are in the expected title order,\n */\n $this->assertEquals([\n 'Fast black dogs',\n 'Quick brown fox',\n 'Swift green frogs',\n ], $response->map(function ($a) {\n return $a->title;\n })->all());\n\n /* Response can be used as an array (of the results) */\n $response = $response->perPage(1)->page(2);\n\n $this->assertEquals(1, count($response));\n\n $this->assertInstanceOf(Result::class, $response[0]);\n\n $article = $response[0];\n $this->assertEquals('Quick brown fox', $article->title);\n\n $this->assertEquals('<ul class=\"pagination\">'.\n '<li><a href=\"/?page=1\" rel=\"prev\">&laquo;</a></li> '.\n '<li><a href=\"/?page=1\">1</a></li>'.\n '<li class=\"active\"><span>2</span></li>'.\n '<li><a href=\"/?page=3\">3</a></li> '.\n '<li><a href=\"/?page=3\" rel=\"next\">&raquo;</a></li>'.\n '</ul>', $response->render());\n\n $this->assertEquals(3, $response->total());\n $this->assertEquals(1, $response->perPage());\n $this->assertEquals(2, $response->currentPage());\n $this->assertEquals(3, $response->lastPage());\n }", "function _sortbyName($a, $b) \n {\n return(strcasecmp($a[\"name\"], $b[\"name\"]));\n }", "public function testParseResponse() {\n $data = $this->dl->parseResponse($this->sampleData, \"JSON\");\n $this->assertion($data['zip'], \"37931\", \"Parsed zip should equal 37931.\");\n $this->assertion($data['conditions'], \"clear sky\", \"Parsed conditions should equal clear sky.\");\n $this->assertion($data['pressure'], \"1031\", \"Parsed pressure should equal 1031.\");\n $this->assertion($data['temperature'], \"35\", \"Parsed temperature should equal 35.\");\n $this->assertion($data['windDirection'], \"ESE\", \"Parsed wind direction should equal ESE.\");\n $this->assertion($data['windSpeed'], \"1.06\", \"Parsed wind speed should equal 1.06.\");\n $this->assertion($data['humidity'], \"80\", \"Parsed humidity should equal 80.\");\n $this->assertion($data['timestamp'], \"1518144900\", \"Parsed timestamp should equal 1518144900.\");\n }", "function it_receives_the_expected_response_when_looking_up_all_templates() {\n $response = $this->listTemplates();\n\n $response->shouldHaveKey('templates');\n $response['templates']->shouldBeArray();\n\n $templates = $response['templates'];\n $total_notifications_count = count($templates->getWrappedObject());\n\n for( $i = 0; $i < $total_notifications_count; $i++ ) {\n\n $template = $templates[$i];\n\n $template->shouldBeArray();\n $template->shouldHaveKey( 'id' );\n $template->shouldHaveKey( 'name' );\n $template->shouldHaveKey( 'type' );\n $template->shouldHaveKey( 'created_at' );\n $template->shouldHaveKey( 'updated_at' );\n $template->shouldHaveKey( 'created_by' );\n $template->shouldHaveKey( 'version' );\n $template->shouldHaveKey( 'body' );\n $template->shouldHaveKey( 'subject' );\n $template->shouldHaveKey( 'letter_contact_block' );\n\n $template['id']->shouldBeString();\n $template['created_at']->shouldBeString();\n $template['created_by']->shouldBeString();\n $template['version']->shouldBeInteger();\n $template['body']->shouldBeString();\n\n $template['type']->shouldBeString();\n $template_type = $template['type']->getWrappedObject();\n\n if ( $template_type == \"sms\" ) {\n $template['subject']->shouldBeNull();\n $template['letter_contact_block']->shouldBeNull();\n\n } elseif ( $template_type == \"email\") {\n $template['subject']->shouldBeString();\n $template['letter_contact_block']->shouldBeNull();\n\n } elseif ( $template_type == \"letter\") {\n $template['subject']->shouldBeString();\n $template['letter_contact_block']->shouldBeString();\n\n }\n }\n\n }", "public function testSortByPrice()\n {\n $result=$this->sort->sortByPrice();\n $result = $this->hotelMapperService->serialize($result);\n $this->assertInternalType('array',$result);\n foreach ($result as $i => $hotel) {\n var_dump($hotel['price']);die;\n $this->assertGreaterThan($result[$i+1]['price'],$hotel['price']);\n $this->assertArrayHasKey('name', $hotel);\n $this->assertArrayHasKey('price', $hotel);\n $this->assertArrayHasKey('city', $hotel);\n $this->assertArrayHasKey('availability', $hotel);\n } \n }", "public function testResultGetFieldNames()\n {\n \t$this->assertEquals(array('id', 'key', 'title', 'status'), $this->conn->query('SELECT * FROM test')->getFieldNames());\n \t$this->assertEquals(array('id', 'title'), $this->conn->query('SELECT id, title FROM test')->getFieldNames(), \"Only id, title\");\n \t$this->assertEquals(array('id', 'idTest', 'title', 'subtitle'), $this->conn->query('SELECT child.id, child.idTest, title, subtitle FROM test INNER JOIN child ON test.id = child.idTest')->getFieldNames());\n }", "public function testGetList_SortingLimit()\n\t{\n\t\t$this->object->Save();\n\t\t$newObject1 = new object(\"efg\");\n\t\t$newObject2 = new object(\"abc\");\n\t\t$newObject3 = new object(\"d\");\n\n\t\t$newObject1->Save();\n\t\t$newObject2->Save();\n\t\t$newObject3->Save();\n\n\t\t$objectList = $newObject1->GetList(array(array(\"objectId\", \">\", 0)), \"attribute\", true, 2);\n\n\t\t$this->assertEquals(2, sizeof($objectList));\n\t\t$this->assertEquals(\"abc\", $objectList[0]->attribute);\n\n\t\t$objectList = $newObject1->GetList(array(array(\"objectId\", \">\", 0)), \"attribute\", false, 2);\n\n\t\t$this->assertEquals(2, sizeof($objectList));\n\t\t$this->assertEquals(\"obj att\", $objectList[0]->attribute);\n\t\t$this->assertEquals(\"efg\", $objectList[1]->attribute);\n\t}", "public function testGetAllNames()\n {\n $map = $this->driver->getAllNames();\n $this->assertCount(1, $map);\n $types = array(\n 'http://rdfs.org/sioc/ns#Post' => 'Test\\\\Midgard\\\\CreatePHP\\\\Model',\n );\n $this->assertEquals($types, $map);\n }", "public function testSort()\n {\n $obj_query = new \\Search\\Query();\n $this->assertEmpty($obj_query->getSorts());\n $obj_query->sort('a', 'b');\n $this->assertEquals([['a', 'b']], $obj_query->getSorts());\n $obj_query2 = $obj_query->sort('c', 'd');\n $this->assertEquals([['a', 'b'],['c', 'd']], $obj_query->getSorts());\n $this->assertSame($obj_query, $obj_query2);\n }", "public function testAbook()\n {\n\n // $this->assertTrue(true);\n $response= $this->json ('post','/books',['name'=> 'MyHeroAcademiaVOL.2']);\n\n $response ->assertStatus(200)\n -> assertJson ([\n 'created'=>true\n ]);\n\n $response1= $this->json ('post','/books',['name'=> 'Samurai Champloo VOL.1']);\n\n $response1 ->assertStatus(200)\n -> assertJson ([\n 'created'=>true\n ]);\n\n $response2= $this->json ('post','/books',['name'=> 'Attack On Titan VOL.6']);\n\n $response2 ->assertStatus(200)\n -> assertJson ([\n 'created'=>true\n ]);\n\n $response3= $this->json ('post','/books',['name'=> 'Kimetsu No Yaiba VOL.4']);\n\n $response3 ->assertStatus(200)\n -> assertJson ([\n 'created'=>true\n ]);\n\n\n }", "function thrive_dashboard_get_thrive_products($type = '', $sort = true)\n{\n $products = array();\n\n $response = wp_remote_get(THRIVE_DASHBOARD_PRODUCTS_URL, array('sslverify' => false));\n if (is_wp_error($response)) {\n return $products;\n }\n\n $products = json_decode($response['body']);\n if ($type != '') {\n foreach ($products as $key => $product) {\n if ($product->type != $type) {\n unset($products[$key]);\n }\n }\n }\n\n if ($sort == true) {\n usort($products, function ($a, $b) {\n return strcasecmp($a->name, $b->name);\n });\n }\n\n return $products;\n}", "public function byName($name) {\n\t\tif (strlen ( $name ) > 0) {\n\t\t\t$name = strtolower ( $name );\n\t\t\tif (stripos ( $name, ',' ) !== false) {\n\t\t\t\t$name = explode ( ',', $name );\n\t\t\t}\n\t\t\tif ($this->getNamespace ()) {\n\t\t\t\tif ($this->isReadable ()) {\n\t\t\t\t\t\n\t\t\t\t\t$aResponsePre = $this->renderMeta ( $this->oMetas->getAll ( $this->oMetavalue ) );\n\t\t\t\t\t$aResponsePost = false;\n\t\t\t\t\tforeach ( $aResponsePre as $sKey => $meta ) {\n\t\t\t\t\t\tif (! is_array ( $name )) {\n\t\t\t\t\t\t\tif ($sKey === $name) {\n\t\t\t\t\t\t\t\t$aResponsePost [$sKey] = $meta;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif (in_array ( $sKey, $name )) {\n\t\t\t\t\t\t\t\t$aResponsePost [$sKey] = $meta;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t$this->addEntry ( 'response', array ('metas' => $aResponsePost ) );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$this->addEntry ( 'response', $this->oError->throwError ( 'NAMESPACE_NOT_FOUND' ) );\n\t\t\t}\n\t\t} else {\n\t\t\t$this->addEntry ( 'response', $this->oError->throwError ( 'Nothing to search for' ) );\n\t\t}\n\t\treturn $this->getResponse ();\n\t}", "abstract function parse_api_response();", "protected function _getSortType() {}", "protected function _getSortType() {}", "public function testSortingOrder()\n {\n $this->request = new Request([\n 'sEcho' => 13,\n 'iDisplayStart' => 11,\n 'iDisplayLength' => 103,\n 'iColumns' => 1, // will be ignored, the column number is already set on the server side\n 'sSearch' => 'fooBar',\n 'bRegex' => true,\n 'bSearchable_0' => true, // will be ignored, the configuration is already set on the server side\n 'sSearch_0' => 'fooBar_1',\n 'bRegex_0' => true, // will be ignored, the configuration is already set on the server side\n 'bSortable_0' => true, // will be ignored, the configuration is already set on the server side\n 'iSortingCols' => 2,\n 'iSortCol_0' => 1,\n 'sSortDir_0' => 'desc',\n 'iSortCol_1' => 0,\n 'sSortDir_1' => 'desc',\n ]);\n\n $this->parser = new Datatable19QueryParser($this->request);\n\n $column = ColumnConfigurationBuilder::create()\n ->name(\"id\")\n ->build();\n\n $column1 = ColumnConfigurationBuilder::create()\n ->name(\"name\")\n ->build();\n\n $conf = $this->parser->parse($this->request, [$column, $column1]);\n\n // assert column order\n $this->assertCount(2, $conf->orderColumns());\n $def = $conf->orderColumns()[0];\n $this->assertSame('name', $def->columnName());\n $this->assertFalse($def->isAscending());\n }", "public function responseType ();", "function sortServerInfo($a, $b)\r\n{\r\n\tif($a['name'] == \"Unrecognized Game\" && $b['name'] == \"Unrecognized Game\")\r\n\t{\r\n\t\treturn sortByLocationAndPort($a, $b);\r\n\t}\r\n\telse\r\n\t{\r\n\t\tif($a['name'] == \"Unrecognized Game\") return 1;\r\n\t\tif($b['name'] == \"Unrecognized Game\") return -1;\r\n\t}\r\n\r\n\tif($a['name'] == $b['name'])\r\n\t{\r\n\t\treturn sortByLocationAndPort($a, $b);\r\n\t}\r\n\telse\r\n\t{\r\n\t\tif($a['name'] > $b['name']) return 1;\r\n\t\tif($a['name'] < $b['name']) return -1;\r\n\t}\r\n\treturn 0;\r\n}", "function cmp_by_name($val1, $val2){\n return strcmp($val1->name, $val2->name);\n}", "public function testProcessResponse()\n\t{\n\t\t$response = new JHttpResponse;\n\t\t$response->code = 200;\n\t\t$response->body = \"<ListAllMyBucketsResult xmlns=\\\"http://s3.amazonaws.com/doc/2006-03-01/\\\">\"\n\t\t\t. \"<Owner><ID>6e887773574284f7e38cacbac9e1455ecce62f79929260e9b68db3b84720ed96</ID>\"\n\t\t\t. \"<DisplayName>alex.ukf</DisplayName></Owner><Buckets><Bucket><Name>jgsoc</Name>\"\n\t\t\t. \"<CreationDate>2013-06-29T10:29:36.000Z</CreationDate></Bucket></Buckets></ListAllMyBucketsResult>\";\n\t\t$expectedResult = new SimpleXMLElement($response->body);\n\n\t\t$this->assertThat(\n\t\t\t$this->object->processResponse($response),\n\t\t\t$this->equalTo($expectedResult)\n\t\t);\n\t}", "public function testListCars(){\n $cars = Car::orderBy(\"created_at\", \"desc\")->with(\"type\", \"brand\", \"owner\")->get();\n $response = $this->json(\"GET\", \"/cars\");\n $response->assertJsonFragment($cars->first()->toArray());\n $response->assertStatus(200);\n }", "protected function setUp(): void\n {\n parent::setUp();\n\n $this->response = new Response(200, [], '[{\n \"cik\" : \"0001067983\",\n \"name\" : \" BERKSHIRE HATHAWAY\"\n }, {\n \"cik\" : \"0000949012\",\n \"name\" : \" BERKSHIRE ASSET MANAGEMENT LLC/PA \"\n }, {\n \"cik\" : \"0000949012\",\n \"name\" : \" BERKSHIRE ASSET MANAGEMENT INC/PA \"\n }, {\n \"cik\" : \"0001133742\",\n \"name\" : \" BERKSHIRE CAPITAL HOLDINGS\"\n }, {\n \"cik\" : \"0001535172\",\n \"name\" : \" Berkshire Money Management, Inc. \"\n }, {\n \"cik\" : \"0001067983\",\n \"name\" : \"BERKSHIRE HATHAWAY\"\n }, {\n \"cik\" : \"0001312988\",\n \"name\" : \"Berkshire Partners LLC\"\n }, {\n \"cik\" : \"0001133742\",\n \"name\" : \"BERKSHIRE CAPITAL HOLDINGS\"\n }, {\n \"cik\" : \"0000949012\",\n \"name\" : \"BERKSHIRE ASSET MANAGEMENT LLC/PA\"\n }, {\n \"cik\" : \"0001535172\",\n \"name\" : \"Berkshire Money Management, Inc.\"\n }, {\n \"cik\" : \"0001831984\",\n \"name\" : \"Berkshire Bank\"\n }, {\n \"cik\" : \"0001831984\",\n \"name\" : \"BERKSHIRE HATHAWAY\"\n }]');\n\n $this->client = $this->setupMockedClient($this->response);\n }", "abstract protected function _getSortType();", "public function testSortByTitle()\n {\n $item1 = new \\Saitow\\Model\\Tire('sql', 1);\n $item1->setTitle('B');\n\n $item2 = new Saitow\\Model\\Tire('xml', 50);\n $item2->setTitle('A');\n\n $item3 = new \\Saitow\\Model\\Tire('other', 22);\n $item3->setTitle('C');\n\n $items = [$item1, $item2, $item3];\n\n $sorted = TiresCollectionSorter::sort($items, \\Saitow\\Library\\TiresDataSource::ORDERBY_MANUFACTURE);\n\n $this->assertEquals($item2, $sorted[0]);\n $this->assertEquals($item1, $sorted[1]);\n $this->assertEquals($item3, $sorted[2]);\n }", "public function testAutocompleteResponse()\n {\n }", "function sort_requests_by_total($a, $b)\n{\n if($a->total == $b->total) return 0;\n return ($a->total > $b->total) ? -1 : 1;\n}", "public function testFilterByTitle()\n {\n $response = $this->runApp('GET', '/v1/products?q=.net&password=' . $this->apiPassword);\n\n $this->assertEquals(StatusCode::HTTP_OK, $response->getStatusCode());\n $result = (array)json_decode($response->getBody())->result;\n $this->assertEquals(count($result), 7);\n }", "public function testFilterByTitle2()\n {\n $response = $this->runApp('GET', '/v1/products?q=tremblay&password=' . $this->apiPassword);\n\n $this->assertEquals(StatusCode::HTTP_OK, $response->getStatusCode());\n $sJson = '[{\"id\":\"12\",\"title\":\"tremblay.com\",\"brand\":\"dolorem\",\"price\":\"94953540.00\",\"stock\":\"4\"}]';\n $result = (array)json_decode($response->getBody())->result;\n\n $this->assertEquals(json_decode($sJson), $result);\n }", "public function testAssertContentType(): void\n {\n $this->_response = new Response();\n $this->_response = $this->_response->withType('json');\n\n $this->assertContentType('json');\n $this->assertContentType('application/json');\n }", "function rest_filter_response_fields($response, $server, $request)\n {\n }", "public function testGetAll()\n {\n $response = $this->get('/api/Product/GetAll/');\n\n $response->assertStatus(200);\n $response->assertJsonStructure(['data' =>\n [\n '*' =>[\n 'name'\n ]\n ],\n ]);\n\n }", "public function dataForTestSort()\n {\n return [\n ['id', 'posts.id'],\n ['body', 'posts.body'],\n ];\n }", "public function testDataResponse()\n {\n $driversEndpoint = new DriverClassesEndpoint(getenv('MRP_API_KEY'));\n $data = $driversEndpoint->setDriverCount(1)\n ->setOrder('name')\n ->setIncludeStats('true')\n ->setScheduleYear(2016)\n ->setFeaturedOnly('true')\n ->setForcePic('false')\n ->setIncludeDrivers('true')\n ->getRequest();\n\n $this->assertNotEmpty($data);\n $this->assertTrue(is_object($data));\n $this->assertEquals(1, $data->RequestValid);\n }", "public function test_getAllVehicleTest()\n {\n $response = $this->get('/api/inventory/vehicles/search');\n\n $response->assertStatus(200);\n $response->assertJson ([\n 'data'=>[[\n \"name\"=>$response['data'][0]['name'],\n \"model\"=>$response['data'][0]['model'],\n \"manufacturer\"=> $response['data'][0]['count'],\n \"cost_in_credits\" =>$response['data'][0]['cost_in_credits'],\n \"length\"=>$response['data'][0]['length'],\n \"max_atmosphering_speed\"=> $response['data'][0]['max_atmosphering_speed'],\n \"crew\"=> $response['data'][0]['crew'],\n \"passengers\"=>$response['data'][0]['passengers'],\n \"cargo_capacity\"=>$response['data'][0]['cargo_capacity'],\n \"consumables\"=> $response['data'][0]['consumables'],\n \"vehicle_class\"=>$response['data'][0]['vehicle_class'],\n \"pilots\"=>$response['data'][0]['pilots'],\n \"films\"=>$response['data'][0]['films'],\n \"created\"=> $response['data'][0]['created'],\n \"edited\"=> $response['data'][0]['edited'],\n \"url\"=> $response['data'][0]['url'],\n \"count\"=> $response['data'][0]['count']\n ]]\n\n\n\n ]);\n }", "public function testSortSalaryAsc()\n {\n $repository = new Repository();\n dd($repository->getCities());\n\n $result = $repository->all(['sort_salary' => 'asc']);\n\n $this->assertInstanceOf('stdClass', array_first($result));\n }", "private function checkDataStructure($response)\n {\n $this->assertInstanceOf(Data::class, $response);\n $this->assertIsArray($response->data);\n foreach ($response->data as $ticker) {\n $this->assertInstanceOf(Ticker::class, $ticker);\n $this->assertIsString($ticker->slug);\n $this->assertIsString($ticker->title);\n $this->assertIsString($ticker->symbol);\n $this->assertIsInt($ticker->rank);\n $this->assertIsFloat($ticker->price);\n $this->assertIsFloat($ticker->volume);\n }\n }", "public function it_sorts_by_field_in_ascending_order(): void\n {\n $results = Client::filter([\n 'sorts' => [\n [\n 'column' => 'name',\n 'direction' => 'asc',\n ],\n ],\n ])->get();\n\n self::assertEquals($results->sortBy('name')->pluck('id'), $results->pluck('id'));\n }", "public function testIndex()\n\t{\n\t\t$response = $this->call('GET', '/'.self::$endpoint);\n\t\t$this->assertEquals(200, $response->getStatusCode());\n\t\t$result = $response->getOriginalContent()->toArray();\n\t\t$this->assertTrue(is_array($result));\n\t\t$this->assertTrue(count($result)>0);\n\n\t\t// tes apakah hasil return adalah yang sesuai\n\t\tforeach ($this->obj->attributesToArray() as $attr => $attr_val)\n\t\t\t$this->assertArrayHasKey($attr, $result[0]);\n\t}", "function cmp_entries($a, $b){\n $a_nameparts = explode(\" \", $a[\"name\"], 2);\n $b_nameparts = explode(\" \", $b[\"name\"], 2);\n $result = 0;\n if( isset($a_nameparts[1]) && isset($b_nameparts[1]) ){\n $result = strcmp($a_nameparts[1], $b_nameparts[1]);\n }\n if( $result === 0 ) {\n $result = strcmp($a_nameparts[0], $b_nameparts[0]);\n }\n if( $result === 0 ) {\n $result = strcmp($a[\"number\"], $b[\"number\"]);\n }\n return $result;\n}", "private static function formatAndSortResult(&$result)\n {\n if (!is_array($result)) {\n return $result;\n }\n\n $result['formatedPrivateDataList'] = array();\n\n // Parse list of private data and create key/value association instead of classic key/value list\n if (isset($result['privateDataList']) && is_array($result['privateDataList']) && isset($result['privateDataList']['privateData']) && is_array($result['privateDataList']['privateData'])) {\n foreach ($result['privateDataList']['privateData'] as $k => $v) {\n if (is_array($v) && isset($v['key']) && isset($v['value'])) {\n $result['formatedPrivateDataList'][$v['key']] = $v['value'];\n }\n }\n }\n\n // Parse list of billing record and add a calculated_status column\n if (isset($result['billingRecordList']) && is_array($result['billingRecordList']) && isset($result['billingRecordList']['billingRecord']) && is_array($result['billingRecordList']['billingRecord'])) {\n foreach ($result['billingRecordList']['billingRecord'] as &$billingRecord) {\n $billingRecord['calculated_status'] = $billingRecord['status'];\n if ($billingRecord['status'] != 2 && isset($billingRecord['result']) && (!PaylinePaymentGateway::isValidResponse($billingRecord, self::$approvedResponseCode) || !PaylinePaymentGateway::isValidResponse($billingRecord, self::$pendingResponseCode))) {\n $billingRecord['calculated_status'] = 2;\n }\n }\n }\n\n // Sort associatedTransactionsList by date, latest first (not done by the API)\n if (isset($result['associatedTransactionsList']) && isset($result['associatedTransactionsList']['associatedTransactions']) && is_array($result['associatedTransactionsList']['associatedTransactions'])) {\n uasort($result['associatedTransactionsList']['associatedTransactions'], function ($a, $b) {\n if (self::getTimestampFromPaylineDate($a['date']) == self::getTimestampFromPaylineDate($b['date'])) {\n return 0;\n } elseif (self::getTimestampFromPaylineDate($a['date']) > self::getTimestampFromPaylineDate($b['date'])) {\n return -1;\n } else {\n return 1;\n }\n });\n }\n\n // Sort statusHistoryList by date, latest first (not done by the API)\n if (isset($result['statusHistoryList']) && isset($result['statusHistoryList']['statusHistory']) && is_array($result['statusHistoryList']['statusHistory'])) {\n uasort($result['statusHistoryList']['statusHistory'], function ($a, $b) {\n if (self::getTimestampFromPaylineDate($a['date']) == self::getTimestampFromPaylineDate($b['date'])) {\n return 0;\n } elseif (self::getTimestampFromPaylineDate($a['date']) > self::getTimestampFromPaylineDate($b['date'])) {\n return -1;\n } else {\n return 1;\n }\n });\n }\n\n return $result;\n }", "public static function sort_all($a, $b){\n if($a->type == \"book\" && $b->type == \"book\"){\n if (!empty($a->series)){\n if (!empty($b->series)){\n return (strtolower($a->series) == strtolower($b->series)) ? ($a->volume > $b->volume) : strtolower($a->series) > strtolower($b->series);\n }else{\n return (strtolower($a->series) == strtolower($b->title)) ? ($a->volume > $b->volume) : strtolower($a->series) > strtolower($b->title);\n }\n }else{\n if (!empty($b->series)){\n return (strtolower($a->title) == strtolower($b->series)) ? ($a->volume > $b->volume) : strtolower($a->title) > strtolower($b->series);\n }else{\n return (strtolower($a->title) == strtolower($b->title)) ? ($a->volume > $b->volume) : strtolower($a->title) > strtolower($b->title);\n }\n }\n }else if ($a->type == \"movie\" && $b->type == \"movie\"){\n return (strtolower($a->title) == strtolower($b->title)) ? ($a->season > $b->season) : strtolower($a->title) > strtolower($b->title);\n }else{\n return strtolower($a->title) > strtolower($b->title);\n }\n }", "public function test_it_can_order_by_display_name_of_sp_handle_sps_without_display_name_correctly()\n {\n $locale = 'en';\n $specifiedConsent = [\n $this->buildMockSpecifiedConsent($locale, '', 'https://aa.example.com/metadata'),\n $this->buildMockSpecifiedConsent($locale, 'https://selfservice'),\n $this->buildMockSpecifiedConsent($locale, '', 'https://selfservice.stepup.example.com/metadata'),\n $this->buildMockSpecifiedConsent($locale, 'Healty-service'),\n ];\n $list = SpecifiedConsentList::createWith($specifiedConsent);\n $list->sortByDisplayName('en');\n /** @var SpecifiedConsent[] $sorted */\n $sorted = $list->getIterator()->getArrayCopy();\n $this->assertEquals('Healty-service', array_shift($sorted)->getServiceProvider()->getLocaleAwareEntityName($locale));\n $this->assertEquals('https://selfservice', array_shift($sorted)->getServiceProvider()->getLocaleAwareEntityName($locale));\n $this->assertEquals('https://aa.example.com/metadata', array_shift($sorted)->getServiceProvider()->getLocaleAwareEntityName($locale));\n $this->assertEquals('https://selfservice.stepup.example.com/metadata', array_shift($sorted)->getServiceProvider()->getLocaleAwareEntityName($locale));\n }", "public function test_resultsAreValidFormat() {\n $types = ['track'];\n\n foreach ($types as $tk => $type) {\n $searchInstance = new SpotifySearch('a', $type, SingletonTokenContainer::get());\n $results = $searchInstance->getNextPage()->get();\n\n foreach ($results as $ik => $item) {\n $this->assertNotEmpty($item->href);\n $this->assertNotEmpty($item->name);\n if ($type != 'track') {\n $this->assertNotEmpty($item->images);\n } else {\n $this->assertNotEmpty($item->album);\n }\n }\n }\n\n }", "public function test_treatments_can_get_public_list_by_name_true()\n {\n $this->seed();\n $number = rand(2,6);\n Treatment::factory()\n ->count(3)\n ->create();\n $name = Str::random(10);\n Treatment::factory()->create(['title'=> $name, 'public'=>1]);\n $response = $this->json('GET','/api/treatments/list?name='.$name);\n\n $response->assertStatus(200)->assertJsonCount(1, 'data');\n }", "public function testApiLoadModels()\n {\n $response = $this->get($this->apiPath . '/dinamicQuery/models', $this->createAuthHeaderToAdminUser());\n $response->assertStatus(200);\n\n $responseData = $response->decodeResponseJson();\n\n $this->seeJsonStructure($response, ['*' => [\n 'name', 'attributes' => [\n '*' => ['name', 'type']\n ]\n ]]);\n\n //need to be at least user model\n $this->assertContains('User', collect($responseData)->pluck('name')->all());\n }", "private function determineResponseOrder(Collection $responses): Collection\n {\n return $responses->each(\n function (ResponseQueueItem $data, $response) use ($responses) {\n if (isset($data->type)) {\n switch ($data->type) {\n case 'condition':\n $data->order += 3000000;\n break;\n case 'weighted':\n case 'atomic':\n $data->order += 1000000;\n break;\n }\n\n $responses->put($response, $data);\n }\n }\n );\n }", "public function testFindPetByStatus()\n {\n // initialize the API client\n $config = (new Configuration())->setHost('http://petstore.swagger.io/v2');\n $api_client = new ApiClient($config);\n $pet_api = new Api\\PetApi($api_client);\n // return Pet (model)\n $response = $pet_api->findPetsByStatus(\"available\");\n $this->assertGreaterThan(0, count($response)); // at least one object returned\n $this->assertSame(get_class($response[0]), \"Swagger\\\\Client\\\\Model\\\\Pet\"); // verify the object is Pet\n // loop through result to ensure status is \"available\"\n foreach ($response as $_pet) {\n $this->assertSame($_pet['status'], \"available\");\n }\n // test invalid status\n $response = $pet_api->findPetsByStatus(\"unknown_and_incorrect_status\");\n $this->assertSame(count($response), 0); // confirm no object returned\n }", "public function test_response_get_faturas()\n {\n $response = $this->json('GET', 'api/fatura/historico-faturas');\n\n\n $response->assertStatus(200);\n }", "public function testGroupTypeIndex()\n {\n $groupType = factory(GroupType::class)->create();\n $groupNames = [\n 'Batman Begins',\n 'Bipartisan',\n 'Brave New World',\n 'If I Never Knew You',\n 'San Dimas High School',\n 'Santa Claus',\n ];\n\n foreach ($groupNames as $groupName) {\n factory(Group::class)->create([\n 'group_type_id' => $groupType->id,\n 'name' => $groupName,\n ]);\n }\n\n $response = $this->getJson('api/v3/groups');\n $decodedResponse = $response->decodeResponseJson();\n\n $response->assertStatus(200);\n $this->assertEquals(6, $decodedResponse['meta']['pagination']['count']);\n\n $response = $this->getJson('api/v3/groups?filter[name]=new');\n $decodedResponse = $response->decodeResponseJson();\n\n $response->assertStatus(200);\n $this->assertEquals(2, $decodedResponse['meta']['pagination']['count']);\n\n $response = $this->getJson('api/v3/groups?filter[name]=san');\n $decodedResponse = $response->decodeResponseJson();\n\n $response->assertStatus(200);\n $this->assertEquals(3, $decodedResponse['meta']['pagination']['count']);\n\n // Test for encoded special characters.\n $response = $this->getJson('api/v3/groups?filter[name]=g%5C');\n $decodedResponse = $response->decodeResponseJson();\n\n $response->assertStatus(200);\n $this->assertEquals(0, $decodedResponse['meta']['pagination']['count']);\n }", "public function testOGParserResponse()\n {\n $user = factory(\\App\\User::class, 1)->create();\n\n $response = $this->json(\n 'POST',\n '/api/content/ogparser',\n ['url' => 'https://www.codejungle.org'],\n ['HTTP_Authorization' => 'Bearer '.$user[0]->api_token]\n );\n\n $response->assertStatus(200);\n $response->assertJsonStructure(\n ['ogtags' => ['title', 'image', 'description']]\n );\n }", "protected function _assertJsonApiResponse()\n {\n $this->assertHeader('Content-Type', 'application/vnd.api+json');\n $this->assertContentType('application/vnd.api+json');\n }", "public function getResponseType();", "public function getResponseType();", "private function checkResponseFormat(){\n\n }", "function sort_compare_type($a, $b) {\n // Order table types by hardcoded values in a local function getTypePriority.\n // Order tables alphabetically.\n //$cmp = $this->getTypePriority($a['Type']) - $this->getTypePriority($b['Type']);\n //if ($cmp != 0) return $cmp;\n //return strnatcmp($a['Name'], $b['Name']);\n\n // New way of sort. 11/27/2015.\n // Order both table types and tables by priority defined in WMD.\n //print $a['Type'] . \" := \" . $this->tableTypePriorityHash[$a['Type']] . \" - \" .\n // $b['Type'] . \" := \" . $this->tableTypePriorityHash[$b['Type']] . \"<br/>\";\n $cmp = $this->tableTypePriorityHash[$a['Type']] - $this->tableTypePriorityHash[$b['Type']];\n if ($cmp != 0) return $cmp;\n return $this->tablePriorityHash[$a['Name']] - $this->tablePriorityHash[$b['Name']];\n }", "public function prepare_response_for_collection($response)\n {\n }", "function test_a_user_can_filter_threads_by_popularity(){\n // with 2,3 and 0 replies respectively\n\n $ThreadWithTwoReplies = create('App\\Thread');\n create('App\\Reply',['thread_id'=>$ThreadWithTwoReplies->id],2);\n\n\n $ThreadWithThreeReplies = create('App\\Thread');\n create('App\\Reply',['thread_id'=>$ThreadWithThreeReplies->id],3);\n\n $ThreadWithNoReplies = $this->thread;\n\n\n\n //When I filter all threads by popularity\n $response = $this->getJson('threads?popular=1')->json();\n // then they should be returned from most replies to least\n\n $this->assertEquals([3,2,0], array_column($response,'replies_count'));\n\n }", "public static function cmp($a, $b)\n {\n return $a['name'] > $b['name'];\n }", "public function testRetrieveTheCategoryList(): void\n {\n $response = $this->request('GET', '/api/categories');\n $json = json_decode($response->getContent(), true);\n\n $this->assertEquals(200, $response->getStatusCode());\n $this->assertEquals('application/json; charset=utf-8', $response->headers->get('Content-Type'));\n\n $this->assertCount(5, $json);\n\n foreach ($json as $key => $value) {\n $this->assertArrayHasKey('id', $json[$key]);\n $this->assertArrayHasKey('name', $json[$key]);\n $this->assertArrayHasKey('createdAt', $json[$key]); \n } \n }", "public function testSortNamesList(): void\n {\n $result = $this->sorter->sortList(self::UNSORTED_NAMES_LIST);\n self::assertSame(\n // Don't tab the names list;\n // Good practice for unit test doesn't transform the expected result in any way.\n <<<SORTED\nMarin Alvarez\nAdonis Julius Archer\nBeau Tristan Bentley\nHunter Uriah Mathew Clarke\nLeo Gardner\nVaughn Lewis\nLondon Lindsey\nMikayla Lopez\nJanet Parsons\nFrankie Conner Ritter\nShelby Nathan Yoder\nSORTED,\n $result\n );\n }", "function sort_results ($unsorted)\n{\n // Add a key to all objects in the array that allows for sensible\n // sorting of numeric substrings.\n foreach ($unsorted as $res) {\n $res->key = preg_replace_callback (\n '|\\d+|',\n function ($match) {\n return 'zz' . strval (strlen ($match[0])) . $match[0];\n },\n $res->meta_value\n );\n }\n\n // Sort the array according to key.\n usort (\n $unsorted,\n function ($res1, $res2) {\n return strcoll ($res1->key, $res2->key);\n }\n );\n\n return array_map (\n function ($s) {\n return $s->meta_value;\n },\n $unsorted\n );\n}", "public function testListSuppliers()\n {\n $stream = '{\"first_page_url\":\"page=1\",\"from\":1,\"last_page\":2,\"last_page_url\":\"page=2\",\"next_page_url\":\"page=2\",\"path\":\"\\/entities\\/suppliers\",\"per_page\":50,\"prev_page_url\":null,\"to\":55,\"total\":55,\"data\":[{\"id\":12345,\"code\":\"AE86\",\"name\":\"Mario Rossi S.R.L.\",\"type\":\"company\",\"first_name\":\"Mario\",\"last_name\":\"Rossi\",\"contact_person\":\"\",\"vat_number\":\"111222333\",\"tax_code\":\"111122233\",\"address_street\":\"Corso Magellano, 46\",\"address_postal_code\":\"20146\",\"address_city\":\"Milano\",\"address_province\":\"MI\",\"address_extra\":\"\",\"country\":\"Italia\",\"email\":\"[email protected]\",\"certified_email\":\"[email protected]\",\"phone\":\"1234567890\",\"fax\":\"123456789\",\"notes\":\"\",\"created_at\":\"2021-15-08\",\"updated_at\":\"2021-15-08\"},{\"id\":12346,\"code\":\"GT86\",\"name\":\"Maria Grossi S.R.L.\",\"type\":\"company\",\"first_name\":\"\",\"last_name\":\"\",\"contact_person\":\"\",\"vat_number\":\"200020102020\",\"tax_code\":\"200020102020\",\"address_street\":\"Vicolo stretto, 32\",\"address_postal_code\":\"20146\",\"address_city\":\"Milano\",\"address_province\":\"MI\",\"address_extra\":\"\",\"country\":\"Italia\",\"email\":\"[email protected]\",\"certified_email\":\"[email protected]\",\"phone\":\"0987654321\",\"fax\":\"098765432\",\"notes\":\"\",\"created_at\":\"2021-15-09\",\"updated_at\":\"2021-15-09\"}]}';\n $mock = new MockHandler([new Response(\n 200,\n ['Content-Type' => 'application/json'],\n $stream\n )]);\n\n $handler = HandlerStack::create($mock);\n $apiInstance = new \\FattureInCloud\\Api\\SuppliersApi(\n new \\GuzzleHttp\\Client(['handler' => $handler])\n );\n $company_id = 2;\n $result = $apiInstance->listSuppliers($company_id);\n $obj = ObjectSerializer::deserialize($stream, '\\FattureInCloud\\Model\\ListSuppliersResponse');\n\n TestCase::assertEquals($obj, $result);\n }", "public function test_rest_filter_response_fields_no_request_filter() {\n\t\t$response = new WP_REST_Response();\n\t\t$response->set_data( array( 'a' => true ) );\n\t\t$request = array();\n\n\t\t$response = rest_filter_response_fields( $response, null, $request );\n\t\t$this->assertSame( array( 'a' => true ), $response->get_data() );\n\t}", "public function test_rest_filter_response_fields_single_field_filter() {\n\t\t$response = new WP_REST_Response();\n\t\t$response->set_data(\n\t\t\tarray(\n\t\t\t\t'a' => 0,\n\t\t\t\t'b' => 1,\n\t\t\t\t'c' => 2,\n\t\t\t)\n\t\t);\n\t\t$request = array(\n\t\t\t'_fields' => 'b',\n\t\t);\n\n\t\t$response = rest_filter_response_fields( $response, null, $request );\n\t\t$this->assertSame( array( 'b' => 1 ), $response->get_data() );\n\t}", "public function determineResponseType(string $response): string\n {\n $wildcards = [\n 'weighted' => '{weight=(.+?)}',\n 'condition' => '/^\\*/',\n 'continue' => '/^\\^/',\n 'atomic' => '/-/',\n ];\n\n foreach ($wildcards as $type => $pattern) {\n if (@preg_match_all($pattern, $response, $matches)) {\n return $type;\n }\n }\n\n return 'atomic';\n }", "public function testCategorySearchByName()\n {\n echo \"\\n testCategorySearchByName...\";\n $url = TestServiceAsReadOnly::$elasticsearchHost.$this->context.\"/category_search\";\n $query = \"{\\\"query\\\": { \".\n \"\\\"term\\\" : { \\\"Name\\\" : \\\"Cell Death\\\" } \". \n \"}}\";\n $response = $this->just_curl_get_data($url, $query);\n $response = $this->handleResponse($response);\n //echo \"\\n testCategorySearchByName response:\".$response.\"---\";\n if(is_null($response))\n {\n echo \"\\n testCategorySearchByName response is empty\";\n $this->assertTrue(false);\n }\n \n $result = json_decode($response);\n if(is_null($result))\n {\n echo \"\\n testCategorySearchByName json is invalid\";\n $this->assertTrue(false);\n }\n \n if(isset($result->hits->total) && $result->hits->total > 0)\n $this->assertTrue(true);\n else \n $this->assertTrue(false);\n \n }", "private function sortQueryOrders() {\n foreach ($this->queryResult as $index => $order) {\n $order = $this->injectKitData($order);\n $this->statusOutputOrder[$order['Order']['status']][$order['Order']['id']] = $order;\n }\n }", "public function getSortBy();", "function addressbook_cmp($a,$b) {\n\n if($a['backend'] > $b['backend']) {\n return 1;\n } else if($a['backend'] < $b['backend']) {\n return -1;\n }\n\n return (strtolower($a['name']) > strtolower($b['name'])) ? 1 : -1;\n\n}", "public function testListingWithFilters()\n {\n $filters[] = ['limit' => 30, 'page' => 30];\n $filters[] = ['listing_type' => 'public'];\n foreach ($filters as $k => $v) {\n $client = static::createClient();\n $client->request('GET', '/v2/story', $v, [], $this->headers);\n $this->assertStatusCode(200, $client);\n\n $response = json_decode($client->getResponse()->getContent(), true);\n $this->assertTrue(is_array($response));\n }\n }", "public function testFindPetsByTags()\n {\n // initialize the API client\n $config = (new Configuration())->setHost('http://petstore.swagger.io/v2');\n $api_client = new ApiClient($config);\n $pet_api = new Api\\PetApi($api_client);\n // return Pet (model)\n $response = $pet_api->findPetsByTags(\"test php tag\");\n $this->assertGreaterThan(0, count($response)); // at least one object returned\n $this->assertSame(get_class($response[0]), \"Swagger\\\\Client\\\\Model\\\\Pet\"); // verify the object is Pet\n // loop through result to ensure status is \"available\"\n foreach ($response as $_pet) {\n $this->assertSame($_pet['tags'][0]['name'], \"test php tag\");\n }\n // test invalid status\n $response = $pet_api->findPetsByTags(\"unknown_and_incorrect_tag\");\n $this->assertSame(count($response), 0); // confirm no object returned\n }", "public function testGetOrderByFilter()\n {\n }", "public function testOrderByMultiple()\n {\n if (DB::get_conn() instanceof MySQLDatabase) {\n $query = new SQLSelect();\n $query->setSelect(['\"Name\"', '\"Meta\"']);\n $query->setFrom('\"SQLSelectTest_DO\"');\n $query->setOrderBy(['MID(\"Name\", 8, 1) DESC', '\"Name\" ASC']);\n\n $records = [];\n foreach ($query->execute() as $record) {\n $records[] = $record;\n }\n\n $this->assertCount(2, $records);\n\n $this->assertEquals('Object 2', $records[0]['Name']);\n $this->assertEquals('2', $records[0]['_SortColumn0']);\n\n $this->assertEquals('Object 1', $records[1]['Name']);\n $this->assertEquals('1', $records[1]['_SortColumn0']);\n }\n }", "public function test_rest_filter_response_fields_multi_field_filter() {\n\t\t$response = new WP_REST_Response();\n\t\t$response->set_data(\n\t\t\tarray(\n\t\t\t\t'a' => 0,\n\t\t\t\t'b' => 1,\n\t\t\t\t'c' => 2,\n\t\t\t\t'd' => 3,\n\t\t\t\t'e' => 4,\n\t\t\t\t'f' => 5,\n\t\t\t)\n\t\t);\n\t\t$request = array(\n\t\t\t'_fields' => 'b,c,e',\n\t\t);\n\n\t\t$response = rest_filter_response_fields( $response, null, $request );\n\t\t$this->assertSame(\n\t\t\tarray(\n\t\t\t\t'b' => 1,\n\t\t\t\t'c' => 2,\n\t\t\t\t'e' => 4,\n\t\t\t),\n\t\t\t$response->get_data()\n\t\t);\n\t}", "public function test_it_returns_list_of_pap_types()\n {\n $this->seed(PapTypesTableSeeder::class);\n\n $response = $this->getJson(route('api.pap_types.index'));\n\n $response\n ->assertStatus(200)\n ->assertJsonStructure([\n 'data' => [\n [\n 'id',\n 'name',\n 'slug'\n ]\n ],\n ]);\n }", "function businessNameSort ($x, $y) {\r\n return strcasecmp($x['businessName'], $y['businessName']);\r\n}", "public function testListTags() : void\n {\n $response = $this->actingAs(static::$user, 'api')\n ->get('/api/tags');\n\n $response->assertStatus(200);\n\n $response->assertJsonStructure([\n '*' => [\n 'id',\n 'name'\n ]\n ]);\n }", "public function testCollectionsApi()\n {\n $response = $this->withHeaders([\n 'X-Secure-Code' => '12345678',\n ])->getJson('api/collections/0');\n\n $response->assertStatus(200)\n ->assertJsonPath('title','親子步道')\n ->assertJsonStructure([\n 'id',\n 'title',\n 'subTitle',\n 'bgColor',\n 'iconImage',\n 'trails',\n ]);\n }", "public function testRetrieveTheProductList(): void\n {\n $response = $this->request('GET', '/api/products');\n $json = json_decode($response->getContent(), true);\n\n $this->assertEquals(200, $response->getStatusCode());\n $this->assertEquals('application/json; charset=utf-8', $response->headers->get('Content-Type'));\n\n $this->assertCount(10, $json);\n\n foreach ($json as $key => $value) {\n $this->assertArrayHasKey('id', $json[$key]);\n $this->assertArrayHasKey('name', $json[$key]);\n $this->assertArrayHasKey('description', $json[$key]);\n $this->assertArrayHasKey('price', $json[$key]);\n $this->assertArrayHasKey('priceWithTax', $json[$key]);\n $this->assertArrayHasKey('category', $json[$key]);\n $this->assertArrayHasKey('id', $json[$key]['category']);\n $this->assertArrayHasKey('name', $json[$key]['category']);\n $this->assertArrayHasKey('tax', $json[$key]);\n $this->assertArrayHasKey('id', $json[$key]['tax']);\n $this->assertArrayHasKey('name', $json[$key]['tax']);\n $this->assertArrayHasKey('value', $json[$key]['tax']);\n $this->assertArrayHasKey('images', $json[$key]);\n foreach ($json[$key]['images'] as $image) {\n $this->assertArrayHasKey('id', $image);\n $this->assertArrayHasKey('fileName', $image);\n $this->assertArrayHasKey('mimeType', $image);\n }\n $this->assertArrayHasKey('updatedAt', $json[$key]);\n $this->assertArrayHasKey('createdAt', $json[$key]);\n } \n }", "function alistcmp($a,$b) {\n $abook_sort_order=get_abook_sort();\n\n switch ($abook_sort_order) {\n case 0:\n case 1:\n $abook_sort='nickname';\n break;\n case 4:\n case 5:\n $abook_sort='email';\n break;\n case 6:\n case 7:\n $abook_sort='label';\n break;\n case 2:\n case 3:\n case 8:\n default:\n $abook_sort='name';\n }\n\n if ($a['backend'] > $b['backend']) {\n return 1;\n } else {\n if ($a['backend'] < $b['backend']) {\n return -1;\n }\n }\n\n if( (($abook_sort_order+2) % 2) == 1) {\n return (strtolower($a[$abook_sort]) < strtolower($b[$abook_sort])) ? 1 : -1;\n } else {\n return (strtolower($a[$abook_sort]) > strtolower($b[$abook_sort])) ? 1 : -1;\n }\n}", "public function parseUrlUsingSortEnabled()\n {\n $query = new ControllerQuery($this->enabledFilters, '/test');\n $url = $query->setSorts(['field' => 'asc', 'another field' => 'desc'])\n ->build();\n\n $this->assertEquals(\n 'http://www.comicvine.com/api/test/?limit=100&offset=0&sort=field:asc,another+field:desc',\n $url\n );\n }", "public function testGetOrdersWithCorrectParams()\n {\n echo \"\\n ***** Valid test - param value (page=4 and limit=2) - should get 200 ***** \\n \";\n $params = '{\"origin\": [\"-33.865143\",\"151.209900\"], \"destination\": [\"-37.663712\",\"144.844788\"]}';\n $params = json_decode($params, true);\n $response = $this->json('POST', '/orders', $params);\n \n $params = '{\"origin\": [\"-33.865143\",\"151.209900\"], \"destination\": [\"-37.663712\",\"144.844788\"]}';\n $params = json_decode($params, true);\n $response = $this->json('POST', '/orders', $params);\n \n $params = 'page=1&limit=2';\n $response = $this->json('GET', '/orders?'.$params);\n $response_data = $response->getContent();\n $response->assertStatus(200);\n\n echo \"\\n ***** Valid test - Number or count of response should be less than 2 - should get 200 ***** \\n \";\n $this->assertLessThan(3, count($response_data));\n \n echo \"\\n ***** Valid test - Get Order - Response should contain id, distance and status keys only ***** \\n\";\n $response_data = json_decode($response_data);\n\n foreach ($response_data as $order) {\n $order = (array) $order;\n $this->assertArrayHasKey('id', $order);\n $this->assertArrayHasKey('distance', $order);\n $this->assertArrayHasKey('status', $order);\n }\n }", "public function testGetChildren_SortingLimit()\n\t{\n\t\t$this->object->AddChild($this->child);\n\t\t$newChild1 = new child(\"efg\");\n\t\t$newChild2 = new child(\"abc\");\n\t\t$newChild3 = new child(\"d\");\n\n\t\t$this->object->AddChild($newChild1);\n\t\t$this->object->AddChild($newChild2);\n\t\t$this->object->AddChild($newChild3);\n\n\t\t$this->object->Save();\n\n\t\t$childrenList = $this->object->GetChildList(array(array(\"childId\", \">\", 0)), \"attribute\", true, 2);\n\n\t\t$this->assertEquals(\"abc\", $childrenList[0]->attribute);\n\t\t$this->assertEquals(\"child att\", $childrenList[1]->attribute);\n\n\t\t$childrenList = $this->object->GetChildList(array(array(\"childId\", \">\", 0)), \"attribute\", false, 2);\n\n\t\t$this->assertEquals(\"efg\", $childrenList[0]->attribute);\n\t\t$this->assertEquals(\"d\", $childrenList[1]->attribute);\n\t}", "function _usort_terms_by_name($a, $b)\n {\n }", "public function topFiltered(string $flag): ResponseInterface;", "public function testIndex()\n {\n // $this->assertTrue(true);\n $response = $this->json('get','/api/todos');\n $this->seeJsonStructure($response, [\n '*' => [\n 'id', 'status', 'title', 'created_at', 'updated_at'\n ]\n ]);\n }", "protected function formatResponse($preparedQuery, $type = \"select\") {\n if($preparedQuery['status']){\n if($type == \"select\"){\n for($c = 0; $c < count($preparedQuery['results']); $c++){\n $response_array['results'][] = array($preparedQuery['results'][$c]['title'] => $preparedQuery['results'][$c]['id']);\n } \n $response_array['status'] = 'success';\n } elseif($type === \"insert\" or $type === \"update\" or $type === 'drop') {\n $response_array['status'] = 'success';\n } elseif($type == 'getbf'){\n $response_array['status'] = 'success';\n $response_array['id'] = $preparedQuery[\"results\"][0]['id'];\n $response_array['area_id'] = $preparedQuery[\"results\"][0]['area_id'];\n $response_array['title'] = $preparedQuery[\"results\"][0]['title'];\n $response_array['body'] = stripslashes($preparedQuery[\"results\"][0]['body']);\n $response_array['file_under'] = strtoupper($preparedQuery[\"results\"][0]['file_under']);\n }\n } elseif($type == 'update'){\n $response_array['status'] = 'no change (else_error)'; \n } else {\n $response_array['status'] = 'else_error'; \n }\n\n return $response_array;\n }", "public function testComplexDifferentOrder()\n {\n $groupTable = Centurion_Db::getSingleton('auth/group');\n\n //Two order, first asc, the second one desc\n $select = $groupTable->select()->where('name like(\\'test_%\\')')->order('name asc')->order('id desc');\n\n //We get the first one\n $groupRow = $select->fetchRow();\n $data = array();\n while (null !== $groupRow) {\n $data[] = $groupRow->id;\n //We iterate by using getNextBy on each $group;\n $groupRow = $groupRow->getNextBy('name', null, $select);\n }\n\n $expected = array(\n '10', '12', '11', '13'\n );\n\n $this->assertEquals($expected, $data);\n }", "public function testTableSortQuery() {\n $sorts = [\n ['field' => 'Task ID', 'sort' => 'desc', 'first' => 'perform at superbowl', 'last' => 'eat'],\n ['field' => 'Task ID', 'sort' => 'asc', 'first' => 'eat', 'last' => 'perform at superbowl'],\n ['field' => 'Task', 'sort' => 'asc', 'first' => 'code', 'last' => 'sleep'],\n ['field' => 'Task', 'sort' => 'desc', 'first' => 'sleep', 'last' => 'code'],\n // more elements here\n\n ];\n\n foreach ($sorts as $sort) {\n $this->drupalGet('database_test/tablesort/', ['query' => ['order' => $sort['field'], 'sort' => $sort['sort']]]);\n $data = json_decode($this->getSession()->getPage()->getContent());\n\n $first = array_shift($data->tasks);\n $last = array_pop($data->tasks);\n\n $this->assertEquals($sort['first'], $first->task, 'Items appear in the correct order.');\n $this->assertEquals($sort['last'], $last->task, 'Items appear in the correct order.');\n }\n }", "public function testFindPetsByStatusWithEmptyResponse()\n {\n // initialize the API client\n $config = (new Configuration())->setHost('http://petstore.swagger.io/v2');\n $apiClient = new ApiClient($config);\n $storeApi = new Api\\PetApi($apiClient);\n // this call returns and empty array\n $response = $storeApi->findPetsByStatus(array());\n\n // make sure this is an array as we want it to be\n $this->assertInternalType(\"array\", $response);\n\n // make sure the array is empty just in case the petstore\n // server changes its output\n $this->assertEmpty($response);\n }", "public function test_lista_anuncions()\n {\n $response = $this->withHeaders(['Authorization' => 'Bearer '.$this->token])\n ->json('GET', '/api/pecas');\n $response->assertOk();\n }", "public function getTestResultsData()\n {\n $out = [];\n\n // Case #0, sorted in default acceding\n $out[] = [\n [\n 'green',\n 'yellow',\n 'red',\n 'blue',\n ],\n 'sc'\n ];\n\n // Case #1, sorted in descending order by term, blue is prioritized.\n $out[] = [\n [\n 'acme',\n 'bar',\n 'foo',\n ],\n 'sc_zero_choices'\n ];\n\n // Case #2, all items prioritized, so sorting shouldn't matter.\n $out[] = [\n [\n 'blue',\n 'green',\n ],\n 'sc_sort_term_a'\n ];\n\n // Case #3, sort items by count, red prioritized.\n $out[] = [\n [\n 'yellow',\n ],\n 'sc_sort_term_d'\n ];\n\n // Case #4\n $out[] = [\n [\n 'blue',\n 'red',\n 'green',\n 'yellow'\n ],\n 'sc_sort_count'\n ];\n\n // Case #5 with selected man\n $out[] = [\n [\n 'yellow',\n 'red',\n 'blue',\n ],\n 'sc',\n ['manufacturer' => 'a']\n ];\n\n // Case #6 with selected man with zero choices\n $out[] = [\n [\n 'acme',\n 'foo',\n 'bar',\n ],\n 'sc_zero_choices',\n ['manufacturer' => 'a']\n ];\n\n // Case #7 with selected man with zero choices\n $out[] = [\n [\n 'yellow',\n 'red',\n 'blue',\n 'green',\n ],\n 'sc_zero_choices_color',\n ['manufacturer' => 'a']\n ];\n\n return $out;\n }", "public function testFilterReturnsFilteredServiceWithUsedTypesOnly()\n {\n $sourceService = $this->givenServiceWithOperations();\n\n $actualService = $this->sut->filter($sourceService);\n\n // Check that getAuthors and types for this not exists\n $this->assertNull($actualService->getOperation('GetAuthor'));\n $this->assertNull($actualService->getType('Method_Get_Authors_Response'));\n $this->assertNull($actualService->getType('Get_Authors_Response_Author'));\n $this->assertNull($actualService->getType('Method_Get_Authors_Request'));\n // Check that getBook and types exists\n $this->assertEquals($sourceService->getOperation('GetBook'), $actualService->getOperation('GetBook'));\n $this->assertEquals($sourceService->getType('Method_Get_Book_Response_BOOK'), $actualService->getType('Method_Get_Book_Response_BOOK'));\n $this->assertEquals($sourceService->getType('Book_Type_Enumeration'), $actualService->getType('Book_Type_Enumeration'));\n $this->assertEquals($sourceService->getType('Method_Get_Book_Response_BOOK_BOOK_NAME'), $actualService->getType('Method_Get_Book_Response_BOOK_BOOK_NAME'));\n $this->assertEquals($sourceService->getType('Get_Book_Type_Response'), $actualService->getType('Get_Book_Type_Response'));\n $this->assertEquals($sourceService->getType('Method_Get_Book_Request_BOOK'), $actualService->getType('Method_Get_Book_Request_BOOK'));\n $this->assertEquals($sourceService->getType('Get_Book_Type_Request'), $actualService->getType('Get_Book_Type_Request'));\n // Check that setVersion and types exists\n $this->assertEquals($sourceService->getOperation('SetVersion'), $actualService->getOperation('SetVersion'));\n $this->assertEquals($sourceService->getType('Method_Set_Version_Request'), $actualService->getType('Method_Set_Version_Request'));\n }" ]
[ "0.5780222", "0.5760177", "0.5757209", "0.57431144", "0.5592697", "0.55461377", "0.55292994", "0.5500212", "0.54605204", "0.5422834", "0.5372241", "0.5362019", "0.5351873", "0.5344494", "0.53215086", "0.53190184", "0.5294356", "0.5271464", "0.5239272", "0.523155", "0.5207087", "0.5207087", "0.5204179", "0.5202844", "0.5201068", "0.51859564", "0.517934", "0.5178643", "0.5170585", "0.5164083", "0.5149333", "0.51470846", "0.51099265", "0.510409", "0.5087483", "0.5069982", "0.50660855", "0.5061749", "0.50383896", "0.5038315", "0.5032867", "0.5031111", "0.5026686", "0.50214124", "0.50208646", "0.5020859", "0.5020515", "0.5020272", "0.5013934", "0.5007868", "0.50000167", "0.49986133", "0.4996377", "0.49848822", "0.49753144", "0.49721044", "0.49648118", "0.4963306", "0.49622867", "0.49622867", "0.49601695", "0.49566066", "0.49563766", "0.49473444", "0.49466196", "0.49434778", "0.49335533", "0.49333027", "0.4929177", "0.49241477", "0.4911757", "0.49100247", "0.49066868", "0.4906609", "0.4904748", "0.48894435", "0.48866996", "0.48852745", "0.48787993", "0.48783317", "0.48767263", "0.48760128", "0.4868475", "0.48675847", "0.48671466", "0.4856307", "0.48509127", "0.48487973", "0.48425418", "0.48358047", "0.48308858", "0.48275155", "0.48193648", "0.48147616", "0.47995362", "0.4798871", "0.47957757", "0.47931987", "0.4792039", "0.47908178" ]
0.6412094
0
Here we we test our response's structure and type when we sort by price
public function testSortByPrice() { $result=$this->sort->sortByPrice(); $result = $this->hotelMapperService->serialize($result); $this->assertInternalType('array',$result); foreach ($result as $i => $hotel) { var_dump($hotel['price']);die; $this->assertGreaterThan($result[$i+1]['price'],$hotel['price']); $this->assertArrayHasKey('name', $hotel); $this->assertArrayHasKey('price', $hotel); $this->assertArrayHasKey('city', $hotel); $this->assertArrayHasKey('availability', $hotel); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testSortByPrice()\n {\n $item1 = new \\Saitow\\Model\\Tire('sql', 1);\n $item1->setPrice(1.1);\n\n $item2 = new Saitow\\Model\\Tire('xml', 50);\n $item2->setPrice(2.2);\n\n $item3 = new \\Saitow\\Model\\Tire('other', 22);\n $item3->setPrice(0.1);\n\n $items = [$item1, $item2, $item3];\n\n $sorted = TiresCollectionSorter::sort($items, \\Saitow\\Library\\TiresDataSource::ORDERBY_PRICE);\n\n $this->assertEquals($item3, $sorted[0]);\n $this->assertEquals($item1, $sorted[1]);\n $this->assertEquals($item2, $sorted[2]);\n }", "function thrive_dashboard_get_thrive_products($type = '', $sort = true)\n{\n $products = array();\n\n $response = wp_remote_get(THRIVE_DASHBOARD_PRODUCTS_URL, array('sslverify' => false));\n if (is_wp_error($response)) {\n return $products;\n }\n\n $products = json_decode($response['body']);\n if ($type != '') {\n foreach ($products as $key => $product) {\n if ($product->type != $type) {\n unset($products[$key]);\n }\n }\n }\n\n if ($sort == true) {\n usort($products, function ($a, $b) {\n return strcasecmp($a->name, $b->name);\n });\n }\n\n return $products;\n}", "function sortWithMoneyAndAlph($a, $b)\n{\n $aPrice = $a[\"price\"];\n $bPrice = $b[\"price\"];\n if (is_numeric($aPrice) and is_numeric($bPrice)) {\n $diff = $aPrice- $bPrice;\n } elseif (is_numeric($aPrice)) {\n $diff= 1; //only a is a nmber\n } else {\n $diff = -1; //only b is a number\n }\n\n\n $moneyRank = priceSort($a, $b);\n if ($diff == 0) {\n return critterNameSort($a, $b);\n }\n return $moneyRank;\n}", "public function getSortedItems($type)\n\t{\n\t\t$sorted = array();\n\t\tforeach ($this->items as $item)\n\t\t{\n\t\t\t$sorted[($item->price * 100)] = $item;\n\t\t}\n\t\treturn ksort($sorted, SORT_NUMERIC);\n\t}", "public function testPaginationAndESSorting()\n {\n $response = Article::search('*', [\n 'sort' => [\n 'title',\n ],\n ]);\n\n /*\n * Just so it's clear these are in the expected title order,\n */\n $this->assertEquals([\n 'Fast black dogs',\n 'Quick brown fox',\n 'Swift green frogs',\n ], $response->map(function ($a) {\n return $a->title;\n })->all());\n\n /* Response can be used as an array (of the results) */\n $response = $response->perPage(1)->page(2);\n\n $this->assertEquals(1, count($response));\n\n $this->assertInstanceOf(Result::class, $response[0]);\n\n $article = $response[0];\n $this->assertEquals('Quick brown fox', $article->title);\n\n $this->assertEquals('<ul class=\"pagination\">'.\n '<li><a href=\"/?page=1\" rel=\"prev\">&laquo;</a></li> '.\n '<li><a href=\"/?page=1\">1</a></li>'.\n '<li class=\"active\"><span>2</span></li>'.\n '<li><a href=\"/?page=3\">3</a></li> '.\n '<li><a href=\"/?page=3\" rel=\"next\">&raquo;</a></li>'.\n '</ul>', $response->render());\n\n $this->assertEquals(3, $response->total());\n $this->assertEquals(1, $response->perPage());\n $this->assertEquals(2, $response->currentPage());\n $this->assertEquals(3, $response->lastPage());\n }", "public function testRetrieveTheProductList(): void\n {\n $response = $this->request('GET', '/api/products');\n $json = json_decode($response->getContent(), true);\n\n $this->assertEquals(200, $response->getStatusCode());\n $this->assertEquals('application/json; charset=utf-8', $response->headers->get('Content-Type'));\n\n $this->assertCount(10, $json);\n\n foreach ($json as $key => $value) {\n $this->assertArrayHasKey('id', $json[$key]);\n $this->assertArrayHasKey('name', $json[$key]);\n $this->assertArrayHasKey('description', $json[$key]);\n $this->assertArrayHasKey('price', $json[$key]);\n $this->assertArrayHasKey('priceWithTax', $json[$key]);\n $this->assertArrayHasKey('category', $json[$key]);\n $this->assertArrayHasKey('id', $json[$key]['category']);\n $this->assertArrayHasKey('name', $json[$key]['category']);\n $this->assertArrayHasKey('tax', $json[$key]);\n $this->assertArrayHasKey('id', $json[$key]['tax']);\n $this->assertArrayHasKey('name', $json[$key]['tax']);\n $this->assertArrayHasKey('value', $json[$key]['tax']);\n $this->assertArrayHasKey('images', $json[$key]);\n foreach ($json[$key]['images'] as $image) {\n $this->assertArrayHasKey('id', $image);\n $this->assertArrayHasKey('fileName', $image);\n $this->assertArrayHasKey('mimeType', $image);\n }\n $this->assertArrayHasKey('updatedAt', $json[$key]);\n $this->assertArrayHasKey('createdAt', $json[$key]);\n } \n }", "public function testFilterByTitle2()\n {\n $response = $this->runApp('GET', '/v1/products?q=tremblay&password=' . $this->apiPassword);\n\n $this->assertEquals(StatusCode::HTTP_OK, $response->getStatusCode());\n $sJson = '[{\"id\":\"12\",\"title\":\"tremblay.com\",\"brand\":\"dolorem\",\"price\":\"94953540.00\",\"stock\":\"4\"}]';\n $result = (array)json_decode($response->getBody())->result;\n\n $this->assertEquals(json_decode($sJson), $result);\n }", "function sortLowToHigh($a, $b)\n{\n return $a->price < $b->price ? -1 : 1; //Compare the prices, evalutes to true\n // return $a->price > $b->price ? 1 : -1; // Gives the same result\n}", "function sortByPrice($a, $b) { \n return $a['menor_valor'] - $b['menor_valor'];\n}", "public function testSortByName()\n {\n $result=$this->sort->sortByName();\n $result = $this->hotelMapperService->serialize($result);\n $this->assertInternalType('array',$result);\n foreach ($result as $i => $hotel) {\n $this->assertGreaterThan($result[$i+1]['name'],$hotel['name']);\n $this->assertArrayHasKey('name', $hotel);\n $this->assertArrayHasKey('price', $hotel);\n $this->assertArrayHasKey('city', $hotel);\n $this->assertArrayHasKey('availability', $hotel);\n }\n }", "public function testGetOrdersWithCorrectParams()\n {\n echo \"\\n ***** Valid test - param value (page=4 and limit=2) - should get 200 ***** \\n \";\n $params = '{\"origin\": [\"-33.865143\",\"151.209900\"], \"destination\": [\"-37.663712\",\"144.844788\"]}';\n $params = json_decode($params, true);\n $response = $this->json('POST', '/orders', $params);\n \n $params = '{\"origin\": [\"-33.865143\",\"151.209900\"], \"destination\": [\"-37.663712\",\"144.844788\"]}';\n $params = json_decode($params, true);\n $response = $this->json('POST', '/orders', $params);\n \n $params = 'page=1&limit=2';\n $response = $this->json('GET', '/orders?'.$params);\n $response_data = $response->getContent();\n $response->assertStatus(200);\n\n echo \"\\n ***** Valid test - Number or count of response should be less than 2 - should get 200 ***** \\n \";\n $this->assertLessThan(3, count($response_data));\n \n echo \"\\n ***** Valid test - Get Order - Response should contain id, distance and status keys only ***** \\n\";\n $response_data = json_decode($response_data);\n\n foreach ($response_data as $order) {\n $order = (array) $order;\n $this->assertArrayHasKey('id', $order);\n $this->assertArrayHasKey('distance', $order);\n $this->assertArrayHasKey('status', $order);\n }\n }", "function sort_requests_by_total($a, $b)\n{\n if($a->total == $b->total) return 0;\n return ($a->total > $b->total) ? -1 : 1;\n}", "function get_vehicles_by_price() {\n global $db;\n $query = 'SELECT * FROM vehicles\n ORDER BY price DESC';\n $statement = $db->prepare($query);\n $statement->execute();\n $vehicles = $statement->fetchAll();\n $statement->closeCursor();\n return $vehicles;\n }", "public function testGetPriceBucketsUsingGET()\n {\n }", "function getPrice($id,$rdvtype){\r global $bdd;\r\r $req4=$bdd->prepare(\"select * from packs where idpack=? \");\r $req4->execute(array($id));\r while($ar = $req4->fetch()){\r if($rdvtype == 'visio'){return $ar['prvisio'];}else if($rdvtype == 'public'){return $ar['prpublic'];}else if($rdvtype == 'domicile'){return $ar['prdomicile'];}\r }\r\r return 200;\r}", "public function testGetAllProducts()\n {\n $response = $this->get('/api/history');\n $response->assertStatus(200);\n\n $content = $response->json();\n $this->assertIsArray($content, \"Response of get all histories are not array response\");\n\n if (is_array($content)){\n if (count($content)){\n $asserts = [\n \"id\" => \"assertIsInt\",\n \"product_id\" => \"assertIsInt\",\n \"price\" => \"assertIsInt\",\n \"previous_balance\" => \"assertIsInt\",\n \"movement\" => \"assertIsInt\",\n \"final_balance\" => \"assertIsInt\",\n \"created_at\" => \"assertIsString\",\n \"updated_at\" => \"assertIsString\",\n \"product_name\" => \"assertIsString\"\n ];\n foreach ($asserts as $index => $assert) {\n $this->assertArrayHasKey($index, $content[0], \"Product does not have {$index} attribute\");\n $this->{$assert}($content[0][$index], \"Product {$index} is cant {$assert}\");\n }\n }\n }\n }", "public function responseFromApiProductsByGETIsJSON()\n {\n $response = $this->get('api/products');\n $this->assertThat($response->content(), $this->isJson());\n }", "abstract function getPriceFromAPI($pair);", "public function getPricing() : array\n {\n $data = $this->fetchJson();\n $result = [];\n\n foreach ($data['fuel']['types'] as $fuelType) {\n if (!in_array($fuelType['name'], $this->types)) {\n continue;\n }\n\n $result[] = [\n 'name' => $fuelType['name'],\n 'price' => $fuelType['price'] * 100\n ] ;\n }\n\n return $result;\n }", "private static function formatAndSortResult(&$result)\n {\n if (!is_array($result)) {\n return $result;\n }\n\n $result['formatedPrivateDataList'] = array();\n\n // Parse list of private data and create key/value association instead of classic key/value list\n if (isset($result['privateDataList']) && is_array($result['privateDataList']) && isset($result['privateDataList']['privateData']) && is_array($result['privateDataList']['privateData'])) {\n foreach ($result['privateDataList']['privateData'] as $k => $v) {\n if (is_array($v) && isset($v['key']) && isset($v['value'])) {\n $result['formatedPrivateDataList'][$v['key']] = $v['value'];\n }\n }\n }\n\n // Parse list of billing record and add a calculated_status column\n if (isset($result['billingRecordList']) && is_array($result['billingRecordList']) && isset($result['billingRecordList']['billingRecord']) && is_array($result['billingRecordList']['billingRecord'])) {\n foreach ($result['billingRecordList']['billingRecord'] as &$billingRecord) {\n $billingRecord['calculated_status'] = $billingRecord['status'];\n if ($billingRecord['status'] != 2 && isset($billingRecord['result']) && (!PaylinePaymentGateway::isValidResponse($billingRecord, self::$approvedResponseCode) || !PaylinePaymentGateway::isValidResponse($billingRecord, self::$pendingResponseCode))) {\n $billingRecord['calculated_status'] = 2;\n }\n }\n }\n\n // Sort associatedTransactionsList by date, latest first (not done by the API)\n if (isset($result['associatedTransactionsList']) && isset($result['associatedTransactionsList']['associatedTransactions']) && is_array($result['associatedTransactionsList']['associatedTransactions'])) {\n uasort($result['associatedTransactionsList']['associatedTransactions'], function ($a, $b) {\n if (self::getTimestampFromPaylineDate($a['date']) == self::getTimestampFromPaylineDate($b['date'])) {\n return 0;\n } elseif (self::getTimestampFromPaylineDate($a['date']) > self::getTimestampFromPaylineDate($b['date'])) {\n return -1;\n } else {\n return 1;\n }\n });\n }\n\n // Sort statusHistoryList by date, latest first (not done by the API)\n if (isset($result['statusHistoryList']) && isset($result['statusHistoryList']['statusHistory']) && is_array($result['statusHistoryList']['statusHistory'])) {\n uasort($result['statusHistoryList']['statusHistory'], function ($a, $b) {\n if (self::getTimestampFromPaylineDate($a['date']) == self::getTimestampFromPaylineDate($b['date'])) {\n return 0;\n } elseif (self::getTimestampFromPaylineDate($a['date']) > self::getTimestampFromPaylineDate($b['date'])) {\n return -1;\n } else {\n return 1;\n }\n });\n }\n\n return $result;\n }", "public function testListCars(){\n $cars = Car::orderBy(\"created_at\", \"desc\")->with(\"type\", \"brand\", \"owner\")->get();\n $response = $this->json(\"GET\", \"/cars\");\n $response->assertJsonFragment($cars->first()->toArray());\n $response->assertStatus(200);\n }", "private function getOrders()\n {\n $OD = $this->dbclient->coins->OwnOrderBook;\n\n $ownOrders = $OD->find(\n array('$or'=>\n array(array('Status'=>'buying'), array('Status'=>'selling'))\n ));\n\n $output = ' {\n \"success\" : true,\n \"message\" : \"\",\n \"result\" : [';\n foreach ($ownOrders as $ownOrder) {\n\n if ($ownOrder) {\n if ($ownOrder->Status == 'buying' or $ownOrder->Status == 'selling') {\n $uri = $this->baseUrl . 'public/getorderbook';\n $params['market'] = $ownOrder->MarketName;\n if ($ownOrder->Status == 'buying') {\n $params['type'] = 'sell';\n $params['uuid'] = $ownOrder->BuyOrder->uuid;\n $limit = 'buy';\n } elseif ($ownOrder->Status == 'selling') {\n $params['type'] = 'buy';\n $params['uuid'] = $ownOrder->SellOrder->uuid;\n $limit = 'sell';\n }\n\n if (!empty($params)) {\n $uri .= '?' . http_build_query($params);\n }\n\n $sign = hash_hmac('sha512', $uri, $this->apiSecret);\n $ch = curl_init($uri);\n curl_setopt($ch, CURLOPT_HTTPHEADER, array('apisign: ' . $sign));\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n $result = curl_exec($ch);\n $answer = json_decode($result);\n $success = false;\n $quantity = 0;\n $rate = 0;\n\n if ($answer->success == true) {\n $closest_rate = $answer->result[0]->Rate;\n\n if ($ownOrder->Status == 'buying' && $ownOrder->BuyOrder->Rate >= $closest_rate) {\n $success = true;\n $quantity = $answer->result[0]->Quantity;\n $rate = $answer->result[0]->Rate;\n }\n\n if ($ownOrder->Status == 'selling' && $ownOrder->SellOrder->Rate <= $closest_rate) {\n $success = true;\n $quantity = $answer->result[0]->Quantity;\n $rate = $answer->result[0]->Rate;\n }\n\n if (!$success) {\n $output = $output.'{\n \"AccountId\" : null,\n \"OrderUuid\" : \"' . $params['uuid'] . '\",\n \"Exchange\" : \"' . $params['market'] . '\",\n \"Type\" : \"LIMIT_' . strtoupper($limit) . '\",\n \"Quantity\" : ' . $quantity . ',\n \"QuantityRemaining\" : 0.00000000,\n \"Limit\" : 0.00000001,\n \"Reserved\" : 0.00001000,\n \"ReserveRemaining\" : 0.00001000,\n \"CommissionReserved\" : 0.00000002,\n \"CommissionReserveRemaining\" : 0.00000002,\n \"CommissionPaid\" : 0.00000000,\n \"Price\" : ' . $rate . ',\n \"PricePerUnit\" : ' . $closest_rate . ',\n \"Opened\" : \"2014-07-13T07:45:46.27\",\n \"Closed\" : null,\n \"IsOpen\" : true,\n \"Sentinel\" : \"6c454604-22e2-4fb4-892e-179eede20972\",\n \"CancelInitiated\" : false,\n \"ImmediateOrCancel\" : false,\n \"IsConditional\" : false,\n \"Condition\" : \"NONE\",\n \"ConditionTarget\" : null\n },';\n\n }\n }\n }\n }\n }\n $output = rtrim($output, ',').']\n}';\n return $output;\n }", "public function sort_response($response_data)\n\t{\n\t\tasort($response_data);\n\t\treturn $response_data;\n\t}", "public function testGetItemsByType()\n\t{\n\t\t$items = self::$items->getItemsByType(\\ElectronicItem\\ElectronicItem::ELECTRONIC_ITEM_CONSOLE);\n\t\t$this->assertSame(350.98, $items[0]->getPrice());\n\t\t$this->assertSame(80, $items[0]->getExtrasPrice());\n\t}", "public function getPrices()\n {\n }", "public function test_getAllVehicleTest()\n {\n $response = $this->get('/api/inventory/vehicles/search');\n\n $response->assertStatus(200);\n $response->assertJson ([\n 'data'=>[[\n \"name\"=>$response['data'][0]['name'],\n \"model\"=>$response['data'][0]['model'],\n \"manufacturer\"=> $response['data'][0]['count'],\n \"cost_in_credits\" =>$response['data'][0]['cost_in_credits'],\n \"length\"=>$response['data'][0]['length'],\n \"max_atmosphering_speed\"=> $response['data'][0]['max_atmosphering_speed'],\n \"crew\"=> $response['data'][0]['crew'],\n \"passengers\"=>$response['data'][0]['passengers'],\n \"cargo_capacity\"=>$response['data'][0]['cargo_capacity'],\n \"consumables\"=> $response['data'][0]['consumables'],\n \"vehicle_class\"=>$response['data'][0]['vehicle_class'],\n \"pilots\"=>$response['data'][0]['pilots'],\n \"films\"=>$response['data'][0]['films'],\n \"created\"=> $response['data'][0]['created'],\n \"edited\"=> $response['data'][0]['edited'],\n \"url\"=> $response['data'][0]['url'],\n \"count\"=> $response['data'][0]['count']\n ]]\n\n\n\n ]);\n }", "public function testSuccessfulGetSortAttendants()\n {\n for ($i = 10000; $i < 10003; $i++) {\n $this->createData($i, '138000' . $i, 1);\n }\n for ($i = 10000; $i < 10003; $i++) {\n factory(Vote::class)->create([\n 'voter' => '138009' . $i,\n 'type' => Vote::TYPE_APP,\n 'user_id' => $i,\n ]);\n }\n $this->createData(10004, '13800010004', 0);\n $this->ajaxGet('/wap/' . self::ROUTE_PREFIX . '/approved/sort/list?page=1')\n ->seeJsonContains([\n 'code' => 0,\n ]);\n $result = json_decode($this->response->getContent(), true);\n $this->assertEquals(1, $result['pages']);\n $this->assertCount(3, $result['attendants']);\n }", "public function testValidCase()\n {\n $this->mock(AlphaVantageApiService::class, function ($mock) {\n return $mock->shouldReceive('querySymbol')\n ->once()\n ->andReturn(new \\GuzzleHttp\\Psr7\\Response(\n Response::HTTP_OK,\n [],\n '{\n \"Global Quote\": {\n \"01. symbol\": \"AMZN\",\n \"02. open\": \"3185.5600\",\n \"03. high\": \"3228.8600\",\n \"04. low\": \"3183.0000\",\n \"05. price\": \"3222.9000\",\n \"06. volume\": \"3325022\",\n \"07. latest trading day\": \"2021-05-14\",\n \"08. previous close\": \"3161.4700\",\n \"09. change\": \"61.4300\",\n \"10. change percent\": \"1.9431%\"\n }\n }'\n ));\n });\n\n $response = $this->getJson('api/stock-quotes?symbol=AMZN');\n $response->assertStatus(Response::HTTP_CREATED);\n $response->assertJson([\n 'id' => 1,\n 'symbol' => 'AMZN',\n 'high' => \"3228.8600\",\n 'low' => \"3183.0000\",\n 'price' => \"3222.9000\",\n ]);\n }", "public function testReturnsSupportedTranslationLanguagePairsTiersAndCreditPrices()\n {\n $serviceAPI = new Service();\n\n $response = json_decode($serviceAPI->getLanguagePairs(), true);\n $this->assertEquals('ok', $response['opstat']);\n $this->assertTrue(isset($response['response']));\n }", "public function testListSuppliers()\n {\n $stream = '{\"first_page_url\":\"page=1\",\"from\":1,\"last_page\":2,\"last_page_url\":\"page=2\",\"next_page_url\":\"page=2\",\"path\":\"\\/entities\\/suppliers\",\"per_page\":50,\"prev_page_url\":null,\"to\":55,\"total\":55,\"data\":[{\"id\":12345,\"code\":\"AE86\",\"name\":\"Mario Rossi S.R.L.\",\"type\":\"company\",\"first_name\":\"Mario\",\"last_name\":\"Rossi\",\"contact_person\":\"\",\"vat_number\":\"111222333\",\"tax_code\":\"111122233\",\"address_street\":\"Corso Magellano, 46\",\"address_postal_code\":\"20146\",\"address_city\":\"Milano\",\"address_province\":\"MI\",\"address_extra\":\"\",\"country\":\"Italia\",\"email\":\"[email protected]\",\"certified_email\":\"[email protected]\",\"phone\":\"1234567890\",\"fax\":\"123456789\",\"notes\":\"\",\"created_at\":\"2021-15-08\",\"updated_at\":\"2021-15-08\"},{\"id\":12346,\"code\":\"GT86\",\"name\":\"Maria Grossi S.R.L.\",\"type\":\"company\",\"first_name\":\"\",\"last_name\":\"\",\"contact_person\":\"\",\"vat_number\":\"200020102020\",\"tax_code\":\"200020102020\",\"address_street\":\"Vicolo stretto, 32\",\"address_postal_code\":\"20146\",\"address_city\":\"Milano\",\"address_province\":\"MI\",\"address_extra\":\"\",\"country\":\"Italia\",\"email\":\"[email protected]\",\"certified_email\":\"[email protected]\",\"phone\":\"0987654321\",\"fax\":\"098765432\",\"notes\":\"\",\"created_at\":\"2021-15-09\",\"updated_at\":\"2021-15-09\"}]}';\n $mock = new MockHandler([new Response(\n 200,\n ['Content-Type' => 'application/json'],\n $stream\n )]);\n\n $handler = HandlerStack::create($mock);\n $apiInstance = new \\FattureInCloud\\Api\\SuppliersApi(\n new \\GuzzleHttp\\Client(['handler' => $handler])\n );\n $company_id = 2;\n $result = $apiInstance->listSuppliers($company_id);\n $obj = ObjectSerializer::deserialize($stream, '\\FattureInCloud\\Model\\ListSuppliersResponse');\n\n TestCase::assertEquals($obj, $result);\n }", "public function getProductListings(string $query_type, $keyword_or_cat_id, string $sort_by, string $price_filter, int $page = 1): array\n {\n $page = $page - 1;\n $options = ['start' => ($page * business('products_per_page')), 'facets' => ['brand'], 'max_results' => business('products_per_page')];\n $ret_val = ['brand_facets' => new Collection(), 'listings' => new Collection()];\n $query_params = [];\n\n // Handle price filter\n if($price_filter != 'all')\n {\n list($price_low, $price_high) = explode('_', $price_filter);\n $query_params['store_price'] = ['between' => [$price_low, $price_high]];\n }\n\n // Handle sort\n switch($sort_by)\n {\n case 'newest':\n $options['sort_by'] = ['timestamp', 'desc'];\n break;\n\n case 'price_asc':\n $options['sort_by'] = ['store_price', 'asc'];\n break;\n\n case 'price_desc':\n $options['sort_by'] = ['store_price', 'desc'];\n break;\n }\n\n if($query_type == 'search')\n {\n $keyword = addslashes($keyword_or_cat_id);\n $query_params = array_merge($query_params, ['*all*' => $keyword, 'in_stock' => 'true']);\n }\n else // Category search\n {\n $cat_id = $keyword_or_cat_id;\n $query_params = array_merge($query_params, ['category_ids' => $cat_id, 'in_stock' => 'true']);\n }\n\n $result_set = $this->noSQLDataSource->findBy('products', $query_params, $options);\n $ret_val['listings'] = $result_set->getResults();\n $ret_val['brand_facets'] = $result_set->getFacets();\n $ret_val['num_of_listings'] = $result_set->getTotalResultsCount();\n\n return $ret_val;\n }", "public function testProductGetPrices()\n {\n $product = $this->find('product', 1);\n $prices = $product->getPrices();\n $price = $prices[0];\n \n $currencies = $this->findAll('currency');\n $dollarCurrency = $currencies[0];\n \n $money = Money::create(10, $dollarCurrency); \n \n $this->assertEquals(\n $money,\n $price\n );\n }", "public function testOrder()\n {\n $index = new Index();\n $query = new Query($index);\n $this->assertSame($query, $query->order('price'));\n\n $elasticQuery = $query->compileQuery()->toArray();\n $expected = [['price' => ['order' => 'desc']]];\n $this->assertEquals($expected, $elasticQuery['sort']);\n\n $query->order(['created' => 'asc']);\n $elasticQuery = $query->compileQuery()->toArray();\n $expected = [\n ['price' => ['order' => 'desc']],\n ['created' => ['order' => 'asc']],\n ];\n $this->assertEquals($expected, $elasticQuery['sort']);\n\n $query->order(['modified' => 'desc', 'score' => 'asc']);\n $elasticQuery = $query->compileQuery()->toArray();\n $expected = [\n ['price' => ['order' => 'desc']],\n ['created' => ['order' => 'asc']],\n ['modified' => ['order' => 'desc']],\n ['score' => ['order' => 'asc']],\n ];\n $this->assertEquals($expected, $elasticQuery['sort']);\n\n $query->order(['clicks' => ['mode' => 'avg', 'order' => 'asc']]);\n $elasticQuery = $query->compileQuery()->toArray();\n $expected = [\n ['price' => ['order' => 'desc']],\n ['created' => ['order' => 'asc']],\n ['modified' => ['order' => 'desc']],\n ['score' => ['order' => 'asc']],\n ['clicks' => ['mode' => 'avg', 'order' => 'asc']],\n ];\n $this->assertEquals($expected, $elasticQuery['sort']);\n\n $query->order(['created' => 'asc'], true);\n $elasticQuery = $query->compileQuery()->toArray();\n $expected = [\n ['created' => ['order' => 'asc']],\n ];\n $this->assertEquals($expected, $elasticQuery['sort']);\n }", "public function priceList(Request $request){\n /*==Sorting filter on price ghazanfar on 27-1-2020==*/\n\n // $objProduct=Product::select('products.id','products.name','products.image_url','products.msrp','products.price','products.brand_id','products.category_id','product_rugs.collection','product_rugs.size','product_rugs.color','product_decors.collection','product_decors.size','product_decors.color')->Join('product_rugs','product_rugs.product_id','=','products.id')->Join('product_decors','product_decors.product_id','=','products.id')->where($request->filter)->orderBy('price',$request->order)->paginate(12);\n\n \n $objProduct=Product::has('productRug')->select('products.id','products.name','products.image_url','products.msrp','products.price','products.brand_id','products.category_id','product_rugs.collection','product_rugs.size','product_rugs.color')->Join('product_rugs','product_rugs.product_id','=','products.id')->where($request->filter)->orderBy('price',$request->order)->where('active',1)->paginate(12);\n \n if(count($objProduct)==0){\n\n $objProduct=Product::has('productDecor')->select('products.id','products.name','products.image_url','products.msrp','products.price','products.brand_id','products.category_id','product_decors.collection','product_decors.size','product_decors.color')->Join('product_decors','product_decors.product_id','=','products.id')->orderBy('price',$request->order)->where($request->filter)->where('active',1)->paginate(12);\n \n }\n \n return view('layouts.product_listing',compact('objProduct'));\n }", "function fetchOptionPrices($json, $optionType) {\n $data = \"\";\n $optionObjects = $json['optionChain']['result'][0]['options'][0][$optionType];\n\n foreach($optionObjects as $option) {\n // Price,Last,Bid,Ask,Open Int,Volume,IV\n $data .= $option['strike']['raw'] . \",\";\n $data .= $option['lastPrice']['raw'] . \",\";\n $data .= $option['bid']['raw'] . \",\";\n $data .= $option['ask']['raw'] . \",\";\n $data .= $option['openInterest']['raw'] . \",\";\n $data .= $option['volume']['raw'] . \",\";\n $data .= $option['impliedVolatility']['raw'] . \"\\n\";\n }\n return $data;\n}", "public static function sort_all($a, $b){\n if($a->type == \"book\" && $b->type == \"book\"){\n if (!empty($a->series)){\n if (!empty($b->series)){\n return (strtolower($a->series) == strtolower($b->series)) ? ($a->volume > $b->volume) : strtolower($a->series) > strtolower($b->series);\n }else{\n return (strtolower($a->series) == strtolower($b->title)) ? ($a->volume > $b->volume) : strtolower($a->series) > strtolower($b->title);\n }\n }else{\n if (!empty($b->series)){\n return (strtolower($a->title) == strtolower($b->series)) ? ($a->volume > $b->volume) : strtolower($a->title) > strtolower($b->series);\n }else{\n return (strtolower($a->title) == strtolower($b->title)) ? ($a->volume > $b->volume) : strtolower($a->title) > strtolower($b->title);\n }\n }\n }else if ($a->type == \"movie\" && $b->type == \"movie\"){\n return (strtolower($a->title) == strtolower($b->title)) ? ($a->season > $b->season) : strtolower($a->title) > strtolower($b->title);\n }else{\n return strtolower($a->title) > strtolower($b->title);\n }\n }", "public function testOrderBy(): void\n {\n $request = new Request([\n 'orderBy' => 'status',\n ]);\n\n $this->assertEquals(['status', 'asc'], $request->orderBy());\n\n $request = new Request([]);\n $this->assertEquals(['id', 'asc'], $request->orderBy());\n\n $request = new Request([\n 'orderBy' => 'vehicle:owner.status',\n ]);\n\n $this->assertEquals(['vehicle', 'owner.status'], $request->orderBy());\n }", "public function testFilterReturnsFilteredServiceWithUsedTypesOnly()\n {\n $sourceService = $this->givenServiceWithOperations();\n\n $actualService = $this->sut->filter($sourceService);\n\n // Check that getAuthors and types for this not exists\n $this->assertNull($actualService->getOperation('GetAuthor'));\n $this->assertNull($actualService->getType('Method_Get_Authors_Response'));\n $this->assertNull($actualService->getType('Get_Authors_Response_Author'));\n $this->assertNull($actualService->getType('Method_Get_Authors_Request'));\n // Check that getBook and types exists\n $this->assertEquals($sourceService->getOperation('GetBook'), $actualService->getOperation('GetBook'));\n $this->assertEquals($sourceService->getType('Method_Get_Book_Response_BOOK'), $actualService->getType('Method_Get_Book_Response_BOOK'));\n $this->assertEquals($sourceService->getType('Book_Type_Enumeration'), $actualService->getType('Book_Type_Enumeration'));\n $this->assertEquals($sourceService->getType('Method_Get_Book_Response_BOOK_BOOK_NAME'), $actualService->getType('Method_Get_Book_Response_BOOK_BOOK_NAME'));\n $this->assertEquals($sourceService->getType('Get_Book_Type_Response'), $actualService->getType('Get_Book_Type_Response'));\n $this->assertEquals($sourceService->getType('Method_Get_Book_Request_BOOK'), $actualService->getType('Method_Get_Book_Request_BOOK'));\n $this->assertEquals($sourceService->getType('Get_Book_Type_Request'), $actualService->getType('Get_Book_Type_Request'));\n // Check that setVersion and types exists\n $this->assertEquals($sourceService->getOperation('SetVersion'), $actualService->getOperation('SetVersion'));\n $this->assertEquals($sourceService->getType('Method_Set_Version_Request'), $actualService->getType('Method_Set_Version_Request'));\n }", "public function test_resultsAreValidFormat() {\n $types = ['track'];\n\n foreach ($types as $tk => $type) {\n $searchInstance = new SpotifySearch('a', $type, SingletonTokenContainer::get());\n $results = $searchInstance->getNextPage()->get();\n\n foreach ($results as $ik => $item) {\n $this->assertNotEmpty($item->href);\n $this->assertNotEmpty($item->name);\n if ($type != 'track') {\n $this->assertNotEmpty($item->images);\n } else {\n $this->assertNotEmpty($item->album);\n }\n }\n }\n\n }", "public function products()\n {\n // api call to shopify\n// try {\n// $request = $this->client->get($this->url);\n// $response = $request->getBody();\n\n $response = array(\n 0 =>\n array(\n 'id' => 799,\n 'name' => 'Ship Your Idea',\n 'slug' => 'ship-your-idea-22',\n 'permalink' => 'https://example.com/product/ship-your-idea-22/',\n 'date_created' => '2017-03-23T17:03:12',\n 'date_created_gmt' => '2017-03-23T20:03:12',\n 'date_modified' => '2017-03-23T17:03:12',\n 'date_modified_gmt' => '2017-03-23T20:03:12',\n 'type' => 'variable',\n 'status' => 'publish',\n 'featured' => false,\n 'catalog_visibility' => 'visible',\n 'description' => '<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>\n',\n 'short_description' => '<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>\n',\n 'sku' => '',\n 'price' => '',\n 'regular_price' => '',\n 'sale_price' => '',\n 'date_on_sale_from' => NULL,\n 'date_on_sale_from_gmt' => NULL,\n 'date_on_sale_to' => NULL,\n 'date_on_sale_to_gmt' => NULL,\n 'price_html' => '',\n 'on_sale' => false,\n 'purchasable' => false,\n 'total_sales' => 0,\n 'virtual' => false,\n 'downloadable' => false,\n 'downloads' =>\n array(),\n 'download_limit' => -1,\n 'download_expiry' => -1,\n 'external_url' => '',\n 'button_text' => '',\n 'tax_status' => 'taxable',\n 'tax_class' => '',\n 'manage_stock' => false,\n 'stock_quantity' => NULL,\n 'stock_status' => 'instock',\n 'backorders' => 'no',\n 'backorders_allowed' => false,\n 'backordered' => false,\n 'sold_individually' => false,\n 'weight' => '',\n 'dimensions' =>\n array(\n 'length' => '',\n 'width' => '',\n 'height' => '',\n ),\n 'shipping_required' => true,\n 'shipping_taxable' => true,\n 'shipping_class' => '',\n 'shipping_class_id' => 0,\n 'reviews_allowed' => true,\n 'average_rating' => '0.00',\n 'rating_count' => 0,\n 'related_ids' =>\n array(\n 0 => 31,\n 1 => 22,\n 2 => 369,\n 3 => 414,\n 4 => 56,\n ),\n 'upsell_ids' =>\n array(),\n 'cross_sell_ids' =>\n array(),\n 'parent_id' => 0,\n 'purchase_note' => '',\n 'categories' =>\n array(\n 0 =>\n array(\n 'id' => 9,\n 'name' => 'Clothing',\n 'slug' => 'clothing',\n ),\n 1 =>\n array(\n 'id' => 14,\n 'name' => 'T-shirts',\n 'slug' => 't-shirts',\n ),\n ),\n 'tags' =>\n array(),\n 'images' =>\n array(\n 0 =>\n array(\n 'id' => 795,\n 'date_created' => '2017-03-23T14:03:08',\n 'date_created_gmt' => '2017-03-23T20:03:08',\n 'date_modified' => '2017-03-23T14:03:08',\n 'date_modified_gmt' => '2017-03-23T20:03:08',\n 'src' => 'https://example.com/wp-content/uploads/2017/03/T_4_front-11.jpg',\n 'name' => '',\n 'alt' => '',\n ),\n 1 =>\n array(\n 'id' => 796,\n 'date_created' => '2017-03-23T14:03:09',\n 'date_created_gmt' => '2017-03-23T20:03:09',\n 'date_modified' => '2017-03-23T14:03:09',\n 'date_modified_gmt' => '2017-03-23T20:03:09',\n 'src' => 'https://example.com/wp-content/uploads/2017/03/T_4_back-10.jpg',\n 'name' => '',\n 'alt' => '',\n ),\n 2 =>\n array(\n 'id' => 797,\n 'date_created' => '2017-03-23T14:03:10',\n 'date_created_gmt' => '2017-03-23T20:03:10',\n 'date_modified' => '2017-03-23T14:03:10',\n 'date_modified_gmt' => '2017-03-23T20:03:10',\n 'src' => 'https://example.com/wp-content/uploads/2017/03/T_3_front-10.jpg',\n 'name' => '',\n 'alt' => '',\n ),\n 3 =>\n array(\n 'id' => 798,\n 'date_created' => '2017-03-23T14:03:11',\n 'date_created_gmt' => '2017-03-23T20:03:11',\n 'date_modified' => '2017-03-23T14:03:11',\n 'date_modified_gmt' => '2017-03-23T20:03:11',\n 'src' => 'https://example.com/wp-content/uploads/2017/03/T_3_back-10.jpg',\n 'name' => '',\n 'alt' => '',\n ),\n ),\n 'attributes' =>\n array(\n 0 =>\n array(\n 'id' => 6,\n 'name' => 'Color',\n 'position' => 0,\n 'visible' => false,\n 'variation' => true,\n 'options' =>\n array(\n 0 => 'Black',\n 1 => 'Green',\n ),\n ),\n 1 =>\n array(\n 'id' => 0,\n 'name' => 'Size',\n 'position' => 0,\n 'visible' => true,\n 'variation' => true,\n 'options' =>\n array(\n 0 => 'S',\n 1 => 'M',\n ),\n ),\n ),\n 'default_attributes' =>\n array(),\n 'variations' =>\n array(),\n 'grouped_products' =>\n array(),\n 'menu_order' => 0,\n 'meta_data' =>\n array(),\n '_links' =>\n array(\n 'self' =>\n array(\n 0 =>\n array(\n 'href' => 'https://example.com/wp-json/wc/v3/products/799',\n ),\n ),\n 'collection' =>\n array(\n 0 =>\n array(\n 'href' => 'https://example.com/wp-json/wc/v3/products',\n ),\n ),\n ),\n ),\n 1 =>\n array(\n 'id' => 794,\n 'name' => 'Premium Quality',\n 'slug' => 'premium-quality-19',\n 'permalink' => 'https://example.com/product/premium-quality-19/',\n 'date_created' => '2017-03-23T17:01:14',\n 'date_created_gmt' => '2017-03-23T20:01:14',\n 'date_modified' => '2017-03-23T17:01:14',\n 'date_modified_gmt' => '2017-03-23T20:01:14',\n 'type' => 'simple',\n 'status' => 'publish',\n 'featured' => false,\n 'catalog_visibility' => 'visible',\n 'description' => '<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>\n',\n 'short_description' => '<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>\n',\n 'sku' => '',\n 'price' => '21.99',\n 'regular_price' => '21.99',\n 'sale_price' => '',\n 'date_on_sale_from' => NULL,\n 'date_on_sale_from_gmt' => NULL,\n 'date_on_sale_to' => NULL,\n 'date_on_sale_to_gmt' => NULL,\n 'price_html' => '<span class=\"woocommerce-Price-amount amount\"><span class=\"woocommerce-Price-currencySymbol\">&#36;</span>21.99</span>',\n 'on_sale' => false,\n 'purchasable' => true,\n 'total_sales' => 0,\n 'virtual' => false,\n 'downloadable' => false,\n 'downloads' =>\n array(),\n 'download_limit' => -1,\n 'download_expiry' => -1,\n 'external_url' => '',\n 'button_text' => '',\n 'tax_status' => 'taxable',\n 'tax_class' => '',\n 'manage_stock' => false,\n 'stock_quantity' => NULL,\n 'stock_status' => 'instock',\n 'backorders' => 'no',\n 'backorders_allowed' => false,\n 'backordered' => false,\n 'sold_individually' => false,\n 'weight' => '',\n 'dimensions' =>\n array(\n 'length' => '',\n 'width' => '',\n 'height' => '',\n ),\n 'shipping_required' => true,\n 'shipping_taxable' => true,\n 'shipping_class' => '',\n 'shipping_class_id' => 0,\n 'reviews_allowed' => true,\n 'average_rating' => '0.00',\n 'rating_count' => 0,\n 'related_ids' =>\n array(\n 0 => 463,\n 1 => 47,\n 2 => 31,\n 3 => 387,\n 4 => 458,\n ),\n 'upsell_ids' =>\n array(),\n 'cross_sell_ids' =>\n array(),\n 'parent_id' => 0,\n 'purchase_note' => '',\n 'categories' =>\n array(\n 0 =>\n array(\n 'id' => 9,\n 'name' => 'Clothing',\n 'slug' => 'clothing',\n ),\n 1 =>\n array(\n 'id' => 14,\n 'name' => 'T-shirts',\n 'slug' => 't-shirts',\n ),\n ),\n 'tags' =>\n array(),\n 'images' =>\n array(\n 0 =>\n array(\n 'id' => 792,\n 'date_created' => '2017-03-23T14:01:13',\n 'date_created_gmt' => '2017-03-23T20:01:13',\n 'date_modified' => '2017-03-23T14:01:13',\n 'date_modified_gmt' => '2017-03-23T20:01:13',\n 'src' => 'https://example.com/wp-content/uploads/2017/03/T_2_front-4.jpg',\n 'name' => '',\n 'alt' => '',\n ),\n 1 =>\n array(\n 'id' => 793,\n 'date_created' => '2017-03-23T14:01:14',\n 'date_created_gmt' => '2017-03-23T20:01:14',\n 'date_modified' => '2017-03-23T14:01:14',\n 'date_modified_gmt' => '2017-03-23T20:01:14',\n 'src' => 'https://example.com/wp-content/uploads/2017/03/T_2_back-2.jpg',\n 'name' => '',\n 'alt' => '',\n ),\n ),\n 'attributes' =>\n array(),\n 'default_attributes' =>\n array(\n 0 =>\n array(\n 'id' => 6,\n 'name' => 'Color',\n 'option' => 'black',\n ),\n 1 =>\n array(\n 'id' => 0,\n 'name' => 'Size',\n 'option' => 'S',\n ),\n ),\n 'variations' =>\n array(),\n 'grouped_products' =>\n array(),\n 'menu_order' => 0,\n 'meta_data' =>\n array(),\n '_links' =>\n array(\n 'self' =>\n array(\n 0 =>\n array(\n 'href' => 'https://example.com/wp-json/wc/v3/products/794',\n ),\n ),\n 'collection' =>\n array(\n 0 =>\n array(\n 'href' => 'https://example.com/wp-json/wc/v3/products',\n ),\n ),\n ),\n ),\n );\n\n $products = $this->transformData($response);\n\n return response()->json($products);\n// }catch (\\Exception $exception){\n// Log::error($exception->getMessage(), ['_trace' => $exception->getTraceAsString()]);\n//\n// throw new \\Exception('Whoops! something went wrong with WooCommerce product listings.', 500);\n// }\n }", "public function testGetAll()\n {\n $response = $this->get('/api/Product/GetAll/');\n\n $response->assertStatus(200);\n $response->assertJsonStructure(['data' =>\n [\n '*' =>[\n 'name'\n ]\n ],\n ]);\n\n }", "public function testRetrieveTheTaxList(): void\n {\n $response = $this->request('GET', '/api/taxes');\n $json = json_decode($response->getContent(), true);\n\n $this->assertEquals(200, $response->getStatusCode());\n $this->assertEquals('application/json; charset=utf-8', $response->headers->get('Content-Type'));\n\n $this->assertCount(5, $json);\n\n foreach ($json as $key => $value) {\n $this->assertArrayHasKey('id', $json[$key]);\n $this->assertArrayHasKey('name', $json[$key]);\n $this->assertArrayHasKey('value', $json[$key]); \n $this->assertArrayHasKey('createdAt', $json[$key]); \n $this->assertArrayHasKey('updatedAt', $json[$key]); \n } \n }", "public function testRetrive()\n {\n $json = <<<JSON\n{\n \"order_id\": \"f3392f8b-6116-4073-ab96-e330819e2c07\",\n \"order_amount\": 50000,\n \"order_tax_amount\": 5000\n}\nJSON;\n\n $this->mock->append(\n new Response(\n 200,\n ['Content-Type' => 'application/json'],\n $json\n )\n );\n\n $order = new Orders($this->connector, 'auth-token-123456');\n $this->assertEquals('auth-token-123456', $order->getId());\n\n $order->retrieve();\n\n $this->assertEquals('f3392f8b-6116-4073-ab96-e330819e2c07', $order['order_id']);\n $this->assertEquals(50000, $order['order_amount']);\n\n $request = $this->mock->getLastRequest();\n $this->assertEquals(Method::GET, $request->getMethod());\n $this->assertEquals(\n '/instantshopping/v1/authorizations/auth-token-123456',\n $request->getUri()->getPath()\n );\n\n $this->assertAuthorization($request);\n }", "function es_add_catalog_order_by_member_prices($catalog_orderby_options) {\n\tunset($catalog_orderby_options[\"rating\"]);\n\n\t$catalog_orderby_options['member_price'] = __( 'Sort by member price', 'woocommerce' );\n\t\n\treturn $catalog_orderby_options;\n}", "function test_leverage_tier($exchange, $method, $tier) {\n $format = array(\n 'tier' => 1,\n 'minNotional' => 0,\n 'maxNotional' => 5000,\n 'maintenanceMarginRate' => 0.01,\n 'maxLeverage' => 25,\n 'info' => array(),\n );\n $keys = is_array($format) ? array_keys($format) : array();\n for ($i = 0; $i < count($keys); $i++) {\n $key = $keys[$i];\n assert (is_array($tier, $exchange->id . ' ' . $method . ' ' . $key . ' missing from response') && array_key_exists($key, $tier, $exchange->id . ' ' . $method . ' ' . $key . ' missing from response'));\n }\n if ($tier['tier'] !== null) {\n assert ((is_float($tier['tier']) || is_int($tier['tier'])));\n assert ($tier['tier'] >= 0);\n }\n if ($tier['minNotional'] !== null) {\n assert ((is_float($tier['minNotional']) || is_int($tier['minNotional'])));\n assert ($tier['minNotional'] >= 0);\n }\n if ($tier['maxNotional'] !== null) {\n assert ((is_float($tier['maxNotional']) || is_int($tier['maxNotional'])));\n assert ($tier['maxNotional'] >= 0);\n }\n if ($tier['maxLeverage'] !== null) {\n assert ((is_float($tier['maxLeverage']) || is_int($tier['maxLeverage'])));\n assert ($tier['maxLeverage'] >= 1);\n }\n if ($tier['maintenanceMarginRate'] !== null) {\n assert ((is_float($tier['maintenanceMarginRate']) || is_int($tier['maintenanceMarginRate'])));\n assert ($tier['maintenanceMarginRate'] <= 1);\n }\n var_dump ($exchange->id, $method, $tier['tier'], $tier['minNotional'], $tier['maxNotional'], $tier['maintenanceMarginRate'], $tier['maxLeverage']);\n return $tier;\n}", "public function testFilterByTitle()\n {\n $response = $this->runApp('GET', '/v1/products?q=.net&password=' . $this->apiPassword);\n\n $this->assertEquals(StatusCode::HTTP_OK, $response->getStatusCode());\n $result = (array)json_decode($response->getBody())->result;\n $this->assertEquals(count($result), 7);\n }", "public function testSortProduct()\n {\n $this->loginAdmin(\"Administer Products\", \"Products\");\n $this->changeAdminListLanguage('Deutsch');\n //sorting\n $this->type(\"where[oxarticles][oxartnum]\", \"100\");\n $this->clickAndWait(\"submitit\");\n $this->clickAndWait(\"link=A\");\n $this->assertElementPresent(\"//tr[@id='row.1']/td[@class='listitem active']\");\n $this->assertElementPresent(\"//tr[@id='row.4']/td[@class='listitem2 active']\");\n $this->assertElementNotPresent(\"//tr[@id='row.5']/td[@class='listitem active']\");\n $this->clickAndWait(\"link=Prod.No.\");\n $this->assertEquals(\"1000\", $this->getText(\"//tr[@id='row.1']/td[2]\"));\n $this->assertEquals(\"1001\", $this->getText(\"//tr[@id='row.2']/td[2]\"));\n $this->assertEquals(\"10010\", $this->getText(\"//tr[@id='row.3']/td[2]\"));\n $this->clickAndWait(\"link=Title\");\n $this->assertEquals(\"10 DE product šÄßüл\", $this->getText(\"//tr[@id='row.1']/td[3]\"));\n $this->assertEquals(\"11 DE product šÄßüл\", $this->getText(\"//tr[@id='row.2']/td[3]\"));\n $this->assertEquals(\"12 DE product šÄßüл\", $this->getText(\"//tr[@id='row.3']/td[3]\"));\n $this->assertEquals(\"10011\", $this->getText(\"//tr[@id='row.1']/td[2]\"));\n $this->assertEquals(\"10 DE product šÄßüл\", $this->getText(\"//tr[@id='row.1']/td[3]\"));\n $this->assertEquals(\"11 DE description\", $this->getText(\"//tr[@id='row.1']/td[4]\"));\n $this->clickAndWait(\"link=Short Description\");\n $this->assertEquals(\"1 DE description\", $this->getText(\"//tr[@id='row.1']/td[4]\"));\n $this->assertEquals(\"10 DE description\", $this->getText(\"//tr[@id='row.2']/td[4]\"));\n $this->assertEquals(\"11 DE description\", $this->getText(\"//tr[@id='row.3']/td[4]\"));\n $this->assertEquals(\"12 DE description\", $this->getText(\"//tr[@id='row.4']/td[4]\"));\n $this->assertElementNotPresent(\"//tr[@id='row.1']/td[@class='listitem active']\");\n $this->assertEquals(\"10010\", $this->getText(\"//tr[@id='row.1']/td[2]\"));\n $this->assertEquals(\"[last] DE product šÄßüл\", $this->getText(\"//tr[@id='row.1']/td[3]\"));\n $this->changeAdminListLanguage('English');\n $this->clickAndWait(\"link=A\");\n $this->assertElementPresent(\"//tr[@id='row.1']/td[@class='listitem active']\");\n $this->assertElementPresent(\"//tr[@id='row.4']/td[@class='listitem2 active']\");\n $this->assertElementNotPresent(\"//tr[@id='row.5']/td[@class='listitem active']\");\n $this->clickAndWait(\"link=Prod.No.\");\n $this->assertEquals(\"1000\", $this->getText(\"//tr[@id='row.1']/td[2]\"));\n $this->assertEquals(\"1001\", $this->getText(\"//tr[@id='row.2']/td[2]\"));\n $this->assertEquals(\"10010\", $this->getText(\"//tr[@id='row.3']/td[2]\"));\n $this->assertEquals(\"Test product 0 [EN] šÄßüл\", $this->getText(\"//tr[@id='row.1']/td[3]\"));\n $this->assertEquals(\"Test product 0 short desc [EN] šÄßüл\", $this->getText(\"//tr[@id='row.1']/td[4]\"));\n $this->clickAndWait(\"link=Title\");\n $this->assertEquals(\"1 EN product šÄßüл\", $this->getText(\"//tr[@id='row.1']/td[3]\"));\n $this->assertEquals(\"10010\", $this->getText(\"//tr[@id='row.1']/td[2]\"));\n $this->assertEquals(\"[last] EN description šÄßüл\", $this->getText(\"//tr[@id='row.1']/td[4]\"));\n $this->assertEquals(\"Page 1 / 2\", $this->getText(\"nav.site\"));\n $this->assertElementPresent(\"//a[@id='nav.page.1'][@class='pagenavigation pagenavigationactive']\");\n $this->clickAndWait(\"nav.next\");\n $this->assertEquals(\"1003\", $this->getText(\"//tr[@id='row.1']/td[2]\"));\n $this->assertEquals(\"Test product 3 [EN] šÄßüл\", $this->getText(\"//tr[@id='row.1']/td[3]\"));\n $this->assertEquals(\"Test product 3 short desc [EN] šÄßüл\", $this->getText(\"//tr[@id='row.1']/td[4]\"));\n $this->assertEquals(\"Page 2 / 2\", $this->getText(\"nav.site\"));\n $this->assertElementPresent(\"//a[@id='nav.page.2'][@class='pagenavigation pagenavigationactive']\");\n $this->clickAndWait(\"nav.prev\");\n $this->assertEquals(\"1 EN product šÄßüл\", $this->getText(\"//tr[@id='row.1']/td[3]\"));\n $this->clickAndWait(\"link=Short Description\");\n $this->assertEquals(\"10 EN description šÄßüл\", $this->getText(\"//tr[@id='row.1']/td[4]\"));\n $this->assertEquals(\"11 EN description šÄßüл\", $this->getText(\"//tr[@id='row.2']/td[4]\"));\n $this->assertEquals(\"Page 1 / 2\", $this->getText(\"nav.site\"));\n $this->assertElementPresent(\"//a[@id='nav.page.1'][@class='pagenavigation pagenavigationactive']\");\n $this->clickAndWait(\"nav.last\");\n $this->assertEquals(\"[last] EN description šÄßüл\", $this->getText(\"//tr[@id='row.1']/td[4]\"));\n $this->assertEquals(\"1 EN product šÄßüл\", $this->getText(\"//tr[@id='row.1']/td[3]\"));\n $this->assertEquals(\"10010\", $this->getText(\"//tr[@id='row.1']/td[2]\"));\n $this->assertEquals(\"Page 2 / 2\", $this->getText(\"nav.site\"));\n $this->assertElementPresent(\"//a[@id='nav.page.2'][@class='pagenavigation pagenavigationactive']\");\n $this->clickAndWait(\"nav.first\");\n $this->assertEquals(\"10 EN description šÄßüл\", $this->getText(\"//tr[@id='row.1']/td[4]\"));\n $this->assertEquals(\"11 EN product šÄßüл\", $this->getText(\"//tr[@id='row.1']/td[3]\"));\n $this->assertEquals(\"10011\", $this->getText(\"//tr[@id='row.1']/td[2]\"));\n $this->assertEquals(\"Page 1 / 2\", $this->getText(\"nav.site\"));\n $this->assertElementPresent(\"//a[@id='nav.page.1'][@class='pagenavigation pagenavigationactive']\");\n //removing item to check if paging is correct\n $this->clickAndWait(\"nav.last\");\n $this->assertEquals(\"[last] EN description šÄßüл\", $this->getText(\"//tr[@id='row.1']/td[4]\"));\n $this->clickDeleteListItem(1);\n $this->assertElementNotPresent(\"nav.page.1\", \"Delete product does not work\");\n $this->assertEquals(\"10 EN description šÄßüл\", $this->getText(\"//tr[@id='row.1']/td[4]\"));\n }", "function orderPrice($count) {\n global $conn;\n if($count == 1) {\n $sql = \"SELECT * FROM `candy` ORDER BY `candy`.`priceId` ASC\";\n }\n else {\n $sql = \"SELECT * FROM `candy` ORDER BY `candy`.`priceId` DESC\"; \n }\n $statement = $conn->prepare($sql);\n $statement->execute();\n $candies = $statement->fetchAll(PDO::FETCH_ASSOC);\n return $candies;\n}", "function sortWithAll($a, $b)\n{\n\n $priorityRank = expSort($a, $b);\n\n if ($priorityRank == 0) {\n $aPrice = $a[\"price\"];\n $bPrice = $b[\"price\"];\n if (is_numeric($aPrice) and is_numeric($bPrice)) {\n $diff = $bPrice - $aPrice;\n } elseif (is_numeric($aPrice)) {\n $diff= -1; //only a is a nmber\n } else {\n $diff = 1; //only b is a number\n }\n if ($diff == 0){\n return critterNameSort($a, $b);\n }\n return $diff;\n }\n return $priorityRank;\n}", "public function testSortSalaryAsc()\n {\n $repository = new Repository();\n dd($repository->getCities());\n\n $result = $repository->all(['sort_salary' => 'asc']);\n\n $this->assertInstanceOf('stdClass', array_first($result));\n }", "public function prepare($data)\n {\n $response = array('name' => $data['title']);\n \n if (!empty($data['short_description'])) {\n $response['short_description'] = $data['short_description'];\n }\n \n if (!empty($data['description'])) {\n $response['description'] = $data['description'];\n }\n \n if (!empty($data['categories'])) {\n $categories = array();\n foreach ($data['categories'] as $categoryId) {\n $categories[] = array('id' => $categoryId);\n }\n \n $response['categories'] = $categories;\n }\n \n $images = array(); $position = 0;\n foreach ($data['images'] as $image) {\n $images[] = array(\n 'src' => $image,\n 'position' => $position++\n );\n }\n $response['images'] = $images;\n\n \n $isVariable = (!empty($data['variations']));\n $response['type'] = ($isVariable) ? 'variable' : 'simple';\n \n if (!$isVariable) {\n $response['regular_price'] = $data['price_low'];\n if (!empty($data['special_price_low'])) {\n $response['sale_price'] = $data['special_price_low'];\n }\n }\n\n $attributes = $variationAttributeTitles = array(); $position = 0;\n foreach ($data['attributes'] as $attribute) {\n $attributes[] = array(\n 'name' => $attribute['title'],\n 'position' => $position++,\n 'visible' => true,\n 'options' => explode('|', $attribute['value']),\n 'variation' => ($attribute['is_variation'])\n );\n \n if ($attribute['is_variation']) {\n $variationAttributeTitles[] = $attribute['title'];\n }\n }\n $response['attributes'] = $attributes;\n \n if ($isVariable) {\n $variations = array();\n foreach ($data['variations'] as $variation) {\n $newVariation = array(\n 'regular_price' => $variation['advertised'],\n 'image' => array(\n array(\n 'src' => $variation['image'],\n 'position' => 0\n )\n )\n );\n \n if (!empty($variation['final_price'])) {\n $newVariation['sale_price'] = $variation['final_price'];\n }\n \n $attributes = array(); \n $attributeValues = explode('|', $variation['name']);\n foreach ($variationAttributeTitles as $key => $variationAttributeTitle) {\n $attributes[] = array(\n 'name' => $variationAttributeTitle,\n 'option' => $attributeValues[$key]\n );\n }\n \n $newVariation['attributes'] = $attributes;\n $variations[] = $newVariation;\n }\n \n $response['variations'] = $variations;\n }\n \n return $response;\n }", "public function testProductGetAll()\r\n\t{\r\n\t\t$this->json('get', '/api/products')->assertStatus(200);\r\n\t}", "private function checkDataStructure($response)\n {\n $this->assertInstanceOf(Data::class, $response);\n $this->assertIsArray($response->data);\n foreach ($response->data as $ticker) {\n $this->assertInstanceOf(Ticker::class, $ticker);\n $this->assertIsString($ticker->slug);\n $this->assertIsString($ticker->title);\n $this->assertIsString($ticker->symbol);\n $this->assertIsInt($ticker->rank);\n $this->assertIsFloat($ticker->price);\n $this->assertIsFloat($ticker->volume);\n }\n }", "public function testDispatchOrder()\n {\n $client = $this->shoppersLogin();\n\n //Get shopper data\n $client->request('GET', '/shoppersapi/v1/shopper');\n $shopper = json_decode($client->getResponse()->getContent());\n $shopperId = $shopper->shopperId;\n\n //Get available shops\n $client->request('GET', '/shoppersapi/v1/shops');\n $shops = json_decode($client->getResponse()->getContent());\n\n //Get a random Shop\n $randomShop = array_rand($shops, 1);\n $shopId = $shops[$randomShop]->shopId;\n\n //Get the Dispatch Order\n $client->request('GET', '/shoppersapi/v1/dispatchorders/'.$shopperId.\"/shops/\".$shopId);\n $response = $client->getResponse();\n\n //For verification purpose only\n var_dump($response->getContent());\n\n $this->assertJson($response->getContent());\n }", "public function addPricesToCollection($response)\n {\n if (isset($response['Book'])) {\n foreach ($response['Book'] as $offer) {\n $offer = (object) $offer;\n $price = $this->createNewPrice();\n if (isset($offer->listingPrice)) {\n if (isset($offer->listingCondition) && strtolower($offer->listingCondition) == 'new book') {\n $price->condition = parent::CONDITION_NEW;\n } elseif (isset($offer->itemCondition)) {\n $price->condition = $this->getConditionFromString($offer->itemCondition);\n }\n if (empty($price->condition)) {\n $price->condition = parent::CONDITION_GOOD;\n }\n $price->isbn13 = $offer->isbn13;\n $price->price = $offer->listingPrice;\n $price->shipping_price = $offer->firstBookShipCost;\n $price->url = 'http://affiliates.abebooks.com/c/74871/77797/2029?u='.urlencode($offer->listingUrl);\n $price->retailer = self::RETAILER;\n $price->term = parent::TERM_PERPETUAL;\n }\n $this->addPriceToCollection($price);\n }\n }\n return $this;\n }", "public function parseUrlUsingSortEnabled()\n {\n $query = new ControllerQuery($this->enabledFilters, '/test');\n $url = $query->setSorts(['field' => 'asc', 'another field' => 'desc'])\n ->build();\n\n $this->assertEquals(\n 'http://www.comicvine.com/api/test/?limit=100&offset=0&sort=field:asc,another+field:desc',\n $url\n );\n }", "public function testFindPetsByTags()\n {\n // initialize the API client\n $config = (new Configuration())->setHost('http://petstore.swagger.io/v2');\n $api_client = new ApiClient($config);\n $pet_api = new Api\\PetApi($api_client);\n // return Pet (model)\n $response = $pet_api->findPetsByTags(\"test php tag\");\n $this->assertGreaterThan(0, count($response)); // at least one object returned\n $this->assertSame(get_class($response[0]), \"Swagger\\\\Client\\\\Model\\\\Pet\"); // verify the object is Pet\n // loop through result to ensure status is \"available\"\n foreach ($response as $_pet) {\n $this->assertSame($_pet['tags'][0]['name'], \"test php tag\");\n }\n // test invalid status\n $response = $pet_api->findPetsByTags(\"unknown_and_incorrect_tag\");\n $this->assertSame(count($response), 0); // confirm no object returned\n }", "public function testDataResponse()\n {\n $driversEndpoint = new DriverClassesEndpoint(getenv('MRP_API_KEY'));\n $data = $driversEndpoint->setDriverCount(1)\n ->setOrder('name')\n ->setIncludeStats('true')\n ->setScheduleYear(2016)\n ->setFeaturedOnly('true')\n ->setForcePic('false')\n ->setIncludeDrivers('true')\n ->getRequest();\n\n $this->assertNotEmpty($data);\n $this->assertTrue(is_object($data));\n $this->assertEquals(1, $data->RequestValid);\n }", "function getInventoryOrderedLow(){\n global $db;\n \n $stmt=$db->prepare(\"SELECT idItem, `name`, amount, unitPrice, salesPrice, parAmount, (amount / parAmount) AS orderAmount FROM inventory ORDER BY orderAmount ASC;\");\n \n if($stmt->execute() && $stmt->rowCount()>0){\n $results = $stmt->fetchAll(PDO::FETCH_ASSOC);\n return ($results);\n }\n else{\n return false;\n }\n }", "function getOrderings() ;", "public function testSortByTitle()\n {\n $item1 = new \\Saitow\\Model\\Tire('sql', 1);\n $item1->setTitle('B');\n\n $item2 = new Saitow\\Model\\Tire('xml', 50);\n $item2->setTitle('A');\n\n $item3 = new \\Saitow\\Model\\Tire('other', 22);\n $item3->setTitle('C');\n\n $items = [$item1, $item2, $item3];\n\n $sorted = TiresCollectionSorter::sort($items, \\Saitow\\Library\\TiresDataSource::ORDERBY_MANUFACTURE);\n\n $this->assertEquals($item2, $sorted[0]);\n $this->assertEquals($item1, $sorted[1]);\n $this->assertEquals($item3, $sorted[2]);\n }", "public function testSort()\n {\n $obj_query = new \\Search\\Query();\n $this->assertEmpty($obj_query->getSorts());\n $obj_query->sort('a', 'b');\n $this->assertEquals([['a', 'b']], $obj_query->getSorts());\n $obj_query2 = $obj_query->sort('c', 'd');\n $this->assertEquals([['a', 'b'],['c', 'd']], $obj_query->getSorts());\n $this->assertSame($obj_query, $obj_query2);\n }", "public function testFindPetByStatus()\n {\n // initialize the API client\n $config = (new Configuration())->setHost('http://petstore.swagger.io/v2');\n $api_client = new ApiClient($config);\n $pet_api = new Api\\PetApi($api_client);\n // return Pet (model)\n $response = $pet_api->findPetsByStatus(\"available\");\n $this->assertGreaterThan(0, count($response)); // at least one object returned\n $this->assertSame(get_class($response[0]), \"Swagger\\\\Client\\\\Model\\\\Pet\"); // verify the object is Pet\n // loop through result to ensure status is \"available\"\n foreach ($response as $_pet) {\n $this->assertSame($_pet['status'], \"available\");\n }\n // test invalid status\n $response = $pet_api->findPetsByStatus(\"unknown_and_incorrect_status\");\n $this->assertSame(count($response), 0); // confirm no object returned\n }", "function rec_sort_by_sold_date( $options ) {\n\n\tif( isset($_GET['property_status']) && $_GET['property_status'] == 'sold' && isset($_GET['post_type']) && $_GET['post_type'] == 'property' ) {\n\n\t\t// Remove options from default on property_status=sold\n\n\t\tforeach ($options as $key => &$option) {\n\t\t\tif ( ($option['id'] == 'high') || ($option['id'] == 'low') ) {\n\t\t\t\tunset($options[$key]);\n\t\t\t}\n\t\t}\n\n\t\t// sold only options\n\n\t\t$options[] = array(\n\t\t\t'id'\t\t=>\t'sold_high',\n\t\t\t'label'\t\t=>\t__('Sold Price: High to Low','easy-property-listings' ),\n\t\t\t'type'\t\t=>\t'meta',\n\t\t\t//'key'\t\t=>\tis_epl_rental_post( $post_type ) ? 'property_rent':'property_sold_price',\n\t\t\t'key'\t\t=>\t'property_sold_price',\n\t\t\t'order'\t\t=>\t'DESC',\n\t\t\t'orderby'\t=>\t'meta_value_num',\n\t\t);\n\n\t\t$options[] = array(\n\t\t\t'id'\t\t=>\t'sold_low',\n\t\t\t'label'\t\t=>\t__('Sold Price: Low to High','easy-property-listings' ),\n\t\t\t//'key'\t\t=>\tis_epl_rental_post( $post_type ) ? 'property_rent':'property_sold_price',\n\t\t\t'key'\t\t=>\t'property_sold_price',\n\t\t\t'order'\t\t=>\t'ASC',\n\t\t\t'orderby'\t=>\t'meta_value_num',\n\t\t);\n\n\t}\n\n\treturn $options;\n\n}", "public function testGetPriceFromIndexer()\n {\n /** @var PriceTableResolver $tableResolver */\n $tableResolver = Bootstrap::getObjectManager()->create(PriceTableResolver::class);\n\n /** @var ResourceConnection $resourceConnection */\n $resourceConnection = Bootstrap::getObjectManager()->create(ResourceConnection::class);\n\n /** @var DimensionFactory $dimensionFactory */\n $dimensionFactory = Bootstrap::getObjectManager()->create(DimensionFactory::class);\n $dimension = [\n $dimensionFactory->create(CustomerGroupDimensionProvider::DIMENSION_NAME, (string)0),\n $dimensionFactory->create(WebsiteDimensionProvider::DIMENSION_NAME, (string)1)\n ];\n $connection = $resourceConnection->getConnection();\n $priceTable = $connection->getTableName(\n $tableResolver->resolve('catalog_product_index_price', $dimension)\n );\n\n $select = $connection->select()->from($priceTable)->where('entity_id = 1');\n\n $return = $connection->fetchAll($select);\n\n $this->assertEquals(10, $return[0]['price']);\n $this->assertEquals(10, $return[0]['final_price']);\n $this->assertEquals(19, $return[0]['min_price']);\n $this->assertEquals(19, $return[0]['max_price']);\n }", "protected function _getSortType() {}", "protected function _getSortType() {}", "public function getAllReviews($response, $hasta, $total,$shop) {\n echo \"<div style='color:blue;'>Actualizando \" . $hasta . \" de \" . $total . \" articulos.</div><br><br>\";\n $contador = 1;\n foreach ($response as $review) {\n $porcentaje = ($contador * 100) / count($response);\n echo \"<div style='color: blue'>\" . $contador . \" de \" . count($response) . \" - \" . $porcentaje. \"% Producto: \" . $review[\"post_title\"] . \"</div><br>\";\n // Obtiene los metadatos del producto\n $metadata = $this->getMetaData($review[\"ID\"]);\n\n // Imprime el asin\n $asin = $this->getAsin($metadata);\n echo \"<strong>Asin: </strong>\" . $asin . \"<br>\";\n\n // Nombres de las columnas de las diferentes tiendas\n $links = $this->productsLink();\n //foreach ($links as $link) {\n $link = $shop;\n foreach ($metadata as $mdata) {\n // Valida que exista el precio de esa tienda en la BD\n if (isset($mdata['meta_key']) && $mdata['meta_key'] == $link) {\n // Si tiene una url del producto en las tiendas...\n if (isset($mdata['meta_value']) && !empty($mdata['meta_value'])) {\n // Obtiene el precio, haciendo scrapping\n if ($link == 'amazon_affiliate_link' || $link == 'amazon_pl') {\n $price = $this->linkToScrap($link, $asin);\n } else {\n $price = $this->linkToScrap($link, $mdata['meta_value']);\n }\n // Valida si el precio del producto cambio\n // Imprime el link\n echo $mdata['meta_value'];\n // Imprime el precio\n echo \"<br><strong>Precio: </strong>\";\n echo (isset($price) && is_numeric($price) ? $price : \"<div style='color: red'>El producto ya no se encuentra disponible</div>\");\n\n if ($price != null && $price != \"\" && !empty($price)) {\n $hasChanged = $this->priceHasChanged($metadata, $link, $price);\n if ($hasChanged[\"change\"]) {\n if ($hasChanged[\"action\"] == 'update') {\n $oldPrice = $hasChanged['oldPrice'];\n echo \" El precio cambio, precio original: \" . $oldPrice;\n $this->updatePrice($link, $price, $mdata['post_id']);\n } else {\n echo \" El precio no existe, se creo en la base de datos\";\n $this->createPrice($link, $price, $mdata['post_id']);\n }\n }\n }\n echo \"<br>\";\n break;\n }\n }\n }\n //}\n echo \"<br><br>\";\n\n // ACtualiza el mejor precio y mejor tienda para del producto\n $this->setBestPrice($review[\"ID\"]);\n\n $contador += 1;\n }\n\n return $response;\n }", "public function getProduct(Request $request) {\n switch ($request->type){\n case \"none\":\n $product = Product::where('user_id', Auth::user()->id)\n ->get();\n foreach($product as $item) { \n $objTmp = new \\stdClass;\n $objTmp->name = $item->name;\n $objTmp->code = $item->code;\n $objTmp->user_id = $item->user_id;\n $objTmp->description = $item->description;\n $objTmp->origin[\"lat\"] = floatval(explode(\",\", $item->location->origin)[0]);\n $objTmp->origin[\"lng\"] = floatval(explode(\",\", $item->location->origin)[1]);\n $objTmp->destination[\"lat\"] = floatval(explode(\",\", $item->location->destination)[0]);\n $objTmp->destination[\"lng\"] = floatval(explode(\",\", $item->location->destination)[1]);\n $objTmp->location_new[\"lat\"] = $objTmp->origin[\"lat\"];\n $objTmp->location_new[\"lng\"] = $objTmp->origin[\"lng\"];\n if (!empty($item->location_new)) {\n $objTmp->location_new[\"lat\"] = floatval(explode(\",\", $item->location_new)[0]);\n $objTmp->location_new[\"lng\"] = floatval(explode(\",\", $item->location_new)[1]);\n }\n $objTmp->status = $item->status;\n $objTmp->pickup = $item->pickup;\n $list = $objTmp;\n }\n return response()->json($list);\n case \"slide_bar\":\n $product = Product::where('user_id', Auth::user()->id)\n ->get();\n foreach($product as $item) { \n $objTmp = new \\stdClass;\n $objTmp->id = $item->id;\n $objTmp->name = $item->name;\n $objTmp->code = $item->code;\n $objTmp->user_id = $item->user_id;\n $list[] = $objTmp;\n }\n return response()->json($list);\n case \"view\":\n case \"user\":\n $item = Product::find($request->id); \n $objTmp = new \\stdClass;\n $objTmp->id = $item->id;\n $objTmp->name = $item->name;\n $objTmp->code = $item->code;\n $objTmp->user_id = $item->user_id;\n $objTmp->email = $item->user->email;\n $objTmp->description = $item->description;\n $objTmp->origin[\"lat\"] = floatval(explode(\",\", $item->location->origin)[0]);\n $objTmp->origin[\"lng\"] = floatval(explode(\",\", $item->location->origin)[1]);\n $objTmp->destination[\"lat\"] = floatval(explode(\",\", $item->location->destination)[0]);\n $objTmp->destination[\"lng\"] = floatval(explode(\",\", $item->location->destination)[1]);\n $objTmp->location_new[\"lat\"] = $objTmp->origin[\"lat\"];\n $objTmp->location_new[\"lng\"] = $objTmp->origin[\"lng\"];\n if (!empty($item->location_new)) {\n $objTmp->location_new[\"lat\"] = floatval(explode(\",\", $item->location_new)[0]);\n $objTmp->location_new[\"lng\"] = floatval(explode(\",\", $item->location_new)[1]); \n }\n $objTmp->status = $item->status;\n $objTmp->pickup = $item->pickup;\n return response()->json($objTmp);\n case \"admin\":\n $product = Product::select('products.*', 'users.email as email')\n ->leftJoin('users', 'users.id', '=', 'products.user_id')\n ->where('email', 'like', \"%{$request->keySearch}%\")\n ->orWhere('products.name', 'like', \"%{$request->keySearch}%\")\n ->orWhere('products.code', 'like', \"%{$request->keySearch}%\")\n ->orWhere('products.status', 'like', \"%{$request->keySearch}%\");\n $totalRecord = $product->count();\n if ($request->limit == \"*\") {\n $listProduct = $product->offset(0);\n }\n else {\n $offset = (intval($request->currentPage) - 1) * intval($request->limit);\n $listProduct = $product->offset($offset)->limit(intval($request->limit));\n }\n $listProduct = $product->get()->sortBy(\"products.id\");\n $list = [];\n foreach($listProduct as $item) { \n $objTmp = new \\stdClass;\n $objTmp->id = $item->id;\n $objTmp->name = $item->name;\n $objTmp->code = $item->code;\n $objTmp->user_id = $item->user_id;\n $objTmp->email = $item->email;\n $objTmp->description = $item->description;\n $objTmp->pickup = $item->pickup;\n $objTmp->origin[\"lat\"] = floatval(explode(\",\", $item->location->origin)[0]);\n $objTmp->origin[\"lng\"] = floatval(explode(\",\", $item->location->origin)[1]);\n $objTmp->destination[\"lat\"] = floatval(explode(\",\", $item->location->destination)[0]);\n $objTmp->destination[\"lng\"] = floatval(explode(\",\", $item->location->destination)[1]);\n $objTmp->location_new[\"lat\"] = $objTmp->origin[\"lat\"];\n $objTmp->location_new[\"lng\"] = $objTmp->origin[\"lng\"];\n if (!empty($item->location_new)) {\n $objTmp->location_new[\"lat\"] = floatval(explode(\",\", $item->location_new)[0]);\n $objTmp->location_new[\"lng\"] = floatval(explode(\",\", $item->location_new)[1]);\n } \n $objTmp->status = GlobalConfig::getListStatus()[$item->status];\n $objTmp->created_at = new \\DateTime($item[\"created_at\"]);\n $objTmp->created_at = $objTmp->created_at->format(env('DATETIMEFORMAT', 'm/d/Y h:i A'));\n $objTmp->updated_at = $item[\"updated_at\"];\n if (!empty($item[\"updated_at\"])) {\n $objTmp->updated_at = new \\DateTime($item[\"updated_at\"]);\n $objTmp->updated_at = $objTmp->updated_at->format(env('DATETIMEFORMAT', 'm/d/Y h:i A'));\n }\n $list[] = $objTmp;\n }\n return response()->json([\"listProduct\" => $list,\n \"totalRecord\" => $totalRecord,\n \"from_date\" => $request->from_date,\n \"to_date\"=> $request->to_date]);\n case \"export\":\n return Excel::download(new ExportController($request), 'products.xlsx');\n }\n }", "public static function getStatProductstocks($formData, $sortby, $sorttype, $limit = '', $countOnly = false)\r\n {\r\n $whereString = '';\r\n\r\n\r\n if($formData['fpbarcode'] != '')\r\n $whereString .= ($whereString != '' ? ' AND ' : '') . 'sp.p_barcode = \"'.Helper::unspecialtext((string)$formData['fpbarcode']).'\" ';\r\n\r\n if($formData['fsid'] > 0)\r\n $whereString .= ($whereString != '' ? ' AND ' : '') . 'sp.s_id = '.(int)$formData['fsid'].' ';\r\n\r\n if($formData['fid'] > 0)\r\n $whereString .= ($whereString != '' ? ' AND ' : '') . 'sp.sd_id = '.(int)$formData['fid'].' ';\r\n\r\n if($formData['fday'] > 0)\r\n $whereString .= ($whereString != '' ? ' AND ' : '') . 'sp.sd_day = '.(int)$formData['fday'].' ';\r\n\r\n if($formData['fmonth'] > 0)\r\n $whereString .= ($whereString != '' ? ' AND ' : '') . 'sp.sd_month = '.(int)$formData['fmonth'].' ';\r\n\r\n if($formData['fyear'] > 0)\r\n $whereString .= ($whereString != '' ? ' AND ' : '') . 'sp.sd_year = '.(int)$formData['fyear'].' ';\r\n\r\n\r\n\r\n if(strlen($formData['fkeywordFilter']) > 0)\r\n {\r\n $formData['fkeywordFilter'] = Helper::unspecialtext($formData['fkeywordFilter']);\r\n\r\n if($formData['fsearchKeywordIn'] == 'pbarcode')\r\n $whereString .= ($whereString != '' ? ' AND ' : '') . 'sp.p_barcode LIKE \\'%'.$formData['fkeywordFilter'].'%\\'';\r\n else\r\n $whereString .= ($whereString != '' ? ' AND ' : '') . '( (sp.p_barcode LIKE \\'%'.$formData['fkeywordFilter'].'%\\') )';\r\n }\r\n\r\n //checking sort by & sort type\r\n if($sorttype != 'DESC' && $sorttype != 'ASC')\r\n $sorttype = 'DESC';\r\n\r\n\r\n if($sortby == 'pbarcode')\r\n $orderString = 'p_barcode ' . $sorttype;\r\n elseif($sortby == 'sid')\r\n $orderString = 's_id ' . $sorttype;\r\n elseif($sortby == 'id')\r\n $orderString = 'sd_id ' . $sorttype;\r\n elseif($sortby == 'quantity')\r\n $orderString = 'sd_quantity ' . $sorttype;\r\n elseif($sortby == 'day')\r\n $orderString = 'sd_day ' . $sorttype;\r\n elseif($sortby == 'month')\r\n $orderString = 'sd_month ' . $sorttype;\r\n elseif($sortby == 'year')\r\n $orderString = 'sd_year ' . $sorttype;\r\n else\r\n $orderString = 'sd_id ' . $sorttype;\r\n\r\n if($countOnly)\r\n return self::countList($whereString);\r\n else\r\n return self::getList($whereString, $orderString, $limit);\r\n }", "function search($searchType, $price, $location, $categories) {\n $url_params = array();\n \n $url_params['term'] = $searchType;\n //$url_params['location'] = $location;\n $url_params['longitude'] = $location[0];\n $url_params['latitude'] = $location[1];\n //8046.72 is equivalent to 5 miles 16093.44 is equivalent to 10 miles\n $url_params['radius'] = 16093;\n $url_params['price'] = $price;\n $url_params['sort_by'] = 'rating';\n $url_params['open_now'] = true;\n $url_params['limit'] = 20;\n $url_params['categories'] = $categories;\n \n //converts into 'https://api.yelp.com/v3/businesses/search/location&limit&price&sort_by&radius'\n $response = request($GLOBALS['API_HOST'], $GLOBALS['SEARCH_PATH'], $url_params);\n \n $pretty_response = json_encode(json_decode($response), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);\n\n $data = json_decode($pretty_response, true);\n\n return $data['businesses'];\n}", "public function determineSortPrice()\n {\n $price = $this->mcp3Project->getStringByPath('//project:Details/project:Koop/project:Prijs');\n if (!empty($price))\n return $price;\n\n $price = $this->mcp3Project->getStringByPath('//project:Details/project:Huur/project:Prijs');\n if (!empty($price))\n return $price;\n\n return 0;\n }", "public function testGetProducts()\n {\n $stub = $this->getMockBuilder('AppBundle\\Parser\\PageFetcher')->getMock();\n $stub->method('fetchHtml')->willReturn($this->sampleHtml);\n\n $productParser = new ProductParser();\n\n $productsResponse = $productParser->getProducts($this->url);\n\n $this->assertInstanceOf('\\AppBundle\\ValueObj\\ProductsResponse', $productsResponse);\n }", "public function testSearchWithoutFilters()\n {\n // Stub a JSON response for api.bestHotels.com/ endpoint.\n Http::fake([\n 'api.topHotels.com/*' => Http::response(['data' => $this->topHotelsDataFactory->getItems()], 200),\n 'api.bestHotels.com/*' => Http::response(['data' => $this->bestHotelsDataFactory->getItems()], 200)\n ]);\n $response = $this->json('get', 'api/search');\n $response->assertStatus(200);\n $response->assertJsonStructure([\n 'data' => [\n '*' => [\n 'provider',\n 'hotelName',\n 'rate',\n 'discount',\n 'fare',\n 'amenities',\n ]\n ],\n ]);\n }", "public function testOrdersApiValue()\n {\n $this->assertEquals(3, PaymentMethodType::ORDERS_API);\n }", "public function getSellerList(Request $request){\n $pid=$request->pid;\n if(!empty($pid)){\n $pid_val=$pid;\n }else{\n $pid_val=\"\";\n }\n\n $filter_type=[]; //code is still need to improved\n //Get page number from Ajax\n if(isset($_POST[\"page\"])){\n $page_number = filter_var($_POST[\"page\"], FILTER_SANITIZE_NUMBER_INT, FILTER_FLAG_STRIP_HIGH); //filter number\n if(!is_numeric($page_number)){die('Invalid page number!');} //incase of invalid page number\n }else{\n $page_number = 1; //if there's no page number, set it to 1\n }\n $client = new Client();\n // Grab the client's handler instance.\n $clientHandler = $client->getConfig('handler');\n // Create a middleware that echoes parts of the request.\n $tapMiddleware = Middleware::tap(function ($request) {\n $request->getHeaderLine('Content-Type');\n // application/json\n $request->getBody();\n\n });\n\n\n $response = $client->request('POST', Config::get('ayra.apiList.SELLER_LIST'), [\n 'json' => [\n 'API_TOKEN' => '',\n 'category_id' =>$pid_val,\n 'filters' => $filter_type,\n 'is_gold_supplier' => '0',\n 'is_trade_assurance' => '0',\n 'moq' => '0',\n 'order' => 'asc',\n 'page' => $page_number,\n 'search_keyword' => '',\n 'sort' => '',\n ],\n 'handler' => $tapMiddleware($clientHandler)\n ]);\n // echo $response->getBody()->getContents();\n$data_arr=json_decode($response->getBody()->getContents());\n\n$item_per_page \t\t= $data_arr->data->per_page; //item to display per page\n//get total number of records from database\n\n$get_total_rows = $data_arr->data->total; //hold total records in variable\n//break records into pages\n$total_pages = ceil($get_total_rows/$item_per_page);\n//position of records\n$page_position = (($page_number-1) * $item_per_page);\n//Limit our results within a specified range.\n\n\n\n\n\n\n//Display records fetched from database.\n$html='<ul class=\"contents\">';\n// echo \"<pre>\";\nforeach ($data_arr->data->data as $key => $value) {\n\n if($value->image==\"\"){\n $avatar = new LetterAvatar($value->name);\n\n }else{\n $avatar=$value->image;\n }\n $html='<div class=\"pr_display_card\">\n <div class=\"row\">\n\n <div class=\"col-md-2\">\n <div class=\"pr_thumbnail\">\n\n <img width=\"145px\" class=\"img_circle\" src=\"'.$avatar.'\" >\n </div>\n </div>\n <div class=\"col-md-8\">\n <div class=\"pr_content_card\">\n <div class=\"company_list_card\">\n <ul class=\"list-inline\">\n <li>\n <span class=\"sh1\">'.$value->name.'</span> <span> '.$value->location.'</span>\n </li>\n </ul>\n <span class=\"splbxinh24\" >Main Product</span>\n </div>\n </div>\n <div class=\"navcontainer_aj\">\n <ul>';\n\n foreach ($value->main_products as $key => $mp_value) {\n // echo \"<pre>\";\n // print_r($mp_value);\n $pname1=str_replace('/', '-', $mp_value->name);\n $pname=str_replace(' ', '-', $pname1);\n\n echo $plinka=preg_replace('/\\s+/u', '-', trim($pname));\n echo \"<br>\";\n\n\n\n\n $urllink=route('seller-detail', ['id' =>$value->id,'name' =>$plinka]);\n\n $html .='<li><a href=\"'.URL::to('/product-detail/'.$mp_value->id.\"/\".$plinka).'\">\n <img src=\"'.$mp_value->image.'\" width=\"110%\" style=\"min-height:110px;\">\n <span class=\"ist\">'.$mp_value->name.'</span>\n\n </a>\n </li>';\n }\n\n\n\n $html .='</ul>\n </div>\n </div>\n <div class=\"col-md-1\">\n <span class=\"comp_img_tag_img\">\n <img src=\"'.$value->group_image.'\" alt\"\" width=\"75px\">\n </span>\n <a href=\"'.$urllink.'\" class=\"btn btn-primary btn-ms aj_button_req\" name=\"button\">View Details</a> </div>\n </div>\n </div>';\n\n echo $html .='</ul>';\n\n\n}\necho '<div align=\"center\">';\n// To generate links, we call the pagination function here.\necho $this->paginate_function($item_per_page, $page_number, $get_total_rows, $total_pages);\necho '</div>';\n\n}", "public function sortSalestransactions(Request $request,$column) {\n //get the collection from the seesion variable\n $salestransactions = $request->session()->get('salestransactions');\n // now sort the collection\n // first check the session variable to see if we are sorting on the same column\n // if so, reverse the sort\n $txcol = $request->session()->get('txcol');\n $txord = $request->session()->get('txord');\n $ord = 'A';\n if ($txcol == $column) {\n if ($txord == 'A') {\n $ord = 'D';\n }\n }\n // check if column is either last name or city - need special sort\n\n if ($column == 'salesperson_name') {\n if ($ord == 'A') {\n $salestransactions = $salestransactions->sortBy(function($salestransactions) {\n return $salestransactions->salesperson->last_name . ',' . $salestransactions->salesperson->first_name . ' ' . $salestransactions->transaction_date;\n });\n } else {\n $salestransactions = $salestransactions->sortByDesc(function($salestransactions) {\n return $salestransactions->salesperson->last_name . ',' . $salestransactions->salesperson->first_name . ' ' . $salestransactions->transaction_date;\n });\n }\n } elseif ($column == 'product_id') {\n if ($ord == 'A') {\n $salestransactions = $salestransactions->sortBy(function($salestransactions) {\n return $salestransactions->product->product_id . ' ' . $salestransactions->transaction_date;\n });\n } else {\n $salestransactions = $salestransactions->sortByDesc(function($salestransactions) {\n return $salestransactions->product->product_id . ' ' . $salestransactions->transaction_date;\n });\n }\n } elseif ($column == 'product_name') {\n if ($ord == 'A') {\n $salestransactions = $salestransactions->sortBy(function($salestransactions) {\n return $salestransactions->product->product_name . ' ' . $salestransactions->transaction_date;\n });\n } else {\n $salestransactions = $salestransactions->sortByDesc(function($salestransactions) {\n return $salestransactions->product->product_name . ' ' . $salestransactions->transaction_date;\n });\n }\n } elseif ($column == 'total') {\n if ($ord == 'A') {\n $salestransactions = $salestransactions->sortBy(function($salestransactions) {\n return $salestransactions->quantity * $salestransactions->product->price;\n });\n } else {\n $salestransactions = $salestransactions->sortByDesc(function($salestransactions) {\n return $salestransactions->quantity * $salestransactions->product->price;\n });\n }\n } else {\n if ($ord == 'A') {\n $salestransactions = $salestransactions->sortBy($column);\n } else {\n $salestransactions = $salestransactions->sortByDesc($column);\n }\n }\n\n $salestransactions->values()->all();\n // set the session variable to refelect the current sort\n $request->session()->put('txcol',$column);\n $request->session()->put('txord',$ord);\n $request->session()->put('salestransactions',$salestransactions);\n return view('salestransactions', ['sortOrder' => $column], ['salestransactions' => $salestransactions]);\n }", "abstract protected function _getSortType();", "public function testParseResponse() {\n $data = $this->dl->parseResponse($this->sampleData, \"JSON\");\n $this->assertion($data['zip'], \"37931\", \"Parsed zip should equal 37931.\");\n $this->assertion($data['conditions'], \"clear sky\", \"Parsed conditions should equal clear sky.\");\n $this->assertion($data['pressure'], \"1031\", \"Parsed pressure should equal 1031.\");\n $this->assertion($data['temperature'], \"35\", \"Parsed temperature should equal 35.\");\n $this->assertion($data['windDirection'], \"ESE\", \"Parsed wind direction should equal ESE.\");\n $this->assertion($data['windSpeed'], \"1.06\", \"Parsed wind speed should equal 1.06.\");\n $this->assertion($data['humidity'], \"80\", \"Parsed humidity should equal 80.\");\n $this->assertion($data['timestamp'], \"1518144900\", \"Parsed timestamp should equal 1518144900.\");\n }", "function getProducts($page)\n{\n // Update the API URL with the page number\n $api_url = API_URL . '?page=' . $page;\n\n // Initialize the cURL\n $curl = curl_init();\n\n // Configure the cURL\n curl_setopt($curl, CURLOPT_URL, $api_url);\n curl_setopt($curl, CURLOPT_HEADER, true);\n curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($curl, CURLOPT_USERPWD, API_USERNAME . ':' . API_PASSWORD);\n curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);\n\n // Execute the cURL\n $response = curl_exec($curl);\n\n // Extract the headers of the response\n $header_size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);\n $header = substr($response, 0, $header_size);\n $header = getHeaders($header);\n\n // Get the total pages and total products from the headers\n $total_pages = $header['X-WP-TotalPages'];\n $total_products = $header['X-WP-Total'];\n\n // Extract body of the response\n $body = substr($response, $header_size);\n\n // Convert the body from string to array\n $body = json_decode($body);\n\n // Define an array to store the products\n $products = array();\n\n // Loop through the response\n foreach ($body as $item) {\n // Only if the catalog visibility is visible\n if ($item->catalog_visibility === 'visible') {\n // Instantiate an object of Product\n $product = new Product();\n\n // Assign the values\n $product->id = $item->id;\n $product->name = $item->name;\n $product->images = $item->images;\n\n // Push the object into the array\n array_push($products, $product);\n }\n }\n\n // Destroy the cURL instance\n curl_close($curl);\n\n // Encapsulate all the data in an array\n $data = array(\n \"total_pages\" => $total_pages,\n \"total_products\" => $total_products,\n \"products\" => $products\n );\n\n return $data;\n}", "public function testGetAllValidVouchers(){\n $response = $this->json('POST', 'api/voucher/all', ['email' => '[email protected]']);\n\n $response\n ->assertStatus(200)\n ->assertJsonStructure([\n [\n 'code',\n 'offer'\n ]\n ]);\n }", "public function test_show_list_of_products()\n {\n $response = $this->getJson('/api/products');\n $response->assertStatus(200);\n }", "public function testGetSuppliersUsingGET()\n {\n }", "function expected_orders($data)\n{\n global $user;\n $expected_orders = [];\n $user_id = $user->uid;\n $account_products_ids = [];\n if (!isset($data['accounts'])) {\n return services_error('accounts is not defined!', 500);\n } elseif (!isset($data['therapeutic'])) {\n return services_error('therapeutic area is not defined!', 500);\n } else {\n if (!isset($data['year'])) {\n $date = get_year_dates();\n } else {\n $date = get_year_dates($data['year']);\n }\n if (!isset($data['quarter'])) {\n $data['quarter'] = 1;\n }\n if (is_array($data['quarter'])) {\n $data['quarter'] = $data['quarter'][0];\n }\n if (is_array($data['therapeutic'])) {\n $data['therapeutic'] = $data['therapeutic'][0];\n }\n // Get reps;\n if (is_rep($user)) {\n $data['reps'] = (is_array($user_id)) ? $user_id : [$user_id];\n } elseif (is_sales_manager($user)) {\n $data['reps'] = ppt_resources_get_sales_manager_reps($user_id);\n $data['reps'] = (is_array($data['reps'])) ? $data['reps'] : [$data['reps']];\n } elseif (is_comm_lead($user)) {\n if (isset($data['team'])) {\n if (is_array($data['team'])) {\n $data['team'] = $data['team'][0];\n $data['reps'] = array_keys(ppt_resources_get_team_reps($data['team']));\n }\n $data['reps'] = (is_array($data['reps'])) ? $data['reps'] : [$data['reps']];\n }\n } else {\n $data['reps'] = ppt_resources_get_users_per_role($user);\n $data['reps'] = (is_array($data['reps'])) ? $data['reps'] : [$data['reps']];\n }\n // Get products belong to selected account.\n $account_info = node_load_multiple($data['accounts']);\n foreach ($account_info as $info) {\n $account_products_array = $info->field_products['und'];\n foreach ($account_products_array as $product) {\n $account_products_ids[] = $product['target_id'];\n }\n }\n // Get products belong to theraputic area.\n $thermatic_area_products_ids = get_thermatic_area_products_ids($data[\"therapeutic\"]);\n // Get match products with account and thermatic area .\n if (!empty($thermatic_area_products_ids) && !empty($account_products_ids)) {\n foreach ($account_products_ids as $product_id) {\n if (in_array($product_id, $thermatic_area_products_ids)) {\n $data['products'][] = $product_id;\n }\n }\n if (!empty($data['products'])) {\n // Match current user products.\n if (is_rep($user)) {\n $final_products = [];\n $user_products = get_products_for_current_user($user_id, FALSE, FALSE);\n if (isset($user_products) && !empty($user_products)) {\n foreach ($user_products as $product_id) {\n if (in_array($product_id, $data['products'])) {\n $final_products[] = $product_id;\n }\n }\n }\n if (!empty($final_products)) {\n $data['products'] = $final_products;\n } else {\n return [];\n }\n }\n }\n } else {\n return [];\n }\n // return $data['products'];\n if (empty($data['products'])) {\n return [];\n }\n\n // Planned orders.\n $orders = get_planned_orders($data['reps'], $data['accounts'], $data['products'], $date);\n if (isset($orders) && !empty($orders)) {\n foreach ($orders as $order) {\n // Load product.\n $product_id = $order->field_planned_product['und'][0]['target_id'];\n // Create array of product planned_orders .\n $expected_orders[$product_id]['planned_orders'][] = [\n 'planned_period' => $order->field_planned_period['und'][0]['value'],\n 'acutal_period' => $order->field_planned_actual_period['und'][0]['value'],\n 'planned_quantity' => $order->field_planned_quantity['und'][0]['value'],\n 'delivered_quantity' => $order->field_planned_delivered_quantity['und'][0]['value']\n ];\n }\n }\n if (isset($data['products']) && isset($data['accounts']) && isset($data['reps'])) {\n foreach ($data['accounts'] as $account) {\n foreach ($data['products'] as $product) {\n $entries = ppt_resources_get_entries($account, [$product], $data['reps']);\n $entries_records = get_entries_records_for_year($entries, $data['year'], 'consumption_stock_entry');\n if (isset($entries_records)) {\n foreach ($entries_records as $entry => $records) {\n $records_loaded = entity_load(\"entry_month_record\", $records);\n foreach ($records_loaded as $record) {\n // Create array of product stocks .\n $expected_orders[$product][\"stocks\"][] = [\n 'consumption' => $record->field_consumption['und'][0]['value'],\n 'stocks' => $record->field_stocks['und'][0]['value'],\n 'entry_date' => $record->field_entry_date['und'][0]['value']\n ];\n }\n }\n }\n }\n }\n }\n $total_expected = [];\n if (isset($expected_orders)) {\n foreach ($expected_orders as $key => $orders) {\n // Intialize array with each month and values for each month = 0 .\n $final_array = [\n \"Dec\" => [\n 'stocks' => 0,\n 'consumption' => 0,\n 'planned_quantity' => 0,\n 'delivered_quantity' => 0\n ],\n \"Jan\" => [\n 'stocks' => 0,\n 'consumption' => 0,\n 'planned_quantity' => 0,\n 'delivered_quantity' => 0\n ],\n \"Feb\" => [\n 'stocks' => 0,\n 'consumption' => 0,\n 'planned_quantity' => 0,\n 'delivered_quantity' => 0\n ],\n \"Mar\" => [\n 'stocks' => 0,\n 'consumption' => 0,\n 'planned_quantity' => 0,\n 'delivered_quantity' => 0\n ],\n \"Apr\" => [\n 'stocks' => 0,\n 'consumption' => 0,\n 'planned_quantity' => 0,\n 'delivered_quantity' => 0\n ],\n \"May\" => [\n 'stocks' => 0,\n 'consumption' => 0,\n 'planned_quantity' => 0,\n 'delivered_quantity' => 0\n ],\n \"Jun\" => [\n 'stocks' => 0,\n 'consumption' => 0,\n 'planned_quantity' => 0,\n 'delivered_quantity' => 0\n ],\n \"Jul\" => [\n 'stocks' => 0,\n 'consumption' => 0,\n 'planned_quantity' => 0,\n 'delivered_quantity' => 0\n ],\n \"Aug\" => [\n 'stocks' => 0,\n 'consumption' => 0,\n 'planned_quantity' => 0,\n 'delivered_quantity' => 0\n ],\n \"Sep\" => [\n 'stocks' => 0,\n 'consumption' => 0,\n 'planned_quantity' => 0,\n 'delivered_quantity' => 0\n ],\n \"Oct\" => [\n 'stocks' => 0,\n 'consumption' => 0,\n 'planned_quantity' => 0,\n 'delivered_quantity' => 0\n ],\n \"Nov\" => [\n 'stocks' => 0,\n 'consumption' => 0,\n 'planned_quantity' => 0,\n 'delivered_quantity' => 0\n ]\n ];\n if (isset($orders['planned_orders'])) {\n foreach ($orders['planned_orders'] as $order) {\n $final_array[date(\"M\", strtotime($order['planned_period']))]['planned_quantity'] += $order['planned_quantity'];\n $final_array[date(\"M\", strtotime($order['acutal_period']))]['delivered_quantity'] += $order['delivered_quantity'];\n }\n }\n if (isset($orders['stocks'])) {\n foreach ($orders['stocks'] as $order) {\n $final_array[date(\"M\", strtotime($order['entry_date']))]['consumption'] += $order['consumption'];\n $final_array[date(\"M\", strtotime($order['entry_date']))]['stocks'] += $order['stocks'];\n }\n }\n $product_name = taxonomy_term_load($key)->name;\n // Add final array to its product .\n $total_expected[$product_name] = $final_array;\n }\n }\n // Set products matched with 0 values if not have values.\n foreach ($data['products'] as $product_id) {\n $product_name = taxonomy_term_load($product_id)->name;\n if (!in_array($product_name, array_keys($total_expected))) {\n $total_expected[$product_name] = [\n \"Dec\" => [\n 'stocks' => 0,\n 'consumption' => 0,\n 'planned_quantity' => 0,\n 'delivered_quantity' => 0\n ],\n \"Jan\" => [\n 'stocks' => 0,\n 'consumption' => 0,\n 'planned_quantity' => 0,\n 'delivered_quantity' => 0\n ],\n \"Feb\" => [\n 'stocks' => 0,\n 'consumption' => 0,\n 'planned_quantity' => 0,\n 'delivered_quantity' => 0\n ],\n \"Mar\" => [\n 'stocks' => 0,\n 'consumption' => 0,\n 'planned_quantity' => 0,\n 'delivered_quantity' => 0\n ],\n \"Apr\" => [\n 'stocks' => 0,\n 'consumption' => 0,\n 'planned_quantity' => 0,\n 'delivered_quantity' => 0\n ],\n \"May\" => [\n 'stocks' => 0,\n 'consumption' => 0,\n 'planned_quantity' => 0,\n 'delivered_quantity' => 0\n ],\n \"Jun\" => [\n 'stocks' => 0,\n 'consumption' => 0,\n 'planned_quantity' => 0,\n 'delivered_quantity' => 0\n ],\n \"Jul\" => [\n 'stocks' => 0,\n 'consumption' => 0,\n 'planned_quantity' => 0,\n 'delivered_quantity' => 0\n ],\n \"Aug\" => [\n 'stocks' => 0,\n 'consumption' => 0,\n 'planned_quantity' => 0,\n 'delivered_quantity' => 0\n ],\n \"Sep\" => [\n 'stocks' => 0,\n 'consumption' => 0,\n 'planned_quantity' => 0,\n 'delivered_quantity' => 0\n ],\n \"Oct\" => [\n 'stocks' => 0,\n 'consumption' => 0,\n 'planned_quantity' => 0,\n 'delivered_quantity' => 0\n ],\n \"Nov\" => [\n 'stocks' => 0,\n 'consumption' => 0,\n 'planned_quantity' => 0,\n 'delivered_quantity' => 0\n ]\n ];\n }\n }\n $quarter_array = [];\n switch ($data['quarter']) {\n case 1:\n foreach ($total_expected as $key => $product_arr) {\n $quarter_array[$key] = array_slice($product_arr, 0, 3);\n }\n break;\n case 2:\n foreach ($total_expected as $key => $product_arr) {\n $quarter_array[$key] = array_slice($product_arr, 3, 3);\n }\n break;\n case 3:\n foreach ($total_expected as $key => $product_arr) {\n $quarter_array[$key] = array_slice($product_arr, 6, 3);\n }\n break;\n case 4:\n foreach ($total_expected as $key => $product_arr) {\n $quarter_array[$key] = array_slice($product_arr, 9, 3);\n }\n break;\n }\n // Return YTD by current Month .\n foreach ($total_expected as $product_name => $months) {\n $counter = 0;\n $temp = [];\n $ytd = [\n \"delivered_quantity\" => 0,\n \"consumption\" => 0,\n \"stocks\" => 0 ,\n \"moh\" => 0\n ];\n $current_month = date('m');\n $current_year = date('Y');\n foreach ($months as $month => $total) {\n $nmonth = date('m', strtotime($month));\n // calculate Consumption avarage .\n if ($current_year == ($data['year']-1)){\n if ($current_month == 12) {\n // get the value of Dec only .\n if ($nmonth == $current_month) {\n $ytd['delivered_quantity'] += $total['delivered_quantity'];\n $ytd['consumption'] += $total['consumption'];\n $ytd['stocks'] += $total['stocks'];\n }\n }\n }\n else {\n // get months from 12 till months less than or equall current month .\n if ($nmonth <= $current_month || $nmonth == 12) {\n if( $total['consumption'] > 0){\n $counter+=1 ;\n }\n // Ytd DQ value.\n $ytd['delivered_quantity'] += $total['delivered_quantity'];\n $ytd['consumption'] += $total['consumption'];\n// $ytd['stocks'] += $total['stocks'];\n }\n }\n // Calculate latest available stock .\n if (empty($temp)) {\n $temp['value'] = (empty($total['stocks']))?0:$total['stocks'];\n $temp['month'] = ($nmonth == 12)?0:$nmonth ;\n }else{\n if (!empty($total['stocks']) && $nmonth > $temp['month'] ){\n $temp['value'] = $total['stocks'];\n $temp['month'] = $nmonth;\n }\n }\n }\n // Ytd stocks value .\n $ytd['stocks'] = $temp['value'];\n // Ytd consumption value.\n if ($counter!=0){\n $ytd['consumption'] = number_format($ytd['consumption']/$counter,2,'.','')+0;\n }\n // Ytd moh vale.\n if ($ytd['consumption'] == 0){\n $ytd['moh'] = 0;\n }\n else {\n $moh_value = $ytd['stocks']/$ytd['consumption'] ;\n if (fmod($moh_value,1) !== 0.00) {\n $ytd['moh'] = number_format($moh_value,2,'.','') + 0;\n } else {\n $ytd['moh'] = $moh_value;\n }\n }\n $quarter_array[$product_name]['ytd'] = $ytd;\n }\n $ytd = array_column($quarter_array, 'ytd');\n $consumption = array_column($ytd, 'consumption');\n array_multisort($consumption, SORT_DESC, $quarter_array);\n return $quarter_array;\n }\n}", "public function PriceFilter(Request $request){\n//featured filter sorting\nif ($request->brand_filter)\n{\n // $brand = Session::get('brand');\n if ($request->brand_filter == $brand)\n {\n \n $request->brand_filter = null ; \n }\n}\n\n\n\nif($request->sorting_filter == \"featured\" ){ \n $newArrivalProductDatas = Product::where('is_new_arrival','1')->where('status','1')->where('is_deleted','0')->where('is_featured','1')->get();\n foreach ($newArrivalProductDatas as $keyNewArrivalProductReview => $valueNewArrivalProductReview) {\n $newArrivalProductData[$keyNewArrivalProductReview] = $valueNewArrivalProductReview;\n //$newArrivalProductData[$keyNewArrivalProductReview]['review'] = $review = Review::where('product_id',$valueNewArrivalProductReview['id'])->get();\n }\n\n foreach ($newArrivalProductDatas as $keyProductImage => $valueProductImage) {\n $newArrivalProductData[$keyProductImage] = $valueProductImage;\n $newArrivalProductData[$keyProductImage]['product_image'] = $ProductImage = ProductImage::where('product_id',$valueProductImage['id'])->take('4')->get();\n }\n\n}\n\nif($request->sorting_filter == \"name_a_to_z\" ){ \n $newArrivalProductDatas = Product::where('is_new_arrival','1')->where('status','1')->where('is_deleted','0')->orderBy('name','ASC')->get();\n foreach ($newArrivalProductDatas as $keyNewArrivalProductReview => $valueNewArrivalProductReview) {\n $newArrivalProductData[$keyNewArrivalProductReview] = $valueNewArrivalProductReview;\n //$newArrivalProductData[$keyNewArrivalProductReview]['review'] = $review = Review::where('product_id',$valueNewArrivalProductReview['id'])->get();\n }\n\n foreach ($newArrivalProductDatas as $keyProductImage => $valueProductImage) {\n $newArrivalProductData[$keyProductImage] = $valueProductImage;\n $newArrivalProductData[$keyProductImage]['product_image'] = $ProductImage = ProductImage::where('product_id',$valueProductImage['id'])->take('4')->get();\n }\n\n}\n\nif($request->sorting_filter == \"name_z_to_a\" ){ \n $newArrivalProductDatas = Product::where('is_new_arrival','1')->where('status','1')->where('is_deleted','0')->orderBy('name','DESC')->get();\n foreach ($newArrivalProductDatas as $keyNewArrivalProductReview => $valueNewArrivalProductReview) {\n $newArrivalProductData[$keyNewArrivalProductReview] = $valueNewArrivalProductReview;\n //$newArrivalProductData[$keyNewArrivalProductReview]['review'] = $review = Review::where('product_id',$valueNewArrivalProductReview['id'])->get();\n }\n\n foreach ($newArrivalProductDatas as $keyProductImage => $valueProductImage) {\n $newArrivalProductData[$keyProductImage] = $valueProductImage;\n $newArrivalProductData[$keyProductImage]['product_image'] = $ProductImage = ProductImage::where('product_id',$valueProductImage['id'])->take('4')->get();\n }\n\n}\n\nif($request->sorting_filter == \"price_low_to_high\" ){ \n $newArrivalProductDatas = Product::where('is_new_arrival','1')->where('status','1')->where('is_deleted','0')->orderBy('price','ASC')->get();\n foreach ($newArrivalProductDatas as $keyNewArrivalProductReview => $valueNewArrivalProductReview) {\n $newArrivalProductData[$keyNewArrivalProductReview] = $valueNewArrivalProductReview;\n //$newArrivalProductData[$keyNewArrivalProductReview]['review'] = $review = Review::where('product_id',$valueNewArrivalProductReview['id'])->get();\n }\n\n foreach ($newArrivalProductDatas as $keyProductImage => $valueProductImage) {\n $newArrivalProductData[$keyProductImage] = $valueProductImage;\n $newArrivalProductData[$keyProductImage]['product_image'] = $ProductImage = ProductImage::where('product_id',$valueProductImage['id'])->take('4')->get();\n }\n}\n\nif($request->sorting_filter == \"price_high_to_low\" ){ \n $newArrivalProductDatas = Product::where('is_new_arrival','1')->where('status','1')->where('is_deleted','0')->orderBy('price','DESC')->get();\n foreach ($newArrivalProductDatas as $keyNewArrivalProductReview => $valueNewArrivalProductReview) {\n $newArrivalProductData[$keyNewArrivalProductReview] = $valueNewArrivalProductReview;\n //$newArrivalProductData[$keyNewArrivalProductReview]['review'] = $review = Review::where('product_id',$valueNewArrivalProductReview['id'])->get();\n }\n\n foreach ($newArrivalProductDatas as $keyProductImage => $valueProductImage) {\n $newArrivalProductData[$keyProductImage] = $valueProductImage;\n $newArrivalProductData[$keyProductImage]['product_image'] = $ProductImage = ProductImage::where('product_id',$valueProductImage['id'])->take('4')->get();\n }\n}\n\n/////////////////////////////////////// Default sorting filter end////////////////\n\n\n\n\n if($request->min_price != null){ \n foreach ($request->min_price as $value) {\n $min_price = $value;\n }\n }else{\n $min_price = null;\n }\n\n if($request->max_price != null){ \n foreach ($request->max_price as $value) {\n $max_price = $value;\n }\n }else{\n $max_price = null;\n }\n\n\n if($request->clearall != null){ \n foreach ($request->clearall as $value) {\n $clearall = $value;\n }\n }else{\n $clearall = null;\n }\n\n \n\n \n if ($min_price != null && $max_price != null) {\n //dd($min_price , $max_price);\n $newArrivalProductDatas = Product::where('is_new_arrival','1')->where('status','1')->where('is_deleted','0')->where('price','>=',$min_price)->where('price','<=',$max_price)->get();\n foreach ($newArrivalProductDatas as $keyNewArrivalProductReview => $valueNewArrivalProductReview) {\n $newArrivalProductData[$keyNewArrivalProductReview] = $valueNewArrivalProductReview;\n //$newArrivalProductData[$keyNewArrivalProductReview]['review'] = $review = Review::where('product_id',$valueNewArrivalProductReview['id'])->get();\n }\n\n foreach ($newArrivalProductDatas as $keyProductImage => $valueProductImage) {\n $newArrivalProductData[$keyProductImage] = $valueProductImage;\n $newArrivalProductData[$keyProductImage]['product_image'] = $ProductImage = ProductImage::where('product_id',$valueProductImage['id'])->take('4')->get();\n }\n } \n\n\n //New arrival categories filter\n\n if (isset($request->department)) {\n $newArrivalId = $request->department;\n $newArrivalProductDatas = Product::where('is_new_arrival','1')->where('status','1')->where('is_deleted','0')->whereIn('category_id',$newArrivalId)->get();\n //dd($newArrivalProductDatas);\n foreach ($newArrivalProductDatas as $keyNewArrivalProductReview => $valueNewArrivalProductReview) {\n $newArrivalProductData[$keyNewArrivalProductReview] = $valueNewArrivalProductReview;\n //$newArrivalProductData[$keyNewArrivalProductReview]['review'] = $review = Review::where('product_id',$valueNewArrivalProductReview['id'])->get();\n }\n\n foreach ($newArrivalProductDatas as $keyProductImage => $valueProductImage) {\n $newArrivalProductData[$keyProductImage] = $valueProductImage;\n $newArrivalProductData[$keyProductImage]['product_image'] = $ProductImage = ProductImage::where('product_id',$valueProductImage['id'])->take('4')->get();\n }\n }\n\n //Brand filter\n if (isset($request->brand_filter)){\n Session::put('brand',$request->brand_filter);\n $newArrivalId = $request->brand_filter;\n $newArrivalProductDatas = Product::where('is_new_arrival','1')->where('status','1')->where('is_deleted','0')->whereIn('brand_id',$newArrivalId)->get();\n foreach ($newArrivalProductDatas as $keyNewArrivalProductReview => $valueNewArrivalProductReview) {\n $newArrivalProductData[$keyNewArrivalProductReview] = $valueNewArrivalProductReview;\n //$newArrivalProductData[$keyNewArrivalProductReview]['review'] = $review = Review::where('product_id',$valueNewArrivalProductReview['id'])->get();\n }\n\n foreach ($newArrivalProductDatas as $keyProductImage => $valueProductImage) {\n $newArrivalProductData[$keyProductImage] = $valueProductImage;\n $newArrivalProductData[$keyProductImage]['product_image'] = $ProductImage = ProductImage::where('product_id',$valueProductImage['id'])->take('4')->get();\n }\n\n } \n\n //Size filter\n if (isset($request->size_filter)){\n $size_filter = $request->size_filter;\n $sizeProductId = ProductSize::where('qty','!=',0)->whereIn('size_id',$size_filter)->pluck('product_id');\n \n $newArrivalProductDatas = Product::where('is_new_arrival','1')->where('status','1')->where('is_deleted','0')->whereIn('id',$sizeProductId)->get();\n foreach ($newArrivalProductDatas as $keyNewArrivalProductReview => $valueNewArrivalProductReview) {\n $newArrivalProductData[$keyNewArrivalProductReview] = $valueNewArrivalProductReview;\n //$newArrivalProductData[$keyNewArrivalProductReview]['review'] = $review = Review::where('product_id',$valueNewArrivalProductReview['id'])->get();\n }\n\n foreach ($newArrivalProductDatas as $keyProductImage => $valueProductImage) {\n $newArrivalProductData[$keyProductImage] = $valueProductImage;\n $newArrivalProductData[$keyProductImage]['product_image'] = $ProductImage = ProductImage::where('product_id',$valueProductImage['id'])->take('4')->get();\n }\n\n \n }\n\n //Colors filter\n \n if (isset($request->color_filter)){\n $newArrivalId = $request->color_filter;\n $newArrivalProductDatas = Product::where('is_new_arrival','1')->where('status','1')->where('is_deleted','0')->whereIn('color_id',$newArrivalId)->get();\n foreach ($newArrivalProductDatas as $keyNewArrivalProductReview => $valueNewArrivalProductReview) {\n $newArrivalProductData[$keyNewArrivalProductReview] = $valueNewArrivalProductReview;\n //$newArrivalProductData[$keyNewArrivalProductReview]['review'] = $review = Review::where('product_id',$valueNewArrivalProductReview['id'])->get();\n }\n\n foreach ($newArrivalProductDatas as $keyProductImage => $valueProductImage) {\n $newArrivalProductData[$keyProductImage] = $valueProductImage;\n $newArrivalProductData[$keyProductImage]['product_image'] = $ProductImage = ProductImage::where('product_id',$valueProductImage['id'])->take('4')->get();\n }\n\n } \n //dd ($request->min_price, $request->sorting_filter, $request->color_filter,$request->size_filter,$request->brand_filter,$request->department,$request->max_price,$request->clearall);\n\n if($request->clearall )\n if ($request->min_price == null && $request->sorting_filter == null && $request->color_filter == null && $request->size_filter == null && $request->brand_filter == null && $request->department == null && $request->max_price == null ) \n \n { \n $newArrivalProductDatas = Product::where('is_new_arrival','1')->where('status','1')->where('is_deleted','0')->get();\n foreach ($newArrivalProductDatas as $keyNewArrivalProductReview => $valueNewArrivalProductReview) {\n $newArrivalProductData[$keyNewArrivalProductReview] = $valueNewArrivalProductReview;\n //$newArrivalProductData[$keyNewArrivalProductReview]['review'] = $review = Review::where('product_id',$valueNewArrivalProductReview['id'])->get();\n }\n\n foreach ($newArrivalProductDatas as $keyProductImage => $valueProductImage) {\n $newArrivalProductData[$keyProductImage] = $valueProductImage;\n $newArrivalProductData[$keyProductImage]['product_image'] = $ProductImage = ProductImage::where('product_id',$valueProductImage['id'])->take('4')->get();\n }\n } \n return view('ajax.ajaxfilter_price',compact('newArrivalProductDatas'));\n }", "public function testFromOkResponse() : void {\n $bob = Record::fromName(\"bob\");\n $result = Result::fromResponse(Response::fromQueriedRecords(null, $bob));\n foreach ($result as $object) {\n $this->assertInstanceOf(SalesforceObject::class, $object);\n }\n\n $first = $result->first();\n $this->assertInstanceOf(SalesforceObject::class, $first);\n $this->assertEquals($bob[\"Id\"], $first->Id);\n $this->assertEquals($bob[\"Name\"], $first->Name);\n }", "private function data()\n {\n $result = json_decode($this->response->getBody());\n\n $mediatorResult = (isset($result->minimum_price)) ? $result->minimum_price : 'absent';\n\n if($mediatorResult == 'absent')\n {\n return $result;\n }\n\n $result->isFree = number_format($mediatorResult, 2) == 0.0;\n\n return $result;\n }", "function verusPrice( $currency ) {\n global $phpextconfig;\n $currency = strtoupper($currency);\n\n if ( $currency == 'VRSC' | $currency == 'VERUS' ) {\n $results = json_decode( curlRequest( $phpextconfig['fiat_api'] . 'rawpricedata.php', curl_init(), null ), true );\n return $results['data']['avg_btc'];\n }\n else {\n return curlRequest( $phpextconfig['fiat_api'] . '?currency=' . $currency, curl_init(), null );\n } \n}", "public function test_getLowStockByFilter() {\n\n }", "private function formedCatalogParamatterSortQuery($parametter_array = array()) {\n // $this->db->order_by('site_catalog.in_stock', 'DESC');\n // $this->db->order_by('site_catalog.position', 'aSC');\n\n if (!is_array($parametter_array) || empty($parametter_array)) return false;\n\n if (isset($parametter_array['sort'][0])) {\n\n switch($parametter_array['sort'][0]) {\n\n case 'cheap': {\n\n $this->db\n ->order_by('site_catalog.in_stock', 'DESC')\n ->order_by('site_catalog.delivery_3_5', 'ASC')\n ->order_by('price', 'ASC')\n ;\n\n } break;\n\n case 'news': {\n\n $this->db\n ->order_by('site_catalog.in_stock', 'DESC')\n ->order_by('site_catalog.delivery_3_5', 'ASC')\n ->order_by('site_catalog.shareid', 'DESC')\n ;\n\n } break;\n\n case 'discounts': {\n\n $this->db\n \n ->order_by('site_catalog.in_stock', 'DESC')\n ->order_by('site_catalog.delivery_3_5', 'ASC')\n ->order_by('site_catalog.old_price', 'ASC')\n\n ;\n\n } break;\n\n case 'popular': {\n\n $this->db\n ->order_by('site_catalog.in_stock', 'DESC')\n ->order_by('site_catalog.delivery_3_5', 'ASC')\n ->order_by('site_catalog.countwatch', 'DESC')\n ;\n\n } break;\n\n case 'expansiv': {\n\n $this->db\n ->order_by('site_catalog.in_stock', 'DESC')\n ->order_by('site_catalog.delivery_3_5', 'ASC')\n ->order_by('price', 'DESC')\n // ->order_by('site_catalog.countwatch', 'DESC')\n ;\n\n } break;\n\n default: {\n\n $this->db\n ->order_by('site_catalog.product-visible', 'DESC')\n ->order_by('site_catalog.in_stock', 'DESC')\n ->order_by('site_catalog.delivery_3_5', 'ASC')\n ->order_by('site_catalog.position', 'ASC')\n ;\n\n } break;\n\n }\n\n }\n\n }", "public function testSortOrderByTotal()\n {\n $this->browse(function (Browser $browser) {\n $browser->loginAs($this->user)\n ->visit('/admin/orders')\n ->click('#sort-by-total');\n\n $ordersSortAsc = Order::orderBy('total', 'ASC')->pluck('total')->toArray();\n\n for ($i = 1; $i <= 5; $i++) {\n $selector = \".table tbody tr:nth-child($i) td:nth-child(4)\";\n $this->assertEquals($browser->text($selector), number_format($ordersSortAsc[$i-1]));\n }\n\n $browser->click('#sort-by-total');\n $ordersSortDesc = Order::orderBy('total', 'DESC')->pluck('total')->toArray();\n\n for ($i = 1; $i <= 5; $i++) {\n $selector = \".table tbody tr:nth-child($i) td:nth-child(4)\";\n $this->assertEquals($browser->text($selector), number_format($ordersSortDesc[$i-1]));\n }\n });\n }", "public function test_library_bookOrder() {\n\t\t$bible = \"AAIWBTN2ET\";\n\t\t$path = route('v2_library_bookOrder',[],false);\n\t\t$this->params['dam_id'] = $bible;\n\n\t\techo \"\\nTesting: \" . route('v2_library_bookOrder', $this->params);\n\t\t$response = $this->get(route('v2_library_bookOrder'), $this->params);\n\t\t$response->assertSuccessful();\n\t\t$response->assertJsonStructure([$this->getSchemaKeys('v2_library_bookOrder')]);\n\t\t$this->compareToOriginal($path,[$this->getSchemaKeys('v2_library_bookOrder')]);\n\t}", "function getAllItem_filter($ordertype,$what,$where,$category)\n\t{\n\t\tif($category=='all'){\n\t\t\tswitch ($ordertype) {\n\t\t\t\tcase '2':\n\t\t\t\t$query=\"SELECT * FROM list_items WHERE user_addr LIKE '%$where%' AND item_name LIKE '%$what%' ORDER BY item_name DESC\";\n\t\t\t\t\n\t\t\t\tbreak;\n\t\t\t\t\n\t\t\t\tcase '3':\n\t\t\t\t$query=\"SELECT * FROM list_items WHERE user_addr LIKE '%$where%' AND item_name LIKE '%$what%' ORDER BY user_addr ASC\";\n\t\t\t\t\n\t\t\t\tbreak;\n\n\t\t\t\tcase '4':\n\t\t\t\t$query=\"SELECT * FROM list_items WHERE user_addr LIKE '%$where%' AND item_name LIKE '%$what%' ORDER BY user_addr DESC\";\n\t\t\t\t\n\t\t\t\tbreak;\n\n\t\t\t\tcase '5':\n\t\t\t\t$query=\"SELECT * FROM list_items WHERE user_addr LIKE '%$where%' AND item_name LIKE '%$what%' ORDER BY daily_rate ASC\";\n\t\t\t\t\n\t\t\t\tbreak;\n\n\t\t\t\tcase '6':\n\t\t\t\t$query=\"SELECT * FROM list_items WHERE user_addr LIKE '%$where%' AND item_name LIKE '%$what%' ORDER BY daily_rate DESC\";\n\t\t\t\t\n\t\t\t\tbreak;\n\n\t\t\t\tcase '7':\n\t\t\t\t$query=\"SELECT * FROM list_items WHERE user_addr LIKE '%$where%' AND item_name LIKE '%$what%' ORDER BY weekly_rate ASC\";\n\t\t\t\t\n\t\t\t\tbreak;\n\n\t\t\t\tcase '8':\n\t\t\t\t$query=\"SELECT * FROM list_items WHERE user_addr LIKE '%$where%' AND item_name LIKE '%$what%' ORDER BY weekly_rate DESC\";\n\t\t\t\t\n\t\t\t\tbreak;\n\n\t\t\t\tcase '9':\n\t\t\t\t$query=\"SELECT * FROM list_items WHERE user_addr LIKE '%$where%' AND item_name LIKE '%$what%' ORDER BY monthly_rate ASC\";\n\t\t\t\t\n\t\t\t\tbreak;\n\n\t\t\t\tcase '10':\n\t\t\t\t$query=\"SELECT * FROM list_items WHERE user_addr LIKE '%$where%' AND item_name LIKE '%$what%' ORDER BY monthly_rate DESC\";\n\t\t\t\t\n\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t$query=\"SELECT * FROM list_items WHERE user_addr LIKE '%$where%' AND item_name LIKE '%$what%' ORDER BY item_name\"; \n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\telse{\n\t\t\tswitch ($ordertype) {\n\t\t\t\tcase '2':\n\t\t\t\t$query=\"SELECT * FROM list_items WHERE user_addr LIKE '%$where%' AND cat_name LIKE '%$category%' AND item_name LIKE '%$what%' ORDER BY item_name DESC\";\n\t\t\t\t\n\t\t\t\tbreak;\n\t\t\t\t\n\t\t\t\tcase '3':\n\t\t\t\t$query=\"SELECT * FROM list_items WHERE user_addr LIKE '%$where%' AND cat_name LIKE '%$category%' AND item_name LIKE '%$what%' ORDER BY user_addr ASC\";\n\t\t\t\t\n\t\t\t\tbreak;\n\n\t\t\t\tcase '4':\n\t\t\t\t$query=\"SELECT * FROM list_items WHERE user_addr LIKE '%$where%' AND cat_name LIKE '%$category%' AND item_name LIKE '%$what%' ORDER BY user_addr DESC\";\n\t\t\t\t\n\t\t\t\tbreak;\n\n\t\t\t\tcase '5':\n\t\t\t\t$query=\"SELECT * FROM list_items WHERE user_addr LIKE '%$where%' AND cat_name LIKE '%$category%' AND item_name LIKE '%$what%' ORDER BY daily_rate ASC\";\n\t\t\t\t\n\t\t\t\tbreak;\n\n\t\t\t\tcase '6':\n\t\t\t\t$query=\"SELECT * FROM list_items WHERE user_addr LIKE '%$where%' AND cat_name LIKE '%$category%' AND item_name LIKE '%$what%' ORDER BY daily_rate DESC\";\n\t\t\t\t\n\t\t\t\tbreak;\n\n\t\t\t\tcase '7':\n\t\t\t\t$query=\"SELECT * FROM list_items WHERE user_addr LIKE '%$where%' AND cat_name LIKE '%$category%' AND item_name LIKE '%$what%' ORDER BY weekly_rate ASC\";\n\t\t\t\t\n\t\t\t\tbreak;\n\n\t\t\t\tcase '8':\n\t\t\t\t$query=\"SELECT * FROM list_items WHERE user_addr LIKE '%$where%' AND cat_name LIKE '%$category%' AND item_name LIKE '%$what%' ORDER BY weekly_rate DESC\";\n\t\t\t\t\n\t\t\t\tbreak;\n\n\t\t\t\tcase '9':\n\t\t\t\t$query=\"SELECT * FROM list_items WHERE user_addr LIKE '%$where%' AND cat_name LIKE '%$category%' AND item_name LIKE '%$what%' ORDER BY monthly_rate ASC\";\n\t\t\t\t\n\t\t\t\tbreak;\n\n\t\t\t\tcase '10':\n\t\t\t\t$query=\"SELECT * FROM list_items WHERE user_addr LIKE '%$where%' AND cat_name LIKE '%$category%' AND item_name LIKE '%$what%' ORDER BY monthly_rate DESC\";\n\t\t\t\t\n\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t$query=\"SELECT * FROM list_items WHERE user_addr LIKE '%$where%' AND cat_name LIKE '%$category%' AND item_name LIKE '%$what%' ORDER BY item_name\"; \n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t$result = $this->db->query($query);\n\t\t$item=\"\";\n\t\t\n\t\tforeach ($result->result_array() as $row) {\n\t\t\t$daily_price=$row['daily_rate'];\n\t\t\t$weekly_price=$row['weekly_rate'];\n\t\t\t$weekend_price=$row['weekend_rate'];\n\t\t\t$monthly_price=$row['monthly_rate'];\n\t\t\t$bond_price=$row['bond_rate'];\n\t\t\t\n\t\t\tif($daily_price==0){$daily_price=\"NA\";}\n\t\t\tif($weekly_price==0){$weekly_price=\"NA\";}\n\t\t\tif($weekend_price==0){$weekend_price=\"NA\";}\n\t\t\tif($monthly_price==0){$monthly_price=\"NA\";}\n\t\t\tif($bond_price==0){$bond_price=\"NA\";}\n\n\t\t\t$extra=array(\n\t\t\t\t'item_id'\t=>\t$row['item_id'],\n\t\t\t\t'item_pictures'\t=>\t$row['item_pictures'],\n\t\t\t\t'item_name'\t=>\t$row['item_name'],\n\t\t\t\t'cat_name'\t=>\t$row['cat_name'],\n\t\t\t\t'user_addr'\t=>\t$row['user_addr'],\n\t\t\t\t'isLive'\t=>\t$row['isLive'],\n\t\t\t\t'user_name'\t=>\t$row['user_name'],\n\t\t\t\t'daily_rate'\t=>\t$row['daily_rate'],\n\t\t\t\t'weekly_rate'\t=>\t$row['weekly_rate'],\n\t\t\t\t'weekend_rate'\t=>\t$row['weekend_rate'],\n\t\t\t\t'monthly_rate'\t=>\t$row['monthly_rate'],\n\t\t\t\t'bond_rate'\t=>\t$row['bond_rate']\t\t\t\t\n\t\t\t);\n\t\t\t$item[]=$extra;\n\t\t}\n\n\t\treturn json_encode($item);\n\t}", "public function dataForTestSort()\n {\n return [\n ['id', 'posts.id'],\n ['body', 'posts.body'],\n ];\n }", "protected function setUp(): void\n {\n parent::setUp();\n\n $this->response = new Response(200, [], '{\"AAPL\": [{\"price\": 227.3,\"size\": 72,\"tradeId\": 869507736,\"isISO\": false,\"isOddLot\": true,\"isOutsideRegularHours\": false,\"isSinglePriceCross\": false,\"isTradeThroughExempt\": false,\"timestamp\": 1591657188819},{\"price\": 229.23,\"size\": 30,\"tradeId\": 844915880,\"isISO\": false,\"isOddLot\": true,\"isOutsideRegularHours\": false,\"isSinglePriceCross\": false,\"isTradeThroughExempt\": false,\"timestamp\": 1619690090714},{\"price\": 229.478,\"size\": 52,\"tradeId\": 850469976,\"isISO\": false,\"isOddLot\": true,\"isOutsideRegularHours\": false,\"isSinglePriceCross\": false,\"isTradeThroughExempt\": false,\"timestamp\": 1628633187464},{\"price\": 224.328,\"size\": 21,\"tradeId\": 859904609,\"isISO\": false,\"isOddLot\": true,\"isOutsideRegularHours\": false,\"isSinglePriceCross\": false,\"isTradeThroughExempt\": false,\"timestamp\": 1619035871226},{\"price\": 230.48,\"size\": 117,\"tradeId\": 827610906, \"isISO\": false,\"isOddLot\": false,\"isOutsideRegularHours\": false,\"isSinglePriceCross\": false,\"isTradeThroughExempt\": false,\"timestamp\": 1579640030232}]}');\n\n $this->client = $this->setupMockedClient($this->response);\n }", "public function testGetList_SortingLimit()\n\t{\n\t\t$this->object->Save();\n\t\t$newObject1 = new object(\"efg\");\n\t\t$newObject2 = new object(\"abc\");\n\t\t$newObject3 = new object(\"d\");\n\n\t\t$newObject1->Save();\n\t\t$newObject2->Save();\n\t\t$newObject3->Save();\n\n\t\t$objectList = $newObject1->GetList(array(array(\"objectId\", \">\", 0)), \"attribute\", true, 2);\n\n\t\t$this->assertEquals(2, sizeof($objectList));\n\t\t$this->assertEquals(\"abc\", $objectList[0]->attribute);\n\n\t\t$objectList = $newObject1->GetList(array(array(\"objectId\", \">\", 0)), \"attribute\", false, 2);\n\n\t\t$this->assertEquals(2, sizeof($objectList));\n\t\t$this->assertEquals(\"obj att\", $objectList[0]->attribute);\n\t\t$this->assertEquals(\"efg\", $objectList[1]->attribute);\n\t}", "public function testOrderCriteriaOrderType()\n {\n\n $orderCriteria = $this->criteriaCreator->getOrderCriteria($this->getMockedRequestQueryData());\n\n // order is desc then the orderType should be true\n $this->assertTrue($orderCriteria->getOrderType());\n\n }", "public function testCallTest()\n {\n $expected = '{\"widget\":\"test\",\"price\":\"111.11\",\"date\":\"2016-12-28 11:11:11\"}';\n // make the call\n $response = $this->api->findByName('test');\n $this->assertEquals($expected, $response);\n }", "function awesomeSort($a, $b)\n{\n return $a['amount'] <=> $b['amount'];\n}", "public function getPriceInformation() {\n $fields = array('priceInformation' => array(\n 'priceHeader' => 'header',\n 'price',\n 'acquisitionTerms',\n ));\n $result = TingOpenformatMethods::parseFields($this->_getDetails(), $fields);\n return $result;\n }" ]
[ "0.6775954", "0.590531", "0.585309", "0.5791465", "0.56464386", "0.56445473", "0.56119233", "0.5596878", "0.5569873", "0.5545255", "0.55211115", "0.5482619", "0.54670006", "0.5464328", "0.54582024", "0.54364574", "0.54232496", "0.54016703", "0.5363386", "0.53609765", "0.5342642", "0.5318067", "0.5306027", "0.5290696", "0.52666193", "0.5261389", "0.52571", "0.522111", "0.5202919", "0.51845336", "0.5180516", "0.51766366", "0.5172723", "0.5172705", "0.5152569", "0.51450694", "0.51007575", "0.5093753", "0.50908613", "0.50872976", "0.5074197", "0.50738156", "0.50688267", "0.50660044", "0.5065659", "0.5064479", "0.50644195", "0.5062802", "0.5059224", "0.50564885", "0.50557667", "0.505146", "0.5039028", "0.5032027", "0.5028884", "0.5010157", "0.5007325", "0.49930117", "0.49853957", "0.49768224", "0.49754193", "0.4974925", "0.49730742", "0.49636713", "0.49625242", "0.495917", "0.495917", "0.49579424", "0.49567342", "0.49518368", "0.49457356", "0.49448884", "0.4937889", "0.49333692", "0.4928128", "0.49274728", "0.49232438", "0.4920844", "0.49202517", "0.4911728", "0.49090925", "0.49081773", "0.4906077", "0.4905143", "0.49037483", "0.49009806", "0.48979563", "0.4896736", "0.48936987", "0.48933977", "0.48904243", "0.48898742", "0.48868933", "0.48858374", "0.48830214", "0.48696512", "0.48676795", "0.4862121", "0.48591673", "0.48564366" ]
0.7147369
0
Show a list of all available Threads
public function index() { $threads_1 = DB::table('threads') ->join('users','users.id', '=', 'threads.user_id') ->select('threads.*', 'users.name') ->where('threads.category', '=', '1') ->orderBy('updated_at', 'desc') ->get(); $threads_2 = DB::table('threads') ->join('users','users.id', '=', 'threads.user_id') ->select('threads.*', 'users.name') ->where('category', '=', '2') ->orderBy('updated_at', 'desc') ->get(); $threads_3 = DB::table('threads') ->join('users','users.id', '=', 'threads.user_id') ->select('threads.*', 'users.name') ->where('category', '=', '3') ->orderBy('updated_at', 'desc') ->get(); $threads_4 = DB::table('threads') ->join('users','users.id', '=', 'threads.user_id') ->select('threads.*', 'users.name') ->where('category', '=', '4') ->orderBy('updated_at', 'desc') ->get(); return view('thread', ['threads_1' => $threads_1, 'threads_2' => $threads_2, 'threads_3' => $threads_3, 'threads_4' => $threads_4]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function get_threads() {\n\n\t\t//return $query->result();\n\t}", "public function threads()\n\t{\n\n\t\t// get sort type\n\n\n\t\t$query = Thread::where('parent_id', null)->with('user')->with('topic')->limit(20);\n\n\t\t$sort = get_string('sort', 'newest');\n\n\t\t$topic = get_int('topic', false);\n\n\t\tif($topic)\n\t\t\t$query->where('topic_id', $topic);\n\n\t\tThread::setOrder($query, $sort);\n\n\t\t$threads = $query->get();\n\n\t\t$topics = Topic::all();\n\n\t\treturn view('threads.index', compact('threads', 'sort', 'topics'));\n\t\n\t}", "public function index()\n {\n\n // All threads, ignore deleted/archived participants\n $threads = Thread::getAllLatest()->get();\n\n\n return response()->json($threads);\n }", "public function index()\n {\n $threads = DB::table('thread')->get();\n\n return view ('threads.index') -> with ('threads', $threads );\n }", "public function actionIndex()\n {\n $searchModel = new ThreadSearch();\n $dataProvider = $searchModel->search(Yii::$app->request->queryParams);\n\n return $this->render('index', [\n 'searchModel' => $searchModel,\n 'dataProvider' => $dataProvider,\n ]);\n }", "public function getThreads()\n {\n $user = request()->user();\n\n $messages = $user->threadsWithMessagesWithUsers($user->id)->get();\n\n /**\n * Returns unread messages given the userId.\n */\n //$messages = Message::unreadForUser($user->id)->get();\n\n return ThreadsResource::collection($messages);\n //return response()->json($messages);\n }", "function threads_get()\n\t{\n\t\t$this->check_board();\n\n\t\tif ($this->get('page'))\n\t\t{\n\t\t\tif (!is_natural($this->get('page')))\n\t\t\t{\n\t\t\t\t$this->response(array('error' => __(\"Invalid value for 'page'.\")), 404);\n\t\t\t}\n\t\t\telse if ($this->get('page') > 500)\n\t\t\t{\n\t\t\t\t$this->response(array('error' => __('Unable to return more than 500 pages.')), 404);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$page = intval($this->get('page'));\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$page = 1;\n\t\t}\n\n\n\t\tif ($this->get('per_page'))\n\t\t{\n\t\t\tif (!is_natural($this->get('per_page')))\n\t\t\t{\n\t\t\t\t$this->response(array('error' => __(\"Invalid value for 'per_page'.\")), 404);\n\t\t\t}\n\t\t\telse if ($this->get('per_page') > 50)\n\t\t\t{\n\t\t\t\t$this->response(array('error' => __('Unable to return more than 50 threads per page.')),\n\t\t\t\t\t404);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$per_page = intval($this->get('per_page'));\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$per_page = 25;\n\t\t}\n\n\n\n\t\t$posts = $this->post->get_latest(get_selected_radix(), $page, array('per_page' => $per_page));\n\t\tif (count($posts) > 0)\n\t\t{\n\t\t\t$this->response($posts, 200); // 200 being the HTTP response code\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->response(array('error' => __('Unable to locate any threads.')), 404);\n\t\t}\n\t}", "public function get_topics()\n {\n return $this->connection->query_select_value('threads', 'COUNT(*)');\n }", "private function fetchThreads() {\n\t\t\t$query = '';\n\t\t\t$boards = listBoards(true);\n\n\t\t\tforeach ($boards as $b) {\n\t\t\t\tif (in_array($b, $this->settings['exclude']))\n\t\t\t\t\tcontinue;\n\t\t\t\t// Threads are those posts that have no parent thread\n\t\t\t\t$query .= \"SELECT *, '$b' AS `board` FROM ``posts_$b`` \" .\n\t\t\t\t\t\"WHERE `thread` IS NULL UNION ALL \";\n\t\t\t}\n\n\t\t\t$query = preg_replace('/UNION ALL $/', 'ORDER BY `bump` DESC', $query);\n\t\t\t$result = query($query) or error(db_error());\n\n\t\t\treturn $result->fetchAll(PDO::FETCH_ASSOC);\n\t\t}", "public function getAvailableTasks();", "public function index()\n {\n $threads = Thread::with('user')->paginate(5);\n return view(\"threads.index\",compact('threads'));\n }", "function get_thread_list($forum_id, $limit = 25, $start = 0) {\n return $this->call('get_thread_list', array('forum_id' => $forum_id, 'limit' => $limit, 'start' => 0));\n }", "public function threads()\n\t{\n\t\treturn $this->hasMany(Thread::class)->latest();\n\t}", "public static function getMarkedThreads() {\n\t\t$sessionVars = WCF::getSession()->getVars();\n\t\tif (isset($sessionVars['markedThreads'])) {\n\t\t\treturn $sessionVars['markedThreads'];\n\t\t}\n\t\treturn null;\n\t}", "public function getTopThreads()\n {\n $db = DB::conn();\n $threads = array();\n \n $rows = $db->rows('SELECT t.id, t.user_id, t.title, u.username, t.created, t.last_modified, u.usertype, \n COUNT(c.id) AS thread_count FROM comment c \n INNER JOIN thread t ON c.thread_id=t.id \n INNER JOIN user u ON t.user_id=u.id \n GROUP BY t.id ORDER BY COUNT(c.id) DESC, t.last_modified DESC');\n\n foreach ($rows as $row) {\n $threads[] = new Thread($row);\n }\n\n return $threads;\n }", "public function indexAction()\n {\n $em = $this->getDoctrine()->getManager();\n\n $entities = $em->getRepository('APiszczekDemoBundle:Thread')->findAll();\n\n return $this->render('APiszczekDemoBundle:Thread:index.html.twig', array(\n 'entities' => $entities,\n ));\n }", "public function hasThreads() {\n\t\treturn false;\n\t}", "public function getAllTopThreads() {\r\n\t\t$filteredList = array();\r\n\t\tforeach ($this->threads as $thread) {\r\n\t\t\tif ($thread -> getTopTopic() == -1) {\r\n\t\t\t\tarray_push($filteredList, $thread);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn $filteredList;\r\n\t}", "public function getWorkers()\n {\n }", "function ghost_threads_get()\n\t{\n\t\t$this->check_board();\n\n\t\tif ($this->get('page'))\n\t\t{\n\t\t\tif (!is_natural($this->get('page')))\n\t\t\t{\n\t\t\t\t$this->response(array('error' => __(\"Invalid value for 'page'.\")), 404);\n\t\t\t}\n\t\t\telse if ($this->get('page') > 500)\n\t\t\t{\n\t\t\t\t$this->response(array('error' => __('Unable to return more than 500 pages.')), 404);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$page = intval($this->get('page'));\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$page = 1;\n\t\t}\n\n\n\t\tif ($this->get('per_page'))\n\t\t{\n\t\t\tif (!is_natural($this->get('per_page')))\n\t\t\t{\n\t\t\t\t$this->response(array('error' => __(\"Invalid value for 'per_page'.\")), 404);\n\t\t\t}\n\t\t\telse if ($this->get('per_page') > 50)\n\t\t\t{\n\t\t\t\t$this->response(array('error' => __('Unable to return more than 50 threads per page.')),\n\t\t\t\t\t404);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$per_page = intval($this->get('per_page'));\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$per_page = 25;\n\t\t}\n\n\t\t$page = intval($page);\n\n\t\t$posts = $this->post->get_latest_ghost(get_selected_radix(), $page, array('per_page' => $per_page));\n\n\t\tif (count($posts) > 0)\n\t\t{\n\t\t\t$this->response($posts, 200); // 200 being the HTTP response code\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// no comics\n\t\t\t$this->response(array('error' => __('Unable to locate any threads.')), 404);\n\t\t}\n\t}", "function xthreads_info() {\r\n\tglobal $lang, $mybb, $plugins;\r\n\t$lang->load('xthreads');\r\n\t\r\n\t$info = array(\r\n\t\t'name' => '<span style=\"color: #008000;\">'.$lang->xthreads_name.'</span>',\r\n\t\t'description' => $lang->xthreads_desc,\r\n\t\t'website' => 'http://mybbhacks.zingaburga.com/showthread.php?tid=288',\r\n\t\t'author' => 'ZiNgA BuRgA',\r\n\t\t'authorsite' => 'http://mybbhacks.zingaburga.com/',\r\n\t\t'version' => xthreads_format_version_number(XTHREADS_VERSION),\r\n\t\t'compatibility' => '14*,15*,16*,17*,18*',\r\n\t\t'guid' => ''\r\n\t);\r\n\tif(is_object($plugins)) {\r\n\t\t$info = $plugins->run_hooks('xthreads_info_needs_moar_pimpin', $info);\r\n\t}\r\n\tif(!empty($mybb->input['action']) || !isset($GLOBALS['table']) || !is_object($GLOBALS['table'])) // not main plugins page\r\n\t\treturn $info;\r\n\tif($mybb->version_code >= 1700) return $info;\r\n\t\r\n\tstatic $done = false;\r\n\tif(!$done) {\r\n\t\t$done = true;\r\n\t\t// let's have some fun here\r\n\t\tcontrol_object($GLOBALS['table'], '\r\n\t\t\tfunction construct_row($extra = array()) {\r\n\t\t\t\tstatic $done=false;\r\n\t\t\t\tif(!$done) {\r\n\t\t\t\t\txthreads_info_no_more_fun();\r\n\t\t\t\t\t$done = true;\r\n\t\t\t\t}\r\n\t\t\t\treturn parent::construct_row($extra);\r\n\t\t\t}\r\n\t\t');\r\n\t\t$lang->__activate = $lang->activate;\r\n\t\t$lang->__deactivate = $lang->deactivate;\r\n\t\t$lang->__install_and_activate = $lang->install_and_activate;\r\n\t\t$lang->__uninstall = $lang->uninstall;\r\n\t\t\r\n\t\t$imgcode = '<![if gte IE 8]><img src=\"data:image/png;base64,{data}\" alt=\"\" style=\"vertical-align: middle;\" /><![endif]> ';\r\n\t\t$lang->install_and_activate = str_replace('{data}', xthreads_install_img_install(), $imgcode).'<span style=\"color: #008000;\">'.$lang->xthreads_install_and_activate.'</span>';\r\n\t\t$lang->activate = str_replace('{data}', xthreads_install_img_activate(), $imgcode).'<span style=\"color: #FF8000;\">'.$lang->activate.'</span>';\r\n\t\t$lang->deactivate = str_replace('{data}', xthreads_install_img_deactivate(), $imgcode).'<span style=\"color: #20A0A0;\">'.$lang->deactivate.'</span>';\r\n\t\t$lang->uninstall = str_replace('{data}', xthreads_install_img_uninstall(), $imgcode).'<span style=\"color: #FF0000;\">'.$lang->uninstall.'</span>';\r\n\t}\r\n\treturn array(\r\n\t\t'name' => '</strong><small style=\"font-family: Tempus Sans ITC, Lucida Calligraphy, Harrington, Comic Sans MS, Some other less-readable goofy font, Serif\"><a href=\"'.$info['website'].'\">'.$info['name'].'</a> v'.$info['version'].', '.$lang->xthreads_fun_desc.'<!-- ',\r\n\t\t'author' => '--><i><small>',\r\n\t\t'compatibility' => $info['compatibility'],\r\n\t\t'guid' => $info['guid']\r\n\t);\r\n}", "public function list()\n\t\t{\n\t return Task::all();\n\t\t}", "public function index(Request $request)\n {\n $threads = Thread::threadInfo()\n ->inChannel($request->channels)\n ->isPublic()//复杂的筛选\n ->with('author', 'tags', 'last_component', 'last_post')\n ->withType($request->withType)\n ->withBianyuan($request->withBianyuan)\n ->withTag($request->tags)\n ->excludeTag($request->excludeTags)\n ->ordered($request->ordered)\n ->paginate(config('constants.threads_per_page'));\n return response()->success([\n 'threads' => ThreadInfoResource::collection($threads),\n 'paginate' => new PaginateResource($threads),\n ]);\n //return view('test',compact('threads'));\n }", "public function index()\n {\n $threads = Thread::all();\n $threads->load('posts', 'author');\n\n return view('threads.index', compact('threads'));\n }", "public function threads()\n {\n return $this->morphedByMany('App\\Thread', 'taggable');\n }", "public function index()\n {\n\n $threads = Thread::forUser(Auth::id())->with([\n 'users' => function ($query) {\n $query->select('avatar', 'name', 'agent_name');\n },\n 'messages' => function ($query) {\n $query->latest()->first();\n },\n ])\n ->groupBy('threads.id')\n ->latest('updated_at')\n ->paginate();\n\n $threads->getCollection()->transform(function ($value) {\n $value->isUnread = $value->isUnread(Auth::id());\n\n return $value;\n });\n\n\n return response()->json($threads);\n }", "public function threads()\n {\n return $this->hasMany(Thread::class);\n }", "function get_forum_list() {\n return $this->call('get_forum_list');\n }", "public function index(Request $request)\n {\n $request_data = $this->sanitize_thread_request_data($request);\n\n if($request_data&&!auth('api')->check()){abort(401);}\n\n $query_id = $this->process_thread_query_id($request_data);\n\n $threads = $this->find_threads_with_query($query_id, $request_data);\n\n return response()->success([\n 'threads' => ThreadInfoResource::collection($threads),\n 'paginate' => new PaginateResource($threads),\n 'request_data' => $request_data,\n ]);\n }", "function graph_jmx_threads_report ( &$rrdtool_graph ) {\n\n global $context,\n $hostname,\n $graph_var,\n $range,\n $rrd_dir,\n $size,\n $strip_domainname;\n\n if ($strip_domainname) {\n $hostname = strip_domainname($hostname);\n }\n\n $jmx = $graph_var;\n $title = $jmx.' JMX Threads';\n if ($context != 'host') {\n $rrdtool_graph['title'] = $title;\n } else {\n $rrdtool_graph['title'] = \"$hostname $title last $range\";\n }\n $rrdtool_graph['lower-limit'] = '0';\n $rrdtool_graph['vertical-label'] = 'threads';\n $rrdtool_graph['height'] += ($size == 'medium') ? 28 : 0;\n\n\t$series = \"DEF:'live'='${rrd_dir}/jmx_${jmx}_thread_count.rrd':'sum':AVERAGE \"\n\t\t.\"DEF:'daemon'='${rrd_dir}/jmx_${jmx}_daemon_threads.rrd':'sum':AVERAGE \"\n\t\t.\"LINE1:'live'#F19A2A:'Live' \"\n\t\t.\"LINE1:'daemon'#20ABD9:'Daemon' \"\n\t;\n\n $rrdtool_graph['series'] = $series;\n\n return $rrdtool_graph;\n\n}", "public function threads()\n {\n return $this->hasMany(thread::class);\n }", "public static function checkForOldThreads()\r\n {\r\n /* @var $threadModel XenForo_Model_Thread */\r\n $threadModel = XenForo_Model::create('XenForo_Model_Thread');\r\n \r\n $lastPostDate = array(\r\n '>=<', \r\n XenForo_Application::$time - (XenForo_Application::get('options')->th_notifyOldThreads_oldThreadMaxDays * 86400),\r\n XenForo_Application::$time - (XenForo_Application::get('options')->th_notifyOldThreads_oldThreadMinDays * 86400),\r\n );\r\n \r\n $conditions = array(\r\n 'last_post_date' => $lastPostDate,\r\n \t'reply_count_th' => 0,\r\n 'discussion_state' => 'visible',\r\n 'discussion_open' => 1,\r\n );\r\n \r\n $excludedNodeIds = XenForo_Application::getOptions()->th_notifyOldThreads_forumIds;\r\n if (!empty($excludedNodeIds)) {\r\n $allowedNodeIds = array_keys(XenForo_Model::create('XenForo_Model_Node')->getAllNodes());\r\n $allowedNodeIds = array_diff($allowedNodeIds, $excludedNodeIds);\r\n $conditions['node_id'] = $allowedNodeIds;\r\n }\r\n \r\n $threadIds = $threadModel->getThreadIds($conditions);\r\n \r\n if (!empty($threadIds)) {\r\n $dw = XenForo_DataWriter::create('XenForo_DataWriter_Option');\r\n $dw->setExistingData('th_notifyOldThreads_threadIds');\r\n $dw->set('option_value', $threadIds);\r\n $dw->save();\r\n }\r\n }", "public function workers()\n {\n $workerManager = $this->container->get('dtc_queue.manager.worker');\n $workers = $workerManager->getWorkers();\n\n $workerList = [];\n foreach ($workers as $workerName => $worker) {\n /* @var Worker $worker */\n $workerList[$workerName] = get_class($worker);\n }\n $params = ['workers' => $workerList];\n $this->addCssJs($params);\n\n return $this->render('@DtcQueue/Queue/workers.html.twig', $params);\n }", "public function index()\n {\n if (!is_logged_in()) {\n redirect(url('user/index'));\n }\n\n $thread_count = Thread::getNumRows();\n $pagination = pagination($thread_count);\n $threads = Thread::getAll($pagination['max']);\n $this->set(get_defined_vars());\n }", "public function get_threading() {\n\n return $this->threading;\n }", "public function index()\n {\n $threads = Thread::with('user', 'votes')->withCount('replies')->latest()->paginate(10);\n // return $threads;\n return view('pertanyaan.index', compact('threads'));\n }", "public function index()\n {\n $threads = Thread::orderBy('created_at', 'desc')->paginate(5);\n $data = [\n 'threads' => $threads\n ];\n return view('ask-index')->with('data', $data);\n }", "public function getThreadId();", "public function getThreadId();", "public function threads()\n {\n return $this->hasMany('App\\Thread');\n }", "public function threads()\n {\n return $this->hasMany('App\\Thread');\n }", "function pdo_list_processes($link=NULL) {\r\n return pdo_query(\"SHOW FULL PROCESSLIST\", pdo_handle($link));\r\n }", "function drush_acapi_ac_task_list() {\n $api_args = acapi_get_site_args();\n $format = acapi_get_option('format');\n $state = drush_get_option('state', NULL);\n $days = drush_get_option('days', NULL);\n $limit = drush_get_option('limit', NULL);\n $params = array();\n if (isset($state)) {\n $params['state'] = $state;\n }\n if (isset($days)) {\n $params['days'] = $days;\n }\n if (isset($limit)) {\n $params['limit'] = $limit;\n }\n\n list($status, $result) = acapi_call(\n 'GET',\n '/sites/:realm::site/tasks',\n $api_args,\n $params,\n array(),\n array('display' => !empty($format))\n );\n\n $simulate = drush_get_option('simulate', FALSE);\n if ($simulate) {\n return;\n }\n\n if (empty($format)) {\n $display = array();\n foreach ($result as $id => $task) {\n $display[$task->id] = $task->description;\n }\n drush_print_table(drush_key_value_to_array_table($display));\n }\n}", "public function declineAllPendingThreads()\n {\n return $this->ig->request('direct_v2/threads/decline_all/')\n ->addPost('_csrftoken', $this->ig->client->getToken())\n ->addPost('_uuid', $this->ig->uuid)\n ->setSignedPost(false)\n ->getResponse(new Response\\GenericResponse());\n }", "public function index()\n\t{\n\t\t$workers = Worker::all();\n\t}", "public function index()\n\t{\n\n\t\t$id = get_int('id', false);\n\n\t\tif($id)\n\t\t\treturn $this->posts($id);\n\n\t\treturn $this->threads();\n\t\n\t}", "public function getNewestThreads() {\n $topic_1 = 4; // Đánh giá phần mềm\n $topic_2 = 8; // Games Online\n $topic_3 = 10; // Thể Thao\n $limit = 5;\n\n $data = [];\n $data[$topic_1]['name'] = 'Đánh giá phần mềm';\n $data[$topic_2]['name'] = 'Games Online';\n $data[$topic_3]['name'] = 'Thể Thao';\n\n $threadModel = new thread_model();\n $result = $threadModel->excute(\"\n SELECT * FROM threads WHERE topic_id = {$topic_1}\n ORDER BY id DESC LIMIT {$limit} OFFSET 0\n \");\n while ($row = $result->fetch_assoc()) {\n $data[$topic_1]['threads'][] = ['id' => $row['id'], 'title' => $row['title']];\n }\n\n $result = $threadModel->excute(\"\n SELECT * FROM threads WHERE topic_id = {$topic_2}\n ORDER BY id DESC LIMIT {$limit} OFFSET 0\n \");\n while ($row = $result->fetch_assoc()) {\n $data[$topic_2]['threads'][] = ['id' => $row['id'], 'title' => $row['title']];\n }\n\n $result = $threadModel->excute(\"\n SELECT * FROM threads WHERE topic_id = {$topic_3}\n ORDER BY id DESC LIMIT {$limit} OFFSET 0\n \");\n while ($row = $result->fetch_assoc()) {\n $data[$topic_3]['threads'][] = ['id' => $row['id'], 'title' => $row['title']];\n }\n\n return $data;\n }", "public function getThreadType();", "public static function getNumberOfWorkers();", "public function show_all_computers(){\r\n\t\t$result = $this->c->show_all_computers();\r\n\t\techo json_encode($result);\r\n\t}", "function listQueues() {\n\t\t$query = \"SELECT rs.`terminal` - 81, (rs.`terminal` - 80) AS que_no, rs.`title`, rs.`ter_type` AS dep_type\n\t\t\tFROM `\".BIT_DB_PREFIX.\"task_roomstat` rs\n\t\t\tWHERE rs.`ter_type` > 6 AND rs.`terminal` > 80\n\t\t\tORDER BY rs.`terminal`\";\n\t\t$result = array();\n\t\t$result['depts'] = $this->mDb->GetAssoc( $query );\n\t\tif ( isset($this->mInfo['department']) && $this->mInfo['department'] > 0 ) {\n\t\t\t$result['tags']\t= $this->mDb->GetAssoc(\"SELECT `reason`, `reason` AS tag_no, `title`, `tag` FROM `\".BIT_DB_PREFIX.\"task_reason` WHERE `reason_type` = \".$this->mInfo['department'].\" ORDER BY `reason`\");\n\t\t\tif ( $this->mInfo['subtag'] > 0 ) {\n\t\t\t\t$result['subtags'] = $this->mDb->GetAssoc(\"SELECT `reason`, `reason` AS tag_no, `title`, `tag` FROM `\".BIT_DB_PREFIX.\"task_reason` WHERE `reason_type` = \".$this->mInfo['subtag'].\" ORDER BY `reason`\");\n\t\t\t}\n\t\t}\n\t\treturn $result;\n\t}", "public static function getTasksList()\n {\n return array('savewebsite', 'exec', 'execquery', 'clearcache', 'cleart3temp');\n }", "function getThreadById($id){\n \n return $this->find($id)->toArray(); \n }", "public function getTasks();", "public function getTasks();", "public function index()\n {\n // All threads that user is participating in\n $threads = Thread::forUser(Auth::id())->latest('updated_at')->get();\n foreach ($threads as $key => $thread) {\n $users = User::whereIn('id', $thread->participantsUserIds())->get();\n $senderAvatar = str_replace('storage/owner/', 'img/cache/small-avatar/', Storage::url($users[1]->avatar_name));\n $cafe = Cafe::where('owner_id', Owner::where('user_id', $users[0]->id)->first()->id)->first();\n $threads[$key]->cafeLogo = str_replace('storage/logo/', 'img/cache/small-logo/', Storage::url($cafe->logo_path));\n $threads[$key]->users = $users;\n $threads[$key]->senderAvatar = $senderAvatar;\n }\n return view('messenger.index', compact('threads'));\n }", "function mysqli_list_processes() {\n\tglobal $link;\n $query = \"SHOW PROCESSLIST\";\n\tif ($res = mysqli_query($link, $query)) {\n // while ($row = mysqli_fetch_assoc($res)) $recs[$i++] = $row;\n\t\t// mysqli_free_result($res);\n // return $recs;\n\t\treturn $res;\n } else {\n return false;\n }\n}", "public function index(Request $request)\n {\n $s = $request->input(\"s\");\n \n $threads = Thread::with(\"tag\")\n ->latest()\n ->search($s)\n ->paginate(100); \n\n return view('thread.index', [\n \"tags\" => Tag::latest(),\n \"threads\" => $threads,\n \"s\" => $s\n ]);\n }", "public function testMessageThreadsV2Get0()\n {\n }", "public function index()\n {\n $categories = Category::with('forums.threadsCount')->get();\n\n return view('index', compact('categories'));\n }", "public function index()\n {\n $threads = Thread::forUser(Auth::user()->id)->orderBy('created_at', 'desc')->get();\n $data['statues'] = \"200 Ok\";\n $data['error'] = null;\n foreach ($threads as $thread) {\n $last_message = $thread->messages()->orderBy('created_at', 'desc')->get()[0]->body;\n $participants = $thread->participants()->get();\n\n foreach ($participants as $participant) {\n if (User::find($participant->user_id)->id != $thread->messages()->orderBy('created_at', 'desc')->get()[0]->user_id) {\n $thread['receiver'] = User::find($participant->user_id);\n }\n }\n $thread['last_message'] = $last_message;\n $thread['last_sender'] = User::find($thread->messages()->orderBy('created_at', 'desc')->get()[0]->user_id);\n }\n $data['data']['threads'] = $threads;\n return response()->json($data, 200);\n }", "function thread_get()\n\t{\n\t\t$this->check_board();\n\n\t\tif (!$this->get('num'))\n\t\t{\n\t\t\t$this->response(array('error' => __(\"You are missing the 'num' parameter.\")), 404);\n\t\t}\n\n\t\tif (!is_natural($this->get('num')))\n\t\t{\n\t\t\t$this->response(array('error' => __(\"Invalid value for 'num'.\")), 404);\n\t\t}\n\n\t\t$num = intval($this->get('num'));\n\n\t\t$from_realtime = FALSE;\n\n\t\t// build an array if we have more specifications\n\t\tif ($this->get('latest_doc_id'))\n\t\t{\n\t\t\tif (!is_natural($this->get('latest_doc_id')) && $this->get('latest_doc_id') < 0)\n\t\t\t{\n\t\t\t\t$this->response(array('error' => __(\"The value for 'latest_doc_id' is malformed.\")), 404);\n\t\t\t}\n\n\t\t\t$latest_doc_id = intval($this->get('latest_doc_id'));\n\t\t\t$from_realtime = TRUE;\n\n\t\t\t$thread = $this->post->get_thread(\n\t\t\t\tget_selected_radix(), $num,\n\t\t\t\tarray('realtime' => TRUE, 'type' => 'from_doc_id', 'type_extra' => array('latest_doc_id' => $latest_doc_id))\n\t\t\t);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$thread = $this->post->get_thread(\n\t\t\t\tget_selected_radix(), $num, array()\n\t\t\t);\n\t\t}\n\n\t\tif ($thread !== FALSE)\n\t\t{\n\t\t\t$this->response($thread['result'], 200); // 200 being the HTTP response code\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif ($from_realtime)\n\t\t\t{\n\t\t\t\t$response = array();\n\t\t\t\t$response[$num['num']] = array('posts' => array());\n\t\t\t\t$this->response($response, 200);\n\t\t\t}\n\n\t\t\t$this->response(array('error' => __('Thread could not be found.')), 200);\n\t\t}\n\t}", "public function getProcessors() {}", "public function workersAction()\n {\n $workerManager = $this->get('dtc_queue.worker_manager');\n $workers = $workerManager->getWorkers();\n\n $workerList = [];\n foreach ($workers as $workerName => $worker) {\n /* @var Worker $worker */\n $workerList[$workerName] = get_class($worker);\n }\n $params = ['workers' => $workerList];\n $this->addCssJs($params);\n\n return $params;\n }", "public function getPoolSize();", "public function getProcessors();", "public function connections()\n {\n $this->_display('connections');\n }", "public function index(Request $request)\n {\n $threads = Thread::with('lastReply')\n ->filter($request)\n ->orderByDesc('last_posted_at')\n ->paginate(25);\n\n return Inertia::render('forum/Index', [\n 'threads' => $threads,\n 'filters' => $request->all('search'),\n ])->withViewData([\n 'title' => 'Forum',\n 'description' => \"Les forums communautaires sont un endroit pour discuter de tout ce qui concerne le développement / le design. Laravel Cameroun offrira l'un des plus grands forum francophone sur Laravel & PHP\",\n 'openGraphURL' => url(\"/forum\")\n ]);\n }", "public function index()\n {\n $threads= Thread::with('tags' ,'video' ,'video.videoDetails')->get();\n return view('home', compact('threads'));\n\n }", "public static function all()\n\t{\n\t\t$workers = Resque::redis()->smembers('workers');\n\t\tif (!is_array($workers)) {\n\t\t\t$workers = array();\n\t\t}\n\n\t\t$instances = array();\n\t\tforeach ($workers as $workerId) {\n\t\t\t$instances[] = self::find($workerId);\n\t\t}\n\t\treturn $instances;\n\t}", "public function getAllDBTC()\n {\n return $this->fetchAllKeyed('SELECT * FROM dbtc_catalog ORDER BY dbtc_date DESC', 'dbtc_thread_id');\n }", "function loadThreads($user_id)\n\t\t{\n\t\t\t$query=sqlite_query($this->connection, \"SELECT member1_id, member2_id, date_created FROM thread WHERE '$user_id' in (member1_id, member2_id) AND valid='yes' ORDER BY thread_id DESC\");\n\t\t\twhile ($row = sqlite_fetch_array($query))\n\t\t\t{\n\t\t\t\t$row[0]=$this->loadUser($row[0]);\n\t\t\t\t$row[1]=$this->loadUser($row[1]);\n\t\t\t}\n\t\t\treturn $row;\n\t\t}", "public function getMessageThreadOverview($idMember, $storeMember = Common_Resource_MessageThread::STORE_INBOX)\n {\n $threads = array();\n\n $messageThreadResource = $this->getResource('MessageThread');\n $messsageThreadRowset = $messageThreadResource->getThreadsByMemberId(\n $idMember,\n $storeMember\n );\n\n foreach ($messsageThreadRowset as $messageThreadRow) {\n $messageThreadObj = $this->messageThreadObject($messageThreadRow);\n array_push($threads, $messageThreadObj);\n }\n\n return $threads;\n }", "public function index()\n {\n $threads = Thread::orderBy('created_at', 'desc')->with('Movie', 'User')->get();\n\n foreach ($threads as $thread) {\n $thread->movie->description = shorten($thread->movie->description, 88);\n $thread->rating_slug = Str::slug($thread->rating);\n $thread->tmdb_id = (isset($thread->movie->externalid[0])) ? $thread->movie->externalid[0]->external_id : null;\n $thread->imdb_id = (isset($thread->movie->externalid[1])) ? $thread->movie->externalid[1]->external_id : null;\n if ($thread->user_id == Auth::user()->id) {\n $thread->can_edit = true;\n }\n }\n\n return response()->json($threads);\n }", "function econsole_get_all_instances_in_topic($modulename, $section, $coursemodinfo){\r\n\t$modules = get_all_instances_in_course($modulename, $coursemodinfo);\r\n\t$moduleids = \"\";\r\n\tforeach($modules as $module){\r\n\t\tif($module->section == $section){\r\n\t\t\t$moduleids .= $module->coursemodule.\",\";\r\n\t\t}\r\n\t}\r\n\treturn substr($moduleids,0,-1);\r\n}", "abstract public function listDevices();", "public function status()\n {\n return $this->belongsToMany(ThreadStatus::class)\n ->withTimestamps();\n }", "function _get_processes()\n\t{\n\t\t// Mac OS X uses different method to output \"top\" list instead\n\t\t// of continuously updating it, so let's define what command it is.\n\t\t\n\t\t$topcmd = ((IS_DARWIN_OS == true) ? \"top -l 1\" : \"top -b -n 1\");\n\t\t\n\t\t$command = ((IS_WINDOWS_OS == true) ? \"tasklist\" : $topcmd);\n\t\t\t\n\t\t$processlist = @shell_exec($command);\n\t\t\n\t\treturn (($topinfo === false) ? false : trim($processlist));\n\t}", "public function getOneThread()\n\t{\t\n\t\tglobal $ilDB;\n\t\t\t\n\t\t$data_type = array();\n\t\t$data_value = array();\n\t\t\n\t\t$query = 'SELECT * FROM frm_threads WHERE ';\n\t\t\n\t\tif($this->getMDB2Query() != '' && $this->getMDB2DataType() != '' && $this->getMDB2DataValue() != '')\n\t\t{\n\t\t\t$query .= $this->getMDB2Query();\n\t\t\t$data_type = $data_type + $this->getMDB2DataType();\n\t\t\t$data_value = $data_value + $this->getMDB2DataValue();\n\t\t\t\n\t\t\t$sql_res = $ilDB->queryf($query, $data_type, $data_value);\n\t\t\t$result = $sql_res->fetchRow(DB_FETCHMODE_ASSOC);\n\t\t\t$result[\"thr_subject\"] = trim($result[\"thr_subject\"]);\n\t\t}\n\n\t\treturn $result;\n\t}", "public function getList()\n {\n return $this->returnText('Full list of users and queues can be found here: https://nbq.2g.be/'. $this->c->id .'/'. urlencode($this->c->displayName) .' ');\n }", "public function index()\n {\n return Worker::all();\n }", "public function threads(){\n return $this->belongsToMany('App\\Thread');\n }", "public function testMessageThreadsV2Get()\n {\n }", "public function getThreadedList($query=null) {\n\t\t\tif (!empty($query)) {\n\t\t\t\t$search = array('name LIKE' => '%'.$query.'%');\n\t\t\t} else {\n\t\t\t\t$search = array();\n\t\t\t}\n\t\t\t\n\t\t\treturn $this->MyMenu->find('threaded', array(\n\t\t\t\t'fields' => array('id', 'parent_id', 'name', 'publish'),\n\t\t\t\t'conditions' => array_merge(array('lang_id' => $this->pageLanguage), $search),\n\t\t\t\t'order' => 'lft'\n\t\t\t));\n\t\t}", "public function get_procs_array();", "public function index()\n {\n //\n \n // $search = \\Request::get('search');\n // $thread = Thread::where('name', 'like', '%' .$search. '%')->get();\n // return view('threads.index', compact('thread'));\n $search = \\Request::get('search');\n if($search){\n $thread = Thread::where('name', 'like', '%' .$search. '%')->get();\n return view('threads.result', compact('thread'));\n }\n $thread = Thread::paginate(10);\n $recent_thread = Thread::orderBy('created_at', 'desc')->take(5)->get();\n return view('threads.index', compact('thread'))->with('recent', $recent_thread);\n }", "function showThreadsObject()\n\t{\n\t\t$this->tpl->setRightContent($this->getRightColumnHTML());\n\t\t$this->getCenterColumnHTML();\n\t}", "public function getIdleWorkerCount(): int;", "function listAllHosts() {\n $execute = LIST_COMMAND;\n exec($execute, $output, $retVal);\n return $output;\n}", "public function jobsAllAction()\n {\n $this->validateManagerType('dtc_queue.default_manager');\n $class1 = $this->container->getParameter('dtc_queue.class_job');\n $class2 = $this->container->getParameter('dtc_queue.class_job_archive');\n $label1 = 'Non-Archived Jobs';\n $label2 = 'Archived Jobs';\n\n $params = $this->getDualGridParams($class1, $class2, $label1, $label2);\n\n return $this->render('@DtcQueue/Queue/grid.html.twig', $params);\n }", "public function getTaskListList(){\n return $this->_get(2);\n }", "public function rebuildAllThreads($visible)\n\t{\n\t\t$back = '';\n\t\t$news_table = GDO::table('GWF_News');\n\t\t$result = $news_table->select('*');\n\t\twhile (false !== ($news = $news_table->fetch($result, GDO::ARRAY_O)))\n\t\t{\n\t\t\t$back .= $this->newsToForum($news, $visible);\n\t\t}\n\t\t$news_table->free($result);\n\t\treturn $back;\n\t}", "public static function tasks ()\r\n {\r\n $acl = Session::get('acl');\r\n return $acl['tasks'];\r\n }", "public function show($id)\n {\n //\n $thread = Thread::find($id);\n return view('threads.show', compact('thread'));\n }", "public function getJobs();", "public function getJobs();", "public function describeDedicatedClusterInstanceList($request)\n {\n $runtime = new RuntimeOptions([]);\n\n return $this->describeDedicatedClusterInstanceListWithOptions($request, $runtime);\n }", "public function retrieveConcurrentSessions()\n {\n $endpoint = self::$endpoint . '/statistics' . SessionEndpoint::$endpoint;\n return self::sendRequest(Method::GET, $endpoint);\n }", "public function threadsWithNewMessages()\n {\n $threadsWithNewMessages = [];\n $participants = Participant::where('user_id', $this->id)->lists('last_read', 'thread_id');\n\n /**\n * @todo: see if we can fix this more in the future.\n * Illuminate\\Foundation is not available through composer, only in laravel/framework which\n * I don't want to include as a dependency for this package...it's overkill. So let's\n * exclude this check in the testing environment.\n */\n if (getenv('APP_ENV') == 'testing' || !str_contains(\\Illuminate\\Foundation\\Application::VERSION, '5.0')) {\n $participants = $participants->all();\n }\n\n if ($participants) {\n $threads = Thread::whereIn('id', array_keys($participants))->get();\n\n foreach ($threads as $thread) {\n if ($thread->updated_at > $participants[$thread->id]) {\n $threadsWithNewMessages[] = $thread->id;\n }\n }\n }\n\n return $threadsWithNewMessages;\n }", "public function getAvailableSites();" ]
[ "0.64835525", "0.6027719", "0.6026949", "0.5942333", "0.5875374", "0.5848816", "0.584709", "0.579849", "0.5772946", "0.5770617", "0.57400596", "0.5722606", "0.5690784", "0.56481206", "0.55997443", "0.559453", "0.55693346", "0.55655766", "0.5536028", "0.5490036", "0.5478312", "0.5464308", "0.5455423", "0.5451919", "0.5355403", "0.52846307", "0.5279305", "0.5276915", "0.5266682", "0.52366287", "0.5235291", "0.5228021", "0.5223274", "0.52213657", "0.51817447", "0.517131", "0.5163687", "0.5156899", "0.5156899", "0.51332", "0.51332", "0.5131052", "0.5103273", "0.50989985", "0.509042", "0.5049939", "0.50425583", "0.50161093", "0.49956515", "0.4972783", "0.49493363", "0.49389958", "0.49317056", "0.49197263", "0.49197263", "0.4913406", "0.49122322", "0.49070084", "0.48823574", "0.48783076", "0.48630503", "0.48511136", "0.48483142", "0.48356095", "0.48325363", "0.48307246", "0.48186415", "0.4810864", "0.4789435", "0.47850493", "0.4774561", "0.4773611", "0.4768989", "0.47670132", "0.47648728", "0.47635967", "0.47620437", "0.47595498", "0.47496945", "0.47311702", "0.47297487", "0.47085842", "0.4703403", "0.46940565", "0.46900654", "0.4684477", "0.46721107", "0.46636137", "0.46609524", "0.46504575", "0.46369705", "0.4635763", "0.46340546", "0.46306762", "0.4621873", "0.4621873", "0.4607696", "0.4605784", "0.4601684", "0.4601583" ]
0.4954538
50
Store a new thread.
public function store(ThreadRequest $request) { $thread = new Thread; $thread->title = $request->input('title'); $thread->category = $request->input('category'); $thread->user_id = Auth::user()->id; $thread->save(); $post = new Post; $post->title = $request->input('title'); $post->message = $request->input('message'); $post->user_id = Auth::user()->id; $post->thread_id = $thread->id; $post->save(); return redirect('threads/'.$thread->id); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function store(Thread $thread)\n {\n $thread->update(['locked' => true]);\n }", "public function store($channel, Thread $thread)\n {\n $thread->subscribe();\n }", "public function store(StoreThread $request, Thread $thread)\n {\n if ($thread->store()) {\n return redirect('/threads/'.$thread->slug);\n }\n\n return back()->withErrors('Failed to store your threads.');\n }", "public function store(ThreadRequest $request)\n {\n Auth::user()->saveThread(Thread::new($request));\n\n return redirect()->route('threads.index')\n ->with('flash', 'Your thread has been published.');\n }", "public function store($channelID, Request $request, Thread $thread)\n {\n //Validate incoming request\n $request->validate([\n 'reply' => 'required',\n ]);\n\n //Make a reply object and associate with the thread\n $thread->addReply([\n 'reply'=> request('reply'),\n 'expert_id' => auth('expert')->user()->id,\n ]);\n\n return back();\n }", "public function store(ThreadRequest $request)\n {\n $request->merge(['user_id' => auth()->id()]);\n $thread = $this->repository->create($request->all());\n\n $thread->creator->notify(new SendSlackThread($thread));\n\n return redirect($thread->path);\n }", "public function store(Request $request)\n {\n $thread = new Thread();\n $thread->category_id = $request->category;\n $thread->title = $request->title;\n $thread->body = $request->body;\n $thread->user_id = auth()->id();\n $isSave = $thread->save();\n }", "public function create()\n\t{\n\n\t\t$post = $this->store('create', '/thread/new');\n\n\t\tredirect('/threads?id=' . $post->id);\n\t}", "public function store(Request $request, Thread $thread)\n {\n if ($request->hasFile('thumbnail')) {\n\n $thumbnail = $request->file('thumbnail');\n \n $filename = time() . '.' . $thumbnail->getClientOriginalExtension();\n $location = public_path('/thumbnails/' . $filename);\n \n Image::make($thumbnail)->save($location);\n }\n\n $thread = Thread::create([\n \"user_id\" => auth()->id(),\n \"tag_id\" => $request->input('tag_id'),\n \"title\" => $request->input('title'),\n \"description\" => $request->input('description'),\n \"thumbnail\" => $thread->thumbnail = $filename,\n \"body\" => $request->input('body')\n ]);\n\n flash(e('You have successfully created ' . $thread->title . '!'), 'success');\n\n return redirect(\"/threads\");\n }", "public function store(StoreThread $form)//\n {\n $channel = $form->channel();\n if(empty($channel)||((!$channel->is_public)&&(!auth('api')->user()->canSeeChannel($channel->id)))){abort(403);}\n\n //针对创建清单进行一个数值的限制\n if($channel->type==='list'){\n $list_count = Thread::where('user_id', auth('api')->id())->withType('list')->count();\n if($list_count > auth('api')->user()->user_level){abort(403);}\n }\n if($channel->type==='box'){\n $box_count = Thread::where('user_id', auth('api')->id())->withType('box')->count();\n if($box_count >=1){abort(403);}//暂时每个人只能建立一个问题箱\n }\n $thread = $form->generateThread();\n return response()->success(new ThreadProfileResource($thread));\n }", "public function created(Thread $thread)\n {\n $thread->user->recordActivity('created a new thread:', $thread);\n }", "public function store(StoreThread $form)//\n {\n $channel = collect(config('channel'))->keyby('id')->get($form->channel_id);\n if(!$channel||!auth('api')->user()){abort(404);}\n\n if(auth('api')->user()->no_posting){abort(403,'禁言中');}\n\n if($channel->type==='book'&&(auth('api')->user()->level<1||auth('api')->user()->quiz_level<1)&&!auth('api')->user()->isAdmin()){abort(403,'发布书籍,必须用户等级1以上,答题等级1以上');}\n\n if($channel->type<>'book'&&(auth('api')->user()->level<4||auth('api')->user()->quiz_level<2)&&!auth('api')->user()->isAdmin()){abort(403,'发布非书籍主题,必须用户等级4以上,答题等级2以上');}\n\n if(!$channel->is_public&&!auth('api')->user()->canSeeChannel($channel->id)){abort(403,'不能访问这个channel');}\n\n if(!auth('api')->user()->isAdmin()&&Cache::has('created-thread-' . auth('api')->id())){abort(410,\"不能短时间频繁建立新主题\");}\n\n //针对创建清单进行一个数值的限制\n if($channel->type==='list'){\n $list_count = Thread::where('user_id', auth('api')->id())->withType('list')->count();\n if($list_count > auth('api')->user()->user_level){abort(410,'额度不足,不能创建更多清单');}\n }\n if($channel->type==='box'){\n $box_count = Thread::where('user_id', auth('api')->id())->withType('box')->count();\n if($box_count >=1){abort(410,'目前每个人只能建立一个问题箱');}\n }\n\n $thread = $form->generateThread($channel);\n\n Cache::put('created-thread-' . auth('api')->id(), true, 10);\n\n if($channel->type==='list'&&auth('api')->user()->info->default_list_id===0){\n auth('api')->user()->info->update(['default_list_id'=>$thread->id]);\n }\n if($channel->type==='box'&&auth('api')->user()->info->default_box_id===0){\n auth('api')->user()->info->update(['default_box_id'=>$thread->id]);\n }\n\n $thread = $this->threadProfile($thread->id);\n\n return response()->success(new ThreadProfileResource($thread));\n }", "public function store($channelId, Thread $thread, CreatePostRequest $request)\n {\n return $thread->addReply([\n 'user_id' => Auth::user()->id,\n 'body' => request('body'),\n ])->load('owner');\n }", "public function store(Thread $thread)\n {\n $thread->addSubscription();\n\n return response('Subscription added', 200);\n }", "public function store(Request $request, Thread $thread)\n {\n $message = Message::create(['sender_id' => auth()->id(), 'receiver_id' => request('receiver_id'), \n 'message' => request('message'), 'thread_id' => $thread->id]);\n\n User::findOrFail(request('receiver_id'))->notify(new NewChatMessage($message));\n\n broadcast(new NewMessage($message))->toOthers();\n\n return response(['message' => $message], 200);\n }", "function store($channelId, Thread $thread, CreatePostRequest $form){\n\n\t\t// #54 remove all codes to $form CreatePostForm\n\t\t\n\t\t// if(Gate::denies('create', new Reply)){\n\t\t// \treturn response(\n\t\t// \t\t'Та дахин дахин нийтлэл оруулж байна, Түр хүлээнэ үү! :)', 429);\n\t\t// } \n\t\t// request()->validate(['body' => 'required|spamfree']);\n\t\t\n\t\treturn $thread->addReply([\t\n\t\t\t'body' => request('body'), \t\t\t\t\n\t\t\t'user_id' => auth()->id()\t\t\t\n\t\t])->load('owner');\n\n\t}", "final public function post_thread(Thread $thread) {\r\n\t\tif ($this->user_id && $thread->thread_text && $thread->type) {\r\n\t\t\tif ($thread->type == 1) {\r\n\t\t\t\t$sql = \"INSERT INTO `threads` (thread_text, author_id, date_posted, type, date_play) VALUES ('$thread->thread_text', '$this->user_id', NOW(), '$thread->type', '$thread->date_play')\";\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t$sql = \"INSERT INTO `threads` (thread_text, author_id, date_posted, type) VALUES ('$thread->thread_text', '$this->user_id', NOW(), '$thread->type')\";\r\n\t\t\t}\r\n\t\t\t$result = $this->dbc->query($sql)\r\n\t\t\tor die ($this->dbc->error);\r\n\t\t\t$thread->thread_id = $this->dbc->insert_id;\r\n\r\n\t\t\t//Push the action\r\n\t\t\t$action = new PostedThread(array(\r\n\t\t\t\t'thread' => $thread,\r\n\t\t\t\t'poster' => clone $this)\r\n\t\t\t);\r\n\t\t\tActionPusher::push_action($action);\r\n\t\t\treturn $thread;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tthrow new UnexpectedValueException('UnexpectedValueException occured on method call post_thread');\r\n\t\t}\r\n\t}", "public function store()\n {\n DB::transaction(function () {\n\n $url = null;\n\n if (request()->hasFile('file')) {\n $url = $this->files();\n }\n\n\n\n $this->thread = Thread::create([\n 'subject' => bin2hex(random_bytes(10)),\n ]);\n\n // Message\n $this->message = Message::create([\n 'thread_id' => $this->thread->id,\n 'user_id' => request()->user()->id,\n 'body' => request()->body ?? null,\n 'file_url' => $url ?? null,\n 'type' => request()->type ?? null\n ]);\n\n // Sender\n Participant::create([\n 'thread_id' => $this->thread->id,\n 'user_id' => request()->user()->id,\n 'last_read' => new Carbon,\n ]);\n\n // Recipients\n if (request()->has('recipients')) {\n $this->thread->addParticipant((int) request()->recipients);\n }\n });\n\n /**\n * dispatches an event\n */\n event(new NewMessage(\n [\n 'id' => $this->thread->id,\n 'users' => $this->thread->users,\n 'participants' => $this->thread->participants,\n 'extras' => collect($this->thread->users)->map(function ($user) {\n return [\n 'profile_picture' => $user->profilePictures()->latest('created_at')->first(),\n 'count' => $this->thread->userUnreadMessagesCount($user->id),\n 'user_id' => $user->id\n ];\n }),\n 'messages' => $this->thread->messages\n ]\n ));\n\n\n return new ThreadResource($this->thread);\n }", "public function store($channelId, Thread $thread)\n {\n if ($thread->locked) {\n return response(\"Thread is locked\", 422);\n }\n\n try {\n if (Gate::denies('create', new Reply)) {\n return response(\"You are posting too freaquently, Please take a break :)\", 422);\n }\n\n $this->validate(request(), ['body' => ['required', new SpamFree]]);\n\n $reply = $thread->addReply([\n 'body' => request('body'),\n 'user_id' => auth()->id()\n ]);\n } catch (\\Exception $e) {\n return response(\"Sorry, your request could not be saved at the moment.\", 422);\n }\n\n return $reply->load('owner');\n }", "public function addMetadata(ThreadMetadataInterface $meta): ThreadInterface;", "public function store(Request $request)\n {\n // dd($request);\n //\n $tags = $request->tags;\n foreach ($tags as $key => $tag) {\n if (!is_numeric($tag)) {\n $tags[$key] = Tag::create(['name' => $tag])->id;\n } else {\n if (Tag::where('name', '=', $tag)->count() < 1) {\n $tags[$key] = Tag::create(['name' => $tag])->id;\n }\n }\n }\n\n $this->validate($request, [\n 'subject' => 'required|min:5',\n 'tags' => 'required',\n 'thread' => 'required|min:10',\n// 'g-recaptcha-response' => 'required|captcha'\n ]);\n\n //store\n $thread = auth()->user()->threads()->create($request->all())->tags()->attach($tags);\n // $thread->tags()->attach($request->tags);\n\n //redirect\n return back()->withMessage('Thread Created!');\n\n }", "public function store(Request $request)\n {\n $this->validate($request, [\n 'topic' => 'required|min:10',\n 'question' => 'required|min:100'\n ]);\n\n $topic = $this->addTopic($request->input('topic'));\n\n if($topic != null) {\n $thread = new Thread;\n $thread->user_id = $this->currentUser()->id;\n $thread->id_topic = $topic->id;\n $thread->question = $request->input('question');\n\n $log = null;\n if($thread->save()) {\n $log = Common::registerLog([\n 'action' => \"membuat diskusi baru.\",\n 'target' => 'thread',\n 'prefix' => 't-create',\n 'target_id' => $thread->id,\n 'actor' => 'user',\n 'actor_id' => Common::currentUser('web')->id\n ]);\n }\n\n if($log != null && $log == true) {\n return redirect(route('user.thread.index'))->with('success', 'Pertanyaan dikirim !');\n }\n return redirect()->back()->with('failed', 'Gagal mengirim pertanyaan, silahkan coba lagi nanti.');\n }\n return redirect()->back()->with('failed', 'Gagal mengirim pertanyaan, silahkan coba lagi nanti.');\n }", "public function store(Thread $thread, CreateReplyRequest $request)\n {\n $attributes = [\n 'body' => request('body'),\n 'user_id' => auth()->id(),\n 'thread_id' => $thread->id\n ];\n\n $reply = $thread->addReply($attributes);\n\n return $reply->load('creator');\n }", "public function store()\n {\n $input = Input::all();\n $thread = Thread::create([\n 'subject' => $input['subject'],\n ]);\n\n // Message\n Message::create([\n 'thread_id' => $thread->id,\n 'user_id' => Auth::id(),\n 'body' => $input['message'],\n ]);\n\n // Sender\n Participant::create([\n 'thread_id' => $thread->id,\n 'user_id' => Auth::id(),\n 'last_read' => new Carbon,\n ]);\n\n // Recipients\n $thread->addParticipant($input['recipient']);\n\n return redirect()->route('messages.show', $thread->id);\n }", "public function store()\n\t{\n\t\tWorker::create(Request::all());\n\t}", "public function publishThread($attributes)\n\t{\n\t\treturn $this->threads()->create($attributes);\n\t}", "function ciniki_core_threadAdd(&$ciniki, $module, $object, $table, $history_table, $args) {\n //\n // All arguments are assumed to be un-escaped, and will be passed through dbQuote to\n // ensure they are safe to insert.\n //\n\n // Required functions\n ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbQuote');\n ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbInsert');\n\n //\n // Don't worry about autocommit here, it's taken care of in the calling function\n //\n\n //\n // Get a new UUID\n //\n ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbUUID');\n $rc = ciniki_core_dbUUID($ciniki, $module);\n if( $rc['stat'] != 'ok' ) {\n return $rc;\n }\n $uuid = $rc['uuid'];\n\n // \n // Setup the SQL statement to insert the new thread\n //\n $strsql = \"INSERT INTO $table (uuid, tnid, user_id, subject, state, \"\n . \"source, source_link, options, \"\n . \"date_added, last_updated) VALUES (\"\n . \"'\" . ciniki_core_dbQuote($ciniki, $uuid) . \"', \"\n . \"\";\n\n // tnid\n if( isset($args['tnid']) && $args['tnid'] != '' && $args['tnid'] > 0 ) {\n $strsql .= \"'\" . ciniki_core_dbQuote($ciniki, $args['tnid']) . \"', \";\n } else {\n return array('stat'=>'fail', 'err'=>array('code'=>'ciniki.core.373', 'msg'=>'Required argument missing', 'pmsg'=>'No tnid'));\n }\n\n // user_id\n if( isset($args['user_id']) && $args['user_id'] != '' && $args['user_id'] > 0 ) {\n $strsql .= \"'\" . ciniki_core_dbQuote($ciniki, $args['user_id']) . \"', \";\n } else {\n return array('stat'=>'fail', 'err'=>array('code'=>'ciniki.core.374', 'msg'=>'Required argument missing', 'pmsg'=>'No user_id'));\n }\n\n // subject\n if( isset($args['subject']) && $args['subject'] != '' ) {\n $strsql .= \"'\" . ciniki_core_dbQuote($ciniki, $args['subject']) . \"', \";\n } else {\n return array('stat'=>'fail', 'err'=>array('code'=>'ciniki.core.375', 'msg'=>'Required argument missing', 'pmsg'=>'No subject'));\n }\n\n // state - optional\n if( isset($args['state']) && $args['state'] != '' ) {\n $strsql .= \"'\" . ciniki_core_dbQuote($ciniki, $args['state']) . \"', \";\n } else {\n $strsql .= \"'', \";\n }\n\n // source - optional\n if( isset($args['source']) && $args['source'] != '' ) {\n $strsql .= \"'\" . ciniki_core_dbQuote($ciniki, $args['source']) . \"', \";\n } else {\n $strsql .= \"'', \";\n }\n\n // source_link - optional\n if( isset($args['source_link']) && $args['source_link'] != '' ) {\n $strsql .= \"'\" . ciniki_core_dbQuote($ciniki, $args['source_link']) . \"', \";\n } else {\n $strsql .= \"'', \";\n }\n\n // options - optional\n if( isset($args['options']) && $args['options'] != '' ) {\n $strsql .= \"'\" . ciniki_core_dbQuote($ciniki, $args['options']) . \"', \";\n } else {\n $strsql .= \"'0', \";\n }\n\n $strsql .= \"UTC_TIMESTAMP(), UTC_TIMESTAMP())\";\n\n $rc = ciniki_core_dbInsert($ciniki, $strsql, $module);\n if( $rc['stat'] != 'ok' ) {\n return $rc;\n }\n $thread_id = $rc['insert_id'];\n\n ciniki_core_dbAddModuleHistory($ciniki, $module, $history_table, $tnid,\n 1, $table, $thread_id, 'uuid', $uuid);\n if( isset($args['user_id']) && $args['user_id'] != '' && $args['user_id'] > 0 ) {\n ciniki_core_dbAddModuleHistory($ciniki, $module, $history_table, $tnid,\n 1, $table, $thread_id, 'user_id', $args['user_id']);\n }\n if( isset($args['subject']) && $args['subject'] != '' ) {\n ciniki_core_dbAddModuleHistory($ciniki, $module, $history_table, $tnid,\n 1, $table, $thread_id, 'subject', $args['subject']);\n }\n if( isset($args['state']) && $args['state'] != '' ) {\n ciniki_core_dbAddModuleHistory($ciniki, $module, $history_table, $tnid,\n 1, $table, $thread_id, 'state', $args['state']);\n }\n if( isset($args['source']) && $args['source'] != '' ) {\n ciniki_core_dbAddModuleHistory($ciniki, $module, $history_table, $tnid,\n 1, $table, $thread_id, 'source', $args['source']);\n }\n if( isset($args['source_link']) && $args['source_link'] != '' ) {\n ciniki_core_dbAddModuleHistory($ciniki, $module, $history_table, $tnid,\n 1, $table, $thread_id, 'source_link', $args['source_link']);\n }\n if( isset($args['options']) && $args['options'] != '' ) {\n ciniki_core_dbAddModuleHistory($ciniki, $module, $history_table, $tnid,\n 1, $table, $thread_id, 'options', $args['options']);\n }\n //\n // Sync push\n //\n $ciniki['syncqueue'][] = array('push'=>$module . '.' . $object, \n 'args'=>array('id'=>$thread_id));\n\n return $rc;\n}", "public function store(Request $request)\n {\n $thread = Thread::create([\n 'subject' => $request->get('subject','new'),\n ]);\n\n // Message\n Message::create([\n 'thread_id' => $thread->id,\n 'user_id' => Auth::user()->id,\n 'body' => $request->get('message'),\n ]);\n\n // Sender\n Participant::create([\n 'thread_id' => $thread->id,\n 'user_id' => Auth::user()->id,\n 'last_read' => new Carbon,\n ]);\n\n // Recipients\n if ($request->has('recipients')) {\n $thread->addParticipant($request->get('recipients'));\n }\n\n return response()->json($thread);\n }", "function newThread($member1_id, $member2_id)\n\t\t{\n\t\t\t$query=sqlite_exec($this->connection,\"INSERT INTO thread(member1_id, member2_id, date_created) VALUES($member1_id, $member2_id, NOW())\");\n\t\t\treturn sqlite_last_insert_rowid($this->connection);\n\t\t}", "function createThread($boardUrl, $subject, $comment, $user, $ip){\n R::begin();\n try {\n $board = boardByURL($boardUrl);\n $user = checkSetDefaultPoster($user, $board);\n $thread = R::dispense(TTHREAD::TABLE);\n R::store($thread);\n $post = _dispensePost($board, $subject, $comment, $user, $ip);\n $post[TPOST::ISOP] = true;\n R::store($post);\n array_push($thread[TTHREAD::POSTS], $post);\n array_push($board[TBOARD::THREADS], $thread);\n R::store($board);\n R::commit();\n } catch(Exception $e) {\n R::rollback();\n }\n \n }", "public function __construct()\n {\n // for example creates \"thread\"\n }", "public function store($channelId, Thread $thread, CreatePostForm $form)\n {\n if ($reply = $form->persist($thread)) {\n return response([\n 'success' => 'Your reply has been left.',\n 'reply' => $reply->load('user')\n ]);\n }\n }", "public function store(Request $request)\n {\n request()->validate([\n 'title' => 'required',\n 'content' => 'required',\n ]);\n\n $thread = new Thread;\n $thread->user_id = auth()->user()->id;\n $thread->title = request('title');\n $thread->content = request('content');\n $thread->save();\n\n session()->flash('successMessage', 'Pertanyaan telah tersimpan');\n return redirect()->back();\n }", "public function store($type='create', $redirect_url='/')\n\t{\n\n\t\tif(!is_logged())\n\t\t\tforbidden();\n\n\t\tif($type=='save' || $type=='reply'){\n\n\t\t\t$id = post_int('id', false);\n\n\t\t\tif(!$id) die('Invalid post');\n\n\t\t\t$post = Thread::find($id);\n\n\t\t}\n\n\t\t$rules['body'] = 'text|min:2';\n\n\t\tif($title = post_string('title', false))\n\t\t\t$rules['title'] = 'text|min:2';\n\n\t\tif($id)\n\t\t\t$redirect_url = str_replace('_id_', $id, $redirect_url);\n\n\t\t$valid = $this->validate($rules, $redirect_url);\n\n\t\tif($title)\n\t\t\t$data['title'] = sanitize_string($_POST['title']);\n\n\t\t$data['body'] = sanitize_richtext($_POST['body']);\n\n\t\t$data['topic_id'] = post_int('topic_id', null);\n\n\t\tif($type=='save'){\n\n\t\t\tThread::update($data, ['id' => $id]);\n\n\t\t\treturn $post;\n\n\t\t}elseif($type=='reply'){\n\n\t\t\t$data['user_id'] = user()->id;\n\n\t\t\t$data['parent_id'] = $id;\n\n\t\t\treturn Thread::create($data);\n\n\n\t\t}else{\n\n\t\t\t$data['user_id'] = user()->id;\n\n\t\t\treturn Thread::create($data);\n\t\t}\n\t\n\t}", "public function store(Request $request)\n {\n $this->validate($request, [\n 'subject' => 'required',\n 'question' => 'required'\n ]);\n\n $thread = new Thread;\n $thread->ThreadSubject = $request->input('subject');\n $thread->ThreadDescription = $request->input('question');\n $thread->save();\n\n return redirect('/threads') -> with('success', 'Question Created');\n }", "public function actionSave()\n\t{\n\t\t// we will get called again from\n\t\t// Tinhte_XenTag_XenForo_DataWriter_Discussion_Thread::_discussionPreSave()\n\t\t$GLOBALS[Tinhte_XenTag_Constants::GLOBALS_CONTROLLERPUBLIC_THREAD_SAVE] = $this;\n\n\t\treturn parent::actionSave();\n\t}", "function addThread()\n{\n\tif(!isset($db) || $db = NULL || !isset($connection) || $connection = NULL)\n\t{\n\t\t$db = new Database();\n\t\t$connection = $db->mysqli_db_connect();\n\t}\n\t\n\t// Re initialize the Board class\n\tif(!isset($main) || $main = NULL)\n\t{\n\t\t$main = new Board($db, $connection);\n\t}\n\t\n\tif(isset($_SESSION['angemeldet']) && $_SESSION['angemeldet'] == true || $main->boardConfig($main->getThreadBoardID($_GET['threadID']), \"guest_posts\"))\n\t{\n\n\t\tglobal $threadAddStatusArray;\n\t\tglobal $largestNumber;\n\n\t\t$threadAddStatus = false;\n\n\t\t$_SESSION['ID'] = session_id();\n\t\t$getAuthorID = $db->query(\"SELECT id FROM $db->table_accounts WHERE sid=('\".$_SESSION['ID'].\"')\");\n\n\t\twhile ($authorID = mysqli_fetch_object($getAuthorID)) {\n\t\t\t$authorIDResult = $authorID->id;\n\t\t}\n\n\t\t// VARS\n\n\t\t// BOARD ID\n\t\tif(isset($_GET['boardview']) && !isset($_GET['threadID'])) {\n\t\t\t$actualBoard = mysqli_real_escape_string($GLOBALS['connection'], $_GET['boardview']);\n\t\t} else {\n\t\t\t$getBoard = $db->query(\"SELECT main_forum_id FROM $db->table_thread WHERE id=('\".$actualThread.\"')\");\n\t\t\t\n\t\t\twhile($boardIDData = mysqli_fetch_object($getBoard)) {\n\t\t\t\t$actualBoard = $boardIDData->main_forum_id;\n\t\t\t}\n\t\t}\n\n\t\tif ((empty($_POST[\"threadAddArea\"])) || (empty($_POST[\"threadTitleInput\"]))) {\n\t\t\techo 'Sie haben nicht alle benötigten Informationen eingegeben!';\n\n\t\t} else {\n\n\t\t\t$newThreadTitle = mysqli_real_escape_string($GLOBALS['connection'], $_POST[\"threadTitleInput\"]);\n\t\t\t$content \t\t= mysqli_real_escape_string($GLOBALS['connection'], $_POST[\"threadAddArea\"]);\n\n\t\t\tif (! isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {\n\t\t\t$client_ip = $_SERVER['REMOTE_ADDR'];\n\t\t\t}\n\t\t\telse {\n\t\t\t$client_ip = $_SERVER['HTTP_X_FORWARDED_FOR'];\n\t\t\t}\n\n\t\t\tif (strlen($newThreadTitle) \n\t\t\t< 3) {\n\t\t\techo 'Der Titel muss mindestens 3 Zeichen besitzen.';\n\t\t\treturn;\n\t\t\t};\n\n\t\t\tif (strlen($newThreadTitle) >\n\t\t\t200) {\n\t\t\techo 'Der eingegebene Titel ist zu lang. Er darf maximal 200 Zeichen beinhalten.';\n\t\t\treturn;\n\t\t\t};\n\n\t\t\tif (strlen($content) \n\t\t\t< 30) {\n\t\t\techo 'Ihr Beitrag muss mindestens 30 Zeichen besitzen.';\n\t\t\treturn;\n\t\t\t};\n\n\t\t\tif (strlen($content) >\n\t\t\t30000) {\n\t\t\techo 'Ihr Beitrag ist zu lang. Er darf maximal 30000 Zeichen beinhalten.';\n\t\t\treturn;\n\t\t\t};\n\n\t\t\tif (strlen(trim($content)) == 0) {\n\t\t\techo 'Ihr Beitrag darf nicht ausschließlich aus Leerzeichen bestehen!';\n\t\t\treturn;\n\t\t\t};\n\n\t\t\t$insertTime = time();\n\n\n\t\t\t$db->query(\"INSERT INTO $db->table_thread (main_forum_id, title, date_created, last_replyTime,last_post_author_id, posts, author_id) VALUES ('\".$actualBoard.\"', '\".$newThreadTitle.\"', '\".$insertTime.\"', '\".$insertTime.\"','\".$authorIDResult.\"', '0', '\".$authorIDResult.\"')\");\n\t\t\t$db->query(\"INSERT INTO $db->table_thread_posts (thread_id, author_id, date_posted, text) VALUES ((SELECT id FROM $db->table_thread WHERE id=(SELECT max(id) FROM $db->table_thread)), '\".$authorIDResult.\"', '\".$insertTime.\"', '\".$content.\"')\");\n\t\t\t$db->query(\"UPDATE $db->table_accdata SET post_counter=post_counter+1 WHERE account_id=(SELECT id FROM $db->table_accounts WHERE sid=('\".$_SESSION['ID'].\"'))\");\n\t\t\t$db->query(\"UPDATE $db->table_thread SET last_activity=0 WHERE last_activity=1 AND main_forum_id=('\".$actualBoard.\"')\");\n\n\t\t\t$token = mysqli_real_escape_string($GLOBALS['connection'], $_GET['token']);\n\n\t\t\t$tokenCheck = $db->query(\"SELECT token FROM $db->table_thread_saves WHERE token = ('\".$token.\"') AND user_id = (SELECT id FROM $db->table_accounts WHERE sid=('\" . $_SESSION['ID'] . \"'))\");\n\t\t\tif(isset($_GET['token']) && !empty($_GET['token']) && mysqli_num_rows($tokenCheck) >= 1) $db->query(\"DELETE FROM $db->table_thread_saves WHERE token = ('\".$token.\"') AND user_id = (SELECT id FROM $db->table_accounts WHERE sid=('\" . $_SESSION['ID'] . \"'))\");\n\n\t\t\t$rowSQL = $db->query( \"SELECT MAX( id ) AS max FROM $db->table_thread\" );\n\t\t\t$row = mysqli_fetch_array( $rowSQL );\n\t\t\t$largestNumber = $row['max'];\n\t\t\t$db->query(\"UPDATE $db->table_thread SET last_activity=1 WHERE last_activity=0 AND id=('\".$largestNumber.\"')\");\n\n\t\t\t$threadAddStatus = true;\n\t\t}\n\t\t\t$threadAddStatusArray = array(\n\t\t\t'threadAddStatus' => $threadAddStatus, \n\t\t\t'newThreadID' => $largestNumber\n\t\t\t);\n\t\t\t\n\t\t\t\treturn $threadAddStatusArray;\n\t}\n\telse\n\t\treturn;\n}", "public function store(Thread $thread, Recaptcha $recaptcha)\n {\n // dd(request()->all());\n // post https://www.google.com/recaptcha/api/siteverify\n $validated = request()->validate([\n 'title' => 'required|spamfree',\n 'body' => 'required|spamfree',\n 'channel_id' => 'required|exists:channels,id',\n 'g-recaptcha-response' => ['required', $recaptcha]\n ]);\n\n $validated['user_id'] = auth()->id();\n\n $thread = $thread->addThread($validated);\n\n if (request()->wantsJson()) {\n return response($thread, 201);\n }\n\n return redirect($thread->path())\n ->with('flash', 'Your Thread has been published');\n }", "public function testMessageThreadsV2MarkThread()\n {\n }", "public function setThread(Thread $Thread) {\r\n if (!$this->thread instanceof Thread || !filter_var($this->thread->id, FILTER_VALIDATE_INT)) {\r\n $this->thread = $Thread;\r\n }\r\n \r\n return $this;\r\n }", "public function create()\n {\n $thread = new Thread;\n $comment = new Comment;\n $page = Param::get('page_next', 'create');\n $username = $_SESSION['username'];\n\n switch ($page) {\n case 'create':\n break;\n case 'create_end';\n $thread->title = Param::get('title');\n $comment->username = $username;\n $comment->body = Param::get('body');\n try {\n $thread->create($comment);\n } catch (ValidationException $e) {\n $page = 'create';\n }\n break;\n default:\n throw new NotFoundException(\"{$page} is not found\");\n break;\n }\n\n $this->set(get_defined_vars());\n $this->render($page);\n }", "function save() {\n \tfile_put_contents(\"threads/{$this->id}\", serialize($this));\n }", "public function create()\n {\n\n return view(\"thread.create\");\n }", "public function store(Request $request)\n {\n $this->validate($request, Thread::$rules);\n\n try {\n $movie = Movie::getOrCreate($request->input('external_url'));\n\n Thread::verifyIfExists($movie);\n\n $thread = new Thread([\n 'rating' => $request->input('rating'),\n 'comment' => ($request->input('comment') == '') ? null : $request->input('comment'),\n ]);\n $thread->user()->associate(Auth::user());\n $thread->movie()->associate($movie);\n $thread->save();\n\n $tb = new TelegramBot();\n $tb->sendMessage($thread);\n\n flash()->success('Tudo Certo!', 'O título escolhido foi indicado com sucesso!');\n\n return redirect('/');\n } catch (\\Exception $e) {\n flash()->error('Ops!', $e->getMessage());\n\n return redirect()->back()->withInput();\n }\n }", "public function create($id)\n {\n $thread = $this->threadManager->createThread();\n $thread->setId($id);\n $thread->setPermalink($this->request->getUri());\n $this->threadManager->addThread($thread);\n\n return $thread;\n }", "public function push() {\r\n\t$clone = clone($this);\r\n\t$clone->position = count($_SESSION[\"STATE\"][$this->thread]);\r\n\t$_SESSION[\"STATE\"][$this->thread][$clone->position] = serialize($clone);\r\n\treturn $clone;\r\n}", "public function store(Request $request){\n $this->validate($request, []);\n\n try{\n $this->threads->create($request->all());\n return redirect()->route('admin.threads.index')->withMessage(trans('crud.record_created'));\n } catch (Exception $ex) {\n return redirect()->back()->withErrors($ex->getMessage())->withInput();\n }\n }", "public function store($slug, Thread $thread, ReplyRequest $request)\n {\n $reply = new Reply();\n $reply->fill($request->all());\n $reply->owner()->associate(auth()->user());\n $thread->addReply($reply);\n\n if ($request->wantsJson()) {\n return $reply->fresh();\n }\n\n return back();\n }", "public function store(Request $request)\n {\n $request->validate([\n 'reply' => 'required|max:255'\n ]);\n\n Reply::create($request->all());\n\n $url = '/thread' . '/' . $request->thread_id;\n return redirect($url);\n }", "public function push(Token $t)\n {\n if (!isset ($this->queue))\n return;\n \n array_push($this->queue, $t);\n }", "public function store($channelId, Thread $thread, Spam $spam)\n {\n $this->validate(request(), ['body' => 'required']);\n $spam->detect(request('body'));\n\n $reply = $thread->addReply([\n 'body' => request('body'),\n 'user_id' => auth()->id()\n ]);\n\n if (request()->expectsJson()) {\n return $reply->load('owner');\n }\n\n return back()->with('flash', 'Reply successfully created!');\n }", "protected function recordActivity($event)\n {\n $this->activity()->create([\n //type => created_thread\n 'type' => $event . '_' . strtolower(class_basename($this)),\n 'user_id' => auth()->id()\n ]);\n }", "public function create(ChannelContract $channel){\n return view('admin.threads.create')->with([\n 'channels' => $channel->get()\n ]);\n }", "function storeAndNew() {\n $this->store();\n }", "public function add(object $function): void\n {\n $this->_threads[] = $function;\n }", "public function createAction(Request $request)\n {\n $entity = new Thread();\n $form = $this->createCreateForm($entity);\n $form->handleRequest($request);\n\n if ($form->isValid()) {\n $em = $this->getDoctrine()->getManager();\n $em->persist($entity);\n $em->flush();\n\n return $this->redirect($this->generateUrl('thread_show', array('id' => $entity->getId())));\n }\n\n return $this->render('APiszczekDemoBundle:Thread:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n ));\n }", "public function run()\n {\n // User::factory()->count(15)->create();\n Thread::factory()->count(200)->create();\n }", "function createThread() {\n\t//create thread\n\techo $_POST[\"title\"] . \"<br/>\";\n\t$db = DB::$connection;\n\t$db->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING );\n\n\t$sql = \"INSERT INTO threads(title,userid,date) VALUES (?,?,NOW())\";\n\t$stmt = $db->prepare($sql);\n\t$stmt->execute(array(htmlspecialchars($_POST[\"title\"]),$_SESSION['currentUser']));\n\t$trd_id = $db->lastInsertId();\n\techo $trd_id;\n\n\t// post to thread\n\t$db->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING );\n\n\n\t$threadid = $trd_id;\n\t$postbody = $_POST[\"postbody\"];\n\t$userid = $_SESSION['currentUser'];\n\n\t// post to thread\n\t$sql = 'INSERT INTO posts(threadid,postbody,userid,date) VALUES(?,?,?,NOW())';\n\t$stmt = $db->prepare($sql);\n\t$stmt->execute(array(htmlspecialchars($threadid),($postbody),($userid)));\n\treturn $trd_id;\n}", "public function actionCreate()\n {\n $model = new Thread();\n $model->user_id = Yii::$app->user->id;\n\n $newCommentModel = new Comment();\n $newCommentModel->user_id = Yii::$app->user->id;\n\n $postData = Yii::$app->request->post();\n if ($model->load($postData) && $res = $model->save()) {\n $newCommentModel->load(Yii::$app->request->post());\n $newCommentModel->thread_id = $model->id;\n $newCommentModel->user_id = Yii::$app->user->id;\n $newCommentModel->save();\n\n return $this->redirect(['view', 'id' => $model->id]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n 'newCommentModel' => $newCommentModel,\n ]);\n }\n }", "public function registerWorker()\r\n {\r\n Resque::redis()->sadd('workers', $this);\r\n setlocale(LC_TIME, \"\");\r\n setlocale(LC_ALL, \"en\");\r\n Resque::redis()->set('worker:' . (string)$this . ':started', strftime('%a %b %d %H:%M:%S %Z %Y'));\r\n }", "public function create($channel, $data)\n {\n return $channel->threads()->create([\n 'title' => $data['title'],\n 'body' => $data['body'],\n 'user_id' => auth()->user()->id\n ]);\n }", "public function registerWorker()\n\t{\n\t\tResque::redis()->sadd('workers', (string)$this);\n\t\tResque::redis()->set('worker:' . (string)$this . ':started', date('c'));\n\t}", "public static function store(string $token): void\n\t{\n\t\tself::$token = $token;\n\t}", "public function store(StorePostRequest $request)\n {\n $data = $request->only('body');\n $data['thread_id'] = $request->id;\n $data['user_id'] = Auth::user()->id;\n $data['subforum_id'] = $request->subforum_id;\n\n $draft = config('app.draft');\n\n if (ThreadController::getUserRoleName(Auth::user()->id) === 'Administrator' || ThreadController::getUserRoleName(Auth::user()->id) === 'Moderator' || $draft == false) {\n $data['updated_at'] = null;\n $data['published'] = 1;\n $query = DB::table('threads')\n ->where('id', $request->id)\n ->update(['lastpost_uid' => Auth::user()->id, 'lastpost_date' => now()]);\n }\n\n $post = Post::create($data);\n\n return redirect()->route('index')->with('alert', 'Post has been saved successfully.');\n }", "public function create()\n {\n /**\n * Placeholder for now, only \"oisenon\" user can create thread\n * \n */\n if(Auth::user()->id !== 1){\n return 'Access denied.';\n }\n return view('threads.create');\n }", "public function store(Request $request, Forum $forum, Thread $thread)\n {\n // validate the post\n // TODO: more validation/authorizations\n\n $this->validate($request, [\n 'body' => 'required|min:6',\n 'author_id' => 'required',\n 'author_type' => 'required'\n ]);\n\n $author_id = request('author_id') === 'u' ? auth()->id() : request('author_id');\n\n $post = POST::make([\n 'thread_id' => $thread->id,\n 'author_id' => $author_id,\n 'author_type' => request('author_type'),\n 'body' => request('body')\n ])->toArray();\n\n $thread->addPost($post);\n\n return back();\n }", "function newthread( $args )\n\t{\n\t // if not logged in redirect\n\t if( !$this->app->user->is_logged_in() ){\n\t $this->app->redirect('user/login');\n\t }\n\t \n\t // get board id\n\t $board_id = (int) $args['id'];\n\t \n\t // get board info\n\t $boards_model = $this->app->\n\t model('forum_boards','forum/models');\n\t \n\t // get board item\n\t $board = $boards_model->get_item( $board_id );\n\t \n\t // check if board exists\n\t if( count($board) == 0 ){\n\t $this->app->redirect('forum');\n\t }\n\t \n\t // action message\n\t $action_message = null;\n\t \n\t \n\t \n\t // init failed submission values\n\t $name_value = '';\n\t $description_value = '';\n\t \n\t \n\t /* -------------------------\n\t * Check for form submission\n\t */\n\t if( $_SERVER['REQUEST_METHOD'] == 'POST' && \n\t isset( $_POST['name']) && \n\t $_POST['name'] != null &&\n\t isset( $_POST['description']) && \n\t $_POST['description'] != null\n\t ){\n\t \n\t // get threads model\n\t $threads_model = $this->app->\n\t model('forum_threads','forum/models');\n\t \n\t // add the new thread\n\t $success = $threads_model->\n\t new_item($this->app->user->get_user_id(), \n\t $board_id, $_POST );\n\t \n\t // test for success\n\t if( $success ){\n\t \n\t // get most recent thread\n\t $thread = $threads_model->last_thread();\n\t \n\t // increment thread count\n\t $boards_model->increment_thread($board_id);\n\t \n\t // redirect to the new thread\n\t $this->app->redirect('forum/thread/'.$thread['id']);\n\t }\n\t } elseif($_SERVER['REQUEST_METHOD'] == 'POST' ) {\n\t $action_message = \"One ore more required inputs were not \n\t provided.\";\n\t \n\t $name_value = 'value=\"'.$_POST['name'].'\"';\n\t $description_value = $_POST['description'];\n\t \n\t }\n\t \n\t // add init values\n\t $this->view->add('name_value',$name_value);\n\t $this->view->add('description_value',$description_value);\n\t \n\t // add action message\n\t $this->view->add('action_message',$action_message);\n\t \n\t \n\t \n\t /* -------------------------\n\t * Action paths defined here\n\t */\n\t \n\t // action on form submit\n\t $this->view->add('submit_action',\n\t $this->app->form_path('forum/newthread/'.$board_id));\n\t \n\t // get wysiwyg extension\n\t $wysiwyg = $this->app->extension('wysiwyg');\n\t \n\t // set page title\n\t $this->view->add('page_title','Create a new thread');\n\t \n\t}", "public function create(Request $request)\n {\n $this->authorize('create', Thread::class);\n\n return view('threads.create');\n }", "public function store(Request $request)\n {\n $input = $request->all();\n $thread = Thread::create(\n [\n 'subject' => $input['subject'],\n ]\n );\n // Message\n Message::create(\n [\n 'thread_id' => $thread->id,\n 'user_id' => Auth::user()->id,\n 'body' => $input['message'],\n ]\n );\n // Sender\n Participant::create(\n [\n 'thread_id' => $thread->id,\n 'user_id' => Auth::user()->id,\n 'last_read' => new Carbon(),\n ]\n );\n $thread->addParticipant($input['receiver']);\n $data['statues'] = \"200 Ok\";\n $data['error'] = null;\n $data['data'] = null;\n return response()->json($data, 200);\n\n }", "public function run()\n {\n \\App\\Thread::insert([\n [\n 'subject' => 'kelopo',\n 'thread' => 'kelopo ono opo kelopo ono opo kelopo ono opo kelopo ono opo',\n 'user_id' =>'1',\n 'created_at' => \\Carbon\\Carbon::now('Asia/Jakarta')\n ],\n [\n 'subject' => 'degan',\n 'thread' => 'degan ono opo kelopo ono opo kelopo ono opo kelopo ono opo',\n 'user_id' =>'2',\n 'created_at' => \\Carbon\\Carbon::now('Asia/Jakarta')\n ],\n [\n 'subject' => 'sayur',\n 'thread' => 'sayur ono opo kelopo ono opo kelopo ono opo kelopo ono opo',\n 'user_id' =>'4',\n 'created_at' => \\Carbon\\Carbon::now('Asia/Jakarta')\n ],\n ]);\n }", "function thread( $args )\n\t{\n\t $thread_id = (int)$args['id'];\n\t \n\t // check for existance, use threads model\n\t $threads_model = $this->app->\n\t model('forum_threads','forum/models');\n\t \n\t\t// boards model\n\t\t$boards_model = $this->app->\n\t\t model('forum_boards', 'forum/models'); \n\t \n\t // posts model\n\t $posts_model = $this->app->\n\t model('forum_posts','forum/models');\n\t \n\t // get item\n\t $thread = $threads_model->get_item( $thread_id );\n\t $thread = ( count($thread) > 0 ) ? $thread[0] : null;\n\t \n\t \n\t // imprtant stuffs\n\t if( $thread == null ){\n\t \n\t \t// redirect\n\t \t$this->app->redirect('forum');\n\t }\n\t \n\t \n // get board\n $board = $boards_model->get_item((int)$thread['board_id']);\n $board = $board[0];\n \n // set page title\n $this->view->add('page_title',\n 'Viewing thread: ' . $thread['name'] );\n \n // set index action\n $this->view->add('index_action',\n $this->app->form_path('forum'));\n \n // set board action\n $this->view->add('board_action',\n $this->app->form_path('forum/board/'.$board['id']));\n \n // good\n $this->view->add('board_name', $board['name'] );\n\t \n\t // need an action message\n\t $action_message = null;\n\t \n\t // init text area values\n\t $name_value = '';\n\t $post_value = '';\n\t \n\t \n\t // check for post\n\t if( $_SERVER['REQUEST_METHOD'] == 'POST' &&\n\t \tisset($_POST['name']) &&\n\t \t$_POST['name'] != null &&\n\t \tisset($_POST['post']) &&\n\t \t$_POST['name'] != null \n\t ){\n\t \t\n\t \t// add success\n\t \t$success = $posts_model->new_item( \n\t \t\t$this->app->user->get_user_id(), $thread_id, $_POST );\n\t \t\n\t \t// test for success\n\t \tif( $success ){\n\t \t\n\t \t\t// increment reply count\n\t \t\t$threads_model->increment_reply( $thread_id );\n\t \t\t\t \t\n\t \t\t$action_message = 'Post successfully added.';\n\t \t} else {\n\t \t\t$action_message = 'There was an error adding your post';\n\t \t}\n\t \t\n\t } elseif( $_SERVER['REQUEST_METHOD'] == 'POST' ) {\n\t \t\n\t \t$action_message = 'One or more required fields was not\n\t \t\tprovided';\n\t \t\t\n\t \t// update values\n\t\t\t$name_value = 'value=\"'.$_POST['name'].'\"';\n\t\t\t$post_value = $_POST['post'];\n\t }\n\t \n\t \n\t // add them\n\t $this->view->add('name_value',$name_value);\n\t $this->view->add('post_value',$post_value);\n\t \n\t // add actio message\n\t $this->view->add('action_message',$action_message);\n\t \n\t // get limits\n\t $limit = 10;\n\t \n\t // get page\n\t $page = 0;\n\t if( isset($_GET['p']) ){\n\t $page = (int)$_GET['p'];\n\t }\n\t \n\t // get replies\n\t $posts_result = $posts_model->limit($limit)->page($page)->\n\t get_all($thread_id);\n\t \n\t //\n\t $this->view->add('posts_result',$posts_result);\n\t \n\t $reply_count = ($thread==null) ? 0 :(int)$thread['reply_count'];\n\t \n\t // add paging\n\t $this->view->add('page_info',array(\n\t // posts count\n\t 'page_count' => (int)(($reply_count) / $limit)+1,\n\t 'this_page' => $page\n\t ));\n\t \n\t \n\t // add actions\n\t $this->view->add('page_action',\n\t $this->app->form_path('forum/thread/'.$thread_id.'?p='));\n\t \n\t $this->view->add('reply_action',$this->app->\n\t form_path('forum/thread/'.$thread_id.'?p='.$page));\n\t \n\t \n\t // add to the view\n\t $this->view->add('thread_result',$thread);\n\t \n\t \n\t // get wysiwyg extension\n\t $wysiwyg = $this->app->extension('wysiwyg');\n\t \n\t}", "public function read(Thread $thread)\n {\n cache()->forever($this->visitedThreadCacheKey($thread), \\Carbon\\Carbon::now());\n }", "public function run()\n {\n $threads = factory('App\\Thread', 20)->create();\n\n $threads->each(function($thread) {\n factory('App\\Reply', 6)->create(['thread_id' => $thread->id]);\n });\n }", "public function store(Request $request)\n {\n $message = new MessageThreadMessage($request->all());\n $message->thread_id = $request->input('threadId');\n $message->user_id = Auth::user()->id;\n $message->save();\n // TODO: Reload user for data sent back to client\n $message->load('postedBy');\n // TODO: If there's an attachment, add it\n return response()->json($message);\n }", "public static function install(){\n\t\t\n\t\tAnta_Core::mysqli()->query(\"\n\t\t\tCREATE TABLE `anta`.`threads` (\n\t\t\t\t`id_thread` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,\n\t\t\t\t`id_routine` INT NOT NULL ,\n\t\t\t\t`type` VARCHAR( 2 ) NOT NULL ,\n\t\t\t\t`order` INT( 0 ) NOT NULL ,\n\t\t\t\t`status` VARCHAR( 10 ) NOT NULL DEFAULT 'ready' COMMENT 'ready | done | working',\n\t\t\t\tINDEX ( `type` , `order` , `status` )\n\t\t\t) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci\"\n\t\t);\n\n\t}", "public function updated(Thread $thread)\n {\n //\n }", "protected function store($token) {\n\t\tSession::put($this->token(), $token);\n\t}", "private function storeCacheSetting()\n {\n Cache::forever('setting', $this->setting->getKeyValueToStoreCache());\n }", "public function test_an_authenticated_user_can_create_a_new_forum_threads()\n {\n $this->signIn();\n\n //we hit the end point to create anew thread\n\n $thread = make('App\\Thread');\n\n\n $response = $this->post('/thread', $thread->toArray());\n\n // dd($response->headers->get('Location'));\n //when we visit the thread page\n\n //we should see the new thread\n $this->get($response->headers->get('Location'))\n ->assertSee($thread->title)\n ->assertSee($thread->body);\n\n //we should see the new thread\n //\n\n }", "public function newAction()\n {\n $entity = new Thread();\n $form = $this->createCreateForm($entity);\n\n return $this->render('APiszczekDemoBundle:Thread:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n ));\n }", "public function create()\n {\n return view('threads.create');\n }", "public function create()\n {\n return view('threads.create');\n }", "public function create()\n {\n return view('threads.create');\n }", "public function create()\n {\n return view('threads.create');\n }", "public function create()\n {\n return view('threads.create');\n }", "public function create()\n {\n return view('threads.create');\n }", "public function write() {\n\t\t$this->loadModel('Thread');\n\t\tif ($this->request->is('post')) {\n $this->Thread->set('user_id', $this->Auth->user('id'));\n $this->Thread->set('forums_id', $this->params['pass'][0]);\n if ($this->Thread->save($this->request->data)) {\n $this->Session->setFlash('Din tråd har sparats.');\n $this->redirect(array('action' => 'index'));\n } else {\n $this->Session->setFlash('Kunde inte spara tråden.');\n }\n }\n\t}", "public function store(Request $request)\n {\n //\n $this->validate($request, [\n 'title' => 'required',\n 'description' => 'required',\n 'cover_image' => 'image|nullable|max:1999'\n ]);\n \n // image upload\n if($request->hasFile('cover_image')){\n // get filename with ext\n $filenameWithExt = $request->file('cover_image')->getClientOriginalName();\n // get filename only\n $filename = pathinfo($filenameWithExt, PATHINFO_FILENAME);\n // get ext only\n $extension = $request->file('cover_image')->getClientOriginalExtension();\n // file name to store\n $fileNameToStore = $filename.'_'.time().'.'.$extension;\n\n // upload\n $path = $request->file('cover_image')->storeAs('public/cover_images', $fileNameToStore);\n } \n else{\n $fileNameToStore = 'noimage.jpg';\n } \n\n // create thread\n $thread = new Thread;\n $thread->name = $request->input('title');\n $thread->description = $request->input('description');\n $thread->miscellaneous = $request->input('miscellaneous');\n $thread->cover_image = $fileNameToStore;\n $thread->save();\n\n return redirect('/threads')->with('success', 'Thread Created');\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n Factory('App\\Thread', 50)->create();\n $thread = \\App\\Thread::all()->last();\n Factory('App\\Reply', 30)->create(['thread_id' => $thread->id]);\n }", "private function storeWatch($video)\n\t{\n\t $this->session->push('watched_video', $video->id);\n\t}", "public function __construct(Thread $thread, Reply $reply)\n {\n $this->thread = $thread;\n $this->reply = $reply;\n }", "public function store(Request $request,Recaptcha $recaptcha)\n {\n $this->validate($request, [\n 'title' => 'required', new Spamfree,\n 'body' => 'required', new Spamfree,\n 'channel_id' => 'required|exists:channels,id',\n 'g-recaptcha-response' => 'required',$recaptcha\n ]);\n\n $response = Http::asForm()->post('https://www.google.com/recaptcha/api/siteverify', [\n 'secret' => config('services.recaptcha.secret'),\n 'response' => $request->input('g-recaptcha-response'),\n 'remoteip' => request()->ip()\n ]);\n\n $thread = Thread::create([\n 'user_id' => Auth::id(),\n 'channel_id' => $request->channel_id,\n 'title' => $request->title,\n 'body' => $request->body,\n 'slug' => $request->title\n ]);\n\n return redirect($thread->path())\n ->with('flash','Your thread has been published');\n }", "public function store()\n\t{\n\t\t\n\t\t//\n\t}", "private function storePost($post) {\n // in the session. Laravel allows us to use a nested key\n // so that we can set the post id key on the viewed_posts\n // array.\n $key = 'viewed_posts.' . $post->id;\n\n // Then set that key on the session and set its value\n // to the current timestamp.\n $this->session->put($key, time());\n }", "public function write( $path, $value )\n\t{\n\t\tif ( !static::isValidThreadPath( $path ) )\n\t\t\tthrow new \\InvalidArgumentException( 'invalid thread path' );\n\n\t\t$cb = function( $stage, &$scope, &$result, $passed, $current, $next ) use ($value)\n\t\t{\n\t\t\tswitch ( $stage )\n\t\t\t{\n\t\t\t\tcase set::STAGE_MISSING :\n\t\t\t\t\tif ( count( $next ) )\n\t\t\t\t\t\t$scope[$current] = array();\n\t\t\t\t\telse\n\t\t\t\t\t\t$scope[$current] = null;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase set::STAGE_MATCH :\n\t\t\t\t\t$result = true;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase set::STAGE_BUBBLE :\n\t\t\t\t\tif ( $result )\n\t\t\t\t\t{\n\t\t\t\t\t\t$scope[$current] = $value;\n\t\t\t\t\t\t$result = false;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t};\n\n\t\t$result = false;\n\n\t\tstatic::processThread( $this->data, $result, $path, null, $cb );\n\t}", "public function testLoggedUserCanCreateThread()\n {\n $user = \\factory(User::class)->states('activated')->create();\n\n $this->actingAs($user, 'api')->postJson('api/threads', ['title' => 'Hello world!', 'body' => 'hello every one.', 'ticket' => 'mock-ticket'])\n ->assertStatus(201)\n ->assertJsonStructure(['title', 'user_id', 'content' => ['body']])\n ->assertJsonFragment(['title' => 'Hello world!', 'body' => 'hello every one.']);\n\n $this->actingAs($user, 'api')->patchJson('api/threads/1', [\n 'title' => 'The New Title',\n 'body' => 'updated content.',\n ])->assertJsonFragment([\n 'title' => 'The New Title',\n 'body' => 'updated content.',\n ]);\n }", "public function run()\n {\n DB::table('threads')->insert([\n [\n 'user_id' => \"1\",\n 'threadtitle' => \"Sample Thread 1\",\n 'threaddetails' => \"sample description\",\n 'slug' => \"sample-thread-1\",\n 'created_at' => Carbon::now()->format('Y-m-d H:i:s'),\n 'updated_at' => Carbon::now()->format('Y-m-d H:i:s'),\n ],\n [\n 'user_id' => \"1\",\n 'threadtitle' => \"Sample Thread 2\",\n 'threaddetails' => \"sample description 2\",\n 'slug' => \"sample-thread-2\",\n 'created_at' => Carbon::now()->format('Y-m-d H:i:s'),\n 'updated_at' => Carbon::now()->format('Y-m-d H:i:s'),\n ],\n [\n 'user_id' => \"1\",\n 'threadtitle' => \"Sample Thread 3\",\n 'threaddetails' => \"sample description3\",\n 'slug' => \"sample-thread-3\",\n 'created_at' => Carbon::now()->format('Y-m-d H:i:s'),\n 'updated_at' => Carbon::now()->format('Y-m-d H:i:s'),\n ] \n ]);\n }", "public function read($thread)\n\t{\n\t\tcache()->forever($this->visitedThreadCacheKey($thread), now());\n\t}", "public function store()\n\t {\n\t //\n\t }", "public function read($thread){\n //which means, the user has visited this thread\n cache()->forever(\n $this->visitedThreadCacheKey($thread), \n \\Carbon\\Carbon::now()\n );\n }" ]
[ "0.67814606", "0.60974586", "0.6010781", "0.6008035", "0.5955583", "0.5876444", "0.5820617", "0.5720615", "0.57027435", "0.569007", "0.5673161", "0.56156516", "0.555691", "0.5545452", "0.55090624", "0.53459036", "0.5336149", "0.5322128", "0.5304469", "0.52239645", "0.5203441", "0.5186678", "0.5171316", "0.513828", "0.5137199", "0.5132264", "0.5092033", "0.5089348", "0.50827736", "0.5077978", "0.5062131", "0.5052282", "0.504153", "0.50398266", "0.49966612", "0.49780115", "0.49568763", "0.4943683", "0.491956", "0.4900658", "0.4899331", "0.4889619", "0.48675913", "0.48433542", "0.47851795", "0.4754533", "0.47364423", "0.47100937", "0.4698239", "0.46749043", "0.4669619", "0.46550888", "0.46381518", "0.46242064", "0.46057123", "0.457167", "0.45657775", "0.45635942", "0.456181", "0.4539533", "0.4535565", "0.4532198", "0.45298484", "0.45293748", "0.45069227", "0.44842905", "0.44801006", "0.44672707", "0.44469228", "0.44396597", "0.44031313", "0.43977004", "0.43947938", "0.43862867", "0.438581", "0.43821463", "0.4363355", "0.43537685", "0.43337524", "0.43227705", "0.43217215", "0.43217215", "0.43217215", "0.43217215", "0.43217215", "0.43217215", "0.4312203", "0.4300273", "0.42919594", "0.4286919", "0.4274432", "0.42592973", "0.42562097", "0.42517322", "0.42248037", "0.42169335", "0.42107102", "0.4210487", "0.42070115", "0.42067912" ]
0.5722436
7
$tripList>printList(); test inList() $tripList>inList('stop_name', 'HOHOKUS'); helper functions// function takes a train station and returns the next $num trains
function nextTrains($database, $stop_id, $time, $num) { //get next $num of trains leaving after $time from $stop_id $query = array("stop_id" => $stop_id, "departure_time" => array('$gt' => $time)); $cursor = $database->stop_times->find( $query )->sort(array("departure_time" => 1))->limit($num); //print("\nnextTrains\n"); //print_debug($cursor); return ($cursor); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getTrains($station) {\n\n\t\t$retval = array();\n\t\t$redis_key = \"station/getTrains-${station}\";\n\t\t//$redis_key .= time(); // Debugging\n\n\t\tif ($retval = $this->redisGet($redis_key)) {\n\t\t\treturn($retval);\n\n\t\t} else {\n\n\t\t\t$query = 'search index=\"septa_analytics\" '\n\t\t\t\t. 'earliest=-24h late != 999 '\n\t\t\t\t. 'nextstop=\"' . $station . '\" '\n\t\t\t\t. '| eval time=strftime(_time,\"%Y-%m-%dT%H:%M:%S\") '\n\t\t\t\t. '| stats max(late) AS \"Minutes Late\", max(time) AS \"time\", max(train_line) AS \"Train Line\" by trainno '\n\t\t\t\t. '| sort time desc';\n\n\t\t\t$retval = $this->query($query);\n\t\t\t$retval[\"metadata\"][\"_comment\"] = \"Most recent trains that have arrived at the station named '$station'\";\n\n\t\t\t$this->redisSet($redis_key, $retval);\n\t\t\treturn($retval);\n\n\t\t}\n\n\n\t}", "function nextTrip($database, $trip_id, $stop_seq)\n\t{\n\t\t//gets the trip\n\t\t$query = array(\"trip_id\" => $trip_id, \"stop_sequence\" => array('$gte' => $stop_seq));\n\t\t$cursor = $database->stop_times->find( $query )->sort(array(\"stop_sequence\" => 1));\n\n\t\t//print_debug($cursor);\n\t\t//print_r($cursor);\n\t\t\n\t\treturn ($cursor);\n\t}", "function snameList()\r\n{\r\n\t// --------- GLOBALIZE ---------\r\n\tglobal $db;\r\n\t// --------- CONVERT TO INT ---------\r\n\t$id = intval(GET_INC('id'));\r\n\t// --------- GET LIST ---------\r\n\t$db->connDB();\r\n\t$db->query(\"SELECT station FROM bus_circuit WHERE id={$id};\");\r\n\t$res = $db->fetch_array();\r\n\t$res = explode(',',$res['station']);\r\n\t// first write?\r\n\t$fw = true;\r\n\tforeach ( $res as $v )\r\n\t{\r\n\t\tif ( !$fw )\r\n\t\t{\r\n\t\t\techo ';';\r\n\t\t}else{\r\n\t\t\t$fw = false;\r\n\t\t}\r\n\t\techo $v;\r\n\t\techo '&';\r\n\t\t$db->free();\r\n\t\t$db->query(\"SELECT name FROM bus_sname WHERE id={$v} AND is_primary=1;\");\r\n\t\t$r = $db->fetch_array();\r\n\t\techo $r['name'];\r\n\t}\r\n\t$db->closeDB();\r\n}", "function add_stopout_list($data)\n\t{\n\t\t$this->db->insert('pamm_stopout_list',$data);\n\t}", "public function speeduplistAction()\n {\n $uid = $this->_USER_ID;\n $floorId = $this->getParam('CF_floorId');\n $storeType = $this->getParam(\"CF_storeType\");\n //chair id from giveservice page\n $chairId = $this->getParam(\"CF_chairid\");\n\n $mbllApi = new Mbll_Tower_ServiceApi($uid);\n $aryRst = $mbllApi->getSpeedUpList($floorId);\n $speedUpList = $aryRst['result'];\n\n if (!$aryRst) {\n $errParam = '-1';\n if (!empty($aryRst['errno'])) {\n $errParam = $aryRst['errno'];\n }\n return $this->_redirectErrorMsg($errParam);\n }\n\n if (!isset($speedUpList[17])) {\n $speedUpList[17]['id'] = 17;\n $speedUpList[17]['nm'] = 0;\n }\n if (!isset($speedUpList[18])) {\n $speedUpList[18]['id'] = 18;\n $speedUpList[18]['nm'] = 0;\n }\n if (!isset($speedUpList[19])) {\n $speedUpList[19]['id'] = 19;\n $speedUpList[19]['nm'] = 0;\n }\n if (!isset($speedUpList[28])) {\n $speedUpList[28]['id'] = 28;\n $speedUpList[28]['nm'] = 0;\n }\n if (!isset($speedUpList[29])) {\n $speedUpList[29]['id'] = 29;\n $speedUpList[29]['nm'] = 0;\n }\n if (!isset($speedUpList[1119])) {\n $speedUpList[1119]['id'] = 1119;\n $speedUpList[1119]['nm'] = 0;\n }\n\n if (!empty($speedUpList)) {\n //add item name and desc\n foreach ($speedUpList as $key => $value) {\n $item = Mbll_Tower_ItemTpl::getItemDescription($value['id']);\n $speedUpList[$key]['name'] = $item['name'];\n $speedUpList[$key]['des'] = $item['desc'];\n if ($item['buy_mb'] > 0) {\n $speedUpList[$key]['money_type'] = 'm';\n }\n else if ($item['buy_gb'] > 0) {\n $speedUpList[$key]['money_type'] = 'g';\n }\n }\n }\n\n $this->view->userInfo = $this->_user;\n $this->view->speedUpList = $speedUpList;\n $this->view->floorId = $floorId;\n $this->view->chairId = $chairId;\n $this->view->storeType = $storeType;\n $this->render();\n }", "public function index()\n {\n $this->list_trip();\n }", "private function computeOpenSchedules($list) {\n\n // print_array($list, 'input');\n // echo '<br>';\n\n $st = array();\n $et = array();\n $final = array();\n $start = 7;\n $end = 21;\n $temp = $start;\n\n while($temp < $end) {\n array_push( $st, number_format((float)$temp, 2, ':', '') );\n $temp++;\n }\n\n $temp = $start++;\n while( $start <= $end ) {\n array_push( $et, number_format((float)$start, 2, ':', '') );\n $start++;\n }\n\n // print_array($st, 'start_time');\n // print_array($et, 'end_time');\n // echo '<br>';\n\n foreach( $list as $val ) {\n $times = explode(\"-\", $val);\n $start_time = trim($times[0]);\n $end_time = trim($times[1]);\n\n $range = $this->find_range($start_time, $end_time);\n \n if (($key = array_search($start_time, $st)) !== false) {\n unset($st[$key]);\n }\n\n if (($key = array_search($end_time, $et)) !== false) {\n unset($et[$key]);\n }\n\n foreach($range as $time) {\n if (($key = array_search($time, $st)) !== false) {\n unset($st[$key]);\n }\n\n if (($key = array_search($time, $et)) !== false) {\n unset($et[$key]);\n }\n }\n }\n\n $st = array_values($st);\n $et = array_values($et);\n\n $this->print_array($st, 'start_time');\n $this->print_array($et, 'end_time');\n echo '<br>';\n\n if(count($st) >= count($et)) {\n for($idx = 0; $idx < count($st); $idx++){\n array_push($final, new Time($st[$idx], $et[$idx]));\n }\n } \n return $final;\n }", "function multipleLayerNeurons($start) {\n\t\tfor($i = 0; $i < 10; $i++) \n\t\t\t$this->layerNeurons( $start + $i , 0 );\n\t}", "public function getTrainDetails(){\n $day = $this->_request['day'];\n $sourceCity = $this->_request['sourceCity'];\n $destinationCity = $this->_request['destinationCity'];\n if ($day=='' && $sourceCity=='' && $destinationCity=='')\n $sql=\"select * from train\";\n else if($day=='' && $sourceCity!='' && $destinationCity=='')\n $sql=\"select * from train where FromStation = '$sourceCity'\";\n else if($day=='' && $sourceCity!='' && $destinationCity!='')\n $sql=\"select * from train where FromStation = '$sourceCity' AND ToStation = '$destinationCity'\";\n else if($day=='' && $sourceCity=='' && $destinationCity!='')\n $sql=\"select * from train where ToStation = '$destinationCity' \";\n else if($day!='' && $sourceCity!='' && $destinationCity!='')\n $sql=\"select * from train where $day = 1 AND FromStation = '$sourceCity' AND ToStation = '$destinationCity' \";\n else if($day!='' && $sourceCity=='' && $destinationCity!='')\n $sql=\"select * from train where $day = 1 AND ToStation = '$destinationCity' \";\n else if($day!='' && $sourceCity!='' && $destinationCity=='')\n $sql=\"select * from train where FromStation = '$sourceCity' AND $day = 1\";\n else if($day!='' && $sourceCity=='' && $destinationCity=='')\n $sql=\"select * from train where $day = 1\";\n $rows = $this->executeGenericDQLQuery($sql);\n $trainDetails= array();\n for($i=0 ; $i<sizeof($rows);$i++)\n {\n $trainDetails[$i]['TrainID'] = $rows[$i]['TrainID'];\n $trainDetails[$i]['TrainNumber'] = $rows[$i]['TrainNumber'];\n $trainDetails[$i]['TrainName'] = $rows[$i]['TrainName'];\n $trainDetails[$i]['FromStation'] = $rows[$i]['FromStation'];\n $trainDetails[$i]['ToStation'] = $rows[$i]['ToStation'];\n $trainDetails[$i]['StartAt'] = $rows[$i]['StartAt'];\n $trainDetails[$i]['ReachesAt'] = $rows[$i]['ReachesAt'];\n $trainDetails[$i]['Monday'] = $rows[$i]['Monday'];\n $trainDetails[$i]['Tuesday'] = $rows[$i]['Tuesday'];\n $trainDetails[$i]['Wednesday'] = $rows[$i]['Wednesday'];\n $trainDetails[$i]['Thursday'] = $rows[$i]['Thursday'];\n $trainDetails[$i]['Friday'] = $rows[$i]['Friday'];\n $trainDetails[$i]['Saturday'] = $rows[$i]['Saturday'];\n $trainDetails[$i]['Sunday'] = $rows[$i]['Sunday'];\n // $trainDetails[$i]['CityID'] = $rows[$i]['CityID'];\n $trainDetails[$i]['WebLink'] = $rows[$i]['WebLink'];\n }\n $this->response($this->json($trainDetails), 200);\n\n }", "public function NextDepartures() {\r\n\t\t\t\r\n\t\t}", "function get_flight_from_ws($airline, $depcode, $descode, $depdate, $retdate, $direction=1, $format='json'){\n\t\n\t$airline = strtoupper(trim($airline));\n\t$depcode = strtoupper(trim($depcode));\n\t$descode = strtoupper(trim($descode));\n\t$depdate = str_replace('/','-',$depdate);\n\t$retdate = isset($retdate) && !empty($retdate) ? str_replace('/','-',$retdate) : $depdate; \n\t$api_key = '70cd2199f6dc871824ea9fed45170af354ffe9e6';\n \n $timeout = 30;\n \n\tif ($airline == 'VN' || $airline == 'QH') {\n $urls = array(\n // 'http://fs2.vietjet.net',\n 'http://fs3.vietjet.net',\n 'http://fs4.vietjet.net',\n 'http://fs5.vietjet.net',\n 'http://fs6.vietjet.net',\n 'http://fs7.vietjet.net',\n 'http://fs8.vietjet.net',\n 'http://fs9.vietjet.net',\n 'http://fs10.vietjet.net',\n 'http://fs11.vietjet.net',\n 'http://fs12.vietjet.net',\n 'http://fs13.vietjet.net',\n 'http://fs14.vietjet.net',\n 'http://fs15.vietjet.net',\n 'http://fs16.vietjet.net',\n 'http://fs17.vietjet.net',\n 'http://fs18.vietjet.net',\n 'http://fs19.vietjet.net',\n 'http://fs20.vietjet.net',\n 'http://fs21.vietjet.net',\n 'http://fs22.vietjet.net',\n 'http://fs23.vietjet.net',\n 'http://fs24.vietjet.net',\n 'http://fs25.vietjet.net',\n 'http://fs26.vietjet.net',\n 'http://fs27.vietjet.net',\n 'http://fs28.vietjet.net',\n 'http://fs29.vietjet.net',\n 'http://fs30.vietjet.net',\n );\n } else if ($airline == 'VJ' || $airline == 'BL'){\n $timeout = 35;\n $urls = array(\n 'http://fs2.vietjet.net',\n );\n }\n\n shuffle($urls);\n $url = $urls[array_rand($urls)];\n\t$url .= '/index.php/apiv1/api/flight_search/format/'.$format;\n\t$url .= '/airline/'.$airline.'/depcode/'.$depcode.'/descode/'.$descode.'/departdate/'.$depdate.'/returndate/'.$retdate.'/direction/'.$direction;\n\n\t$curl_handle = curl_init();\n\tcurl_setopt($curl_handle, CURLOPT_URL, $url);\n\tcurl_setopt($curl_handle, CURLOPT_ENCODING, 'gzip');\n\tcurl_setopt($curl_handle, CURLOPT_TIMEOUT, $timeout);\n curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, $timeout);\n\tcurl_setopt($curl_handle, CURLOPT_HTTPHEADER, array('X-API-KEY: '.$api_key));\n\tcurl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);\n $buffer = curl_exec($curl_handle);\n\n curl_close($curl_handle);\n $result = json_decode($buffer, true);\n\n\treturn $result;\n}", "function init(array $list)\n{\n return take(\\count($list) - 1)($list);\n}", "function getTrainsLatest($station) {\n\n\t\t$retval = array();\n\t\t$redis_key = \"station/getTrainsLatest-${station}\";\n\n\t\tif ($retval = $this->redisGet($redis_key)) {\n\t\t\treturn($retval);\n\n\t\t} else {\n\t\t\t$query = 'search index=\"septa_analytics\" '\n\t\t\t\t\t. 'earliest=-24h late != 999 '\n\t\t\t\t\t. 'nextstop=\"' . $station . '\" '\n\t\t\t\t\t. '| eval time=strftime(_time,\"%Y-%m-%dT%H:%M:%S\") '\n\t\t\t\t\t. '| eval id = trainno . \"-\" . dest '\n\t\t\t\t\t. '| stats max(late) AS \"Minutes Late\", max(time) AS \"time\", max(train_line) AS \"Train Line\" by id '\n\t\t\t\t\t. '| sort \"Minutes Late\" desc '\n\t\t\t\t\t. '| head '\n\t\t\t\t\t. '| chart max(\"Minutes Late\") AS \"Minutes Late\" by id '\n\t\t\t\t\t. '| sort \"Minutes Late\" desc';\n\n\t\t\t$retval = $this->query($query);\n\t\t\t$retval[\"metadata\"][\"_comment\"] = \"Latest trains that have arrived at the station named '$station'\";\n\n\t\t\t$this->redisSet($redis_key, $retval);\n\t\t\treturn($retval);\n\n\t\t}\n\n\t}", "function getLessIndex($packList,$start,$num)\n{\n for ($i=$start;$i<count($packList);$i++)\n {\n if((int)$packList[$i]['pack_of']>$num)\n {\n $i++;\n }else{\n return $i;\n }\n }\n}", "public function show(Listt $listt)\n {\n //\n }", "function listWorkflows($page = null, $rownums = null);", "function fann_get_train_stop_function($ann)\n{\n}", "function createKiltPinsListings()\n{\n\t$id = NULL;\n\t$count = 0;\n\t$clanName = NULL;\n\t$surname = NULL;\n\t$surname_list = NULL;\n\t$complete_list = NULL;\n\n\t$query = \"SELECT * FROM clan WHERE active = 1;\";\n\t// $query = \"SELECT * FROM clan WHERE active = 1 AND id > 323;\";\n\t// $query = \"SELECT * FROM clan WHERE active = 4;\"; // use this for any image uploads that failed.\n\t$result = @mysql_query($query); // Run the query.\n\tif($result)\n\t{\n\t\twhile($row = mysql_fetch_array($result, MYSQL_ASSOC))\n\t\t{\n\t\t\t$id = $row['Id'];\n\t\t\t$clanName = $row['name'];\n\t\t\t\n\t\t\t$complete_list = \"Kilt Pins Clan \" . $clanName . \":\";\n\t\t\tif(strlen($complete_list) < 55)\n\t\t\t{\n\t\t\t\t// Now run another query to get all surnames linked to clan.\n\t\t\t\t$query2 = \"SELECT surnames.* FROM surnames, clan_surnames, clan WHERE clan.Id = \" . $id . \" AND clan_surnames.clan_id = clan.Id AND clan_surnames.surname_id = surnames.Id;\";\n\t\t\t\t$result2 = @mysql_query($query2); // Run the query.\n\t\t\t\tif($result2)\n\t\t\t\t{\n\t\t\t\t\twhile($row2 = mysql_fetch_array($result2, MYSQL_ASSOC))\n\t\t\t\t\t{\n\t\t\t\t\t\t$surname = $row2['name'];\n\t\t\t\t\t\tif((strlen(\"Kilt Pins Clan \" . $clanName . \":\" . $surname_list) + strlen($surname)) < 55) {\n\t\t\t\t\t\t\t$surname_list .= \" \" . $surname;\n\t\t\t\t\t\t\t$complete_list .= \" \" . $surname;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Now perform insertion into kilt_pin_listing table in the DB.\n\t\t\t\t\t\t\t$query3 = \"INSERT INTO kilt_pins_listing(Id, clan_id, clan_name, surname_list, active, date_time) \nVALUES('', $id, '$clanName', '$surname_list', 1, NOW());\";\n\t\t\t\t\t\t\t$result3 = @mysql_query($query3); // Run the query.\n\t\t\t\t\t\t\tif($result3)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t// Insert successfull.\n\t\t\t\t\t\t\t\t$int_id = mysql_insert_id();\n\t\t\t\t\t\t\t\t$surname_list = \" \" . $surname;\n\t\t\t\t\t\t\t\t$complete_list = \"Kilt Pins Clan \" . $clanName . \":\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// System.out.println(\"*** \" + surname_list);\n\t\t\t\t\t\t\t$count++;\n\t\t\t\t\t\t\t// $surname_list = \"Clan \" . $clanName . \" Kilt Pin:\";\n\t\t\t\t\t\t\t// System.out.println(\"\\tCount is \" + count);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// If the surnames while is complete, we still may have to add one last entry.\n\t\t\t\t\t// Just check that the complete list is less than 56 characters.\n\t\t\t\t\tif(strlen($complete_list) < 55)\n\t\t\t\t\t{\n\t\t\t\t\t\t$query3 = \"INSERT INTO kilt_pins_listing(Id, clan_id, clan_name, surname_list, active, date_time) \n\tVALUES('', $id, '$clanName', '$surname_list', 1, NOW());\";\n\t\t\t\t\t\t$result3 = @mysql_query($query3); // Run the query.\n\t\t\t\t\t\tif($result3)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Insert successfull.\n\t\t\t\t\t\t\t$int_id = mysql_insert_id();\n\t\t\t\t\t\t\t$surname_list = \"\";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t\n\techo \"<Ack>Success</Ack>\";\n}", "function get_order_indicator_of_list($list_string) {\r\n\t\tpreg_match('/ type=\"([^\"]*?)\"/is', $list_string, $type_match);\r\n\t\tpreg_match('/ start=\"([^\"]*?)\"/is', $list_string, $start_match);\r\n\t\t$type = $type_match[1];\r\n\t\t$start = $start_match[1];\r\n\t\tif($type === \"1\") {\r\n\t\t\treturn $start;\r\n\t\t} elseif($type === \"A\") {\r\n\t\t\treturn ReTidy::decimal_to_alphabetical($start);\r\n\t\t} elseif($type === \"a\") {\r\n\t\t\treturn strtolower(ReTidy::decimal_to_alphabetical($start));\r\n\t\t} elseif($type === \"I\") {\r\n\t\t\treturn ReTidy::decimal_to_roman_numeral($start);\r\n\t\t} elseif($type === \"i\") {\r\n\t\t\treturn strtolower(ReTidy::decimal_to_roman_numeral($start));\r\n\t\t} else {\r\n\t\t\tprint(\"<span style=\\\"color: red;\\\"> should never get here (get_order_indicator_of_list) 238384905484749</span><br>\\r\\n\");\r\n\t\t\tprint(\"list_string: \");var_dump($list_string);\r\n\t\t\tprint(\"type: \");var_dump($type);\r\n\t\t\tprint(\"start: \");var_dump($start);\r\n\t\t}\r\n\t}", "function get_other_buses($stopcode)\n{\n\n\t$url = \"http://api.bus.southampton.ac.uk/stop/\" . $stopcode . \"/buses\";\n\t$data = json_decode(file_get_contents($url), true);\n\t$ret = array();\n\tforeach($data as $item)\n\t{\n\t\t$operator = preg_replace(\"#^([^/]+)/.*$#\", \"$1\", $item['id']);\n\t\tif(strcmp($operator, \"BLUS\") == 0) { continue; }\n\t\tif(strcmp($operator, \"UNIL\") == 0) { continue; }\n\n\t\t$bus = array();\n\t\t$bus['name'] = $item['name'];\n\t\t$bus['dest'] = $item['dest'];\n\t\t$bus['date'] = $item['date'];\n\t\t$bus['time'] = date(\"H:i\", $item['date']);\n\t\t$bus['journey'] = $item['journey'];\n\t\t$ret[] = $bus;\n\t}\n\treturn($ret);\n}", "function testListIterator() {\r\n $list = array(\"one\", \"two\", \"three\", \"four\");\r\n echo \"Testing constructor, hasNext, next\\n\";\r\n $it = new ListIterator($list);\r\n $index = 0;\r\n while ($it->hasNext()) {\r\n $item = $it->next();\r\n assert('!strcmp($item, $list[$index])');\r\n assert('$item === $list[$index]');\r\n $index++;\r\n }\r\n assert('$index === count($list)');\r\n echo \"Testing count\\n\";\r\n $it2 = new ListIterator($list);\r\n while ($it2->hasNext()) {\r\n $item = $it2->next();\r\n assert('$item === $it2->current()');\r\n }\r\n echo \"...unit test complete\\n\";\r\n}", "public function testGettingStartedListing()\n\t{\n\t\t$oSDK=new BrexSdk\\SDKHost;\n\t\t$oSDK->addHttpPlugin($this->oHostPlugin);\n\n\n\t\t//Let's get company details to start\n\t\t$oTeamClient=$oSDK->setAuthKey($this->BREX_TOKEN) #consider using a token vault\n\t\t\t\t->setupTeamClient();\n\n\t\t/** @var BrexSdk\\API\\Team\\Client */\n\t\t$oTeamClient;\n\n\t\t//... OR\n\t\t//if you will be doing work across the API, use the follow convenience method\n\t\t$oTeamClient=$oSDK->setupAllClients()->getTeamClient();\n\t\t//etc...\n\n\t\t/** @var BrexSdk\\API\\Team\\Model\\CompanyResponse */\n\t\t$aCompanyDetails=$oTeamClient->getCompany();\n\n\t\t$sCompanyName=$aCompanyDetails->getLegalName();\n\t\t// ACME Corp, Inc.\n\t\tcodecept_debug($sCompanyName);\n\t\t$this->assertStringContainsString('Nxs Systems Staging 01', $sCompanyName);\n\t}", "public function constructTriples(){\n try {\n // Sparql11query.g:258:3: ( triplesSameSubject ( DOT ( constructTriples )? )? ) \n // Sparql11query.g:259:3: triplesSameSubject ( DOT ( constructTriples )? )? \n {\n $this->pushFollow(self::$FOLLOW_triplesSameSubject_in_constructTriples893);\n $this->triplesSameSubject();\n\n $this->state->_fsp--;\n\n // Sparql11query.g:259:22: ( DOT ( constructTriples )? )? \n $alt34=2;\n $LA34_0 = $this->input->LA(1);\n\n if ( ($LA34_0==$this->getToken('DOT')) ) {\n $alt34=1;\n }\n switch ($alt34) {\n case 1 :\n // Sparql11query.g:259:23: DOT ( constructTriples )? \n {\n $this->match($this->input,$this->getToken('DOT'),self::$FOLLOW_DOT_in_constructTriples896); \n // Sparql11query.g:259:27: ( constructTriples )? \n $alt33=2;\n $LA33_0 = $this->input->LA(1);\n\n if ( (($LA33_0>=$this->getToken('TRUE') && $LA33_0<=$this->getToken('FALSE'))||$LA33_0==$this->getToken('IRI_REF')||$LA33_0==$this->getToken('PNAME_NS')||$LA33_0==$this->getToken('PNAME_LN')||($LA33_0>=$this->getToken('VAR1') && $LA33_0<=$this->getToken('VAR2'))||$LA33_0==$this->getToken('INTEGER')||$LA33_0==$this->getToken('DECIMAL')||$LA33_0==$this->getToken('DOUBLE')||($LA33_0>=$this->getToken('INTEGER_POSITIVE') && $LA33_0<=$this->getToken('DOUBLE_NEGATIVE'))||($LA33_0>=$this->getToken('STRING_LITERAL1') && $LA33_0<=$this->getToken('STRING_LITERAL_LONG2'))||$LA33_0==$this->getToken('BLANK_NODE_LABEL')||$LA33_0==$this->getToken('OPEN_BRACE')||$LA33_0==$this->getToken('OPEN_SQUARE_BRACE')) ) {\n $alt33=1;\n }\n switch ($alt33) {\n case 1 :\n // Sparql11query.g:259:27: constructTriples \n {\n $this->pushFollow(self::$FOLLOW_constructTriples_in_constructTriples898);\n $this->constructTriples();\n\n $this->state->_fsp--;\n\n\n }\n break;\n\n }\n\n\n }\n break;\n\n }\n\n\n }\n\n }\n catch (RecognitionException $re) {\n $this->reportError($re);\n $this->recover($this->input,$re);\n }\n catch(Exception $e) {\n throw $e;\n }\n \n return ;\n }", "public function getMyTrades($symbol, $limit = NULL, $fromId = NULL, $recvWindow = NULL);", "function select_from_stopout_list($number,$action)\n\t{\n\t return $this->db->select('*')\n\t\t ->from('pamm_stopout_list')\n\t\t ->where('number',$number)\n\t\t ->where('action',$action)\n\t\t ->get()->result();\n\t}", "private function findTrips($html) {\n\t\t$trips = array();\n\n\t\tforeach ($html->find('.reiselistsub') as $trip) {\n\n\t\t\t$singleTrip = array(\"title\" => trim($trip->find('b', 0)->plaintext), \"excerpt\" => trim($trip->find('a img')[0]->alt), \"description\" => trim($trip->find('span', 0)->plaintext), \"img\" => $trip->find('a img')[0]->src, \"category\" => \"\", \"saison\" => \"\", \"price\" => $this->formatPrice($trip->find('font b', 0)->plaintext), \"booking_url\" => $trip->find('a', 0)->href);\n\n\t\t\tarray_push($trips, $singleTrip);\n\t\t}\n\n\t\treturn $trips;\n\t}", "private function extractFirstLastTrip()\n {\n // If trip is shorter than 3 legs, there is actually no need anymore\n if (count($this->tripCollection) < 2) {\n return $this->tripCollection;\n }\n\n // Find the start and end point for the trips\n for ($i = 0, $max = count($this->tripCollection); $i < $max; $i++) {\n $hasPreviousTrip = false;\n $isLastTrip = true;\n\n foreach ($this->tripCollection as $index => $trip) {\n // If this trip is attached to a previous trip, we pass!\n if (strcasecmp($this->tripCollection[$i]['Departure'], $trip['Arrival']) == 0) {\n $hasPreviousTrip = true;\n } // If this trip is not the last trip, we pass!\n elseif (strcasecmp($this->tripCollection[$i]['Arrival'], $trip['Departure']) == 0) {\n $isLastTrip = false;\n }\n }\n\n // We found the start point of the trip,\n // so we put it on the top of the list\n if (!$hasPreviousTrip) {\n array_unshift($this->tripCollection, $this->tripCollection[$i]);\n unset($this->tripCollection[$i]);\n } // And the end of the trip\n elseif ($isLastTrip) {\n array_push($this->tripCollection, $this->tripCollection[$i]);\n unset($this->tripCollection[$i]);\n }\n\n }\n\n // Reset indexes\n $this->tripCollection = array_merge($this->tripCollection);\n }", "function wisataone_X1_get_all_order_by_id_tour_and_step_gte_110($id_tour, $trip_date) {\n global $wpdb, $wisataone_X1_tblname;\n $wp_track_table = $wpdb->prefix . $wisataone_X1_tblname;\n\n return $wpdb->get_results( \n \"\n SELECT *\n FROM {$wp_track_table}\n WHERE {$wp_track_table}.id_tour = {$id_tour} AND {$wp_track_table}.trip_date LIKE '{$trip_date}' AND {$wp_track_table}.current_step >= 110\n \"\n );\n}", "public function getTrades($symbol, $limit = NULL);", "function serviceList(&$smartyServiceList,$abcBar=false,$searchBox=false,$topList=false) {\n\t\t//\tfunction makeServiceListQuery($char=all,$limit=true,$count=false) {\n\t\t$query = $this->makeServiceListQuery($this->piVars['char']);\n\t\tif (!$query) {\n\t\t\treturn false;\n\t\t}\n\t\t$res = $GLOBALS['TYPO3_DB']->sql(TYPO3_db,$query);\n\n\t\t$row_counter = 0;\n\n\t\t// WS-VERSIONING: collect all new records and place them at the beginning of the array!\n\t\t// the new records have no name in live-space and therefore would be delegated\n\t\t// to the very end of the list through the order by clause in function makeServiceListQuery....\n\t\t$eleminated_rows=0;\n\t\twhile ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))\t{\n\t\t\t// WS-VERSIONING: get the Preview from the Core!!!!\n\t\t\t// copied from tt_news\n\t\t\t// the function versionOL() in /t3lib/class.t3lib_page.php does\n\t\t\t// the rendering of the version records for preview.\n\t\t\t// i.e. a new, not yet published record has the name ['PLACEHOLDER'] and is hidden in live-workspace,\n\t\t\t// class.t3lib_page.php replaces the fields in question with content from its\n\t\t\t// version-workspace-equivalent for preview purposes!\n\t\t\t// for it to work the result must also contain the records from live-workspace which carry the hidden-flag!!!\n\t\t\tif ($this->versioningEnabled) {\n\t\t\t\t// remember: versionOL generates field-list and cannot handle aliases!\n\t\t\t\t// i.e. there must not be any aliases in the query!!!\n\t\t\t\t$GLOBALS['TSFE']->sys_page->versionOL('tx_civserv_service',$row);\n\n\t\t\t\tif($this->previewMode){\n\t\t\t\t\t$row['realname']=$row['sv_name'];\n\t\t\t\t\t$row['name']=$row['realname'];\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif(is_array($row)){\n\t\t\t\t$services[$row_counter]['uid']=$row['uid']; //needed for preview-sorting see below\n\t\t\t\t$services[$row_counter]['t3ver_state']=$row['t3ver_state'];\n\t\t\t\t$services[$row_counter]['fe_group']=$row['fe_group'];\n\t\t\t\t// customLinks will only work if there is an according rewrite-rule in action!!!!\n\t\t\t\tif(!$this->conf['useCustomLinks_Services']){\n\t\t\t\t\t$services[$row_counter]['link'] = htmlspecialchars($this->pi_linkTP_keepPIvars_url(array(mode => 'service',id => $row['uid']),$this->conf['cache_services'],1));\n\t\t\t\t}else{\n\t\t\t\t\t$services[$row_counter]['link'] = strtolower($this->convert_plus_minus(urlencode($this->replace_umlauts($this->strip_extra($row['realname'].\"_\".$row['uid']))))).\".html\";\n\t\t\t\t}\n\t\t\t\tif ($row['name'] == $row['realname']) {\n\t\t\t\t\t$services[$row_counter]['name'] = $row['name'];\n\t\t\t\t} else {\n\t\t\t\t\t// this will only happen in LIVE context\n\t\t\t\t\t$services[$row_counter]['name'] = $row['name'] . ' (= ' . $row['realname'] . ')';\n\t\t\t\t}\n\t\t\t\t// mark the version records for the FE, could be done by colour in template as well!\n\t\t\t\tif($row['_ORIG_pid']==-1 && $row['t3ver_state']==0){ // VERSION records\n\t\t\t\t\t$services[$row_counter]['name'].=\" DRAFT: \".$row['uid'];\n\t\t\t\t\t$services[$row_counter]['preview']=1;\n\t\t\t\t}elseif($row['_ORIG_pid']==-1 && $row['t3ver_state']==-1){ // NEW records\n\t\t\t\t\t$services[$row_counter]['name'].=\" NEW: \".$row['uid'];\n\t\t\t\t\t$services[$row_counter]['preview']=1;\n\t\t\t\t}else{\n\t\t\t\t\t// LIVE!!\n\t\t\t\t\t#$services[$row_counter]['name'].= \" \".$row['uid'];\n\t\t\t\t}\n\n\n\t\t\t\t//for the online_service list we want form descr. and service picture as well.\n\t\t\t\tif($this->piVars['mode'] == \"online_services\"){\n\t\t\t\t\t$res_online_services = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(\n\t\t\t\t\t\t'tx_civserv_form.fo_descr,\n\t\t\t\t\t\t tx_civserv_service.sv_image,\n\t\t\t\t\t\t tx_civserv_service.sv_image_text',\n\t\t\t\t\t\t'tx_civserv_service',\n\t\t\t\t\t\t'tx_civserv_service_sv_form_mm',\n\t\t\t\t\t\t'tx_civserv_form',\n\t\t\t\t\t\t' AND tx_civserv_service.uid = ' . $row['uid'] .\n\t\t \t\t\t\t $this->cObj->enableFields('tx_civserv_form').\n\t\t\t\t\t\t' AND tx_civserv_form.fo_status >= 2',\n\t\t\t\t\t\t'',\n\t\t\t\t\t\t'');\n\n\n\t\t\t\t\tif ($online_sv_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res_online_services) ) { //we only accept one online-form per service!!!!\n\t\t\t\t\t\t$imagepath = $this->conf['folder_organisations'] . $this->community['id'] . '/images/';\n\t\t\t\t\t\t#function getImageCode($image,$path,$conf,$altText)\t{\n\t\t\t\t\t\t$imageCode = $this->getImageCode($online_sv_row['sv_image'],$imagepath,$this->conf['service-image.'],$online_sv_row['sv_image_text']);\n\t\t\t\t\t\t$services[$row_counter]['descr']=$online_sv_row['fo_descr'];\n\t\t\t\t\t\t$services[$row_counter]['image']=$imageCode;\n\t\t\t\t\t\t$services[$row_counter]['image_text']=$online_sv_row['sv_image_text'];\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// highlight_external services in list view!! (works only if function makeServiceListQuery returns pid-value!)\n\t\t\t\t$mandant = t3lib_div::makeInstanceClassName('tx_civserv_mandant');\n\t\t\t\t$mandantInst = new $mandant();\n\t\t\t\t$service_community_id= $mandantInst->get_mandant($row['pid']);\n\t\t\t\t$service_community_name = $mandantInst->get_mandant_name($row['pid']);\n\t\t\t\tif($this->community['id'] != $service_community_id){\n\t\t\t\t\t$services[$row_counter]['name'] .= \" <i> - \".$service_community_name.\"</i>\";\n\t\t\t\t}\n\t\t\t\t$row_counter++;\n\t\t\t}else{\n\t\t\t\t// NULL-rows (obsolete)\n\t\t\t\t$eleminated_rows++;\n\t\t\t}\n\t\t} //end while\n\n\n\t\tif($this->previewMode){\n\t\t\t// we need to re_sort the services_array in order to incorporate the\n\t\t\t// new services which appear at the very end (due to \"order by name\" meets \"[PLACEHOLDER]\")\n\n\t\t\t#http://forum.jswelt.de/serverseitige-programmierung/10285-array_multisort.html\n\t\t\t#http://www.php.net/manual/en/function.array-multisort.php\n\t\t\t#http://de.php.net/array_multisort#AEN9158\n\n\t\t\t//found solution here:\n\t\t\t#http://www.php-resource.de/manual.php?p=function.array-multisort\n\n\t\t\t$lowercase_uids=array();\n\t\t\t//ATTENTION: multisort is case sensitive!!!\n\t\t\tfor($i=0; $i<count($services); $i++){\n\t\t\t\t$name=$services[$i]['name'];\n\t\t\t\t// service-name starts with lowercase letter\n\t\t\t\tif(strcmp(substr($name,0,1), strtoupper(substr($name,0,1)))>0){\n\t\t\t\t\t// make it uppercase\n\t\t\t\t\t$services[$i]['name']=strtoupper(substr($name,0,1)).substr($name,1,strlen($name));\n\t\t\t\t\t// remember which one it was you manipulated\n\t\t\t\t\t$lowercase_uids[]=$services[$i]['uid'];\n\t\t\t\t}\n\t\t\t\t$sortarray[$i] = $services[$i]['name'];\n\t\t\t}\n\n\t\t\t// DON'T! or else multisort won't work! (must be something about keys and indexes??)\n\t\t\t# natcasesort($sortarray);\n\n\t\t\t// $services is sorted by $sortarray as in SQL \"ordery by name\"\n\t\t\t// $sortarray itself gets sorted by multisort!!!\n\t\t\tif(is_array($sortarray) && count($sortarray)>0){\n\t\t\t\tarray_multisort($sortarray, SORT_ASC, $services);\n\t\t\t}\n\n\t\t\tfor($i=0; $i<count($services); $i++){\n\t\t\t\t$name=$services[$i]['name'];\n\t\t\t\t// reset the converted service-names to their initial value (lowercase first letter)\n\t\t\t\tif(in_array($services[$i]['uid'],$lowercase_uids)){\n\t\t\t\t\t$services[$i]['name']=strtolower(substr($name,0,1)).substr($name,1,strlen($name));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\n\t\t// Retrieve the service count\n\t\t$row_count = 0;\n\t\t//\tfunction makeServiceListQuery($char=all,$limit=true,$count=false) {\n\t\t$query = $this->makeServiceListQuery($this->piVars['char'],false,true);\n\t\t$res = $GLOBALS['TYPO3_DB']->sql(TYPO3_db,$query);\n\t\twhile ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {\n\t\t\t$row_count += $row['count(*)'];\n\t\t}\n\n\t\t$row_count = $row_count-$eleminated_rows;\n\t\t$this->internal['res_count'] = $row_count;\n\n\t\tif(!$this->previewMode){\n\t\t\t$this->internal['results_at_a_time']= $this->conf['services_per_page'];\n\t\t}else{\n\t\t\t$this->internal['results_at_a_time']=10000; //in Preview Mode we need ALL records - new ones from the end of the alphabethical list are to be included!!!\n\t\t}\n\n\t\t$this->internal['maxPages'] = $this->conf['max_pages_in_pagebar'];\n\n\n\t\t$smartyServiceList->assign('services', $services);\n\n\t\tif ($abcBar) {\n\t\t\t$query = $this->makeServiceListQuery(all,false);\n\t\t\t$smartyServiceList->assign('abcbar',$this->makeAbcBar($query));\n\t\t}\n\t\t$smartyServiceList->assign('heading',$this->getServiceListHeading($this->piVars['mode'],intval($this->piVars['id'])));\n\n\n\t\t// if the title is set here it will overwrite the value we want in the organisationDetail-View\n\t\t// but we do need it for circumstance and user_groups!\n\t\t$GLOBALS['TSFE']->page['title'] = $this->getServiceListHeading($this->piVars['mode'],intval($this->piVars['id']));\n\n\t\tif($this->piVars['char']>''){\n\t\t\t $GLOBALS['TSFE']->page['title'] .= ': '.$this->pi_getLL('tx_civserv_pi1_service_list.abc_letter','Letter').' '.$this->piVars['char'];\n\t\t}\n\n\t\tif ($searchBox) {\n\t\t\t//$_SERVER['REQUEST_URI'] = $this->pi_linkTP_keepPIvars_url(array(mode => 'search_result'),0,1); //dropped this according to instructions from security review\n\t\t\t$smartyServiceList->assign('searchbox', $this->pi_list_searchBox('',true));\n\t\t}\n\n\t\tif ($topList) {\n\t\t\tif (!$this->calculate_top15($smartyServiceList,false,$this->conf['topCount'])) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\t//test bk: the service_list template is being used by several modes, change the subheading in accordance with the modes!!!\n\t\tif($this->piVars['mode'] == 'organisation')$smartyServiceList->assign('subheading',$this->pi_getLL('tx_civserv_pi1_service_list.available_services','Here you find the following services'));\n\t\t$smartyServiceList->assign('pagebar',$this->pi_list_browseresults(true,'', ' '.$this->conf['abcSpacer'].' '));\n\n\t\treturn true;\n\t}", "function display_list($dbFileName, $uploadPath, $totalEntities, $list)\n {\n echo \"total entities in $dbFileName: $totalEntities</br>\";\n for ($i = 0; $i < $totalEntities + 1; $i++) {\n if ($list[$i] == \"_GLOBAL\") {\n $i = $i + 1;\n $totalEntties = $totalEntities + 1;\n echo \"$i \". $list[$i]. \"<br>\";\n } else {\n echo \"$i \". $list[$i]. \"<br>\";\n }\n }\n }", "function addStation($name,$line,$name1,$name2,$distfromS1,$price=array(0,0,0)){\n\n /**\n * Parameters:\n * Name = the name of the new station you want to add.\n * line = the name of the line in which you will add the station.\n * name1 = name of the first station\n * name2 = name of the terminal station to determine direction\n *\n * distfromS1 = the distance of the new staion from name1\n * price = array of three ints\n *\n */\n\n // check existance in Database, each station is identified by key pair (Nom, NomLigne)\n if ( ! (($station1= getStationDB($name1,$line)) && ($station2= getStationDB($name2,$line)))) return \"stations do not exist\";\n if (getStationDB($name,$line)) return \"station already exists\";\n\n\n // calculate distance\n if ($station1->getDist() > $station2->getDist()) {$dist=$station1->getDist()-$distfromS1;}\n else if ($station1->getDist() < $station2->getDist()) {$dist=$station1->getDist()+$distfromS1;}\n else {\n $dist=$station1->getDist() + $distfromS1 * getisTerminalUtility($station2);\n\n }\n\n // check if new station is not in the location of an existing station\n if (getStationByDistDB($dist,$line)) return \"invalid distance\";\n\n // we can now safely create and insert our station\n $newstation = new Station($name,$line,$dist,$price);\n insertStationDB($newstation);\n return false;\n\n}", "public function startCheck($flight);", "function get_urls($count, $start, $urls, $filter) {\n\tif ($start < $count) {\n\t\t$sparql = new EasyRdf_Sparql_Client(esc_attr(get_option( 'endpoint')));\n\t\t$result = $sparql->query(\n\t\t\t'SELECT distinct ?url ?date WHERE {\n\t\t\t\t ?url rdf:type <http://schema.org/CreativeWork>;\n\t\t\t\t '.$filter.'\n\t\t\t\t}\n\t\t\t\tORDER BY DESC(?date)\n\t\t\t\tLIMIT 50\n\t\t\t\tOFFSET ' . $start\n\t\t);\n\t\tforeach ($result as $row) {\n\t\t\techo '<br/>adding to array: '. $row->url;\n\t\t\tarray_push($urls, $row->url);\n\t\t}\n\t\tget_urls($count, $start += 50, $urls, $filter);\n\t} else {\n\t\tprocess_urls($urls);\t\n\t}\n\t\n\t\n}", "static function getTarifList($params=array()){\n // type - ���, pickup ��� courier\n // mode - ��� ��������:\n // answer - �������� ������� (string) ��� �������� �� ���������� (array)\n $arList = array(\n 'pickup' => array(\n 'usual' => array(234,136,138),\n 'heavy' => array(15,17),\n 'express' => array(62,63,5,10,12)\n ),\n 'courier' => array(\n 'usual' => array(233,137,139),\n 'heavy' => array(16,18),\n 'express' => array(11,1,3,61,60,59,58,57,83)\n )\n );\n $blocked = unserialize(COption::GetOptionString(sdekdriver::$MODULE_ID,'tarifs','a:{}'));\n if(count($blocked) && (!array_key_exists('fSkipCheckBlocks',$params) || !$params['fSkipCheckBlocks'])){\n foreach($blocked as $key => $val)\n if(!array_key_exists('BLOCK',$val))\n unset($blocked[$key]);\n if(count($blocked))\n foreach($arList as $tarType => $arTars)\n foreach($arTars as $tarMode => $arTarIds)\n foreach($arTarIds as $key => $arTarId)\n if(array_key_exists($arTarId,$blocked))\n unset($arList[$tarType][$tarMode][$key]);\n }\n $answer = $arList;\n if($params['type']){\n if(is_numeric($params['type'])) $type = ($params['type']==136)?$type='pickup':$type='courier';\n else $type = $params['type'];\n $answer = $answer[$type];\n\n if($params['mode'] && array_key_exists($params['mode'],$answer))\n $answer = $answer[$params['mode']];\n }\n\n if(array_key_exists('answer',$params)){\n $answer = self::arrVals($answer);\n if($params['answer'] == 'string'){\n $answer = implode(',',$answer);\n $answer = substr($answer,0,strlen($answer));\n }\n }\n return $answer;\n }", "function waiting_list_list(){\r\n\t\t$jenis_rawat = isset($_POST['jenis_rawat']) ? $_POST['jenis_rawat'] : \"\";\r\n\t\t$tgl_app = isset($_POST['wl_tgl_app']) ? $_POST['wl_tgl_app'] : \"\";\r\n\t\t$query = isset($_POST['query']) ? $_POST['query'] : \"\";\r\n\t\t$start = (integer) (isset($_POST['start']) ? $_POST['start'] : $_GET['start']);\r\n\t\t$end = (integer) (isset($_POST['limit']) ? $_POST['limit'] : $_GET['limit']);\r\n\t\t$karyawan_id = isset($_POST['karyawan_id']) ? $_POST['karyawan_id'] : \"\";\r\n\t\t$result=$this->m_waiting_list->waiting_list_list($query,$start,$end,$tgl_app,$jenis_rawat,$karyawan_id);\r\n\t\techo $result;\r\n\t}", "function createKiltPinListings()\n{\n\t$id = NULL;\n\t$count = 0;\n\t$clanName = NULL;\n\t$surname = NULL;\n\t$surname_list = NULL;\n\t$complete_list = NULL;\n\n\t$query = \"SELECT * FROM clan WHERE active = 1;\";\n\t// $query = \"SELECT * FROM clan WHERE active = 1 AND id > 323;\";\n\t// $query = \"SELECT * FROM clan WHERE active = 4;\"; // use this for any image uploads that failed.\n\t$result = @mysql_query($query); // Run the query.\n\tif($result)\n\t{\n\t\twhile($row = mysql_fetch_array($result, MYSQL_ASSOC))\n\t\t{\n\t\t\t$id = $row['Id'];\n\t\t\t$clanName = $row['name'];\n\t\t\t\n\t\t\t$complete_list = \"Kilt Pin Clan \" . $clanName . \":\";\n\t\t\tif(strlen($complete_list) < 55)\n\t\t\t{\n\t\t\t\t// Now run another query to get all surnames linked to clan.\n\t\t\t\t$query2 = \"SELECT surnames.* FROM surnames, clan_surnames, clan WHERE clan.Id = \" . $id . \" AND clan_surnames.clan_id = clan.Id AND clan_surnames.surname_id = surnames.Id;\";\n\t\t\t\t$result2 = @mysql_query($query2); // Run the query.\n\t\t\t\tif($result2)\n\t\t\t\t{\n\t\t\t\t\twhile($row2 = mysql_fetch_array($result2, MYSQL_ASSOC))\n\t\t\t\t\t{\n\t\t\t\t\t\t$surname = $row2['name'];\n\t\t\t\t\t\tif((strlen(\"Kilt Pin Clan \" . $clanName . \":\" . $surname_list) + strlen($surname)) < 55) {\n\t\t\t\t\t\t\t$surname_list .= \" \" . $surname;\n\t\t\t\t\t\t\t$complete_list .= \" \" . $surname;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Now perform insertion into kilt_pin_listing table in the DB.\n\t\t\t\t\t\t\t$query3 = \"INSERT INTO kilt_pin_listing(Id, clan_id, clan_name, surname_list, active, date_time) \nVALUES('', $id, '$clanName', '$surname_list', 1, NOW());\";\n\t\t\t\t\t\t\t$result3 = @mysql_query($query3); // Run the query.\n\t\t\t\t\t\t\tif($result3)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t// Insert successfull.\n\t\t\t\t\t\t\t\t$int_id = mysql_insert_id();\n\t\t\t\t\t\t\t\t$surname_list = \" \" . $surname;\n\t\t\t\t\t\t\t\t$complete_list = \"Kilt Pin Clan \" . $clanName . \":\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// System.out.println(\"*** \" + surname_list);\n\t\t\t\t\t\t\t$count++;\n\t\t\t\t\t\t\t// $surname_list = \"Clan \" . $clanName . \" Kilt Pin:\";\n\t\t\t\t\t\t\t// System.out.println(\"\\tCount is \" + count);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// If the surnames while is complete, we still may have to add one last entry.\n\t\t\t\t\t// Just check that the complete list is less than 56 characters.\n\t\t\t\t\tif(strlen($complete_list) < 55)\n\t\t\t\t\t{\n\t\t\t\t\t\t$query3 = \"INSERT INTO kilt_pin_listing(Id, clan_id, clan_name, surname_list, active, date_time) \n\tVALUES('', $id, '$clanName', '$surname_list', 1, NOW());\";\n\t\t\t\t\t\t$result3 = @mysql_query($query3); // Run the query.\n\t\t\t\t\t\tif($result3)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Insert successfull.\n\t\t\t\t\t\t\t$int_id = mysql_insert_id();\n\t\t\t\t\t\t\t$surname_list = \"\";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t\n\t// echo \"<Ack>Success</Ack>\";\n\t// createKiltPinsListings();\n}", "function create_or_update_flight_infos(){\n $flag = true;\n array_shift($_POST[\"flights\"]);\n if(count($_POST[\"flights\"]) > 1){\n $_SESSION[\"multiple\"] = true;\n $_SESSION[\"flights_list\"] = $_POST[\"flights\"];\n $i = 0;\n foreach($_POST[\"flights\"] as $flight_data){\n $flight = explode('-', $flight_data); \n if($flight && !create_or_update_flight_info($flight, $i)){\n $flag = false;\n }\n $i++;\n }\n \n }else{\n $_SESSION[\"multiple\"] = false;\n $flight = explode('-', $_POST[\"flights\"][0]); \n $flag = create_or_update_flight_info($flight, 0);\n }\n \n /*$i = 0;\n $flag = true;\n foreach($_POST[\"flights\"] as $flight_data){\n $flight = explode('-', $flight_data); \n if($flight && !create_or_update_flight_info($flight, $i)){\n $flag = false;\n }\n $i++;\n }*/\n return $flag;\n}", "function genStartList()\r\n\t{\r\n\t\tglobal $debug;\r\n\t\tglobal $msg;\r\n\t\t\r\n\t\t$dbh = getOpenedConnection();\r\n\t\t$list = array();\r\n\t\t\r\n\t\tif ($dbh == null) {\r\n\t\t\t$dbh = openDB();\r\n\t\t\tif ($dbh == null)\r\n\t\t\t\treturn;\r\n\t\t}\r\n\t\t\r\n\t\t$pat = \"\";\r\n\t\t$paid = \"and e.Status = 'P'\";\r\n\t\t$paid = \"\";\r\n\t\t\t\r\n\t\t$sql = \"\r\n\t\t\tselect p.Id PatrolId,\r\n\t\t\t\tp.SortOrder,\r\n\t\t\t\tconcat(s.FirstName, ' ', s.LastName) as ShotName,\r\n\t\t\t\ts.GunCard,\r\n\t\t\t\tc.Name as ClubName,\r\n\t\t\t\te.Id as EntryId,\r\n\t\t\t\tg.Grade as GunClassName,\r\n\t\t\t\tsc.Name as ShotClassName,\r\n\t\t\t\ts.Id as ShotId,\r\n\t\t\t\ttime_format( p.StartTime, '%H:%i') as FirstStart\r\n\t\t\tfrom tbl_Pistol_Patrol p\r\n\t\t\tjoin tbl_Pistol_Entry e on (e.PatrolId = p.Id $paid)\r\n\t\t\tjoin tbl_Pistol_Shot s on (s.Id = e.ShotId)\r\n\t\t\tjoin tbl_Pistol_Club c on (c.Id = s.ClubId)\r\n\t\t\tjoin tbl_Pistol_GunClassification g on (g.Id = e.GunClassificationId)\r\n\t\t\tjoin tbl_Pistol_ShotClass sc on (sc.Id = e.ShotClassId)\r\n\t\t\twhere p.CompetitionDayId = $this->id\r\n\t\t\t$pat\r\n\t\t\torder by c.Name, p.SortOrder, s.LastName, s.FirstName\r\n\t\t\";\r\n\t\t\r\n\t\tif ($debug)\r\n\t\t\tprint_r($sql);\r\n\t\t\t\r\n\t\t$result = mysqli_query($dbh,$sql);\r\n\t\t$rc = mysqli_affected_rows($dbh);\r\n\t\t\r\n\t\tif ($rc < 0)\r\n\t\t{\r\n\t\t\t$msg = mysqli_error($dbh);\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t\t\r\n\t\twhile ($obj = mysqli_fetch_object($result))\r\n\t\t{\r\n\t\t\tunset($row);\r\n\t\t\t$row[\"PatrolId\"] = $obj->PatrolId;\r\n\t\t\t$row[\"SortOrder\"] = $obj->SortOrder;\r\n\t\t\t$row[\"ShotName\"] = $obj->ShotName;\r\n\t\t\t$row[\"GunCard\"] = $obj->GunCard;\r\n\t\t\t$row[\"ClubName\"] = $obj->ClubName;\r\n\t\t\t$row[\"ShotClassName\"] = $obj->ShotClassName;\r\n\t\t\t$row[\"GunClassName\"] = $obj->GunClassName;\r\n\t\t\t$row[\"ShotId\"] = $obj->ShotId;\r\n\t\t\t$row[\"EntryId\"] = $obj->EntryId;\r\n\t\t\t$row[\"FirstStart\"] = $obj->FirstStart;\r\n\t\t\t\r\n\t\t\t$list[] = $row;\r\n\t\t}\r\n\r\n\t\tmysqli_free_result($result);\r\n\r\n\t\treturn $list;\r\n\t}", "function trackback_url_list($tb_list, $post_id)\n {\n }", "public function generateList() {}", "public function generateList() {}", "public function generateList() {}", "function checkTrips($numbers) {\n\t//TODO: Tjek om der er \"trips\"\n}", "public function speeduplisttootherAction()\n {\n $uid = $this->_USER_ID;\n $floorId = $this->getParam('CF_floorId');\n $storeType = $this->getParam(\"CF_storeType\");\n $chairId = $this->getParam(\"CF_chairid\");\n\n //get user item list\n $mbllApi = new Mbll_Tower_ServiceApi($uid);\n $aryRst = $mbllApi->getUserItemList(0, 100, 1);\n\n if (!$aryRst || !$aryRst['result']) {\n $errParam = '-1';\n if (!empty($aryRst['errno'])) {\n $errParam = $aryRst['errno'];\n }\n return $this->_redirectErrorMsg($errParam);\n }\n\n //speed up to others item list\n $speedUpList = $aryRst['result']['list'];\n\n //get item can speed to other\n $speedItem = array();\n foreach ($speedUpList as $key => $value) {\n if (20 == $value['id'] || 21 == $value['id']) {\n $speedItem[$value['id']]['id'] = $value['id'];\n $speedItem[$value['id']]['nm'] = $value['num'];\n }\n }\n\n\n if (!isset($speedItem[20])) {\n $speedItem[20]['id'] = 20;\n $speedItem[20]['nm'] = 0;\n }\n if (!isset($speedItem[21])) {\n $speedItem[21]['id'] = 21;\n $speedItem[21]['nm'] = 0;\n }\n\n\n foreach ($speedItem as $key => $value) {\n $item = Mbll_Tower_ItemTpl::getItemDescription($value['id']);\n $speedItem[$key]['name'] = $item['name'];\n $speedItem[$key]['des'] = $item['desc'];\n }\n\n $this->view->userInfo = $this->_user;\n $this->view->speedUpList = $speedItem;\n $this->view->floorId = $floorId;\n $this->view->storeType = $storeType;\n $this->view->chairId = $chairId;\n $this->render();\n }", "function wp_parse_list($input_list)\n {\n }", "function get_flight_inter_from_ws($depcode, $arvcode, $outbound_date, $inbound_date, $adult, $child, $infant, $triptype='ROUND_TRIP', $format='json'){\n\t\n\t$outbound_date = str_replace('/','-',$outbound_date);\n\t$inbound_date = isset($inbound_date) && !empty($inbound_date) ? str_replace('/','-',$inbound_date) : $outbound_date;\n\t$api_key = '70cd2199f6dc871824ea9fed45170af354ffe9e6';\n\t$supplier = 'hnh';\n\t\n\t$url = 'http://api.vemaybaynamphuong.com/index.php/apiv1/api/flight_search_inter/format/'.$format;\n\t$url .= '/supplier/'.$supplier;\n\t$url .= '/depcode/'.$depcode;\n\t$url .= '/arvcode/'.$arvcode;\n\t$url .= '/outbound_date/'.$outbound_date;\n\t$url .= '/inbound_date/'.$inbound_date;\n\t$url .= '/adult/'.$adult;\n\tif($child > 0){\n\t\t$url .= '/child/'.$child;\n\t}\n\tif($infant > 0){\n\t\t$url .= '/infant/'.$infant;\n\t}\n\t$url .= '/triptype/'.$triptype;\n\t\n\t$curl_handle = curl_init();\n\tcurl_setopt($curl_handle, CURLOPT_URL, $url);\n\tcurl_setopt($curl_handle, CURLOPT_TIMEOUT, 30);\n curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 30);\n\tcurl_setopt($curl_handle, CURLOPT_HTTPHEADER, array('X-API-KEY: '.$api_key));\n\tcurl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);\n\t\n\t$buffer = curl_exec($curl_handle);\n\tcurl_close($curl_handle);\n\t$result = json_decode($buffer, true);\n\treturn $result;\n}", "public function getTrainingList()\n {\n $umg = $this->username;\n\n $this->db->select(\"th_ref_id,\n th_training_title,\n to_char(th_date_from, 'dd/mm/yyyy') th_date_from2,\n to_char(th_date_to, 'dd/mm/yyyy') th_date_to2\n \");\n $this->db->from(\"ims_hris.training_head\");\n \n $this->db->where(\"th_status = 'ENTRY'\");\n $this->db->where(\"th_dept_code = (select sm_dept_code from ims_hris.staff_main where upper(sm_apps_username) = UPPER('$umg'))\");\n $this->db->where(\"th_internal_external = 'EXTERNAL_AGENCY'\");\n $this->db->order_by(\"th_date_from, th_date_to, th_training_title, th_ref_id\");\n $q = $this->db->get();\n \n return $q->result_case('UPPER');\n }", "function alat_list(){\r\n\t\t\r\n\t\t$query = isset($_POST['query']) ? $_POST['query'] : \"\";\r\n\t\t$start = (integer) (isset($_POST['start']) ? $_POST['start'] : $_GET['start']);\r\n\t\t$end = (integer) (isset($_POST['limit']) ? $_POST['limit'] : $_GET['limit']);\r\n\r\n\t\t$result=$this->m_alat->alat_list($query,$start,$end);\r\n\t\techo $result;\r\n\t}", "function find_MODEL($list) {\n while($server = $list->Next()) {\n if ($server->name == 'MODEL')\n return $server;\n }\n die(\"Can't find the MODEL server\\n\");\n}", "function create_train($departure, $destination)\n{\n\t$mysqli = connectToDB();\n\t$avg_speed = 50.0;\n\t$days = array(\"MTWTh\", \"TWThF\", \"WThFSa\", \"ThFSaSu\", \"FSaSuM\", \"MTW\", \"MWF\", \"TTh\", \"MTWThF\", \"TFSa\", \"SaSuMT\");\n\t$running_days = $days[mt_rand(0, 10)];\n\n $travel_time = calculate_distance($departure, $destination)/$avg_speed;\n\n\t\n\t$train_id = newTrainID();\n\t$insert_query = \"INSERT INTO Train VALUES(?, ?, ?, ?, ?, 0)\";\n\t\n\tif(!$stmt = $mysqli->prepare($insert_query))\n\t{\n\t\techo \"line 83\";\n\t\texit();\n\t}\n\t$stmt->bind_param(\"sssss\", $train_id, $departure, $destination, $running_days, $travel_time);\n\t$stmt->execute();\n\t$stmt->close();\t\n\n\t$query = \"SELECT locomotive_ID FROM Locomotive WHERE locomotive_ID NOT IN (SELECT locomotive_ID FROM Assigned_Locomotive)\";\n\t$result = $mysqli->query($query);\n\n\tif ($result->num_rows == 0)\n\t{\n\t\techo \"no free locomotives\";\n\t\texit();\n\t}\n\t$locomotive = $result->fetch_array(MYSQLI_ASSOC);\n\t\n\t$insert_query = \"INSERT INTO Assigned_Locomotive VALUES(?, ?)\";\n\n\tif(!$stmt = $mysqli->prepare($insert_query))\n\t{\n\t\techo \"line 107\";\n\t\texit();\n\t}\n\t$stmt->bind_param(\"ss\", $locomotive['locomotive_ID'], $train_id);\n\t$stmt->execute();\n\t$stmt->close();\n\n\t\n\t$query = \"SELECT user_id FROM Engineer WHERE user_id NOT IN (SELECT user_id FROM Assigned_Engineer)\";\n\t$result = $mysqli->query($query);\n\tif ($result->num_rows < 2)\n\t{\n\t\techo \"not enough free engineers\";\n\t\texit();\n\t}\n\t$engineer1 = $result->fetch_array(MYSQLI_ASSOC); \n\t$engineer2 = $result->fetch_array(MYSQLI_ASSOC);\n\t\n\t$insert_query = \"INSERT INTO Assigned_Engineer VALUES(?, ?)\";\n\tif(!$stmt = $mysqli->prepare($insert_query))\n\t{\n\t\techo \"line 127\";\n\t\texit();\n\t}\n\t$stmt->bind_param(\"ss\", $engineer1['user_id'], $train_id);\n\t$stmt->execute();\n\t$stmt->close();\n\t\n\tif(!$stmt = $mysqli->prepare($insert_query))\n {\n echo \"line 136\";\n\t\texit();\n }\n $stmt->bind_param(\"ss\", $engineer2['user_id'], $train_id);\n $stmt->execute();\n $stmt->close();\n\t\n\t$query = \"SELECT user_id FROM Conductor WHERE user_id NOT IN (SELECT user_id FROM Assigned_Conductor)\";\n\t$result = $mysqli->query($query);\n\tif ($result->num_rows == 0)\n\t{\n\t\techo \"no free conductors\";\n\t\texit();\n\t}\n\t$conductor = $result->fetch_array(MYSQLI_ASSOC);\n\t$insert_query = \"INSERT INTO Assigned_Conductor VALUES(?, ?)\";\n\t if(!$stmt = $mysqli->prepare($insert_query))\n {\n echo \"line 153\";\n\t\texit();\n }\n $stmt->bind_param(\"ss\", $conductor['user_id'], $train_id);\n $stmt->execute();\n $stmt->close();\n\n\n\t$mysqli->close();\n\t\n\treturn $train_id;\n}", "function createKiltPinNoStoneListings()\n{\n\t$id = NULL;\n\t$count = 0;\n\t$clanName = NULL;\n\t$surname = NULL;\n\t$surname_list = NULL;\n\t$complete_list = NULL;\n\n\t$query = \"SELECT * FROM clan WHERE active = 1;\";\n\t// $query = \"SELECT * FROM clan WHERE active = 1 AND id > 323;\";\n\t// $query = \"SELECT * FROM clan WHERE active = 4;\"; // use this for any image uploads that failed.\n\t$result = @mysql_query($query); // Run the query.\n\tif($result)\n\t{\n\t\twhile($row = mysql_fetch_array($result, MYSQL_ASSOC))\n\t\t{\n\t\t\t$id = $row['Id'];\n\t\t\t$clanName = $row['name'];\n\t\t\t\n\t\t\t$complete_list = \"Kilt Pin Clan \" . $clanName . \":\";\n\t\t\tif(strlen($complete_list) < 55)\n\t\t\t{\n\t\t\t\t// Now run another query to get all surnames linked to clan.\n\t\t\t\t$query2 = \"SELECT surnames.* FROM surnames, clan_surnames, clan WHERE clan.Id = \" . $id . \" AND clan_surnames.clan_id = clan.Id AND clan_surnames.surname_id = surnames.Id;\";\n\t\t\t\t$result2 = @mysql_query($query2); // Run the query.\n\t\t\t\tif($result2)\n\t\t\t\t{\n\t\t\t\t\twhile($row2 = mysql_fetch_array($result2, MYSQL_ASSOC))\n\t\t\t\t\t{\n\t\t\t\t\t\t$surname = $row2['name'];\n\t\t\t\t\t\tif((strlen(\"Kilt Pin Clan \" . $clanName . \":\" . $surname_list) + strlen($surname)) < 55) {\n\t\t\t\t\t\t\t$surname_list .= \" \" . $surname;\n\t\t\t\t\t\t\t$complete_list .= \" \" . $surname;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Now perform insertion into kilt_pin_listing table in the DB.\n\t\t\t\t\t\t\t$query3 = \"INSERT INTO kilt_pin_no_stone_listing(Id, clan_id, clan_name, surname_list, active, date_time) \nVALUES('', $id, '$clanName', '$surname_list', 1, NOW());\";\n\t\t\t\t\t\t\t$result3 = @mysql_query($query3); // Run the query.\n\t\t\t\t\t\t\tif($result3)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t// Insert successfull.\n\t\t\t\t\t\t\t\t$int_id = mysql_insert_id();\n\t\t\t\t\t\t\t\t$surname_list = \" \" . $surname;\n\t\t\t\t\t\t\t\t$complete_list = \"Kilt Pin Clan \" . $clanName . \":\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// System.out.println(\"*** \" + surname_list);\n\t\t\t\t\t\t\t$count++;\n\t\t\t\t\t\t\t// $surname_list = \"Clan \" . $clanName . \" Kilt Pin:\";\n\t\t\t\t\t\t\t// System.out.println(\"\\tCount is \" + count);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// If the surnames while is complete, we still may have to add one last entry.\n\t\t\t\t\t// Just check that the complete list is less than 56 characters.\n\t\t\t\t\tif(strlen($complete_list) < 55)\n\t\t\t\t\t{\n\t\t\t\t\t\t$query3 = \"INSERT INTO kilt_pin_no_stone_listing(Id, clan_id, clan_name, surname_list, active, date_time) \n\tVALUES('', $id, '$clanName', '$surname_list', 1, NOW());\";\n\t\t\t\t\t\t$result3 = @mysql_query($query3); // Run the query.\n\t\t\t\t\t\tif($result3)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Insert successfull.\n\t\t\t\t\t\t\t$int_id = mysql_insert_id();\n\t\t\t\t\t\t\t$surname_list = \"\";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n}", "function get_inbound_list($parms)\r\n{\r\n global $mydb;\r\n\r\n // dereference function parameters\r\n \r\n foreach($parms as $key=>$val)\r\n {\r\n $$key = \"$val\";\r\n $s .= \"$key = $val , \";\r\n }\r\n\r\n \r\n // return new soap_fault(\"Client\", \"\", $s);\r\n\r\n // Build the ORDER BY clause for the SQL statement...\r\n if($order_by != \"\")\r\n {\r\n $order_clause = \" order by $order_by $order_dir \";\r\n }\r\n else\r\n {\r\n $order_clause = \" order by seq desc\";\r\n }\r\n \r\n //return new soap_fault(\"Client\", \"\", $order_clause);\r\n \r\n // Build the WHERE clause for the SQL statement...\r\n\r\n //return new soap_fault(\"Client\", \"\", htmlspecialchars($end_sql));\r\n\r\n $sql_query = array();\r\n\r\n if ($company == \"\")\r\n {\r\n return new soap_fault(\"Client\", \"\", \"Company parameter is required\");\r\n }\r\n\r\n $sql = \"select a.seq,\r\n a.carinit, \r\n a.carnum,\r\n a.inbound_group,\r\n a.train_id,\r\n a.owner,\r\n b.name as owner_name,\r\n a.inbound_date,\r\n (d.track || '/' ||d.track_pos) as track,\r\n a.repair_comp_date,\r\n c.inbound_status as inbound_status_desc\r\n from ${company}inbound a left outer join \r\n (select * from car_track_loc where company = '${company}') d \r\n on (a.carinit = d.carinit and a.carnum = d.carnum),\r\n customers b, inbound_statuses c \r\n where a.owner = b.customer\r\n and a.inbound_status = c.inbound_status_id\";\r\n $sql .= \" and rownum < 7000\"; // limit the number of records returned (to avoid out of memory condition)\r\n $select = \" seq,\r\n carinit,\r\n carnum,\r\n inbound_group,\r\n train_id,\r\n owner,\r\n owner_name,\r\n to_char(inbound_date, 'MM/DD/YYYY') as inbound_date,\r\n track,\r\n to_char(repair_comp_date, 'MM/DD/YYYY') as repair_comp_date,\r\n inbound_status_desc\r\n \";\r\n \r\n $sql_text = \"select $select from ($sql) $order_clause\";\r\n\r\n //return new soap_fault(\"Client\", \"\", htmlspecialchars($sql_text));\r\n //return new soap_fault(\"Client\", \"\", htmlspecialchars($sql));\r\n\r\n/*\r\n$fp = fopen(\"/tmp/ws.log\", \"w\");\r\nfputs($fp, $sql_text . \"\\n\");\r\nfclose($fp);\r\n*/\r\n\r\n $qry = $mydb->query($sql_text);\r\n $xml_res = $qry->get_result_xml(\"main\", \"rec\", $start, $stop);\r\n\r\n // Create a new soap val object here...\r\n $myval = new soapval('', 'xml', $xml_res);\r\n\r\n // And return it...\r\n return $myval;\r\n}", "function buildItinerary($trip_id=0)\n\t{\n\t\t/*$filter = array(\n\t\t\t\t'id' => $trip_id,\n\t\t\t\t'DATEADD(DAY,number+1,@Date1) < ' => 'drop_date');\n\t\t$this->db->select('DATEADD(DAY,number+1,pickup_date) [itinerary]');\n\t\t$this->db->from('trips');\n\t\t$this->db->where($filter);*/\n\t\t$this->db->select('pick_up_date,drop_date');\n\t\t$this->db->from('trips');\n\t\t$this->db->where('id',$trip_id);\n\t\t$query = $this->db->get();\n\t\t$itinerary = array();\n\t\tif($query->num_rows() == 1)\n\t\t{\n\t\t\t$row = $query->row();\n\t\t\t\n\t\t\t$itinerary[] = $row->pick_up_date;\n\n\t\t\t$next = date('Y-m-d', strtotime($row->pick_up_date . ' + 1 day'));\n\t\t\twhile(strtotime($row->drop_date) >= strtotime($next)){\n\t\t\t\t$itinerary[] = $next;\n\t\t\t\t$next = date('Y-m-d', strtotime($next . ' + 1 day'));\n\t\t\t}\n\t\t\treturn $itinerary;\n\t\t\t\n\t\t}else{\n\t\t\treturn false;\n\t\t}\n\n\t}", "function elementfinder($list1, $element){ \n $comparator=0; //container for the element at a particular index to be compared with the element to be found to be found\n $locator=0; \n $indexes=\"occuring at index(ices): \"; // gives the container for the number of timed the element was located\n $listlength=count($list1)-1; //efffective largest index of the given list\n \n for($i=0; $i<=$listlength;$i++){ //step through the list\n$comparator=$list1[$i]; //get the element at the current index\n/**if this element equals the element to be found, then upgrade the number of times the element has been found(that is the locator variable)and add the index it was found to the index variable */\nif($element==$comparator){\n $locator=$locator+1;\n $indexes=$indexes.$i. \" \";\n}\n }\n /** print out result and the given list operated upon */\n echo \"given the list: \"; print_r($list1); echo \"<br>\";\n echo $locator.\" matches found \";\n echo $indexes;\n return $locator;\n}", "public function show(Train $train)\n {\n //\n }", "function datapointIterator($iterator){\n\n// create references to vars outside function\n\tglobal $insertPointQuery;\n\tglobal $rowNumber;\n\tglobal $highestJourneyId;\n\tglobal $dateErrorFlag;\n\n// checks for valid entry\n\twhile (($iterator->valid()) and ($dateErrorFlag!==true)){\n\n\t// if the entry has children\n\t\tif($iterator->hasChildren()){\n\t\t// recursive call to loop down a level\n\t\t\tdatapointIterator($iterator -> getChildren());\n // if it doesn't have children\n\t\t} else {\n \t// checks for a new entry - uses timestamp as a new line id\n\t\t\tif($iterator -> key()==\"timestamp\"){\n\t\t\t\t// date validation\n\t\t\t\t// get string from iterator\n\t\t\t\t$validityCheckString = $iterator -> current().PHP_EOL;\n\t\t\t\t// trim carrigae return from end\n\t\t\t\t$validityCheckString = str_replace(\"\\n\", \"\",$validityCheckString);\n\t\t\t\t// create new date/time from the retrieved value\n\t\t\t\t$newDate = date_create_from_format('j M Y H:i:s',$validityCheckString);\n\t\t\t\t// creates a timestamp for now\n\t\t\t\t$now = new DateTime();\n\t\t\t\t// check if new date matches the retieved date\n\t\t\t\t// this is needed as php turns 31 Feb into 3 March!!!!\n\t\t\t\t// also checks for future dates\t\t\t\n\t\t\t\tif(($validityCheckString!==date_format($newDate, 'j M Y H:i:s'))||($newDate >= $now)){\n\t\t\t\t\t// sets error flag to true\n\t\t\t\t\t$dateErrorFlag = true;\n\t\t\t\t\t// breaks the loop\n\t\t\t\t\tbreak;\n\t\t\t\t};\n\n\t\t\t\t// adds opening brackets, rowNumber and journey number and start of string to date\n\t\t\t\t$insertPointQuery = $insertPointQuery.\" (\".$rowNumber.\", \".$highestJourneyId.\", STR_TO_DATE('\";\n\t\t\t\t// add the value with the string to date format\n\t\t\t\t$insertPointQuery = $insertPointQuery.$iterator -> current().PHP_EOL.\"', '%d %M %Y %H:%i:%s'), \";\n\t\t\t\t// increments row number\n\t\t\t\t$rowNumber++;\n\t\t\t// checks for speeds over 100mph and removes them\n\t\t\t} elseif(($iterator -> key()==\"velocity_mph\") && ($iterator -> current().PHP_EOL>MAX_ALLOWABLE_SPEED)){\n\t\t\t\t// appends null to the spped attribute\n\t\t\t\t$insertPointQuery= $insertPointQuery.\"Null\".\", \";\n\t\t\t// all other attributes\n\t\t\t} else {\n\t\t\t//////////////////////////////////////////////////////////////////////////////////\n\t\t\t////////////LAT AND LONG ARE CURRENTLY BACKWARDS IN THE SOURCE FILES//////////////\n\t\t\t//////////////////////MY DATABASE FIELD NAMES CORRECT THIS////////////////////////\n \t\t// adds the value\n\t\t\t$insertPointQuery=$insertPointQuery.$iterator -> current().PHP_EOL.\", \";\n\t\t}\n\t}\n\n\t// if this is the last entry in a row then close brackets\n\tif($iterator -> key()==\"route\"){\n\t\t$insertPointQuery\n\t\t= $insertPointQuery\n\t\t.\"),\";\n\t}\n\t// go to next iteration\n\t$iterator->next();\n\t}// end while loop\n}", "function checkLeastInList($list2Check,$list){\n\t\tif (strlen($list2Check) && strlen($list)){\n\t\t\t$sourceArray=explode(',',$list);\n\t\t\tforeach($sourceArray as $value){\n\t\t\t\tif (t3lib_div::inList($list2Check,$value))\n\t\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "function master_jual_rawat_list(){\r\n\t\t\r\n\t\t$query = isset($_POST['query']) ? $_POST['query'] : \"\";\r\n\t\t$start = (integer) (isset($_POST['start']) ? $_POST['start'] : $_GET['start']);\r\n\t\t$end = (integer) (isset($_POST['limit']) ? $_POST['limit'] : $_GET['limit']);\r\n\t\t$result=$this->m_master_jual_rawat->master_jual_rawat_list($query,$start,$end);\r\n\t\techo $result;\r\n\t}", "public function run()\n {\n $station_func = array(array('station'=>'Headquarters', 'function'=>'AIM Products Management'),\n\t\t\t\t\t\tarray('station'=>'Jomo Kenyatta International Airport', 'function'=>'AIS Products Management'),\n\t\t\t\t\t\tarray('station'=>'Jomo Kenyatta International Airport NOF', 'function'=>'AIS Products Management'),\n\t\t\t\t\t\tarray('station'=>'Nairobi Wilson Airport', 'function'=>'AIS Products Management'),\n\t\t\t\t\t\tarray('station'=>'Moi International Airport', 'function'=>'AIS Products Management'),\n\t\t\t\t\t\tarray('station'=>'Eldoret International Airport', 'function'=>'AIS Products Management'),\n\t\t\t\t\t\tarray('station'=>'Kisumu Airport', 'function'=>'AIS Products Management'),\n\t\t\t\t\t\tarray('station'=>'Malindi Airport', 'function'=>'AIS Products Management'),\n\t\t\t\t\t\tarray('station'=>'Wajir Airport', 'function'=>'AIS Products Management'),\n\t\t\t\t\t\tarray('station'=>'Lokochoggio Airport', 'function'=>'AIS Products Management'),\n\t\t\t\t\t\t\n\t\t\t\t\t\tarray('station'=>'Jomo Kenyatta International Airport', 'function'=>'Flight Planning Management'),\n\t\t\t\t\t\tarray('station'=>'Nairobi Wilson Airport', 'function'=>'Flight Planning Management'),\n\t\t\t\t\t\tarray('station'=>'Moi International Airport', 'function'=>'Flight Planning Management'),\n\t\t\t\t\t\tarray('station'=>'Eldoret International Airport', 'function'=>'Flight Planning Management'),\n\t\t\t\t\t\tarray('station'=>'Kisumu Airport', 'function'=>'Flight Planning Management'),\n\t\t\t\t\t\tarray('station'=>'Malindi Airport', 'function'=>'Flight Planning Management'),\n\t\t\t\t\t\tarray('station'=>'Wajir Airport', 'function'=>'Flight Planning Management'),\n\t\t\t\t\t\tarray('station'=>'Lokochoggio Airport', 'function'=>'Flight Planning Management'),\n\t\t\t\t\t\t\n\t\t\t\t\t\tarray('station'=>'Headquarters', 'function'=>'Maps and Charts Management'),\n\t\t\t\t\t\tarray('station'=>'Headquarters', 'function'=>'Terrain and Obstacle Data Management'),\n\t\t\t\t\t\tarray('station'=>'Headquarters', 'function'=>'Instrument/Visual flight procedure design'),\n\t\t\t\t\t\t\n\t\t\t\t\t\tarray('station'=>'Headquarters', 'function'=>'Technical library'),\n\t\t\t\t\t\tarray('station'=>'Jomo Kenyatta International Airport', 'function'=>'Technical library'),\n\t\t\t\t\t\tarray('station'=>'Jomo Kenyatta International Airport NOF', 'function'=>'Technical library'),\n\t\t\t\t\t\tarray('station'=>'Nairobi Wilson Airport', 'function'=>'Technical library'),\n\t\t\t\t\t\tarray('station'=>'Moi International Airport', 'function'=>'Technical library'),\n\t\t\t\t\t\tarray('station'=>'Eldoret International Airport', 'function'=>'Technical library'),\n\t\t\t\t\t\tarray('station'=>'Kisumu Airport', 'function'=>'Technical library'),\n\t\t\t\t\t\tarray('station'=>'Malindi Airport', 'function'=>'Technical library'),\n\t\t\t\t\t\tarray('station'=>'Wajir Airport', 'function'=>'Technical library'),\n\t\t\t\t\t\tarray('station'=>'Lokochoggio Airport', 'function'=>'Technical library'),\n\t\t);\n\t\t\n\t\t$stations = Station::all();\n\t\t$functions = Func::all();\n\t\t\n\t\tfor($i = 0; $i < count($station_func); $i++){\n\t\t\tforeach($stations as $station){\n\t\t\t\tif($station_func[$i]['station'] == $station->name){\n\t\t\t\t\tforeach($functions as $function){\n\t\t\t\t\t\tif($station_func[$i]['function'] == $function->name){\n\t\t\t\t\t\t\t$station->func()->attach($function);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n }", "public function addTrainingByType($residencyApplication,$typeName,$orderinlist,$maxNumber=1) {\n $user = $residencyApplication->getUser();\n\n $trainings = $user->getTrainings();\n //echo \"training count=\".count($trainings).\"<br>\";\n\n $count = 0;\n\n foreach( $trainings as $training ) {\n //echo \"training=\".$training->getTrainingType().\"<br>\";\n if( $training->getTrainingType() && $training->getTrainingType()->getName().\"\" == $typeName ) {\n //echo $typeName.\": count++=[\".$training->getTrainingType()->getName().\"]<br>\";\n $count++;\n }\n }\n //echo $typeName.\": maxNumber=\".$maxNumber.\", count=\".$count.\"<br>\";\n\n //add up to maxNumber\n for( $count; $count < $maxNumber; $count++ ) {\n //echo \"maxNumber=\".$maxNumber.\", count=\".$count.\"<br>\";\n $this->addSingleTraining($residencyApplication,$typeName,$orderinlist);\n }\n\n }", "function list_items($list)\n{\n\t$result = '';\n\tforeach ($list as $key => $value) {\n // Display each item and a newline\n $add = $key + 1; \n $result .= \"[{$add}] {$value}\\n\";\n }\n\t\n\treturn $result;\n}", "public function searchForPlayList();", "function listing() {\r\n\r\n }", "function travelL(){\n $swim = $this->_last;\n if($swim->next == null){\n echo __CLASS__,'->',__FUNCTION__ ,':No Object exist!<br>';\n return;\n }\n while($swim){\n echo $swim->data.'&nbsp;';\n $swim = $swim->next;\n }\n }", "function getDetailAllStationNext($common_id1,$DbConnection)\n {\n $query=\"SELECT station_id,station_name from station USE INDEX(stn_uaid_status) where user_account_id='$common_id1' AND status='1'\";\n //echo \"query=\".$query.\"<br>\";\n $result=mysql_query($query,$DbConnection);\t\t\n while($row=mysql_fetch_object($result))\n {\t\t\t\t\t\t\t\t\t\n /*$geo_id=$row->station_id;\n $geo_name=$row->station_name;*/\n\t\t\t\n $data[]=array('geo_id'=>$row->station_id,'geo_name'=>$row->station_name);\t\n }\n return $data;\t\t\t\t\t\t\n }", "function listNetworkAdd($searchadd){\n #sends the deconstructed IP to the networkAdd function\n\n\t\t$iplist = explode(\".\", $searchadd);\n\n\t\t$networkList = [];\n\n\t\tfor($i = 8; $i < 33; $i++){\n\t\t\t$ipvar = explode(\".\", $searchadd);\n\t\t\t$temp = networkAdd($ipvar, $i);\n\t\t\t$networkList[] = $temp;\n\t\t}\n\n\t\t#echo\"All network addresses</br>\";\n\n\t\treturn $networkList;\n\t}", "public function listing();", "private function getRTSListing(){\n\t\t\t\t\n\t\t// gather movie data\n\t\t$movie_data = json_decode(json_encode((array) simplexml_load_string($this->get_data('http://72352.formovietickets.com:2235/showtimes.xml'))), 1);\n\n\t\treturn $movie_data;\t\t\t\t\t\n\t}", "public function list();", "public function list();", "public function list();", "function find_closest_stations ($lat, $lng, $stations, $num, $recalc = FALSE) {\r\n\tstatic $R = 6371;\r\n\tstatic $distances = array();\r\n\t$closest = -1;\r\n\treset($distances);\r\n\t//if (count(array_diff($stations_cache,$stations)) > 0) {\r\n\t//\t$stations_cache = $stations;\r\n\t// \t$recalc = TRUE;\r\n\t//}\r\n\tif (count($distances) == 0 || $recalc) {\r\n\t\t$station_ids = array_keys( $stations );\r\n\t\tfor ( $i = 0 ; $i < count( $station_ids ) ; $i++ ) {\r\n\t\t\tif ( !isset( $stations[$station_ids[$i]] ) ) { continue; }\r\n\t\t\t// check for a duplicate station using an alternate ID, e.g. 999999XXXXX or XXXXXX99999\r\n\t\t\tif ( isset( $stations[$station_ids[$i]] ) && $stations[$station_ids[$i]]['usafid'] != '999999' && $stations[$station_ids[$i]]['wban'] != '99999' ) {\r\n\t\t\t\t$i_usafid_only = $stations[$station_ids[$i]]['usafid'] . '99999';\r\n\t\t\t\tif ( isset( $stations[$i_usafid_only] ) ) {\r\n\t\t\t\t\tunset( $stations[$i_usafid_only] );\r\n\t\t\t\t\tif ( isset( $distances[$i_usafid_only] ) ) {\r\n\t\t\t\t\t\tunset( $distances[$i_usafid_only] );\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t$i_wban_only = '999999' . $stations[$station_ids[$i]]['wban'];\r\n\t\t\t\tif ( isset( $stations[$i_wban_only] ) ) {\r\n\t\t\t\t\tunset( $stations[$i_wban_only] );\r\n\t\t\t\t\tif ( isset( $distances[$i_wban_only] ) ) {\r\n\t\t\t\t\t\tunset( $distances[$i_wban_only] );\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t$mlat = $stations[$station_ids[$i]]['lat'];\r\n\t\t\t$mlng = $stations[$station_ids[$i]]['lng'];\r\n\t\t\t$dLat = rad($mlat - $lat);\r\n\t\t\t$dLng = rad($mlng - $lng);\r\n\t\t\t$a = sin($dLat/2) * sin($dLat/2) +\r\n\t\t\t\tcos(rad($lat)) * cos(rad($lat)) * sin($dLng/2) * sin($dLng/2);\r\n\t\t\t$c = 2 * atan2(sqrt($a), sqrt(1-$a));\r\n\t\t\t$d = $R * $c;\r\n\t\t\t/* If the distance calculation results in is_nan($d), do not add it to the distances array. \r\n\t\t\tThese values will always be pushed to the top of the array, resulting in a poor \r\n\t\t\t\"closest station\" calculation. */\r\n\t\t\tif (!is_nan($d)) {\r\n\t\t\t\t$distances[$station_ids[$i]] = $d;\r\n\t\t\t}\r\n\t\t}\r\n\t\tasort($distances);\r\n\t} else {\r\n\t\tunset($distances[key($distances)]);\r\n\t}\r\n\treturn array_slice($distances,0,$num,TRUE);\r\n}", "public function waitservicelistAction()\n {\n\n $uid = $this->_USER_ID;\n $floorId = $this->getParam('CF_floorid');\n\n $mbllApi = new Mbll_Tower_ServiceApi($uid);\n $aryRst = $mbllApi->getWaitServiceList($floorId);\n\n if (!$aryRst || !$aryRst['result']) {\n $errParam = '-1';\n if (!empty($aryRst['errno'])) {\n $errParam = $aryRst['errno'];\n }\n return $this->_redirectErrorMsg($errParam);\n }\n\n //service list info\n $waitServiceList = $aryRst['result']['list'];\n\n foreach ($waitServiceList as $key => $value) {\n $guest = Mbll_Tower_GuestTpl::getGuestDescription($value['tp']);\n //guest name\n $guestName = explode(\"|\", $guest['des']);\n $waitServiceList[$key]['name'] = $guestName[0];\n //need item\n $needItem = Mbll_Tower_ItemTpl::getItemDescription($value['ac']);\n $waitServiceList[$key]['ac_name'] = $needItem['name'];\n //mood picture\n $waitServiceList[$key]['moodPic'] = round($value['ha']/10)*10;\n\n $waitServiceList[$key]['ha_emoj'] = Mbll_Tower_Common::getMoodDesc($value['ha']);\n //leave time\n $waitServiceList[$key]['remain_hour'] = floor(($value['ot'] - $value['ct'])/3600);\n $waitServiceList[$key]['remain_minute'] = strftime('%M', $value['ot'] - $value['ct']);\n }\n\n $this->view->waitServiceList = $waitServiceList;\n $this->view->countService = count($waitServiceList);\n $this->view->floorid = $floorId;\n $this->render();\n }", "function traiter_listes($t) {\n\tstatic $wheel = null;\n\n\tif (!isset($wheel)) {\n\t\t$wheel = new TextWheel(\n\t\t\tSPIPTextWheelRuleset::loader($GLOBALS['spip_wheels']['listes'])\n\t\t);\n\t}\n\n\ttry {\n\t\t$t = $wheel->text($t);\n\t} catch (Exception $e) {\n\t\terreur_squelette($e->getMessage());\n\t}\n\n\treturn $t;\n}", "public function getCheckInTaskListList(){\n return $this->_get(2);\n }", "function head(array $list)\n{\n return array_shift($list);\n}", "protected function getInstrList()\n {\n\t$isconnected = $this->cedarconnect() ;\n\tif( $isconnected != \"good\" )\n\t{\n\t print( \"$isconnected\\n\" ) ;\n\t exit( 0 ) ;\n\t}\n\n\t$query = \"SELECT DISTINCT KINST, INST_NAME, PREFIX from tbl_instrument\" ;\n\n\t//print( \"$query\\n\" ) ;\n\n\t$result = parent::dbquery( $query ) ;\n\t$num_rows = mysql_num_rows( $result ) ;\n\tif( $num_rows != 0 )\n\t{\n\t while( $line = mysql_fetch_row( $result ) )\n\t {\n\t\tif( $line )\n\t\t{\n\t\t $colnum = 0 ;\n\t\t foreach( $line as $value )\n\t\t {\n\t\t\tif( $colnum > 0 ) echo \",\" ;\n\t\t\techo $value ;\n\t\t\t$colnum++ ;\n\t\t }\n\t\t echo \"\\n\" ;\n\t\t}\n\t }\n\t}\n\n\tparent::dbclose( $result ) ;\n }", "function info_list(){\r\n\t\t\r\n\t\t$query = isset($_POST['query']) ? $_POST['query'] : \"\";\r\n\t\t$start = (integer) (isset($_POST['start']) ? $_POST['start'] : $_GET['start']);\r\n\t\t$end = (integer) (isset($_POST['limit']) ? $_POST['limit'] : $_GET['limit']);\r\n\r\n\t\t$result=$this->m_info->info_list($query,$start,$end);\r\n\t\techo $result;\r\n\t}", "public static function getTwistyListForFront(){\n\t\t$sql = 'SELECT id_twisty,product_name,ord.id_order,ord.total_paid_tax_incl,od.product_reference,product_ean13,product_quantity,tor.id_order_detail,qte_picked,id_box,is_finished,date_twisty,payment,total_shipping '.\n\t\t'FROM '._DB_PREFIX_.'twisty_orders tor '.\n\t\t'LEFT JOIN '._DB_PREFIX_.'order_detail od ON od.id_order_detail=tor.id_order_detail '.\n\t\t'LEFT JOIN '._DB_PREFIX_.'orders ord ON ord.id_order=od.id_order '.\n\t\t'WHERE ord.id_order in ('.\n\t\t'\tSELECT id_order '.\n\t\t'\tFROM '._DB_PREFIX_.'twisty_orders tor '.\n\t\t'\tLEFT JOIN '._DB_PREFIX_.'order_detail od ON od.id_order_detail=tor.id_order_detail '.\n\t\t'\tGROUP BY id_order '.\n\t\t'\tHAVING count(tor.id_order_detail)=sum(is_valid) and count(tor.id_order_detail)=sum(tor.is_show) '.\n\t\t') '.\n\t\t'ORDER BY id_box,product_ean13';\n\t\tif ($results = Db::getInstance()->ExecuteS($sql))\n\t\t\treturn $results;\n\t}", "function get_isi_rawat_list(){\r\n\t\t$dapaket_dpaket = isset($_POST['dapaket_dpaket']) ? $_POST['dapaket_dpaket'] : 0;\r\n\t\t$dapaket_jpaket = isset($_POST['dapaket_jpaket']) ? $_POST['dapaket_jpaket'] : 0;\r\n\t\t$dapaket_paket = isset($_POST['dapaket_paket']) ? $_POST['dapaket_paket'] : 0;\r\n\t\t$start = (integer) (isset($_POST['start']) ? $_POST['start'] : $_GET['start']);\r\n\t\t$end = (integer) (isset($_POST['limit']) ? $_POST['limit'] : $_GET['limit']);\r\n\t\t$result = $this->m_master_ambil_paket->get_isi_rawat_list($dapaket_dpaket,$dapaket_jpaket,$dapaket_paket,$start,$end);\r\n\t\techo $result;\r\n\t}", "function fann_set_train_stop_function($ann, $stop_function)\n{\n}", "abstract protected function displayList($list);", "function Parsser($list) {\r\n $array = explode(\" \",$list);\r\n if ($array[0]==\"createCart\" )\r\n {\r\n // $currancy = $this -> setCurrancy($array);\r\n $itemList = $this-> setItemList($array);\r\n }\r\n return $array;\r\n }", "function testFl($destinationLocation, $originLocation, $departureDate, $adultNo, $childNo, $infantNo, $flightClass)\n{\n $seatRequested = $adultNo+$childNo;//+$infantNo;\n $childExist = \"\";\n $infantExist = \"\";\n if( $childNo != 0 ) {\n $childExist = '<PassengerTypeQuantity Code=\"CNN\" Quantity=\"'.$childNo.'\" />';\n }\n if( $infantNo != 0 ) {\n $infantExist = '<PassengerTypeQuantity Code=\"INF\" Quantity=\"'.$infantNo.'\" />';\n }\n $service = new SWSWebService(\"[email protected]\",\"8888\",\"CTC78866\",\"8HYD\",\"https://webservices.sabre.com/websvc\");\n if($service->SessionCreate())\n {\n if($service->SessionValidate())\n {\n $OTA_AirLowFareSearchRQ = '\n <OTA_AirLowFareSearchRQ xmlns=\"http://www.opentravel.org/OTA/2003/05\" ResponseType=\"OTA\" Version=\"3.4.0\" AvailableFlightsOnly=\"true\">\n <POS>\n <Source PseudoCityCode=\"8HYD\">\n <RequestorID ID=\"1\" Type=\"1\">\n <CompanyName Code=\"TN\" />\n </RequestorID>\n </Source>\n </POS>\n <OriginDestinationInformation RPH=\"1\">\n <DepartureDateTime>'.$departureDate.'</DepartureDateTime>\n <OriginLocation LocationCode=\"'.$originLocation.'\" />\n <DestinationLocation LocationCode=\"'.$destinationLocation.'\" />\n <TPA_Extensions>\n <SegmentType Code=\"O\" />\n <IncludeVendorPref Code=\"AA\"/>\n <IncludeVendorPref Code=\"AC\"/>\n <IncludeVendorPref Code=\"AF\"/>\n <IncludeVendorPref Code=\"AI\"/>\n <IncludeVendorPref Code=\"BA\"/>\n <IncludeVendorPref Code=\"BI\"/>\n <IncludeVendorPref Code=\"BR\"/>\n <IncludeVendorPref Code=\"CA\"/>\n <IncludeVendorPref Code=\"CI\"/>\n <IncludeVendorPref Code=\"CX\"/>\n <IncludeVendorPref Code=\"CZ\"/>\n <IncludeVendorPref Code=\"DG\"/>\n <IncludeVendorPref Code=\"DL\"/>\n <IncludeVendorPref Code=\"EK\"/>\n <IncludeVendorPref Code=\"EY\"/>\n <IncludeVendorPref Code=\"FJ\"/>\n <IncludeVendorPref Code=\"GA\"/>\n <IncludeVendorPref Code=\"GF\"/>\n <IncludeVendorPref Code=\"IT\"/>\n <IncludeVendorPref Code=\"JL\"/>\n <IncludeVendorPref Code=\"KE\"/>\n <IncludeVendorPref Code=\"KL\"/>\n <IncludeVendorPref Code=\"LA\"/>\n <IncludeVendorPref Code=\"LH\"/>\n <IncludeVendorPref Code=\"LX\"/>\n <IncludeVendorPref Code=\"MF\"/>\n <IncludeVendorPref Code=\"MH\"/>\n <IncludeVendorPref Code=\"MI\"/>\n <IncludeVendorPref Code=\"MK\"/>\n <IncludeVendorPref Code=\"MU\"/>\n <IncludeVendorPref Code=\"NH\"/>\n <IncludeVendorPref Code=\"NZ\"/>\n <IncludeVendorPref Code=\"OD\"/>\n <IncludeVendorPref Code=\"OZ\"/>\n <IncludeVendorPref Code=\"PG\"/>\n <IncludeVendorPref Code=\"PR\"/>\n <IncludeVendorPref Code=\"PX\"/>\n <IncludeVendorPref Code=\"QF\"/>\n <IncludeVendorPref Code=\"QR\"/>\n <IncludeVendorPref Code=\"QV\"/>\n <IncludeVendorPref Code=\"SK\"/>\n <IncludeVendorPref Code=\"SQ\"/>\n <IncludeVendorPref Code=\"SU\"/>\n <IncludeVendorPref Code=\"TG\"/>\n <IncludeVendorPref Code=\"TK\"/>\n ';\n if($infantNo == 0) {\n $OTA_AirLowFareSearchRQ .= '<IncludeVendorPref Code=\"TR\"/><IncludeVendorPref Code=\"TT\"/>\n ';}\n else if($childNo == 0) {\n $OTA_BargainMaxFinder .= '\n <IncludeVendorPref Code=\"OD\"/>\n ';\n }\n else {\n\n }\n $OTA_AirLowFareSearchRQ .= '\n <IncludeVendorPref Code=\"TZ\"/><IncludeVendorPref Code=\"UA\"/>\n <IncludeVendorPref Code=\"UB\"/>\n <IncludeVendorPref Code=\"UL\"/>\n <IncludeVendorPref Code=\"VA\"/>\n <IncludeVendorPref Code=\"VN\"/>\n <IncludeVendorPref Code=\"WY\"/>\n <IncludeVendorPref Code=\"8M\"/>\n <IncludeVendorPref Code=\"9W\"/>\n </TPA_Extensions>\n </TPA_Extensions>\n </OriginDestinationInformation>\n <TravelPreferences ValidInterlineTicket=\"false\" SmokingAllowed=\"false\" ETicketDesired=\"false\" MaxStopsQuantity=\"2\">\n <CabinPref PreferLevel=\"Only\" Cabin=\"'.$flightClass.'\"/>\n <TPA_Extensions>\n <TripType Value=\"OneWay\" />\n <LongConnectTime Min=\"780\" Max=\"1200\" Enable=\"true\" />\n <ExcludeCallDirectCarriers Enabled=\"true\" />\n </TPA_Extensions>\n </TravelPreferences>\n <TravelerInfoSummary>\n <SeatsRequested>'.$seatRequested.'</SeatsRequested>\n <AirTravelerAvail>\n <PassengerTypeQuantity Code=\"ADT\" Quantity=\"'.$adultNo.'\" />\n '.$childExist.'\n '.$infantExist.'\n </AirTravelerAvail>\n <PriceRequestInformation NegotiatedFaresOnly=\"false\" CurrencyCode=\"SGD\">\n </PriceRequestInformation>\n </TravelerInfoSummary>\n <TPA_Extensions>\n <IntelliSellTransaction>\n <RequestType Name=\"150ITINS\" />\n <CompressResponse Value=\"false\"/>\n </IntelliSellTransaction>\n </TPA_Extensions>\n </OTA_AirLowFareSearchRQ>​';\n $xml = $service->Execute(\"BargainFinderMaxRQ\",$OTA_AirLowFareSearchRQ,\"OTA\",\"Air\");\n echo '<xmp>'.$OTA_AirLowFareSearchRQ.'</xmp>';\n\n $parseResult = simplexml_load_string($xml);\n $arrayFinalFlight = json_decode(json_encode($parseResult), true);\n\n echo '<pre>';\n var_dump($arrayFinalFlight);\n die();\n\n if( $xml ) {\n\n //$result_test = XMLtoArray($xml);\n return $xml;\n }\n else {\n echo htmlspecialchars($service->error);\n }\n }\n else {\n echo htmlspecialchars($service->error);\n }\n }\n else {\n echo htmlspecialchars($service->error);\n }\n}", "function customer_list(){\r\n\t\t\r\n\t\t$query = isset($_POST['query']) ? $_POST['query'] : \"\";\r\n\t\t$start = (integer) (isset($_POST['start']) ? $_POST['start'] : $_GET['start']);\r\n\t\t$end = (integer) (isset($_POST['limit']) ? $_POST['limit'] : $_GET['limit']);\r\n\r\n\t\t$result=$this->m_customer->customer_list($query,$start,$end);\r\n\t\techo $result;\r\n\t}", "function get_number_of_triples(){\n\t\n\tGLOBAL $cmd_pre;\n\tGLOBAL $cmd_post;\n\t\n\t$qry = \"select count(*) where { graph ?g {?x ?y ?z} FILTER regex(?g, \\\"bio2rdf\\\") }\";\n\t\n\t$cmd = $cmd_pre.$qry.$cmd_post;\n\t\n\t$out = \"\";\n\t\n\ttry {\n\t\t$out = execute_isql_command($cmd);\n\t} catch (Exception $e){\n\t\techo 'iSQL error: ' .$e->getMessage();\n\t\treturn null;\n\t}\n\n\t$split_results = explode(\"Type HELP; for help and EXIT; to exit.\\n\", $out);\n\t$split_results_2 = explode(\"\\n\\n\", $split_results[1]);\n\t\n\t\t$results = trim($split_results_2[0]);\n\t\n\tif (preg_match(\"/^0 Rows./is\", $results) === 0) {\n\t\treturn $results;\n\t} else {\n\t\treturn null;\n\t}\n\t\n}", "public function actionTCIs()\n\t{\n\t\tif (ctype_digit(@$_GET['page'])) $this->page = $_GET['page'];\n\t\t$this->renderPartial('_list',array('operations'=>$this->getTransportList($_GET)));\n\t}", "public function showTrails()\n {\n return $this->load->model('Trail')->fetchTrails();\n }", "function skip($count);", "public function index()\n\t{\n\t\t$trainings = Training::select(DB::raw('id, title'))\n\t\t\t\t\t\t\t->where('isActive','=',true)\n\t\t\t\t\t\t\t->where('isInternalTraining','=',true)\n\t\t\t\t\t\t\t->where('isTrainingPlan','=',true)\n\t\t\t\t\t\t\t->get();\n\n\t\t$consecutive_trainings = array();\n\t\t$separated_trainings = array();\n\n\t\tforeach ($trainings as $key => $value) {\n\t\t\tif($value->is_consecutive)\n\t\t\t{\n\t\t\t\tarray_push($consecutive_trainings, $value);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tforeach ($value->all_date as $k => $v) {\n\t\t\t\t\tarray_push($separated_trainings, array('id' => $value->id, 'title' => $value->title, 'start' => $v->date_scheduled));\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t}\n\n\t\treturn View::make('training_plan.index')\n\t\t\t\t\t->with('consecutive_trainings',$consecutive_trainings)\n\t\t\t\t\t->with('separated_trainings',$separated_trainings);\n\t}", "function printLinkedLists($head) {\n $i=0;\n echo \"[\";\n while ($head != null && $i<20) {\n $i++;\n echo $head -> data;\n $head = $head -> next;\n if ($head != null) {\n echo \" \";\n }\n }\n echo \"]\\n\";\n}", "public function __construct($trips)\n {\n $this->compTrips = $trips;\n }", "function getStart($tab, $nbLigne, $nbChar){\n\n \n $z = 0;//check 0\n $u = 0;//check 1\n $add = 0;\n $err4 = \"Il manque un point de départ ou d'arrivée!\".PHP_EOL;\n\n $xd = 0;\n $yd = 0; //coord du point de départ\n\n $xa = 0;\n $ya = 0; //coord du point d'arrivée \n\n for ($j=0; $j<$nbLigne; $j++){ \n for ($i=0; $i<$nbChar; $i++){ \n \n if ($tab[$j][$i] === '0'){\n $z++;\n $z = $z++; // echo $z.' check 0'.PHP_EOL; \n //RECHERCHE DE COORDONNEES\n $xd = $i;// \n echo \"xd=\".($xd).\" \";\n $yd = $j;// \n echo \"yd=\".($yd).PHP_EOL;\n }\n if ($tab[$j][$i] === '1'){\n $u++;\n $u = $u++; // echo $u .' check 1'.PHP_EOL;\n //RECHERCHE DE COORDONNEES\n $xa = $i;//\n echo \"xa=\".($xa).\" \";\n $ya = $j;//\n echo \"ya=\".($ya).PHP_EOL; \n } \n }\n }\n\n if ($z === 1 && $u === 1){\n play($tab, $nbLigne, $nbChar, $xd, $yd, $xa, $ya); //echo \"the play can beggin\".PHP_EOL;\n }\n else\n exit($err4);\n}", "function listTransitions($workflowId, $page = null, $rownums = null);", "function runListFeatures()\n{\n echo \"Running ListFeatures...\\n\";\n global $client;\n\n $lo_point = new Routeguide\\Point();\n $hi_point = new Routeguide\\Point();\n\n $lo_point->setLatitude(400000000);\n $lo_point->setLongitude(-750000000);\n $hi_point->setLatitude(420000000);\n $hi_point->setLongitude(-730000000);\n\n $rectangle = new Routeguide\\Rectangle();\n $rectangle->setLo($lo_point);\n $rectangle->setHi($hi_point);\n\n // start the server streaming call\n $call = $client->ListFeatures($rectangle);\n // an iterator over the server streaming responses\n $features = $call->responses();\n foreach ($features as $feature) {\n printFeature($feature);\n }\n}", "public function lists();", "public function traininglist()\n {\n return view('training.opentraining.index');\n }", "function GasStation($strArr) {\r\n $totalGasAtStation = 0;\r\n $totalGasToTravel = 0;\r\n $totalNumGasStation = array_shift($strArr);\r\n for ($i = 0; $i < $totalNumGasStation; $i++) {\r\n $gas = explode(':',$strArr[$i]);\r\n $totalGasAtStation = $totalGasAtStation + $gas[0];\r\n $totalGasToTravel = $totalGasToTravel + $gas[1];\r\n }\r\n if ($totalGasAtStation < $totalGasToTravel) {\r\n $strArr = \"impossible\";\r\n }\r\n // iterate through the routes \r\n else {\r\n \r\n $iteration = 0;\r\n $foundloop = false;\r\n while (($foundloop == false) && ($iteration <= $totalNumGasStation)) {\r\n $iteration++;\r\n $gasTank = 0;\r\n $isBrokeDown = false;\r\n $gasStationNum = 0;\r\n for ($gasStationNum; $gasStationNum < $totalNumGasStation; $gasStationNum++) {\r\n \r\n $gas = explode(':',$strArr[$gasStationNum]);\r\n $gasTank = $gasTank + $gas[0] - $gas[1];\r\n if ($gasTank < 0) {\r\n \r\n $isBrokeDown = true;\r\n break;\r\n }\r\n }\r\n \r\n if (($isBrokeDown == FALSE) && ($gasStationNum == 4)) {\r\n $strArr = $iteration;\r\n $foundloop = true;\r\n }\r\n else {\r\n $deltaGasStation = array_shift($strArr);\r\n $strArr[] = $deltaGasStation;\r\n\r\n }\r\n }\r\n }\r\n return $strArr; \r\n\r\n}", "public function test_start_retrieves_sessionid_list()\n {\n $called = false;\n\n $this->sessionStub->setSessionId(321);\n\n $this->monitor->on('list', function () use (&$called) {\n $called = true;\n });\n\n $this->monitor->start();\n\n $this->sessionStub->respondToCall(SessionMonitor::SESSION_LIST_TOPIC, [[321]]);\n\n $this->assertTrue($called);\n }" ]
[ "0.5781081", "0.54503745", "0.5128231", "0.5019329", "0.50053805", "0.4991708", "0.4963868", "0.49330297", "0.4860214", "0.48550525", "0.4843406", "0.48130915", "0.47894514", "0.47403437", "0.47088164", "0.47008035", "0.4679761", "0.46698704", "0.4655264", "0.46517396", "0.46510944", "0.46334386", "0.4629772", "0.4623559", "0.46143854", "0.46136475", "0.4611508", "0.46076944", "0.4601931", "0.4600994", "0.45994624", "0.45648837", "0.45648414", "0.45602447", "0.45575398", "0.4555198", "0.45545435", "0.45376852", "0.45194477", "0.45189026", "0.45163926", "0.45163926", "0.4515524", "0.4515418", "0.4505573", "0.4501962", "0.44999772", "0.44971347", "0.44848785", "0.4474753", "0.44693273", "0.44681895", "0.44666427", "0.44591522", "0.44545788", "0.44518194", "0.44453043", "0.4442745", "0.44424295", "0.44309008", "0.44282186", "0.44223076", "0.44186628", "0.44166857", "0.44145826", "0.43992764", "0.43963456", "0.43921652", "0.43875638", "0.43871972", "0.43871972", "0.43871972", "0.43842807", "0.4383526", "0.4379121", "0.43773478", "0.43631226", "0.4360279", "0.43584016", "0.43494725", "0.43478763", "0.4345172", "0.43447", "0.43418705", "0.4340652", "0.43383485", "0.4337875", "0.433327", "0.43286827", "0.43221208", "0.4321944", "0.43215126", "0.431133", "0.4308106", "0.43020678", "0.42978114", "0.42976016", "0.42964137", "0.42888683", "0.4285644" ]
0.62130743
0
function takes a trip id and returns an array of the remaining stops
function nextTrip($database, $trip_id, $stop_seq) { //gets the trip $query = array("trip_id" => $trip_id, "stop_sequence" => array('$gte' => $stop_seq)); $cursor = $database->stop_times->find( $query )->sort(array("stop_sequence" => 1)); //print_debug($cursor); //print_r($cursor); return ($cursor); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function getScheduleByIdGroupedByTrip($id){\n $schedule = self::getScheduleById($id);\n if (empty($schedule->data)) {\n //should really return the same error here\n return false;\n }\n $trips = [];\n foreach($schedule->data as $stop){\n $tripid = $stop->relationships->trip->data->id;\n $trips[$tripid] = $trips[$tripid] ?? [];\n array_push($trips[$tripid], $stop);\n }\n return $trips;\n }", "public static function getStop($id){\n if (!empty(self::$stops[$id])) {\n return self::$stops[$id];\n }\n $curl = curl_init('https://api-v3.mbta.com/stops/'.$id);\n curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); \n $result = curl_exec($curl);\n curl_close($curl);\n self::$stops[$id] = json_decode($result);\n return self::$stops[$id];\n }", "function getRoutesWithStage($stop_id){\n\t\t\t$routes_stops_ids = query(\"SELECT `route_id` FROM `tbl_route_stops` WHERE `stop_id` = ?\", $stop_id);\n\t\t\tforeach ($routes_stops_ids as $key => $routes_stops_id) {\n\t\t\t\t$routes_stops[] = $this->getRoute($routes_stops_id['route_id']);\n\t\t\t}\n\t\t\treturn $routes_stops;\n\t\t}", "function Stop($id = null) {\r\n\r\n\t# if no $id name is sent call it '~stopped'\r\n\tif ($id == null) $id = '~stopped';\r\n\r\n\t# enter a stop interval time\r\n\t$this->Interval($id);\r\n\r\n\t# sum all intervals\r\n\t$tot = 0;\r\n\tforeach ($this->intervals as $t) $tot += $t;\r\n\r\n\t# make a total time entry in the array\r\n\t$this->AddInterval(\"~total time\", $tot);\r\n\r\n\t# return the complete array\r\n\treturn $this->AllIntervals();\r\n\r\n# end function\r\n}", "public function getAllStops();", "public function getStops()\n {\n return $this->Stops;\n }", "protected function _getStops($leg){\n \n $result = self::NONSTOP;\n \n if(!is_array($leg['segments'])) return $result;\n \n $count = count($leg['segments']);\n \n if($count > 1){\n \n $result = count($leg['segments']) == 2 ? self::ONE_STOP : sprintf(self::MULTIPLE_STOPS, $count);\n \n }\n \n return $result;\n \n }", "public static function getTrip($id){\n if (!empty(self::$trips[$id])) {\n return self::$trips[$id];\n }\n $curl = curl_init('https://api-v3.mbta.com/trips/'.$id);\n curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); \n $result = curl_exec($curl);\n curl_close($curl);\n self::$trips[$id] = json_decode($result);\n return self::$trips[$id];\n }", "private function extractFirstLastTrip()\n {\n // If trip is shorter than 3 legs, there is actually no need anymore\n if (count($this->tripCollection) < 2) {\n return $this->tripCollection;\n }\n\n // Find the start and end point for the trips\n for ($i = 0, $max = count($this->tripCollection); $i < $max; $i++) {\n $hasPreviousTrip = false;\n $isLastTrip = true;\n\n foreach ($this->tripCollection as $index => $trip) {\n // If this trip is attached to a previous trip, we pass!\n if (strcasecmp($this->tripCollection[$i]['Departure'], $trip['Arrival']) == 0) {\n $hasPreviousTrip = true;\n } // If this trip is not the last trip, we pass!\n elseif (strcasecmp($this->tripCollection[$i]['Arrival'], $trip['Departure']) == 0) {\n $isLastTrip = false;\n }\n }\n\n // We found the start point of the trip,\n // so we put it on the top of the list\n if (!$hasPreviousTrip) {\n array_unshift($this->tripCollection, $this->tripCollection[$i]);\n unset($this->tripCollection[$i]);\n } // And the end of the trip\n elseif ($isLastTrip) {\n array_push($this->tripCollection, $this->tripCollection[$i]);\n unset($this->tripCollection[$i]);\n }\n\n }\n\n // Reset indexes\n $this->tripCollection = array_merge($this->tripCollection);\n }", "function getItineraryDataAll($trip_id=0)\n\t{ \n\t\tif(!is_numeric($trip_id))\n\t\t\treturn false;\n\n\t\t$itineraries = $this->getItineraries($trip_id);\n\n\t\t$tbls = array('trip_destinations','trip_accommodation','trip_services','trip_vehicles');\n\t\t$retArray = array();\n\t\tif($itineraries!=false){\n\t\tforeach($itineraries as $itinerary){\n\t\t\tforeach($tbls as $tbl){\n\t\t\t\t$tbleData = $this->getItineraryData($itinerary['id'],$tbl);\n\t\t\t\tif($tbleData)\n\t\t\t\t\t$retArray[$itinerary['date']][$tbl]=$tbleData;\n\t\t\t}\n\t\t}\n\n\t\treturn $retArray;\n\t\t}\n\t\t\n\t}", "function buildItinerary($trip_id=0)\n\t{\n\t\t/*$filter = array(\n\t\t\t\t'id' => $trip_id,\n\t\t\t\t'DATEADD(DAY,number+1,@Date1) < ' => 'drop_date');\n\t\t$this->db->select('DATEADD(DAY,number+1,pickup_date) [itinerary]');\n\t\t$this->db->from('trips');\n\t\t$this->db->where($filter);*/\n\t\t$this->db->select('pick_up_date,drop_date');\n\t\t$this->db->from('trips');\n\t\t$this->db->where('id',$trip_id);\n\t\t$query = $this->db->get();\n\t\t$itinerary = array();\n\t\tif($query->num_rows() == 1)\n\t\t{\n\t\t\t$row = $query->row();\n\t\t\t\n\t\t\t$itinerary[] = $row->pick_up_date;\n\n\t\t\t$next = date('Y-m-d', strtotime($row->pick_up_date . ' + 1 day'));\n\t\t\twhile(strtotime($row->drop_date) >= strtotime($next)){\n\t\t\t\t$itinerary[] = $next;\n\t\t\t\t$next = date('Y-m-d', strtotime($next . ' + 1 day'));\n\t\t\t}\n\t\t\treturn $itinerary;\n\t\t\t\n\t\t}else{\n\t\t\treturn false;\n\t\t}\n\n\t}", "public function getStop($stopId);", "function getTourValues($trip_id){\n\n\t\t$itineraries = $this->getItineraries($trip_id);\n\t\t$retArray = array('tour_vehicles'=>array(),\n\t\t\t\t'tour_hotels'=>array(),\n\t\t\t\t'tour_services'=>array()\n\t\t\t\t);\n\t\tif($itineraries){\n\t\t\t$itryIds = array();\n\t\t\tforeach($itineraries as $itry){\n\t\t\t\tarray_push($itryIds,$itry['id']);\n\t\t\t}\n\n\t\t\t//tour vehicles\n\t\t\t$this->db->select('v.id,v.registration_number');\n\t\t\t$this->db->from('trip_vehicles tv');\n\t\t\t$this->db->join('vehicles v','v.id = tv.vehicle_id','left');\n\t\t\t$qry=$this->db->where_in('itinerary_id',$itryIds);\n\t\t\t$qry=$this->db->get();\n\t\t\tif($qry->num_rows() > 0){\n\t\t\t\t$list = $qry->result_array();\n\t\t\t\tforeach($list as $row){\n\t\t\t\t\t$retArray['tour_vehicles'][$row['id']]=$row['registration_number'];\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t//tour hotels\n\t\t\t$this->db->select('h.id,h.name');\n\t\t\t$this->db->from('trip_accommodation ta');\n\t\t\t$this->db->join('hotels h','h.id = ta.hotel_id','left');\n\t\t\t$qry=$this->db->where_in('itinerary_id',$itryIds);\n\t\t\t$qry=$this->db->get();\n\t\t\tif($qry->num_rows() > 0){\n\t\t\t\t$list = $qry->result_array();\n\t\t\t\tforeach($list as $row){\n\t\t\t\t\t$retArray['tour_hotels'][$row['id']]=$row['name'];\n\t\t\t\t}\n\t\t\t}\n\n\n\t\t\t//tour services\n\t\t\t$this->db->select('s.id,s.name');\n\t\t\t$this->db->from('trip_services ts');\n\t\t\t$this->db->join('services s','s.id = ts.service_id','left');\n\t\t\t$qry=$this->db->where_in('itinerary_id',$itryIds);\n\t\t\t$qry=$this->db->get();\n\t\t\tif($qry->num_rows() > 0){\n\t\t\t\t$list = $qry->result_array();\n\t\t\t\tforeach($list as $row){\n\t\t\t\t\t$retArray['tour_services'][$row['id']]=$row['name'];\n\t\t\t\t}\n\t\t\t}\n\n\n\t\t\t\n\t\t}\n\n\t\t//echo \"<pre>\";print_r($retArray);echo \"</pre>\";exit;\n\t\treturn $retArray;\n\n\t}", "function getItineraries($trip_id = 0)\n\t{\n\t\t$this->db->from('itinerary');\n\t\t$this->db->where('trip_id',$trip_id);\n\t\t$query = $this->db->get();\n\t\tif($query->num_rows() > 0)\n\t\t\treturn $query->result_array();\n\t\telse\n\t\t\treturn false;\n\t}", "private function findTrips($html) {\n\t\t$trips = array();\n\n\t\tforeach ($html->find('.reiselistsub') as $trip) {\n\n\t\t\t$singleTrip = array(\"title\" => trim($trip->find('b', 0)->plaintext), \"excerpt\" => trim($trip->find('a img')[0]->alt), \"description\" => trim($trip->find('span', 0)->plaintext), \"img\" => $trip->find('a img')[0]->src, \"category\" => \"\", \"saison\" => \"\", \"price\" => $this->formatPrice($trip->find('font b', 0)->plaintext), \"booking_url\" => $trip->find('a', 0)->href);\n\n\t\t\tarray_push($trips, $singleTrip);\n\t\t}\n\n\t\treturn $trips;\n\t}", "function get_other_buses($stopcode)\n{\n\n\t$url = \"http://api.bus.southampton.ac.uk/stop/\" . $stopcode . \"/buses\";\n\t$data = json_decode(file_get_contents($url), true);\n\t$ret = array();\n\tforeach($data as $item)\n\t{\n\t\t$operator = preg_replace(\"#^([^/]+)/.*$#\", \"$1\", $item['id']);\n\t\tif(strcmp($operator, \"BLUS\") == 0) { continue; }\n\t\tif(strcmp($operator, \"UNIL\") == 0) { continue; }\n\n\t\t$bus = array();\n\t\t$bus['name'] = $item['name'];\n\t\t$bus['dest'] = $item['dest'];\n\t\t$bus['date'] = $item['date'];\n\t\t$bus['time'] = date(\"H:i\", $item['date']);\n\t\t$bus['journey'] = $item['journey'];\n\t\t$ret[] = $bus;\n\t}\n\treturn($ret);\n}", "public function getPreviousAndNextSibblings($id)\n {\n $sibblings = $this->getSibblings($id);\n\n for ($i = 0; $i < count($sibblings); $i++) {\n\n if ($sibblings[$i]->id === $id) {\n $prev = $sibblings[$i - 1] ?? null;\n $next = $sibblings[$i + 1] ?? null;\n return [$prev, $next];\n }\n }\n }", "public function getTrips()\n {\n return $this->hasMany(Trip::className(), ['currency_id' => 'id']);\n }", "public static function download_start_stop_time_by_id($measurement_id)\r\n {\r\n\t\t$result_get_data_json = TracerouteMeasurement::get_measurement_data_by_id($measurement_id);\r\n\t\t\r\n\t\t/*\r\n $description = $result_get_data_json[description];\r\n $address_family = $result_get_data_json[af];\r\n\t\tif ($result_get_data_json[proto_tcp]) {\r\n\t\t\t$protocol = \"TCP\";\r\n\t\t} else {\r\n\t\t\t$protocol = $result_get_data_json[protocol];\r\n\t\t}\r\n\t\t*/\r\n\t\t\r\n $creation_time_unix = $result_get_data_json[creation_time];\r\n\t\t$start_time_unix = $result_get_data_json[start_time];\r\n $stop_time_unix = $result_get_data_json[stop_time];\r\n\r\n\t\t$creation_time = date(\"Y-m-d H:i:s\", $creation_time_unix);\r\n\t\t$start_time = date(\"Y-m-d H:i:s\", $start_time_unix);\r\n\t\t$stop_time = date(\"Y-m-d H:i:s\", $stop_time_unix);\r\n\t\t\r\n\t\t/*\r\n $response_timeout = $result_get_data_json[response_timeout];\r\n $paris = $result_get_data_json[paris];\r\n $packets = $result_get_data_json[packets];\r\n $port = $result_get_data_json[port];\r\n $size = $result_get_data_json[size];\r\n $maxhops = $result_get_data_json[maxhops];\r\n\t\t\r\n $number_of_probes_involved = $result_get_data_json[participant_count];\r\n\t\t\r\n $target_address = $result_get_data_json[dst_addr];\r\n $target_asn = $result_get_data_json[dst_asn];\r\n $target_name = $result_get_data_json[dst_name];\r\n\t\t\r\n\t\techo $description;\r\n\t\techo '<br/>';\r\n\t\techo $address_family;\r\n\t\techo '<br/>';\r\n\t\techo $protocol;\r\n\t\techo '<br/>';\r\n\t\techo $creation_time;\r\n\t\techo '<br/>';\r\n echo $start_time;\r\n\t\techo '<br/>';\r\n\t\techo $stop_time;\r\n\t\techo '<br/>';\r\n\t\t*/\r\n\r\n\t\t// create and check connection\r\n $link = CheckrouteDatabase::connect();\r\n\r\n\t\t// write information on new measurement to database\r\n\t\t$stmt = mysqli_prepare($link, \"UPDATE `TracerouteMeasurement` SET `creation_time`=?, `start_time`=?, `end_time`=? WHERE `id` = ?\");\r\n\t\tif ($stmt === false) {\r\n\t\t\ttrigger_error('Error: Insert statement failed. ' . htmlspecialchars(mysqli_error($mysqli)), E_USER_ERROR);\r\n\t\t}\r\n\t\t$bind = mysqli_stmt_bind_param($stmt, \"ssss\", $creation_time, $start_time, $stop_time, $measurement_id);\r\n\t\tif ($bind === false) {\r\n\t\t\ttrigger_error('Error: Bind of parameter failed. ', E_USER_ERROR);\r\n\t\t}\r\n\t\t$exec = mysqli_stmt_execute($stmt);\r\n\t\tif ($exec === false) {\r\n\t\t\ttrigger_error('Error: execution of statement failed. ' . htmlspecialchars(mysqli_stmt_error($stmt)), E_USER_ERROR);\r\n\t\t}\r\n\t\t\r\n // close database connection\r\n\t\tCheckrouteDatabase::close($link);\r\n\r\n }", "public function seekBusStopsByBusway(Busway $busway) : array\n {\n return $this->busStopFromArray(\n $this->execute('Parada/BuscarParadasPorCorredor',\n ['codigoCorredor' => $busway->getCod()]\n ));\n }", "function get_break_time($br_plan){\r\n foreach ($br_plan as $key => $value) {\r\n if($key==='start' || $key==='ends'){\r\n $br[] = get_times($br_plan['start'],$br_plan['ends']);\r\n }else{\r\n $br[] = get_times($br_plan[$key]['start'],$br_plan[$key]['ends']); \r\n }\r\n \r\n }\r\n return $flat = call_user_func_array('array_merge', $br);\r\n }", "public function getMinimumStops()\n {\n $this->stops = 0;\n for ($i = 0; $i < self::MAX_STOPS; $i++) {\n $this->stops++;\n $this->handleStop();\n if ($this->driversKnowAllGossips()) {\n return $this->stops;\n }\n $this->nextStop();\n }\n return self::MINIMUM_NEVER;\n }", "function extract_journey_times($dow, $hod) {\n $time_sql = \"SELECT source.stopid AS start, destination.stopid AS end, \"\n \t .\"AVG(EXTRACT(EPOCH FROM AGE(destination.estimatedtime, source.estimatedtime))) AS average_time \"\n\t .\"FROM batch_journey AS source, \"\n\t .\"batch_journey AS destination, \"\n\t .\"(SELECT DISTINCT a.stopid as x, b.stopid as y \"\n\t .\"FROM (route_reference NATURAL JOIN stop_reference) AS a, \"\n\t .\"(route_reference NATURAL JOIN stop_reference) AS b \"\n\t .\"WHERE a.linename = b.linename \"\n\t .\"AND a.directionid = b.directionid \"\n\t .\"AND (b.stopnumber - a.stopnumber) = 1) as connected_stops \"\n\t .\"WHERE source.uniqueid = destination.uniqueid \"\n\t .\"AND EXTRACT(DOW FROM source.estimatedtime) = $dow \"\n\t .\"AND EXTRACT(HOUR FROM source.estimatedtime) = $hod \"\n\t .\"AND x = source.stopid \"\n\t .\"AND y = destination.stopid \"\n\t .\"GROUP BY source.stopid, destination.stopid\";\n\n return $this->database->execute_sql($time_sql)->fetchAll(PDO::FETCH_ASSOC);\n }", "public function getNextDepartures($filter)\n {\n $processor = $this->container->get('canaltp_schedule.next.departure.processor');\n return $processor->bindFromStopScheduleFilter($filter);\n }", "function tripId()\n\t{\n\t\treturn $this->_tour_voucher_contents['trip_id'];\n\t}", "public function get_destinations($id = 0) {\n\n $_chldIds = array();\n\n if ($id == 0) {\n $sub_destinations = \\DB::table('tb_categories')->where('parent_category_id', 0)->where('id', '!=', 8)->get();\n } else {\n $sub_destinations = \\DB::table('tb_categories')->where('parent_category_id', $id)->get();\n }\n\n if (!empty($sub_destinations)) {\n foreach ($sub_destinations as $key => $sub_destination) {\n\n $chldIds = array();\n\n $chldIds[] = $sub_destination->id;\n $temp = $this->get_destinations($sub_destination->id);\n $sub_destinations[$key]->sub_destinations = $temp['sub_destinations'];\n $chldIds = array_merge($chldIds, $temp['chldIds']);\n $_chldIds = array_merge($_chldIds, $chldIds);\n\n $getcats = '';\n if (!empty($chldIds)) {\n $getcats = \" AND (\" . implode(\" || \", array_map(function($v) {\n return sprintf(\"FIND_IN_SET('%s', property_category_id)\", $v);\n }, array_values($chldIds))) . \")\";\n $preprops = DB::select(DB::raw(\"SELECT COUNT(*) AS total_rows FROM tb_properties WHERE property_status = '1' $getcats\"));\n if ($preprops[0]->total_rows == 0) {\n unset($sub_destinations[$key]);\n }\n }\n }\n }\n\n return array('sub_destinations' => $sub_destinations, 'chldIds' => $_chldIds);\n }", "function get_all_Finish_trip_details()\n {\n return $this->db->get('Finish_trip_details')->result_array();\n }", "function getUserTrips($user_id){\n global $mysqli;\n $sql = \"SELECT * FROM `trips` WHERE `user_id`=$user_id ORDER BY `date_added` DESC\";\n $result = $mysqli->query( $sql );\n return $result->fetch_all( MYSQLI_ASSOC ); // [0 => ''] ['user_id' ]\n}", "public function fetchTrips($person_id)\n {\n $result = TripModel::where('person_id', $person_id)->get();\n\n $trips = [];\n foreach ($result as $trip) {\n $trips[] = [\n \"trip_id\" => $trip->id,\n \"city\" => CityModel::find($trip->city_id)->name, \n \"rate\" => $trip->rate\n ];\n }\n return $trips;\n }", "public function trips($person_id)\n {\n return response($this->fetchTrips($person_id));\n }", "public function getTripCollection()\n {\n return $this->tripCollection;\n }", "public function findDowntimes(int $hostId, int $serviceId): array;", "function GasStation($strArr) {\r\n $totalGasAtStation = 0;\r\n $totalGasToTravel = 0;\r\n $totalNumGasStation = array_shift($strArr);\r\n for ($i = 0; $i < $totalNumGasStation; $i++) {\r\n $gas = explode(':',$strArr[$i]);\r\n $totalGasAtStation = $totalGasAtStation + $gas[0];\r\n $totalGasToTravel = $totalGasToTravel + $gas[1];\r\n }\r\n if ($totalGasAtStation < $totalGasToTravel) {\r\n $strArr = \"impossible\";\r\n }\r\n // iterate through the routes \r\n else {\r\n \r\n $iteration = 0;\r\n $foundloop = false;\r\n while (($foundloop == false) && ($iteration <= $totalNumGasStation)) {\r\n $iteration++;\r\n $gasTank = 0;\r\n $isBrokeDown = false;\r\n $gasStationNum = 0;\r\n for ($gasStationNum; $gasStationNum < $totalNumGasStation; $gasStationNum++) {\r\n \r\n $gas = explode(':',$strArr[$gasStationNum]);\r\n $gasTank = $gasTank + $gas[0] - $gas[1];\r\n if ($gasTank < 0) {\r\n \r\n $isBrokeDown = true;\r\n break;\r\n }\r\n }\r\n \r\n if (($isBrokeDown == FALSE) && ($gasStationNum == 4)) {\r\n $strArr = $iteration;\r\n $foundloop = true;\r\n }\r\n else {\r\n $deltaGasStation = array_shift($strArr);\r\n $strArr[] = $deltaGasStation;\r\n\r\n }\r\n }\r\n }\r\n return $strArr; \r\n\r\n}", "public function index() {\n $stops_id = Stop::where('agency_id', \\Auth::user()->agency_id)->pluck('id');\n $stop_times = StopTime::whereIn('stop_id', $stops_id)->get(['id', 'trip_id', 'stop_id', 'arrival_time', 'departure_time', 'stop_sequence', 'stop_headsign', 'pickup_type', 'drop_off_type', 'timepoint', 'created_at', 'updated_at']);\n return response()->json(compact('stop_times'), 200);\n }", "function getTripData($db, $strTripID = \"\")\n{\n global $arrData;\n $strResult = \"\";\n if ($strTripID == \"\") {\n return \"\";\n }\n $strSQL = \"SELECT t1.*, (date_thru - date_from) AS durasi, t2.employee_id FROM hrd_trip AS t1 \";\n $strSQL .= \"LEFT JOIN hrd_employee AS t2 ON t1.id_employee = t2.id \";\n $strSQL .= \"WHERE t1.id = '$strTripID' \";\n $resDb = $db->execute($strSQL);\n if ($rowDb = $db->fetchrow($resDb)) {\n $arrData['dataLocation'] = $rowDb['location'];\n $arrData['dataPurpose'] = $rowDb['purpose'];\n $arrData['dataTask'] = $rowDb['task'];\n $arrData['dataEmployee'] = $rowDb['employee_id'];\n $arrData['dataDateFrom'] = $rowDb['date_from'];\n $arrData['dataDateThru'] = $rowDb['date_thru'];\n $arrData['dataAllowance'] = $rowDb['totalAllowance'];\n $arrData['dataDuration'] = $rowDb['durasi'] + 1;\n //$arrData['dataDuration'] = totalWorkDay($db,$rowDb['date_from'],$rowDb['date_thru']);\n }\n // cari apakah ada payment\n $strSQL = \"SELECT id FROM hrd_trip_payment WHERE id_trip = '$strTripID' \";\n $resDb = $db->execute($strSQL);\n if ($rowDb = $db->fetchrow($resDb)) {\n $strResult = $rowDb['id'];\n }\n $arrData['dataTotal'] += $arrData['dataAllowance'];\n return $strResult;\n}", "public static function get_stepdata($tourid) {\n global $DB;\n\n $cache = \\cache::make('tool_usertours', self::CACHENAME_STEP);\n\n $data = $cache->get($tourid);\n if ($data === false) {\n $sql = <<<EOF\n SELECT s.*\n FROM {tool_usertours_steps} s\n WHERE s.tourid = :tourid\n ORDER BY s.sortorder ASC\nEOF;\n\n $data = $DB->get_records_sql($sql, ['tourid' => $tourid]);\n $cache->set($tourid, $data);\n }\n\n return $data;\n }", "public function getAvailableEndingStationsRoute(int $stationId, int $tripId, int $startingRoute)\n {\n return $this->whereStation((int) $stationId)->where('trip_id', $tripId)->where('route', '>', $startingRoute)->first(['station_id', 'route', 'trip_id']);\n }", "function stayPointDetection($tr, $dT, $tT) {\n\n $i = 0;\n $j = 0;\n $pointNum = count($tr);\n $SP = [];\n\n while ($i < $pointNum && $j < $pointNum) {\n\n $j = $j + 1;\n\n while ($j < $pointNum) {\n\n $dist = getDistanceBetweenPoints($tr[$i], $tr[$j]);\n\n if ($dist > $dT) {\n\n $deltaT = $tr[$j]->dateTime - $tr[$i]->dateTime;\n\n if ($deltaT > $tT) {\n\n $S = [];\n $S['coord'] = computeMean($tr, $i, $j);\n $S['stayTime'] = $deltaT;\n $S['fuelStations'] = getFuelstations($tr[$j]->lon, $tr[$j]->lat);\n $SP[] = $S;\n\n }\n\n $i = $j;\n break;\n\n }\n\n $j = $j + 1;\n\n }\n }\n\n return json_encode($SP);\n}", "public function get_directions();", "public function getLineWithStops($lineId);", "public function destinations($id)\n {\n return Terminal::distinct() ->select('terminals.id', 'terminals.name', 'terminals.short_name', 'terminals.location')\n ->join('routes', 'terminals.id', '=', 'routes.destination')\n ->where('routes.departure', $id)\n ->orderBy('terminals.id')\n ->get();\n }", "public function stopper(){\n\t\t$query=$this->db->get('tbl_stoppers');\n\t\treturn $query->result();\n\t}", "function get_failed_stopout_accounts()\n\t{\n\t return $this->db->select()\n\t\t ->from('pamm_stopout_list')\n\t\t ->get()->result();\n\t}", "public function getRoutes() {\r\n \r\n $params = array(\"line\");\r\n \r\n $results = $this->fetch(\"search\", $params);\r\n \r\n $routes = array(); \r\n \r\n foreach ($results as $row) {\r\n if ($row['result']['transport_type'] == \"train\") {\r\n $routes[$row['result']['line_id']] = array(\r\n \"id\" => $row['result']['line_id'],\r\n \"route_id\" => $row['result']['line_id'],\r\n \"agency_id\" => 1,\r\n \"route_short_name\" => $row['result']['line_number'],\r\n \"route_long_name\" => $row['result']['line_name'],\r\n \"route_desc\" => \"\",\r\n \"route_url\" => \"\",\r\n \"route_color\" => \"\",\r\n \"route_text_color\" => \"\",\r\n \"url\" => new Url(sprintf(\"%s/timetables?provider=%s&id=%d\", RP_WEB_ROOT, static::PROVIDER_NAME, $row['result']['line_id']))\r\n );\r\n }\r\n }\r\n \r\n return $routes;\r\n \r\n /*\r\n $routes = array(\r\n array(\r\n \"id\" => 1,\r\n \"route_id\" => 1,\r\n \"agency_id\" => 1,\r\n \"route_short_name\" => \"Alamein Line\",\r\n \"route_long_name\" => \"Alamein Line\",\r\n \"route_desc\" => \"\",\r\n \"route_url\" => \"\",\r\n \"route_color\" => \"\",\r\n \"route_text_color\" => \"\"\r\n ),\r\n array(\r\n \"id\" => 2,\r\n \"route_id\" => 2,\r\n \"agency_id\" => 1,\r\n \"route_short_name\" => \"Belgrave Line\",\r\n \"route_long_name\" => \"Belgrave Line\",\r\n \"route_desc\" => \"\",\r\n \"route_url\" => \"\",\r\n \"route_color\" => \"\",\r\n \"route_text_color\" => \"\"\r\n ),\r\n array(\r\n \"id\" => 3,\r\n \"route_id\" => 3,\r\n \"agency_id\" => 1,\r\n \"route_short_name\" => \"Craigieburn Line\",\r\n \"route_long_name\" => \"Craigieburn Line\",\r\n \"route_desc\" => \"\",\r\n \"route_url\" => \"\",\r\n \"route_color\" => \"\",\r\n \"route_text_color\" => \"\"\r\n ),\r\n array(\r\n \"id\" => 4,\r\n \"route_id\" => 4,\r\n \"agency_id\" => 1,\r\n \"route_short_name\" => \"Cranbourne Line\",\r\n \"route_long_name\" => \"Cranbourne Line\",\r\n \"route_desc\" => \"\",\r\n \"route_url\" => \"\",\r\n \"route_color\" => \"\",\r\n \"route_text_color\" => \"\"\r\n ),\r\n array(\r\n \"id\" => 6,\r\n \"route_id\" => 6,\r\n \"agency_id\" => 1,\r\n \"route_short_name\" => \"Frankston Line\",\r\n \"route_long_name\" => \"Frankston Line\",\r\n \"route_desc\" => \"\",\r\n \"route_url\" => \"\",\r\n \"route_color\" => \"\",\r\n \"route_text_color\" => \"\"\r\n ),\r\n array(\r\n \"id\" => 7,\r\n \"route_id\" => 7,\r\n \"agency_id\" => 1,\r\n \"route_short_name\" => \"Glen Waverley Line\",\r\n \"route_long_name\" => \"Glen Waverley Line\",\r\n \"route_desc\" => \"\",\r\n \"route_url\" => \"\",\r\n \"route_color\" => \"\",\r\n \"route_text_color\" => \"\"\r\n ),\r\n array(\r\n \"id\" => 8,\r\n \"route_id\" => 8,\r\n \"agency_id\" => 1,\r\n \"route_short_name\" => \"Hurstbridge Line\",\r\n \"route_long_name\" => \"Hurstbridge Line\",\r\n \"route_desc\" => \"\",\r\n \"route_url\" => \"\",\r\n \"route_color\" => \"\",\r\n \"route_text_color\" => \"\"\r\n ),\r\n array(\r\n \"id\" => 9,\r\n \"route_id\" => 9,\r\n \"agency_id\" => 1,\r\n \"route_short_name\" => \"Lilydale Line\",\r\n \"route_long_name\" => \"Lilydale Line\",\r\n \"route_desc\" => \"\",\r\n \"route_url\" => \"\",\r\n \"route_color\" => \"\",\r\n \"route_text_color\" => \"\"\r\n ),\r\n array(\r\n \"id\" => 11,\r\n \"route_id\" => 11,\r\n \"agency_id\" => 1,\r\n \"route_short_name\" => \"Pakenham Line\",\r\n \"route_long_name\" => \"Pakenham Line\",\r\n \"route_desc\" => \"\",\r\n \"route_url\" => \"\",\r\n \"route_color\" => \"\",\r\n \"route_text_color\" => \"\"\r\n )\r\n );\r\n */\r\n \r\n printArray($routes);\r\n }", "public function trips()\n {\n return $this->hasMany('App\\Trip');\n }", "function get_car_trips_gps($vin, $ts_start, $ts_end)\n{\n global $cars_dt;\n \n // Lecture des trajets\n // -------------------\n // ouverture du fichier de log: trajets\n $fn_car = dirname(__FILE__).CARS_FILES_DIR.$vin.'/trips.log';\n $fcar = fopen($fn_car, \"r\");\n\n // lecture des donnees\n $line = 0;\n $cars_dt[\"trips\"] = [];\n $first_ts = time();\n $last_ts = 0;\n if ($fcar) {\n while (($buffer = fgets($fcar, 4096)) !== false) {\n // extrait les timestamps debut et fin du trajet\n list($tr_tss, $tr_tse, $tr_ds, $tr_batt) = explode(\",\", $buffer);\n $tsi_s = intval($tr_tss);\n $tsi_e = intval($tr_tse);\n // selectionne les trajets selon leur date depart&arrive\n if (($tsi_s>=$ts_start) && ($tsi_s<=$ts_end)) {\n $cars_dt[\"trips\"][$line] = $buffer;\n $line = $line + 1;\n // Recherche des ts mini et maxi pour les trajets retenus\n if ($tsi_s<$first_ts)\n $first_ts = $tsi_s;\n if ($tsi_e>$last_ts)\n $last_ts = $tsi_e;\n }\n }\n }\n fclose($fcar);\n\n // Lecture des points GPS pour ces trajets\n // ---------------------------------------\n // ouverture du fichier de log: points GPS\n $fn_car = dirname(__FILE__).CARS_FILES_DIR.$vin.'/gps.log';\n $fcar = fopen($fn_car, \"r\");\n\n // lecture des donnees\n $line = 0;\n $cars_dt[\"gps\"] = [];\n if ($fcar) {\n while (($buffer = fgets($fcar, 4096)) !== false) {\n // extrait les timestamps debut et fin du trajet\n list($pts_ts, $pts_lat, $pts_lon, $pts_head, $pts_batt, $pts_mlg, $pts_moving) = explode(\",\", $buffer);\n $pts_tsi = intval($pts_ts);\n // selectionne les trajets selon leur date depart&arrive\n if (($pts_tsi>=$first_ts) && ($pts_tsi<=$last_ts)) {\n $cars_dt[\"gps\"][$line] = $buffer;\n $line = $line + 1;\n }\n }\n }\n fclose($fcar);\n // Ajoute les coordonnées du domicile pour utilisation par javascript\n $latitute=config::byKey(\"info::latitude\");\n $longitude=config::byKey(\"info::longitude\");\n $cars_dt[\"home\"] = $latitute.\",\".$longitude;\n\n //log::add('peugeotcars', 'debug', 'Ajax:get_car_trips:nb_lines'.$line);\n return;\n}", "public function deliveryTimeslots($id = null){\n $data['delivery_slots'] = [];\n if( request()->ajax() ){\n $data['delivery_slots'] = getDeliveryTimeslots($id)->prepend('Select Timeslot', 0 );\n }\n\n return $data;\n }", "function last_visited_get_array( $p_user_id = null ) {\n\t$t_value = token_get_value( TOKEN_LAST_VISITED, $p_user_id );\n\n\tif( is_null( $t_value ) ) {\n\t\treturn array();\n\t}\n\n\t# we don't slice the array here to optimise for performance. If the user reduces the number of recently\n\t# visited to track, then he/she will get the extra entries until visiting an issue.\n\t$t_ids = explode( ',', $t_value );\n\n\tbug_cache_array_rows( $t_ids );\n\treturn $t_ids;\n}", "public function show($id) {\n $stops_id = Stop::where('agency_id', \\Auth::user()->agency_id)->pluck('id');\n $stop_time = StopTime::select(['id', 'trip_id', 'stop_id', 'arrival_time', 'departure_time', 'stop_sequence', 'stop_headsign', 'pickup_type', 'drop_off_type', 'timepoint', 'created_at', 'updated_at'])\n ->with('trip', 'stop')->whereIn('stop_id', $stops_id)->findOrFail($id);\n return response()->json(compact('stop_time'), 200);\n }", "public function getTailles(){\n return $this->db->get($this->taille)->result();\n }", "public function pastTrips()\n\t{\n\t\t\n\t\t$now = \\Carbon\\Carbon::now()->format('Y-m-d');\n\t\t\n\t\t// Ensure only the logged in user's bookings are being pulled\n\t\t$listings = Booking::where('traveller_id', '=', Auth::user()->id)\n\t\t\t->where('end_date', '<', $now)\n\t\t\t->whereNotNull('transaction_id')\n\t\t\t->whereNull('canceled_at')\n\t\t\t->leftJoin('listings', 'listings.id', '=', 'bookings.listing_id')\n\t\t\t->leftJoin('listing_addresses', 'listing_addresses.id', '=', 'listings.id')\n\t\t\t->leftJoin(DB::raw(\"(select url, listing_id \n\t\t\t\t\t\t\tfrom `listings_images` \n\t\t\t\t\t\t\twhere `primary` = 1) as `list_images`\"), 'list_images.listing_id', '=', 'listings.id')\n\t\t\t->leftJoin(DB::raw(\"(select booking_id as review from `reviews`) as `listing_review`\"), 'listing_review.review', '=', 'bookings.id')\n\t\t\t->get();\n\t\t\n\t\t\n\t\treturn view('dashboard.traveller.past')\n\t\t\t->with('listings', $listings);\n\t}", "function getStop($db, $stop_id)\n\t{\n\t\t//get the stop info\n\t\t$query = array(\"stop_id\" => $stop_id);\n\t\t$cursor = $db->stops->find( $query );\n\t\t\n\t\t//print_debug($cursor);\n\t\treturn ($cursor);\n\t}", "public function get_lv_days($id){\r\n\t \r\n\t $lv_days = $this->data_client->get_lv_days($id);\r\n\t return $lv_days;\r\n\t }", "function nextTrains($database, $stop_id, $time, $num)\n\t{\n\t\t//get next $num of trains leaving after $time from $stop_id\n\t\t$query = array(\"stop_id\" => $stop_id, \"departure_time\" => array('$gt' => $time));\n $cursor = $database->stop_times->find( $query )->sort(array(\"departure_time\" => 1))->limit($num);\n \n //print(\"\\nnextTrains\\n\");\n //print_debug($cursor);\n\t\t\n\t\treturn ($cursor);\n\t}", "public function getTour($id) {\n\t\t$action = new EventerraActionGetTours($this);\n\t\t$array = $action->request($id);\n\t\treturn array_shift($array);\n\t}", "public static function getStopName($id){\n return self::getStop($id)->data->attributes->name;\n }", "function get_flight_from_ws($airline, $depcode, $descode, $depdate, $retdate, $direction=1, $format='json'){\n\t\n\t$airline = strtoupper(trim($airline));\n\t$depcode = strtoupper(trim($depcode));\n\t$descode = strtoupper(trim($descode));\n\t$depdate = str_replace('/','-',$depdate);\n\t$retdate = isset($retdate) && !empty($retdate) ? str_replace('/','-',$retdate) : $depdate; \n\t$api_key = '70cd2199f6dc871824ea9fed45170af354ffe9e6';\n \n $timeout = 30;\n \n\tif ($airline == 'VN' || $airline == 'QH') {\n $urls = array(\n // 'http://fs2.vietjet.net',\n 'http://fs3.vietjet.net',\n 'http://fs4.vietjet.net',\n 'http://fs5.vietjet.net',\n 'http://fs6.vietjet.net',\n 'http://fs7.vietjet.net',\n 'http://fs8.vietjet.net',\n 'http://fs9.vietjet.net',\n 'http://fs10.vietjet.net',\n 'http://fs11.vietjet.net',\n 'http://fs12.vietjet.net',\n 'http://fs13.vietjet.net',\n 'http://fs14.vietjet.net',\n 'http://fs15.vietjet.net',\n 'http://fs16.vietjet.net',\n 'http://fs17.vietjet.net',\n 'http://fs18.vietjet.net',\n 'http://fs19.vietjet.net',\n 'http://fs20.vietjet.net',\n 'http://fs21.vietjet.net',\n 'http://fs22.vietjet.net',\n 'http://fs23.vietjet.net',\n 'http://fs24.vietjet.net',\n 'http://fs25.vietjet.net',\n 'http://fs26.vietjet.net',\n 'http://fs27.vietjet.net',\n 'http://fs28.vietjet.net',\n 'http://fs29.vietjet.net',\n 'http://fs30.vietjet.net',\n );\n } else if ($airline == 'VJ' || $airline == 'BL'){\n $timeout = 35;\n $urls = array(\n 'http://fs2.vietjet.net',\n );\n }\n\n shuffle($urls);\n $url = $urls[array_rand($urls)];\n\t$url .= '/index.php/apiv1/api/flight_search/format/'.$format;\n\t$url .= '/airline/'.$airline.'/depcode/'.$depcode.'/descode/'.$descode.'/departdate/'.$depdate.'/returndate/'.$retdate.'/direction/'.$direction;\n\n\t$curl_handle = curl_init();\n\tcurl_setopt($curl_handle, CURLOPT_URL, $url);\n\tcurl_setopt($curl_handle, CURLOPT_ENCODING, 'gzip');\n\tcurl_setopt($curl_handle, CURLOPT_TIMEOUT, $timeout);\n curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, $timeout);\n\tcurl_setopt($curl_handle, CURLOPT_HTTPHEADER, array('X-API-KEY: '.$api_key));\n\tcurl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);\n $buffer = curl_exec($curl_handle);\n\n curl_close($curl_handle);\n $result = json_decode($buffer, true);\n\n\treturn $result;\n}", "public function getServiceTurnaroundTimes()\n {\n if ( null === $this->_turnaroundTimes )\n {\n $model = new Application_Model_ServiceTurnaround();\n $this->_turnaroundTimes = $model->fetchAll( \"service_id = '\" . $this->id . \"'\" );\n }\n return $this->_turnaroundTimes;\n }", "public function getStationWithSchedules($id);", "public function trip(){\n\t\t\t// with trip\n\t\t\treturn $this->hasMany(\"Trip\");\n\t\t}", "public function getPollingConstituents($id){\n $stmt = $this->con->prepare(\"SELECT * FROM pollingstations WHERE constituency_id = ? ORDER BY constituency_id ASC\");\n $stmt->bind_param(\"i\",$id);\n $stmt->execute();\n $pollings = $stmt->get_result();\n $stmt->close(); \n return $pollings;\n }", "public function getPendingSteps();", "public function NextDepartures() {\r\n\t\t\t\r\n\t\t}", "public function outAdjacentVertices($id) {\n\t\treturn $this->outAdjacents[$id];\n\t}", "private function _getAllTrips(User $driver) {\n\t\t$trips = $driver->getTrips();\t\t\n\t\treturn $trips;\n\t}", "public function getChain($id, array & $traversedPaths = array(), array $traversedBranch = array())\n\t{\n\t\tarray_unshift($traversedPaths, $id);\n\t\tarray_unshift($traversedBranch, $id);\n\n\t\tif (isset($this->_map[$id]) == 0) {\n\t\t\treturn array();\n\t\t}\n\n\t\t$_ref1 = array_reverse(array_slice($this->_map[$id], 0));\n\t\tforeach ($_ref1 as $depId) {\n\t\t\tif (array_search($depId, $traversedBranch) !== false) { # cycle\n\t\t\t\tthrow new \\Exception(\"Cyclic dependency from {$id} to {$depId}\");\n\t\t\t}\n\n\t\t\t$depIdIndex = array_search($depId, $traversedPaths);\n\t\t\tif ($depIdIndex !== false) { # duplicate, push to front\n\t\t\t\tarray_splice($traversedPaths, $depIdIndex, 1);\n\t\t\t\tarray_unshift($traversedPaths, $depId);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$this->getChain($depId, $traversedPaths, $traversedBranch);\n\t\t}\n\n\t\treturn array_slice($traversedPaths, 0, -1);\n\t}", "private function getCompleteList(): array\n {\n $stmt = $this->connection->executeQuery(\n '\n SELECT sip.ip_address, sip.netmask, sip.first_ip_address, sip.last_ip_address,\n s.service_id, t.tariff_id, t.download_speed, t.upload_speed\n FROM service_ip sip\n INNER JOIN service_device sd ON sip.service_device_id = sd.service_device_id\n INNER JOIN service s ON s.service_id = sd.service_id\n INNER JOIN tariff t ON t.tariff_id = s.tariff_id\n WHERE s.status != :statusEnded\n AND s.deleted_at IS NULL\n ORDER BY sip.ip_address\n ',\n [\n 'statusEnded' => Service::STATUS_ENDED,\n ]\n );\n\n return $stmt->fetchAll();\n }", "static public function GetAirports()\n {\n $ids = DbHandler::Query(\"SELECT DISTINCT(airport_id) FROM airports WHERE (airport_id IN ( SELECT airport_start_id FROM traject GROUP BY airport_start_id) OR airport_id IN ( SELECT airport_stop_id FROM traject GROUP BY airport_stop_id)) ;\");\n\n $airports = array();\n for ($i = 0; $i < count($ids); $i++) {\n $airports[] = airports::GetAirportByID($ids[$i][\"airport_id\"]);\n\n }\n\n\n return $airports;\n }", "public function calculateRoute($startLongitude, $startLatitude, $tripDistance, $breweriesData)\n {\n if (!$this->validateInputFields($startLongitude, $startLatitude, $tripDistance, $breweriesData)) {\n return [];\n }\n $currentLong = $startLongitude;\n $currentLat = $startLatitude;\n $usedIndexes = [];//contains indexes of visited breweries\n $distanceLeft = $tripDistance;//setting up starting data\n $i = 0;//index for usedIndexes array\n while ($this->findClosestPointService->\n findClosestPoint($currentLong, $currentLat, $usedIndexes, $distanceLeft, $breweriesData) != null) {\n //while closest point exists and you can go back home after visiting it\n $closestData = $this->findClosestPointService->findClosestPoint(//finds closest point\n $currentLong,\n $currentLat,\n $usedIndexes,\n $distanceLeft,\n $breweriesData\n );\n\n if (in_array($closestData['closestBreweryIndex'], $usedIndexes)) {\n return [\n 'usedIndexes' => $usedIndexes,\n 'distanceLeft' => $distanceLeft,\n 'breweriesData' => $breweriesData\n ];\n }\n $usedIndexes[$i] = $closestData['closestBreweryIndex'];//inserts index of found point to visited indexes\n $distanceLeft = $distanceLeft - $closestData['closestDistance'];//subtracts trip distance\n //setting up values for next iteration\n\n $breweriesData[$closestData['closestBreweryIndex']]['distance'] = $closestData['closestDistance'];\n\n $currentLat = $breweriesData[$closestData['closestBreweryIndex']]['latitude'];\n $currentLong = $breweriesData[$closestData['closestBreweryIndex']]['longitude'];\n $i++;\n }\n return ['usedIndexes' => $usedIndexes, 'distanceLeft' => $distanceLeft, 'breweriesData' => $breweriesData];\n }", "public function directions(): array;", "function get_finish_trip_detail($finish_id)\n {\n return $this->db->get_where('Finish_trip_details',array('finish_id'=>$finish_id))->row_array();\n }", "private function codTributos(): array\n {\n $codigos = [];\n if ($this->ws === 'wsfe') {\n $codigos = $this->FEParamGetTiposTributos();\n $codigos = array_map(function ($o) {\n return $o->Id;\n }, $codigos->TributoTipo);\n }\n\n return $codigos;\n }", "function getTail_length($id){\n\t$crud = new CRUD();\n\t$crud->connect();\n\n\t$crud->sql(\"select * from pigs_tbl where pig_id='{$id}'\");\n\t$r = $crud->getResult();\n\tforeach($r as $rs){\n\t\treturn $rs['tail_length'];\n\n\t}\n\t$crud->disconnect();\n}", "public function getSkipped();", "public function currentRouteIds() {\n trigger_error(\"Deprecated function called.\", E_USER_DEPRECATED);\n $sql = \"\n select pathId, max(id) as id\n from `document_routes`\n where trackingId=? and arrivalTime is not null\n group by `pathId` order by `arrivalTime`, id desc\n \";\n\n $ids = [];\n $rows = \\DB::select($sql, [$this->trackingId]);\n foreach ($rows as $row) {\n $ids[] = $row->id;\n }\n return $ids;\n }", "public function StopsNearLocation($latitude = null, $longitude = null) {\r\n if ($latitude == null) {\r\n throw new Exception(\"Cannot fetch \" . __METHOD__ . \" - no latitude given\");\r\n }\r\n \r\n if ($longitude == null) {\r\n throw new Exception(\"Cannot fetch \" . __METHOD__ . \" - no longitude given\");\r\n }\r\n \r\n $parameters = array(\r\n \"latitude\" => $latitude,\r\n \"longitude\" => $longitude\r\n );\r\n \r\n $return = array();\r\n \r\n foreach ($this->fetch(\"nearme\", $parameters) as $row) {\r\n $row['result']['location_name'] = trim($row['result']['location_name']);\r\n \r\n if ($row['result']['transport_type'] == \"train\" || preg_match(\"@Railway@i\", $row['result']['location_name'])) {\r\n $placeData = array(\r\n \"stop_id\" => $row['result']['stop_id'],\r\n \"stop_name\" => $row['result']['location_name'],\r\n \"stop_lat\" => $row['result']['lat'],\r\n \"stop_lon\" => $row['result']['lon'],\r\n \"wheelchair_boarding\" => 0,\r\n \"location_type\" => 1\r\n );\r\n \r\n /**\r\n * Check if this is stored in the database, and add it if it's missing\r\n */\r\n \r\n if (!in_array($row['result']['location_name'], $this->ignore_stops) && \r\n $row['result']['stop_id'] < 10000 &&\r\n !preg_match(\"@#([0-9]{0,3})@\", $row['result']['location_name'])\r\n ) {\r\n $query = sprintf(\"SELECT stop_id FROM %s_stops WHERE stop_id = %d LIMIT 1\", self::DB_PREFIX, $row['result']['stop_id']); \r\n $result = $this->adapter->query($query, Adapter::QUERY_MODE_EXECUTE); \r\n \r\n if ($result->count() === 0) {\r\n $Insert = $this->db->insert(sprintf(\"%s_stops\", self::DB_PREFIX));\r\n $Insert->values($placeData);\r\n $selectString = $this->db->getSqlStringForSqlObject($Insert);\r\n $this->adapter->query($selectString, Adapter::QUERY_MODE_EXECUTE);\r\n }\r\n \r\n $placeData['distance'] = vincentyGreatCircleDistance($row['result']['lat'], $row['result']['lon'], $latitude, $longitude);\r\n $placeData['provider'] = $this->provider;\r\n \r\n if ($placeData['distance'] <= 10000) { // Limit results to 10km from provided lat/lon\r\n $return[] = $placeData;\r\n }\r\n }\r\n }\r\n }\r\n \r\n return $return;\r\n }", "protected function getTempCont($id){\n\t\t\t$sql = \"SELECT * FROM time_control WHERE time_temp_id = ?\";\n\t\t\t$stmt = $this->prpConnect()->prepare($sql);\n\t\t\t$stmt->execute([$id]);\n\t\t\t$results = $stmt->fetchAll();\n\t\t\treturn $results;\n\t\t}", "public function all_trips()\n {\n $relevanttrips = Tour::all();\n $recentlyquotedtrip = Departure::with('tour')\n ->where('id','=', session('departureid'))\n ->first();\n\n if(null !== session('incompletebookingid')) {\n $incompletebooking = Booking::with('tour')\n ->where('id','=', session('incompletebookingid'))\n ->orderBy('updated_at', 'desc')\n ->first();\n\n return view('explore')->with([\n 'returnedtrips' => $relevanttrips,\n 'incompletebooking' => $incompletebooking,\n 'recentlyquotedtrip' => $recentlyquotedtrip\n ]);\n }\n\n return view('explore')->with([\n 'returnedtrips' => $relevanttrips,\n 'recentlyquotedtrip' => $recentlyquotedtrip\n ]);\n }", "function getTrips() {\n // Create connection\n global $servername, $username, $password, $database;\n $conn = mysqli_connect( $servername, $username, $password, $database);\n // Check connection\n if (!$conn) {\n die(\"Connection failed: \" . mysqli_connect_error());\n }\n\n $sql = \"SELECT id, trip_departure_place, trip_destination, trip_date, trip_price, trip_comment, send_date FROM trips\";\n $result = mysqli_query($conn, $sql);\n\n // getting the boats from the database and showing them on the page\n if($result->num_rows > 0) {\n // start of trips area\n echo \"<div class='trip-all'>\";\n\n // start of loop\n while($row = mysqli_fetch_assoc($result)) {\n echo \"<h3>\" . $row['trip_departure_place'] . \" - \" . $row['trip_destination'] . \"</h3>\";\n echo \"<h4>Vertrekdatum: \" . $row['trip_date'] . \"</h4>\";\n echo \"<h4>Prijs: \" . $row['trip_price'] . \"</h4>\";\n echo \"<p>\" . $row['trip_comment'] . \"</p>\";\n\n // delete button -> code in delete-trip.php\n echo \"<td><button class='update-delete-button'><a href='includes/delete_update/delete-trip.php?id=\" . $row['id'] . \"'>Verwijderen</a></button></td>\";\n\n // edit button -> code in includes/update-trip.php\n echo \"<td><button class='update-delete-button'><a href='includes/delete_update/update-trip.php?id=\" . $row['id'] .\"'>Aanpassen</a></button></td>\";\n }\n\n // end of trips area\n echo \"</div>\";\n\n } else {\n // if there aren't any boats, show this:\n echo \"Er zijn nog geen trips. Voeg eerst een trip toe.\";\n }\n}", "public function getTourTypes(int $id) : array\n {\n $query = \"SELECT * FROM Tour_Types WHERE tour_id=?\";\n\n if($stmt = $this->conn->prepare($query)) {\n // Create bind params to prevent sql injection\n $stmt->bind_param(\"i\", $id);\n\n // Execute query\n $stmt->execute();\n\n // Get the result\n $result = $stmt->get_result();\n\n $tourTypesArray = array();\n while($row = $result->fetch_assoc())\n {\n $tourType = new tourType(\n (int)$row[\"tour_id\"],\n (int)$row[\"tour_types_id\"],\n (int)$row[\"tour_guide_id\"],\n $row[\"amount_of_tours\"],\n $row[\"language\"]\n );\n\n $tourTypesArray[] = $tourType;\n }\n\n return $tourTypesArray;\n }\n }", "private function getSequence(): array\n {\n $ping = $this->results;\n\n $items_count = count($ping);\n\n // First remove items from final of the array\n for ($i = 6; $i > 0; $i--) {\n unset($ping[$items_count - $i]);\n }\n\n // Then remove first items\n unset($ping[1]);\n unset($ping[0]);\n\n $key = 0;\n\n $sequence = [];\n\n foreach ($ping as $row) {\n $sequence[$key] = $row;\n\n $key++;\n }\n\n return $sequence;\n }", "public static function layoutWallSlotsBreakdown($id){\n $data = array();\n\n if($layout = Layouts::get_layouts($id)){\n // Get studio, sizing can diff between certain studios\n $studio = $layout->studio()->get();\n $studio = $studio[0];\n\n $data['singleLargeSideSlots'] = round($layout->size_x / $studio->externalwallsingleslotlength);\n $data['singleSmallSideSlots'] = round($layout->size_y / $studio->externalwallsingleslotlength);\n\n $data['totalLargeSideSlots'] = $data['singleLargeSideSlots'] * 2;\n $data['totalSmallSideSlots'] = $data['singleSmallSideSlots'] * 2;\n\n $data['totalSlots'] = $data['totalLargeSideSlots'] + $data['totalSmallSideSlots'];\n\n return $data;\n }\n\n return 0;\n }", "public function getSwitchUrls($id)\n {\n return $this->wallpaperMapper->createSwitchUrls($id, self::MODULE, self::CONTROLLER);\n }", "public static function getRoutesFromWaypoints(array $params)\n {\n // TODO :: Need to change this code to work with\n // the collection of Waypoints instances\n\n /** @var Helpers\\RoutePriceHelper $priceHelper */\n [\n 'from' => $startPoint,\n 'to' => $endPoint,\n 'waypoints' => $waypoints,\n 'routes' => $routesTime,\n 'priceHelper' => $priceHelper\n ] = $params;\n\n $tripWaypoints = collect([$startPoint]);\n $routes = collect([]);\n\n if (! empty($waypoints)) {\n foreach ($waypoints as $tripWaypoint) {\n $tripWaypoints->push($tripWaypoint);\n }\n }\n\n $tripWaypoints->push($endPoint);\n\n foreach (range(0, $tripWaypoints->count() - 2) as $key => $iteration) {\n $chunk = $tripWaypoints->slice($iteration, 2)->values();\n\n $routes->push([\n 'from' => $chunk[0],\n 'from_lat' => $chunk[0]['geometry']['location']['lat'],\n 'from_lng' => $chunk[0]['geometry']['location']['lng'],\n 'to' => $chunk[1],\n 'to_lat' => $chunk[1]['geometry']['location']['lat'],\n 'to_lng' => $chunk[1]['geometry']['location']['lng'],\n 'start_at' => $routesTime[$key]['start_at'],\n 'end_at' => $routesTime[$key]['end_at'],\n 'price' => $priceHelper->getPriceByKey($key),\n ]);\n }\n\n return $routes;\n }", "public static function getSetTrend($id) \n\t{\n\t\t$trend = [];\n\n\t\t// Get Cols\n\t\t$sCols = self::getSensorsColumnsFromSet($id)['co2'];\n\t\t$wColsPure = self::getSensorsColumnsFromSet($id)['wind'];\n\t\t$wCols = [];\n\n\t\tforeach ($sCols as $key => $value) {\n\t\t\t$wind = self::getMyWind($key);\n\t\t\t$wCols[$wind] = [];\n\t\t\tforeach ($value as $index => $val) {\n\t\t\t\tif ($val != 0 && array_key_exists($index, $wColsPure[$wind])) {\n\t\t\t\t\t$wCols[$wind][] = $wColsPure[$wind][$index];\n\t\t\t\t} \n\t\t\t}\n\t\t}\n\n\t\t$wTrend = [];\n\t\tforeach ($wCols as $sensor => $info) {\n\t\t\t$wTrend[$sensor] = [\n\t\t\t'velocity' => self::getWindDirectionTrend($info)['velocity'],\n\t\t\t'direction' => self::getWindDirectionTrend($info)['direction']\n\t\t\t];\n\t\t}\n\n\t\tforeach ($sCols as $sensor => $ppms) {\n\t\t\t$sum = array_sum($ppms);\n\t\t\t$trend[$sensor] = [\n\t\t\t\t'length' => self::countOnes($ppms),\n\t\t\t\t'weight' => $sum,\n\t\t\t\t'avg' => (round($sum/count($ppms))),\n\t\t\t\t'wind' => $wTrend[self::getMyWind($sensor)]\n\t\t\t];\n\t\t}\n\n\t\treturn $trend;\n\t}", "function getDailySteps(){\n $time = array();\n $steps = array();\n $prevNum = 0;\n $mysqli = $GLOBALS['mysqli'];\n $result = $mysqli->query(\"SELECT DATE_FORMAT(time, '%H:%i') AS time,steps FROM steps WHERE DATE(`time`) = CURDATE()\");\n while($row = $result->fetch_assoc()) {\n $diff = $row['steps'] - $prevNum;\n $prevNum = $row['steps'];\n $time[] = $row['time'];\n $steps[] = $diff;\n }\n return array($time, $steps);\n}", "public function stop($id);", "function resetTripItineraryData($table='',$trip_id=''){\n\t\tif($table !='' && $trip_id != ''){\n\t\t\t$this->db->select('id');\n\t\t\t$this->db->from('itinerary');\n\t\t\t$this->db->where('trip_id',$trip_id);\n\t\t\t$qry = $this->db->get();\n\t\t\t$rows = $qry->result_array();\n\t\t\t$itineraries = array();\n\t\t\tif($rows){\n\t\t\t\tforeach($rows as $row){\n\t\t\t\tarray_push($itineraries,$row['id']);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif($itineraries){\n\t\t\t\t$this->db->where_in('itinerary_id', $itineraries);\n\t\t\t\t$this->db->delete($table); \n\t\t\t}\n\t\t}\n\t}", "public function backoff(): array\n {\n return [5, 10, 15];\n }", "function getCurrentSteps(){\n $rows = array();\n $mysqli = $GLOBALS['mysqli'];\n $result = $mysqli->query(\"SELECT time,steps from steps ORDER BY id DESC LIMIT 1\");\n while($r = $result->fetch_assoc()) {\n $rows[] = $r;\n }\n return $rows;\n}", "public function seekBusStops($searchString) : array\n {\n return $this->busStopFromArray(\n $this->execute('Parada/Buscar',\n ['termosBusca' => $searchString]\n ));\n }", "public function getWaypoints()\n {\n return $this->responseData->waypoints;\n }", "public function getSubNote($id): array\n {\n if (is_numeric($id)) {\n /** @var Note $note */\n $subNote = $this->em->getRepository('ApiBundle:SubNote')\n ->findOneBy(['id' => $id]);\n\n if ($subNote) {\n /** @var Notebook $notebook */\n $notebook = $subNote->getNote()->getNotebook();\n if ($notebook->getPrivate() === true) {\n if ($notebook->getUser() == $this->tokenStorage->getToken()->getUser()) {\n $subNote = $this->em->getRepository('ApiBundle:SubNote')\n ->findSubNote($subNote->getId());\n return [\n 'success' => true,\n 'sub_note' => $subNote,\n 'notebook' => $notebook->getId()\n ];\n }\n return ['success' => false, 'code' => 403];\n }\n $subNote = $this->em->getRepository('ApiBundle:SubNote')\n ->findSubNote($subNote->getId());\n return [\n 'success' => true,\n 'sub_note' => $subNote,\n 'notebook' => $notebook->getId()\n ];\n }\n return ['success' => false, 'code' => 404];\n }\n return ['success' => false];\n }", "public static function timeslotlist_t2(){\n\t\t$datetoday=Fun::datetoday();\n\t\t$times=array();\n\t\tfor($i=0;$i<6;$i++){\n\t\t\t$pair=array();\n\t\t\tfor($j=0;$j<2;$j++){\n\t\t\t\t$h=$i*2+$j*12;\n\t\t\t\t$pair[]=array(Fun::timetotime_t3($datetoday+$h*3600,false).\" - \".Fun::timetotime_t3($datetoday+($h+2)*3600,true ), implode(\"-\", Fun::oneToN(2*$h+4,2*$h+1)));\n\t\t\t}\n\t\t\t$times[]=$pair;\n\t\t}\n\t\treturn $times;\n\t}", "public function getTimes();", "public function bus_stops()\n {\n return $this->belongsToMany('App\\BusStop');\n }", "public static function getNewtorkIds()\n {\n return array_keys(self::$networks);\n }", "static public function GetAirportsEndByStart($begin)\n {\n $ids = DbHandler::Query(\"SELECT DISTINCT(airport_id) FROM airports WHERE ( airport_id IN ( SELECT airport_stop_id FROM traject WHERE airport_start_id=:id GROUP BY airport_stop_id)) ORDER BY airports.name ASC ;\",\n array(\"id\" => $begin));\n\n $airports = array();\n\n for ($i = 0; $i < count($ids); $i++) {\n $airports[] = airports::GetAirportByID($ids[$i][\"airport_id\"]);\n }\n\n return $airports;\n }", "public function getHistorySteps($id)\n {\n try {\n $store = $this->getPersistence();\n\n return $store->findHistorySteps($id);\n } catch (StoreException $e) {\n $errMsg = sprintf(\n 'Ошибка при получение истории шагов для экземпляра workflow c id# %s',\n $id\n );\n $this->getLog()->error($errMsg, [$e]);\n }\n\n return [];\n }", "public function getServiceTurnaroundTimesDropDown()\n {\n $serviceTurnaroundTimes = $this->getServiceTurnaroundTimes();\n\n if ( count( $serviceTurnaroundTimes ) > 0 )\n {\n foreach ( $serviceTurnaroundTimes as $turnAroundTime )\n {\n $turnAroundTimes[ $turnAroundTime->getTurnaroundTime()->id ] = $turnAroundTime->getTurnaroundTime()->name;\n }\n return $turnAroundTimes;\n }\n return array();\n }" ]
[ "0.62264055", "0.6187026", "0.6047254", "0.60381603", "0.6017687", "0.5994894", "0.5771069", "0.56499535", "0.55783504", "0.55626345", "0.5516591", "0.54681015", "0.54279566", "0.53501785", "0.53155154", "0.5205559", "0.5177524", "0.5137254", "0.51315176", "0.5131162", "0.507839", "0.5046375", "0.5023856", "0.4988016", "0.49812448", "0.49361914", "0.49284053", "0.49098444", "0.4908424", "0.4884343", "0.4877219", "0.48757744", "0.48749503", "0.48728803", "0.48708308", "0.48698765", "0.48594493", "0.48520544", "0.48395407", "0.48329958", "0.48312545", "0.48261482", "0.4815517", "0.48149306", "0.48092577", "0.4808236", "0.48062915", "0.4786313", "0.47764474", "0.4768457", "0.4766951", "0.47663873", "0.47615728", "0.47471154", "0.4746989", "0.47421932", "0.47360617", "0.47282934", "0.47280478", "0.47219074", "0.47133848", "0.46995202", "0.46973553", "0.46918434", "0.4689679", "0.46882248", "0.468581", "0.46831015", "0.46686485", "0.46647292", "0.46574837", "0.46402434", "0.46261877", "0.4626125", "0.46206808", "0.46190256", "0.4618864", "0.46131092", "0.46121174", "0.46049678", "0.45921344", "0.45822632", "0.45721385", "0.4568581", "0.45680255", "0.45567742", "0.45375663", "0.4537074", "0.45319688", "0.45265517", "0.4523707", "0.45220935", "0.45199645", "0.45175293", "0.4516669", "0.45125324", "0.45110685", "0.45109203", "0.45005527", "0.45002276" ]
0.48870522
29
get name of a stop
function getStop($db, $stop_id) { //get the stop info $query = array("stop_id" => $stop_id); $cursor = $db->stops->find( $query ); //print_debug($cursor); return ($cursor); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function getStopName($id){\n return self::getStop($id)->data->attributes->name;\n }", "private function getStopReadableName($stop_id): string\n {\n $url = 'https://api-v3.mbta.com/stops/' . $stop_id;\n\n $client = \\Drupal::httpClient();\n $request = $client->get($url)->getBody()->getContents();\n $name = json_decode($request, true)['data']['attributes']['description'];\n return $name;\n }", "public function getStop($stopId);", "function getStopCode() {\n\t\treturn $this->code[self::STOP];\n\t}", "public function getName(){\n return $this->game->get_current_turn()->ReturnName();\n }", "public function getName() {\n\t\treturn $this->selectedEndpoint['name'];\n\t}", "public function getInstanceName(): string\n {\n return $this->instanceName;\n }", "public function getName() {\n\t\treturn $this->current_name;\n\t}", "public function getInstanceName()\n {\n return $this->instanceName;\n }", "public function getInstanceName()\n {\n return $this->instanceName;\n }", "public function getName() {\n\t\treturn \"Slime\";\n\t}", "public function getName()\n\t{\n\t\treturn $this->process;\n\t}", "public function getName(): string {\n\t\treturn $this->lFactory->get('spreed')->t('Talk');\n\t}", "function getStepName()\r\n {\r\n return $this->_currentStep;\r\n }", "protected function getServiceName()\n {\n return $this->argument('service');\n }", "public function getName() {\n\t\t\n\t\t// cut last part of class name\n\t\treturn substr( get_class( $this ), 0, -11 );\n\t\t\n\t}", "public function getName() {\n $path = explode('\\\\', get_class($this->object[\"data\"]));\n return array_pop($path);\n }", "function loggy_stop($name = 'Measurement')\n {\n return Loggy::stopMeasurement($name);\n }", "function get_name() {\n\t\treturn $this->get_name_from_vtec();\t\n\t}", "public static function timeFunctionStop($name)\n {\n $session = self::getSession();\n\n if (isset($session->timings[$name])) {\n $level = $session->timings[$name]['level'] - 1;\n\n if (isset($session->timings[$name]['times'][$level]['start'])) {\n $time = microtime(true) - $session->timings[$name]['times'][$level]['start'];\n\n $session->timings[$name]['times'][$level]['start'] = null;\n $session->timings[$name]['times'][$level]['count']++;\n $session->timings[$name]['times'][$level]['sum'] += $time;\n\n $session->timings[$name]['count']++;\n $session->timings[$name]['level']--;\n $session->timings[$name]['sum'] += $time;\n } else {\n self::r(\"To many stop timing calls for $name at $level.\");\n }\n } else {\n self::r(\"Unknown stop timing call for $name.\");\n }\n }", "public function getName()\r\n {\r\n // TODO: Implement getName() method.\r\n return \"servicedescription\";\r\n }", "public static function name()\n {\n return 'swertres';\n }", "function getName() {\n return $this->instance->getName();\n }", "public function getName()\n\t{\n\t\treturn substr(__CLASS__, 7);\n\t}", "public function getName()\n\t{\n\t\treturn substr(__CLASS__, 7);\n\t}", "public function getName()\n {\n return $this->scheduleTypeName;\n }", "protected function getNameInput()\n {\n return preg_replace('/Endpoint$/', '', trim($this->argument('name'))) . \"Endpoint\";\n }", "protected function _getTaskName()\n {\n $name = explode(':', $this->getName());\n\n return $name[1];\n }", "public static function getName();", "public function getServiceName()\n {\n if (array_key_exists(\"serviceName\", $this->_propDict)) {\n return $this->_propDict[\"serviceName\"];\n } else {\n return null;\n }\n }", "function getCurTrackName(){\n\n\t}", "public function getStationName(): string\n {\n return $this->name;\n }", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();" ]
[ "0.81311196", "0.71966153", "0.65919685", "0.65143657", "0.61098754", "0.6005389", "0.58205366", "0.5813099", "0.58087814", "0.58087814", "0.57916105", "0.5770967", "0.5769359", "0.57645065", "0.576272", "0.5746036", "0.5697314", "0.5691237", "0.5681408", "0.56703115", "0.566599", "0.56594104", "0.5655837", "0.564694", "0.564694", "0.56374717", "0.5630796", "0.5575546", "0.55704176", "0.556781", "0.5560629", "0.55567014", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187", "0.5550187" ]
0.56056356
27
helper to print variables
function print_debug($var) { //display if null if ($var == NULL) print("$var is NULL"); //iterate through results and display foreach($var as $obj) { print_r($obj);; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dump() {\n\t\t$vars = get_object_vars( $this );\n\t\techo '<pre style=\"text-align:left\">';\n\t\tforeach( $vars as $name => $value ) {\n\t\t\techo $name.': '.$value.\"\\n\";\n\t\t}\n\t\techo '</pre>';\n\t}", "public function dump($variable) {}", "function dump($variable)\n {\n echo '<pre>';\n print_r($variable);\n }", "function var_show($var)\n{\n echo '<pre>';\n var_dump($var);\n echo '</pre>';\n}", "function varInfo(...$vars)\n {\n return (new VarDump(...$vars))->toString();\n }", "function pr($var) {\n\t\t\t\n\t\t\tob_start();\n\t\t\tprint_r($var);\n\t\t\t$content = ob_get_contents();\n\t\t\tob_clean();\n\t\t\t\n\t\t\techo \"<pre>\";\n\t\t\techo htmlentities($content);\n\t\t\techo \"</pre>\";\n\t}", "function dump($var) {\n\t\t\techo '<pre>';\n\t\t\tvar_dump($var);\n\t\t\techo '</pre>';\n\t\t}", "function myVar_dump($var)\n{\n echo sprintf('<pre>%s</pre>', print_r($var, true));\n}", "public function print_vars($vars)\n\t{\n\t\t$this->last_selector = null;\n\n\t\t$args = array();\n\t\tforeach (func_get_args() as $name => $arg)\n\t\t{\n\t\t\tif (is_object($arg))\n\t\t\t{\n\t\t\t\t$arg = get_object_vars($arg);\n\t\t\t}\n\t\t\t$args[$name] = array(var_export($arg, true));\n\t\t}\n\n\t\treturn $this->cmd(6, $args);\n\t}", "public static function dump($var)\n {\n echo \"<pre>\" . htmlentities(print_r($var, true)) . \"</pre>\";\n }", "function dump2(&$variable, $info = false) {\n $backup = $variable;\n $variable = $seed = md5(uniqid() . rand());\n $variable_name = 'unknown';\n foreach ($GLOBALS as $key => $value) {\n if ($value === $seed) { $variable_name = $key; }\n }\n $variable = $backup;\n\n echo '<pre style=\"\n font: 9pt sans-serif;\n text-align: left;\n margin: 25px;\n display: block;\n background: white;\n color: black;\n border:1px solid #ccc;\n padding:5px;\n margin: 25px;\n font-size: 11px;\n line-height: 14px;\n \">';\n\n $info = ($info) ? $info : '$' . $variable_name;\n echo '<b style=\"color:red;\">' . $info . ':</b><br>';\n do_dump($variable, '$' . $variable_name);\n echo '<b style=\"color:red;\">End ' . $info . '</b></pre>';\n}", "public static function debug()\n\t{\n\t\tif (func_num_args() === 0)\n\t\t\treturn;\n\n\t\t// Get all passed variables\n\t\t$variables = func_get_args();\n\n\t\t$output = array();\n\t\tforeach ($variables as $var)\n\t\t{\n\t\t\t$type = gettype($var);\n\n\t\t\tswitch ($type)\n\t\t\t{\n\t\t\t\tcase 'null':\n\t\t\t\t\t$var = 'NULL';\n\t\t\t\tbreak;\n\t\t\t\tcase 'boolean':\n\t\t\t\t\t$var = $var ? 'TRUE' : 'FALSE';\n\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\t$var = htmlspecialchars(print_r($var, TRUE), NULL, self::$charset, TRUE);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t$output[] = '<pre>('.$type.') '.$var.'</pre>';\n\t\t}\n\n\t\treturn implode(\"\\n\", $output);\n\t}", "public function printVar($varName) {\n if ( isset($this->templateVars[$varName]) ) {\n echo $this->templateVars[$varName];\n }\n }", "public function PrintData() {\r\n echo \"\".\"<br/>\";\r\n echo $this->string_var.\"<br/>\";\r\n echo $this->int_var.\"<br/>\";\r\n }", "function dump($var, $name='') {\r\n}", "function var_dump_pre ($input_variable)\n{\n print(\"<pre>\");\n var_dump($input_variable);\n print(\"</pre>\");\n}", "function debug( $var ) {\n print \"<pre>\";\n var_dump( $var );\n print \"</pre>\";\n }", "function dumpvar($mixed)\n\t\t{\n\t\t\t$this->vardump($mixed);\n\t\t}", "function pr($var)\n{\n $var_name = return_var_name($var);\n echo \"<pre> \\n\";\n echo '==============================';\n echo \"\\nBEGIN print_r of \\\"\\${$var_name}\\\"\";\n echo \"\\n------------------------------\\n\";\n print_r($var);\n echo \"\\n------------------------------\\n\";\n echo \"END print_r of \\\"\\${$var_name}\\\"\\n\";\n echo \"==============================\\n\";\n echo '</pre>' . PHP_EOL . PHP_EOL;\n}", "function dumpVar($var)\n\t{\n\t\tif (is_array($var) || is_object($var))\n\t\t\t$var = trim(preg_replace(\"/\\n */\", \" \", print_r($var, true)));\n\t\treturn htmlspecialchars($var, ENT_NOQUOTES);\n\t}", "function debug($var) {\n\techo '<pre>',print_r($var,1),'</pre>';\n}", "public static function debug()\r\n {\r\n if (func_num_args() === 0)\r\n return;\r\n\r\n // Get all passed variables\r\n $variables = func_get_args();\r\n\r\n $output = array();\r\n foreach ($variables as $var)\r\n {\r\n $output[] = Core::_dump($var, 1024);\r\n }\r\n\r\n echo '<pre class=\"debug\">'.implode(\"\\n\", $output).'</pre>';\r\n }", "function xdump(...$vars)\n {\n screens()->runtime()->addNl(\n (new VarDump(...$vars))\n ->toString()\n )->emit();\n }", "function preVar($variable){\n\techo \"<pre>\";\n\tvar_dump($variable);\n\techo \"</pre>\";\n}", "function dump($var)\n {\n util::dump($var);\n }", "function dump($var)\n{\n echo '<pre>';\n var_dump($var);\n echo '</pre>';\n}", "function debug($variable)\n{\n echo \"<pre>\" . print_r($variable, true) . \"</pre>\";\n}", "function dump($variable)\n {\n // dump variable using some quick and dirty (albeit invalid) XHTML\n if (!$variable && !is_numeric($variable))\n print(\"Variable is empty, null, or not even set.\");\n else\n print(\"<pre>\" . print_r($variable, true) . \"</pre>\");\n\n // exit immediately so that we can see what we printed\n exit;\n }", "function dump(&$var, $info = FALSE)\n{\n\t$scope = false;\n\t$prefix = 'unique';\n\t$suffix = 'value';\n\n\tif($scope) $vals = $scope;\n\telse $vals = $GLOBALS;\n\n\t$old = $var;\n\t$var = $new = $prefix . rand() . $suffix; $vname = FALSE;\n\tforeach($vals as $key => $val) if($val === $new) $vname = $key;\n\t$var = $old;\n\n\techo \"<pre style='margin: 0px 0px 10px 0px; display: block; background: white; color: black; font-family: Verdana; border: 1px solid #cccccc; padding: 5px; font-size: 10px; line-height: 13px;'>\";\n\tif($info != FALSE) echo \"<b style='color: red;'>$info:</b><br>\";\n\tdo_dump($var, '$'.$vname);\n\techo \"</pre>\";\n}", "private function vardump($var_name = NULL){\r\n\t\tif (isset($var_name)) {\r\n\t\t\t$scope = $GLOBALS[$var_name];\r\n\r\n\t\t\t$this->info($var_name . ' : ' . trim(var_export($scope,true)) . PHP_EOL\r\n\t\t\t$this->info(\"-----------------------------------\");\r\n\t\t}\r\n\t}", "public static function dump($variable) {\n echo '<pre>';\n var_dump($variable);\n echo '</pre>';\n }", "public static function dump($var) {\n self::$dumped .= print_r($var, TRUE) . \"<br><br>\";\n self::$dumped = htmlspecialchars(self::$dumped);\n }", "function varDump($object) {\n\t\techo \"<pre>\";\n\t\tprint_r($object);\n\t\techo \"</pre>\";\n\t}", "function dump($var)\n{\n echo '<br /><pre>';\n var_dump($var);\n echo'</pre><hr />';\n}", "private function print() {\n\t\tvar_dump($this->getParams());\n\t}", "public function pr($var) \n\t{\n\t\techo '<pre>';\n\t\tprint_r($var);\n\t\techo '</pre>';\n\t}", "function debug($var) {\n echo '<pre>'. print_r($var, 1) .'</pre>';\n}", "public function print();", "public function dprint()\n\t{\n\t\tprint_r( $this->debug );\n\t}", "public abstract function printValue($value);", "function dump ($var, $label = 'Dump', $echo = TRUE)\n {\n ob_start();\n var_dump($var);\n $output = ob_get_clean();\n \n // Add formatting\n $output = preg_replace(\"/\\]\\=\\>\\n(\\s+)/m\", \"] => \", $output);\n $output = '<pre style=\"background: #FFFEEF; color: #000; border: 1px dotted #000; padding: 10px; margin: 10px 0; text-align: left;\">' . $label . ' => ' . $output . '</pre>';\n \n // Output\n if ($echo == TRUE) {\n echo $output;\n }\n else {\n return $output;\n }\n }", "function debug_var(...$values) { // \"...\" permet de regroupers tous les paramètres en un tableau ($values)\n var_dump(...$values); // \"...\" permet ici l'inverse, il split le tableau pour tout remonter au même niveau. équivalent de var_dump($values[0], $values[1], $values[2]);\n die(); // Stop le rendu PHP ici. Plus rien ne s'exécutera et le resultat est directement retourné à l'utilisateur\n}", "function PrintVar(&$var, $template_safe = true)\n {\n if( !CCDebug::IsEnabled() )\n return;\n\n $t =& CCDebug::_textize($var);\n\n $html = '<pre style=\"font-size: 10pt;\">' .\n htmlspecialchars($t) .\n '</pre>';\n\n if( $template_safe )\n {\n CCPage::PrintPage( $html );\n }\n else\n {\n print(\"<html><body>$html</body></html>\");\n }\n exit;\n }", "public function printValues() {\n\t\t//print_r($this->objects);\n\t\tforeach ($this->objects as $value) {\n\t\t\techo \"$value<br/>\";\n\t\t}\n\t}", "function dump($var, $label = 'Dump', $echo = true) {\n ob_start();\n var_dump($var);\n $output = ob_get_clean();\n\n // Add formatting\n $output = preg_replace(\"/\\]\\=\\>\\n(\\s+)/m\", '] => ', $output);\n $output = '<pre style=\"background: #FFFEEF; color: #000; border: 1px dotted #000; padding: 10px; margin: 10px 0; text-align: left;\">'.$label.' => '.$output.'</pre>';\n\n // Output\n if ($echo == true) {\n echo $output;\n } else {\n return $output;\n }\n }", "function varDumpToString ($var) {\n echo __FUNCTION__ . \"\\n\";\n ob_start();\n var_dump($var);\n $result = ob_get_clean();\n return $result;\n}", "function vd($var) {\n\techo '<hr><pre>';\n\tvar_dump($var);\n\techo '</pre><hr>';\n}", "static function dump($var) {\n\t\tif (is_null($var)) {\n\t\t\treturn self::em('null');\n\t\t} elseif (is_scalar($var)) {\n\t\t\tif (is_string($var)) {\n\t\t\t\treturn $var;\n\t\t\t} elseif (is_numeric($var)) {\n\t\t\t\treturn $var;\n\t\t\t} elseif (is_bool($var)) {\n\t\t\t\treturn ($var) ? 'true' : 'false';\n\t\t\t} else {\n\t\t\t\treturn 'scalar but non string / numeric / bool';\n\t\t\t}\n\t\t} else {\n\t\t\tif (is_array($var)) {\n\t\t\t\tif (a::associative($var)) {\n\t\t\t\t\t$return = '<table cellpadding=\"5\" border=\"1\" style=\"margin:20px;font:12px helvetica;\">';\n\t\t\t\t\tforeach ($var as $key=>$value) {\n\t\t\t\t\t\t$return .= '<tr><td style=\"background-color:#eee;font-weight:bold;\">' . $key . '</td><td>' . self::dump($value) . '</td></tr>';\n\t\t\t\t\t}\n\t\t\t\t\treturn $return . '</table>';\n\t\t\t\t} else {\n\t\t\t\t\tforeach ($var as &$value) $value = self::dump($value);\n\t\t\t\t\treturn self::ol($var, array('start'=>0));\n\t\t\t\t}\n\t\t\t} elseif (is_object($var)) {\n\t\t\t\treturn 'object' . self::dump(a::object($var));\n\t\t\t} elseif (is_resource($var)) {\n\t\t\t\treturn 'resource';\n\t\t\t} else {\n\t\t\t\treturn 'non-scalar but not array, object or resource';\n\t\t\t}\n\t\t}\n\t}", "function debug($variable)\n{\n\techo '<pre>';\n\tprint_r($variable);\n\techo '</pre>';\n}", "function v($variable) {\tdie( var_dump($variable) ); }", "function d($var, $var_name = null) {\n?>\n <pre style=\"word-wrap: break-word; white-space: pre; font-size: 11px;\">\n<?php\n if (isset($var_name)) {\n echo \"<strong>$var_name</strong>\\n\";\n }\n if (is_null($var) || is_string($var) || is_int($var) || is_bool($var) || is_float($var)) {\n var_dump($var);\n } else {\n print_r($var);\n }\n?>\n </pre><br>\n<?php\n}", "function dumpvar($mixed)\n\t\t{\n\t\t\treturn $this->vardump($mixed);\n\t\t}", "function dump ($var, $label = 'Dump', $echo = TRUE)\n{\n // Store dump in variable\n ob_start();\n var_dump($var);\n $output = ob_get_clean();\n\n // Add formatting\n $output = preg_replace(\"/\\]\\=\\>\\n(\\s+)/m\", \"] => \", $output);\n $output = '<pre style=\"background: #FFFEEF; color: #000; border: 1px dotted #000; padding: 10px; margin: 10px 0; text-align: left;\">' . $label . ' => ' . $output . '</pre>';\n\n // Output\n if ($echo == TRUE) {\n echo $output;\n }\n else {\n return $output;\n }\n}", "public static function debug($var) \n\t{\n\t\techo '<pre>'; var_dump($var); exit;\n\t}", "function pr( $var, $die = true ) {\n\techo '<pre>';\n\tprint_r( $var );\n\techo '</pre>';\n\tif ( $die ) {\n\t\tdie();\n\t}\n}", "function indeed_debug_var($variable){\n\t if (is_array($variable) || is_object($variable)){\n\t\t echo '<pre>';\n\t\t print_r($variable);\n\t\t echo '</pre>';\n\t } else {\n\t \tvar_dump($variable);\n\t }\n}", "function printvalues(){\n\t\tprint_r([$this->bedroom,$this->bathroom,$this->kitchen, $this->livingroom]);\n\t}", "static function var_dump (\n\t\t$var, \n\t\t$max_levels = null, \n\t\t$label = '$',\n\t\t$return_content = null)\n\t{\n\t\tif ($return_content === 'text') {\n\t\t\t$as_text = true;\n\t\t} else {\n\t\t\t$as_text = Pie::textMode();\n\t\t}\n\t\t\n\t\t$scope = false;\n\t\t$prefix = 'unique';\n\t\t$suffix = 'value';\n\t\t\n\t\tif ($scope) {\n\t\t\t$vals = $scope;\n\t\t} else {\n\t\t\t$vals = $GLOBALS;\n\t\t}\n\t\t\n\t\t$old = $var;\n\t\t$var = $new = $prefix . rand() . $suffix;\n\t\t$vname = FALSE;\n\t\tforeach ($vals as $key => $val)\n\t\t\tif ($val === $new) // ingenious way of finding a global var :)\n\t\t\t\t$vname = $key;\n\t\t$var = $old;\n\t\t\n\t\tif ($return_content) {\n\t\t\t$ob = new Pie_OutputBuffer();\n\t\t}\n\t\tif ($as_text) {\n\t\t\techo PHP_EOL;\n\t\t} else {\n\t\t\techo \"<pre style='margin: 0px 0px 10px 0px; display: block; background: white; color: black; font-family: Verdana; border: 1px solid #cccccc; padding: 5px; font-size: 10px; line-height: 13px;'>\";\n\t\t}\n\t\tif (!isset(self::$var_dump_max_levels)) {\n\t\t\tself::$var_dump_max_levels = Pie_Config::get('pie', 'var_dump_max_levels', 5);\n\t\t}\n\t\t$current_levels = self::$var_dump_max_levels;\n\t\tif (isset($max_levels)) {\n\t\t\tself::$var_dump_max_levels = $max_levels;\n\t\t}\n\t\tself::do_dump($var, $label . $vname, null, null, $as_text);\n\t\tif (isset($max_levels)) {\n\t\t\tself::$var_dump_max_levels = $current_levels;\n\t\t}\n\t\tif ($as_text) {\n\t\t\techo PHP_EOL;\n\t\t} else {\n\t\t\techo \"</pre>\";\n\t\t}\n\t\t\n\t\tif ($return_content) {\n\t\t\treturn $ob->getClean();\n\t\t}\n\t}", "public function debugprint($variable,$desc=\"\",$exit=0) {\n\t}", "function qa_debug($var)\n{\n\techo \"\\n\" . '<pre style=\"padding: 10px; background-color: #eee; color: #444; font-size: 11px; text-align: left\">';\n\techo $var === null ? 'NULL' : htmlspecialchars(print_r($var, true), ENT_COMPAT|ENT_SUBSTITUTE);\n\techo '</pre>' . \"\\n\";\n}", "private static function varDumpToString ($var)\n {\n ob_start();\n var_dump($var);\n $result = ob_get_clean();\n return $result;\n }", "public static function debugVar($var)\n {\n echo '<pre>';\n var_dump($var);\n echo '</pre>';\n }", "function smarty_modifier_debug_print_var( $var, $depth = 0, $length = 40 )\r\n{\r\n $_replace = array( \"\\n\" => \"<i>\\\\n</i>\", \"\\r\" => \"<i>\\\\r</i>\", \"\\t\" => \"<i>\\\\t</i>\" );\r\n switch ( gettype( $var ) )\r\n {\r\n case \"array\" :\r\n $results = \"<b>Array (\".count( $var ).\")</b>\";\r\n foreach ( $var as $curr_key => $curr_val )\r\n {\r\n $results .= \"<br>\".str_repeat( \"&nbsp;\", $depth * 2 ).\"<b>\".strtr( $curr_key, $_replace ).\"</b> =&gt; \".smarty_modifier_debug_print_var( $curr_val, ++$depth, $length );\r\n $depth--;\r\n }\r\n break;\r\n case \"object\" :\r\n $object_vars = get_object_vars( $var );\r\n $results = \"<b>\".get_class( $var ).\" Object (\".count( $object_vars ).\")</b>\";\r\n foreach ( $object_vars as $curr_key => $curr_val )\r\n {\r\n $results .= \"<br>\".str_repeat( \"&nbsp;\", $depth * 2 ).\"<b> -&gt;\".strtr( $curr_key, $_replace ).\"</b> = \".smarty_modifier_debug_print_var( $curr_val, ++$depth, $length );\r\n $depth--;\r\n }\r\n break;\r\n case \"boolean\" :\r\n case \"NULL\" :\r\n case \"resource\" :\r\n if ( TRUE === $var )\r\n {\r\n $results = \"true\";\r\n }\r\n else if ( FALSE === $var )\r\n {\r\n $results = \"false\";\r\n }\r\n else if ( NULL === $var )\r\n {\r\n $results = \"null\";\r\n }\r\n else\r\n {\r\n $results = htmlspecialchars( ( boolean )$var );\r\n }\r\n $results = \"<i>\".$results.\"</i>\";\r\n break;\r\n case \"integer\" :\r\n case \"float\" :\r\n $results = htmlspecialchars( ( boolean )$var );\r\n break;\r\n case \"string\" :\r\n $results = strtr( $var, $_replace );\r\n if ( $length < strlen( $var ) )\r\n {\r\n $results = substr( $var, 0, $length - 3 ).\"...\";\r\n }\r\n $results = htmlspecialchars( \"\\\"\".$results.\"\\\"\" );\r\n break;\r\n case \"unknown type\" :\r\n default :\r\n do\r\n {\r\n $results = strtr( ( boolean )$var, $_replace );\r\n if ( $length < strlen( $results ) )\r\n {\r\n $results = substr( $results, 0, $length - 3 ).\"...\";\r\n }\r\n $results = htmlspecialchars( $results );\r\n break;\r\n } while ( 1 );\r\n }\r\n return $results;\r\n}", "public function MyVarDump($var, $exit = true){\r\n\t\techo '<pre style=\"font-size:15px;\">';\r\n\t\t\tvar_dump($var);\r\n\t\techo '</pre>';\r\n\t\tif($exit){exit;}\r\n\t}", "function toDebug($nl = '<br>')\n {\n foreach (array_keys(get_class_vars(get_class($this))) as $k) {\n echo \"$k [\" . $this->$k . \"]{$nl}\";\n }\n }", "function xdd(...$vars)\n {\n screens()->runtime()->addNl(\n (new VarDump(...$vars))\n ->toString()\n )->emit();\n die(0);\n }", "public function out($var){\n\t\t\techo \"<br><br><pre>\";\n\t\t\tprint_r($var);\n\t\t\techo \"</pre><br><br>\";\n\t\t}", "public function out($var){\n\t\t\techo \"<br><br><pre>\";\n\t\t\tprint_r($var);\n\t\t\techo \"</pre><br><br>\";\n\t\t}", "public static function vdump($variable) {\r\n\t\t$dump = '';\r\n\t\tif(Debug::enabled()) {\r\n\t\t\tif(func_num_args() >= 1) {\r\n\t\t\t\tob_start();\r\n\t\t\t\techo \"<pre>\";\r\n\t\t\t\t$args = func_get_args();\r\n\t\t\t\t\r\n\t\t\t\t$count = count($args);\r\n\t\t\t\tfor($x = 0; $x < $count; $x++) {\r\n\t\t\t\t\tvar_dump($variable);\r\n\t\t\t\t}\r\n\t\t\t\techo Debug::getBackTrace('', 1, 'fdumped in');\r\n\t\t\t\techo \"\\n\\n\";\r\n\t\t\t\techo \"</pre>\"; \r\n\t\t\t\t$dump = ob_get_clean();\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\treturn $dump;\r\n\t}", "function psa_debug( $variable ) {\n\techo \"<pre>\";\n\tif( is_array( $variable ) || is_object( $variable ) ) {\n\t\tprint_r( $variable );\n\t} else {\n\t\tvar_dump( $variable );\n\t}\n\techo \"</pre>\";\n}", "function pre_var_dump( $var ) {\n\techo '<pre>'.\"\\n\";\n\tvar_dump( $var );\n\techo '</pre>'.\"\\n\";\n}", "function dd(){\n $args = func_get_args();\n ob_start();\n echo '<pre>';\n foreach($args as $vars){\n if(is_bool($vars) || is_null($vars))\n var_dump($vars);\n else\n echo htmlspecialchars(print_r($vars, true), ENT_QUOTES);\n echo PHP_EOL;\n }\n echo '</pre>';\n \n $ctx = ob_get_contents();\n ob_end_clean();\n \n echo $ctx;\n die;\n}", "function atk_var_dump($a, $d=\"\")\n{\n\tob_start();\n\tvar_dump($a);\n\t$data = ob_get_contents();\n\tatkdebug(\"vardump: \".($d!=\"\"?$d.\" = \":\"\").\"<pre>\".$data.\"</pre>\");\n\tob_end_clean();\n}", "public static function debug()\n {\n if (func_num_args() === 0) {\n return;\n }\n\n // Get params\n $params = func_get_args();\n $output = array();\n\n foreach ($params as $var) {\n $output[] = '<pre>('.gettype($var).') '.html::specialchars(print_r($var, true)).'</pre>';\n }\n\n return implode(\"\\n\", $output);\n }", "public static function debug($var) {\n echo '<pre>';\n var_dump($var);\n echo '</pre>';\n }", "private function pr($var) {\n if (is_object($var)) {\n if (!method_exists($var, 'toArray'))\n return;\n $var = $var->toArray();\n }\n\n echo '<pre style=\"font:15px Consolas;padding:10px;border:1px solid #c2c2c2;border-radius:10px;background-color:f7f7f7;box-shadow:0 1px 2px #ccc;\">';\n print_r($var);\n echo '</pre>';\n }", "static function dump($val) {\n\t\techo '<pre style=\"background-color:#ccc;padding:5px;font-size:14px;line-height:18px;\">';\n\t\t$caller = Debug::caller();\n\t\techo \"<span style=\\\"font-size: 12px;color:#666;\\\">Line $caller[line] of \" . basename($caller['file']) . \":</span>\\n\";\n\t\tif (is_string($val)) print_r(wordwrap($val, 100));\n\t\telse print_r($val);\n\t\techo '</pre>';\n\t}", "protected function debugVar($var){\n \tob_start(); \n \t$this->debug(nl2br(ob_get_clean()));\n }", "function ffd_debug( $var = '' , $exit=false) {\r\n\r\n\techo '<pre style=\"/*display: none;*/\">';\r\n\t\tif( is_object($var) || is_array($var) )\r\n\t\t\tprint_r($var);\r\n\t\telse \r\n\t\t\tvar_dump($var);\r\n echo '</pre>';\r\n if( $exit )\r\n die();\r\n}", "public static function p()\r\n\t{\r\n\t\t$consolePrint = false;\r\n\r\n\t\tif (!isset($_SERVER['HTTP_HOST']) || $_SERVER['HTTP_HOST'] == null) {\r\n\t\t\t$consolePrint = true;\r\n\t\t}\r\n\r\n\t\tif (!$consolePrint) {\r\n\t\t\techo '<pre>';\r\n\t\t}\r\n\t\t$args = func_get_args();\r\n\r\n\t\tforeach ($args as $var)\r\n\t\t{\r\n\t\t\tif ($var == null || $var == '') {\r\n\t\t\t\tvar_dump($var);\r\n\t\t\t} elseif (is_array($var) || is_object($var)) {\r\n\t\t\t\tprint_r($var);\r\n\t\t\t} else {\r\n\t\t\t\techo $var;\r\n\t\t\t}\r\n\t\t\tif (!$consolePrint) {\r\n\t\t\t\techo '<br>';\r\n\t\t\t} else {\r\n\t\t\t\techo \"\\n\";\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (!$consolePrint) {\r\n\t\t\techo '</pre>';\r\n\t\t}\r\n\t}", "public static function var_dumpp()\n {\n echo \"<pre>\";\n if(func_num_args()>0)\n foreach(func_get_args() as $argv)\n {\n var_dump($argv);\n }\n echo \"</pre>\";\n\n }", "function pr($a) {\n\techo '<pre>', gettype($a), ' - ', print_r($a, true), '</pre>';\n}", "public static function pvardebug($var) {\n printf(\"%s\\n\", static::vardebug($var));\n return static::getLastResult();\n }", "public static function dump()\n {\n $html = \"\";\n\n foreach( func_get_args() as $value )\n {\n $html .= \"<div style=\\\"background: #ffc; margin: 20px; padding: 20px;\\\"> \\n\";\n $html .= \" <pre> \\n\";\n $html .= \" \" . print_r( $value, true ) .\" \\n\";\n $html .= \" </pre> \\n\";\n $html .= \"</div> \\n\";\n }\n echo trim( $html );\n exit;\n }", "function w_dump($var) {\n if(is_object($var) and $var instanceof Closure) {\n $str = 'function (';\n $r = new ReflectionFunction($var);\n $params = array();\n foreach($r->getParameters() as $p) {\n $s = '';\n if($p->isArray()) {\n $s .= 'array ';\n } else if($p->getClass()) {\n $s .= $p->getClass()->name . ' ';\n }\n if($p->isPassedByReference()){\n $s .= '&';\n }\n $s .= '$' . $p->name;\n if($p->isOptional()) {\n $s .= ' = ' . var_export($p->getDefaultValue(), TRUE);\n }\n $params []= $s;\n }\n $str .= implode(', ', $params);\n $str .= '){' . PHP_EOL;\n $lines = file($r->getFileName());\n for($l = $r->getStartLine(); $l < $r->getEndLine(); $l++) {\n $str .= $lines[$l];\n }\n echo $str;\n return;\n } else if(is_array($var)) {\n echo \"<xmp class='a-left'>\";\n print_r($var);\n echo \"</xmp>\";\n return;\n } else {\n var_dump($var);\n return;\n }\n}", "function dump($var)\n{\n var_dump($var);\n return $var;\n}", "public function printValue($value)\n {\n print $value;\n }", "function debug($var): void\n {\n call_user_func('dump', $var);\n }", "function debug($var, $die = false) {\n\techo \"<pre>\" . print_r($var, true) . \"</pre>\";\n\tif ($die) {\n\t\tdie;\n\t}\n}", "function debug($variable){\n echo '<div style=\"border: 1px solid orange\">';\n echo '<pre>';\n print_r($variable);\n echo '</pre>';\n echo '</div>';\n}", "function debug($var = null, $name = null)\n{\n $bt = array();\n $file = '';\n if ($name !== false) {\n $bt = debug_backtrace();\n $file = str_replace(bp(), '', $bt[0]['file']);\n print '<div style=\"font-family: arial; background: #FFFBD6; margin: 10px 0; padding: 5px; border:1px solid #666;\">';\n if ($name) $name = '<b>' . $name . '</b><br/>';\n print '<span style=\"font-size:14px;\">' . $name . '</span>';\n print '<div style=\"border:1px solid #ccc; border-width: 1px 0;\">';\n }\n print '<pre style=\"margin:0;padding:10px;\">';\n print_r($var);\n print '</pre>';\n if ($name !== false) {\n print '</div>';\n print '<span style=\"font-family: helvetica; font-size:10px;\">' . $file . ' on line ' . $bt[0]['line'] . '</span>';\n print '</div>';\n }\n}", "private function debug($var = null) {\n if( $var ) {\n echo '<pre>';\n print_r( $var );\n echo '</pre>';\n }\n }", "function dd($var){\n\t\techo \"<pre>\";\n\t\tdie(print_r($var));\n\t}", "function do_dump(&$var, $var_name = NULL, $indent = NULL, $reference = NULL)\n{\n\t$do_dump_indent = \"<span style='color:#eeeeee;'>|</span> &nbsp;&nbsp; \";\n\t$reference = $reference.$var_name;\n\t$keyvar = 'the_do_dump_recursion_protection_scheme'; $keyname = 'referenced_object_name';\n\n\tif (is_array($var) && isset($var[$keyvar]))\n\t{\n\t\t$real_var = &$var[$keyvar];\n\t\t$real_name = &$var[$keyname];\n\t\t$type = ucfirst(gettype($real_var));\n\t\techo \"$indent$var_name <span style='color:#a2a2a2'>$type</span> = <span style='color:#e87800;'>&amp;$real_name</span><br>\";\n\t}\n\telse\n\t{\n\t\t$var = array($keyvar => $var, $keyname => $reference);\n\t\t$avar = &$var[$keyvar];\n\n\t\t$type = ucfirst(gettype($avar));\n\t\tif($type == \"String\") $type_color = \"<span style='color:green'>\";\n\t\telseif($type == \"Integer\") $type_color = \"<span style='color:red'>\";\n\t\telseif($type == \"Double\"){ $type_color = \"<span style='color:#0099c5'>\"; $type = \"Float\"; }\n\t\telseif($type == \"Boolean\") $type_color = \"<span style='color:#92008d'>\";\n\t\telseif($type == \"NULL\") $type_color = \"<span style='color:black'>\";\n\n\t\tif(is_array($avar))\n\t\t{\n\t\t\t$count = count($avar);\n\t\t\techo \"$indent\" . ($var_name ? \"$var_name => \":\"\") . \"<span style='color:#a2a2a2'>$type ($count)</span><br>$indent(<br>\";\n\t\t\t$keys = array_keys($avar);\n\t\t\tforeach($keys as $name)\n\t\t\t{\n\t\t\t\t$value = &$avar[$name];\n\t\t\t\tdo_dump($value, \"['$name']\", $indent.$do_dump_indent, $reference);\n\t\t\t}\n\t\t\techo \"$indent)<br>\";\n\t\t}\n\t\telseif(is_object($avar))\n\t\t{\n\t\t\techo \"$indent$var_name <span style='color:#a2a2a2'>$type</span><br>$indent(<br>\";\n\t\t\tforeach($avar as $name=>$value) do_dump($value, \"$name\", $indent.$do_dump_indent, $reference);\n\t\t\techo \"$indent)<br>\";\n\t\t}\n\t\telseif(is_int($avar)) echo \"$indent$var_name = <span style='color:#a2a2a2'>$type(\".strlen($avar).\")</span> $type_color$avar</span><br>\";\n\t\telseif(is_string($avar)) echo \"$indent$var_name = <span style='color:#a2a2a2'>$type(\".strlen($avar).\")</span> $type_color\\\"$avar\\\"</span><br>\";\n\t\telseif(is_float($avar)) echo \"$indent$var_name = <span style='color:#a2a2a2'>$type(\".strlen($avar).\")</span> $type_color$avar</span><br>\";\n\t\telseif(is_bool($avar)) echo \"$indent$var_name = <span style='color:#a2a2a2'>$type(\".strlen($avar).\")</span> $type_color\".($avar == 1 ? \"TRUE\":\"FALSE\").\"</span><br>\";\n\t\telseif(is_null($avar)) echo \"$indent$var_name = <span style='color:#a2a2a2'>$type(\".strlen($avar).\")</span> {$type_color}NULL</span><br>\";\n\t\telse echo \"$indent$var_name = <span style='color:#a2a2a2'>$type(\".strlen($avar).\")</span> $avar<br>\";\n\n\t\t$var = $var[$keyvar];\n\t}\n}", "function debug() {\r\n//\tif (!$debug_mode) {\r\n//\t\treturn;\r\n//\t}\r\n\techo '<pre>';\r\n\tforeach (func_get_args() as $var) {\r\n\t\t$psfix = str_repeat('-', 40);\r\n\t echo \"<span style='font-size: 18px; color:blue;'>\".\r\n\t \"debug: $psfix I were newbility line separator $psfix\".\r\n\t \"</span>\\n\";\r\n\t echo(var_dump($var));\r\n\t}\r\n echo '</pre>';\r\n}", "function vardump($mixed='')\n\t\t{\n\n\t\t\t// Start outup buffering\n\t\t\tob_start();\n\n\t\t\techo \"<p><table><tr><td bgcolor=ffffff><blockquote><font color=000090>\";\n\t\t\techo \"<pre><font face=arial>\";\n\n\t\t\tif ( ! $this->vardump_called )\n\t\t\t{\n\t\t\t\techo \"<font color=800080><b>ezSQL</b> (v\".EZSQL_VERSION.\") <b>Variable Dump..</b></font>\\n\\n\";\n\t\t\t}\n\n\t\t\t$var_type = gettype ($mixed);\n\t\t\tprint_r(($mixed?$mixed:\"<font color=red>No Value / False</font>\"));\n\t\t\techo \"\\n\\n<b>Type:</b> \" . ucfirst($var_type) . \"\\n\";\n\t\t\techo \"<b>Last Query</b> [$this->num_queries]<b>:</b> \".($this->last_query?$this->last_query:\"NULL\").\"\\n\";\n\t\t\techo \"<b>Last Function Call:</b> \" . ($this->func_call?$this->func_call:\"None\").\"\\n\";\n\t\t\techo \"<b>Last Rows Returned:</b> \".count($this->last_result).\"\\n\";\n\t\t\techo \"</font></pre></font></blockquote></td></tr></table>\".$this->donation();\n\t\t\techo \"\\n<hr size=1 noshade color=dddddd>\";\n\n\t\t\t// Stop output buffering and capture debug HTML\n\t\t\t$html = ob_get_contents();\n\t\t\tob_end_clean();\n\n\t\t\t// Only echo output if it is turned on\n\t\t\tif ( $this->debug_echo_is_on )\n\t\t\t{\n\t\t\t\techo $html;\n\t\t\t}\n\n\t\t\t$this->vardump_called = true;\n\n\t\t\treturn $html;\n\n\t\t}", "function d($var)\n{\n echo \"<style>pre.sf-dump .sf-dump-compact { display: inline !important; }</style>\";\n dd($var);\n}", "public static function debug_var($var)\n\t{\n\t\tswitch (gettype($var))\n\t\t{\n\t\t\tcase 'null':\n\t\t\t\treturn 'NULL';\n\t\t\tbreak;\n\t\t\tcase 'boolean':\n\t\t\t\treturn $var ? 'TRUE' : 'FALSE';\n\t\t\tbreak;\n\t\t\tcase 'string':\n\t\t\t\treturn var_export($var, TRUE);\n\t\t\tbreak;\n\t\t\tcase 'object':\n\t\t\t\treturn 'object '.get_class($var);\n\t\t\tbreak;\n\t\t\tcase 'array':\n\t\t\t\tif (arr::is_assoc($var))\n\t\t\t\t\treturn print_r($var, TRUE);\n\n\t\t\t\treturn 'array('.implode(', ', array_map(array(__CLASS__, __FUNCTION__), $var)).')';\n\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treturn var_export($var, TRUE);\n\t\t\tbreak;\n\t\t}\n\t}", "public function pr($objVar) {\n\t\techo \"<div align='left'>\";\n\t\tif (is_array($objVar) or is_object($objVar)) {\n\t\t\techo \"<pre>\";\n\t\t\tprint_r($objVar);\n\t\t\techo \"</pre>\";\n\t\t} else {\n\t\t\techo str_replace(\"\\n\", \"<br>\", $objVar);\n\t\t}\n\t\techo \"</div><hr>\";\n\t}", "function var_dump_pre($var)\n{\n echo '<pre>';\n echo var_dump($var);\n echo '</pre>';\n}" ]
[ "0.75960344", "0.7443416", "0.7346558", "0.73166335", "0.7314223", "0.7255716", "0.713064", "0.7119965", "0.7048607", "0.70357805", "0.70110255", "0.7007484", "0.6995851", "0.69943684", "0.6970716", "0.6892181", "0.68519855", "0.68465567", "0.6838294", "0.683062", "0.68197864", "0.681587", "0.681498", "0.68035144", "0.68031406", "0.67928994", "0.67769283", "0.67759705", "0.67466193", "0.6735725", "0.67275774", "0.67266077", "0.671474", "0.67113477", "0.6696847", "0.6690514", "0.6679935", "0.6664987", "0.6662088", "0.6656823", "0.6653498", "0.66457725", "0.6632223", "0.6630549", "0.6608976", "0.66013366", "0.6594706", "0.6593005", "0.6590364", "0.65895665", "0.6589297", "0.6577685", "0.6574143", "0.65394944", "0.6525786", "0.6520395", "0.6512716", "0.65109104", "0.6510438", "0.650831", "0.649771", "0.6497489", "0.6492982", "0.64909667", "0.64867765", "0.64800614", "0.64782006", "0.64782006", "0.6465787", "0.6465463", "0.6458402", "0.6456004", "0.6442306", "0.6436731", "0.6421882", "0.6412737", "0.640681", "0.63993496", "0.63891935", "0.6376616", "0.63713723", "0.6370891", "0.6370145", "0.63615346", "0.63387793", "0.63315785", "0.63286257", "0.6327601", "0.632062", "0.63153756", "0.6313637", "0.62954974", "0.628085", "0.6269633", "0.6262416", "0.6260355", "0.6259918", "0.6255163", "0.624387", "0.6226089" ]
0.6830112
20
Finds an existing Agent or creates a new DB Record
public function findOrCreate(Array $attributes): Agent { if (empty($attributes['name'])) { $attributes['name'] = 'unknown'; } return Agent::firstOrCreate($attributes); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function saveAgent() {\r\n // Consider wrapping the lines of code so its more\r\n // readable. Preferrably within 80-90 character length\r\n // - @vishal\r\n $sqlQuery = \"INSERT INTO users ( lname, fname, image_name, password, email, phone, enable, creation_date, address1, address2, zipcode, state, country, city, role) VALUES ('\" .\r\n parent::getLastname() . \"', '\" . \r\n parent::getFirstname() . \"', '\" . \r\n parent::getPictureName() . \"', '\" . \r\n hash(\"sha256\",parent::getPassword()) . \"', '\" . \r\n parent::getEmail() . \"', '\" . \r\n parent::getPhone() . \"', '\" .\r\n $this->enabled . \"', NOW(), '\". \r\n parent::getAddress1() .\"', '\".\r\n parent::getAddress2() .\"', '\". \r\n parent::getZipcode() .\"', '\" . \r\n parent::getState() .\"', '\" . \r\n parent::getCountry() .\"', '\" . \r\n parent::getCity() .\"', '\" . \r\n AGENT_ROLE_ID . \"');\";\r\n $result = $this->dbcomm->executeQuery($sqlQuery);\r\n \r\n if ($result != true)\r\n {\r\n echo $sqlQuery;\r\n echo \"<br><b>\" . $this->dbcomm->giveError() . \"</b>\";\r\n // As with many other lines, use single quotes '' where\r\n // string interpolation isn't required\r\n // - @vishal\r\n die(\"Error at agent saving\");\r\n }\r\n else\r\n {\r\n return 1;\r\n }\r\n }", "function addNewAgentToDB($data) {\n\t\tprint \"<br/>\\$data: \";\n\t\tprint_r($data);\n\t\treturn insertDatatoBD(\"agents\", $data) ;\n\t}", "function addAgent($agt) {\n\t\t\n\t\t# Create a new mySQLi object to connect to the \"travelexperts\" database\n\t\t$dbconnection = new mysqli(\"localhost\", \"root\", \"\", \"travelexperts\");\n\t\t\t\n\t\tif ($dbconnection->connect_error) {\n\t\t\tdie(\"Connection failed: \" . $dbconnection->connect_error);\n\t\t} \n\t\t\n\t\t# Create the SQL statement using the data in the $agt Agent object. The Agent object contains values for \n\t\t# every field in the agents table, so the field names do not need to be specified.\n\t\t$sql = \"INSERT INTO agents VALUES (\" . $agt->toString() . \")\";\n\t\t\n\t\t$result = $dbconnection->query($sql);\n\t\t\n\t\t# Log the SQL query and result to a log file, sqllog.txt. This file will be created if it doesn't exist,\n\t\t# otherwise text will be appended to the end of the existing file. \"\\r\\n\" creates a line break.\n\t\t$log = fopen(\"sqllog.txt\", \"a\");\n\t\tfwrite($log, $sql . \"\\r\\n\");\n\t\tif ($result) {\n\t\t\tfwrite($log, \"SUCCESS \\r\\n\");\n\t\t}\n\t\telse {\n\t\t\tfwrite($log, \"FAIL \\r\\n\");\n\t\t}\n\t\tfclose($log);\n\t\t\n\t\t$dbconnection->close();\n\t\t\n\t\t# Return a boolean value. $result is true if the insert query was successful and false if unsuccessful.\n\t\treturn $result;\n\t}", "private function createNewAgent($email_address, $agent_name) {\n try {\n $stmt = StatTracker::db()->prepare(\"INSERT INTO Agent (`email`, `agent`) VALUES (?, ?) ON DUPLICATE KEY UPDATE agent = VALUES(agent);\");\n $stmt->execute(array($email_address, $agent_name));\n $stmt->closeCursor();\n }\n catch (PDOException $e) {\n // Failing to insert an auth code will cause a generic registration email to be sent to the user.\n error_log($e);\n }\n }", "public function store(CreateAgentRequest $request)\n {\n $input = $request->all();\n\n\n //dd($input);\n\n\n try {\n DB::beginTransaction();\n\n $validator = validator($request->input(), [\n 'first_name' => 'required',\n 'last_name' => 'required',\n //'userID' => 'required|exists:users,userID',\n ]);\n\n if ($validator->fails()) {\n return back()->withErrors($validator);\n }\n\n $user = User::create([\n 'name' => $input['first_name'] . \" \" . $input['last_name'],\n 'email' => $input['email'],\n 'password' => Hash::make($input['password']),\n ]);\n\n $user->assignRole('agents');\n $input['user_id'] = $user->id;\n\n\n $agent = $this->agentRepository->create($input);\n $localGovt = $input['lga_id'];\n $resLGA = Lga::find($localGovt);\n\n $id = sprintf(\"%'04d\", $agent->id);\n $driverID = \"CYA\" . $resLGA->lgaId . $id;\n $input['unique_code'] = $driverID;\n $input['data_id'] = $agent->id;\n $input['model'] = \"Agent\";\n\n $biodata = $this->biodataRepository->create($input);\n\n\n DB::commit();\n Flash::success('Agent saved successfully.');\n } catch (\\Exception $exception) {\n //dd($exception->getMessage(), $exception->getLine(),$exception->getFile());\n DB::rollBack();\n Flash::error($exception->getMessage());\n }\n\n return redirect(route('agents.index'));\n }", "public function save($Obj){\n $rsArray = array();\n // convert the object to an Array\n \n $Obj->toArray($rsArray);\n\t\t#Zend_Debug::dump($rsArray);die();\n if($this->_exists($Obj->get_uid() ) ){\n \t//die(\"UPDATE - Agent\");\n \t$this->_index = $this->_update($rsArray);\n //\tdie($this->_index);\n return $this->_index; \n }else{\n \t//die(\"INSERT - Agent\");\n \t$this->_index = $this->_insert($rsArray);\n return $this->_index; \n }\n }", "public function createCrowdAgent($data){\n\n\t\t$workerId = $data['WorkerId'];\n\n\t\tif($id = CrowdAgent::where('platformAgentId', $workerId)->where('softwareAgent_id', 'amt')->pluck('_id')) \n\t\t\treturn $id;\n\t\telse {\n\t\t\t$agent = new CrowdAgent;\n\t\t\t$agent->_id= \"crowdagent/amt/$workerId\";\n\t\t\t$agent->softwareAgent_id= 'amt';\n\t\t\t$agent->platformAgentId = $workerId;\n\t\t\t$agent->save();\t\t\n\t\t\treturn $agent->_id;\n\t\t}\n\t}", "public function store(AgentRequest $request)\n {\n Agent::create($request->all());\n\n $id = Agent::where('nationCode', $request->input('nationCode'))->value('id');\n\n User::create([\n 'username' => $request->input('phonenumber'),\n 'password' => Hash::make($request->input('nationCode')),\n 'rollId' => -1 * $id\n ]);\n\n return redirect(route('agents.index'));\n }", "public function replaceAgent()\n {\n $agents = User::where('firstName', 'Direct')->delete();\n $user_details = new User();\n $user_details->role = \"AG\";\n $role = Role::where('abbreviation', 'AG')->first();\n $user_details->firstName = ucwords(strtolower('Direct'));\n $user_details->lastName = ucwords(strtolower(''));\n $user_details->email = '';\n $user_details->password = bcrypt(123456);\n $user_details->empID = 'B-0001';\n\n $user_details->department = ucwords(strtolower(''));\n $user_details->position = ucwords(strtolower(''));\n $user_details->nameOfSupervisor = ucwords(strtolower(''));\n $user_details->name = 'Direct';\n $user_details->role_name = 'Agent';\n $user_details->isActive = (int) 1;\n $user_details->save();\n dd($user_details);\n }", "public function record(){\n //store deadbody object first\n $this->create();\n\n //stores new deadbody in compartment\n $sql = \"SELECT * FROM compartment WHERE status='free' LIMIT 1\";\n $this->compartment = array_shift(Compartment::find_by_sql($sql));\n $this->compartment->status = \"occupied\";\n $this->compartment->dead_no = $this->id;\n\n //create basic service object related to this object\n $service = new RequestedService();\n $service->rel_no = 'null';\n $service->service_no = 1;\n $service->dead_no = $this->id;\n $service->status=\"TODO\";\n $this->requested_service[] = $service;\n\n //stores storage and service information\n if($this->compartment->save() && $service->save()){\n return true;\n } else {\n return false;\n }\n }", "protected function create(array $data)\n {\n\n return Agent::create([\n 'name' => $data['name'],\n 'email' => $data['email'],\n 'password' => Hash::make($data['password']),\n 'middlename' => $data['middlename'], \n 'lastname' => $data['lastname'], \n 'company_name' => $data['company_name'],\n 'socail_security_number' => $data['socail_security_number'], \n 'tax_id'=> $data['tax_id'], \n 'phone_number'=> $data['phone_number'],\n 'email2'=> $data['email2'],\n 'address'=> $data['address'],\n 'address2'=> $data['address2'],\n 'city'=> $data['city'],\n 'state'=> $data['state'],\n 'pincode'=> $data['pincode'],\n 'upline'=> $data['upline'],\n 'uplinetype'=>$data['uplinetype'],\n 'compensation'=>$data['compensation'],\n 'override'=>$data['compensation'],\n 'agentid'=> $data['agentid'],\n ]);\n }", "public function run()\n {\n foreach ($this->getAgencies() as $orgao) {\n Agency::firstOrCreate($orgao);\n }\n }", "public function store(StoreAgent $request)\n {\n $agent = new Agent;\n $agent->nome = $request->input('nome');\n $agent->cognome = $request->input('cognome');\n $agent->tel = $request->input('tel');\n $agent->email = $request->input('email');\n $agent->email2 = $request->input('email2');\n $agent->active = $request->has('active') ? true : false;\n $agent->save();\n\n return redirect()\n ->route('agents.index')\n ->with('success','Agente creato corretamente.');\n }", "public function create()\n {\n $agent = new Agent;\n \n return view('agent.createModify')->with([\n 'agent' => $agent,\n 'action' => 'create',\n ]);\n }", "public function run()\n {\n Agent::create([\n 'name' => 'agent',\n 'email' => '[email protected]',\n 'password' => 1234\n ]);\n \n Agent::create([\n 'name' => 'huzaifa',\n 'email' => '[email protected]',\n 'password' => 1234\n ]);\n }", "public function run()\n {\n Agent::create([\n 'username' => 'agent1',\n 'password' => bcrypt('123456'),\n ]);\n\n Agent::create([\n 'username' => 'agent11',\n 'agent_id' => 1,\n 'password' => bcrypt('123456'),\n ]);\n\n Agent::create([\n 'username' => 'agent12',\n 'agent_id' => 1,\n 'password' => bcrypt('123456'),\n ]);\n }", "public function findOrCreateNotDetected(): Agent\n {\n return Agent::firstOrCreate([\n 'name' => 'unknown',\n 'browser' => NULL,\n 'browser_version' => NULL\n ]);\n }", "function insert_record($post_data)\n {\n if (isset($post_data[\"user_agent\"])) {\n $user_agent = $post_data[\"user_agent\"];\n if ($user_agent == \"\" or $user_agent == \" \") {\n $this->invalid_data_format('[{\"user_agent\":\"SIPAgent\"}]');\n return;\n }\n } else {\n $this->invalid_data_format('[{\"user_agent\":\"SIPAgent\"}]');\n return;\n }\n $db = new DB();\n $conn = $db->connect();\n if (empty($conn)) {\n $statusCode = 404;\n $this->setHttpHeaders(\"application/json\", $statusCode);\n $rows = array(\n 'error' => 'No databases found!'\n );\n $response = json_encode($rows);\n echo $response;\n return;\n } else {\n $statusCode = 200;\n }\n $stmt = $conn->prepare(\"call insert_user_agent(?)\");\n $stmt->bind_param('s', $user_agent);\n $stmt->execute();\n $result = $db->get_result($stmt);\n $conn->close();\n $rows = array();\n while ($r = array_shift($result)) {\n $rows[] = $r;\n }\n if ($rows == Null) {\n $statusCode = 409;\n $rows = array(\n array(\n 'error' => \"user_agent(\" . $user_agent . \") already exists in table or table doesn't exist\"\n )\n );\n }\n $this->setHttpHeaders(\"application/json\", $statusCode);\n $response = json_encode($rows[0]);\n echo $response;\n }", "public function agent_add() {\n\n\n\t\t$post = $this->input->post();\n \n $this->form_validation->set_rules('agent', 'agent' , 'required|is_unique[agent.agent]');\n $this->form_validation->set_error_delimiters('<span class=\"text-danger\">','</span>');\n\n\t\tif(!empty($post) && $this->form_validation->run() ==FALSE) {\n\t\t\t \n\t\t\t $this->session->set_flashdata('error', 'Validation error. Please check the form.');\n\t\t\t $this->load->model('Datype_model');\n\t\t\t\t$data[\"admins\"] = $this->Datype_model->getAgent();\n\t\t\t\t$this->load->view('header');\n\t\t\t\t$this->load->view('masters/agent', $data);\n\t\t\t\t$this->load->view('footer');\n \n\t\t} else {\n \n\t\t\t$table_array = array ('agent' => $post['agent']);\n\t\t\t$this->db->insert('agent' , $table_array);\n\t\t\t$inserted = $this->db->insert_id();\n\t\t\tif(!empty($inserted)) {\n\t\t\t\t$this->session->set_flashdata('success', 'Agent added Successfully!.');\n\t\t\t\treturn redirect(base_url().'masters/agent');\n\t\t\t} else {\n\t\t\t\t$this->session->set_flashdata('error', 'Technical error!.');\n\t\t\t\treturn redirect(base_url().'masters/agent');\n\t\t\t}\n\t\t}\n\t\t\n\t}", "public function create()\n {\n return view('Tenant::Agent/add');\n }", "public function createRecord();", "public function store() {\n $validator = \\Validator::make(\\Request::all(), array(\n 'name' => 'required|max:255|unique:groups',\n 'region_id' => 'required',\n 'phone_no' => 'sometimes|digits_between:10,15',\n )\n );\n //dd(\\Request::all());\n if ($validator->fails()) {\n return redirect('/agent/add-agent')\n ->withErrors($validator)\n ->withInput();\n } else {\n $agents = \\App\\Agent::create(\\Request::all());\n if ($agents) {\n return redirect('/agent')\n ->with('global', '<div class=\"alert alert-success\">Agent details successfullly saved in the database</div>');\n } else {\n return redirect('/agent')\n ->with('global', '<div class=\"alert alert-warning\">Your input could not be saved. Please contact administrator!</div>');\n }\n }\n }", "public function return_existing_if_exists()\n {\n $author = factory( Author::class )->create();\n $data = array_add( $this->authorDataFormat, 'data.id', $author->id );\n\n $newAuthor = $this->dispatch( new StoreAuthor( $data ) );\n\n $this->assertEquals( $author->id, $newAuthor->id );\n }", "public function run()\n {\n if(DB::table('agents')->count() == 0) {\n DB::table('agents')->insert([\n\n 'nom' =>'Lekhal',\n 'prenom' => 'Maha',\n 'sexe'=>'Femme',\n 'user_id' => 1,\n 'poste_id' =>1,\n 'updated_at'=>now(),\n 'created_at' => now()\n \n \n \n ]);\n }\n }", "public function store(Request $request)\n {\n //\n //dd(Auth::user()->name);\n\n //dd($request);\n\n $this->validate(request(),[\n 'Issue_Number' => 'required|integer',\n 'client_satisfied' => 'required',\n 'client_confidence' => 'required',\n 'Self_Rating' => 'required'\n ]);\n\n\n $agent = new Agent;\n\n $agent->date = Carbon::now()->toDateString();\n $agent->agent = Auth::user()->name;\n $agent->issue_number = $request->Issue_Number;\n $agent->satisfaction = $request->client_satisfied;\n $agent->confidence = $request->client_confidence;\n $agent->rating = $request->Self_Rating;\n $agent->fk_user = Auth::user()->id;\n\n\n\n $agent->save();\n\n return redirect()->back()->with('message', 'Your details have been saved. Thanks');\n }", "public function agent()\n {\n \treturn $this->belongsTo(Agent::class, 'agent_id');\n }", "public final function find_or_create ($payload) {\n $found = $this->table()->getActionType($this->_type_from_payload($payload));\n return $found !== null ? $this->_adapt($found) : $this->create($payload);\n }", "public function AutomaticCreateBasedAdmin(){\n $resp = employees::find(1);\n if(!$resp){\n employees::create([\n 'emp_name'=>'admin',\n 'emp_password'=>'test',\n 'emp_address'=>'abc',\n 'emp_phone'=>'0000000000',\n 'emp_dob'=> new DateTime(),\n 'pos_id'=>1,\n ]);\n }else{\n $resp->pos_id = 1;\n $resp->save();\n }\n }", "public function create_a_record()\n {\n // Add a record\n factory(Email::class, 1)->create();\n\n $this->assertCount(1, Email::all());\n }", "public function save(){\n\t\t$db = new Database();\n\n\t\t$reportInDB = isset($this->id);\n\n\t\tif($reportInDB === false){ //new report\n\t\t\t$sql = \"INSERT INTO `reports`(`description`, `involvementKindID`, `reportKindID`, `locationID`, `personID`, `departmentID`, `dateTime`,`statusID`,`actionTaken`, `photoPath`) VALUES(?,?,?,?,?,?,?,?,?,?)\";\n\t\t\t$sql = $db->prepareQuery($sql, $this->description, $this->involvementKindID, $this->reportKindID, $this->locationID, $this->personID, $this->departmentID, $this->dateTime, $this->statusID, $this->actionTaken, $this->photoPath);\n\t\t\t$db->query($sql);\n\n\t\t\t//get id of new Report\n\t\t\t$reportInDB = Report::reportExists($this->personID, $this->dateTime);\n\t\t\tif($reportInDB != false){\n\t\t\t\t$this->id = $reportInDB;\n\t\t\t} else return false;\n\t\t} else { //old report\n\t\t\tif(is_null($this->id)){ //old report, new object. no local id yet\n\t\t\t\t$this->id = $reportInDB;\n\t\t\t}\n\n\t\t\t$sql = \"UPDATE reports SET `description`=?, `involvementKindID`=?, `reportKindID`=?, `locationID`=?, `personID`=?, `departmentID`=?, `dateTime`=?, `statusID`=?, `actionTaken`=?, `photoPath`=? WHERE id=?\";\n\t\t\t$sql = $db->prepareQuery($sql, $this->description, $this->involvementKindID, $this->reportKindID, $this->locationID, $this->personID, $this->departmentID, $this->dateTime, $this->statusID, $this->actionTaken, $this->photoPath, $this->id);\n\t\t\t$db->query($sql);\n\t\t}\n\t}", "public function create() {\n\t\t$statement = $this->database->prepare(\"INSERT INTO matches (team1, team2, team1_score, team2_score, venue, match_date) VALUES (?, ?, ?, ?, ?, ?)\");\n\t\t// Bind all values to the placeholders\n\t\t$statement->bindParam(1, $this->team1);\n\t\t$statement->bindParam(2, $this->team2);\n\t\t$statement->bindParam(3, $this->team1_score);\n\t\t$statement->bindParam(4, $this->team2_score);\n\t\t$statement->bindParam(5, $this->venue);\n\t\t$statement->bindParam(6, $this->match_date);\n\n\t\t// Execute the query\n\t\t$result = $statement->execute();\n\n\t\treturn $result ? true : false;\n\t}", "public function agent()\n {\n return $this->belongsTo(Agent::class, 'book_agent');\n }", "public function createOrLoadPerson($params)\n {\n $personLeague = null;\n $person = null;\n \n // Have to have a league identifier\n if (isset($params['aysoVolunteerId']))\n {\n // AYSOV12345678\n $identifier = $params['aysoVolunteerId'];\n $personLeague = $this->loadPersonLeagueForIdentifier($identifier);\n \n // No updated is the person exists\n if ($personLeague) return $personLeague->getPerson();\n \n // Make one\n $person = $this->newPerson();\n $personLeague = $person->getVolunteerAYSO();\n $person->addLeague($personLeague);\n \n $personLeague->setMemId (substr($identifier,5));\n \n $personLeague->setLeague($params['aysoRegionId']);\n \n // Always have primary person person\n $personPerson = $this->newPersonPerson();\n $personPerson->setRolePrimary();\n $personPerson->setMaster($person);\n $personPerson->setSlave ($person);\n $personPerson->setVerified('Yes');\n $person->addPerson($personPerson);\n \n // Referee badge\n if (isset($params['aysoRefereeBadge']))\n {\n $badge = $params['aysoRefereeBadge'];\n $cert = $person->getCertRefereeAYSO(); // Creates one if needed\n $person->addCert($cert);\n \n $cert->setIdentifier($identifier);\n $cert->setBadgex($badge);\n }\n }\n // Check other possible leagues\n if (!$person) return null;\n \n // Update Person\n $person->setFirstName($params['personFirstName']);\n $person->setLastName ($params['personLastName']);\n $person->setNickName ($params['personNickName']);\n $person->setEmail ($params['personEmail']);\n $person->setPhone ($params['personPhone']);\n \n if ($params['personNickName']) $name = $params['personNickName'] . ' ' . $params['personLastName'];\n else $name = $params['personFirstName'] . ' ' . $params['personLastName'];\n \n $person->setName($name);\n \n return $person;\n }", "public static function add_experience($title, $company, $location, $from_year, $to_year, $industry, $headline, $description)\n\t{\n\t\t$email = $_SESSION['email'];\n\t\t$dbhandle=DataAccessHelper::getConnection();\n\n\t\t$sql = \"select * from experience WHERE email = ? AND title = ? AND company =? AND location=? AND from_year=? AND to_year=? AND industry=? AND headline=? AND description=? ;\";\n\n\t\t$stmt = \tmysqli_stmt_init($dbhandle);\n\n\t\tif(!mysqli_stmt_prepare($stmt, $sql)){\n\n\t\t\techo \"SQL statement failed\";\n\t\t}\n\t\telse\n\t\t{\n\t\t\tmysqli_stmt_bind_param($stmt, \"sssssssss\",$email, $title, $company, $location, $from_year , $to_year, $industry, $headline, $description);\n\t\t\tmysqli_stmt_execute($stmt);\n\t\t\t$result = mysqli_stmt_get_result($stmt);\n\t\t\tif($result->num_rows > 0){\n\t\t\t\t\treturn \"Record already exists!\";\n\t\t\t}\n\t\t\telse{\n\n\t\t\t\t// mysqli_stmt_bind_param($stmt, \"sssssssss\",$email, $title, $company, $location, $from_year , $to_year, $industry, $headline, $description);\n\t\t\t\t// mysqli_stmt_execute($stmt);\n\t\t\t\t// $result = mysqli_stmt_get_result($stmt);\n\t\t\t\t// if ($result->num_rows > 0) {\n\t\t\t\t// \t\treturn \"Record alreasy exist!\";\n\t\t\t\t// }\n\t\t\t\t// else{\n\n\t\t\t\t// }\n\t\t\t\t$sql = \"INSERT INTO experience (email,title,company, location,from_year,to_year, industry, headline, description) VALUES (?, ? , ?, ?, ?, ? , ?, ?, ?)\";\n\t\t\t\t$stmt = mysqli_stmt_init($dbhandle);\n\t\t\t\tif(!mysqli_stmt_prepare($stmt, $sql)){\n\t\t\t\t\t\n\t\t\t\t\techo \"SQL error\";\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tmysqli_stmt_bind_param($stmt, \"sssssssss\",$email, $title, $company, $location, $from_year , $to_year, $industry, $headline, $description);\n\t\t\t\t\tmysqli_stmt_execute($stmt);\n\t\t\t\t\t\n\t\t\t\t\treturn \"experience added successfully\";\n\n\t\t\t\t}\n\n\n\t\t\t}\n\n\t\t// $result = mysqli_query($dbhandle,\"select * from experience WHERE email = '$email' AND title ='$title' AND company ='$company' AND location='$location' AND from_year='$from_year' AND to_year='$to_year' AND industry='$industry' AND headline='$headline' AND description='$description' ;\") or die(\"Failed to query database\".mysqli_error($dbhandle));\n\t\t//echo $result->num_rows;\n\t\t// if ($result->num_rows > 0) {\n\t\t// \treturn \"Record already exists!\";\n\t\t// }\n\t\t// else{\n\t\t// \tmysqli_query($dbhandle,\"INSERT INTO experience (email,title,company, location,from_year,to_year, industry, headline, description) VALUES ('$email', '$title' , '$company', '$location', '$from_year', '$to_year', '$industry', '$headline', '$description')\");\n\n\t\t// \treturn \"experience added successfully\";\n\t\t }\n\t}", "public function saves(Request $req)\n {\n \t$full_name=$req->input('full_name');\n \t$username=$req->input('username');\n \t$age=$req->input('age');\n \t$phone_number=$req->input('phone_number');\n \t$email=$req->input('email');\n \t$address=$req->input('address');\n \t$registered_on=$req->input('registered_on');\n \t$registered_by=$req->input('registered_by');\n\n \t$data= array('full_name' =>$full_name,'username' =>$username,'age' =>$age,'phone_number' =>$phone_number,'email' =>$email,'address' =>$address,'registered_on' =>$registered_on,'registered_by' =>$registered_by);\n\n \tDB::table('agents')->insert($data);\n \treturn redirect('/agentdisp');\n\n }", "public function update() {\n $update = \\DB::table('agents')\n ->where('id', \\Request::get('id'))\n ->update(array(\n 'name' => \\Request::get('name'),\n 'phone_no' => \\Request::get('phone_no'),\n 'region_id' => \\Request::get('region_id'),\n 'user_id' => \\Auth::user()->id,\n ));\n if ($update) {\n return redirect('/agent')\n ->with('global', '<div class=\"alert alert-success\">Agent successfullly updated</div>');\n } else {\n return redirect('/agent')\n ->with('global', '<div class=\"alert alert-warning\">Agent could not be updated</div>');\n }\n }", "public function store(Request $request)\n {\n\n $this->validate($request,[\n 'user_id' => 'required',\n 'agency_id' => 'required',\n 'areas' => 'min:1',\n 'speciality' => 'min:1',\n ]);\n\n $agent = Agent::create($request->all());\n\n // dd($request->all());\n if ($request->speciality != null) {\n foreach ($request->speciality as $speciality) {\n AgentSpeciality::create([\n 'agent_id' => $agent->id,\n 'speciality_id' => $speciality\n ]);\n }\n }\n\n foreach ($request->areas as $area) {\n AgentArea::create([\n 'agent_id' => $agent->id,\n 'area_one_id' => $area\n ]);\n }\n return redirect()->route('agents.index');\n }", "public function Persist( $freeAgent )\n {\n $this->em->getConnection()->getConfiguration()->setSQLLogger( null );\n\n $this->em->getConnection()->getConfiguration()->setSQLLogger( null );\n //get the schedule repository\n $repo = $this->em->getRepository( 'DataBundle:FreeAgent' );\n $uow = $this->em->getUnitOfWork();\n\n // Set the criteria to fetch from the db\n $criteria = array( 'playerID' => $freeAgent['PlayerID'] );\n\n //get the team from the repo\n /**\n * @var FreeAgent $currentFreeAgent\n */\n $currentFreeAgent = $repo->FindOneBy( $criteria );\n\n //todo: use a logger to write this data to file\n\n //build the FreeAgents entity\n $currentFreeAgent = $this->builder->buildFreeAgent( $currentFreeAgent, $freeAgent );\n\n\n $exists = $uow->isEntityScheduled( $currentFreeAgent );\n if ( ! $exists) {\n //persist the Entity\n $this->em->persist( $currentFreeAgent );\n $this->em->flush();\n $this->em->clear();\n }\n }", "function create($postdata) \r\n {\r\n\r\n //new PDOAgent\r\n $p = new PDOAgent(\"mysql\", DB_USER, DB_PASS, DB_HOST, DB_NAME);\r\n\r\n //Connect to the Database\r\n $p -> connect();\r\n\r\n //Setup the Bind Parameters\r\n $bindParams = [\r\n 'coachFName' => $postdata['firstName'],\r\n 'coachLName' => $postdata['lastName'],\r\n 'salary' => $postdata['salary'],\r\n 'teamName' => $postdata['team'],\r\n 'dateStarted' => $postdata['dateStarted'],\r\n 'endOfContract' => $postdata['endOfContract']];\r\n \r\n //Get the results of the insert query (rows inserted)\r\n $results = $p->query(\"INSERT INTO Coaches (coachFName, coachLName, salary, teamName, dateStarted, endOfContract)\r\n VALUES (:coachFName, :coachLName, :salary, :teamName, :dateStarted, :endOfContract )\", $bindParams);\r\n //copy the last inserted id\r\n $this->lastInsertId = $p->lastInsertId;\r\n\r\n //Disconnect from the database\r\n $p->disconnect();\r\n \r\n // IF the query \"did not work\"\r\n if ($p->rowcount != 1) {\r\n trigger_error(\"An error has occured\");\r\n die();\r\n }\r\n else\r\n { \r\n header('Location: DoesntMatter.php?entity=coaches&message=Coach created succesfully');\r\n }\r\n \r\n }", "function makeResource($rType, $details, $identifier, $department){\n sqlQuery(\"INSERT INTO resources (resource_type, resource_details, resource_identifier, resource_department) VALUES ('$rType','$details','$identifier','$department')\");\n alog(\"Added resource $identifier\");\n}", "private function createRecord($entityName, array $data) {\n $response = $this->callRaynetcrmRestApi($entityName, self::HTTP_METHOD_PUT, $data);\n $body = Json::decode($response->getBody());\n\n if ($response->getStatusCode() === self::HTTP_CODE_CREATED) {\n return $body->data->id;\n } else {\n throw new RaynetGenericException(\n $body->translatedMessage ? $body->translatedMessage : $body->message,\n $response->getStatusCode()\n );\n }\n }", "private function create()\n\t{\n\t\ttry\n\t\t{\n\t\t\t$q_string = \"insert into sandbox.dbo.daemon (object, dbtype) values (:object, :dbtype)\";\n\n\t\t\t$q = $this->_conn->prepare($q_string);\n\t\t\t$q->bindParam(':object', $this->_object);\n\t\t\t$q->bindParam(':dbtype', $this->_dbtype);\n\n\t\t\t$success = $q->execute();\n\t\t}\n\t\tcatch (PDOException $e)\n\t\t{\n\t\t\techo 'ERROR: ', $e->getMessage(), $this->_nl;\n\t\t\texit();\n\t\t}\n\n\t\t// unable to insert new entry\n\t\tif ($success !== true)\n\t\t{\n\t\t\techo \"ERROR: unable to create new lock entry for $this->_dbtype $this->_object.\", $this->_nl, $this->_nl;\n\t\t\texit();\n\t\t}\n\t}", "public function actionCreate() {\n $this->actionUpdate();\n }", "function findAgency($p_iva){\n global $dbH;\n $dbH->setTable(\"agencies\");\n\n $res = $dbH->read(\"p_iva = ?\",\" limit 1 \",array($p_iva) ,\"id\",$printQuery = false);\n if(Count($res)>0)\n return $res[0][\"id\"];\n else\n return 1;\n}", "function create($entity);", "function dbase_add_record($dbase_identifier, $record)\n{\n}", "public function create()\n {\n $lga = Lga::all()->pluck('name', 'id');\n return view('agents.create')->with(compact('lga'));\n }", "public function store(AgencyRequest $request)\n {\n $province_name = Province::find($request->province_id)->name;\n $district_name = District::find($request->district_id)->name;\n $ward_name = Ward::find($request->ward_id)->name;\n $mapResults = GoogleMapsHelper::lookUpInfoFromAddress($province_name . ' ' . $district_name . ' ' . $ward_name . ' ' . $request->home_number);\n if (isset($mapResults->geometry)) {\n $location = isset($mapResults->geometry->location) ? $mapResults->geometry->location : null;\n }\n DB::beginTransaction();\n try {\n $data = new Agency();\n $data->name = $request->name;\n $data->discount = $request->discount;\n $data->phone = $request->phone;\n $data->address = $request->home_number . ', ' . $ward_name . ', ' . $district_name . ', ' . $province_name;\n $data->province_id = $request->province_id;\n $data->district_id = $request->district_id;\n $data->ward_id = $request->ward_id;\n $data->home_number = $request->home_number;\n if ($location != null) {\n $data->lat = $location->lat;\n $data->lng = $location->lng;\n }\n $data->created_at = Carbon::now();\n $data->updated_at = Carbon::now();\n $data->save();\n foreach ($request->collaborator as $col) {\n Collaborator::insert([\n 'user_id' => $col,\n 'agency_id' => $data->id,\n 'created_at' => Carbon::now(),\n 'updated_at' => Carbon::now(),\n ]);\n }\n\n foreach ($request->scope as $s) {\n ManagementScope::insert([\n 'agency_id' => $data->id,\n 'district_id' => $s\n ]);\n }\n if ($request->ward_scope == null) {\n $ward_check = Ward::whereIn('districtId', $request->scope)->orderBy('name', 'asc')->pluck('id');\n $exist_ward = ManagementWardScope::whereIn('ward_id', $ward_check)->pluck('ward_id');\n $ward = Ward::whereIn('districtId', $request->scope)->whereNotIn('id', $exist_ward)->pluck('id');\n foreach ($ward as $w) {\n ManagementWardScope::insert([\n 'agency_id' => $data->id,\n 'ward_id' => $w\n ]);\n }\n } else {\n foreach ($request->ward_scope as $ws) {\n ManagementWardScope::insert([\n 'agency_id' => $data->id,\n 'ward_id' => $ws\n ]);\n }\n }\n DB::commit();\n } catch (\\Exception $e) {\n DB::rollBack();\n dd($e);\n }\n return redirect(url('admin/agencies'))->with('success', 'Thêm mới đại lý thành công');\n }", "public function agtGetter()\n{\nif(isset($_REQUEST)){\n\n$AgtFirstName=$_REQUEST['AgtFirstName'];\n$AgtMiddleInitial=$_REQUEST['AgtMiddleInitial'];\n$AgtLastName=$_REQUEST['AgtLastName'];\n$AgtBusPhone=$_REQUEST['AgtBusPhone'];\n$AgtEmail=$_REQUEST['AgtEmail'];\n$AgtPosition=$_REQUEST['AgtPosition'];\n\nif($_REQUEST['AgencyId']===\"Calgary\"){\n$AgencyId=\"1\";\n\n\n }\nif($_REQUEST['AgencyId']===\"Okotoks\"){\n$AgencyId=\"2\";\n\n\n }\n\n }\n//connect to database and insert data into agents table\n$mysqli=new mysqli(\"localhost\",\"root\",\"\",\"travelexperts\");\nif($mysqli->connect_error)\n{\n echo(\"Connect failed: \".mysqli_connect_error()); \n exit();\n\n}\n\n$stmt = $mysqli->prepare(\"INSERT INTO agents(AgtFirstName,AgtMiddleInitial,AgtLastName,AgtBusPhone,AgtEmail,AgtPosition,AgencyId) \n\t\tVALUES (?, ?, ?,?,?,?,?)\");\n $stmt->bind_param('sssssss',$AgtFirstName, $AgtMiddleInitial, $AgtLastName,$AgtBusPhone,$AgtEmail,$AgtBusPhone,$AgencyId);\nif($stmt->execute()){\necho \"Agent Created Successfully\";\nprint(\"<br><a href=index.php>Home</a>\");\n\t\t\t\t\t}\n$stmt->close();\n\n\n\n}", "public function storeNewEmployee()\n {\n $values = DatabaseHelpers::dbAddAudit(request()->all());\n $values['gender'] = Person::getGender($values['gender']);\n $values['title'] = Person::getTitle($values['title']);\n $person = Person::create($values);\n\n $employee_values['person_id'] = $person->id;\n $employee_values['employee_status_id'] = $values['employee_status_id'];\n $employee_values['employee_classification_id'] = $values['employee_classification_id'];\n $employee_values['start_date'] = $values['start_date'];\n $employee_values['end_date'] = $values['end_date'];\n\n $values = DatabaseHelpers::dbAddAudit($employee_values);\n $employee = Employee::create($values);\n\n ViewHelpers::flash($employee, 'employee');\n\n if ($employee) {\n $employee->searchable();\n\n return redirect()->to('employee/'.$employee->uuid.'/profile');\n }\n\n return redirect()->back()->withInput();\n }", "protected function create()\n\t{\n\t\tif ($this->load_active()) return false;\n\t\t\n\t\t\\Kofradia\\DB::get()->exec(\"\n\t\t\tINSERT INTO up_achievements\n\t\t\tSET upa_ac_id = {$this->a->id}, upa_time = \".time().\", upa_up_id = {$this->up->id}, upa_complete = 0\");\n\t\t\n\t\t$this->up->achievements->load_cache(true);\n\t\treturn $this->load_active();\n\t}", "public static function create($params) {\n $rows = DB::query('INSERT INTO Department (name, abbreviation) '\n . 'VALUES (:name, :abbreviation) RETURNING id',\n array('name' => StringUtil::trim(($params['name'])), \n 'abbreviation' => $params['abbreviation']));\n \n $last_id = $rows[0];\n return $last_id['id'];\n }", "function add($record)\n {\n $data = get_object_vars($record);\n $this->rest->initialize(array('server' => REST_SERVER));\n $this->rest->option(CURLOPT_PORT, REST_PORT);\n $retrieved = $this->rest->post('recipe/maintenance/item/id/' . $record->menu_id.'-'.$record->inventory_id, $data);\n }", "protected function create()\n {\n $database = cbSQLConnect::connect('object');\n if (isset($database))\n {\n $fields = self::$db_fields;\n $data = array();\n foreach($fields as $key)\n {\n if ($this->{$key})\n {\n $data[$key] = $this->{$key};\n }\n else\n $data[$key] = NULL;\n\n }\n // return data\n $insert = $database->SQLInsert($data, \"place\"); // return true if sucess or false\n if ($insert)\n {\n return $insert;\n }\n else\n {\n return false;\n }\n }\n }", "public function store_agent(Request $request)\n {\n $validatedData = $request->validate([\n 'fullname' => ['required', 'max:50'],\n 'username' => ['required', 'max:50'],\n 'phone_number' => ['required', 'max:20'],\n 'email' => ['required', 'unique:users'],\n 'state' => ['required', 'exists:states,id'],\n 'area' => ['required', 'exists:areas,id'],\n 'account_type' => ['required', 'max:100'],\n 'image' => ['required', 'mimes:jpeg,jpg,png'],\n 'cv' => ['required', 'mimes:doc,docx,pdf'],\n 'password' => ['required', 'confirmed'],\n ]);\n\n \n $fullname = $request->fullname;\n $username = $request->username;\n $phone_number = $request->phone_number;\n $email = $request->email;\n $state_id = $request->state;\n $area_id = $request->area;\n $account_type = $request->account_type;\n $password = $request->password;\n \n \n $agent = new User();\n $agent->fullname = $fullname;\n $agent->username = $username;\n $agent->phone_number = $phone_number;\n $agent->email = $email;\n $agent->email_verified_at = now();\n $agent->role = 'agent';\n $agent->password = Hash::make($password);\n \n if($agent->save()) {\n\n // save agent address\n $agent->addresses()->create([\n 'state_id' => $state_id,\n 'area_id' => $area_id,\n 'account_type' => $account_type\n ]);\n \n // upload cv and save agent details\n if ($request->hasFile('cv')) { // check if file is available for upload\n $path = $request->cv->store('public/uploads/agents/docs/cvs');\n if($path) {\n $cv_name = basename($path);\n $agent->agent_detail()->create(['cv_name' => $cv_name]);\n }\n }\n\n //upload profile image\n $image = $request->image;\n if ($request->hasFile('image')) { // check if file is available for upload\n \n $image = $request->image;\n $image_name = $request->image->getClientOriginalName();\n $image_extension = $image->extension();\n $gen_image_name = md5(now() . 'logo_name' . $image_name);\n $new_image_name = $gen_image_name . '.' . $image_extension;\n $fited_image = Image::make($image ->getRealPath())->fit(300, 300);\n $save_image = $fited_image->save('storage/uploads/agents/images/profile_photos/' . $new_image_name, 60); //save image to server\n\n if($save_image) {\n $agent->images()->create(['name' => $new_image_name]);\n }\n }\n \n return redirect()->back()->with([\n 'message' => 'New Agent has been saved.',\n 'type' => 'success'\n ]);\n\n }\n\n return redirect()->back()->with([\n 'message' => 'Agent was not save, there was an error while try to save it',\n 'type' => 'fail'\n ]);\n }", "public function insert(){\n // Access-controlled resource\n if (!$this->_app->user->checkAccess('uri_drone_insert')){\n $this->_app->notFound();\n }\n // do something here\n }", "public function testExistentRecord()\n {\n try {\n DAL::beginTransaction();\n $assetidOne = 123;\n $typeid = 'asset';\n $sql = $this->_getInsertQuery($assetidOne, $typeid).';';\n\n $assetidTwo = 124;\n $typeid = 'asset';\n $sql .= $this->_getInsertQuery($assetidTwo, $typeid);\n\n $expected = 'asset';\n DAL::executeQueries($sql);\n\n $type = TestDALSys1::dalTestExecuteOne($assetidOne);\n PHPUnit_Framework_Assert::assertEquals($expected, $type);\n\n $type = TestDALSys1::dalTestExecuteOne($assetidTwo);\n PHPUnit_Framework_Assert::assertEquals($expected, $type);\n DAL::rollBack();\n\n } catch (PDOException $e) {\n DAL::rollBack();\n PHPUnit_Framework_Assert::fail($e->getMessage().$e->getTraceAsString());\n } catch (ChannelException $e) {\n DAL::rollBack();\n PHPUnit_Framework_Assert::fail($e->getMessage().$e->getTraceAsString());\n }\n\n }", "public function store(Request $request)\n {\n $data = $request->only('aid','uid');\n $data['created_at'] = date('Y-m-d H:i:s',time());\n $res1 = Acollect::where('aid',$data['aid'])->where('uid',$data['uid'])->first();\n if ($res1) {\n echo 3;\n exit;\n }\n\n $res = Acollect::insert($data);\n if ($res) {\n echo 1;\n }else{\n echo 2;\n }\n\n }", "public function store(Request $request)\n {\n $role = Role::where('label', 'vendedor')->first();\n $vendedor = User::where('role_id', $role->id)->orderBy('updated_at', 'asc')->first();\n\n if ($vendedor) {\n $target = Client::create($request->all());\n $target->fill([\n 'tipo' => 'Target Ativo',\n 'estagio' => 'aguardando',\n 'user_id' => $vendedor->id\n ]);\n $target->save();\n $vendedor->updated_at = time();\n $vendedor->save();\n $record = Record::create([\n 'descricao' => 'Target cadastrado com sucesso',\n 'client_id' => $target->id,\n 'user_id' => Auth::user()->id\n ]);\n } else {\n session()->flash('message', 'Não existe vendedor para vincular o alvo');;\n }\n\n return redirect()->route('target.index');\n }", "public function store()\n\t{\n\t\t$validator = Validator::make($data = Input::all(), Agency::$rules);\n\n\t\tif ($validator->fails())\n\t\t{\n\t\t\treturn Redirect::back()->withErrors($validator)->withInput();\n\t\t}\n\n\t\tagency::create($data);\n\n\t\treturn Redirect::route('agencies.index');\n\t}", "public function run()\n {\n \tDB::table('agents')->delete();\n\n $agents = array(\n \t['information' => json_encode(['full_name' => 'Piri Piri Warrior', 'email_address' => '[email protected]', 'address' => 'C-City', 'birthday' => '03-27-1988', 'contact_no' => '99933300']), 'created_at' => new DateTime],\n \t['information' => json_encode(['full_name' => 'Super Alloy Darkshine', 'email_address' => '[email protected]', 'address' => 'A-City', 'birthday' => '03-27-1988', 'contact_no' => '99933300']), 'created_at' => new DateTime],\n \t['information' => json_encode(['full_name' => 'Metal Knight', 'email_address' => '[email protected]', 'address' => 'H-City', 'birthday' => '03-27-1988', 'contact_no' => '99933300']), 'created_at' => new DateTime],\n \t['information' => json_encode(['full_name' => 'Light Speed Slash', 'email_address' => '[email protected]', 'address' => 'A-City', 'birthday' => '03-27-1988', 'contact_no' => '99933300']), 'created_at' => new DateTime]\n );\n\n // Uncomment the below to run the seeder\n DB::table('agents')->insert($agents);\n }", "public function edit(agent $agent)\n {\n //\n }", "public function updateAgent() {\r\n $pwd = parent::getPassword();\r\n $sqlQuery = \"UPDATE users SET \"\r\n . \"fname='\" . parent::getFirstname() . \"', \"\r\n . \"lname='\" . parent::getLastname() . \"', \"\r\n . \"image_name='\" . parent::getPictureName() .\"', \"\r\n . \"email='\" . parent::getEmail() . \"', \"\r\n . \"enable=\" . $this->enabled . \", \"\r\n . \"address1='\" . parent::getAddress1() . \"', \"\r\n . \"address2='\" . parent::getAddress2() . \"', \"\r\n . \"zipcode='\" . parent::getZipcode() . \"', \"\r\n . \"phone='\" . parent::getPhone() . \"', \"\r\n . \"city='\" . parent::getCity() . \"', \"\r\n . \"state='\" . parent::getState() . \"', \"\r\n . \"country='\" . parent::getCountry() . \"', \";\r\n // add a comment of what the below line does\r\n // - @vishal\r\n if(!empty($pwd))\r\n $sqlQuery .= \"password='\" . hash(\"sha256\", parent::getPassword()) . \"', \";\r\n \r\n $sqlQuery .= \"modification_date=NOW()\" \r\n . \" WHERE user_id = \" . parent::getID() . \";\";\r\n $result = $this->dbcomm->executeQuery($sqlQuery);\r\n \r\n if ($result != true)\r\n {\r\n echo \"<br><b>\" . $sqlQuery . \"</b>\";\r\n echo \"<br><b>\" . $this->dbcomm->giveError() . \"</b>\";\r\n die(\"Error at agent saving\");\r\n }\r\n else\r\n {\r\n return 1;\r\n }\r\n }", "protected function createNew() {\n $this->db->insert($this->tableName, $this->mapToDatabase());\n $this->id = $this->db->insert_id();\n }", "public function run() {\n\t\t$toolbox = R::$toolbox;\n\t\t$adapter = $toolbox->getDatabaseAdapter();\n\t\t$writer = $toolbox->getWriter();\n\t\t$redbean = $toolbox->getRedBean();\n\t\t$pdo = $adapter->getDatabase();\n\t\t$a = new RedBean_AssociationManager( $toolbox );\n\t\t$post = $redbean->dispense('post');\n\t\t$post->title = 'title';\n\t\t$redbean->store($post);\n\t\t$page = $redbean->dispense('page');\n\t\t$page->name = 'title';\n\t\t$redbean->store($page);\t\t\n\t\t$page = $redbean->dispense(\"page\");\n\t\t$page->name = \"John's page\";\n\t\t$idpage = $redbean->store($page);\n\t\t$page2 = $redbean->dispense(\"page\");\n\t\t$page2->name = \"John's second page\";\n\t\t$idpage2 = $redbean->store($page2);\n\t\t$a->associate($page, $page2);\n\t\t$redbean->freeze( true );\n\t\t$page = $redbean->dispense(\"page\");\n\t\t$page->sections = 10;\n\t\t$page->name = \"half a page\";\n\t\ttry {\n\t\t\t$id = $redbean->store($page);\n\t\t\tfail();\n\t\t}catch(RedBean_Exception_SQL $e) {\n\t\t\tpass();\n\t\t}\n\t\t$post = $redbean->dispense(\"post\");\n\t\t$post->title = \"existing table\";\n\t\ttry {\n\t\t\t$id = $redbean->store($post);\n\t\t\tpass();\n\t\t}catch(RedBean_Exception_SQL $e) {\n\t\t\tfail();\n\t\t}\n\t\tasrt(in_array(\"name\",array_keys($writer->getColumns(\"page\"))),true);\n\t\tasrt(in_array(\"sections\",array_keys($writer->getColumns(\"page\"))),false);\n\t\t$newtype = $redbean->dispense(\"newtype\");\n\t\t$newtype->property=1;\n\t\ttry {\n\t\t\t$id = $redbean->store($newtype);\n\t\t\tfail();\n\t\t}catch(RedBean_Exception_SQL $e) {\n\t\t\tpass();\n\t\t}\n\t\t$logger = RedBean_Plugin_QueryLogger::getInstanceAndAttach( $adapter );\n\t\t//now log and make sure no 'describe SQL' happens\n\t\t$page = $redbean->dispense(\"page\");\n\t\t$page->name = \"just another page that has been frozen...\";\n\t\t$id = $redbean->store($page);\n\t\t$page = $redbean->load(\"page\", $id);\n\t\t$page->name = \"just a frozen page...\";\n\t\t$redbean->store($page);\n\t\t$page2 = $redbean->dispense(\"page\");\n\t\t$page2->name = \"an associated frozen page\";\n\t\t$a->associate($page, $page2);\n\t\t$a->related($page, \"page\");\n\t\t$a->unassociate($page, $page2);\n\t\t$a->clearRelations($page,\"page\");\n\t\t$items = $redbean->find(\"page\",array(),array(\"1\"));\n\t\t$redbean->trash($page);\n\t\t$redbean->freeze( false );\n\t\tasrt(count($logger->grep(\"SELECT\"))>0,true);\n\t\tasrt(count($logger->grep(\"describe\"))<1,true);\n\t\tasrt(is_array($logger->getLogs()),true);\n\t}", "public function test_getByRecordId_exists_executesCorrectly()\r\n\t{\r\n\t\t$recordId = \"aDummyRecordId\";\r\n\t\t\r\n\t\t$this->prepareSetRecordId($recordId);\r\n\t\t$this->prepareFind(true);\r\n\t\r\n\t\t$actual = $this->service->getByRecordId($recordId);\r\n\t\t$this->assertEquals($this->dbObjectMock, $actual);\r\n\t}", "public function agent($id)\n {\n $delivery = Delivery::find($id);\n \n if($delivery) {\n $agent = $delivery->agent;\n return !$agent? Response::json(\"Error\", 400) : $agent;\n }\n\n return Response::json(\"Error\", 400);\n }", "public function create()\n\t{\n\t\t// $roles = Role::get();\n\t}", "public function run()\n {\n DB::table('sub_agents')->insert([\n 'name' => 'subagent',\n 'agent_id'=>'1',\n 'township'=>'Yangon',\n 'region'=>'Botataung',\n 'phno'=>'0978215423',\n 'address'=>'No(70),Barbaryaryar Road',\n 'email' => '[email protected]',\n 'password' => Hash::make('password'),\n 'created_at'=>Carbon::now(),\n ]);\n }", "public function save()\n\t{\n\t\t$data = ['criteria' => $this -> criteria,\n\t\t\t\t 'dbname' => $this -> dbname,\n\t\t\t\t 'tblname' => $this -> tblname];\n\n\t\t$result = $this -> connection -> setTable($this -> entity)\r\n\t\t\t\t\t\t\t\t\t -> saveRec($data);\n\t\tif ($result) {\n\t\t\t$this -> id = $result;\n\t\t\treturn $this;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}", "public function create($row)\n\t{\n\t\t$this->db->insert('tournaments', $row);\n\t\treturn $this->db->insert_id();\n\t}", "#[CustomOpenApi\\Operation(id: 'leadStore', tags: [Tags::Lead, Tags::V1])]\n #[OpenApi\\Parameters(factory: DefaultHeaderParameters::class)]\n #[CustomOpenApi\\RequestBody(request: CreateLeadRequest::class)]\n #[CustomOpenApi\\Response(resource: LeadWithLatestActivityResource::class, statusCode: 201)]\n #[CustomOpenApi\\ErrorResponse(exception: SalesOnlyActionException::class)]\n public function store(CreateLeadRequest $request): LeadWithLatestActivityResource\n {\n if (!tenancy()->getUser()->is_sales) throw new SalesOnlyActionException();\n\n $data = array_merge($request->validated(), [\n 'channel_id' => tenancy()->getActiveTenant()->id,\n 'user_id' => tenancy()->getUser()->id,\n 'status' => LeadStatus::GREEN()\n ]);\n\n $lead = Lead::create($data);\n $lead->queueStatusChange();\n $lead->refresh()->loadMissing(self::load_relation);\n\n return $this->show($lead);\n }", "public function actionCreate()\n\t{\n $this->actionUpdate();\n\t}", "public function run()\n {\n DB::table('Agents')->insert([\n 'first_name' => 'Ivan',\n 'last_name' => 'Petrov',\n 'company' => 'Royal',\n ]);\n DB::table('Agents')->insert([\n 'first_name' => 'Kaloyan',\n 'last_name' => 'Rachev',\n 'company' => 'Racheff',\n ]);\n DB::table('Agents')->insert([\n 'first_name' => 'Stoyan',\n 'last_name' => 'Mihaylovski',\n 'company' => 'Journeys',\n ]);\n DB::table('Agents')->insert([\n 'first_name' => 'Petya',\n 'last_name' => 'Hristova',\n 'company' => 'Best Holidays',\n ]);\n\n }", "public function record()\n {\n SearchDomainManager::recordDomainConfig($this);\n $dbDomain = new SearchDomainDatabase($this->name);\n $dbDomain->initialize();\n }", "public function run()\n {\n $check = Company::first();\n if(!$check){\n $data = new Company;\n $data->fullname = 'Jesus Care Prayer Ministry';\n $data->shortname = 'Jesus Care';\n $data->save();\n }\n }", "public function create()\n {\n $agents = Agent::all();\n $positions = Position::all();\n $agencies = Agency::all();\n $users = User::all();\n $speciality = Speciality::all();\n $areas = AreaOne::all();\n return view('admin.agent.create', compact(['agents', 'positions', 'agencies', 'users', 'speciality', 'areas']));\n }", "public function testRefuseCreation()\n {\n $newActor = new \\eddie\\Models\\Actor();\n $newActor->save();\n }", "public function findById($experience_id);", "public function create_record() {\n $class = get_called_class();\n\n if ($this->does_exist()) {\n return false;\n }\n\n $db = DB::connect();\n\n $attributes = '';\n $values = '';\n\n // Loop through all the attributes to get the attributes and values\n foreach (get_object_vars($this) as $key => $value) {\n // We dont add the id of the object, as it is autoincremented\n if ($value == null) {\n continue;\n }\n\n $attributes = $attributes . \" $key,\";\n\n // We cannot add an object to sql statemnt. if the value is an object, get the id of it\n if (gettype($value) == 'object') {\n $value = $value->id;\n } elseif (gettype($value) === 'string') {\n $value = \"'\" . $value . \"'\";\n }\n\n $values = $values . \" $value,\";\n\n }\n\n // Delete the last comma\n $attributes = substr_replace($attributes, \" \", -1);\n $values = substr_replace($values, \" \", -1);\n\n $sql = $db->prepare(\"INSERT INTO \" . $class . \" (\" . $attributes . \") VALUES (\" . $values . \")\");\n $sql->execute();\n\n return true;\n }", "public function create()\n {\n return view('Admin.agents.create');\n }", "function _create($entity)\n {\n $retval = FALSE;\n $id = $this->object->_wpdb()->insert($this->object->get_table_name(), $this->object->_convert_to_table_data($entity));\n if ($id) {\n $key = $this->object->get_primary_key_column();\n $retval = $entity->{$key} = intval($this->object->_wpdb()->insert_id);\n }\n return $retval;\n }", "function allow_assign($sroleid, $troleid) {\n $record = new object;\n $record->roleid = $sroleid;\n $record->allowassign = $troleid;\n return insert_record('role_allow_assign', $record);\n}", "public function Create($params = array()) \n { \n $this->Update($params); \n }", "public function Create($params = array()) \n { \n $this->Update($params); \n }", "public function store()\n {\n $input = Request::onlyLegacy('stage');\n\n $validator = Validator::make($input, ['stage' => 'required']);\n if ($validator->fails()) {\n return ApiResponse::validation($validator);\n }\n DB::beginTransaction();\n try {\n /* inactive current stage */\n $this->inActiveCurrentStage();\n\n $newStage = $this->model->create([\n 'company_id' => $this->scope->id(),\n 'stage' => $input['stage'],\n 'active' => 1,\n ]);\n\n DB::commit();\n } catch (\\Exception $e) {\n DB::rollback();\n\n return ApiResponse::errorInternal(trans('response.error.internal'), $e);\n }\n\n return ApiResponse::success([\n 'message' => trans('response.success.saved', [\n 'attribute' => 'Job Awarded Stage'\n ]),\n 'data' => $newStage,\n ]);\n }", "public function createLeadOther(Request $request)\n {\n $role = Auth::user()->roleDetail('abbreviation');\n if ($role['abbreviation'] == 'EM' || $role['abbreviation'] == 'CO' || $role['abbreviation'] == 'AG' || $role['abbreviation'] == 'RP' || $role['abbreviation'] == 'SV') {\n $employee_id = new ObjectID(Auth::id());\n $LeadDetails = LeadDetails::where('active', 1)->where('employeeTabStatus', (int) 1)->whereNotNull('transferTo')->where(function ($q) use ($employee_id) {\n $q->where('transferTo', 'elemMatch', array('id' => $employee_id, 'status' => 'Transferred'))->orwhere('transferTo', 'elemMatch', array('id' => $employee_id, 'status' => 'Collected'));\n })->get();\n if (count($LeadDetails) >= 20) {\n return response()->json([\n 'success' => false,\n 'save_method' => '',\n 'next_location' => ''\n ]);\n }\n }\n $save_from = $request->input('save_from');\n $reference_number = $request->input('reference_number');\n $dispatch_type = $request->input('dispatch_type');\n\n $leadDetails = new LeadDetails();\n $pipelineItem = WorkTypeData::where('refereneceNumber', $reference_number)->first();\n $customer_name = $pipelineItem['customer']['name'];\n $customer_id = $pipelineItem['customer']['id'];\n $customerCode = $pipelineItem['customer']['customerCode'];\n\n $customer_object = new \\stdClass();\n $customer_object->id = new ObjectID($customer_id);\n $customer_object->name = $customer_name;\n $customer_object->recipientName = $customer_name;\n $customer_object->customerCode = $customerCode;\n $leadDetails->customer = $customer_object;\n $leadDetails->saveType = 'customer';\n\n\n $agentId = $pipelineItem['agent']['id'];\n $agent = User::find($agentId);\n $agentObject = new \\stdClass();\n $agentObject->id = new ObjectID($request->input('agent'));\n $agentObject->name = $agent->name;\n $leadDetails->agent = $agentObject;\n\n $casemanagerId = $pipelineItem['caseManager']['id'];\n $caseManager = User::find($casemanagerId);\n $caseManagerObject = new \\stdClass();\n $caseManagerObject->id = new ObjectID($request->input('caseManager'));\n $caseManagerObject->name = $caseManager->name;\n $leadDetails->caseManager = $caseManagerObject;\n\n $dispatchType = DispatchTypes::where('type', $dispatch_type)->first();\n $dispatchTypeObject = new \\stdClass();\n $dispatchTypeObject->id = new ObjectID($dispatchType->_id);\n $dispatchTypeObject->dispatchType = $dispatchType->type;\n $dispatchTypeObject->code = $dispatchType->code;\n $leadDetails->dispatchType = $dispatchTypeObject;\n $leadDetails->active = (int) 1;\n $customer = Customer::find($customer_id);\n $leadDetails->contactEmail = $customer->email[0];\n $leadDetails->contactNumber = $customer->contactNumber[0];\n\n\n $Date = date('d/m/y');\n $splted_date = explode('/', $Date);\n $currentdate = implode($splted_date);\n date_default_timezone_set('Asia/Dubai');\n $time = date('His');\n $count = LeadDetails::where('referenceNumber', 'like', '%' . $currentdate . '%')->count();\n $newCount = $count + 1;\n if ($newCount < 10) {\n $newCount = '0' . $newCount;\n }\n $refNumber = $dispatchTypeObject->code . \"/\" . $currentdate . \"/\" . $time . \"/\" . $newCount;\n $leadDetails->referenceNumber = (string) $refNumber;\n\n $createdBy_obj = new \\stdClass();\n $createdBy_obj->id = new ObjectID(Auth::id());\n $createdBy_obj->name = Auth::user()->name;\n $createdBy_obj->date = date('d/m/Y');\n $createdBy_obj->action = \"Lead Created\";\n $createdBy[] = $createdBy_obj;\n $leadDetails->createdBy = $createdBy;\n\n $leadDetails->other_id = new ObjectID($pipelineItem->_id);\n $leadDetails->saveFrom = $save_from;\n if ($dispatchType->type == 'Direct Collections' || $dispatchType->type == 'Direct Delivery') {\n $leadDetails->dispatchStatus = 'Reception';\n $next_location = 'go_reception';\n } else {\n $leadDetails->dispatchStatus = 'Lead';\n $next_location = 'go_lead';\n }\n $leadDetails->save();\n if ($next_location == 'go_lead') {\n $this->saveTabStatus($leadDetails->_id);\n } else {\n if ($next_location == 'go_reception') {\n $this->saveDirectTabStatus($leadDetails->_id);\n }\n }\n Session::flash('status', 'Lead created successfully');\n\n return response()->json([\n 'success' => true,\n 'save_method' => $save_from,\n 'next_location' => $next_location\n ]);\n }", "public function create() {\n $regions = \\App\\Region::all();\n return view('agent.add-agent', array('regions' => $regions));\n }", "protected function performInsert()\n {\n $attributes = $this->getAttributes();\n $updatedField = $this->getApi()->{'create'.ucfirst($this->getEntity())}($attributes);\n $this->fill($updatedField);\n $this->exists = true;\n $this->wasRecentlyCreated = true;\n\n return true;\n }", "public function create() {\n abort(404);\n }", "function addActiveGuest($ip, $time){\r\n if(!TRACK_VISITORS) return;\r\n $sql = $this->connection->prepare(\"REPLACE INTO \".TBL_ACTIVE_GUESTS.\" VALUES ('$ip', '$time')\");\r\n $sql->execute();\r\n $this->calcNumActiveGuests();\r\n }", "public function actionCreate()\n {\n $model = new AdvertiserApi();\n\n if ($model->load(Yii::$app->request->post())) {\n // && $model->save()\n $advertiser = Advertiser::getOneByUsername($model->adv_id);\n if (!empty($advertiser)) {\n $model->adv_id = $advertiser->id;\n if ($model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n }\n }\n }\n return $this->render('create', [\n 'model' => $model,\n ]);\n }", "function listOne($coachId)\r\n {\r\n //new PDOAgent\r\n $p = new PDOAgent(\"mysql\", DB_USER, DB_PASS, DB_HOST, DB_NAME);\r\n\r\n //Connect to the Database\r\n $p->connect();\r\n\r\n //Setup the Bind Parameters\r\n $bindParams = ['coachId' => $coachId];\r\n\r\n //Get the results of the insert query (rows inserted)\r\n $results = $p->query(\"SELECT * FROM Coaches WHERE coachId = :coachId;\", $bindParams);\r\n\r\n //Disconnect from the database\r\n $p->disconnect();\r\n \r\n //Return the objects\r\n return $results;\r\n }", "protected function addAnnouncementToDb()\n {\n $db = Db::getConnection();\n $db->query(\"INSERT INTO sale (id, id_user, is_banned, street, total_area, living_area, kitchen_area, balcony, description, price, type_house, floor, count_floor, rooms_count, ownership) VALUES (NULL, '$this->userId', NULL, '$this->street', '$this->totalArea', '$this->livingArea', '$this->kitchenArea', '$this->balcony', '$this->description', '$this->price', '$this->typeHouse', '$this->floor', '$this->countOfFloors', '$this->roomsCount', '$this->ownership');\");\n return $db->lastInsertId();\n }", "function haveInDatabase($table, array $record)\n{\n $id = DB::table($table)->insertGetId($record);\n return DB::table($table)->find($id);\n}", "public function store(CreateRequest $request)\n {\n $actor = Actor::create([\n 'name' => $request->input('data.attributes.name')\n ]);\n\n return (new ActorResource($actor))\n ->response()\n ->header(\n 'Location', route('actors.show', ['actor' => $actor])\n );\n }", "private function _recordVisit() {\n $txnTable = $this->settings['txnTable'];\n $dtlTable = $this->settings['dtlTable'];\n $isRES = BoolYN( $this->_isResource() );\n $rVal = false;\n\n // Construct the INSERT Statement and Record It\n $dsvID = \"CONCAT(DATE_FORMAT(Now(), '%Y-%m-%d %h:00:00'), '-', \" . \n nullInt($this->settings['SiteID']) . \", '-', \" . \n \"'\" . sqlScrub($this->settings['RequestURL']) . \"')\";\n $sqlStr = \"INSERT INTO `$txnTable` (`dsvID`, `DateStamp`, `SiteID`, `VisitURL`, `Hits`, `isResource`, `UpdateDTS`) \" .\n \"VALUES ( MD5($dsvID), DATE_FORMAT(Now(), '%Y-%m-%d %h:00:00'), \" . nullInt($this->settings['SiteID']) . \",\" .\n \" '\" . sqlScrub($this->settings['RequestURL']) . \"',\" .\n \" 1, '$isRES', Now() )\" .\n \"ON DUPLICATE KEY UPDATE `Hits` = `Hits` + 1,\" .\n \" `UpdateDTS` = Now();\" .\n \"INSERT INTO `$dtlTable` (`SiteID`, `DateStamp`, `VisitURL`, `ReferURL`, `SearchQuery`, `isResource`, `isSearch`, `UpdateDTS`) \" .\n \"VALUES ( \" . nullInt($this->settings['SiteID']) . \", DATE_FORMAT(Now(), '%Y-%m-%d %h:00:00'),\" . \n \" '\" . sqlScrub($this->settings['RequestURL']) . \"',\" .\n \" '\" . sqlScrub($this->settings['Referrer']) . \"',\" .\n \" '', '$isRES', 'N', Now() );\";\n $rslt = doSQLExecute( $sqlStr );\n if ( $rslt > 0 ) { $rVal = true; }\n\n // Return the Boolean Response\n return $rVal;\n }", "function create_or_update_flight_info($flight, $i){\n require \"database/dbinfo.php\";\n global $connection;\n $sql = \"SELECT fi.$db_flight_info_id AS 'id' FROM $db_flight_info_tab fi INNER JOIN $db_airports_tab aa ON fi.$db_flight_info_arrivalid = aa.$db_airports_id INNER JOIN $db_airports_tab ad ON fi.$db_flight_info_departureid = ad.$db_airports_id WHERE ad.$db_airports_IATA = ? AND aa.$db_airports_IATA = ? AND fi.$db_flight_info_tripid = ? LIMIT 1 \";\n $stmt = $connection->prepare($sql);\n $stmt->bind_param(\"ssi\", $flight[0], $flight[1], $_SESSION[\"trip_id\"]);\n $stmt->execute();\n $dataSet = $stmt->get_result();\n if ($dataSet->num_rows > 0){\n $data = $dataSet->fetch_array(MYSQLI_ASSOC);\n $stmt->close();\n $flight_info_object = new Flight_info($data[\"id\"]);\n $flight_info_object->update($db_flight_info_order, $i);\n }else{\n $stmt->close();\n insert_flight_info($flight, $i);\n }\n \n\n return true;\n \n}", "public function insertRecord()\n\t{\n\t\tif($this->user->hasRight($this->getHandler()->getAddRight()))\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\t$record = $this->getHandler()->getRecord();\n\t\t\t\t$record->import($this->getRequest());\n\n\t\t\t\t// check captcha\n\t\t\t\t$this->handleCaptcha($record);\n\n\t\t\t\t// insert\n\t\t\t\t$this->getHandler()->create($record);\n\n\n\t\t\t\t$msg = new Message('You have successful create a ' . $record->getName(), true);\n\n\t\t\t\t$this->setResponse($msg);\n\t\t\t}\n\t\t\tcatch(\\Exception $e)\n\t\t\t{\n\t\t\t\t$msg = new Message($e->getMessage(), false);\n\n\t\t\t\t$this->setResponse($msg);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$msg = new Message('Access not allowed', false);\n\n\t\t\t$this->setResponse($msg, null, $this->user->isAnonymous() ? 401 : 403);\n\t\t}\n\t}", "public function agent()\n {\n return $this->hasMany('App\\Masterdata\\Agent');\n }" ]
[ "0.58493173", "0.57976437", "0.5786995", "0.5661915", "0.55334413", "0.5380711", "0.5331223", "0.5209913", "0.52086544", "0.5181502", "0.5143289", "0.5044231", "0.5035857", "0.50067836", "0.49665117", "0.493827", "0.4887388", "0.48414704", "0.48296", "0.48202884", "0.47921005", "0.47485694", "0.47289392", "0.47256044", "0.47235665", "0.46835262", "0.46749535", "0.4656943", "0.46496305", "0.4643632", "0.46286324", "0.46006417", "0.45984134", "0.45872647", "0.45871818", "0.45708236", "0.4569602", "0.454018", "0.4536005", "0.45335343", "0.45274445", "0.4517975", "0.45134258", "0.45114854", "0.4505554", "0.44907677", "0.4485471", "0.4483704", "0.44796517", "0.44785836", "0.44697142", "0.44663018", "0.44648483", "0.4464034", "0.44604388", "0.44480234", "0.44329715", "0.44287983", "0.4426619", "0.44217318", "0.4421056", "0.44196102", "0.44192615", "0.4418762", "0.44177347", "0.44156915", "0.44107753", "0.4410441", "0.44100812", "0.440376", "0.43995264", "0.43964767", "0.43852502", "0.437945", "0.4378844", "0.43763304", "0.43708467", "0.4362654", "0.43618202", "0.43516815", "0.43516186", "0.4345415", "0.4338812", "0.43382567", "0.43382567", "0.43305287", "0.43165186", "0.43165064", "0.43104345", "0.43086058", "0.43066993", "0.43057725", "0.42916945", "0.42898118", "0.4288029", "0.42879888", "0.42865685", "0.42861724", "0.4285914", "0.428334" ]
0.56598294
4
Finds / creats the record for a not detected Agent
public function findOrCreateNotDetected(): Agent { return Agent::firstOrCreate([ 'name' => 'unknown', 'browser' => NULL, 'browser_version' => NULL ]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function record(){\n //store deadbody object first\n $this->create();\n\n //stores new deadbody in compartment\n $sql = \"SELECT * FROM compartment WHERE status='free' LIMIT 1\";\n $this->compartment = array_shift(Compartment::find_by_sql($sql));\n $this->compartment->status = \"occupied\";\n $this->compartment->dead_no = $this->id;\n\n //create basic service object related to this object\n $service = new RequestedService();\n $service->rel_no = 'null';\n $service->service_no = 1;\n $service->dead_no = $this->id;\n $service->status=\"TODO\";\n $this->requested_service[] = $service;\n\n //stores storage and service information\n if($this->compartment->save() && $service->save()){\n return true;\n } else {\n return false;\n }\n }", "public function createMissingRecords()\n {\n $records = $this->getMissingRecords();\n\n foreach ($records as $record) {\n $repo = $this->storage->getRepository($record->getContentType());\n $fields = $record->getFieldsArray();\n\n if (count($fields)) {\n $entity = $repo->create($fields);\n $entity->setStatus('published');\n $repo->save($entity);\n }\n }\n }", "function rejectRecord(){ \n\n // No need to read the list of participants when processing those tabs\n if ($this->current_tab_does_not_need_applicants()) return True;\n\n $reply = False;\n $dbg_text = '';\n if (is_object($this->b_tabs)){\n $active_tab_index = $this->b_tabs->active_tab();\n $tabs = array_values($this->tabs_toShow);\n $reply = (strpos($tabs[$active_tab_index],'bList') !== False);\n $dbg_text = 'b_Tabs';\n }\n\n $this->v = Null;\n if (!$reply && empty($this->av)) switch ($this->doing){\n\t\n case '2excel':\n\tif (bForm_vm_Visit::_getStatus($this->rec) != STATUS_YES) return True;\n case 'photos':\n\tif (bForm_vm_Visit::_getStatus($this->rec) == STATUS_NO) return True;\n case 'budget':\n case 'myguests':\n case 'budget_byProjects':\n\tbreak;\n\t\n case 'lists':\n\tif (bForm_vm_Visit::_getStatus($this->rec) == STATUS_NO){\n\t if (VM_organizer_here && VM::$e->isEventEndorsed()){\n\t $dbg_text = $this->rec['av_firstname'].' '.$this->rec['av_lastname'].' - After the approval do not show the refused applicants to the organizers';\n\t $reply = True;\n\t }\n\t}\n case 'show_mails_exchange':\n\tif (!cnf_dev && $this->rec['v_type'] === VISIT_TYPE_RENT){\n\t $dbg_text = 'VISIT_TYPE_RENT... to be completed';\n\t $reply = True;\n\t}elseif (empty(VM::$e)){\n\t // Visits outside conferences/programs\n\t if (!VM_administrator_here && ($this->rec['v_host_avid'] != @bAuth::$av->ID)){\n\t $dbg_text = 'not my visit';\n\t $reply = True;\n\t }else{\n\t // Guarantee the correct value of status&policy in the snapshot record\n\t if (empty($this->rec['v_status'])){\n\t $this->v = loader::getInstance_new('bForm_vm_Visit',$this->rec['v_id'],'fatal');\n\t $this->rec['v_status'] = $this->v->getStatus();\n\t $this->rec['v_policy'] = $this->v->getValue('v_policy',True);\n\t }\n\t }\n\t}\n }\n if ($reply) $this->dbg($dbg_text);\n return $reply;\n }", "public function findOrCreate(Array $attributes): Agent\n {\n if (empty($attributes['name'])) {\n $attributes['name'] = 'unknown';\n }\n\n return Agent::firstOrCreate($attributes);\n }", "public function testGetRecordIdByItemWithNoRecord()\n {\n\n // Create an exhibit and item.\n $neatline = $this->_createNeatline();\n $item = $this->_createItem();\n\n // Check for null.\n $retrievedId = $neatline->getRecordIdByItem($item);\n $this->assertNull($retrievedId);\n\n }", "private function collectNLAIdentifiers()\n {\n // find all records that has an nla identifier\n $this->log(\"Fetching all records which are related to NLA identifiers or have an NLA party identifier...\");\n\n $prefix = $this->config['party']['prefix'];\n\n $this->nlaIdentifiers = [];\n\n // has nla identifier\n $identifiers = Identifier::where('identifier', 'like', \"%{$prefix}%\")->pluck('identifier')->unique()->values()->toArray();\n $this->nlaIdentifiers = array_merge($this->nlaIdentifiers, $identifiers);\n $count = count($identifiers);\n $this->log(\"NLA identifier(s): {$count}\");\n\n // directly relates to nla identifier\n $identifiers = Relationship::where('related_object_key', 'like', \"%{$prefix}%\")->pluck('related_object_key')->unique()->values()->toArray();\n $this->nlaIdentifiers = array_merge($this->nlaIdentifiers, $identifiers);\n $count = count($identifiers);\n $this->log(\"Related Object NLA Identifier(s): {$count}\");\n\n // has related info parties\n $identifiers = IdentifierRelationship::where('related_object_identifier', 'like', \"%{$prefix}%\")->pluck('related_object_identifier')->unique()->values()->toArray();\n $this->nlaIdentifiers = array_merge($this->nlaIdentifiers, $identifiers);\n $count = count($identifiers);\n $this->log(\"Related Info NLA Identifier(s): {$count}\");\n\n $this->nlaIdentifiers = array_values(array_unique($this->nlaIdentifiers));\n }", "function recordAnalytics() {\n\t\t//Is your user agent any of my business? Not really, but don't worry about it.\n\t\texecuteQuery(\"\n\t\t\tINSERT INTO dwm2r_activitymonitor\n\t\t\t(IPAddress,UserAgent,Flags,Seed,CreatedDTS)\n\t\t\tVALUES (\n\t\t\t\t'\".$_SERVER['REMOTE_ADDR'].\"',\n\t\t\t\t'\".$_SERVER['HTTP_USER_AGENT'].\"',\n\t\t\t\t'\".trim($_REQUEST[\"Flags\"]).\"',\n\t\t\t\t'\".$this->modder->flags[\"Seed\"].\"',\n\t\t\t\tNOW()\n\t\t\t)\n\t\t\");\n\t}", "static private function link_naked_arxiv() {\n // if(self::quick()) return null;\n\n // Pick arXiv IDs within the last year which do not have INSPIRE record.\n $stats = self::inspire_regenerate(\"SELECT arxiv FROM records WHERE (inspire = '' OR inspire IS NULL) AND (arxiv != '' AND arxiv IS NOT NULL) AND (published + interval 1 year > now())\");\n\n if (sizeof($stats->found) > 0)\n self::log(sizeof($stats->found) . \" arXiv ids were associated with INSPIRE: \" . implode(\", \", $stats->found) . \".\");\n if (sizeof($stats->lost) > 0)\n self::log(sizeof($stats->lost) . \" arXiv ids were not found on INSPIRE: \" . implode(\", \", $stats->lost) . \".\");\n }", "function addAgent($agt) {\n\t\t\n\t\t# Create a new mySQLi object to connect to the \"travelexperts\" database\n\t\t$dbconnection = new mysqli(\"localhost\", \"root\", \"\", \"travelexperts\");\n\t\t\t\n\t\tif ($dbconnection->connect_error) {\n\t\t\tdie(\"Connection failed: \" . $dbconnection->connect_error);\n\t\t} \n\t\t\n\t\t# Create the SQL statement using the data in the $agt Agent object. The Agent object contains values for \n\t\t# every field in the agents table, so the field names do not need to be specified.\n\t\t$sql = \"INSERT INTO agents VALUES (\" . $agt->toString() . \")\";\n\t\t\n\t\t$result = $dbconnection->query($sql);\n\t\t\n\t\t# Log the SQL query and result to a log file, sqllog.txt. This file will be created if it doesn't exist,\n\t\t# otherwise text will be appended to the end of the existing file. \"\\r\\n\" creates a line break.\n\t\t$log = fopen(\"sqllog.txt\", \"a\");\n\t\tfwrite($log, $sql . \"\\r\\n\");\n\t\tif ($result) {\n\t\t\tfwrite($log, \"SUCCESS \\r\\n\");\n\t\t}\n\t\telse {\n\t\t\tfwrite($log, \"FAIL \\r\\n\");\n\t\t}\n\t\tfclose($log);\n\t\t\n\t\t$dbconnection->close();\n\t\t\n\t\t# Return a boolean value. $result is true if the insert query was successful and false if unsuccessful.\n\t\treturn $result;\n\t}", "function addPatientToDatabase($fileNumber, $name, $phoneNo, $dateOfBirth, $progressNotes = null)\n{\n $result = ['result' => false, 'message' => 'Unable to save patient !'];\n $isPatientDataValid = isPatientDataValid($fileNumber, $name, $phoneNo, $dateOfBirth);\n if (!$isPatientDataValid['result']) {\n $result['message'] = $isPatientDataValid['message'];\n return $result;\n }\n $patients = getPatients();\n $patientExists = false;\n // good for adding sorting before searching\n foreach ($patients as $patient) {\n $valuesExist = $patient['FileNumber'] === $fileNumber || ($patient['PatientNo'] === $phoneNo && $patient['PatientName'] === $name);\n if ($valuesExist) {\n $patientExists = true;\n break;\n }\n }\n if ($patientExists) {\n $result['message'] = \"Similar Patient Already Exists !\";\n return $result;\n }\n $data = [\n 'FileNumber' => $fileNumber,\n 'PatientName' => $name,\n 'PatientNo' => $phoneNo,\n 'DOB' => $dateOfBirth,\n ];\n\n if ($progressNotes) {\n $data['ProgressNotes'] = $progressNotes;\n $appObject = getAppointmentObject($data);\n $appObject = setAppointmentId($appObject);\n // $appObject['FirebaseId'] = null;\n $patientSaved = saveRecord(APPOINTMENTS_COLLECTION, $appObject, true);\n } else {\n $patientSaved = saveRecord(PATIENTS_COLLECTION, $data, true);\n }\n if ($patientSaved) {\n $result['message'] = \"Patient Saved Successfully\";\n $result['result'] = true;\n return $result;\n }\n return $result;\n}", "function createRecord(){\r\n\r\n $query_fqdn = \"\r\n SELECT\r\n d.id AS id,\r\n d.fqdn AS fqdn\r\n FROM\r\n \" . $this->referencing_table_name . \" AS d\r\n WHERE\r\n d.fqdn = '\" . $this->fqdn . \"'\r\n ORDER BY\r\n d.id DESC\r\n \";\r\n \r\n $stmt_domain = $this->conn->prepare($query_fqdn);\r\n $stmt_domain->execute();\r\n\r\n // If there isn't already in domain table given FDQN then insert it, otherwise get ID for DNS record insert\r\n if ($stmt_domain->rowCount() == 0){\r\n // query to insert record\r\n $query_insert = \"INSERT INTO \" . $this->referencing_table_name . \" SET fqdn=:fqdn\";\r\n \r\n // prepare query\r\n $stmt_insert = $this->conn->prepare($query_insert);\r\n \r\n // sanitize\r\n $this->fqdn=htmlspecialchars(strip_tags($this->fqdn));\r\n \r\n // bind values\r\n $stmt_insert->bindParam(\":fqdn\", $this->fqdn);\r\n \r\n // execute query\r\n $stmt_insert->execute();\r\n\r\n // set last inserted ID into domain for DNS record\r\n $this->domain = $this->conn->lastInsertId();\r\n }\r\n // I ALSO NEED TO IMPLEMENRT CASE WHERE FQDN ALREADY EXIST IN domain TABLE (id from SELECT previous SELECT ), BC 25.10.2021.\r\n\r\n\r\n /* DNS record */\r\n // query to insert DNS record\r\n $query = \"\r\n INSERT INTO \" . $this->table_name . \"\r\n SET type=:type, domain=:domain, name=:name, val=:val, ttl=:ttl\r\n \";\r\n \r\n // prepare query\r\n $stmt = $this->conn->prepare($query);\r\n \r\n // sanitize\r\n $this->type=htmlspecialchars(strip_tags($this->type));\r\n $this->name=htmlspecialchars(strip_tags($this->name));\r\n $this->val=htmlspecialchars(strip_tags($this->val));\r\n $this->ttl=htmlspecialchars(strip_tags($this->ttl));\r\n \r\n // bind values\r\n $stmt->bindParam(\":type\", $this->type);\r\n $stmt->bindParam(\":domain\", $this->domain); // domain doesnt come from GET directly, but ID from domain table\r\n $stmt->bindParam(\":name\", $this->name);\r\n $stmt->bindParam(\":val\", $this->val);\r\n $stmt->bindParam(\":ttl\", $this->ttl);\r\n \r\n // execute query\r\n if($stmt->execute()){\r\n return true;\r\n }\r\n \r\n return false;\r\n }", "public function testNoDatabaseRecord(){\n $uuid = $this->generateValidUuid();\n\n //WHEN\n $response = $this->get(sprintf(self::WEB_ATTACHMENT_URI, $uuid));\n\n //THEN\n $this->assertResponseStatus($response, HttpStatus::HTTP_NOT_FOUND);\n }", "static function dailyrecord()\n {\n \t\n \t$all_game_ids = Game::listAllGameIds();\n \t\n \t$cur = time();\n\t\t$dt = strftime('%Y-%m-%d', $cur);\n\t\t//当天0:0:0的总秒数\n\t\t$today = strtotime($dt);\t\t\n\t\t//一周\n\t\t$dayago = $today - 3600*24;\n\t\t$cachestr = date('Y-m-d', $dayago);\n \t\n \tforeach ($all_game_ids as $agi) {\n \t\t \n \t\tif(!Game_stat::staticGet('game_id',$agi)) {\n // \t\t\techo $agi.\"\\n\";\n \t\t\t$newrecord = new Game_stat();\n//\t\t\t\t$newrecord->game_id = $agi;\n//\t\t\t\techo $newrecord->game_id.\"aa \\n\";\n//\t\t\t\t$newrecord->video_num = 0;\n//\t\t\t\t$newrecord->music_num = 0;\n//\t\t\t\t$newrecord->pic_num = 0;\n//\t\t\t\t$newrecord->text_num = 0;\n//\t\t\t\t$newrecord->user_num = 0;\n//\t\t\t\t$result = $newrecord->insert();\n\t\t\t\t//insert()存在问题,会产生game_stat_seq表,而且插入的数据不正确。\n\t\t\t\t$query = \"INSERT INTO game_stat(`game_id`, `video_num`, `music_num`, `pic_num`, `text_num`, `user_num`) values(\" .$agi. \",0,0,0,0,0)\";\n//\t\t\t\techo $query;\n\t\t\t\t$result = $newrecord -> query($query);\n//\t\t if (!$result) {\n//\t\t common_log_db_error($newrecord, 'INSERT', __FILE__);\n//\t\t return false;\n//\t\t }\n \t\t}\n \t\t$game_stat = Game_stat::staticGet('game_id', $agi);\n \t\tif ($game_stat && !Game_stat_history::stathisGetbyidtime($agi,$cachestr)) {\n \t\t\t$hisrecord = new Game_stat_history();\n\t\t\t\t$hisrecord->game_id = $agi;\n\t\t\t\t$hisrecord->video_num = $game_stat->video_num;\n\t\t\t\t$hisrecord->music_num = $game_stat->music_num;\n\t\t\t\t$hisrecord->pic_num = $game_stat->pic_num;\n\t\t\t\t$hisrecord->text_num = $game_stat->text_num;\n\t\t\t\t$hisrecord->user_num = $game_stat->user_num;\n\t\t\t\t$hisrecord->his_date = $cachestr;\n\t\t\t\t$result = $hisrecord->insert();\n\t\t if (!$result) {\n\t\t common_log_db_error($hisrecord, 'INSERT', __FILE__);\n\t\t return false;\n\t\t }\n \t\t\n\t \t\t$game_stat->user_num = User::getUsernumbyGame($agi);\n\t \t\t$game_stat->video_num = Notice::getNoticenumbyGameandctype(3 ,$agi);\n\t \t\t$game_stat->music_num = Notice::getNoticenumbyGameandctype(2 ,$agi);\n\t \t\t$game_stat->pic_num = Notice::getNoticenumbyGameandctype(4 ,$agi);\n\t \t\t$game_stat->text_num = Notice::getNoticenumbyGameandctype(1 ,$agi);\n\t \t\t$game_stat->update();\n\t \t\t\n\t \t\t\n \t\t}\n \t\t\n \t\tif ($game_stat) {\n \t\t\t$game = Game::staticGet('id', $agi);\n\t \t\t$gameorig = clone($game);\n\t \t\t$game->gamers_num = $game_stat->user_num;\n\t \t\t$game->notice_num = $game_stat->video_num + $game_stat->music_num + $game_stat->pic_num + $game_stat->text_num;\n\t \t\t$game->update($gameorig);\n \t\t}\n \t}\n \t\n \t \t\n }", "public function saveAgent() {\r\n // Consider wrapping the lines of code so its more\r\n // readable. Preferrably within 80-90 character length\r\n // - @vishal\r\n $sqlQuery = \"INSERT INTO users ( lname, fname, image_name, password, email, phone, enable, creation_date, address1, address2, zipcode, state, country, city, role) VALUES ('\" .\r\n parent::getLastname() . \"', '\" . \r\n parent::getFirstname() . \"', '\" . \r\n parent::getPictureName() . \"', '\" . \r\n hash(\"sha256\",parent::getPassword()) . \"', '\" . \r\n parent::getEmail() . \"', '\" . \r\n parent::getPhone() . \"', '\" .\r\n $this->enabled . \"', NOW(), '\". \r\n parent::getAddress1() .\"', '\".\r\n parent::getAddress2() .\"', '\". \r\n parent::getZipcode() .\"', '\" . \r\n parent::getState() .\"', '\" . \r\n parent::getCountry() .\"', '\" . \r\n parent::getCity() .\"', '\" . \r\n AGENT_ROLE_ID . \"');\";\r\n $result = $this->dbcomm->executeQuery($sqlQuery);\r\n \r\n if ($result != true)\r\n {\r\n echo $sqlQuery;\r\n echo \"<br><b>\" . $this->dbcomm->giveError() . \"</b>\";\r\n // As with many other lines, use single quotes '' where\r\n // string interpolation isn't required\r\n // - @vishal\r\n die(\"Error at agent saving\");\r\n }\r\n else\r\n {\r\n return 1;\r\n }\r\n }", "function check_record_exists($id_user , $id_episode , $id_parcours) {\n\tglobal $wpdb;\n\t$results = $wpdb->get_results(\"SELECT * FROM tracking WHERE id_user = $id_user AND id_parcours = $id_parcours AND id_episode = $id_episode\", ARRAY_A);\n\treturn $results;\n}", "protected function reportDispute($args) {\n\n if ($args['ent_date_time'] == '' || $args['ent_report_msg'] == '')\n return $this->_getStatusMessage(1, 1);\n\n $this->curr_date_time = urldecode($args['ent_date_time']);\n $args['ent_appnt_dt'] = urldecode($args['ent_appnt_dt']);\n\n $returned = $this->_validate_token($args['ent_sess_token'], $args['ent_dev_id'], '2');\n\n if (is_array($returned))\n return $returned;\n\n $getApptDetQry = \"select a.status,a.appt_lat,a.appt_long,a.address_line1,a.address_line2,a.created_dt,a.arrive_dt,a.appointment_dt,a.amount,a.appointment_id,a.last_modified_dt,a.mas_id from appointment a where a.appointment_dt = '\" . $args['ent_appnt_dt'] . \"' and a.slave_id = '\" . $this->User['entityId'] . \"'\";\n $apptDet = mysql_fetch_assoc(mysql_query($getApptDetQry, $this->db->conn));\n\n if ($apptDet['status'] == '4')\n return $this->_getStatusMessage(41, 3);\n\n $insertIntoReportQry = \"insert into reports(mas_id,slave_id,appointment_id,report_msg,report_dt) values('\" . $apptDet['mas_id'] . \"','\" . $this->User['entityId'] . \"','\" . $apptDet['appointment_id'] . \"','\" . $args['ent_report_msg'] . \"','\" . $this->curr_date_time . \"')\";\n mysql_query($insertIntoReportQry, $this->db->conn);\n\n if (mysql_insert_id() > 0) {\n $updateQryReq = \"update appointment set payment_status = '2' where appointment_id = '\" . $apptDet['appointment_id'] . \"'\";\n mysql_query($updateQryReq, $this->db->conn);\n\n $message = \"Dispute reported for appointment dated \" . date('d-m-Y h:i a', strtotime($apptDet['appointment_dt'])) . \" on \" . $this->appName . \"!\";\n\n $aplPushContent = array('alert' => $message, 'nt' => '13', 'n' => $this->User['firstName'] . ' ' . $this->User['last_name'], 'd' => $args['ent_appnt_dt'], 'e' => $this->User['email'], 'bid' => $apptDet['appointment_id']);\n $andrPushContent = array(\"payload\" => $message, 'action' => '13', 'sname' => $this->User['firstName'] . ' ' . $this->User['last_name'], 'dt' => $args['ent_appnt_dt'], 'smail' => $this->User['email'], 'bid' => $apptDet['appointment_id']);\n\n $this->ios_cert_path = $this->ios_uberx_driver;\n $this->ios_cert_pwd = $this->ios_mas_pwd;\n $this->androidApiKey = $this->masterApiKey;\n $push = $this->_sendPush($this->User['entityId'], array($apptDet['mas_id']), $message, '13', $this->User['email'], $this->curr_date_time, '1', $aplPushContent, $andrPushContent);\n\n $errMsgArr = $this->_getStatusMessage(85, $push);\n } else {\n $errMsgArr = $this->_getStatusMessage(86, 76);\n }\n\n return array('errNum' => $errMsgArr['errNum'], 'errFlag' => $errMsgArr['errFlag'], 'errMsg' => $errMsgArr['errMsg'], 't' => $insertIntoReportQry);\n }", "public function store(CreateAgentRequest $request)\n {\n $input = $request->all();\n\n\n //dd($input);\n\n\n try {\n DB::beginTransaction();\n\n $validator = validator($request->input(), [\n 'first_name' => 'required',\n 'last_name' => 'required',\n //'userID' => 'required|exists:users,userID',\n ]);\n\n if ($validator->fails()) {\n return back()->withErrors($validator);\n }\n\n $user = User::create([\n 'name' => $input['first_name'] . \" \" . $input['last_name'],\n 'email' => $input['email'],\n 'password' => Hash::make($input['password']),\n ]);\n\n $user->assignRole('agents');\n $input['user_id'] = $user->id;\n\n\n $agent = $this->agentRepository->create($input);\n $localGovt = $input['lga_id'];\n $resLGA = Lga::find($localGovt);\n\n $id = sprintf(\"%'04d\", $agent->id);\n $driverID = \"CYA\" . $resLGA->lgaId . $id;\n $input['unique_code'] = $driverID;\n $input['data_id'] = $agent->id;\n $input['model'] = \"Agent\";\n\n $biodata = $this->biodataRepository->create($input);\n\n\n DB::commit();\n Flash::success('Agent saved successfully.');\n } catch (\\Exception $exception) {\n //dd($exception->getMessage(), $exception->getLine(),$exception->getFile());\n DB::rollBack();\n Flash::error($exception->getMessage());\n }\n\n return redirect(route('agents.index'));\n }", "function record_check($conn, $node, $reg, $ip, $service)\n{\n // PFR_LOCATIONS records select\n $sel = \"select * from DB2INST1.PFR_LOCATIONS \n where (upper(AGENT_NODE) = '\" . strtoupper($node) . \"' or (upper(NODE) = '\" . strtoupper($node) . \"' and AGENT_NODE = '')) and\n substr(PFR_OBJECTSERVER, 4, 3) = '\" . $reg . \"'\";\n $stmt = db2_prepare($conn, $sel);\n $result = db2_execute($stmt);\n\n $consistency = 0;\n $id = '';\n $rec_found = 0;\n while ($row = db2_fetch_assoc($stmt)) {\n // check list\n if (empty($row['SERVICE_NAME']))\n $consistency += CHECK_WARNING_SERVICE_NAME_IS_EMPTY;\n if (strcmp($row['SERVICE_NAME'], $service))\n $consistency += CHECK_WARNING_SERVICE_NAME_IS_NOT_EQUAL_TBSM;\n\n\n $id = $row['ID'];\n $rec_found++;\n }\n\n if ($rec_found == 0)\n return ' *'.CHECK_ABSENT;\n else if ($rec_found > 1)\n return ' *'.CHECK_DUPLICATE;\n else\n return $id.'*'.$consistency;\n}", "public function testExistentRecord()\n {\n try {\n DAL::beginTransaction();\n $assetidOne = 123;\n $typeid = 'asset';\n $sql = $this->_getInsertQuery($assetidOne, $typeid).';';\n\n $assetidTwo = 124;\n $typeid = 'asset';\n $sql .= $this->_getInsertQuery($assetidTwo, $typeid);\n\n $expected = 'asset';\n DAL::executeQueries($sql);\n\n $type = TestDALSys1::dalTestExecuteOne($assetidOne);\n PHPUnit_Framework_Assert::assertEquals($expected, $type);\n\n $type = TestDALSys1::dalTestExecuteOne($assetidTwo);\n PHPUnit_Framework_Assert::assertEquals($expected, $type);\n DAL::rollBack();\n\n } catch (PDOException $e) {\n DAL::rollBack();\n PHPUnit_Framework_Assert::fail($e->getMessage().$e->getTraceAsString());\n } catch (ChannelException $e) {\n DAL::rollBack();\n PHPUnit_Framework_Assert::fail($e->getMessage().$e->getTraceAsString());\n }\n\n }", "public function unsetAgentLead()\n {\n $customers = LeadDetails::where('saveType','recipient')->get();\n $cunt = 0;\n $Acunt = 0;\n $Dcunt = 0;\n foreach ($customers as $customer) {\n $id=$customer->_id;\n if(isset($customer->agent))\n {\n LeadDetails::where('_id',new ObjectID($id))->unset('agent');\n $Acunt++;\n }\n if(isset($customer->dispatchDetails))\n {\n LeadDetails::where('_id', new ObjectID($id))->update(array('dispatchDetails.agent' => (string)'NA'));\n $Dcunt++;\n }\n $cunt++;\n \n }\n echo 'count'.$cunt .'Agnt Count'.$Acunt.'In Ag count'.$Dcunt;\n }", "function gaMatch_addPlayerResult($kidPlayerId, $win, $draw, $lost) {\n //??????????????????? does record already exist - what if player change ?????????\n $match = array_search ( $kidPlayerId , $this->gamatch_gamePlayerMap);\n if ($match === FALSE) {\n $newGame = new stdData_gameUnit_extended;\n $newGame->stdRec_loadRow($row);\n $this->gamatch_gamePlayerMap[$newGame->game_kidPeriodId] = $newGame;\n ++$this->game_opponents_count;\n $this->game_opponents_kidPeriodId[] = $kidPlayerId;\n $this->game_opponents_wins[] = $win;\n $this->game_opponents_draws[] = $draw;\n $this->game_opponents_losts[] = $lost;\n $this->gagArrayGameId[] = 0;\n } else {\n $this->game_opponents_wins[$match] += $win;\n $this->game_opponents_draws[$match] += $draw;\n $this->game_opponents_losts[$match] += $lost;\n }\n}", "function cc_insert_record($offerta){\n\t\t\n\t// recupero post_id dell'agenzia, agente e autore da rif (prime due cifre)\n\t$aau = cc_get_agency($offerta->Riferimento); \n\t$agenzia = $aau['fave_property_agency']; \n\t$agente = $aau['fave_agents']; \n\t$user_id = $aau['post_author'];\n\n\t\n\t// POSTMETA - INDIRIZZO\n\t$map_address = $indirizzo = \"\";\n\t\n\t//$indirizzo = solo indirizzo (via e civico), map_adress = indirizzo completo con cap località e provincia per mappa\n\tif(!empty($offerta->Indirizzo)){\n\t\t$map_address .= (string) $offerta->Indirizzo;\n\t\t$indirizzo .= (string) $offerta->Indirizzo;\n\t}\n\tif(!empty($offerta->NrCivico)){\n\t\t$map_address .= (string) \" \".$offerta->NrCivico;\n\t\t$indirizzo .= (string) \" \".$offerta->NrCivico;\n\t}\n\t\n\t// compilo map_address con cap, località e provincia solo se l'indirizzo (via + civico) è compilato\n\t// se non lo è vuol dire che non deve essere resa noto l'indirizzo esatto dell'immobile\n\tif(!empty($offerta->Comune) and !empty($map_address)){\n\t\t\n\t\t$comune = (string) $offerta->Comune;\n\t\t$comune = trim($comune);\n\t\t$map_address .= \", \";\n\t\t\n\t\t$cp = cc_get_cap_prov($comune);\n\t\tif(!empty($cp)) $map_address .= $cp['cap'].\" \"; \t\t\n\t\t\n\t\t$map_address .= $comune;\n\t\tif(!empty($cp)) $map_address .= \" (\".$cp['prov'].\")\"; \n\t\t\n\t}else{\n\t\t\n\t\t$cp = array();\n\t\t\n\t}\n\t\n\t$map_address = trim($map_address);\n\tif($map_address[0] == ',') $map_address = substr($map_address, 2);\t\n\t\n\t$latitudine = (string) $offerta->Latitudine;\n\t$longitudine = (string) $offerta->Longitudine;\n\t\n\t// da cometa arriva con virgola decimale\n\tif(!empty($latitudine)) $latitudine = str_replace(\",\", \".\", $latitudine);;\n\tif(!empty($longitudine)) $longitudine = str_replace(\",\", \".\", $longitudine);;\n\n\tif(!empty($latitudine) and !empty($longitudine)){\n\t\t$map_coords = $latitudine .\", \". $longitudine;\t\t\n\t}else{\n\t\t$map_coords = \"\";\n\t}\n\t\n\t// Caratteristiche aggiuntive\n\t$af = array();\n\tif(!empty($offerta->Locali)){\n\t\t$af[] = array( \"fave_additional_feature_title\" => \"Locali\", \"fave_additional_feature_value\" => (string) $offerta->Locali);\n\t}\n\tif(!empty($offerta->Cucina)){\n\t\t$af[] = array( \"fave_additional_feature_title\" => \"Cucina\", \"fave_additional_feature_value\" => (string) $offerta->Cucina);\n\t}\n\tif(!empty($offerta->Box)){\n\t\t$af[] = array( \"fave_additional_feature_title\" => \"Box\", \"fave_additional_feature_value\" => (string) $offerta->Box);\n\t}\n\t$fave_additional_features_enable = (empty($af)) ? \"disable\" : \"enable\";\n\t\n\t// controllo se questo nuovo immobile deve essere messo in vetrina o meno e se sì tolgo vetrina a quello precedente\n\t//$vetrina = cc_ho_vetrina( (string) $offerta->IdAgenzia, (string) $offerta->Riferimento);\n\t\n\t// GESTIONE PREZZO / TRATTATIVA RISERVATA\n\t$prezzo = (string) $offerta->Prezzo;\n\t$flag_trattativa_riservata = (string) $offerta->TrattativaRiservata;\n\t\n\tif($flag_trattativa_riservata == '1'){\n\t\t$prezzo = \"Trattativa Riservata\";\n\t\t$fave_private_note = \"Prezzo richiesto €\".$prezzo;\t\t\n\t}else{\n\t\t$fave_private_note = \"\";\n\t}\n\t\n\t\t\n\t// META INPUT VARIABILI\n\t$meta_input = array(\n\t\t//\"fave_featured\" => $vetrina,\n\t\t\"fave_property_size\" => (int) $offerta->Mq, \n\t\t\"fave_property_bedrooms\" => (int) $offerta->Camere, \n\t\t\"fave_property_bathrooms\" => (int) $offerta->Bagni, \n\t\t\"fave_property_id\" => (string) $offerta->Riferimento, \n\t\t\"fave_property_price\" => $prezzo, \n\t\t\"fave_property_map_address\" => (string) $map_address, \n\t\t\"fave_property_location\" => $map_coords, \n\t\t\"fave_additional_features_enable\" => $fave_additional_features_enable,\n\t\t\"additional_features\" => $af,\n\t\t\"fave_property_address\" => $indirizzo,\n\t\t\"houzez_geolocation_lat\" => $latitudine,\n\t\t\"houzez_geolocation_long\" => $longitudine,\n\t\t\"fave_energy_class\" => (string) $offerta->Classe,\n\t\t\"fave_energy_global_index\" => (string) $offerta->IPE.\" \".$offerta->IPEUm, \n\t\t\"fave_private_note\" => $fave_private_note, \n\t\t\"_id_cometa\" => (string) $offerta->Idimmobile\n\t\t\n\t);\t\n\n\tif(!empty($cp)) $meta_input['fave_property_zip'] = $cp['cap'];\n\t\n\t// META INPUT VALORI FISSI\n\t$meta_input['slide_template'] = \"default\";\n\t$meta_input['fave_property_size_prefix'] = \"M²\";\n\t$meta_input['fave_property_country'] = \"IT\";\n\t$meta_input['fave_agents'] = $agente;\n\t$meta_input['fave_property_agency'] = $agenzia;\n\t$meta_input['fave_floor_plans_enable'] = \"disabled\";\n\t$meta_input['fave_agent_display_option'] = \"agent_info\";\n\t$meta_input['fave_payment_status'] = \"not_paid\";\n\t$meta_input['fave_property_map_street_view'] = \"hide\";\n\t$meta_input['houzez_total_property_views'] = \"0\";\n\t$meta_input['houzez_views_by_date'] = \"\";\n\t$meta_input['houzez_recently_viewed'] = \"\";\n\t$meta_input['fave_multiunit_plans_enable'] = \"disable\";\n\t$meta_input['fave_multi_units'] = \"\";\n\t$meta_input['fave_single_top_area'] = \"v2\";\n\t$meta_input['fave_single_content_area'] = \"global\";\n\t$meta_input['fave_property_land_postfix'] = \"M²\";\n\t$meta_input['fave_property_map'] = \"1\";\n\t\n\t// MANCANO FOTO, LE METTO DOPO\n\t\n\t$DataAggiornamento = new DateTime( (string) $offerta->DataAggiornamento ); // $offerta->DataAggiornamento formato 2018-07-25T00:00:00+01:00\n\t$post_modified = $DataAggiornamento->format(\"Y-m-d H:i:s\"); \t\n\t\n\t\n\t$posts_arg = array(\n\t\t\"post_author\" \t=> $user_id, \n\t\t\"post_content\" \t=> (string) $offerta->Descrizione,\n\t\t\"post_title\" \t=> (string) $offerta->Titolo,\n\t\t\"post_excerpt\" \t=> (string) $offerta->Descrizione,\n\t\t\"post_status\" \t=> \"publish\", \n\t\t\"post_type\" \t=> \"property\",\n\t\t\"post_modified\" => (string) $post_modified,\n\t\t\"post_modified_gmt\" => (string) $post_modified,\n\t\t\"comment_status\" \t=> \"closed\",\n\t\t\"ping_status\" \t=> \"closed\",\n\t\t\"guid\" \t\t \t=> wp_generate_uuid4(),\n\t\t\"meta_input\" \t=> $meta_input\n\t);\n\t\n\t// Restituisce l'ID del post se il post è stato aggiornato con success nel DB. Se no restituisce 0.\n\t$post_id = wp_insert_post( $posts_arg, true ); \n\t\n\tif (is_wp_error($post_id)) {\n\t\t$errors = $post_id->get_error_messages();\n\t\t$dbg = \"Errore durante insert record\\n\";\n\t\tforeach ($errors as $error) {\n\t\t\t$dbg .= $error.\"\\n\";\n\t\t}\n\t\treturn $dbg;\t\t\n\t}\n\t\n\t// continuo con inseriemnto foto e categorie\n\t\n\t$foto = array();\n\tfor($nf = 1; $nf < 16; $nf++){\n\t\t\n\t\t$foto_field = \"FOTO\".$nf;\n\t\t$foto_url = (string) $offerta->$foto_field;\n\t\tif(!empty($foto_url)) $foto[] = $foto_url;\n\t\t\n\t}\n\t\n\t// inserisce solo se le foto non sono ancora presenti, restituisce array con id posts delle foto nuove\n\t$foto_nuove = cc_import_images($foto, $post_id, true);\n\t\n\t// Se vi sono nuove foto le aggiungo alla tabella postmeta \n\tif(!empty($foto_nuove)){\n\t\tcc_insert_images_meta($foto_nuove, $post_id); // Non restituisce feedback\n\t}\n\t\n\t\t\n\t// GESTIONE CATEGORIE - SE IL VALORE CATEGORIE (TERM) NON ESISTE ANCORA VIENE AGGIUNTO \n\t\n\t// Categoria \"property_type\" (Appartamento, villa, box etc) - SINGOLO\n\t$property_type = (string) $offerta->Tipologia;\n\tif(!empty($property_type)) $property_type_results = cc_add_term_taxonomy($post_id, \"property_type\", array( $property_type ));\n\t\n\t// Categoria \"property_city\" (Città) - SINGOLO\n\t$property_city = (string) $offerta->Comune;\n\tif(!empty($property_city)) $property_city_results = cc_add_term_taxonomy($post_id, \"property_city\", array( $property_city ));\n\t\n\t\n\t// Categoria \"property_area\" (Zona / Quartiere) - SINGOLO\n\t$property_area = (string) $offerta->Quartiere;\n\t$property_area = trim($property_area);\n\tif(!empty($property_area)) $property_area_results = cc_add_term_taxonomy($post_id, \"property_area\", array( $property_area ));\t\n\t\n\t// Categoria \"property_feature\" (caratteristiche) - MULTI\n\t$property_feature = array();\n\tif(!empty($offerta->Box)) $property_feature[] = \"Box Auto\";\n\tif(!empty($offerta->Box)) $property_feature[] = \"Posto Auto\";\n\tif((string) $offerta->Terrazzo == '-1') $property_feature[] = \"Terrazzo\";\n\tif((string) $offerta->Balcone == '-1') $property_feature[] = \"Balcone\";\n\tif((string) $offerta->GiardinoCondominiale == '-1' or (string) $offerta->GiardinoPrivato == '-1' ) $property_feature[] = \"Giardino\";\n\t//if((string) $offerta->GiardinoPrivato == '-1') $property_feature[] = \"Giardino Privato\";\n\t\n\tif(!empty($property_feature)) $property_feature_results = cc_add_term_taxonomy($post_id, \"property_feature\", $property_feature );\n\t\n\t// FINITO INSERT RECORD\n\t\n\t// update configs xml\n\tcc_update_configs(\"inserted\", 1, true);\t\n\tcc_import_immobili_error_log(\"Inserted: \".$post_id);\n\t\n\treturn \"inserted\";\n\t\n}", "public function saveMatch($fixture,$dato){\n $foundfix = $this->getFixtures($fixture->getId());\n\n /*Si no encontramos el fixture, no guardamos el match*/\n if($foundfix!=null) {\n\n $datos = $this->getMatch( null );\n if ($datos == null) {\n $datos = array();\n\n /* Creamos desde cero en cache */\n array_push( $datos, $dato );\n $this->createObject( 'Match', $datos );\n\n //Si tiene goals llamamos SMSEvent\n if(count($dato->getGoals())>0){\n $sms = new SMSEvent();\n $sms->sendSMS($dato->getGoals());\n }\n }else{\n /* Buscamos si existe */\n $dato_match = $this->getMatch( $dato->getIdMatch() );\n if($dato_match != null){\n /* Update Match */\n for ($i = 0; $i < count($datos); $i++) {\n if($datos[$i]->getIdMatch()==$dato->getIdMatch()){\n $datos[$i]=$dato;\n }\n }\n //Si tiene mas goals que antes llamamos SMSEvent\n if(count($dato->getGoals())>count($dato_match->getGoals())){\n $sms = new SMSEvent();\n $sms->sendSMS($dato->getGoals());\n }\n $this->updateObject( 'Match', $datos );\n }else{\n /* Creamos Match */\n array_push( $datos, $dato );\n $this->createObject( 'Match', $datos );\n }\n }\n }\n }", "public function run()\n {\n //\n $if_exist_status = Store::first();\n\n if (!$if_exist_status){\n $record= new Store();\n $record->name='Guatemala';\n $record->address='3a. Calle 3-60, Zona 9, Guatemala.';\n $record->schedule='Lunes a Viernes: 08:00 am a 06:00 pm';\n $record->number = '+502 23288888';\n $record->waze='https://ul.waze.com/ul?preview_venue_id=176619666.1766065589.1119473&navigate=yes';\n $record->maps='https://goo.gl/maps/zRztEAJrRD3VXxEt5';\n $record->save();\n\n $record= new Store();\n $record->name='Hyundai Roosevelt';\n $record->address='Calzada Roosevelt 18-23 Zona 11';\n $record->schedule='Lunes a viernes: 8:oo am / 7:00 pm Sábado: 8:00 am / 5:00 pm Domingo: 10:00 am a 5:00 pm';\n $record->number = '+502 23288879';\n $record->waze='https://ul.waze.com/ul?preview_venue_id=176619666.1765868982.2147455&navigate=yes&utm_campaign=default&utm_source=waze_website&utm_medium=lm_share_location';\n $record->maps='https://goo.gl/maps/EYxhipDvLg4mELQU8';\n $record->save();\n\n $record= new Store();\n $record->name='Didea Zona 9';\n $record->address='1ra Calle 7-69 zona 9';\n $record->schedule='Lunes a viernes: 8:oo am / 5:00 pm Sábado: 8:00 am / 3:00 pm Domingo: Cerrado';\n $record->number = '+502 23288881';\n $record->waze='https://ul.waze.com/ul?preview_venue_id=176619666.1766131125.2236623&navigate=yes&utm_campaign=waze_website&utm_source=waze_website&utm_medium=lm_share_location';\n $record->maps='https://goo.gl/maps/rvNz5ohuS2Je14nq9';\n $record->save();\n\n $record= new Store();\n $record->name='Didea Majadas';\n $record->address='Majadas 28 Av. 5-20 Z. 11';\n $record->schedule='Lunes a viernes: 7:oo am / 5:30 pm Sábado: 7:00 am / 12:00 pm Domingo: Cerrado';\n $record->number = '+502 23288880';\n $record->waze='https://ul.waze.com/ul?preview_venue_id=176554130.1765803446.10792480&navigate=yes&utm_campaign=waze_website&utm_source=waze_website&utm_medium=lm_share_location';\n $record->maps='https://goo.gl/maps/VevRKiZgu45oAchE9';\n $record->save();\n\n $record= new Store();\n $record->name='Autos Premier';\n $record->address='Petapa 36-09 zona 12';\n $record->schedule='Lunes a viernes: 7:oo am / 5:30 pm Sábado: 7:00 am / 12:00 pm Domingo: Cerrado';\n $record->number = '+502 23288880';\n $record->waze='https://ul.waze.com/ul?ll=14.60526980%2C-90.53910730&navigate=yes&utm_campaign=waze_website&utm_source=waze_website&utm_medium=lm_share_location';\n $record->maps='https://goo.gl/maps/k4ainh2cp7yjDBvV6';\n $record->save();\n\n $record= new Store();\n $record->name='PDI - Amatitlán';\n $record->address='Zona Franca Amatitlán';\n $record->schedule='Lunes a Viernes: 08:00 am a 06:00 pm';\n $record->number = '+502 23288880';\n $record->waze='https://ul.waze.com/ul?place=ChIJyXOdaZgHiYURlrdG-g9_hYA&ll=14.47018360%2C-90.63399190&navigate=yes&utm_campaign=waze_website&utm_source=waze_website&utm_medium=lm_share_location';\n $record->maps='https://goo.gl/maps/VkoWMed6gj3gtGCd8';\n $record->save();\n\n $record= new Store();\n $record->name='Agencia Multimarca Quetzaltenango';\n $record->address='Diagonal 2, 33-18, zona 8, DIDEA Xela, Quetzaltenango';\n $record->schedule= 'Lunes a Viernes: 08:00 am a 05:00 pm Sábado: 08:00 am a 12:00 pm';\n $record->number = '+502 23288888';\n $record->waze='https://ul.waze.com/ul?place=ChIJk1EV16CijoURPR2xd8pP0-U&ll=14.85898840%2C-91.51863860&navigate=yes';\n $record->maps='https://goo.gl/maps/fNSaHZJT2C8GXQKD9';\n $record->save();\n\n $record= new Store();\n $record->name='Agencia Multimarca Rio Hondo';\n $record->address='Km 126.5 Carretera al Atlántico, Santa Cruz, Río Hondo, Zacapa';\n $record->schedule='Lunes a Viernes: 08:00 am a 05:00 pm Sábado: 08:00 am a 12:00 pm';\n $record->number = '+502 23288888';\n $record->waze='https://ul.waze.com/ul?place=ChIJi85QTV4gYo8RShNGA_zlVTQ&ll=15.00657760%2C-89.66519330&navigate=yes';\n $record->maps='https://g.page/AutoCentroEvoluSion?share';\n $record->save();\n\n $record= new Store();\n $record->name='Agencia Multimarca Santa Lucia';\n $record->address='Km 86.5 Carretera a Santa Lucía Cotzumalguapa, Escuintla.';\n $record->schedule='Lunes a Viernes: 08:00 am a 05:00 pm Sábado: 08:00 am a 12:00 pm';\n $record->number = '+502 23288888';\n $record->waze='https://ul.waze.com/ul?place=ChIJwfJa2_wmiYURiYJ4iofL5jY&ll=14.33395500%2C-91.01180150&navigate=yes';\n $record->maps='';\n $record->save();\n\n $record= new Store();\n $record->name='Agencia Multimarca Carretera a El Salvador';\n $record->address='Carretera a El Salvador KM.16.5 Parque Automotriz';\n $record->schedule='Lunes a Viernes: 08:00 am a 05:00 pm Sábado: 08:00 am a 12:00 pm';\n $record->number = '+502 23288888';\n $record->waze='https://ul.waze.com/ul?preview_venue_id=176619665.1766524334.17186114&navigate=yes&utm_campaign=default&utm_source=waze_website&utm_medium=lm_share_location';\n $record->maps='https://goo.gl/maps/zoGFFwoiXCkzxP91A';\n $record->save();\n\n $record= new Store();\n $record->name='Blue Box Peugeot';\n $record->address='Carretera a El Salvador KM.16.5 Parque Automotriz';\n $record->schedule='Lunes a Viernes: 08:00 am a 05:00 pm Sábado: 08:00 am a 12:00 pm';\n $record->number = '+502 23288888';\n $record->waze='https://ul.waze.com/ul?preview_venue_id=176619665.1766524334.17186114&navigate=yes&utm_campaign=default&utm_source=waze_website&utm_medium=lm_share_location';\n $record->maps='https://goo.gl/maps/KzGx3Ba1k2RMeKdY6';\n $record->save();\n\n $record= new Store();\n $record->name='Centro de Servicio Multimarca 19 calle';\n $record->address='19 Calle 17-37';\n $record->schedule='Lunes a Viernes: 08:00 am a 05:00 pm Sábado: 08:00 am a 12:00 pm';\n $record->number = '+502 23288888';\n $record->waze='https://ul.waze.com/ul?ll=14.59746120%2C-90.54194860&navigate=yes&utm_campaign=default&utm_source=waze_website&utm_medium=lm_share_location';\n $record->maps='https://ul.waze.com/ul?ll=14.59746120%2C-90.54194860&navigate=yes&utm_campaign=default&utm_source=waze_website&utm_medium=lm_share_location';\n $record->save();\n\n $record= new Store();\n $record->name='Centro de Servicio Multimarca Vistares';\n $record->address='Avenida Petapa 36 calle, Sótano 1 Centro Comercial Vistares';\n $record->schedule='Lunes a Viernes: 08:00 am a 05:00 pm Sábado: 08:00 am a 12:00 pm';\n $record->number = '+502 23288888';\n $record->waze='https://ul.waze.com/ul?place=ChIJoZxvI8OhiYUR4pHi2a6gvMk&ll=14.58329140%2C-90.54459440&navigate=yes&utm_campaign=default&utm_source=waze_website&utm_medium=lm_share_location';\n $record->maps='https://goo.gl/maps/Q2qHFCwGFvjnJAqA9';\n $record->save();\n\n $record= new Store();\n $record->name='Petén';\n $record->address='1a. Av. Y 1a. Calle Ciudad Satélite\n Finca Pontehill, Santa Elena, Petén';\n $record->schedule='Lunes a Viernes: 08:00 am a 05:00 pm\n Sábado: 08:00 am a 12:00 pm ';\n $record->number = '+502 23288888';\n $record->waze='https://ul.waze.com/ul?place=ChIJMwbABS2NX48RAeO5SRcqSf4&ll=16.91470700%2C-89.88040570&navigate=yes';\n $record->maps='https://goo.gl/maps/DiCyrSgcvGPsqkDP8';\n $record->save();\n\n $record= new Store();\n $record->name='Retalhuleu';\n $record->address='Km 179 San Sebastián, Retalhuleu.';\n $record->schedule='Lunes a Viernes: 08:00 am a 05:00 pm\n Sábado: 08:00 am a 12:00 pm ';\n $record->number = '+502 23288888';\n $record->waze='https://ul.waze.com/ul?place=ChIJ4SSo5drtjoUROg2MiAHlddQ&ll=14.56941970%2C-91.64885360&navigate=yes';\n $record->maps='https://goo.gl/maps/NR81je5G3Te8eKQXA';\n $record->save();\n }\n }", "public function insert () {\n\t\t$GLOBALS[\"logger\"]->debug(\"report:insert\");\n\t\t\n\t\t$newRec = ORM::for_table (self::REPORT_TABLE)->create();\n\t\t$newRec->clip_id = $this->clip->id;\n\t\t$newRec->master_id = $this->masterId;\n\t\t$sngid = NULL;\n\t\tif (!is_null($this->song)) {\n\t\t\t$GLOBALS[\"logger\"]->debug('There is a song with ID ' . $this->song->id);\n\t\t\t$sngid = $this->song->id;\n\t\t}\n\t\t$newRec->song_id = $sngid;\n\t\t$newRec->singalong = $this->singalong;\n\t\t$newRec->seq_num = $this->seqNum;\n\t\t$newRec->user_id = $this->user->id;\n\t\t$newRec->sound_type = $this->soundType;\n\t\t$newRec->sound_subtype = $this->soundSubtype;\n\t\t$newRec->performer_type = $this->performerType;\n\t\t$newRec->flagged = $this->flagged;\n\t\t$GLOBALS[\"logger\"]->debug(\"Saving newRec\");\n\t\t$newRec->save();\n\t\t$GLOBALS[\"logger\"]->debug(\"insert: saved new record into reports table\");\n\t\t$this->id = $newRec->id();\n//\t\t$insstmt = \"INSERT INTO REPORTS (CLIP_ID, MASTER_ID, SEQ_NUM, USER_ID, SOUND_TYPE, \" .\n//\t\t\t\" SOUND_SUBTYPE, SONG_ID, PERFORMER_TYPE, SINGALONG, FLAGGED) \" .\n//\t\t\t\" VALUES ($clpid, $mstrid, $seqn, $usrid, $sndtyp, $sndsbtyp, $sngid, $prftyp, $sngalng, $flgd)\";\n\t\t$this->writePerformers();\n\t\t$this->writeInstruments();\n\t\treturn $newRec->id();\n\t}", "private function _recordVisit() {\n $txnTable = $this->settings['txnTable'];\n $dtlTable = $this->settings['dtlTable'];\n $isRES = BoolYN( $this->_isResource() );\n $rVal = false;\n\n // Construct the INSERT Statement and Record It\n $dsvID = \"CONCAT(DATE_FORMAT(Now(), '%Y-%m-%d %h:00:00'), '-', \" . \n nullInt($this->settings['SiteID']) . \", '-', \" . \n \"'\" . sqlScrub($this->settings['RequestURL']) . \"')\";\n $sqlStr = \"INSERT INTO `$txnTable` (`dsvID`, `DateStamp`, `SiteID`, `VisitURL`, `Hits`, `isResource`, `UpdateDTS`) \" .\n \"VALUES ( MD5($dsvID), DATE_FORMAT(Now(), '%Y-%m-%d %h:00:00'), \" . nullInt($this->settings['SiteID']) . \",\" .\n \" '\" . sqlScrub($this->settings['RequestURL']) . \"',\" .\n \" 1, '$isRES', Now() )\" .\n \"ON DUPLICATE KEY UPDATE `Hits` = `Hits` + 1,\" .\n \" `UpdateDTS` = Now();\" .\n \"INSERT INTO `$dtlTable` (`SiteID`, `DateStamp`, `VisitURL`, `ReferURL`, `SearchQuery`, `isResource`, `isSearch`, `UpdateDTS`) \" .\n \"VALUES ( \" . nullInt($this->settings['SiteID']) . \", DATE_FORMAT(Now(), '%Y-%m-%d %h:00:00'),\" . \n \" '\" . sqlScrub($this->settings['RequestURL']) . \"',\" .\n \" '\" . sqlScrub($this->settings['Referrer']) . \"',\" .\n \" '', '$isRES', 'N', Now() );\";\n $rslt = doSQLExecute( $sqlStr );\n if ( $rslt > 0 ) { $rVal = true; }\n\n // Return the Boolean Response\n return $rVal;\n }", "public function createCrowdAgent($data){\n\n\t\t$workerId = $data['WorkerId'];\n\n\t\tif($id = CrowdAgent::where('platformAgentId', $workerId)->where('softwareAgent_id', 'amt')->pluck('_id')) \n\t\t\treturn $id;\n\t\telse {\n\t\t\t$agent = new CrowdAgent;\n\t\t\t$agent->_id= \"crowdagent/amt/$workerId\";\n\t\t\t$agent->softwareAgent_id= 'amt';\n\t\t\t$agent->platformAgentId = $workerId;\n\t\t\t$agent->save();\t\t\n\t\t\treturn $agent->_id;\n\t\t}\n\t}", "private function createRecordClassInitialTest( $dbModel, $dbRecords, $dbDetailRecords = []) {\n foreach ($dbRecords as $dbRecord) {\n // var_dump($dbRecord);\n echo 'Nombre: ' . $dbRecord[\"name\"] . \"\\n\";\n\n /*\n Version Create - Find\n */\n try {\n \n /*\n * Using collections will allow to have access to multiple methods\n * https://laravel.com/docs/6.0/collections\n */\n // dd(collect($dbRecord)->except(['permissions']));\n // dd(collect($dbRecord)->except($dbDetailRecords));\n\n // This will produce and error if the key 'permissions' (Detail records) is included \n // $newModel = $dbModel::create($dbRecord);\n // $newModel = $dbModel::create(collect($dbRecord)->except(['permissions'])->toArray());\n $newModel = $dbModel::create(collect($dbRecord)->except($dbDetailRecords)->toArray());\n\n /*\n * Process Detail Records set\n * \n */\n /*\n //\n // Single Detail reference Records\n //\n if ( isset($dbRecord['permissions']) ) {\n foreach ($dbRecord['permissions'] as $dbDetail) {\n // var_dump($dbDetail);\n echo 'Permission: ' . $dbDetail . \"\\n\";\n } \n }\n */\n //\n // Multiple Detail reference Records\n //\n // dd($dbDetailRecords);\n foreach ($dbDetailRecords as $dbDetailRecord) {\n echo var_dump($dbDetailRecord);\n if ( isset($dbRecord[$dbDetailRecord]) ) {\n // var_dump($dbRecord[$dbDetailRecord]);\n\n foreach ($dbRecord[$dbDetailRecord] as $dbDetail) {\n var_dump($dbDetail);\n // echo 'Permission: ' . $dbDetail . \"\\n\";\n }\n } \n }\n }\n catch (Exception $ex) {\n dd('stop here');\n \n }\n // @todo: Include the QueryException to allow to continue the excecution\n catch ( \\Illuminate\\Database\\QueryException $ex) {\n echo $ex->getMessage();\n }\n catch ( Spatie\\Permission\\Exceptions\\RoleAlreadyExists $ex) {\n echo $ex->getMessage();\n dd(var_dump($dbRecord));\n }\n finally {\n dd('After Error' . var_dump($newModel));\n \n }\n }\n \n }", "function report_it($id)\r\n\t{\r\n\t\tglobal $db;\r\n\t\t//First checking weather object exists or not\r\n\t\tif($this->exists($id))\r\n\t\t{\r\n\t\t\tif(userid())\r\n\t\t\t{\r\n\t\t\t\tif(!$this->report_check($id))\r\n\t\t\t\t{\r\n\t\t\t\t\t$db->insert(\r\n\t\t\t\t\t\ttbl($this->flag_tbl),\r\n\t\t\t\t\t\tarray('type','id','userid','flag_type','date_added'),\r\n\t\t\t\t\t\tarray($this->type,$id,userid(),post('flag_type'),NOW())\r\n\t\t\t\t\t);\r\n\t\t\t\t\te(sprintf(lang('obj_report_msg'), lang($this->name)),'m');\r\n\t\t\t\t} else {\r\n\t\t\t\t\te(sprintf(lang('obj_report_err'), lang($this->name)));\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\te(lang(\"you_not_logged_in\"));\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\te(sprintf(lang(\"obj_not_exists\"), lang($this->name)));\r\n\t\t}\r\n\t}", "function record_incident($tag,$email,$message){\n $query = \"INSERT INTO HISTORY (TIME,TAG,EMAIL,MESSAGE) VALUES (\" . time() . \",'\" . $tag . \"','\" . $email . \"','\" . $message . \"')\" ; \n if(!$this->query($query)) return false;\n return true;\t \n }", "function makeReport()\n {\n $records = $this->baseRecordType()->records();\n $report = new Report();\n $report->documentRevision()->associate($this);\n $report->report_type_sid = $this->sid;\n\n foreach ($records as $record) {\n try {\n $recordReport = $this->recordReport($record);\n } catch (ReportingException $e) {\n $titleMaker = new TitleMaker();\n throw new ReportingException(\"In record \" . $titleMaker->title($record) . \": \" . $e->getMessage(), 0, $e);\n }\n $report->setRecordReport($record->sid, $recordReport);\n }\n\n return $report;\n }", "function get_assesment_by_taker(){\n \n $assesm_db=$this->assesm_db;\n // query to read single record\n //It loads the data file and converts it to an array\n $assesm_data = file_get_contents($assesm_db);\n $assesm_json = json_decode($assesm_data, true);\n $assesm_found=null;\n if (count($assesm_json)>0){\n $taker=$this->taker;\n foreach ($assesm_json as $as_key => $as_value) {\n $assesment_id=$as_key;\n foreach ($as_value as $as_var => $as_dat) {\n if ($as_var==\"taker\" && $as_dat==$taker) {\n $assesm_found=$assesm_json[$assesment_id];\n } \n }\n }\n }\n \n // set values to object properties\n $this->session_id = $assesm_found['session_id'];\n $this->test = $assesm_found['test'];\n $this->taker = $assesm_found['taker'];\n }", "private function createRecordClass( $dbModel, $dbRecords, $dbDetailRecords = []) {\n foreach ($dbRecords as $dbRecord) {\n // var_dump($dbRecord);\n echo 'Nombre: ' . $dbRecord[\"name\"] . \"\\n\";\n\n /*\n Version Create - Find\n */\n try {\n\n $newModel = $dbModel::create(collect($dbRecord)->except($dbDetailRecords)->toArray());\n\n } catch (Spatie\\Permission\\Exceptions\\RoleAlreadyExists $ex) {\n echo $ex->getMessage();\n $newModel = $dbModel::findByName($dbRecord[\"name\"]);\n // dd(var_dump($newModel));\n }\n catch (Exception $ex) {\n echo $ex->getMessage() . \"\\n\";\n } finally {\n // dd(var_dump($newModel));\n /*\n * Process Detail Records set\n * \n */\n if (isset($newModel)) {\n // dd(var_dump($newModel));\n echo \"Role a procesar: \" . $newModel->name . \"\\n\";\n\n foreach ($dbDetailRecords as $dbDetailRecord) {\n echo var_dump($dbDetailRecord);\n if ( isset($dbRecord[$dbDetailRecord]) ) {\n // var_dump($dbRecord[$dbDetailRecord]);\n\n foreach ($dbRecord[$dbDetailRecord] as $dbDetail) {\n echo \"Assigning: \" . $dbDetail . \"\\n\";\n\n try {\n $newModel->givePermissionTo($dbDetail);\n } catch ( Spatie\\Permission\\Exceptions\\PermissionDoesNotExist $ex) {\n echo $ex->getMessage() . \"\\n\"; \n } catch ( Exception $ex) {\n echo $ex->getMessage() . \"\\n\";\n }\n\n }\n\n } \n }\n }\n }\n\n\n /*\n Version Find - Create\n Initial Seed most probable Create-Find is more appropiate\n */\n /*\n try {\n $newModel = $dbModel::findByName($dbRecord[\"name\"]);\n } catch (Exception $ex) {\n dd($ex->getMessage());\n\n $newModel = $dbModel::create(collect($dbRecord)->except($dbDetailRecords)->toArray());\n }\n */\n\n }\n }", "protected function getCollectedRecords() {}", "protected function getCollectedRecords() {}", "protected function getCollectedRecords() {}", "function game_ai_create_new_player() {\n global $game, $base_url, $ai_output;\n\n while (TRUE) {\n $num = mt_rand(0, 99999);\n $id_to_check = 'ai-' . $num;\n zg_ai_out(\"checking for existing player $id_to_check\");\n\n $sql = 'select id from users\n where phone_id = \"%s\";';\n $result = db_query($sql, $id_to_check);\n $item = db_fetch_object($result);\n\n if (empty($item)) {\n break;\n }\n }\n\n $uri = $base_url . \"/$game/home/$id_to_check\";\n zg_ai_out(\"phone_id $id_to_check not in use; URI is $uri\");\n $response = zg_ai_web_request($id_to_check, 'home');\n zg_ai_out($response);\n\n zg_ai_out('updating record to make this a ToxiCorp Employee');\n $sql = 'update users set username = \"%s\", fkey_neighborhoods_id = 75,\n fkey_values_id = 9, `values` = \"Goo\", meta = \"ai_minion\"\n where phone_id = \"%s\";';\n db_query($sql, \"TC Emp $num\", $id_to_check);\n $ai_bot = zg_fetch_user_by_id($id_to_check);\n // mail('[email protected]', 'ai trying to create a new player AGAIN', $ai_output);.\n zg_slack($ai_bot, 'bots', 'new bot creation', $ai_output);\n}", "public function createRecord();", "public function hasRecord() {}", "public function testIgnoredAgentSequence(): void\n {\n $agent = $this->agentFromConfigArray([\n ConfigKey::MONITORING_ENABLED => true,\n ConfigKey::LOG_LEVEL => LogLevel::DEBUG,\n ]);\n $agent->ignore();\n\n // Start a Parent Controller Span\n $agent->startSpan('Controller/Test');\n\n // Tag Whole Request\n $agent->tagRequest('uri', 'example.com/foo/bar.php');\n\n // Start a Child Span\n $span = $agent->startSpan('SQL/Query');\n\n $agent->changeRequestUri('new request URI');\n\n // Tag the span\n if ($span !== null) {\n $span->tag('sql.query', 'select * from foo');\n }\n\n // Finish Child Span\n $agent->stopSpan();\n\n // Stop Controller Span\n $agent->stopSpan();\n\n self::assertFalse($agent->send());\n\n self::assertTrue($this->logger->hasDebugThatContains('Not sending payload, request has been ignored'));\n }", "private function createNewAgent($email_address, $agent_name) {\n try {\n $stmt = StatTracker::db()->prepare(\"INSERT INTO Agent (`email`, `agent`) VALUES (?, ?) ON DUPLICATE KEY UPDATE agent = VALUES(agent);\");\n $stmt->execute(array($email_address, $agent_name));\n $stmt->closeCursor();\n }\n catch (PDOException $e) {\n // Failing to insert an auth code will cause a generic registration email to be sent to the user.\n error_log($e);\n }\n }", "function addNewAgentToDB($data) {\n\t\tprint \"<br/>\\$data: \";\n\t\tprint_r($data);\n\t\treturn insertDatatoBD(\"agents\", $data) ;\n\t}", "function insert_record($post_data)\n {\n if (isset($post_data[\"user_agent\"])) {\n $user_agent = $post_data[\"user_agent\"];\n if ($user_agent == \"\" or $user_agent == \" \") {\n $this->invalid_data_format('[{\"user_agent\":\"SIPAgent\"}]');\n return;\n }\n } else {\n $this->invalid_data_format('[{\"user_agent\":\"SIPAgent\"}]');\n return;\n }\n $db = new DB();\n $conn = $db->connect();\n if (empty($conn)) {\n $statusCode = 404;\n $this->setHttpHeaders(\"application/json\", $statusCode);\n $rows = array(\n 'error' => 'No databases found!'\n );\n $response = json_encode($rows);\n echo $response;\n return;\n } else {\n $statusCode = 200;\n }\n $stmt = $conn->prepare(\"call insert_user_agent(?)\");\n $stmt->bind_param('s', $user_agent);\n $stmt->execute();\n $result = $db->get_result($stmt);\n $conn->close();\n $rows = array();\n while ($r = array_shift($result)) {\n $rows[] = $r;\n }\n if ($rows == Null) {\n $statusCode = 409;\n $rows = array(\n array(\n 'error' => \"user_agent(\" . $user_agent . \") already exists in table or table doesn't exist\"\n )\n );\n }\n $this->setHttpHeaders(\"application/json\", $statusCode);\n $response = json_encode($rows[0]);\n echo $response;\n }", "private function writePerformers () {\n\t\t$GLOBALS[\"logger\"]->debug(\"writePerformers\");\n\t\tif ($this->performers != NULL) {\n\t\t\tforeach ($this->performers as $performer) {\n\t\t\t\t$GLOBALS[\"logger\"]->debug(\"Got a performer {$performer->id}\");\n\t\t\t\t// $performer is an Actor\n\t\t\t\t$newRec = ORM::for_table(self::REPTS_PERFS_TABLE)->create();\n\t\t\t\t$newRec->report_id = $this->id;\n\t\t\t\t$newRec->actor_id = $performer->id;\n\t\t\t\t$newRec->save();\n//\t\t\t\t$insstmt = \"INSERT INTO REPORTS_PERFORMERS (REPORT_ID, ACTOR_ID) \" .\n//\t\t\t\t\t\"VALUES ($rptid, $actid)\";\n\t\t\t}\n\t\t}\n\t}", "public function run()\n {\n foreach ($this->getAgencies() as $orgao) {\n Agency::firstOrCreate($orgao);\n }\n }", "public function addRecordSent($email_repetitive_sent, $new_record, $instrument, $alertid,$isRepeatInstrument,$repeat_instance,$event_id){\n $email_repetitive_sent_aux = $email_repetitive_sent;\n if(!empty($email_repetitive_sent)) {\n $found_new_instrument = true;\n foreach ($email_repetitive_sent as $sv_name => $survey_records) {\n if($sv_name == $instrument) {\n $found_new_instrument = false;\n $found_new_alert = true;\n foreach ($survey_records as $alert => $alert_value) {\n if ($alert == $alertid) {\n $found_new_alert = false;\n $found_new_record = true;\n $found_is_repeat = false;\n if(!empty($alert_value)){\n foreach ($alert_value as $sv_number => $survey_record) {\n if ($sv_number === \"repeat_instances\") {\n $found_is_repeat = true;\n if($isRepeatInstrument){\n foreach ($alert_value['repeat_instances'] as $survey_record_repeat =>$survey_instances){\n return $this->addArrayInfo(true,$email_repetitive_sent_aux,$instrument,$alertid,$new_record, $repeat_instance,$event_id);\n }\n }\n }else if($sv_number == $new_record){\n if($isRepeatInstrument){\n return $this->addArrayInfo(true,$email_repetitive_sent_aux,$instrument,$alertid,$new_record, $repeat_instance,$event_id);\n }else{\n if(is_array($survey_record)){\n return $this->addArrayInfo(false,$email_repetitive_sent_aux,$instrument,$alertid,$new_record, $repeat_instance,$event_id);\n }else{\n $event_array = array($event_id => $repeat_instance);\n $email_repetitive_sent_aux[$instrument][$alertid][$new_record] = $event_array;\n return $email_repetitive_sent_aux;\n }\n }\n\n }\n\n }\n }\n\n }\n }\n }\n }\n if($found_new_instrument){\n return $this->addJSONInfo($isRepeatInstrument,$email_repetitive_sent_aux,$instrument,$alertid,$new_record, $repeat_instance,$event_id,false);\n }else if($found_new_alert){\n return $this->addJSONInfo($isRepeatInstrument,$email_repetitive_sent_aux,$instrument,$alertid,$new_record, $repeat_instance,$event_id,false);\n }else if($found_new_record){\n return $this->addJSONInfo($isRepeatInstrument,$email_repetitive_sent_aux,$instrument,$alertid,$new_record, $repeat_instance,$event_id,$found_is_repeat);\n }else if(!$found_new_record && !$found_is_repeat){\n return $this->addJSONInfo($isRepeatInstrument,$email_repetitive_sent_aux,$instrument,$alertid,$new_record, $repeat_instance,$event_id,true);\n }\n return $email_repetitive_sent_aux;\n }else{\n return $this->addJSONInfo($isRepeatInstrument,$email_repetitive_sent_aux,$instrument,$alertid,$new_record, $repeat_instance,$event_id,false);\n }\n\n }", "public function testGetNumberOfRecordsWhenNoRecordsExist()\n {\n\n // Create exhibits.\n $neatline = $this->_createNeatline();\n\n // Check count.\n $this->assertEquals($neatline->getNumberOfRecords(), 0);\n\n }", "public function create_a_record()\n {\n // Add a record\n factory(Email::class, 1)->create();\n\n $this->assertCount(1, Email::all());\n }", "function EZRA_Status_By_BibRecord($bib) {\n if (! preg_match(\"/b/\",$bib)) { $bib = \"b\" .$bib; }\n $url = \"http://ezra.wittenberg.edu/record=\". substr($bib,0,8);\n if (! $file = fopen ($url,\"r\")) { print \"could not open file\"; }\n\n while (!(feof($file))) {\n $line = fgetss($file,1056);\n if (preg_match(\"/(AVAILABLE|MISSING|NEW BOOK SHELF|Recently Returned|EXTINCT|DUE\\s+[-\\d]+)/\", $line, $m)){\n $status = $m[1];\n }\n if (preg_match (\"/Connect to resource/\",$line,$m)) {\n // $856url = $m[1];\n $status = \"AVAILABLE ONLINE: $line\";\n } //end else if URL \n } //end while not EOF\n\n if ($status == \"EXTINCT\") {\n global $_SERVER;\n $env = print_r($_SERVER, TRUE);\n $message = \"There is an EXTINCT item from EZRA that appears in the AV search engine. It should be removed, and please get that record suppressed too.\\n\\n$env\";\n mail(\"[email protected]\",\"EXTINCT item visible in AV browse catalog\",$message);\n } // end if extinct item\n\n if (! $status) { $status = \"STATUS UNCERTAIN, <a href=\\\"$url\\\">PLEASE CHECK</a>\"; }\n return ($status);\n}", "function add_a_record()\n {\n /**\n * @var str IP Address for the A record\n * @var int TTL for the A record\n * @var str Hostname for the A record\n * @var str Regex to Validate IPv4 Addresses\n */\n $ip = Null;\n $ttl = Null;\n $host = Null;\n $hnregex = \"/(([a-zA-Z0-9](-*[a-zA-Z0-9]+)*).)+\" . $this->domainnames[$this->domain_id]['name'] . \"/\";\n $shnregex = \"/^(([a-zA-Z0-9](-*[a-zA-Z0-9]+)*).)/\";\n while (!is_string($ip)) {\n $ip = filter_var(readline(\"IP Address: \"), FILTER_VALIDATE_IP, FILTER_FLAG_IPV4);\n }\n while (!is_int($ttl)) {\n $ttl = filter_var(readline(\"TTL [300]: \"), FILTER_VALIDATE_INT);\n $ttl = (!is_bool($ttl)) ? $ttl : 300;\n }\n while (!is_string($host)) {\n $hosttmp = readline(\"Hostname for new A record: \");\n if (filter_var($hosttmp, FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => $hnregex)))) {\n $host = $hosttmp;\n } elseif (filter_var($hosttmp, FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => $shnregex)))) {\n $host = filter_var($hosttmp . \".\" . $this->domainnames[$this->domain_id]['name'], FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => $hnregex)));\n }\n }\n\n foreach ($this->domains as $d) {\n if ($d->name == $this->domainnames[$this->domain_id]['name']){\n $domain = $d;\n }\n }\n\n $record = array(\n 'name' => $host,\n 'type' => 'A',\n 'ttl' => $ttl,\n 'data' => $ip);\n\n printf(\"\\nYou would like to add the following record:\\n\");\n printf(\"Type: %s\\n\", $record['type']);\n printf(\"Name: %s\\n\", $record['name']);\n printf(\"IP: %s\\n\", $record['data']);\n printf(\"TTL: %s\\n\", $record['ttl']);\n\n $proceed = readline(\"Type \\\"Y\\\" or \\\"y\\\" to proceed: \");\n\n if (strtolower($proceed) === 'y') {\n $hostentry = $domain->record($record);\n try {\n $response = $hostentry->create();\n printf(\"Created!\\n\");\n } catch (Exception $e) {\n printf(\"%s\\n\", $e);\n }\n } else {\n printf(\"ABORTED!\\n\");\n }\n }", "public function createLeadOther(Request $request)\n {\n $role = Auth::user()->roleDetail('abbreviation');\n if ($role['abbreviation'] == 'EM' || $role['abbreviation'] == 'CO' || $role['abbreviation'] == 'AG' || $role['abbreviation'] == 'RP' || $role['abbreviation'] == 'SV') {\n $employee_id = new ObjectID(Auth::id());\n $LeadDetails = LeadDetails::where('active', 1)->where('employeeTabStatus', (int) 1)->whereNotNull('transferTo')->where(function ($q) use ($employee_id) {\n $q->where('transferTo', 'elemMatch', array('id' => $employee_id, 'status' => 'Transferred'))->orwhere('transferTo', 'elemMatch', array('id' => $employee_id, 'status' => 'Collected'));\n })->get();\n if (count($LeadDetails) >= 20) {\n return response()->json([\n 'success' => false,\n 'save_method' => '',\n 'next_location' => ''\n ]);\n }\n }\n $save_from = $request->input('save_from');\n $reference_number = $request->input('reference_number');\n $dispatch_type = $request->input('dispatch_type');\n\n $leadDetails = new LeadDetails();\n $pipelineItem = WorkTypeData::where('refereneceNumber', $reference_number)->first();\n $customer_name = $pipelineItem['customer']['name'];\n $customer_id = $pipelineItem['customer']['id'];\n $customerCode = $pipelineItem['customer']['customerCode'];\n\n $customer_object = new \\stdClass();\n $customer_object->id = new ObjectID($customer_id);\n $customer_object->name = $customer_name;\n $customer_object->recipientName = $customer_name;\n $customer_object->customerCode = $customerCode;\n $leadDetails->customer = $customer_object;\n $leadDetails->saveType = 'customer';\n\n\n $agentId = $pipelineItem['agent']['id'];\n $agent = User::find($agentId);\n $agentObject = new \\stdClass();\n $agentObject->id = new ObjectID($request->input('agent'));\n $agentObject->name = $agent->name;\n $leadDetails->agent = $agentObject;\n\n $casemanagerId = $pipelineItem['caseManager']['id'];\n $caseManager = User::find($casemanagerId);\n $caseManagerObject = new \\stdClass();\n $caseManagerObject->id = new ObjectID($request->input('caseManager'));\n $caseManagerObject->name = $caseManager->name;\n $leadDetails->caseManager = $caseManagerObject;\n\n $dispatchType = DispatchTypes::where('type', $dispatch_type)->first();\n $dispatchTypeObject = new \\stdClass();\n $dispatchTypeObject->id = new ObjectID($dispatchType->_id);\n $dispatchTypeObject->dispatchType = $dispatchType->type;\n $dispatchTypeObject->code = $dispatchType->code;\n $leadDetails->dispatchType = $dispatchTypeObject;\n $leadDetails->active = (int) 1;\n $customer = Customer::find($customer_id);\n $leadDetails->contactEmail = $customer->email[0];\n $leadDetails->contactNumber = $customer->contactNumber[0];\n\n\n $Date = date('d/m/y');\n $splted_date = explode('/', $Date);\n $currentdate = implode($splted_date);\n date_default_timezone_set('Asia/Dubai');\n $time = date('His');\n $count = LeadDetails::where('referenceNumber', 'like', '%' . $currentdate . '%')->count();\n $newCount = $count + 1;\n if ($newCount < 10) {\n $newCount = '0' . $newCount;\n }\n $refNumber = $dispatchTypeObject->code . \"/\" . $currentdate . \"/\" . $time . \"/\" . $newCount;\n $leadDetails->referenceNumber = (string) $refNumber;\n\n $createdBy_obj = new \\stdClass();\n $createdBy_obj->id = new ObjectID(Auth::id());\n $createdBy_obj->name = Auth::user()->name;\n $createdBy_obj->date = date('d/m/Y');\n $createdBy_obj->action = \"Lead Created\";\n $createdBy[] = $createdBy_obj;\n $leadDetails->createdBy = $createdBy;\n\n $leadDetails->other_id = new ObjectID($pipelineItem->_id);\n $leadDetails->saveFrom = $save_from;\n if ($dispatchType->type == 'Direct Collections' || $dispatchType->type == 'Direct Delivery') {\n $leadDetails->dispatchStatus = 'Reception';\n $next_location = 'go_reception';\n } else {\n $leadDetails->dispatchStatus = 'Lead';\n $next_location = 'go_lead';\n }\n $leadDetails->save();\n if ($next_location == 'go_lead') {\n $this->saveTabStatus($leadDetails->_id);\n } else {\n if ($next_location == 'go_reception') {\n $this->saveDirectTabStatus($leadDetails->_id);\n }\n }\n Session::flash('status', 'Lead created successfully');\n\n return response()->json([\n 'success' => true,\n 'save_method' => $save_from,\n 'next_location' => $next_location\n ]);\n }", "function getMissing() {\n\t\t$articleDao =& \\DAORegistry::getDAO('ArticleDAO');\n\t\t$sql = \"SELECT * FROM articles WHERE pages like '%#DFM'\";\n\t\t$blub = $articleDao->retrieve($sql);\n\t\t$result = new \\DAOResultFactory($blub, $this, '_dummy');\n\t\t$result = $result->toArray();\n\t\tforeach ($result as $record) {\n\t\t\t$this->getArticleGalleys($record['article_id']);\n\t\t}\n\t}", "protected function createEntity()\n {\n return (new LogRecord());\n }", "public function findRecords()\n {\n $this->MissingFiles->findRecords();\n\n return true;\n }", "function noVideoIfNoAirings($params) {\n extract($params);\n $refine_params['where'] = $where;\n $airing_info = getAiringInfoById($airing_id, $refine_params);\n return $airing_info;\n}", "private function check_if_citation_exists_create_export_if_not($rec)\n {\n $t_source = $rec['trait.source'];\n $t_citation = $rec['trait.citation'];\n\n if(preg_match(\"/wikidata.org\\/entity\\/(.*?)elix/ims\", $t_source.\"elix\", $arr)) return $arr[1]; //is WikiData entity\n elseif(preg_match(\"/wikidata.org\\/wiki\\/(.*?)elix/ims\", $t_source.\"elix\", $arr)) return $arr[1]; //is WikiData entity\n elseif(stripos($t_source, \"/doi.org/\") !== false) { //string is found //https://doi.org/10.1002/ajpa.20957 //is DOI\n if($val = self::get_WD_entityID_for_DOI($t_source)) return $val;\n else { //has DOI no WikiData yet\n echo \"\\n---------------------\\n\"; print_r($rec);\n echo \"\\nhas DOI but not in WikiData yet 222\\n\";\n echo \"\\n---------------------\\n\";\n self::create_WD_for_citation($t_citation, $t_source, 3);\n exit(\"\\nelix1\\n\");\n }\n }\n else { // e.g. trait.source = \"http://reflora.jbrj.gov.br/reflora/floradobrasil/FB104295\"\n self::create_WD_for_citation($t_citation, $t_source, 4);\n exit(\"\\nelix2\\n\");\n }\n }", "function regParticipant($eventId, $participantName, $ward, $participantDOB, $participantAge, $shirtSize, $email, $primTel, $primTelType, $secTel, $secTelType, $participantAddress, $participantCity, $participantState, $emergencyContact, $emerPrimTel, $emerPrimTelType, $emerSecTel, $emerSecTelType, $specialDiet, $specialDietTxt, $allergies, $allergiesTxt, $medication, $selfMedicate, $medicationList, $chronicIllness, $chronicIllnessTxt, $serious, $seriousTxt, $limitations, $considerations, $adult, $contact, $permission, $responsibility, $participantESig, $participantSigDate, $guardianESig, $guardianSigDate, $leader){\n try {\n // Create a connection object using the phpmotors connection function\n $db = hhConnect();\n\n $hostname = gethostname();\n\n // The SQL statement\n $sql = \n 'INSERT INTO hhstake.registrants (event_id, p_name, p_ward, p_dob, p_age, p_shirt_size, email, tele_one, tele_one_type, tele_two, tele_two_type, p_address, p_city, p_state, emer_name, emer_tele_one, emer_tele_one_type, emer_tele_two, emer_tele_two_type, diet, diet_txt, allergies, allergies_txt, medication, self_medicate, medication_txt, chronic, chronic_txt, serious, serious_txt, limitations_txt, considerations_txt, adult, contact, permission, responsibility, p_esig, p_esig_date, g_esig, g_esig_date, userhost, is_graduated)\n VALUES (:eventId, :participantName, :ward, :participantDOB, :participantAge, :shirtSize, :email, :primTel, :primTelType, :secTel, :secTelType, :participantAddress, :participantCity, :participantState, :emergencyContact, :emerPrimTel, :emerPrimTelType, :emerSecTel, :emerSecTelType, :specialDiet, :specialDietTxt, :allergies, :allergiesTxt, :medication, :selfMedicate, :medicationList, :chronicIllness, :chronicIllnessTxt, :serious, :seriousTxt, :limitations, :considerations, :adult, :contact, :permission, :responsibility, :participantESig, :participantSigDate, :guardianESig, :guardianSigDate, :userhost, :leader)\n RETURNING id';\n\n $db->beginTransaction();\n\n // create large object\n $pESigData = $db->pgsqlLOBCreate();\n $stream = $db->pgsqlLOBOpen($pESigData, 'w');\n \n // read data from the file and copy the the stream\n $fh = fopen($participantESig, 'rb');\n stream_copy_to_stream($fh, $stream);\n //\n $fh = null;\n $stream = null;\n\n // create large object\n $gESigData = $db->pgsqlLOBCreate();\n $stream = $db->pgsqlLOBOpen($gESigData, 'w');\n \n // read data from the file and copy the the stream\n $fh = fopen($guardianESig, 'rb');\n stream_copy_to_stream($fh, $stream);\n //\n $fh = null;\n $stream = null;\n\n // Create the prepared statement using the phpmotors connection\n $stmt = $db->prepare($sql);\n // Build var array\n \n $sqlVarArray = array(\n ':eventId' => $eventId,\n ':participantName' => $participantName,\n ':ward' => $ward,\n ':participantDOB' => $participantDOB,\n ':participantAge' => $participantAge,\n ':shirtSize' => $shirtSize, \n ':email' => $email,\n ':primTel' => $primTel,\n ':primTelType' => $primTelType,\n ':secTel' => $secTel,\n ':secTelType' => $secTelType,\n ':participantAddress' => $participantAddress,\n ':participantCity' => $participantCity,\n ':participantState' => $participantState,\n ':emergencyContact' => $emergencyContact,\n ':emerPrimTel' => $emerPrimTel,\n ':emerPrimTelType' => $emerPrimTelType,\n ':emerSecTel' => $emerSecTel,\n ':emerSecTelType' => $emerSecTelType,\n ':specialDiet' => $specialDiet,\n ':specialDietTxt' => $specialDietTxt,\n ':allergies' => $allergies,\n ':allergiesTxt' => $allergiesTxt,\n ':medication' => $medication,\n ':selfMedicate' => $selfMedicate,\n ':medicationList' => $medicationList,\n ':chronicIllness' => $chronicIllness,\n ':chronicIllnessTxt' => $chronicIllnessTxt,\n ':serious' => $serious,\n ':seriousTxt' => $seriousTxt,\n ':limitations' => $limitations,\n ':considerations' => $considerations,\n ':adult' => $adult,\n ':contact' => $contact,\n ':permission' => $permission,\n ':responsibility' => $responsibility,\n ':participantESig' => $pESigData,\n ':participantSigDate' => $participantSigDate,\n ':guardianESig' => $gESigData,\n ':guardianSigDate' => $guardianSigDate,\n ':userhost' => $hostname,\n ':leader' => $leader\n );\n \n // Insert the data\n $stmt->execute($sqlVarArray);\n //$stmt->execute();\n \n // Ask how many rows changed as a result of our insert\n $regResults = $stmt->fetchAll();\n if (count($regResults === 0)){\n $regId = $regResults[0]['id']; \n } else {\n $regId = NULL;\n }\n\n // commit the transaction\n $db->commit();\n \n // Close the database interaction\n $stmt->closeCursor();\n // Return the indication of success (rows changed)\n //return $regOutcome;\n return $regId;\n } catch(PDOException $ex) {\n echo $sql . \"<br>\" . $ex->getMessage();\n }\n}", "function record($REMOTE_ADDR,$ipLog)\n{\n $log=fopen(\"$ipLog\", \"a+\");\n fputs ($log,$REMOTE_ADDR.\"][\".time().\"\\n\");\n fclose($log);\n\nif(isset($_POST['ask'])&&($_POST['ask']==\"worker\")){\n $worker = htmlspecialchars($_POST[ask]);\n $query= \"INSERT INTO golosovanie (worker,s1) values('1', 'Y')\";\n //$query= \"UPDATE users SET wor='$cenmagaz' WHERE id='\".$_SESSION[auth][id].\"'\";\n $result =mysql_query($query);\n header(\"Location: index.php?op=showmode\");\n exit;\n }else{\n header(\"Location: index.php\");\n\n }\n if(isset($_POST['ask'])&&($_POST['ask']==\"gosslug\")){\n $gosslug = htmlspecialchars($_POST[ask]);\n $query= \"INSERT INTO golosovanie (gosslug,s2) values('1', 'Y')\";\n //$query= \"UPDATE users SET wor='$cenmagaz' WHERE id='\".$_SESSION[auth][id].\"'\";\n $result =mysql_query($query);\n header(\"Location: index.php?op=showmode\");\n exit;\n }else{\n header(\"Location: index.php\");\n }\n if(isset($_POST['ask'])&&($_POST['ask']==\"manager\")){\n $manager = htmlspecialchars($_POST[ask]);\n $query= \"INSERT INTO golosovanie (manager,s3) values('1', 'Y')\";\n //$query= \"UPDATE users SET wor='$cenmagaz' WHERE id='\".$_SESSION[auth][id].\"'\";\n $result =mysql_query($query);\n header(\"Location: index.php?op=showmode\");\n exit;\n }else{\n header(\"Location: index.php\");\n }\n\n if(isset($_POST['ask'])&&($_POST['ask']==\"student\")){\n $student = htmlspecialchars($_POST[ask]);\n $query= \"INSERT INTO golosovanie (student,s4) values('1', 'Y')\";\n //$query= \"UPDATE users SET wor='$cenmagaz' WHERE id='\".$_SESSION[auth][id].\"'\";\n $result =mysql_query($query);\n header(\"Location: index.php?op=showmode\");\n exit;\n }else{\n header(\"Location: index.php\");\n }\n\n if(isset($_POST['ask'])&&($_POST['ask']==\"director\")){\n $director = htmlspecialchars($_POST[ask]);\n $query= \"INSERT INTO golosovanie (director,s5) values('1', 'Y')\";\n //$query= \"UPDATE users SET wor='$cenmagaz' WHERE id='\".$_SESSION[auth][id].\"'\";\n $result =mysql_query($query);\n header(\"Location: index.php?op=showmode\");\n exit;\n }else{\n header(\"Location: index.php\");\n }\n if(isset($_POST['ask'])&&($_POST['ask']==\"other\")){\n $other = htmlspecialchars($_POST[ask]);\n $query= \"INSERT INTO golosovanie (other,s6) values('1', 'Y')\";\n //$query= \"UPDATE users SET wor='$cenmagaz' WHERE id='\".$_SESSION[auth][id].\"'\";\n $result =mysql_query($query);\n header(\"Location: index.php?op=showmode\");\n exit;\n }else{\n header(\"Location: index.php\");\n }\n }", "function insert_found_record($dbc, $finder, $item_name, $description, $location_id, $create_date) {\n\t$query = 'INSERT INTO stuff(finder, item_name, description, location_id, create_date, status) VALUES (\"'.$finder.'\" ,\"'.$item_name.'\", \"'.$description.'\", \"'.$location_id.'\", \"'.$create_date.'\", \"found\")' ;\n show_query($query);\n\n $results = mysqli_query($dbc,$query) ;\n check_results($results) ;\n\n return $results ;\n \n echo '<p> Your submission was successful!</p>' ;\n}", "private function createRecords(){\r\n\t\t\r\n\t\t$fileNames = explode(',', $this->collection['images']);\r\n\t\t\r\n\t\tforeach($fileNames as $fileName){\r\n\t\t\t\t\r\n\t\t\tif(trim($fileName) && !isset($this->images[$fileName])){\r\n\t\t\t\t\r\n\t\t\t\t$newRecord = array(\r\n\t\t\t\t\t'pid' => $this->collection['pid'],\r\n\t\t\t\t\t'collection' => $this->collection['uid'],\r\n\t\t\t\t\t'crdate' => time(),\r\n\t\t\t\t\t'cruser_id' => $this->collection['cruser_id'],\r\n\t\t\t\t\t'image' => $fileName,\r\n\t\t\t\t\t'title' => $this->getTitleFromName($fileName)\r\n\t\t\t\t);\r\n\t\t\t\t$this->db->exec_INSERTquery('tx_gorillary_images', $newRecord);\r\n\t\t\t\t$newRecord['uid'] = $this->db->sql_insert_id();\r\n\t\t\t\t$this->images[$fileName] = $newRecord;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t}", "function findNew();", "function LancerNouveauRetour($BonID,$articles,$OtID){\n // un objet contient les deux colones : article_id et qtear\n $success=true;\n $UserID = JWTAuth::user()->id;\n $di_bon_retour=prev_bon_retour::create([\n 'bonp_id' => $BonID,\n 'otp_id'=>$OtID,\n 'user_id'=>$UserID\n ]);\n if(!$di_bon_retour){$success=false;}\n $RetourID=$di_bon_retour->RetourID;\n \n foreach($articles as $article){\n if($article->qtear>0){\n $di_bon_retour_det=prev_bon_retour_det::create([\n 'retour_id' => $RetourID,\n 'article_id' => $article->article_id,\n 'qtear' => $article->qtear,\n 'qter' => null\n ]); \n\n if(!$di_bon_retour_det){$success=false;}\n }\n }\n if($success){return $RetourID;}else{return false;}\n }", "function get_or_create_candidate_from_nom($nom, $prenom)\n{\n\ttry\n\t{\n\n\t\tmysql_query(\"LOCK TABLES \".people_db.\" WRITE;\");\n\n\n\t\t$sql = \"SELECT * FROM \".people_db.' WHERE nom=\"'.$nom.'\" AND prenom=\"'.$prenom.'\" ;';\n\n\t\t$result = sql_request($sql);\n\n\t\t$cdata = mysql_fetch_object($result);\n\t\tif($cdata == false)\n\t\t{\n\t\t\t$data = (object) array();\n\t\t\t$data->nom = $nom;\n\t\t\t$data->prenom = $prenom;\n\t\t\tadd_candidate_to_database($data);\n\t\t\t$result = sql_request($sql);\n\t\t\t$cdata = mysql_fetch_object($result);\n\t\t\tif($cdata == false)\n\t\t\t\tthrow new Exception(\"Failed to find candidate previously added<br/>\".$sql);\n\t\t}\n\n\t\tmysql_query(\"UNLOCK TABLES\");\n\t\treturn normalizeCandidat($cdata);\n\t}\n\tcatch(Exception $exc)\n\t{\n\t\tmysql_query(\"UNLOCK TABLES;\");\n\t\tthrow new Exception(\"Failed to add candidate from report:<br/>\".$exc->getMessage());\n\t}\n}", "private function _seen()\n {\n $nick = str_replace(array(\"!seen \", \"!seen\"), \"\", $this->_data->message);\n \n if (trim($nick) == '')\n return;\n \n $dbh = $this->_connectToDb();\n \n $stmt = $dbh->query(\"SELECT * FROM log_table WHERE channel = '\". $this->_data->channel .\"' AND LOWER(nick) = '\". strtolower(trim($nick)) .\"' ORDER BY id DESC LIMIT 1\");\n \n $row = $stmt->fetch(PDO::FETCH_OBJ);\n\n if (isset($row->when)) {\n $this->_message($this->_data->nick.': I last saw '. trim($nick) .' at '. $row->when .' saying \"'. trim($row->said) .'\"'); \n }\n else {\n $this->_message($this->_data->nick.': I\\'ve never seen '. trim($nick));\n }\n \n \n }", "public function existNoReturned(){\r\n $docs=ClientSDocs::where('projectclientservices_id',$this->id)->where('file_id',-1) ->get();\r\n if($docs!=null){\r\n foreach($docs as $doc)\r\n if($doc->notes_resend==\"\")\r\n return true;\r\n }\r\n return false;\r\n }", "private function saveMatchListMatches() {\n $matches = json_decode($this->matches, true);\n forEach($matches as $match_entry) {\n try {\n $matchFromDatabase = Match::where('gameId', (string)$match_entry['gameId'])->firstOrFail();\n } catch (ModelNotFoundException $e) {\n $apiMatch = $this->api->getMatch($match_entry['gameId'], false);\n\n $newMatch = new Match;\n $newMatch->seasonId = (isset($apiMatch['seasonId']) ? $apiMatch['seasonId'] : '');\n $newMatch->queueId = (isset($apiMatch['queueId']) ? $apiMatch['queueId'] : '');\n $newMatch->gameId = (string)$match_entry['gameId'];\n // make the participant identities\n forEach($apiMatch['participantIdentities'] as $pId) {\n if ($pId['player']['accountId'] != 0) {\n try {\n $findParticipantIdentity = MatchParticipantIdentities::where('matchId', (string)$match_entry['gameId'])->where('accountId', $pId['player']['currentAccountId'])->firstOrFail();\n } catch (ModelNotFoundException $pie) {\n $newPId = new MatchParticipantIdentities;\n $newPId->matchId = (string)$match_entry['gameId'];\n $newPId->currentPlatformId = (isset($pId['player']['currentPlatformId']) ? $pId['player']['currentPlatformId'] : '');\n $newPId->summonerName = $pId['player']['summonerName'];\n $newPId->matchHistoryUri = (isset($pId['player']['matchHistoryUri']) ? $pId['player']['matchHistoryUri'] : '');\n $newPId->platformId = (isset($pId['player']['platformId']) ? $pId['player']['platformId'] : '');\n $newPId->currentAccountId = $pId['player']['currentAccountId'];\n $newPId->profileIcon = (isset($pId['player']['profileIcon']));\n $newPId->summonerId = $pId['player']['summonerId'];\n $newPId->accountId = $pId['player']['accountId'];\n $newPId->participantId = (isset($pId['participantId']) ? $pId['participantId'] : '');\n $newPId->save();\n }\n }\n }\n\n $newMatch->gameVersion = (isset($apiMatch['gameVersion']) ? $apiMatch['gameVersion'] : '');\n $newMatch->platformId = (isset($apiMatch['platformId']) ? $apiMatch['platformId'] : '');\n $newMatch->gameMode = $apiMatch['gameMode'];\n $newMatch->mapId = $apiMatch['mapId'];\n $newMatch->gameType = $apiMatch['gameType'];\n // make the teams\n forEach($apiMatch['teams'] as $team) {\n $newTeam = new MatchTeam;\n $newTeam->matchId = (string)$match_entry['gameId'];\n $newTeam->firstDragon = (isset($team['firstDragon']) ? $team['firstDragon'] : '');\n $newTeam->bans = (isset($team['bans']) ? json_encode($team['bans']) : '');\n $newTeam->win = (isset($team['win']) ? $team['win'] : '');\n $newTeam->firstRiftHerald = (isset($team['firstRiftHerald']) ? $team['firstRiftHerald'] : '');\n $newTeam->firstBaron = (isset($team['firstBaron']) ? $team['firstBaron'] : '');\n $newTeam->firstInhibitor = (isset($team['firstInhibitor']) ? $team['firstInhibitor'] : '');\n $newTeam->baronKills = (isset($team['baronKills']) ? $team['baronKills'] : '');\n $newTeam->riftHeraldKills = (isset($team['riftHeraldKills']) ? $team['riftHeraldKills'] : '');\n $newTeam->firstBlood = $team['firstBlood'];\n $newTeam->teamId = $team['teamId'];\n $newTeam->firstTower = (isset($team['firstTower']) ? $team['firstTower'] : '');\n $newTeam->vilemawKills = (isset($team['vilemawKills']) ? $team['vilemawKills'] : '');\n $newTeam->inhibitorKills = (isset($team['inhibitorKills']) ? $team['inhibitorKills'] : '');\n $newTeam->towerKills = (isset($team['towerKills']) ? $team['towerKills'] : '');\n $newTeam->dominionVictoryScore = (isset($team['dominionVictoryScore']) ? $team['dominionVictoryScore'] : '');\n $newTeam->dragonKills = (isset($team['dragonKills']) ? $team['dragonKills'] : '');\n $newTeam->save();\n }\n // make the participants\n forEach($apiMatch['participants'] as $participant) {\n $newParticipant = new MatchParticipant;\n $newParticipant->matchId = (string)$match_entry['gameId'];\n $newParticipant->stats = json_encode($participant['stats']);\n $newParticipant->runes = (isset($participant['runes']) ? json_encode($participant['runes']) : '');\n $newParticipant->masteries = (isset($participant['masteries']) ? json_encode($participant['masteries']) : '');\n $newParticipant->timeline = (isset($participant['timeline']) ? json_encode($participant['timeline']) : '');\n $newParticipant->spell1Id = (isset($participant['spell1Id']) ? $participant['spell1Id'] : '');\n $newParticipant->spell2Id = (isset($participant['spell2Id']) ? $participant['spell2Id'] : '');\n $newParticipant->participantId = $participant['participantId'];\n $newParticipant->highestAchievedSeasonTier = (isset($participant['highestAchievedSeasonTier']) ? $participant['highestAchievedSeasonTier'] : '');\n $newParticipant->teamId = $participant['teamId'];\n $newParticipant->championId = $participant['championId'];\n $newParticipant->save();\n }\n $newMatch->gameDuration = $apiMatch['gameDuration'];\n $newMatch->gameCreation = (string)$apiMatch['gameCreation'];\n $newMatch->save();\n }\n }\n }", "public function create() {\n // Create a new Match\n $create = $this->match->createMatch();\n\n // If has an error\n if(array_key_exists('error', $create)) {\n throw new \\Exception('create error: ' . $create['error']);\n }\n\n return response()->json($this->listMatches());\n }", "function nycc_rides_report_leaders() {\r\n $sql = array();\r\n $sql['query'] = \"SELECT np.title AS name, np.nid, count(*) AS cnt FROM node np, content_type_rides r, content_field_ride_leaders l, node nr WHERE l.field_ride_leaders_nid = np.nid AND np.type='profile' AND l.nid = r.nid AND l.vid = r.vid AND np.status <> 0 AND nr.nid = r.nid AND nr.vid = r.vid AND nr.status <> 0 \";\r\n\r\n $sql['count'] = \"SELECT COUNT(DISTINCT np.title) AS cnt FROM node np, content_type_rides r, content_field_ride_leaders l, node nr WHERE l.field_ride_leaders_nid = np.nid AND np.type='profile' AND l.nid = r.nid AND l.vid = r.vid AND np.status <> 0 AND nr.nid = r.nid AND nr.vid = r.vid AND nr.status <> 0 \";\r\n\r\n return nycc_rides_report(\"Ride Reports: Leaders\", $sql, nycc_rides_report_rides_header_1(), 'nycc_rides_report_rides_process_row_1', 1);\r\n}", "public function run()\n {\n if(DB::table('agents')->count() == 0) {\n DB::table('agents')->insert([\n\n 'nom' =>'Lekhal',\n 'prenom' => 'Maha',\n 'sexe'=>'Femme',\n 'user_id' => 1,\n 'poste_id' =>1,\n 'updated_at'=>now(),\n 'created_at' => now()\n \n \n \n ]);\n }\n }", "protected function analyze()\n {\n foreach($this->_importedFile['graph']['node'] as $node) {\n $entity = $node['data'][0]['MaltegoEntity'];\n\n switch($entity['@attributes']['type']) {\n case \"maltego.DNSName\":\n $this->_findings['websites'][] = $entity['Properties']['Property']['Value'];\n break;\n case \"maltego.Website\":\n $this->_findings['websites'][] = $entity['Properties']['Property'][0]['Value'];\n break;\n case \"maltego.Domain\":\n $this->_findings['websites'][] = $entity['Properties']['Property'][0]['Value'];\n break;\n case \"maltego.EmailAddress\":\n $email = $entity['Properties']['Property'][0]['Value'];\n if (filter_var($email, FILTER_VALIDATE_EMAIL)) {\n $this->_findings['emails'][] = $email;\n }\n break;\n }\n }\n }", "public function store_agent(Request $request)\n {\n $validatedData = $request->validate([\n 'fullname' => ['required', 'max:50'],\n 'username' => ['required', 'max:50'],\n 'phone_number' => ['required', 'max:20'],\n 'email' => ['required', 'unique:users'],\n 'state' => ['required', 'exists:states,id'],\n 'area' => ['required', 'exists:areas,id'],\n 'account_type' => ['required', 'max:100'],\n 'image' => ['required', 'mimes:jpeg,jpg,png'],\n 'cv' => ['required', 'mimes:doc,docx,pdf'],\n 'password' => ['required', 'confirmed'],\n ]);\n\n \n $fullname = $request->fullname;\n $username = $request->username;\n $phone_number = $request->phone_number;\n $email = $request->email;\n $state_id = $request->state;\n $area_id = $request->area;\n $account_type = $request->account_type;\n $password = $request->password;\n \n \n $agent = new User();\n $agent->fullname = $fullname;\n $agent->username = $username;\n $agent->phone_number = $phone_number;\n $agent->email = $email;\n $agent->email_verified_at = now();\n $agent->role = 'agent';\n $agent->password = Hash::make($password);\n \n if($agent->save()) {\n\n // save agent address\n $agent->addresses()->create([\n 'state_id' => $state_id,\n 'area_id' => $area_id,\n 'account_type' => $account_type\n ]);\n \n // upload cv and save agent details\n if ($request->hasFile('cv')) { // check if file is available for upload\n $path = $request->cv->store('public/uploads/agents/docs/cvs');\n if($path) {\n $cv_name = basename($path);\n $agent->agent_detail()->create(['cv_name' => $cv_name]);\n }\n }\n\n //upload profile image\n $image = $request->image;\n if ($request->hasFile('image')) { // check if file is available for upload\n \n $image = $request->image;\n $image_name = $request->image->getClientOriginalName();\n $image_extension = $image->extension();\n $gen_image_name = md5(now() . 'logo_name' . $image_name);\n $new_image_name = $gen_image_name . '.' . $image_extension;\n $fited_image = Image::make($image ->getRealPath())->fit(300, 300);\n $save_image = $fited_image->save('storage/uploads/agents/images/profile_photos/' . $new_image_name, 60); //save image to server\n\n if($save_image) {\n $agent->images()->create(['name' => $new_image_name]);\n }\n }\n \n return redirect()->back()->with([\n 'message' => 'New Agent has been saved.',\n 'type' => 'success'\n ]);\n\n }\n\n return redirect()->back()->with([\n 'message' => 'Agent was not save, there was an error while try to save it',\n 'type' => 'fail'\n ]);\n }", "public function save(){\n\t\t$db = new Database();\n\n\t\t$reportInDB = isset($this->id);\n\n\t\tif($reportInDB === false){ //new report\n\t\t\t$sql = \"INSERT INTO `reports`(`description`, `involvementKindID`, `reportKindID`, `locationID`, `personID`, `departmentID`, `dateTime`,`statusID`,`actionTaken`, `photoPath`) VALUES(?,?,?,?,?,?,?,?,?,?)\";\n\t\t\t$sql = $db->prepareQuery($sql, $this->description, $this->involvementKindID, $this->reportKindID, $this->locationID, $this->personID, $this->departmentID, $this->dateTime, $this->statusID, $this->actionTaken, $this->photoPath);\n\t\t\t$db->query($sql);\n\n\t\t\t//get id of new Report\n\t\t\t$reportInDB = Report::reportExists($this->personID, $this->dateTime);\n\t\t\tif($reportInDB != false){\n\t\t\t\t$this->id = $reportInDB;\n\t\t\t} else return false;\n\t\t} else { //old report\n\t\t\tif(is_null($this->id)){ //old report, new object. no local id yet\n\t\t\t\t$this->id = $reportInDB;\n\t\t\t}\n\n\t\t\t$sql = \"UPDATE reports SET `description`=?, `involvementKindID`=?, `reportKindID`=?, `locationID`=?, `personID`=?, `departmentID`=?, `dateTime`=?, `statusID`=?, `actionTaken`=?, `photoPath`=? WHERE id=?\";\n\t\t\t$sql = $db->prepareQuery($sql, $this->description, $this->involvementKindID, $this->reportKindID, $this->locationID, $this->personID, $this->departmentID, $this->dateTime, $this->statusID, $this->actionTaken, $this->photoPath, $this->id);\n\t\t\t$db->query($sql);\n\t\t}\n\t}", "function createPersona()\n {\n return isset($this->source['persona']) && $this->source['persona'] ? $this->source['persona'] : null;\n }", "public function agent_add() {\n\n\n\t\t$post = $this->input->post();\n \n $this->form_validation->set_rules('agent', 'agent' , 'required|is_unique[agent.agent]');\n $this->form_validation->set_error_delimiters('<span class=\"text-danger\">','</span>');\n\n\t\tif(!empty($post) && $this->form_validation->run() ==FALSE) {\n\t\t\t \n\t\t\t $this->session->set_flashdata('error', 'Validation error. Please check the form.');\n\t\t\t $this->load->model('Datype_model');\n\t\t\t\t$data[\"admins\"] = $this->Datype_model->getAgent();\n\t\t\t\t$this->load->view('header');\n\t\t\t\t$this->load->view('masters/agent', $data);\n\t\t\t\t$this->load->view('footer');\n \n\t\t} else {\n \n\t\t\t$table_array = array ('agent' => $post['agent']);\n\t\t\t$this->db->insert('agent' , $table_array);\n\t\t\t$inserted = $this->db->insert_id();\n\t\t\tif(!empty($inserted)) {\n\t\t\t\t$this->session->set_flashdata('success', 'Agent added Successfully!.');\n\t\t\t\treturn redirect(base_url().'masters/agent');\n\t\t\t} else {\n\t\t\t\t$this->session->set_flashdata('error', 'Technical error!.');\n\t\t\t\treturn redirect(base_url().'masters/agent');\n\t\t\t}\n\t\t}\n\t\t\n\t}", "public function test_add_new_talkpoint_to_non_existent_activity() {\n $client = new Client($this->_app);\n $client->request('GET', '/999/add');\n }", "public function test_save_does_not_exist() {\n $this->loadDataSet($this->createArrayDataSet(array(\n 'dragdrop_sentence' => array(\n array('id', 'mark', 'instanceid', 'timecreated', 'timemodified'),\n array(1, 20, 13, $this->_now, $this->_now),\n array(2, 20, 13, $this->_now, $this->_now)\n ))\n ));\n $data = array();\n $this->_cut->save(13, $data, $this->_now + 1, 3);\n }", "public function createFundedLoanLendersRepaymentRecord()\n {\n if (!empty($this->current_loan_lender_schedule_ids)) {\n foreach($this->current_loan_lender_schedule_ids as $schedule_id) {\n $loan = array('loan_lender_repayments_schedule_id' => $schedule_id,\n 'amount' => $this->currentLoanRepaymentExpectedAmount\n );\n \n if(!$this->db->createLoanLenderRepayments($loan)) return false;\n }\n \n return true;\n }\n \n return false; // oops?\n }", "private function analyzeRecord($record) {\n\t\tif (! isset ( $this->recordNum )) {\n\t\t\t$this->recordNum = 0;\n\t\t\t$this->_phaseImport = new PhaseImport ();\n\t\t}\n\t\t\n\t\t// count records\n\t\t++ $this->recordNum;\n\t\t\n\t\t// echo \" recordNum = $this->recordNum <br/>\"; //debug\n\t\t\n\t\tif (! isset ( $this->_mission )) {\n\t\t\t// start a new mission\n\t\t\t$this->_mission = new TaxibotMission ();\n\t\t\t$startDateTime = $this->GetDateTimeFromCsvFormat ( $this->_currentRowDateTime );\n\t\t\t$this->_mission->setStartTime ( $startDateTime );\n\t\t\t$this->_mission->setBlfName($this->_blfName);\n\t\t\t$this->missionStarted ();\n\t\t}\n\t\t\n\t\t// mission non changing data : flight number, tail number, AC weight etc.\n\t\t$this->examineMissionData ( $record );\n\t\t\n\t\t// phase\n\t\t$this->_phaseImport->readRow ( $record, $this->_currentRowDateTime );\n\t\t\n\t\t// position\n\t\t$this->saveTrailPosition ( $record );\n\t\t\n\t\t// forces on Landing Gear\n\t\tif (isset ( $this->limitExceedImport )) {\n\t\t\t$this->limitExceedImport->readRowData ( $record, $this->_currentRowDateTime, $this->_lastLatitude, $this->_lastLongitude );\n\t\t}\n\t\t\n\t\t/* if($this->_phaseImport->veolcity != null){\n\t\t\tdd($this->_currentRowDateTime);\n\t\t} */\n\t\t\n\t\tif (isset ( $this->fatigueHistoryImport )) {\n\t\t\t$this->fatigueHistoryImport->readRowData ( $record, $this->_phaseImport->veolcity );\n\t\t}\n\t}", "protected function create(array $data)\n {\n\n return Agent::create([\n 'name' => $data['name'],\n 'email' => $data['email'],\n 'password' => Hash::make($data['password']),\n 'middlename' => $data['middlename'], \n 'lastname' => $data['lastname'], \n 'company_name' => $data['company_name'],\n 'socail_security_number' => $data['socail_security_number'], \n 'tax_id'=> $data['tax_id'], \n 'phone_number'=> $data['phone_number'],\n 'email2'=> $data['email2'],\n 'address'=> $data['address'],\n 'address2'=> $data['address2'],\n 'city'=> $data['city'],\n 'state'=> $data['state'],\n 'pincode'=> $data['pincode'],\n 'upline'=> $data['upline'],\n 'uplinetype'=>$data['uplinetype'],\n 'compensation'=>$data['compensation'],\n 'override'=>$data['compensation'],\n 'agentid'=> $data['agentid'],\n ]);\n }", "public function newRecord($data,$module=\"Leads\") {\r\n \r\n \r\n //if(count($data)&lt;=0)return \"\";\r\n $records = [];\r\n try{\r\n \r\n $record = ZCRMRecord::getInstance( $module, null );\r\n foreach($data as $d=>$v)\r\n $record->setFieldValue($d, $v);\r\n \r\n\r\n $records[] = $record;\r\n \r\n $zcrmModuleIns = ZCRMModule::getInstance($module);\r\n $bulkAPIResponse=$zcrmModuleIns->createRecords($records); // $recordsArray - array of ZCRMRecord instances filled with required data for creation.\r\n $entityResponses = $bulkAPIResponse->getEntityResponses();\r\n \r\n foreach($entityResponses as $entityResponse){\r\n if(\"success\"==$entityResponse->getStatus()){\r\n $createdRecordInstance=$entityResponse->getData();\r\n return $createdRecordInstance->getEntityId();\r\n \r\n }\r\n else{\r\n $file_names = __DIR__.\"/zoho_ERROR_ADDNEW_log.txt\";\r\n \t\t\t\t file_put_contents($file_names, (json_encode($entityResponses)).PHP_EOL , FILE_APPEND | LOCK_EX);\t\r\n \t\t\t\t return \"-1\";\r\n }\r\n }\r\n \r\n \r\n }catch(Exception $e){\r\n $file_names = __DIR__.\"/zoho_ERROR_ADDNEW_log.txt\";\r\n\t\t\t\t file_put_contents($file_names, $e.PHP_EOL , FILE_APPEND | LOCK_EX);\t\r\n return \"\";\r\n }\r\n \r\n \r\n }", "public function agentSaleList($id)\n {\n $report_info =array();\n $operator_id =$this->myGlob->operator_id;\n $agent_ids =$this->myGlob->agent_ids;\n $agopt_ids =$this->myGlob->agopt_ids;\n $operator_ids =array();\n if($agopt_ids){\n $operator_ids =$agopt_ids;\n }else{\n $operator_ids[] =$operator_id;\n }\n $agent_status=$agent_id =$id;\n $trips =Input::get('trips'); //for agent report or not\n $search=array();\n $search['agent_rp'] =1;\n\n $from =Input::get('from');\n $to =Input::get('to');\n\n $start_date =Input::get('start_date');\n $end_date =Input::get('end_date') ? Input::get('end_date') : $this->getDate();\n if($start_date){\n $start_date =str_replace('/', '-', $start_date);\n $start_date =date('Y-m-d', strtotime($start_date));\n $end_date =str_replace('/', '-', $end_date);\n $end_date =date('Y-m-d', strtotime($end_date));\n }else{\n $start_date=$this->getDate();\n $end_date=$this->getDate();\n }\n\n $departure_time =Input::get('departure_time');\n $departure_time =str_replace('-', ' ', $departure_time);\n\n $operator_id =$operator_id ? $operator_id : $this->myGlob->operator_id;\n\n if($from=='all')\n $from=0;\n\n $trip_ids=array();\n $sale_item=array();\n $order_ids=array();\n\n if($departure_time){\n $trip_ids=Trip::wherein('operator_id',$operator_ids)\n ->wheretime($departure_time)->lists('id');\n }else{\n $trip_ids=Trip::wherein('operator_id',$operator_ids)\n ->lists('id');\n }\n\n if($trip_ids)\n $order_ids=SaleItem::wherein('trip_id',$trip_ids)\n ->where('departure_date','>=',$start_date)\n ->where('departure_date','<=',$end_date)\n ->groupBy('order_id')->lists('order_id');\n\n if($order_ids)\n $order_ids=SaleOrder::wherein('id',$order_ids)->wherebooking(0)->lists('id');\n\n if($order_ids)\n { \n /******************************************************************************** \n * For agent report by agent group and branches OR don't have branch agent\n ***/\n $agentgroup_id =Input::get('agentgroup');\n if($agentgroup_id==\"All\")\n $agentgroup_id=0;\n $arr_agent_id =array();\n\n if($agentgroup_id && $agent_id)\n {\n $sale_item = SaleItem::wherein('order_id', $order_ids)\n ->selectRaw('order_id, count(*) as sold_seat, trip_id, price, foreign_price, departure_date, busoccurance_id, SUM(free_ticket) as free_ticket, agent_id')\n ->whereagent_id($agent_id)\n ->groupBy('order_id')->orderBy('departure_date','asc')->get(); \n }\n elseif(!$agentgroup_id && $agent_id)\n {\n $sale_item = SaleItem::wherein('order_id', $order_ids)\n ->selectRaw('order_id, count(*) as sold_seat, trip_id, price, foreign_price, departure_date, busoccurance_id, SUM(free_ticket) as free_ticket, agent_id')\n ->whereagent_id($agent_id)\n ->groupBy('order_id')->orderBy('departure_date','asc')->get();\n }\n elseif($agentgroup_id && !$agent_id)\n {\n $arr_agent_id=Agent::whereagentgroup_id($agentgroup_id)->lists('id');\n \n $order_ids2=array();\n if($arr_agent_id)\n $order_ids2=SaleItem::wherein('agent_id',$arr_agent_id)->where('departure_date','>=',$start_date)->where('departure_date','<=',$end_date)->groupBy('order_id')->lists('order_id');\n // for unique orderids for all agent branches\n $order_id_list=array_intersect($order_ids, $order_ids2);\n // dd($order_id_list);\n if($order_id_list)\n $sale_item = SaleItem::wherein('order_id', $order_id_list)\n ->selectRaw('order_id, count(*) as sold_seat, trip_id, price, foreign_price, departure_date, busoccurance_id, SUM(free_ticket) as free_ticket, agent_id')\n // ->whereagent_id($agent_id)\n ->groupBy('order_id')->orderBy('departure_date','asc')->get(); \n }\n /***\n * End For agent report by agent group and branches OR don't have branch agent\n *********************************************************************************/\n \n /******************************************************************* \n * for Trip report \n */\n else\n {\n $sale_item = SaleItem::wherein('order_id', $order_ids)\n ->selectRaw('order_id, count(*) as sold_seat, trip_id, price, foreign_price, departure_date, busoccurance_id, SUM(free_ticket) as free_ticket, agent_id')\n ->groupBy('order_id')->orderBy('departure_date','asc')->get();\n }\n\n }\n \n $lists = array();\n foreach ($sale_item as $rows) {\n $local_person = 0;\n $foreign_price = 0;\n $total_amount = 0;\n $commission=0;\n $percent_total=0;\n $trip = Trip::whereid($rows->trip_id)->first();\n $order_date=SaleOrder::whereid($rows->order_id)->pluck('orderdate');\n $list['order_date'] = $order_date;\n $list['order_id'] = $rows->order_id;\n // dd($rows->agent_id);\n $agent_name=Agent::whereid($rows->agent_id)->pluck('name');\n $list['agent_id']=$rows->agent_id ? $rows->agent_id : 0;\n $list['agent_name']=$agent_name ? $agent_name : \"-\";\n \n if($trip){\n $list['id'] = $rows->trip_id;\n $list['bus_id'] = $rows->busoccurance_id;\n $list['departure_date'] = $rows->departure_date;\n $list['from_id'] = $trip->from;\n $list['to_id'] = $trip->to;\n $list['from_to'] = City::whereid($trip->from)->pluck('name').'-'.City::whereid($trip->to)->pluck('name');\n $list['time'] = $trip->time;\n $list['class_id'] = $trip->class_id;\n $list['class_name'] = Classes::whereid($trip->class_id)->pluck('name');\n \n $list['from_to_class']=$list['from_to']. \"(\".$list['class_name'].\")\";\n \n $nationality=SaleOrder::whereid($rows->order_id)->pluck('nationality');\n \n $agent_commission = AgentCommission::wheretrip_id($rows->trip_id)->whereagent_id($rows->agent_id)->first();\n if($agent_commission){\n $commission = $agent_commission->commission;\n }else{\n $commission = Trip::whereid($rows->trip_id)->pluck('commission');\n }\n\n if( $nationality== 'local'){\n $local_person += $rows->sold_seat;\n $total_amount += $rows->free_ticket > 0 ? ($rows->price * $rows->sold_seat) - ($rows->price * $rows->free_ticket) : $rows->price * $rows->sold_seat ;\n $tmptotal =$rows->price * ($rows->sold_seat- $rows->free_ticket);\n $percent_total +=$tmptotal - ($commission * ($rows->sold_seat- $rows->free_ticket));\n }else{\n $foreign_price += $rows->sold_seat;\n $total_amount += $rows->free_ticket > 0 ? ($rows->foreign_price * $rows->sold_seat) - ($rows->foreign_price * $rows->free_ticket) : $rows->foreign_price * $rows->sold_seat ;\n $tmptotal =$rows->foreign_price * ($rows->sold_seat- $rows->free_ticket);\n $percent_total +=$tmptotal - ($commission * ($rows->sold_seat- $rows->free_ticket));\n }\n $list['local_person'] = $local_person;\n $list['foreign_person'] = $foreign_price;\n $list['local_price'] = $rows->price;\n $list['foreign_price'] = $rows->foreign_price;\n $list['sold_seat'] = $rows->sold_seat;\n $list['free_ticket'] = $rows->free_ticket;\n $list['total_amount'] = $total_amount;\n $list['percent_total'] = $percent_total;\n $lists[] = $list;\n }\n }\n //Grouping from Lists\n $stack = array();\n foreach ($lists as $rows) {\n if($search['agent_rp'])\n $check = $this->ifExistAgent($rows, $stack);\n else\n $check = $this->ifExist($rows, $stack);\n if($check != -1){\n $stack[$check]['local_person'] += $rows['local_person'];\n $stack[$check]['foreign_person'] += $rows['foreign_person'];\n $stack[$check]['sold_seat'] += $rows['sold_seat'];\n $stack[$check]['free_ticket'] += $rows['free_ticket'];\n $stack[$check]['total_amount'] += $rows['total_amount'];\n $stack[$check]['percent_total'] += $rows['percent_total'];\n }else{\n array_push($stack, $rows);\n }\n }\n\n $search['agentgroup']=\"\";\n $agentgroup=array();\n $agentgroup=AgentGroup::whereoperator_id($operator_id)->get();\n $search['agentgroup']=$agentgroup;\n\n $cities=array();\n $cities=$this->getCitiesByoperatorId($operator_id);\n $search['cities']=$cities;\n \n $times=array();\n $times=$this->getTime($operator_id, $from, $to);\n $search['times']=$times;\n\n $search['operator_id']=$operator_id;\n $search['trips']=$trips;\n $search['from']=$from;\n $search['to']=$to;\n $search['time']=$departure_time;\n $search['start_date']=$start_date;\n $search['end_date']=$end_date;\n $search['agentgroup_id']=Input::get('agentgroup')? Input::get('agentgroup') : 0;\n $search['agent_name']=Agent::whereid($id)->pluck('name');\n $search['agent_id']=$id;\n \n // sorting result\n $response=$this->msort($stack,array(\"departure_date\",\"time\"), $sort_flags=SORT_REGULAR,$order=SORT_ASC);\n \n // grouping\n if($search['agent_rp']==1){\n $tripandorderdategroup = array();\n foreach ($response AS $arr) {\n $tripandorderdategroup[$arr['agent_name']][] = $arr;\n }\n }\n else\n {\n $tripandorderdategroup = array();\n foreach ($response AS $arr) {\n $tripandorderdategroup[$arr['from_to_class']][] = $arr;\n }\n // sorting\n }\n ksort($tripandorderdategroup);\n\n $agent=Agent::whereoperator_id($operator_id)->where('id','!=',$id)->get();\n // return Response::json($tripandorderdategroup);\n return View::make('agent.agentsalelist', array('response'=>$tripandorderdategroup, 'search'=>$search,'agentlist'=>$agent));\n }", "function db_unmatch_daily_entry($params)\n\t{\n\t\t\t// (select name as client_name from a_client where id = t1.client_id),\n\t\t\t// (select name as org_name from a_org where id = t1.org_id),\n\t\t\t// (select name as orgtrx_name from a_org where id = t1.orgtrx_id),\n\t\t\t// sum(case when created_at::date = doc_date then 1 else 0 end) as match,\n\t\t\t// sum(case when created_at::date = doc_date then 0 else 1 end) as unmatch,\n\t\t\t// count(*) as total\n\t\t\t// from \".$params->table.\" t1\n\t\t\t// where client_id = {client_id} and org_id = {org_id} and orgtrx_id in {orgtrx} and is_active = '1' and is_deleted = '0' \n\t\t\t// and doc_date between '\".$params->fdate.\"' and '\".$params->tdate.\"' \".$params->where.\"\n\t\t\t// group by 1, 2, 3, 4\";\n\t\t// $str = translate_variable($str);\n\t\t\n\t\t// $qry = $this->db->query($str);\n\t\t// xresponse(TRUE, ['data' => $qry->result()]);\n\t\t\n\t\t$params->select\t= isset($params->select) ? $params->select : \"'\".$params->module.\"' as module,\n\t\t\t(select name as client_name from a_client where id = t1.client_id),\n\t\t\t(select name as org_name from a_org where id = t1.org_id),\n\t\t\t(select name as orgtrx_name from a_org where id = t1.orgtrx_id),\n\t\t\tt1.orgtrx_id,\n\t\t\tsum(case when created_at::date = doc_date then 1 else 0 end) as match,\n\t\t\tsum(case when created_at::date = doc_date then 0 else 1 end) as unmatch,\n\t\t\tcount(*) as total\";\n\t\t$params->table \t= $params->table.\" t1\";\n\t\t$params->where_custom[] = \"client_id = {client_id} and org_id = {org_id} and orgtrx_id in {orgtrx} and is_active = '1' and is_deleted = '0' \n\t\t\tand doc_date between '\".$params->fdate.\"' and '\".$params->tdate.\"'\";\n\t\t$params->group = [1, 2, 3, 4, 5];\n\t\t$params->where_custom = translate_variable($params->where_custom);\n\t\txresponse(TRUE, ['data' => $this->base_model->mget_rec($params)]);\n\t}", "public static function checkOwnerExisting()\n {\n global $mainframe;\n $db = JFactory::getDbo();\n $db->setQuery(\"Select count(id) from #__osrs_agents where agent_type <> '0' and published = '1'\");\n $count = $db->loadResult();\n if ($count > 0) {\n return true;\n } else {\n return false;\n }\n }", "public function testAfterCreateShouldCreateElasticDocument() {\n\t\tif (!isset(Zend_Registry::get('config')->elasticsearch)) {\n\t\t\treturn;\n\t\t}\n\t\t$elasticModel \t\t\t= $this->getElasticModel();\n\t\t$dbIds \t\t\t\t\t= $this->_updateBogusRecords();\n\t\t$firstGarpModelClass \t= get_class($this->getGarpModel());\n\t\t$dbId \t\t\t\t\t= $dbIds[$firstGarpModelClass];\n\n\t\t/* \tThe Elasticsearch records should be inserted at this point,\n\t\t\tbecause of the db trigger. */\n\n\t\t$question \t\t\t\t= 'Is the bogus record present after insertion?';\n\t\t$elasticRow \t\t\t= $elasticModel->fetch($dbId);\n\t\t$this->assertTrue($elasticRow['exists'], $question);\n\n\t\t$question \t\t\t\t= 'Does the indexed data overlap with mocks?';\n\t\t$elasticData \t\t\t= $elasticRow['_source'];\n\t\t$mockRowData \t\t\t= $this->getGarpModel()->getMockRowData();\n\t\t$overlap \t\t\t\t= array_intersect($mockRowData, $elasticData);\n\t\t$this->assertGreaterThanOrEqual(count($mockRowData), count($overlap), $question);\n\n\t\t$question \t\t\t\t= 'Is the bogus record cleaned up?';\n\t\t$this->_deleteBogusRecords($dbIds);\n\n\t\t$recordExists = false;\n\t\ttry {\n\t\t\t$elasticRow = $elasticModel->fetch($dbId);\n\t\t\t$recordExists = $elasticRow['exists'];\n\t\t} catch (Exception $e) {}\n\t\t\n\t\t$this->assertFalse($recordExists, $question);\n\t}", "private function save_matchday() {\r\n for ($i = 0; $i < count($this->teams_1); $i++) {\r\n if ($this->free_ticket || ($this->teams_1[$i] != $this->free_ticket_identifer &&\r\n $this->teams_2[$i] != $this->free_ticket_identifer))\r\n $matches_tmp[] = array($this->teams_1[$i], $this->teams_2[$i]);\r\n }\r\n $this->matches[] = $matches_tmp;\r\n return true;\r\n }", "public function checkForFollowUpNotOpened()\n {\n $now = Carbon::now();\n $logs = $this->getNotOpenedMessagesToFollow();\n foreach($logs as $log) {\n MailLog::info(sprintf('Trigger sending follow-up not opened email for automation `%s`, subscriber: %s, event ID: %s', $this->automation->name, $log->subscriber_id, $this->id));\n $this->fire(collect([$log->subscriber]));\n // a more verbal way is: fire(Subscriber::where('id', $log->subscriber_id)\n }\n }", "function logrec($aid,$e,$msg,$src='') {\n\t// into the new record array[errors]\n\tglobal $logfile;\n\n\n\t$ts = date('H:i');\n\n\techo \"<p class='red'>$aid: $msg</p>\";\n\tfile_put_contents($logfile,\n\t\tsprintf(\"%6s %4s %1s %s\\n\",$ts,$aid,$e,$msg),FILE_APPEND);\n\tif (!empty($src)) {\n\t\tfile_put_contents($logfile,\n\t\tsprintf(\"%12s %s\\n\",'',$src),FILE_APPEND);\n\t}\n\treturn \"($e) $msg \". NL;\n}", "function recordReport($record)\n {\n $recordReport = new RecordReport();\n foreach ($this->rules() as $rule) {\n // apply this rule to every possible context based on the route\n /** @var Rule $rule */\n try {\n $rule->apply($record, $recordReport);\n } catch (Exception $e) {\n $titleMaker = new TitleMaker();\n throw new ReportingException(\"In rule \" . $titleMaker->title($rule) . \": \" . $e->getMessage(), 0, $e);\n }\n }\n return $recordReport;\n }", "private function initReport()\n {\n $this->report = new \\stdClass();\n\n $this->searchDiffs();\n }", "public function __construct()\n {\n\t\t$agent = new Agent();\n $this->device = ($agent->isDesktop()) ? 'pc' : 'mobile';\n $this->banner = Banner::where('bn_alt','공지사항')->first();\n }", "function inbound_record_log( $title = '', $message = '', $rule_id = 0, $job_id = '', $type = null ) {\n\tglobal $inbound_automation_logs;\n\t$inbound_automation_logs->add( $title, $message, $rule_id, $job_id, $type );\n\n}", "function save_episode($id_user, $id_parcours, $id_episode) {\n\n\t// check if activity has been already done one time\n\t$exists = check_record_exists($id_user , $id_episode , $id_parcours);\n\n\tglobal $wpdb;\n\n\tif(empty($exists)) {\n \n\t\t$db = $wpdb->insert( \n\t\t 'tracking', \n\t\t array( \n\t\t \t'id_user' => $id_user, \n\t\t 'id_episode' => $id_episode,\n\t\t 'id_parcours' => $id_parcours,\n\t\t 'date_last_done' => date( \"Y-m-d h:i:s\", time() )\n\t\t ), \n\t\t array( \n\t\t '%d',\n\t\t '%d',\n\t\t '%d', \n\t\t '%s',\n\t\t '%d'\n\t\t ) \n\t\t);\n\t\t\n\t}\n\t/*else {\n\t\t$db = $wpdb->update( \n\t\t 'tracking', \n\t\t array( \n\t\t 'status' => 1\n\t\t ), \n\t\t array( 'id_user' => $id_user , 'id_episode' => $id_episode , 'id_parcours' => $id_parcours ), \n\t\t array( \n\t\t '%s'\n\t\t ), \n\t\t array( '%d' ) \n\t\t);\n\t}*/\n\n\treturn $db;\n}", "public function generateTrackingNo($id);", "public function testGetNumberOfRecordsWhenRecordsExist()\n {\n\n // Create exhibits.\n $neatline1 = $this->_createNeatline('Test Exhibit 1', '', 'test-exhibit-1');\n $neatline2 = $this->_createNeatline('Test Exhibit 2', '', 'test-exhibit-2');\n\n // Create records.\n $record1 = new NeatlineDataRecord(null, $neatline1);\n $record2 = new NeatlineDataRecord(null, $neatline1);\n $record3 = new NeatlineDataRecord(null, $neatline1);\n $record4 = new NeatlineDataRecord(null, $neatline2);\n $record1->space_active = 1;\n $record2->space_active = 1;\n $record3->space_active = 1;\n $record4->space_active = 1;\n $record1->save();\n $record2->save();\n $record3->save();\n $record4->save();\n\n // Check count.\n $this->assertEquals($neatline1->getNumberOfRecords(), 3);\n $this->assertEquals($neatline2->getNumberOfRecords(), 1);\n\n }", "function test_treatments_report_blocked_true()\n {\n $this->seed();\n\n $user = User::where('email', '=', '[email protected]')->first();\n \n $token = JWTAuth::fromUser($user);\n $treatments = Treatment::factory()\n ->count(3)\n ->for($user)\n ->create(['public' => 1]);\n $treatment = Treatment::first();\n $response = $this->json('POST', '/api/report/'.$treatment->id.'?token='.$token);\n $user = User::where('email', '=', '[email protected]')->first();\n \n $token = JWTAuth::fromUser($user);\n $response = $this->json('POST', '/api/report/'.$treatment->id.'?token='.$token);\n $response->assertOk()->assertJsonFragment(['isReported'=>true]);\n }", "function get_eye_exams($visit)\n {\n return EyeExam::firstOrNew(['visit' => $visit]);\n }", "function collectDetails() {\n if (! $_SESSION[\"eligible\"]) {\n return $this->showStart();\n }\n if (isset($_REQUEST['details_submitted'])) {\n \n /* these attributes are a subset of the db \n * entity 'participant' field names */\n $participant_attributes = array(\n\t\t\t \"first_name\",\n\t\t\t \"last_name\"\n\t\t\t );\n $participant_details = array();\n $participant_contact_details = array();\n\n /* these attributes match the database entity \n * 'participant_contact' field names */\n $contact_attributes = array(\n\t\t\t \"participant_id\",\n\t\t\t \"email\",\n\t\t\t \"alternate_email\",\n\t\t\t \"street_address1\",\n\t\t\t \"street_address2\",\n\t\t\t \"city\",\n\t\t\t \"state\",\n\t\t\t \"postcode\"\n\t\t\t );\n foreach($_REQUEST as $name=>$value) {\n\tif (in_array($name, $participant_attributes)){\n\t $participant_details[$name] = $value;\n\t}\n\telse if (in_array($name, $contact_attributes)){\n\t $participant_contact_details[$name] = $value;\n\t}\n }\n if ($this->isEmailDuplicate($participant_contact_details[\"email\"])) {\n\treturn $this->failToRegister();\n }\n // add the enrolment date to the participant details\n $mysqldatetime = date( 'Y-m-d H:i:s', time());\n $participant_details['enrolled'] = $mysqldatetime;\n // add new participant\n $participant_id = $this->addThing('participant', $participant_details);\n $participant_contact_details['participant_id'] = $participant_id;\n /* add new participant_contact \n * (no id to harvest for dependent entity)\n */\n $this->addThing('participant_contact', $participant_contact_details);\n $_REQUEST[\"participant_id\"] = $participant_id;\n $_REQUEST[\"mode\"] = 'consent';\n return $this->collectConsent();\n }\n $output = $this->outputBoilerplate('details.html');\n return $output;\n }", "public static function addCheckResourcesAgent()\n\t{\n\t\tif (!ModuleManager::isModuleInstalled('bitrix24'))\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\t$agentName = static::class . \"::checkResourcesFileExistsAgent();\";\n\t\t\\CAgent::RemoveAgent($agentName, 'crm');\n\t\t\\CAgent::AddAgent(\n\t\t\t$agentName,\n\t\t\t'crm', \"N\", 60, \"\", \"Y\",\n\t\t\t\\ConvertTimeStamp(time()+\\CTimeZone::GetOffset()+300, \"FULL\")\n\t\t);\n\t}", "function create_flight($flight_info_id){\n $flight_info_object = new Flight_info($flight_info_id); //select our flight_info\n \n if($flight_info_object->flight_id){ //if it has flight linked then \n if(look_for_changes($flight_info_object->flight_id)){ //check if flight information has changed \n link_or_insert_flight($flight_info_id); //if so, search for flight or create a new flight and link if with our flight_info\n }\n\n }else{\n link_or_insert_flight($flight_info_id);// if it doesn't have flight linked, create flight and link it. Simple, isn't it?\n }\n\n \n \n \n}", "function test_treatments_not_found_true()\n {\n $this->seed();\n \n $user = User::where('email', '=', '[email protected]')->first();\n \n $token = JWTAuth::fromUser($user);\n $response = $this->json('GET', '/api/treatments/'.rand(11,50).'?token='.$token);\n $response->assertNotFound();\n }" ]
[ "0.51552266", "0.4772641", "0.47175062", "0.46376115", "0.46119517", "0.46100888", "0.45843157", "0.45701784", "0.45586094", "0.45474917", "0.4532829", "0.45082062", "0.44557235", "0.44137526", "0.4402685", "0.439246", "0.4387997", "0.43790662", "0.43784818", "0.43778485", "0.4377756", "0.43719384", "0.43541613", "0.43484312", "0.43466333", "0.4330926", "0.43290573", "0.43233913", "0.43141147", "0.43139687", "0.4302745", "0.42994735", "0.42951232", "0.42912555", "0.42910117", "0.42910117", "0.42888397", "0.42876792", "0.42857644", "0.42825732", "0.4282343", "0.42809668", "0.4278438", "0.42613333", "0.4261029", "0.42519048", "0.42511436", "0.42509678", "0.42270866", "0.4220804", "0.42205134", "0.4216742", "0.42164108", "0.42163274", "0.42062625", "0.42003977", "0.41929513", "0.41922027", "0.4187899", "0.41663542", "0.4162263", "0.41604128", "0.4156645", "0.41542664", "0.4152839", "0.4152186", "0.41502488", "0.41311398", "0.41197535", "0.4117719", "0.4114703", "0.41138464", "0.4113596", "0.4108709", "0.41043857", "0.41025054", "0.40961263", "0.40861276", "0.40859792", "0.40728998", "0.40725595", "0.40693757", "0.40662512", "0.40655237", "0.4060561", "0.4057043", "0.40556306", "0.40518278", "0.40487376", "0.40481472", "0.404583", "0.40438998", "0.40426102", "0.40363234", "0.4034207", "0.4031407", "0.40227294", "0.40204003", "0.40197062", "0.40159312" ]
0.638491
0
affichage produits non valides dans back office
public function affichageAction() { $em=$this->getDoctrine()->getManager(); $products=$em->getRepository('HologramBundle:Product')->findBy(array('etat'=>'en attente')); return $this->render('HologramBundle:Back:produitsNonValides.html.twig',array('prod'=>$products)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function produits()\n {\n $data[\"list\"]= $this->produit->list();\n $this->template_admin->displayad('liste_Produits');\n }", "function afficherProduits(){\n\t\t$sql=\"SElECT * From paniers \";\n\t\t$db = config::getConnexion();\n\t\ttry{\n\t\t$liste=$db->query($sql);\n\t\treturn $liste;\n\t\t}\n catch (Exception $e){\n die('Erreur: '.$e->getMessage());\n }\t\n\t\n }", "public function obtenerViajesplusAbonados();", "static function verifVentePro($ar){\n $datas = array('WTSCUSTOMER'=>array('pro', 'progroup', 'skdb2bcode'),\n 'WTSCARDSGROUP'=>array('OUTOFSTOCK', 'shortwtp'),\n 'WTSGROUPS'=>array('comments'),\n 'WTSORDER'=>array('ISPROORDER')\n );\n foreach($datas as $atable=>$sommeFields){\n if(!XSystem::tableExists($atable)){\n $mess .= 'La table '.$atable.' n\\'existe pas <br>';\n continue;\n }\n $mess .= 'La table '.$atable.' existe<br>';\n $ds = XDataSource::objectFactoryHelper8('BCLASS=XDSTable&SPECS='.$atable);\n foreach($sommeFields as $fn){\n if (!$ds->fieldExists($fn)){\n $mess .= '-'.$fn.' existe pas<br>';\n } else {\n $mess .= '-'.$fn.' ok<br>';\n }\n }\n }\n $rs = selectQuery('select * from SETS where STAB=\"WTSORDER\" and FIELD=\"MODEPAIEMENT\" and SOID=\"ENCOMPTE\" and SLANG=\"FR\"');\n if (!$rs || $rs->rowCount() < 1)\n $mess .= 'Ajouter le mode de paiement (MODEPAIEMENT) \"ENCOMPTE\" dans WTSORDER<br>';\n else\n $mess .= 'OK MODEPAIEMENT \"ENCOMPTE\" existe dans WTSORDER';\n return $mess;\n }", "function afficherProduits(){\n\t\t$sql=\"SElECT * From product\";\n\t\t$db = config::getConnexion();\n\t\ttry{\n\t\t$liste=$db->query($sql);\n\t\treturn $liste;\n\t\t}\n catch (Exception $e){\n die('Erreur: '.$e->getMessage());\n }\t\n\t}", "function afficherprods(){\r\n\t\t$sql=\"SElECT * From categorie\";\r\n\t\t$db = config::getConnexion();\r\n\t\ttry{\r\n\t\t$liste=$db->query($sql);\r\n\t\treturn $liste;\r\n\t\t}\r\n catch (Exception $e){\r\n die('Erreur: '.$e->getMessage());\r\n }\t\r\n\t}", "function fProcesaBanco(){\n global $db, $cla, $agPar, $igNumChq, $igSecue, $ogDet;\n $alDet = fIniDetalle();\n $alDet[\"det_codcuenta\"]\t= $cla->cla_ctaorigen; \n $alDet[\"det_glosa\"] \t= substr($agPar[\"com_Concepto\"],0, 50) . ' ' . substr($agPar[\"slBenef\"],0,20);\n $alDet['det_idauxiliar']= $agPar[\"com_Emisor\"];\n $alDet[\"det_numcheque\"]\t= $igNumChq;\t\t\t// es el numero de cheque\n $alDet[\"det_feccheque\"]\t= $agPar[\"com_FechCheq\"];\n $alDet['det_valdebito']\t= $agPar[\"flValor\"] * $cla->cla_indicador; // segun el signo del indicador, se aplica como DB/CR al grabar;\n $alDet['det_valcredito']\t= 0;\n $alDet['det_secuencia']\t= $igSecue;\n\tif(fGetParam(\"pAppDbg\",0)){\n\t\tprint_r($alDet);\n\t}\n\tfInsdetalleCont($db, $alDet);\n}", "private function processarNotificacoes() {\n\n /**\n * Objeto assunto e mensagem padrao\n */\n $oMensageriaLicenca = new MensageriaLicenca();\n\n /**\n * Define o sistema para mensageria, pelo nome do municipio\n * - db_config.munic\n */\n $oInstituicao = new Instituicao();\n $oPrefeitura = @$oInstituicao->getDadosPrefeitura();\n $sSistema = 'e-cidade.' . strtolower($oPrefeitura->getMunicipio());\n\n foreach ($this->aLicencas as $oLicenca) {\n\n $iCodigoLicencaEmpreendimento = $oLicenca->getSequencial();\n\n if ($oLicenca->getParecerTecnico()->getTipoLicenca()->getSequencial() != 3) {\n\n $iCodigoLicencaEmpreendimento = $oLicenca->getParecerTecnico()->getCodigoLicencaAnterior();\n if (is_null($iCodigoLicencaEmpreendimento)) {\n $iCodigoLicencaEmpreendimento = $oLicenca->getSequencial();\n }\n }\n\n $oDataVencimento = new DBDate( $oLicenca->getParecerTecnico()->getDataVencimento() );\n\n $aVariaveisLicenca = array(\n\n '[nome_emp]' => $oLicenca->getParecerTecnico()->getEmpreendimento()->getNome(),\n '[codigo_emp]' => $oLicenca->getParecerTecnico()->getEmpreendimento()->getSequencial(),\n '[numero]' => $iCodigoLicencaEmpreendimento,\n '[tipo]' => $oLicenca->getParecerTecnico()->getTipoLicenca()->getDescricao(),\n '[data]' => $oDataVencimento->getDate( DBDate::DATA_PTBR ),\n '[processo]' => $oLicenca->getParecerTecnico()->getProtProcesso()\n );\n\n\n $sAssuntoLicenca = strtr($oMensageriaLicenca->getAssunto(), $aVariaveisLicenca);\n $sMensagemLicenca = strtr($oMensageriaLicenca->getMensagem(), $aVariaveisLicenca);\n $oDBDateAtual = new DBDate(date('Y-m-d'));\n $iDiasVencimento = DBDate::calculaIntervaloEntreDatas(new DBDate($oLicenca->getParecerTecnico()->getDataVencimento()), $oDBDateAtual, 'd');\n $aDestinatarios = array();\n $aUsuarioNotificado = array();\n\n foreach ($this->aCodigoMensageriaLicencaUsuario as $iCodigoMensageriaLicencaUsuario) {\n\n $oMensageriaLicencaUsuario = MensageriaLicencaUsuarioRepository::getPorCodigo($iCodigoMensageriaLicencaUsuario);\n $oUsuarioSistema = $oMensageriaLicencaUsuario->getUsuario();\n\n /**\n * Dias para vencer maior que os dias configurados\n */\n if ($iDiasVencimento > $oMensageriaLicencaUsuario->getDias() ) {\n continue;\n }\n\n /**\n * Salva acordo como ja notificado para usuario e dia\n * mensagerialicencaprocessados\n */\n $this->salvarLicencaProcessado($iCodigoMensageriaLicencaUsuario, $oLicenca->getSequencial());\n\n /**\n * Usuario ja notificado com dia menor que o atual\n */\n if (in_array($oUsuarioSistema->getCodigo(), $aUsuarioNotificado)) {\n continue;\n }\n\n $aDestinatarios[] = array('sLogin' => $oUsuarioSistema->getLogin(), 'sSistema' => $sSistema);\n $aUsuarioNotificado[] = $oUsuarioSistema->getCodigo();\n }\n\n /**\n * Licenca sem usuarios para notificar\n */\n if (empty($aDestinatarios)) {\n continue;\n }\n\n $sAssunto = str_replace('[dias]', $iDiasVencimento, $sAssuntoLicenca);\n $sMensagem = str_replace('[dias]', $iDiasVencimento, $sMensagemLicenca);\n $this->enviarNotificacao($sAssunto, $sMensagem, $sSistema, $aDestinatarios);\n }\n\n return true;\n }", "public function AggiornaPrezzi(){\n\t}", "function consultarNotaAprobatoria() {\r\n\r\n $variables=array('codProyectoEstudiante'=> $this->datosEstudiante['CARRERA'] \r\n );\r\n $cadena_sql = $this->sql->cadena_sql(\"nota_aprobatoria\", $variables);\r\n $resultado = $this->ejecutarSQL($this->configuracion, $this->accesoOracle, $cadena_sql, \"busqueda\");\r\n return $resultado[0][0];\r\n }", "function wtssaisieforfaits($ar){\n $p = new XParam($ar, array());\n $offre = $p->get('offre');\n // lecture des informations à partir des produits (oid=>nb) \n // par exemple si appel offre de meilleur prix\n if ($p->is_set('products')){\n $products = $p->get('products');\n $wtsvalidfrom = $p->get('validfrom');\n $perror = false;\n $wtspools = array();\n $wtspersons = array();\n $wtstickets = array();\n foreach($products as $poid=>$pnb){\n\t$rsp = selectQuery('select wtspool, wtsperson, wtsticket from '.self::$tableCATALOG.' where PUBLISH=1 and LANG=\"FR\" and KOID=\"'.$poid.'\"');\n\tif($rsp->rowCount() != 1){\n\t XLogs::critical(get_class($this). '::wtssaisieforfaits erreur appel via produits produit : '.$poid);\n\t $perror = true;\n\t}\n\t$orsp = $rsp->fetch();\n\t$wtspools[] = $orsp['wtspool'];\n\t$wtstickets[] = $orsp['wtsticket'];\n\t$wtspersons[$orsp['wtsperson']] = $pnb;\n }\n $rsp->closeCursor();\n unset($orsp);\n unset($products);\n unset($poid);\n unset($pnb);\n $wtspool = array_unique($wtspools);\n $wtsticket = array_unique($wtstickets);\n if (count($wtspool) != 1 || count($wtsticket) != 1){\n\t XLogs::critical(get_class($this). '::wtssaisieforfaits erreur appel via produits plusieurs pools, plusieurs tickets '.implode($wtspools).' '.implode($wtstickets));\n\t $perror = true;\n }\n $wtspool = $wtspools[0];\n $wtsticket = $wtstickets[0];\n $wtsperson = $wtspersons;\n unset($wtspools);\n unset($wtstickets);\n unset($wtspersons);\n if ($perror){\n\tXLogs::critical(get_class($this). '::wtssaisieforfaits erreur appel via produits');\n\tXShell::setNext($GLOBALS['HOME_ROOT_URL']);\n\treturn;\n }\n } else {\n $wtspool = $p->get('wtspool');\n $wtsperson = $p->get('wtspersonnumber');\n $wtsticket = $p->get('wtsticket');\n $wtsvalidfrom = $p->get('wtsvalidfrom');\n }\n $personpackid = uniqid('ppid_');\n $tpl = 'wts';\n // l'offre doit être valide\n if (!$this->modcatalog->validOffer($offre)){\n XLogs::critical(get_class($this). '::wtssaisieforfaits acces offre offline ');\n XShell::setNext($GLOBALS['HOME_ROOT_URL']);\n return;\n }\n if ($p->is_set('wtspersonnumbermo')){\n unset($_REQUEST['wtspersonnumber']);\n $_REQUEST['wtspersonnumber'] = $wtsperson = array($p->get('wtspersonnumbermo')=>1);\n }\n $lines = array();\n // saison\n $season = $this->getSeason();\n // lecture de l'offre en cours\n $doffre = $this->modcatalog->displayOffre(array('_options'=>array('local'=>true),\n\t\t\t\t\t\t 'tplentry'=>$tpl.'_offre',\n\t\t\t\t\t\t 'offre'=>$offre,\n\t\t\t\t\t\t 'caddie'=>true\n\t\t\t\t\t\t )\n\t\t\t\t\t );\n // correction saison dans le cas des offres flashs\n if ($doffre['doffre']['oflash']->raw == 1){\n $season['odatedeb'] = $season['odatedebflash'];\n $season['odelaitrans'] = $season['odelaitransflash'];\n $season['odelaifab'] = $season['odelaifabflash'];\n }\n // premier jour de ski pour controle des dispo cartes\n $firstdaynewcard = $this->getFirstDayNewCard($season);\n\n // lecture des produits (pour ensuite avoir le prix)\n foreach($wtsperson as $personoid=>$personnb){\n if (empty($personnb) || $personnb<1)\n continue;\n $dp = $this->modcatalog->displayProduct($offre, $wtspool, $wtsticket, $personoid);\n if ($dp == NULL)\n continue;\n $dpc = $this->modcatalog->getPrdConf($dp);\n// jcp, bloquant, c'est sur le module => xmodeplspecialoffer::getSpecialOffer\n// $dpsp = $this->dsspoffer->getSpecialOffer($dp);\n\n // ajout des assurances ...\n $assur = $this->modcatalog->getProductAssurance($dp, $dpc);\n\n // ajout des prix de cartes si achat possible a cette date pour ce produit\n $newcard = $this->modcatalog->getNewCard($dp, $dpc, $wtsvalidfrom);\n $availablesNewCards = $this->modcatalog->getAvailablesNewCards($dp, $dpc, $wtsvalidfrom, $firstdaynewcard);\n // recherche des prix fidelite (complements sur le bloc forfait)\n $loyaltymess = $loyaltyprice = $loyaltyProductOid = NULL;\n if ($this->modcustomer->loyaltyActive()){\n list($loyaltymess, $loyaltyprice, $loyaltyProductOid) = $this->modcustomer->preCheckLoyaltyReplacementProduct(array('season'=>$season, 'doffre'=>$doffre['doffre'], 'dp'=>$dp, 'dpc'=>$dpc, 'validfrom'=>$wtsvalidfrom, 'availablesNewCards'=>$availablesNewCards));\n }\n // creation des lignes pour chaque personne\n for($i = 0; $i<$personnb; $i++){\n $lines[] = array('assur'=>$assur,\n 'personpackid'=>$personpackid,\n 'productconf'=>$dpc,\n 'validfrom'=>$wtsvalidfrom,\n 'product'=>$dp,\n 'newcard'=>$newcard, /* a virer */\n 'availablesnewcards'=>$availablesNewCards,\n 'id'=>'line_'.str_replace(':', '', $dp['oid']).sprintf('_%04d', $i),\n 'label'=>$dp['owtsperson']->link['olabel']->raw.' '.($i+1),\n 'amin'=>$dp['owtsperson']->link['oamin']->raw,\n 'amax'=>$dp['owtsperson']->link['oamax']->raw,\n\t\t\t 'personoid'=>$dp['owtsperson']->raw,\n 'saisieident'=>$dp['owtsperson']->link['osaisieident']->raw,\n 'saisiedob'=>$dp['owtsperson']->link['osaisiedob']->raw,\n 'loyaltyproductoid'=>($loyaltyProductOid == NULL)?false:$loyaltyProductOid,\n 'loyaltyprice'=>($loyaltyProductOid == NULL)?false:$loyaltyprice,\n 'loyaltymess'=>($loyaltyProductOid != NULL && $loyaltymess != 'found')?$loyaltymess:false);\n }\n }\n \n // lecture des prix par validfrom/produit\n // calcul validtill\n // disponbilité des cartes / validfrom : forfaits déja présent, delais (cas des nouvelles cartes)\n $caddie = $this->getCaddie();\n $carddispo = $caddie['cards'];\n foreach($lines as $il=>&$line){\n $t = $this->modcatalog->getProductTariff($line['product'], $wtsvalidfrom);\n $line['validtill'] = $this->getValidtill($line['validfrom'], $line['product'], $line['productconf']);\n if ($t['tariff'] != 'NOT FOUND'){\n $line['price'] = $t['tariff'];\n } else {\n $line['price'] = 'NOT FOUND';\n }\n foreach($caddie['lines'] as $lineid=>$pline){\n // exclusions par date de forfaits\n if ($pline['type'] == 'forfait'){\n if (($pline['validfrom']<=$line['validtill'] && $line['validtill']<=$pline['validtill']) || \n\t ($pline['validfrom'] <= $line['validfrom'] && $line['validfrom'] <= $pline['validtill']))\n $carddispo[$pline['cardid']] = false;\n }\n // exclusion par nombre (? a paramétrer ?)\n if (count($caddie['bycards'][$pline['cardid']]['cardlines'])>=3){\n $carddispo[$pline['cardid']] = false;\n }\n // exclusion par type de carte \n }\n /* -- vente de cartes seules -- */\n /* et de toute façon */\n foreach($caddie['bycards'] as $cardid=>$carditems){\n if ($carditems['newcard'] !== false && $line['validfrom']<=$firstdaynewcard)\n $carddispo[$cardid] = false;\n }\n $line['cardsdispo'] = $carddispo;\n }\n unset($line);\n // calcul du meilleur prix (si l'offre ne l'interdit pas)\n if ($doffre['doffre']['obetterprice'] && $doffre['doffre']['obetterprice']->raw == 1){\n $rbo = $this->ctrlChoix($ar);\n if ($r->ok == 0){\n XShell::toScreen2($tpl, 'betteroffers', $rbo);\n }\n }\n // gestion du compte client : raccourcis\n if (!empty($this->aliasmyaccount)){\n $custcards = $this->modcustomer->dispCustCards();\n if (count($custcards['custcardnos'])>0)\n XShell::toScreen2($tpl, 'custcards', $custcards);\n } \n // totaux car catégories (pour offre pro entre autres)\n $summary = array('lines'=>array(), 'totforfait'=>0, 'needAssur'=>false, 'needDob'=>false, 'needIdent'=>false);\n foreach($lines as $il=>$aline){\n $aproductoid = $aline['product']['oid'];\n if (!isset($summary['lines'][$aproductoid])){\n $summary['lines'][$aproductoid] = array('label'=>$aline['product']['label'], 'nb'=>0, 'price'=>$aline['price'], 'tot'=>0);\n }\n $summary['lines'][$aproductoid]['nb'] += 1;\n $summary['lines'][$aproductoid]['tot'] += $aline['price'];\n $summary['totforfait'] += $aline['price'];\n if (isset($aline['assur']))\n $summary['needAssur'] = true;\n if ($aline['saisieident'] == 1)\n $summary['needIdent'] = true;\n if ($aline['saisiedob'] == 1)\n $summary['needDob'] = true;\n }\n // cas offre saisie modification de skieurs ! offre \"coherente ?\" \n $advanced = array('on'=>false);\n if (isset($doffre['doffre']['oadvancedinput']) && $doffre['doffre']['oadvancedinput']->raw == 1){\n //&& count($caddie['lines']) == 0){ \n $advanced['on'] = true;\n $this->defaultStepTemplates['commande2'] = $this->templatesdir.'choix-produit2.html';\n foreach($lines as $il=>&$line){\n\tforeach($doffre['tickets'] as $ticketoid=>$aticket){\n\t if (in_array($wtspool, $aticket['pools'])){\n\t $odp = $this->modcatalog->displayProduct($offre, $wtspool, $ticketoid, $line['personoid']);\n\t if ($odp != NULL){\n\t $line['advanced']['calendar'] = $this->modcatalog->configureOneCalendar($season, array($opd['oprdconf']), $doffre['doffre']);\n\t if ($line['product']['owtsticket']->raw == $ticketoid){\n\t\t$aticket['selected'] = true;\n\t }\n\t $aticket['productoid'] = $odp['oid'];\n\t $line['advanced']['tickets'][$ticketoid] = $aticket;\n\t }\n\t }\n\t}\n }\n }\n XShell::toScreen2($tpl, 'advanced', $advanced);\n XShell::toScreen2($tpl, 'summary', $summary);\n //\n XShell::toScreen2($tpl, 'lines', $lines);\n // blocage du pave haut\n XShell::toScreen1($tpl.'_offre', $doffre);\n XShell::toScreen2($tpl.'_offre', 'lock', true);\n\n // valeurs choisies\n $choix = array('wtsvalidfrom'=>$wtsvalidfrom,\n 'wtspool'=>$wtspool,\n 'wtspersonnumber'=>$wtsperson,\n 'wtsticket'=>$wtsticket);\n\n XShell::toScreen2($tpl.'_offre', 'current', $choix);\n\n $choix['wtsoffre'] = $offre;\n setSessionVar('wts_offre_current', $choix);\n\n $_REQUEST['insidefile'] = $this->defaultStepTemplates['commande2'];\n $this->setOffreLabels($doffre['doffre']);\n $this->wtscallback();\n\n }", "static function getTesoreriaPrevision() {\n\n // Albaranes confirmados o expedidos sin facturar\n $alb = new AlbaranesCab();\n $rows = $alb->cargaCondicion(\"sum(TotalBases) as total\", \"(IDEstado='1' or IDEstado='2')\");\n $previstoCobro = $rows[0]['total'];\n unset($alb);\n\n // Pedidos confirmados o recepcionados sin facturar\n $ped = new PedidosCab();\n $rows = $ped->cargaCondicion(\"sum(TotalBases) as total\", \"(IDEstado='1' or IDEstado='2')\");\n $previstoPago = $rows[0]['total'];\n unset($ped);\n\n return array(\n 'cobro' => $previstoCobro,\n 'pago' => $previstoPago\n );\n }", "public function listaProyectos(){\n\t\t$query = \"SELECT * FROM alm_proyecto WHERE ISNULL(alm_proy_usr_baja) ORDER BY alm_proy_estado\";\n\t\treturn $this->mysql->query($query);\n\t}", "function reporteCotizacion(){\n\t\t$this->procedimiento='adq.f_cotizacion_sel';\n\t\t$this->transaccion='ADQ_COTREP_SEL';\n\t\t$this->tipo_procedimiento='SEL';//tipo de transaccion\n\t\t$this->setCount(false);\n\t\t\n\t\t$this->setParametro('id_cotizacion','id_cotizacion','int4');\n\t\t\t\t\n\t\t//Definicion de la lista del resultado del query\n\t\t$this->captura('estado','varchar');\n\t\t$this->captura('fecha_adju','date');\n\t\t$this->captura('fecha_coti','date');\n\t\t$this->captura('fecha_entrega','date');\n\t\t$this->captura('fecha_venc','date');\n\t\t$this->captura('id_moneda','int4');\n\t\t$this->captura('moneda','varchar');\n\t\t$this->captura('id_proceso_compra','int4');\n\t\t$this->captura('codigo_proceso','varchar');\n\t\t$this->captura('num_cotizacion','varchar');\n\t\t$this->captura('num_tramite','varchar');\n\t\t$this->captura('id_proveedor','int4');\n\t\t$this->captura('desc_proveedor','varchar');\n\t\t$this->captura('id_persona','int4');\n\t\t$this->captura('id_institucion','int4');\n\t\t$this->captura('dir_per', 'varchar');\n\t\t$this->captura('tel_per1', 'varchar');\n\t\t$this->captura('tel_per2', 'varchar');\n\t\t$this->captura('cel_per','varchar');\n\t\t$this->captura('correo','varchar');\n\t\t$this->captura('nombre_ins','varchar');\n\t\t$this->captura('cel_ins','varchar');\n\t\t$this->captura('dir_ins','varchar');\n\t\t$this->captura('fax','varchar');\n\t\t$this->captura('email_ins','varchar');\n\t\t$this->captura('tel_ins1','varchar');\n\t\t$this->captura('tel_ins2','varchar');\t\t\n\t\t$this->captura('lugar_entrega','varchar');\n\t\t$this->captura('nro_contrato','varchar');\t\t\n\t\t$this->captura('numero_oc','varchar');\n\t\t$this->captura('obs','text');\n\t\t$this->captura('tipo_entrega','varchar');\n\t\t\n\t\t//Ejecuta la instruccion\n\t\t$this->armarConsulta();\n\t\t$this->ejecutarConsulta();\n\t\t\n\t\t//Devuelve la respuesta\n\t\treturn $this->respuesta;\n\t}", "public function afficherAll()\n {\n }", "abstract public function getPasiekimai();", "function proyinforsup(){\n\t\t\t$proyectos = $this->Proyinforsup->find('all',\n\t\t\tarray(\n\t\t\t\t'fields' => array('DISTINCT idproyecto','numeroproyecto')\t\n\t\t\t\t));\n\t\t\t$this->set('proyectos',Hash::extract($proyectos,'{n}.Proyinforsup'));\n\t\t\t$this->set('_serialize', 'proyectos');\n\t\t\t$this->render('/json/proyinforsup');\n\t\t}", "function sevenconcepts_formulaire_charger($flux){\n $form=$flux['args']['form'];\n if($form=='inscription'){\n include_spip('cextras_pipelines');\n $champs_extras=champs_extras_objet(table_objet_sql('auteur'));\n foreach($champs_extras as $value){\n $flux['data'][$value['options']['nom']]=''; \n if(isset($value['options']['obligatoire']))$flux['data']['obligatoire'][$value['options']['nom']]='on';\n }\n $flux['data']['nom_inscription']='';\n $flux['data']['mail_inscription']='';\n }\n \n return $flux;\n}", "public function verificaAppartenenza(){\n \n $sess_user=$this->session->get_userdata('LOGGEDIN');\n $this->utente=$sess_user[\"LOGGEDIN\"][\"userid\"];\n if(isset($sess_user[\"LOGGEDIN\"][\"business\"])){\n \n $this->azienda=$sess_user[\"LOGGEDIN\"][\"business\"];\n \n \n }\n \n \n }", "function getAllFromProizvod(){\n\t\treturn $this->ime . \"&nbsp\" . $this->imeProizvođača . \"&nbsp\" \n\t\t. $this->prezimeProizvođača . \"&nbsp\" . $this->cijena;\n\t}", "function listarBoletaGarantiaDevuelta(){\r\n\t\t$this->procedimiento='leg.ft_boleta_garantia_dev_sel';\r\n\t\t$this->transaccion='LG_POBODEV_SEL';\r\n\t\t$this->tipo_procedimiento='SEL';//tipo de transaccion\r\n\t\t\t\t\r\n\t\t$this->captura('id_anexo','int4');\r\n\t\t$this->captura('estado_reg','varchar');\r\n\t\t$this->captura('agencia','varchar');\r\n\t\t$this->captura('nro_documento','varchar'); \r\n\t\t$this->captura('fecha_desde','date');\r\n\t\t$this->captura('fecha_fin_uso','date');\r\n\t\t$this->captura('moneda','varchar');\r\n\t\t$this->captura('asegurado','numeric');\r\n\t\t$this->captura('estado','varchar');\r\n\t\t$this->captura('codigo_noiata','varchar');\r\n\t\t$this->captura('codigo','varchar');\r\n\t\t$this->captura('fecha_hasta','date');\r\n\t\t$this->captura('fecha_corte','date');\r\n\t\t$this->captura('codigo_int','varchar');\r\n\t\t$this->captura('fecha_notif','date');\r\n\t\t$this->captura('tipo','varchar');\r\n\t\t$this->captura('numero','varchar');\r\n\t\t$this->captura('tipo_agencia','varchar');\r\n\t\t$this->captura('banco','varchar');\r\n\t\t$this->captura('usr_reg','varchar');\r\n\t\t$this->captura('usr_mod','varchar');\r\n\t\t$this->captura('id_usuario_reg','int4');\r\n\t\t$this->captura('id_usuario_mod','int4');\r\n\t\t$this->captura('observaciones','text');\r\n\t\t$this->captura('id_agencia','int4');\r\n\t\t$this->captura('estado_contrato','varchar');\r\n\t\t$this->captura('id_proceso_wf','integer');\r\n\t\t$this->captura('id_estado_wf','integer');\r\n\t\t$this->captura('nro_hoja_ruta','integer');\r\n\t\t$this->captura('id_contrato','integer');\r\n\t\t$this->captura('id_gestion','integer');\r\n\t\t$this->captura('gestion','integer');\r\n\t\t$this->captura('id_proveedor','integer');\r\n\t\t//Ejecuta la instruccion\r\n\t\t$this->armarConsulta();\t\t\r\n\t\t//echo($this->consulta);exit;\r\n\t\t$this->ejecutarConsulta();\r\n\t\t\r\n\t\t//Devuelve la respuesta\r\n\t\treturn $this->respuesta;\r\n\t}", "function wtsProPaiement($ar){\n $p = new XParam($ar, array());\n $orderoid = $p->get('orderoid');\n // verification du client de la commande et du compte connecte\n list($okPaiement, $mess) = $this->paiementEnCompte($orderoid);\n if (!$okPaiement){\n XLogs::critical(get_class($this), 'paiement pro refusé '.$orderoid.' '.$mess);\n XShell::setNext($GLOBALS['TZR_SESSION_MANAGER']::complete_self(true, true).'&alias='.$this->aliasvente.'&moid='.$this->_moid.'&function=wtsLireOffres');\n return;\n }\n // traitement post commande std\n clearSessionVar('caddie');\n XLogs::critical(get_class($this), 'enregistrement paiement en compte '.$orderoid);\n // traitement standards après validation\n $this->postOrderActions($orderoid, true);\n\n // traitement post order - devrait être dans postOrderActions\n $this->proPostOrderActions($orderoid);\n\n // retour \n if (defined('EPL_ALIAS_PAIEMENT_ENCOMPTE')){\n XShell::setNext($GLOBALS['TZR_SESSION_MANAGER']::complete_self().'alias='.EPL_ALIAS_PAIEMENT_ENCOMPTE);} else {\n XShell::setNext($GLOBALS['TZR_SESSION_MANAGER']::complete_self(true, true).'&alias='.$this->aliasvente.'&moid='.$this->_moid.'&function=wtsLireOffres');\n }\n }", "public function actionAfficherecartcomptage()\n {\n \t$i=0;\n \t$cpt1=0;\n \t$cpt2=0;\n \t$cpttotal=0;\n \t$cptstr=0;\n \t$data=null;\n \t$model= new Inventorier();\n \t$searchModel = new InventorierSearch();\n \t$dataProvider = $searchModel->search(Yii::$app->request->queryParams);\n \t$cpttotal=$dataProvider->getTotalCount();\n \t$models=$dataProvider->getModels();\n \t\n \t/**************************traiter ecart entre les deux comptages **************************************/\n \t\n \t$selection=(array)Yii::$app->request->post('selection');//typecasting\n \t\n \tforeach($selection as $id)\n \t{\n \t\t$modeltr=$this->findModel($id);\n \t\t$modeltr->comptage1='1';\n \t\t$modeltr->comptage2='1';\n \t\t$modeltr->save();\n \t\t\n \t\t\n \t\t\n \t}\n \t\n \tif ($model->load(Yii::$app->request->post()))\n \t{\n \t\t$querystr = Structure::find();\n \t\t\n \t\t$dataProviderstr = new ActiveDataProvider([\n \t\t\t\t'query' => $querystr,\n \t\t\t\t]);\n \t\t$modelsstr=$dataProviderstr->getModels();\n \t\tforeach ($modelsstr as $rowstr)\n \t\t{\n \t\t\tif(intval($model->codestructure)==$rowstr->codestructure)\n \t\t\t{\n \t\t\t\t$model->designationstructure=$rowstr->designation;\n \t\t\t}\n \t\t}\n \t\t\n \t\t$searchModelbur = new BureauSearch();\n \t\t$dataProviderbur = $searchModelbur->search(Yii::$app->request->queryParams);\n \t\t$modelsbur=$dataProviderbur->getModels();\n \t\tforeach ($modelsbur as $rowbur)\n \t\t{\n \t\t\tif($rowbur->codestructure == intval($model->codestructure))\n \t\t\t{\n \t\t\t\t$searchModelaff = new AffecterSearch();\n \t\t\t\t$dataProvideraff = $searchModelaff->searchCodbur(Yii::$app->request->queryParams,$rowbur->codebureau);\n \t\t\t\t$modelsaff = $dataProvideraff->getModels();\n \t\t\n \t\t\t\tforeach ($modelsaff as $rowaff)\n \t\t\t\t{\n \t\t\t\t\t$searchModelbien = new BienSearch();\n \t\t\t\t\t$dataProviderbien = $searchModelbien->searchConsultationBienSelonCodestatut(Yii::$app->request->queryParams, $rowaff->codebien);\n \t\t\t\t\t$modelbien=$dataProviderbien->getModels();\n \t\t\n \t\t\t\t\tforeach ($modelbien as $rowbien)\n \t\t\t\t\t{\n \t\t\n \t\t\t\t\t\tif($rowbien->statutbien==\"affecte\")\n \t\t\t\t\t\t{\n \t\t\t\t\t\t\t$modeltrouv = Inventorier::findOne($rowbien->codebien);\n \t\t\t\t \t\t\t\t\n \t\t\t\t\t\t\tif ((($modeltrouv = Inventorier::findOne($rowbien->codebien)) !== null))\n \t\t\t\t\t\t\t\t{ \n \t\t\t\t\t\t\t\t\t$cptstr++;\n \t\t\t\t\t\t\t\t\tif(($modeltrouv->comptage1!=='1'&&$modeltrouv->comptage2=='1')||($modeltrouv->comptage1=='1'&&$modeltrouv->comptage2!=='1'))\n \t\t\t\t\t\t\t\t\t{ \n \t\t\t\t\t\t\t\t\t\tif(($modeltrouv->comptage1=='1'&&$modeltrouv->comptage2=='1'))\n \t\t\t\t\t\t\t\t\t\t{\n \t\t\t\t\t\t\t\t\t\t\t\n \t\t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t\t\telse\n \t\t\t\t\t\t\t\t\t\t{\n \t\t\t\t\t\t\t\t$data[$i] = ['codebien'=>$rowbien->codebien, 'designation'=>$rowbien->designationbien,'bureau'=>$rowbur->codebureau,'etat'=>$rowbien->etatbien,];\n \t\t\t\t\t\t\t\t $i++;\n \t\t\t\t\t\t\t\t $cpt1++;\n \t\t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t}\n \t\t\t\t\t\t}\n \t\t\t\t\t\telse\n \t\t\t\t\t\t{\n \t\t\t\t\t\t\t\t\n \t\t\t\t\t\t\tif($rowbien->statutbien==\"transfere\")\n \t\t\t\t\t\t\t{\n \t\t\t\t\t\t\t\t$bur=$this->dernierTransfert($rowbien->codebien);\n \t\t\t\t\t\t\t\t$modeltrouv = Inventorier::findOne($rowbien->codebien);\n \t\t\t\t\t\t\t\t\n \t\t\t\t\t\t\t\tif ((($modeltrouv = Inventorier::findOne($rowbien->codebien)) !== null))\n \t\t\t\t\t\t\t\t{ $cptstr++;\n \t\t\t\t\t\t\t\t\tif(($modeltrouv->comptage1=='1'&&$modeltrouv->comptage2!=='1')||($modeltrouv->comptage1!=='1'&&$modeltrouv->comptage2=='1'))\n \t\t\t\t\t\t\t\t\t {\n \t\t\t\t\t\t\t\t\t\tif(($modeltrouv->comptage1=='1'&&$modeltrouv->comptage2=='1')){\n \t\t\t\t\t\t\t\t\t\t\t\t\n \t\t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t\t\telse\n \t\t\t\t\t\t\t\t\t\t{\n \t\t\t\t\t\t\t\t\t\n \t\t\t\t\t\t\t\t\t$data[$i] = ['codebien'=>$rowbien->codebien, 'designation'=>$rowbien->designationbien,'bureau'=>$bur,'etat'=>$rowbien->etatbien,];\n \t\t\t\t\t\t\t\t\t$i++;\n \t\t\t\t\t\t\t\t\t$cpt1++;\n \t\t\t\t\t\t\t\t\t\t\n \t\t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t}\n \t\t\t\t\t\t}\n \t\t\t\t\t}\n \t\t\t\t}\n \t\t\t}\n \t\t}\n \t\t$prc=0;\n \t\tif($cptstr!=0)\n \t\t{ \n \t\t$prc=($cpt1)/$cptstr;\n \t\t$prc=$prc*100;\n \t\t}\n \t\t$prc=number_format($prc, 2, ',', ' ');\n \t\t\n \t\t$model->pourcentageecart=$prc.\" %\";\n \t\t\n \t\t$dataProviderRes = new ArrayDataProvider([\n \t\t\t\t'allModels' => $data,\n \t\t\t\t'key' =>'codebien',\n \t\t\t\t'sort' => [\n \t\t\t\t'attributes' => ['codebien','designation','bureau','etat',],\n \t\t\t\t\t\n \t\t\t\t],\n \t\t\t\t]);\n \t\t \n \t\t// $modeltest=$dataProviderRes->getModels();\n \t\t\n \t\t$dataProvider=$dataProviderRes;\n \t\t\n \t}\n \t\n \telse {\n \t\t\n \t\t\n \tforeach ($models as $row)\n \t{\n \t\tif(($row->comptage1=='1'&&$row->comptage2!='1'))\n \t\t{ \n \t\t\t$rowbien=Bien::findOne($row->codebien); \n \t\t\t$data[$i] = ['codebien'=>$row->codebien, 'designation'=>$rowbien->designationbien,'bureau'=>$row->bureau,'etat'=>$rowbien->etatbien,];\n \t\t\t$i++;\n \t\t\t$cpt1++; \n \t\t}\n \t\telse\n \t\t{\n\n \t\tif($row->comptage1!='1' && $row->comptage2=='1')\n \t\t{\n \t\t\t$rowbien=Bien::findOne($row->codebien); \n \t\t\t$data[$i] = ['codebien'=>$row->codebien, 'designation'=>$rowbien->designationbien,'bureau'=>$row->bureau,'etat'=>$rowbien->etatbien,];\n \t\t\t$i++;\n \t\t\t$cpt1++;\n \t\t}\n \t\t}\n \t\t\n \t}\n \t$prc=0;\n \tif ($cpttotal!=0)\n \t$prc=($cpt1)/$cpttotal;\n \t$prc=$prc*100;\n \t\n \t$seuil=0;\n \t$modelin=new Exerciceinventaire();\n \t$searchModelexerc= new ExerciceinventaireSearch();\n \t$dataProviderexerc = $searchModelexerc->search(Yii::$app->request->queryParams);\n \t\n \t\t$modelsexerc=$dataProviderexerc->getModels();\n \t\tforeach ($modelsexerc as $rowex)\n \t\t{ \n \t\t\tif($rowex->anneeinv==date('Y'))\n \t\t\t{\n \t\t\t\t\n \t\t\t\t$seuil=$rowex->seuil_compte;\n \t\t\t\tif($seuil<=$prc)\n \t\t\t\t{\n \t\t\t\t\t\\Yii::$app->getSession()->setFlash('info', \"L'écart entre les deux comptage est arrivé au seil, Vous devez passer au troisième comptage.\");\n \t\t\t\t\t\t\n \t\t\t\t}\n \t\t\t}\n \t\t\t\n \t\t}\n \t\t$prc=number_format($prc, 2, ',', ' ');\n \t\t\n \t\t$prc=$prc.\" %\";\n \t\t$model->pourcentageecart=$prc;\n \t$dataProviderRes = new ArrayDataProvider([\n \t\t\t'allModels' => $data,\n \t\t\t'key' =>'codebien',\n \t\t\t'sort' => [\n \t\t\t'attributes' => ['codebien','designation','bureau','etat',],\n \t\t\t\t\n \t\t\t],\n \t\t\t]);\n \t \n \t// $modeltest=$dataProviderRes->getModels();\n \t\n \t$dataProvider=$dataProviderRes;\n \t\n \t\n \t}\n \t \n \t \treturn $this->render('extraireEcartComptage', [\n \t\t\t'searchModel' => $searchModel,\n \t\t\t'dataProvider' => $dataProvider,\n \t\t\t'model'=>$model,\n \t\t\t]);\n }", "public function hasProducenum(){\n return $this->_has(35);\n }", "public function choosePrize(){\n if($this->adminVerify()){\n\n }else{\n echo \"Vous devez avoir les droits administrateur pour accéder à cette page\";\n }\n }", "public function hasProbs(){\n return $this->_has(1);\n }", "private function mensagemPrazoEmissao() {\n\n $oContribuinte = $this->_session->contribuinte;\n $iInscricaoMunicipal = $oContribuinte->getInscricaoMunicipal();\n $iIdContribuinte = $oContribuinte->getIdUsuarioContribuinte();\n\n try {\n\n $iQuantidadeNotasEmissao = Contribuinte_Model_NotaAidof::getQuantidadeNotasPendentes(\n $iInscricaoMunicipal,\n NULL,\n Contribuinte_Model_Nota::GRUPO_NOTA_RPS);\n\n if ($iQuantidadeNotasEmissao == 0) {\n\n $sMensagem = 'Limite de notas para emissão atingido, faça uma nova requisição.';\n $this->view->bloqueado_msg = $this->translate->_($sMensagem);\n\n return FALSE;\n }\n\n $oParamContribuinte = Contribuinte_Model_ParametroContribuinte::getById($iIdContribuinte);\n $sMensagemErroEmissao = 'Você possui \"%s\" notas para emissão. É importante gerar uma nova requisição.';\n\n // Verifica a quantidade de notas pela configuracao do Contribuinte\n if (is_object($oParamContribuinte) && $oParamContribuinte->getAvisofimEmissaoNota() > 0) {\n\n if ($iQuantidadeNotasEmissao <= $oParamContribuinte->getAvisofimEmissaoNota()) {\n\n $this->view->messages[] = array(\n 'warning' => sprintf($this->translate->_($sMensagemErroEmissao), $iQuantidadeNotasEmissao)\n );\n }\n } else {\n\n $oParamPrefeitura = Administrativo_Model_Prefeitura::getDadosPrefeituraBase();\n\n if (is_object($oParamPrefeitura) && $oParamPrefeitura->getQuantidadeAvisoFimEmissao() > 0) {\n\n if ($iQuantidadeNotasEmissao <= $oParamPrefeitura->getQuantidadeAvisoFimEmissao()) {\n\n $this->view->messages[] = array(\n 'warning' => sprintf($this->translate->_($sMensagemErroEmissao), $iQuantidadeNotasEmissao)\n );\n }\n }\n }\n } catch (Exception $e) {\n\n echo $this->translate->_('Ocorreu um erro ao verificar a quantidade limite para emissão de notas.');\n\n return FALSE;\n }\n\n return TRUE;\n }", "function commandes_trig_bank_reglement_en_attente($flux){\r\n\t// Si on est dans le bon cas d'un paiement de commande et qu'il y a un id_commande et que la commande existe toujours\r\n\tif ($id_transaction = $flux['args']['id_transaction']\r\n\t AND $transaction = sql_fetsel(\"*\",\"spip_transactions\",\"id_transaction=\".intval($id_transaction))\r\n\t\tAND $id_commande = $transaction['id_commande']\r\n\t\tAND $commande = sql_fetsel('id_commande, statut, id_auteur, mode', 'spip_commandes', 'id_commande='.intval($id_commande))){\r\n\r\n\t\t$statut_commande = $commande['statut'];\r\n\t\t$transaction_mode = $transaction['mode'];\r\n\t\t$commande_mode = $commande['mode'];\r\n\t\t$statut_nouveau = 'attente';\r\n\t\tif ($statut_nouveau !== $statut_commande OR $transaction_mode !==$commande_mode){\r\n\t\t\tspip_log(\"commandes_trig_bank_reglement_en_attente marquer la commande #$id_commande statut=$statut_nouveau mode=$transaction_mode\",'commandes');\r\n\t\t\t//on met a jour la commande\r\n\t\t\tinclude_spip(\"action/editer_commande\");\r\n\t\t\tcommande_modifier($id_commande,array('statut'=>$statut_nouveau,'mode'=>$transaction_mode));\r\n\t\t}\r\n\t}\r\n\r\n\treturn $flux;\r\n}", "function nbProduit(){\n\t$nombre = 0; \n\t\n\tif(isset($_SESSION['panier']['quantite'])){\n\t\tfor($i=0; $i < count($_SESSION['panier']['quantite']); $i++){\n\t\t// On tourne autant de fois qu'il y a de références dans le panier (nombre de ligne dans le petit tableau des quantités)\n\t\t\t$nombre += $_SESSION['panier']['quantite'][$i];\n\t\t}\n\t}\n\t\n\treturn $nombre;\n}", "function getNbProduits() {\n\t return $this->nbProduits;\n\t }", "function evt__procesar(){\n $m = $this->dep('datos')->tabla('mesa')->get();\n $p = array_search('junta_electoral', $this->s__perfil);\n if($p !== false){//Ingreso con perfil junta_electoral\n $m['estado'] = 3;//Cambia el estado de la mesa a Confirmado\n }\n else{\n $p = array_search('secretaria', $this->s__perfil);\n if($p !== false){//Ingreso con perfil secretaria\n $m['estado'] = 4;//Cambia el estado de la mesa a Definitivo\n }\n else{\n $p = array_search('autoridad_mesa', $this->s__perfil); \n if($p !== false){//Ingreso con perfil autoridad de mesa\n $m['estado'] = 1;//Cambia el estado de la mesa a Cargado\n }\n }\n }\n $this->dep('datos')->tabla('mesa')->set($m);\n// print_r($m['id_mesa']);\n $this->dep('datos')->tabla('mesa')->sincronizar();\n $this->dep('datos')->tabla('mesa')->resetear();\n \n \n if(isset($this->s__retorno)){//debe retornar a confirmar\n if($this->s__retorno_estado=='')\n $dato = true;\n else\n $dato['f'] = $this->s__retorno_estado;\n toba::vinculador()->navegar_a(\"\",$this->s__retorno,$dato); \n $this->s__retorno = null; \n $this->s__id_mesa = null;\n $this->s__retorno_estado = null;\n }\n }", "public function afficheProduits(){\r\n //Requete\r\n $sql=$this->db->conn_id->prepare (\"SELECT login, IdLot, nomBateau, nomEspece, specification, libellePresentation, LibelleQualite, poidsBrutLot, prixDepart, prixEncheresMax, dateEnchere, dateHeureFin, codeEtat, prixActuel, nbreJourLot FROM acheteur, lot, bateau, espece, peche, taille, presentation, qualite WHERE lot.IdAcheteur = acheteur.IdAcheteur AND bateau.IdBateau = lot.IdBateau AND espece.IdEspece = lot.IdEspece AND taille.IdTaille = lot.IdTaille AND presentation.IdPresentation = lot.IdPresentation AND qualite.IdQualite = lot.IdQualite AND codeEtat='en cours'\");\r\n /*(SELECT DATEDIFF(day, '2014-01-09', '2014-01-01');)*/\r\n $sql->execute();\r\n $donnees=$sql->fetchAll();//Execution total\r\n //ferme la connexion\r\n //$this->db=null;\r\n return $donnees;\r\n }", "public function findPagoDetalleMontoNegativo()\r\n\t\t{\r\n\t\t\t$registers = self::findPagoDetalleMontoNegativoModel();\r\n\t\t\tif ( !self::guardarConsultaRecaudacion($registers) ) {\r\n\t\t\t\tself::errorCargarData(Yii::t('backend', 'Montos Negativos'));\r\n\t\t\t}\r\n\t\t}", "public function cercaPrenotazioni() {\r\n $fPrenotazioni = USingleton::getInstance('FPrenotazione');\r\n return $fPrenotazioni->cercaPrenotazioniClinica($this->_partitaIVA);\r\n }", "function verifgrps($ar){\n $mess = 'Contrôle des champs pour la gestion des groupes';\n $mess .= '<br> <i>Table des groupes</i>';\n $ds = XDataSource::objectFactoryHelper8('BCLASS=XDSTable&SPECS='.self::$tableGROUPS);\n // champs logingrp, passwordgrp\n $fields = array('logingrp', 'passwordgrp');\n foreach($fields as $fn){\n if (!$ds->fieldExists($fn)){\n $mess .= '<br>-'.$fn.' existe pas';\n } else {\n $mess .= '<br>-'.$fn.' ok';\n }\n }\n $mess .= '<br> <i>Table des offres</i>';\n $ds = XDataSource::objectFactoryHelper8('BCLASS=XDSTable&SPECS='.self::$tableOFFER);\n // champ GRPAUTS\n $fields = array('GRPAUTS');\n foreach($fields as $fn){\n if (!$ds->fieldExists($fn)){\n $mess .= '<br>-'.$fn.' existe pas';\n } else {\n $mess .= '<br>-'.$fn.' ok';\n }\n }\n $mess .= '<br> <i>Table des cartes des groupes</i>';\n $ds = XDataSource::objectFactoryHelper8('BCLASS=XDSTable&SPECS='.self::$tableCARDSGROUP);\n // champs cpnid, dtdebval, dtfinval\n $fields = array('cpnid', 'dtdebval', 'dtfinval');\n foreach($fields as $fn){\n if (!$ds->fieldExists($fn)){\n $mess .= '<br>-'.$fn.' existe pas';\n } else {\n $mess .= '<br>-'.$fn.' ok';\n }\n }\n $mess .= '<br> <i>Table des configurations de produits</i>';\n $ds = XDataSource::objectFactoryHelper8('BCLASS=XDSTable&SPECS='.self::$tablePRDCONF);\n // champs justgrps (WTP GROUPE, COUPON UNIQUE, COUPON MULTI)\n $fields = array('justgrps');\n foreach($fields as $fn){\n if (!$ds->fieldExists($fn)){\n $mess .= '<br>-'.$fn.' existe pas';\n } else {\n $mess .= '<br>-'.$fn.' ok';\n }\n }\n $mess .= '<br> <i>Table des lignes de commandes</i>';\n $ds = XDataSource::objectFactoryHelper8('BCLASS=XDSTable&SPECS='.self::$tableORDERLINE);\n // champs LINEGRPJUSTIF\n $fields = array('LINEGRPJUSTIF');\n foreach($fields as $fn){\n if (!$ds->fieldExists($fn)){\n $mess .= '<br>-'.$fn.' existe pas';\n } else {\n $mess .= '<br>-'.$fn.' ok';\n }\n }\n XShell::setNext($this->getMainAction());\n setSessionVar('message', $mess);\n }", "function recuperarGanadores(){\n\t\t$votopro = new VotaProfesional();\n\t\t$res = $votopro->recuperarGanadores();\n\t\treturn $res;\n\t}", "public function listaProyectosTerminados(){\n\t\t$query = \"SELECT * FROM alm_proyecto WHERE ISNULL(alm_proy_usr_baja) AND \talm_proy_estado='13'\";\n\t\treturn $this->mysql->query($query);\n\t}", "function afficherRendezvouss(){\n\t\t$sql=\"SElECT * From rendezvous\";\n\t\t$db = config::getConnexion();\n\t\ttry{\n\t\t$liste=$db->query($sql);\n\t\treturn $liste;\n\t\t}\n catch (Exception $e){\n die('Erreur: '.$e->getMessage());\n }\t\n\t}", "public function setForAuteur()\n {\n //met à jour les proposition qui n'ont pas de base contrat et qui ne sont pas null\n /*PLUS BESOIN DE BASE CONTRAT\n \t\t$dbP = new Model_DbTable_Iste_proposition();\n \t\t$dbP->update(array(\"base_contrat\"=>null), \"base_contrat=''\");\n */\n\t \t//récupère les vente qui n'ont pas de royalty\n\t \t$sql = \"SELECT \n ac.id_auteurxcontrat, ac.id_livre\n , ac.id_isbn, ac.pc_papier, ac.pc_ebook\n , a.prenom, a.nom, c.type, IFNULL(a.taxe_uk,'oui') taxe_uk\n ,i.num\n , v.id_vente, v.date_vente, v.montant_livre, v.id_boutique, v.type typeVente\n , i.id_editeur, i.type typeISBN\n , impF.conversion_livre_euro\n FROM iste_vente v\n INNER JOIN iste_isbn i ON v.id_isbn = i.id_isbn \n INNER JOIN iste_importdata impD ON impD.id_importdata = v.id_importdata\n INNER JOIN iste_importfic impF ON impF.id_importfic = impD.id_importfic\n INNER JOIN iste_auteurxcontrat ac ON ac.id_isbn = v.id_isbn\n INNER JOIN iste_contrat c ON c.id_contrat = ac.id_contrat\n INNER JOIN iste_auteur a ON a.id_auteur = ac.id_auteur\n INNER JOIN iste_livre l ON l.id_livre = i.id_livre \n LEFT JOIN iste_royalty r ON r.id_vente = v.id_vente AND r.id_auteurxcontrat = ac.id_auteurxcontrat\n WHERE pc_papier is not null AND pc_ebook is not null AND pc_papier != 0 AND pc_ebook != 0\n AND r.id_royalty is null \";\n\n $stmt = $this->_db->query($sql);\n \n \t\t$rs = $stmt->fetchAll(); \n \t\t$arrResult = array();\n \t\tforeach ($rs as $r) {\n\t\t\t//calcule les royalties\n \t\t\t//$mtE = floatval($r[\"montant_euro\"]) / intval($r[\"nbA\"]);\n \t\t\t//$mtE *= floatval($r[\"pc_papier\"])/100;\n \t\t\tif($r[\"typeVente\"]==\"ebook\")$pc = $r[\"pc_ebook\"];\n \t\t\telse $pc = $r[\"pc_papier\"];\n $mtL = floatval($r[\"montant_livre\"])*floatval($pc)/100;\n //ATTENTION le taux de conversion est passé en paramètre à l'import et le montant des ventes est calculé à ce moment\n \t\t\t//$mtD = $mtL*floatval($r[\"taux_livre_dollar\"]);\n \t\t\t$mtE = $mtL*floatval($r['conversion_livre_euro']);\n //ajoute les royalties pour l'auteur et la vente\n //ATTENTION les taxes de déduction sont calculer lors de l'édition avec le taux de l'année en cours\n $dt = array(\"pourcentage\"=>$pc,\"id_vente\"=>$r[\"id_vente\"]\n ,\"id_auteurxcontrat\"=>$r[\"id_auteurxcontrat\"],\"montant_euro\"=>$mtE,\"montant_livre\"=>$mtL\n ,\"conversion_livre_euro\"=>$r['conversion_livre_euro']);\n\t \t\t$arrResult[]= $this->ajouter($dt\n ,true,true);\n //print_r($dt);\n \t\t}\n \t\t\n \t\treturn $arrResult;\n }", "function afficher_produits_commande($id_resto) {\n global $connexion;\n try {\n $select = $connexion -> prepare(\"SELECT * \n FROM lunchr_commandes as lc, \n lunchr_ligne_commande as lcl, \n lunchr_produits as lp\n WHERE lc.lc_id = lcl.lc_id\n AND lp.lp_id = lcl.lp_id\n AND lc.lc_id = :id_resto\");\n $select -> execute(array(\"id_resto\" => $id_resto));\n $select -> setFetchMode(PDO::FETCH_ASSOC);\n $resultat = $select -> fetchAll();\n return $resultat;\n }\n \n catch (Exception $e) {\n print $e->getMessage();\n return false;\n }\n }", "function query_abilita() {\r\n\t\t$in=$this->session_vars;\r\n\t\t$conn=$this->conn;\r\n\t\t$query = new query ( $conn );\r\n\t\t$nq = 0;\r\n\t\tfor($en = 0; $en < count ( $this->enable ); $en ++) {\r\n\t\t\tif (isset ( $in ['invia'] ) || $in ['INVIOCO'] == '1' || $this->enable [$en] ['ONSAVE'] != '') {\r\n\t\t\t\t#echo \"<hr>Controllo abilitazioni\";\r\n\t\t\t\tif ($in ['PROGR'] == '')\r\n\t\t\t\t$in ['PROGR'] = 1;\r\n\t\t\t\t$vis_num = $this->enable [$en] ['VISITNUM'];\r\n\t\t\t\t$es_num = $this->enable [$en] ['NUMBER'];\r\n\r\n\t\t\t\tif ($this->enable [$en] ['PROGR'] != '')\r\n\t\t\t\t$in ['PROGR'] = $this->enable [$en] ['PROGR'];\r\n\t\t\t\t$cond_var = $this->enable [$en] ['CONDITION_VAR'];\r\n\t\t\t\t$cond_val = $this->enable [$en] ['CONDITION_VALUE'];\r\n\t\t\t\tif ($cond_var == '' || ($cond_var != '' && $in [$cond_var] == $cond_val)) {\r\n\t\t\t\t\t#echo \"<hr>Controllo abilitazioni 1\";\r\n\t\t\t\t\t$config_service=$this->config_service;\r\n\t\t\t\t\tunset($bind);\r\n\t\t\t\t\tif ($config_service ['VISITNUM_PROGR'] == '1') {\r\n\t\t\t\t\t\tif ($this->enable [$en] ['VISITNUM_PROGR'] != '')\r\n\t\t\t\t\t\t$vis_progr = $this->enable [$en] ['VISITNUM_PROGR'];\r\n\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\tif (isset ( $in ['VISITNUM_PROGR'] )) {\r\n\t\t\t\t\t\t\t\t$vis_progr = $in ['VISITNUM_PROGR'];\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t$vis_progr = 0;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t$agg_sql_insert_field = \",visitnum_progr\";\r\n\t\t\t\t\t\t$agg_sql_insert_value = \",$vis_progr\";\r\n\t\t\t\t\t\t$where_agg = \" and visitnum_progr=:visitnum_progr\";\r\n\t\t\t\t\t\t$bind['VISITNUM_PROGR']=$vis_progr;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$bind['VISITNUM']=$vis_num;\r\n\t\t\t\t\t$bind['ESAM']=$es_num;\r\n\t\t\t\t\t$bind['PROGR']=$in ['PROGR'];\r\n\t\t\t\t\t$bind['PK_SERVICE']=$in [$this->PK_SERVICE];\r\n\t\t\t\t\tif (strtolower ( $this->enable [$en] ['PROGR'] ) == 'next') {\r\n\t\t\t\t\t\t$query_progr = \"select max(progr) PROGR from \" . $this->service . \"_coordinate where visitnum=:visitnum and esam=:esam and {$this->PK_SERVICE}=:pk_service $where_agg\";\r\n\t\t\t\t\t\t$sql = new query ( $conn );\r\n\t\t\t\t\t\t//$sql->set_sql ( $query_progr );\r\n\t\t\t\t\t\t$sql->exec ($query_progr,$bind);//binded\r\n\t\t\t\t\t\t$sql->get_row ();\r\n\t\t\t\t\t\t$in ['PROGR'] = $sql->row ['PROGR'] + 1;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$query_abil = \"select * from \" . $this->service . \"_coordinate where visitnum=:visitnum and esam=:esam and progr=:progr and {$this->PK_SERVICE}=:pk_service $where_agg\";\r\n//\t\t\t\t\techo $query_abil.\"<br>\";\r\n\t\t\t\t\t//$query->set_sql ( $query_abil );\r\n\t\t\t\t\t\r\n\t\t\t\t\t$query->exec ($query_abil,$bind);//binded\r\n\t\t\t\t\tif (! ($query->numrows >= 1)) {\r\n\t\t\t\t\t\t$query_ins_abil = \"insert into \" . $this->service . \"_coordinate (visitnum $agg_sql_insert_field,esam,progr,{$this->PK_SERVICE}, abilitato, userid) values ('$vis_num' $agg_sql_insert_value ,'$es_num','\" . $in ['PROGR'] . \"','\" . $in [$this->PK_SERVICE] . \"','1', null)\";\r\n\t\t\t\t\t\t$this->query_enable [$nq] = $query_ins_abil;\r\n\t\t\t\t\t\t$nq ++;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public function suprRegimentAppartenance()\n {\n //sécurité :\n $action = 'deleteFolderInformation';\n $error = AccessControll::checkRight($action);\n if ( empty($error) ){ //ok\n //on réccupère l'id à supr (clée primaire)\n $id = $this->request->getGetAttribute('id');\n //ajout d'une entrée dans le fichier de log\n $data = DossierManager::getAppartenanceByClef($id);\n $auth = AuthenticationManager::getInstance();\n $username = $auth->getMatricule();\n $type = 'appartenanceRegiment';\n self::logDeletedInformation($data, $username, $type);\n //on supprime (retourne le matricule)\n $matricule = DossierManager::suprRegimentAppartenanceById($id);\n //on réaffiche le dossier actualisé\n $dossier = DossierManager::getOneFromId($matricule);\n $prez = self::afficheDossierComplet($dossier);\n $this->response->setPart('contenu', $prez);\n } else{\n header(\"location: index.php\");\n die($error);\n }\n }", "public function historiqueEnvoie($datedeb, $datefin, $agence)\n {\n require_once('../../lib/classes/Profil.php');\n $profils = new Profil();\n $date1 = $datedeb;\n $date2 = $datefin;\n $agency = $agence;\n $cond=\"\";\n $select= \"\";\n $from=\"\";\n $inclu\n =\"\";\n\n $type_profil=$profils->getProfilByIdInteger($this->idprofil);\n if($type_profil==1)\n {\n $cond.=\" AND tranfert.user_receiver=\".$_SESSION['rowid'];\n }\n if($type_profil==2 || $type_profil==3 || $type_profil==4)\n {\n $cond.=\" AND tranfert.user_receiver = user.rowid AND user.fk_agence =\".$this->idagence;\n }\n\n if($type_profil==6)\n {\n $from.=\", region \";\n $cond.=\" AND user.fk_agence = agence.rowid AND agence.region = region.idregion AND region.DR =\".$_SESSION['fk_DR'] ;\n }\n\n if($agency!=0)\n {\n $inclu.=\" AND agence.rowid =:agency\";\n }else{\n $inclu.=\" \";\n }\n\n $query_rq_historique = \" SELECT tranfert.idtransfert,tranfert.num_transac,tranfert.montant,tranfert.code, tranfert.frais, tranfert.montant_total, \";\n $query_rq_historique.= \" tranfert.date_tranfert, tranfert.nom_sender, tranfert.prenom_sender, tranfert.cin_sender, tranfert.tel_sender, tranfert.pays_sender, \";\n $query_rq_historique.= \" tranfert.nom_receiver, tranfert.prenom_receiver, tranfert.tel_receiver, tranfert.cin_receiver, tranfert.pays_receiver, tranfert.ville_receiver, \";\n $query_rq_historique.= \" tranfert.adresse_receiver,transaction.num_transac, tranfert.user_receiver \";\n $query_rq_historique.= \" FROM tranfert, transaction, agence, user \".$from;\n $query_rq_historique.= \" WHERE tranfert.statut=1 \".$cond.\"\n\t\t\t AND DATE(tranfert.date_tranfert) >= :date1\n\t\t\t AND DATE(tranfert.date_tranfert) <= :date2\n\t\t\t \".$inclu.\"\n\t\t\t AND tranfert.num_transac = transaction.num_transac\n\t\t\t AND transaction.fkuser = user.rowid\n\t\t\t AND user.fk_agence = agence.rowid\";\n $query_rq_historique.= \" ORDER BY transaction.date_transaction DESC \";\n $historique = $this->getConnexion()->prepare($query_rq_historique);\n $historique->bindParam(\"date1\", $date1);\n $historique->bindParam(\"date2\", $date2);\n if($agency!=0) $historique->bindParam(\"agency\", $agency);\n $historique->execute();\n $rs_historique= $historique->fetchAll();\n return $rs_historique;\n }", "function recuperarFinalistas(){\n\t\t$votopro = new VotaProfesional();\n\t\t$res = $votopro->recuperarFinalistas();\n\t\treturn $res;\n\t}", "function cicleinscription_get_vacancies_remaning(){\n\t\n}", "function contarReprobados($espacios_por_cursar){\n $cantidad=0;\n if(count($espacios_por_cursar)>0){\n foreach ($espacios_por_cursar as $key => $espacio) {\n if($espacio['REPROBADO']==1){\n $cantidad++;\n \t }\n }\n }\n return $cantidad; \n }", "function commandes_bank_traiter_reglement($flux){\r\n\t// Si on est dans le bon cas d'un paiement de commande et qu'il y a un id_commande et que la commande existe toujours\r\n\tif (\r\n\t\t$id_transaction = $flux['args']['id_transaction']\r\n\t\tand $transaction = sql_fetsel(\"*\",\"spip_transactions\",\"id_transaction=\".intval($id_transaction))\r\n\t\tand $id_commande = $transaction['id_commande']\r\n\t\tand $commande = sql_fetsel('id_commande, statut, id_auteur, echeances, reference', 'spip_commandes', 'id_commande='.intval($id_commande))\r\n\t){\r\n\t\t$statut_commande = $commande['statut'];\r\n\t\t$montant_regle = $transaction['montant_regle'];\r\n\t\t$transaction_mode = $transaction['mode'];\r\n\t\t$statut_nouveau = 'paye';\r\n\r\n\r\n\t\t// Si la commande n'a pas d'échéance, le montant attendu est celui du prix de la commande\r\n\t\tinclude_spip('inc/commandes_echeances');\r\n\t\tif (!$commande['echeances']\r\n\t\t\tor !$echeances = unserialize($commande['echeances'])\r\n\t\t or !$desc = commandes_trouver_prochaine_echeance_desc($id_commande, $echeances, true)\r\n\t\t or !isset($desc['montant'])) {\r\n\t\t\t$fonction_prix = charger_fonction('prix', 'inc/');\r\n\t\t\t$montant_attendu = $fonction_prix('commande', $id_commande);\r\n\t\t}\r\n\t\t// Sinon le montant attendu est celui de la prochaine échéance (en ignorant la dernière transaction OK que justement on cherche à tester)\r\n\t\telse {\r\n\t\t\t$montant_attendu = $desc['montant'];\r\n\t\t}\r\n\t\tspip_log(\"commande #$id_commande attendu:$montant_attendu regle:$montant_regle\", 'commandes');\r\n\r\n\t\t// Si le plugin n'était pas déjà en payé et qu'on a pas assez payé\r\n\t\t// (si le plugin était déjà en payé, ce sont possiblement des renouvellements)\r\n\t\tif (\r\n\t\t\t$statut_commande != 'paye'\r\n\t\t\tand (floatval($montant_attendu) - floatval($montant_regle)) >= 0.01\r\n\t\t){\r\n\t\t\t$statut_nouveau = 'partiel';\r\n\t\t}\r\n\t\t\r\n\t\t// S'il y a bien un statut à changer\r\n\t\tif ($statut_nouveau !== $statut_commande){\r\n\t\t\tspip_log(\"commandes_bank_traiter_reglement marquer la commande #$id_commande statut: $statut_commande -> $statut_nouveau mode=$transaction_mode\",'commandes');\r\n\t\t\t// On met a jour la commande\r\n\t\t\tinclude_spip(\"action/editer_commande\");\r\n\t\t\tcommande_modifier($id_commande, array('statut'=>$statut_nouveau, 'mode'=>$transaction_mode));\r\n\t\t}\r\n\r\n\t\t// un message gentil pour l'utilisateur qui vient de payer, on lui rappelle son numero de commande\r\n\t\t$flux['data'] .= \"<br />\"._T('commandes:merci_de_votre_commande_paiement',array('reference'=>$commande['reference']));\r\n\t}\r\n\r\n\treturn $flux;\r\n}", "public function getPros()\r\n {\r\n return $this->_pros;\r\n }", "public function nbProduits(){\n\treturn count($this->listeProduits);\n }", "function getLesIdProduitsDuPanier()\n{\n\treturn $_SESSION['produits'];\n\n}", "public function videPanier()\n {\n $this->CollProduit->vider();\n }", "public function prixtotal(){\r\n\t\t\t\trequire(\"connexiondatabase.php\");\r\n\t\t/*on fait ici une somme des différent object commandé et on reourne*/\r\n\t\t$prixtotal=0;\r\n\t\t//on recupere les id des produis sélectionner pour faire la requette\r\n\t\t$ids = array_keys($_SESSION['panier']);\r\n\t\tif (empty($ids)) {//si les id sont vide, \r\n\t\t\t$produits=array(); // \r\n\t\t}else{\r\n\r\n\t\t$produits = $connexion->prepare('SELECT id, prix FROM produits WHERE id IN ('.implode(',' ,$ids).')');\r\n\t\t$produits->execute();\r\n\t\t}\r\n\r\n\t\twhile ($produit=$produits->fetch(PDO::FETCH_OBJ)){\r\n\t\t\t$prixtotal +=$produit->prix*$_SESSION['panier'][$produit->id];\r\n\t\t}\r\n\t\treturn $prixtotal;\r\n\t}", "public function GetNoticias(){\r\n return $this -> __buscar; \r\n \r\n }", "function consultarEstudiantesSinPrueba(){\n $cadena_sql=$this->cadena_sql(\"estudiantesSinPrueba\",$this->codProyecto);\n $estudiantes=$this->funcionGeneral->ejecutarSQL($this->configuracion, $this->accesoGestion, $cadena_sql,\"busqueda\" );\n return $estudiantes;\n }", "function TrouveNbConversations($utilisateur){\r\n\t\t$conn = mysqli_connect(\"localhost\", \"root\", \"\", \"bddfinale\");\r\n\t\t$requete = \"SELECT mp_expediteur,mp_receveur FROM messages WHERE ((mp_expediteur='$utilisateur')||(mp_receveur='$utilisateur'))\";\r\n\t\t$ligne= mysqli_query($conn, $requete); \r\n\t\t$n = mysqli_num_rows($ligne);\r\n\t\t$Tab = array();\t\t//Tableau de tous les profils qui ont une conversation avec l'utilisateur\r\n\t\tif ($n > 0) {\r\n\t\t\twhile ($TabLigne = mysqli_fetch_assoc($ligne)) { \r\n\t\t\t\tif($TabLigne[\"mp_expediteur\"]!=$utilisateur){\r\n\t\t\t\t$Tab[] = $TabLigne[\"mp_expediteur\"];\r\n\t\t\t\t}\r\n\t\t\t\tif($TabLigne[\"mp_receveur\"]!=$utilisateur){\r\n\t\t\t\t$Tab[] = $TabLigne[\"mp_receveur\"];\r\n\t\t\t\t}\r\n\t\t\t} \r\n\t\t}\r\n\t\tmysqli_close($conn);\r\n\t\t\r\n\t\t$TabConv=array();\t\t//tableau definitif des gens ayant une conversation avec l'utilisateur == sans doublons\r\n\t\tfor($i=0;$i<$n;$i++){ \t//on parcourt le tab de resultats\r\n\t\t\t$boule=0;\r\n\t\t\tfor($j=0;$j<sizeof($TabConv);$j++){\t//on verifie que le profil n'est pas déjà dans le tableau \r\n\t\t\t\tif($Tab[$i]==$TabConv[$j]){\r\n\t\t\t\t$boule=1;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif($boule==0){\t//si \"nouveau\" profil on l'ajoute au tableau des conversations\r\n\t\t\t$TabConv[] = $Tab[$i];\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn $TabConv;\t\t\t\r\n\t\t}", "public function unpaidWorkers() \r\n\t{\r\n\t\t$query = \"SELECT count(ID_PLATA) as Neplaceni FROM \" . $this->table . \" \r\n\t\tWHERE id_plata = 2\";\r\n\r\n\t\t$stmt = $this->conn->prepare($query);\r\n\t\t$stmt->execute();\r\n\r\n\t\t$row = $stmt->fetch(PDO::FETCH_ASSOC);\r\n\t\t$neplaceni = $row['Neplaceni'];\r\n\t\t\r\n\t\treturn $neplaceni;\r\n\t\t\r\n\t}", "function setAgregarUnPais(){\n\t\t$this->comienza_con++;\n\t}", "public static function proba(){\n \n $prodaja = new Application_Model_DbTable_Prodaja();\n \n //$upit=\"SELECT naziv_proizvoda FROM prodaja WHERE id=\".$id;\n \n //$rezultat=$db->query($upit);\n \n $select = $prodaja->select();\n \n $rezultat=$prodaja->fetchAll($select);\n \n return $rezultat;\n \n \n \n }", "function afficherachats(){\n\t\t$sql=\"SElECT * From achat order by ref\";\n\t\t$db = config::getConnexion();\n\t\ttry{\n\t\t$liste=$db->query($sql);\n\t\treturn $liste;\n\t\t}\n\t catch (Exception $e){\n die('Erreur: '.$e->getMessage());\n }\t\n\t}", "public function getNoRegistrasi()\n {\n return $this->hasOne(DataPribadi::className(), ['no_registrasi' => 'no_registrasi']);\n }", "function buscarEspaciosReprobados($notaAprobatoria) {\r\n \r\n $reprobados=isset($reprobados)?$reprobados:'';\r\n $espacios=isset($reprobados)?$reprobados:'';\r\n \r\n if (is_array($this->espaciosCursados)){\r\n foreach ($this->espaciosCursados as $value) {\r\n if (isset($value['NOTA'])&&($value['NOTA']<$notaAprobatoria||$value['CODIGO_OBSERVACION']==20||$value['CODIGO_OBSERVACION']==23||$value['CODIGO_OBSERVACION']==25)){\r\n if ($value['CODIGO_OBSERVACION']==19||$value['CODIGO_OBSERVACION']==22||$value['CODIGO_OBSERVACION']==24)\r\n {\r\n }else\r\n {\r\n $espacios[]=$value['CODIGO'];\r\n }\r\n }\r\n }\r\n if(is_array($espacios)){\r\n \r\n $espacios= array_unique($espacios);\r\n if($this->datosEstudiante['IND_CRED']=='S'){\r\n \r\n foreach ($espacios as $key => $espacio) {\r\n foreach ($this->espaciosCursados as $cursado) {\r\n if($espacio==$cursado['CODIGO']){\r\n $reprobados[$key]['CODIGO']=$cursado['CODIGO'];\r\n $reprobados[$key]['CREDITOS']=(isset($cursado['CREDITOS'])?$cursado['CREDITOS']:0);\r\n }\r\n }\r\n\r\n }\r\n }else{\r\n $reprobados=$espacios;\r\n }\r\n return $reprobados; \r\n \r\n }else{\r\n return 0; \r\n }\r\n \r\n }\r\n else\r\n {\r\n return 0;\r\n }\r\n }", "public function fees_nonreconcile(){\n\t\t$who_reconame = $this->session->userdata('username');\n \t$whdata= array('asfee_feeamount >' => 0,'asfee_reconcilestatus' =>'N');\n \t$this->stu_feedata = $this->commodel->get_listarry('admissionstudent_fees','*',$whdata);\n\t\t$sfee_id=$this->uri->segment(3);\n\n\t\t$this->load->view('enterenceadmin/ent_feesnonreconcile');\n\t\t$this->logger->write_logmessage(\"view\",\"Non reconcile fee page show.\");\n $this->logger->write_dblogmessage(\"view\",\"Reconcile is update.\" );\n\t}", "public function partirAuTravail(): void\n\t{\n\t}", "function afficher_produits()\n{\n\t$sql = \"SELECT * FROM produit\";\n\tglobal $connection;\n\treturn mysqli_query($connection, $sql);\n}", "public function ubah_status_pros()\n {\n $st = $this->uri->segment(3);\n $id_pros = $this->uri->segment(4);\n\n $data = ['status' => $st];\n\n $this->M_prospektus->proses_ubah_status_pros($data, array('id_prospektus' => $id_pros));\n\n // ubah keterangan pada tabel blok menjadi null\n $hasil_id_blok = $this->M_prospektus->ambil_id_blok($id_pros)->row_array();\n\n if ($st == 1) {\n\n $data2 = ['keterangan' => null];\n\n $this->M_prospektus->proses_ubah_ket_blok($data2, $hasil_id_blok['id_blok']);\n\n } elseif ($st == 2) {\n\n $data2 = ['keterangan' => 'kontributor'];\n\n $this->M_prospektus->proses_ubah_ket_blok($data2, $hasil_id_blok['id_blok']);\n }\n\n redirect('prospektus/approve_pros');\n }", "private function respuesta_provincias(){\n\t\t\n\t\t$user = $this->session->userdata('cliente_id');\n\n\t\t//Crear mensaje preguntando\n\n\t\t$data_in = array(\n 'from_id' \t=> 0,\n 'to_id' \t=> $user,\n 'mensaje' => 'Para brindarle más información, por favor indique la ubicación del proyecto en el que está interesado.',\n 'date'\t\t=> applib::fecha()\n );\n\n applib::create(applib::$mensajes_table,$data_in);\n\n\t\t//Crear mensaje de botones\n\n\t\t$mensaje = $this->load->view('frontend/comunes/botones_provincia',null,true);\n\n\t\t$data_in['mensaje'] = $mensaje;\n\t\t$data_in['sin_fondo'] = 1;\n \n applib::create(applib::$mensajes_table,$data_in);\n\n return true;\n\t}", "public function pesquisaProfissionalAction()\r\n\t{\r\n\t\t$this->_helper->viewRenderer->setNoRender(true);\r\n\t\t$this->_helper->layout->disableLayout();\r\n\r\n\t\t// Recupera os parametros enviados por get\r\n\t\t$cd_objeto = $this->_request->getParam('cd_objeto',0);\r\n\r\n\t\t// Caso tenha sido enviada a opcao selecione do combo. Apenas para garantir caso o js falhe nesta verificacao\r\n\t\tif ($cd_objeto == -1) {\r\n\t\t\techo '';\r\n\t\t} else {\r\n\t\t\t/*\r\n\t\t\t * Cria uma instancia do modelo e pesquisa pelos profissionais alocado ao projeto selecionado e aos profissionais que nao estao\r\n\t\t\t * alocados ao mesmo \r\n\t\t\t */\r\n\t\t\t$profissional = new ProfissionalObjetoContrato($this->_request->getControllerName());\r\n\r\n\t\t\t// Recordset de profissionais que nao se encontram no projeto selecionado\r\n $foraObjeto = $profissional->pesquisaProfissionalForaObjeto($cd_objeto);\r\n\r\n\t\t\t// Recordset de profissionais que se encontram no projeto selecionado\r\n\t\t\t$noObjeto = $profissional->pesquisaProfissionalNoObjeto($cd_objeto,true);\r\n\r\n\t\t\t/*\r\n\t\t\t * Os procedimentos abaixo criam os options dos selects de acordo com o seu respectivo recordset. \r\n\t\t\t * Posteriormente eh criado um json que eh enviado ao client (javascript) que adiciona os options aos selects\r\n\t\t\t */\r\n\t\t\t$arr1 = \"\";\r\n\r\n\t\t\tforeach ($foraObjeto as $fora) {\r\n\t\t\t\t$arr1 .= \"<option value=\\\"{$fora['cd_profissional']}\\\">{$fora['tx_profissional']}</option>\";\r\n\t\t\t}\r\n\r\n\t\t\t$arr2 = \"\";\r\n\t\t\tforeach ($noObjeto as $no) {\r\n\t\t\t\t$arr2 .= \"<option value=\\\"{$no['cd_profissional']}\\\">{$no['tx_profissional']}</option>\";\r\n\t\t\t}\r\n\r\n\t\t\t$retornaOsDois = array($arr1, $arr2);\r\n\r\n\t\t\techo Zend_Json_Encoder::encode($retornaOsDois);\r\n\t\t}\r\n\t}", "private function negarDetalleSolicitud()\r\n {\r\n $result = false;\r\n $modelInscripcion = self::findInscripcionSucursal();\r\n if ( $modelInscripcion !== null ) {\r\n if ( $modelInscripcion['id_contribuyente'] == $this->_model->id_contribuyente ) {\r\n $result = self::updateSolicitudInscripcion($modelInscripcion);\r\n } else {\r\n self::setErrors(Yii::t('backend', 'Error in the ID of taxpayer'));\r\n }\r\n }\r\n\r\n return $result;\r\n }", "public function jml_permohonan_prosesBO()\n {\n $this->db->select('id_permohonan_ptsp, COUNT(id_permohonan_ptsp) as permohonan_prosesBO');\n $this->db->from('permohonan_ptsp');\n $this->db->where(\n 'status',\n 'Proses BO'\n );\n $this->db->where('status_delete', 0);\n\n $hasil = $this->db->get();\n return $hasil;\n }", "function getEspecialDisponibilidadPonderada() {\n \t\tglobal $mdb2;\n \t\tglobal $log;\n \t\tglobal $current_usuario_id;\n \t\tglobal $usr;\n\n\t\t//TRAE LAS PONDERACIONES DEL OBJETIVO ESPECIAL\n\t\t$ponderaciones_hora = $this->extra['ponderaciones'];\n\t\t//DATO PARA LA CONSULTA SQL, LISTA LAS HORAS DEL DÍA\n\t\t//SI ES 0 TRAE LAS 24 HORAS\n\t\t$ponderacion = $usr->getPonderacion();\n\n\t\tif ($ponderacion == null) {\n\t\t\t$ponderacion_id = 0;\n\t\t}\n\t\telse {\n\t\t\t$ponderacion_id = $ponderacion->ponderacion_id;\n\t\t}\n\n\t\t$sql = \"SELECT * FROM reporte.disponibilidad_resumen_global_ponderado_poritem(\".\n \t\t\t\tpg_escape_string($current_usuario_id).\",\".\n \t\t\t\tpg_escape_string($this->objetivo_id).\", \".\n \t\t\t\tpg_escape_string($ponderacion_id).\",' \".\n \t\t\t\tpg_escape_string($this->timestamp->getInicioPeriodo()).\"', '\".\n \t\t\t\tpg_escape_string($this->timestamp->getTerminoPeriodo()).\"')\";\n \t\t//echo '<3>'.$sql.'<br>';\n\n \t\t$res = & $mdb2->query($sql);\n \t\tif (MDB2::isError($res)) {\n \t\t\t$log->setError($sql, $res->userinfo);\n \t\t\texit();\n \t\t}\n\n \t\tif($row = $res->fetchRow()){\n \t\t\t$dom = new DomDocument();\n \t\t\t$dom->preserveWhiteSpace = FALSE;\n\t\t\t$dom->loadXML($row[\"disponibilidad_resumen_global_ponderado_poritem\"]);\n \t\t\t$xpath = new DOMXpath($dom);\n\t\t\tunset($row[\"disponibilidad_resumen_global_ponderado_poritem\"]);\n \t\t}\n\n\n \t\t$conf_pasos = $xpath->query(\"/atentus/resultados/propiedades/objetivos/objetivo/paso[@visible=1]\");\n \t\t$conf_eventos = $xpath->query(\"/atentus/resultados/propiedades/eventos/evento\");\n\t\t$conf_ponderaciones = $xpath->query(\"/atentus/resultados/propiedades/ponderaciones/item\");\n\n \t\t//SI NO HAY DATOS MOSTRAR MENSAJE\n \t\tif (!$conf_pasos->length or $xpath->query(\"/atentus/resultados/detalles/detalle/detalles/detalle\")->length == 0) {\n \t\t\t$this->resultado = $this->__generarContenedorSinDatos();\n \t\t\treturn;\n \t\t}\n\t\t//VALIDA QUE NO HAYA MAS DEL 100% DE PONDERACIONES\n\t\tforeach ($ponderaciones_hora as $value) {\n\t\t\t$suma_pond += $value->valor_ponderacion;\n\t\t}\n\n\t\tif (number_format($suma_pond, 2) > 100) {\n\t\t\t$this->resultado = 'EL TOTAL DE LAS PONDERACIONES DEBE SER IGUAL A 100%.<br>ES SUPERIROR AL 100%.';\n\t\t\treturn;\n\t\t}elseif (number_format($suma_pond, 2) < 100) {\n\t\t\t$this->resultado = 'EL TOTAL DE LAS PONDERACIONES DEBE SER IGUAL A 100%.<br>ES MENOR AL 100%.';\n\t\t\treturn;\n \t\t}\n\n \t\t$T =& new Template_PHPLIB(($this->extra[\"imprimir\"])?REP_PATH_PRINTTEMPLATES:REP_PATH_TABLETEMPLATES);\n \t\t$T->setFile('tpl_tabla', 'especial_disponibilidad_resumen.tpl');\n \t\t$T->setBlock('tpl_tabla', 'BLOQUE_EVENTOS_TITULOS', 'bloque_eventos_titulos');\n \t\t$T->setBlock('tpl_tabla', 'BLOQUE_EVENTOS', 'bloque_eventos');\n \t\t$T->setBlock('tpl_tabla', 'BLOQUE_PASOS', 'bloque_pasos');\n \t\t$T->setBlock('tpl_tabla', 'BLOQUE_TITULO_HORARIOS', 'bloque_titulo_horarios');\n \t\t$T->setBlock('tpl_tabla', 'BLOQUE_HORARIOS', 'bloque_horarios');\n\n \t\t$T->setVar('bloque_titulo_horarios', '');\n \t\t$T->setVar('bloque_eventos_titulos', '');\n \t\tforeach ($conf_eventos as $conf_evento) {\n \t\t\t$T->setVar('__evento_nombre', $conf_evento->getAttribute(\"nombre\"));\n \t\t\t$T->parse('bloque_eventos_titulos', 'BLOQUE_EVENTOS_TITULOS', true);\n \t\t}\n\n \t\t$linea = 1;\n \t\tforeach ($conf_pasos as $conf_paso) {\n\t\t\t$array_porcentaje_por_paso = array();\n\t\t\t$tag_paso = $xpath->query(\"//detalles/detalle/detalles/detalle[@paso_orden=\".$conf_paso->getAttribute(\"paso_orden\").\"]\")->item(0);\n \t\t\t$T->setVar('__print_class', ($linea % 2 == 0)?\"celdaIteracion2\":\"celdaIteracion1\");\n \t\t\t$T->setVar('__class', ($linea % 2 == 0)?\"celdanegra15\":\"celdanegra10\");\n \t\t\t$T->setVar('__pasoNombre', $conf_paso->getAttribute(\"nombre\"));\n\n \t\t\t$path_dato = \"//detalles/detalle[@nodo_id=0]/detalles/detalle[@paso_orden=\".$conf_paso->getAttribute(\"paso_orden\").\"]/estadisticas/estadistica/@porcentaje\";\n \t\t\t$diferencia = $xpath->evaluate(\"sum(\".$path_dato.\")\") - 100;\n \t\t\t$maximo = $xpath->evaluate($path_dato.\"[not(. < \".$path_dato.\")][1]\")->item(0)->value;\n\n\t\t\tforeach ($conf_ponderaciones as $conf_ponderacion) {\n\t\t\t\tif ($ponderaciones_hora[$conf_ponderacion->getAttribute('inicio')]->valor_ponderacion == 0) {\n\t\t\t\t\tcontinue;\n \t\t\t\t}\n\n\t\t\t\t$valor=$ponderaciones_hora[$conf_ponderacion->getAttribute('inicio')];\n\n\t\t\t\tforeach ($conf_eventos as $conf_evento) {\n\t\t\t\t\t$tag_dato_item = $xpath->query(\"detalles/detalle[@item_id=\".$conf_ponderacion->getAttribute('item_id').\"]/estadisticas/estadistica[@evento_id=\".$conf_evento->getAttribute(\"evento_id\").\"]\", $tag_paso)->item(0);\n\n\t\t\t\t\t// SE REGISTRAN LOS VALORES POR ITEM.\n\t\t\t\t\tif ($tag_dato_item == null) {\n\t\t\t\t\t\t$porcentaje = 0;\n\t\t\t\t\t}else {\n\t\t\t\t\t\t$porcentaje = $tag_dato_item->getAttribute(\"porcentaje\");\n\t\t\t\t\t}\n\t\t\t\t\t$array_porcentaje_por_paso[$conf_evento->getAttribute(\"evento_id\")] += $porcentaje* ($valor->valor_ponderacion/100);\n \t\t\t\t}\n\n\t\t\t}\n\n\t\t\t$T->setVar('bloque_eventos', '');\n\t\t\tforeach ($conf_eventos as $conf_evento) {\n\n\t\t\t\t$T->setVar('__evento_valor', number_format($array_porcentaje_por_paso[$conf_evento->getAttribute(\"evento_id\")], 2, '.', ''));\n \t\t\t\t$T->setVar('__evento_color', ($conf_evento->getAttribute(\"color\") == \"f0f0f0\")?\"b2b2b2\":$conf_evento->getAttribute(\"color\"));\n \t\t\t\t$T->parse('bloque_eventos', 'BLOQUE_EVENTOS', true);\n \t\t\t}\n\n \t\t\t$T->parse('bloque_pasos', 'BLOQUE_PASOS', true);\n \t\t\t$linea++;\n\n \t\t}\n \t\t$T->parse('bloque_horarios', 'BLOQUE_HORARIOS', true);\n\n \t\t$this->tiempo_expiracion = (strtotime($xpath->query(\"//fecha_expiracion\")->item(0)->nodeValue) - strtotime($xpath->query(\"//fecha\")->item(0)->nodeValue));\n \t\t$this->resultado = $T->parse('out', 'tpl_tabla');\n \t}", "public function getAllDecoupage() {\n $qb = $this->createQueryBuilder('e')\n ->where('e.etatDecoupage != ' . TypeEtat::SUPPRIME);\n // ->orderBy('e.typeDecoupage', 'ASC');\n return $qb->getQuery()->getResult();\n }", "private function aprobarDetalleSolicitud()\r\n {\r\n $result = false;\r\n $idGenerado = 0;\r\n // modelo de InscripcionSucursal.\r\n $modelInscripcion = self::findInscripcionSucursal();\r\n if ( $modelInscripcion !== null ) {\r\n if ( $modelInscripcion['id_contribuyente'] == $this->_model->id_contribuyente ) {\r\n $result = self::updateSolicitudInscripcion($modelInscripcion);\r\n if ( $result ) {\r\n $idGenerado = self::crearContribuyente($modelInscripcion);\r\n if ( $idGenerado > 0 ) {\r\n $result = true;\r\n } else {\r\n $result = false;\r\n }\r\n }\r\n } else {\r\n self::setErrors(Yii::t('backend', 'Error in the ID of taxpayer'));\r\n }\r\n } else {\r\n self::setErrors(Yii::t('backend', 'Request not find'));\r\n }\r\n\r\n return $result;\r\n }", "private function ajoutProduits() {\n $em = $this->getDoctrine()->getManager();\n $produis = $em->getRepository('VentesBundle:Produit')->findAll();\n $produitArray = array();\n foreach ($produis as $p) {\n $id = $p->getId();\n $libelle = $p->getLibelle();\n $produitArray[$id] = $libelle;\n }\n return $produitArray;\n }", "public function getProduitsPanier()\n {\n return $this->CollProduit->getCollection();\n }", "public function getNegocio();", "function Comprobar_NOMBREPROFESOR(){\n\t\t\t$arrayNOMBREPROFESOR=array(); //definicion de array temporal\n\t\t\t$correcto = true; //variable de control\n\n\t\t\t//si no cumple la expresión regular\n\t\t\tif(strlen($this->nombreProfesor)==0 || $this->nombreProfesor==null || preg_match(\"/(^\\s+$)/\", $this->nombreProfesor)){\n\t\t\t\t$error = 'Atributo vacío'; //error\n\t\t\t\t$array = array('nombreatributo' => $this->nombreProfesor, 'codigoincidencia' => '00001', 'mensajeerror' => $error); //array errores\n\t\t\t\tarray_push($arrayNOMBREPROFESOR, $array);\n\t\t\t\t$correcto=false;\n\t\t\t} //fin comprobacion vacio\n\t\t\t//si el nº de letras del nombre es menor que tres\n\t\t\tif (strlen($this->nombreProfesor)<3){\n\t\t\t\t//mensaje de error\n\t\t\t\t$error = 'Valor de atributo no numérico demasiado corto';\n\t\t\t\t$array = array('nombreatributo' =>$this->nombreProfesor, 'codigoincidencia' =>'00003', 'mensajeerror' => $error); //errores\n\t\t\t\t//introduce el mensaje en el rray de errores\n\t\t\t\tarray_push($arrayNOMBREPROFESOR, $array);\n\n\t\t\t\t//cambia correcto a false\n\t\t\t\t$correcto = false;\n\n\t\t\t}//fin comprobación longitud <3\n\n\t\t\t//si el nº de letras del nombre es mayor que 30\n\t\t\tif (strlen($this->nombreProfesor)>15){\n\n\t\t\t\t//crea mensaje de error\n\t\t\t\t$error = 'Valor de atributo demasiado largo';\n\t\t\t\t$array = array('nombreatributo' =>$this->nombreProfesor, 'codigoincidencia' =>'00002', 'mensajeerror' => $error); //errores\n\t\t\t\t//intrudce el mensaje en el array de errores\n\t\t\t\tarray_push($arrayNOMBREPROFESOR, $array);\n\n\t\t\t\t//establece correcto a false\n\t\t\t\t$correcto = false;\n\t\t\n\t\t\t}//fin comprobación nº letras >30\n\t\t\t//si no se cumple la expresión regular\n\t\t\tif (!preg_match(\"/^[a-zA-ZñÑáéíóúÁÉÍÓÚüÜïÏ]+(\\s*[a-zA-ZA-ZñÑáéíóúÁÉÍÓÚüÜïÏ]*)+$/\",$this->nombreProfesor)){\n\n\t\t\t\t//guarda mensaje de error\n\t\t\t\t$error = 'Solo están permitidas alfabéticos';\n\t\t\t\t$array = array( 'nombreatributo' =>$this->nombreProfesor, 'codigoincidencia' =>'00030', 'mensajeerror' => $error);//error\n\t\t\t\t//añade el error al array\n\t\t\t\tarray_push($arrayNOMBREPROFESOR, $array);\n\n\t\t\t\t//establece correcto a falso\n\t\t\t\t$correcto = false;\n\t\t\n\t\t\t}//fin comprobación expresión regular\n\t\t\t//comprobacion errores\n\t\t\tif($correcto==true){\n\t\t\t\t//devuelve el valor de correcto\n\t\t\t\treturn $correcto;\n\t\t\t\t}else{ //si errores\n\t\t\t\t\treturn $arrayNOMBREPROFESOR;\n\t\t\t\t} //fin\n\t\t}", "function consultarEstudiantesPruebaAcademica(){\n $cadena_sql=$this->cadena_sql(\"estudiantesPruebaAcademica\", $this->codProyecto);\n $estudiantes_prueba=$this->funcionGeneral->ejecutarSQL($this->configuracion, $this->accesoGestion, $cadena_sql,\"busqueda\" );\n return $estudiantes_prueba;\n }", "public function opcionesDesplegable();", "function affiche_relais_demande () {\n\t\tglobal $bdd;\n\t\t\n\t\t$req = $bdd->query(\"SELECT * FROM relais_mail JOIN utilisateur ON relais_mail.utilisateur_id_utilisateur = utilisateur.id_utilisateur WHERE status_relais = '2'\");\n\t\treturn $req;\n\t\t\n\t\t$req->closeCursor();\n\t}", "public function propietarios_tatalPropietarios(){ \t\n\n\t\t\t$resultado = array();\n\t\t\t\n\t\t\t$query = \"Select count(idPropietario) as cantidadPropietarios from tb_propietarios \";\n\t\t\t\n\t\t\t$conexion = parent::conexionCliente();\n\t\t\t\n\t\t\tif($res = $conexion->query($query)){\n\t \n\t /* obtener un array asociativo */\n\t while ($filas = $res->fetch_assoc()) {\n\t $resultado = $filas;\n\t }\n\t \n\t /* liberar el conjunto de resultados */\n\t $res->free();\n\t \n\t }\n\t\n\t return $resultado['cantidadPropietarios'];\t\t\t\n\t\t\t\n\t\t\t\n }", "function consulta_personalizada_registro_compras_imprimir($w_anio, $w_mes, $w_anexo) {\n $sql = \"SELECT\n prosic_comprobante.codigo_comprobante\n , prosic_comprobante.emision_comprobante\n , prosic_comprobante.pago_comprobante\n , prosic_tipo_comprobante.sunat_tipo_comprobante\n , prosic_comprobante.serie_comprobante\n , prosic_comprobante.anio_dua_comprobante\n , prosic_comprobante.nro_comprobante\n , prosic_tipo_documento.sunat_tipo_documento\n , prosic_anexo.codigo_anexo\n , SUBSTRING(prosic_anexo.descripcion_anexo,1,20)\n , prosic_comprobante.afecto_comprobante\n , prosic_comprobante.inafecto_comprobante\n , prosic_comprobante.igv_comprobante\n , prosic_comprobante.total_comprobante \t\n , prosic_comprobante.id_operacion\n , prosic_comprobante.no_gravadas_igv\n , prosic_comprobante.inafecto_comprobante\n , prosic_comprobante.isc_comprobante\n , prosic_comprobante.otros_tributos\n , prosic_comprobante.total_comprobante\n , prosic_comprobante.tipo_cambio_comprobante\n , prosic_tipo_comprobante.nombre_tipo_comprobante\n , prosic_comprobante.id_moneda\n FROM\n prosic_comprobante\n INNER JOIN prosic_anexo ON (prosic_comprobante.id_anexo = prosic_anexo.id_anexo)\n INNER JOIN prosic_tipo_comprobante ON (prosic_comprobante.id_tipo_comprobante = prosic_tipo_comprobante.id_tipo_comprobante)\n INNER JOIN prosic_tipo_documento ON (prosic_anexo.id_tipo_documento = prosic_tipo_documento.id_tipo_documento)\n WHERE prosic_comprobante.id_subdiario=3\";\n if ($w_anio != '')$sql.=\" AND prosic_comprobante.id_anio=\" . $w_anio;\n if ($w_mes != '')$sql.=\" AND prosic_comprobante.id_mes=\" . $w_mes;\n if ($w_anexo != '')$sql.=\" AND prosic_comprobante.id_anexo='\" . $w_anexo . \"'\";\n $sql.=\" ORDER BY CAST(prosic_comprobante.codigo_comprobante AS UNSIGNED),prosic_tipo_comprobante.sunat_tipo_comprobante\";\n $result = $this->Consulta_Mysql($sql);\n return $result;\n }", "public function ajoutProduitEncore()\n {\n Produit::create(\n [\n 'uuid' => Str::uuid(),\n 'designation' => 'Mangue',\n 'description' => 'Mangue bien grosse et sucrée! Yaa Proprè !',\n 'prix' => 1500,\n 'like' => 63,\n 'pays_source' => 'Togo',\n 'poids' => 89.5,\n ]\n );\n }", "protected function armaColeccionObligatorios() {\n $dao = new PGDAO();\n $result = array();\n $where = $this->strZpTprop();\n if ($where != '') {\n $colec = $this->leeDBArray($dao->execSql($this->COLECCIONZPCARACOBLIG . \" and tipoprop in (\" . $where . \")\"));\n } else {\n $colec = $this->leeDBArray($dao->execSql($this->COLECCIONZPCARACOBLIG));\n }\n foreach ($colec as $carac) {\n $result[$carac['id_zpcarac']] = 0;\n }\n return $result;\n }", "public function equipementachatListerTous()\n\t{\n\t\t// votre code ici\n\t\treturn Gestion::lister(\"EquipementAchat\");//type array\n\t}", "function commandes_trig_bank_reglement_en_echec($flux){\r\n\t// Si on est dans le bon cas d'un paiement de commande et qu'il y a un id_commande et que la commande existe toujours\r\n\tif ($id_transaction = $flux['args']['id_transaction']\r\n\t AND $transaction = sql_fetsel(\"*\",\"spip_transactions\",\"id_transaction=\".intval($id_transaction))\r\n\t\tAND $id_commande = $transaction['id_commande']\r\n\t\tAND $commande = sql_fetsel('id_commande, statut, id_auteur', 'spip_commandes', 'id_commande='.intval($id_commande))){\r\n\r\n\t\t$statut_commande = $commande['statut'];\r\n\t\t$transaction_mode = $transaction['mode'];\r\n\t\t$statut_nouveau = $statut_commande;\r\n\r\n\t\t// on ne passe la commande en erreur que si le reglement a effectivement echoue,\r\n\t\t// pas si c'est une simple annulation (retour en arriere depuis la page de paiement bancaire)\r\n\t\tif (strncmp($transaction['statut'],\"echec\",5)==0){\r\n\t\t\t$statut_nouveau = 'erreur';\r\n\t\t}\r\n\t\tif ($statut_nouveau !== $statut_commande){\r\n\t\t\tspip_log(\"commandes_trig_bank_reglement_en_attente marquer la commande #$id_commande statut=$statut_nouveau\",'commandes');\r\n\t\t\t//on met a jour la commande\r\n\t\t\tinclude_spip(\"action/editer_commande\");\r\n\t\t\tcommande_modifier($id_commande,array('statut'=>$statut_nouveau,'mode'=>$transaction_mode));\r\n\t\t}\r\n\t}\r\n\r\n\treturn $flux;\r\n}", "function agendas_evts($id_evenement, $evt_confirme)\r\n{\r\n\t////\tListe des agendas ou est affecté l'événement\r\n\tglobal $AGENDAS_AFFECTATIONS;\r\n\t$tab_agenda = array();\r\n\tforeach(db_colonne(\"SELECT id_agenda FROM gt_agenda_jointure_evenement WHERE id_evenement=\".$id_evenement.\" AND confirme='\".$evt_confirme.\"'\") as $id_agenda){\r\n\t\tif(isset($AGENDAS_AFFECTATIONS[$id_agenda])) $tab_agenda[] = $id_agenda;\r\n\t}\r\n\treturn $tab_agenda;\r\n}", "public static function getProdajalci(){\n $db = DBInit::getInstance();\n $funkcija = \"prodajalec\";\n $statement = $db->prepare(\"SELECT email FROM zaposleni WHERE funkcija = :funkcija\");\n $statement->bindParam(\":funkcija\", $funkcija);\n $statement->execute();\n\n $return = $statement->fetchAll();\n \n $vrni = array();\n foreach ($return as $slika){\n $vrni[] = reset($slika);\n }\n return $vrni;\n \n }", "public function reporte_comparativo_unidad($proy_id){\n $data['proyecto'] = $this->model_proyecto->get_datos_proyecto_unidad($proy_id);\n\n if(count($data['proyecto'])!=0){\n $data['mes'] = $this->mes_nombre();\n //$data['partidas']= $this->comparativo_partidas($data['proyecto'][0]['dep_id'],$data['proyecto'][0]['aper_id'],2); //// Cuadro comparativo de partidas\n $data['partidas']= $this->comparativo_partidas_ppto_final($data['proyecto'][0]['dep_id'],$data['proyecto'][0]['aper_id'],2); //// Cuadro comparativo de partidas\n $this->load->view('admin/mantenimiento/ptto_sigep/reporte_comparativo_partidas', $data);\n }\n else{\n echo \"ERROR\";\n }\n }", "public function getInstrucoes();", "public function baseCjenovnik()\n\t{\n\t\t\n\t\t$p = array();\n\t\t$this->red = Cjenovnik::model()->findAll(\"id>0\");\n $this->red1 = TekstCjenovnik::model()->findAllByAttributes(array('jezik'=>Yii::app()->session[\"lang\"]));\n\t/*\t$this->period_od = $konj->period_od;\n\t\t$this->period_do = $row->period_do;\n\t\t$this->tip = $row->tip;\n\t\t$this->cjena_km = $row->cjena_km;\n\t\t$this->cjena_eur = $row->cjena_eur;*/\n\t}", "public function obtenerViajesplus();", "function FacturasAbiertas() {\n $sql = \"SELECT COUNT(*) count FROM \".self::$table.\" WHERE estado='Abierta'\";\n return DBManager::count($sql);\n }", "function VerificarRegistrosNuevos(){\n $obCon = new Backups($_SESSION['idUser']);\n $sql=\"SHOW FULL TABLES WHERE Table_type='BASE TABLE'\";\n $consulta=$obCon->Query($sql);\n $i=0;\n $RegistrosXCopiar=0;\n $TablasLocales=[];\n \n while ($DatosTablas=$obCon->FetchArray($consulta)){\n $Tabla=$DatosTablas[0];\n if($Tabla<>'precotizacion' and $Tabla<>'preventa'){\n $sql=\"SELECT COUNT(*) as TotalRegistros FROM $Tabla WHERE Sync = '0000-00-00 00:00:00' OR Sync<>Updated\";\n $ConsultaConteo=$obCon->Query($sql);\n $Registros=$obCon->FetchAssoc($ConsultaConteo);\n $TotalRegistros=$Registros[\"TotalRegistros\"];\n if($TotalRegistros>0){ \n $RegistrosXCopiar=$RegistrosXCopiar+$TotalRegistros;\n $TablasLocales[$i][\"Nombre\"]=$Tabla;\n $TablasLocales[$i][\"Registros\"]=$TotalRegistros;\n $i++; \n }\n }\n }\n\n print(\"OK;$RegistrosXCopiar;\".json_encode($TablasLocales, JSON_FORCE_OBJECT));\n }", "function getRatiosPrudentiels($list_agence) {\n\n global $dbHandler;\n global $global_monnaie,$global_id_agence;\n\n $db = $dbHandler->openConnection();\n $DATA['limitation_prets_dirigeants'] = 0;\n $DATA['limitation_risque_membre'] = 0;\n $DATA['taux_transformation'] = 0;\n $DATA['total_epargne'] = 0;\n foreach($list_agence as $key_id_ag =>$value) {\n // Parcours des agences\n setGlobalIdAgence($key_id_ag);\n // Encours brut\n $sql = \"SELECT SUM(calculeCV(solde_cap, devise, '$global_monnaie')) FROM ad_etr, ad_dcr, adsys_produit_credit WHERE ad_etr.id_ag=$global_id_agence AND ad_etr.id_ag=ad_dcr.id_ag AND ad_dcr.id_ag=adsys_produit_credit.id_ag AND ad_etr.id_doss = ad_dcr.id_doss AND ad_dcr.id_prod = adsys_produit_credit.id AND (ad_dcr.etat = 5 OR ad_dcr.etat = 7 OR ad_dcr.etat = 13 OR ad_dcr.etat = 14 OR ad_dcr.etat = 15)\";\n\n $result = $db->query($sql);\n if (DB::isError($result)) {\n $dbHandler->closeConnection(false);\n signalErreur(__FILE__, __LINE__, __FUNCTION__);\n }\n\n $row = $result->fetchrow();\n $encours_brut = $row[0];\n\n // Encours max\n $sql = \"SELECT MAX(somme) FROM (SELECT SUM(calculeCV(solde_cap, devise, '$global_monnaie')) AS somme FROM ad_etr, ad_dcr, adsys_produit_credit WHERE ad_etr.id_ag=$global_id_agence AND ad_etr.id_ag=ad_dcr.id_ag AND ad_dcr.id_ag=adsys_produit_credit.id_ag AND ad_etr.id_doss = ad_dcr.id_doss AND ad_dcr.id_prod = adsys_produit_credit.id AND (ad_dcr.etat = 5 OR ad_dcr.etat = 7 OR ad_dcr.etat = 13 OR ad_dcr.etat = 14 OR ad_dcr.etat = 15) GROUP BY ad_etr.id_doss) AS encours\";\n\n $result = $db->query($sql);\n if (DB::isError($result)) {\n $dbHandler->closeConnection(false);\n signalErreur(__FILE__, __LINE__, __FUNCTION__);\n }\n\n $row = $result->fetchrow();\n $encours_max = $row[0];\n\n // Encours dirigeants\n $sql = \"SELECT SUM(calculeCV(solde_cap, devise, '$global_monnaie')) FROM ad_etr, ad_dcr, adsys_produit_credit, ad_cli WHERE ad_etr.id_ag=$global_id_agence AND ad_etr.id_ag=ad_dcr.id_ag AND ad_dcr.id_ag=adsys_produit_credit.id_ag AND adsys_produit_credit.id_ag=ad_cli.id_ag AND ad_etr.id_doss = ad_dcr.id_doss AND ad_dcr.id_prod = adsys_produit_credit.id AND ad_dcr.id_client = ad_cli.id_client AND (ad_dcr.etat = 5 OR ad_dcr.etat = 7 OR ad_dcr.etat = 13 OR ad_dcr.etat = 14 OR ad_dcr.etat = 15) AND ad_cli.qualite = 4\";\n\n $result = $db->query($sql);\n if (DB::isError($result)) {\n $dbHandler->closeConnection(false);\n signalErreur(__FILE__, __LINE__, __FUNCTION__);\n }\n\n $row = $result->fetchrow();\n $encours_dirigeants = $row[0];\n\n // Total épargne\n $sql = \"SELECT SUM(calculeCV(solde, devise, '$global_monnaie')) FROM ad_cpt WHERE id_ag=$global_id_agence AND id_prod <> 2 AND id_prod <> 3\";\n\n $result = $db->query($sql);\n if (DB::isError($result)) {\n $dbHandler->closeConnection(false);\n signalErreur(__FILE__, __LINE__, __FUNCTION__);\n }\n\n $row = $result->fetchrow();\n $total_epargne = $row[0];\n\n // Tableau de données\n if ($total_epargne == NULL) {\n $DATA['limitation_prets_dirigeants'] = NULL;\n $DATA['limitation_risque_membre'] = NULL;\n $DATA['taux_transformation'] = NULL;\n $DATA['total_epargne'] = NULL;\n } else {\n $DATA['limitation_prets_dirigeants'] += $encours_dirigeants / $total_epargne;\n $DATA['limitation_risque_membre'] += $encours_max / $total_epargne;\n $DATA['taux_transformation'] += $encours_brut / $total_epargne;\n $DATA['total_epargne'] += $total_epargne;\n }\n }\n $dbHandler->closeConnection(true);\n\n return $DATA;\n}", "function getCreditosComprometidos(){ return $this->getOEstats()->getTotalCreditosSaldo(); }", "function listarProcesoCompra(){\n\t\t$this->procedimiento='adq.f_proceso_compra_sel';\n\t\t$this->transaccion='ADQ_PROC_SEL';\n\t\t$this->tipo_procedimiento='SEL';//tipo de transaccion\n\t\t\t\t\n\t\t//Definicion de la lista del resultado del query\n\t\t$this->captura('id_proceso_compra','int4');\n\t\t$this->captura('id_depto','int4');\n\t\t$this->captura('num_convocatoria','varchar');\n\t\t$this->captura('id_solicitud','int4');\n\t\t$this->captura('id_estado_wf','int4');\n\t\t$this->captura('fecha_ini_proc','date');\n\t\t$this->captura('obs_proceso','varchar');\n\t\t$this->captura('id_proceso_wf','int4');\n\t\t$this->captura('num_tramite','varchar');\n\t\t$this->captura('codigo_proceso','varchar');\n\t\t$this->captura('estado_reg','varchar');\n\t\t$this->captura('estado','varchar');\n\t\t$this->captura('num_cotizacion','varchar');\n\t\t$this->captura('id_usuario_reg','int4');\n\t\t$this->captura('fecha_reg','timestamp');\n\t\t$this->captura('fecha_mod','timestamp');\n\t\t$this->captura('id_usuario_mod','int4');\n\t\t$this->captura('usr_reg','varchar');\n\t\t$this->captura('usr_mod','varchar');\n\t\t\n\t\t$this->captura('desc_depto','varchar');\n\t\t$this->captura('desc_funcionario','text');\n\t\t$this->captura('desc_solicitud','varchar');\n\t\t$this->captura('desc_moneda','varchar');\n\t\t\n\t\t \n\t\t\n\t\t//Ejecuta la instruccion\n\t\t$this->armarConsulta();\n\t\t$this->ejecutarConsulta();\n\t\t\n\t\t//Devuelve la respuesta\n\t\treturn $this->respuesta;\n\t}", "function consultarNotasDefinitivas() {\r\n \r\n $cadena_sql = $this->sql->cadena_sql(\"consultarEspaciosCursados\", $this->datosEstudiante['CODIGO']);\r\n $resultado = $this->ejecutarSQL($this->configuracion, $this->accesoOracle, $cadena_sql, \"busqueda\"); \r\n \r\n return $resultado;\r\n \r\n }", "public function getEspecialPersonal(){\n\t\t\n\t\tglobal $mdb2;\n\t\tglobal $log;\n\t\tglobal $current_usuario_id;\n\t\tglobal $usr;\n\t\t\n\t\t$negocios= $this->extra['select_obj'];\n\t\t$negocios = json_decode($negocios);\n\t\t$conf_eventos=null;\n\t\t/* TEMPLATE DEL GRAFICO */\n\t\t$T =& new Template_PHPLIB(REP_PATH_PRINTTEMPLATES);\n\t\t$T->setFile('tpl_tabla', 'especial_personal.tpl');\n\t\t$T->setBlock('tpl_tabla', 'TIENE_EVENTO_DATO', 'tiene_evento_dato');\n\t\t$T->setBlock('tpl_tabla', 'LISTA_NEGOCIOS', 'lista_negocios');\n\t\t$T->setBlock('tpl_tabla', 'BLOQUE_TITULO_EVENTO', 'bloque_titulo_evento');\n\t\t$T->setBlock('tpl_tabla', 'BLOQUE_DISPONIBILIDAD', 'bloque_disponibilidad');\n\n\t\t$subObjetivo = null;\n\t\t$muestra_titulo=true;\n\n\t\t$T->setVar('bloque_disponibilidad', '');\n\t\tfor ($i=0; $i <3 ; $i++) {\n\t\t\t$T->setVar('lista_negocios', '');\n\t\t\t//obtiene nombre negocio\n\t\t\tforeach ($negocios as $key => $conf_negocio) {\n\t\t\t\t$T->setVar('__negocio', $conf_negocio->nombre);\n\t\t\t\t$acumulador_porcentaje=null;\n\t\t\t\t$count_obj=0;\n\t\t\t\t$T->setVar('tiene_evento_dato', '');\n\t\t\t\t//obtiene id de objetivo por negocio\n\t\t\t\tforeach ($conf_negocio->objetivos as $key => $conf_objetivo) {\n\t\t\t\t\t$count_obj ++;\n\t\t\t\t\t$subobjetivo_id=$conf_objetivo;\n\t\t\t\t\t$sql = \"SELECT * FROM reporte.disponibilidad_resumen_consolidado(\".\n\t\t\t\t\tpg_escape_string($current_usuario_id).\",\".\n\t\t\t\t\tpg_escape_string($subobjetivo_id).\", \".\n\t\t\t\t\tpg_escape_string($this->horario_id).\",' \".\n\t\t\t\t\tpg_escape_string($this->timestamp->getInicioPeriodo()).\"', '\".\n\t\t\t\t\tpg_escape_string($this->timestamp->getTerminoPeriodo()).\"', \".\n\t\t\t\t\t(isset($this->extra[\"variable\"])?$usr->cliente_id:'0').\")\";\n\t\t\t\t\t//echo $sql.'<br>';\n\t\t\t\t\t$res =& $mdb2->query($sql);\n\t\t\t\t\tif (MDB2::isError($res)) {\n\t\t\t\t\t\t$log->setError($sql, $res->userinfo);\n\t\t\t\t\t\texit();\n\t\t\t\t\t}\n\t\t\t\t\tif($row = $res->fetchRow()){\n\t\t\t\t\t\t$dom = new DomDocument();\n\t\t\t\t\t\t$dom->preserveWhiteSpace = FALSE;\n\t\t\t\t\t\t$dom->loadXML($row[\"disponibilidad_resumen_consolidado\"]);\n\t\t\t\t\t\t$xpath = new DOMXpath($dom);\n\t\t\t\t\t\tunset($row[\"disponibilidad_resumen_consolidado\"]);\n\t\t\t\t\t}\n\t\t\t\t\t$conf_objetivo= $xpath->query(\"/atentus/resultados/propiedades/objetivos/objetivo\")->item(0);\n\t \t\t\t\t$conf_pasos = $xpath->query(\"paso[@visible=1]\", $conf_objetivo);\n\t \t\t\t\t$conf_eventos = $xpath->query(\"/atentus/resultados/propiedades/eventos/evento\");\n\t \t\t\t\t$subObjetivo = $conf_objetivo->getAttribute('nombre');\n\t \t\t\t\t$T->setVar('__paso_objetivos', $subObjetivo);\n\t\t\t\t\t$T->parse('tiene_evento_dato', 'TIENE_EVENTO_DATO', true);\n\n\t \t\t\t\tforeach ($conf_pasos as $conf_paso) {\n\t \t\t\t\t\t$tag_paso =$xpath->query(\"/atentus/resultados/detalles/detalle[@objetivo_id=\".$subobjetivo_id.\"]/detalles/detalle[@nodo_id=0]/detalles/detalle[@paso_orden=\".$conf_paso->getAttribute('paso_orden').\"]\")->item(0);\n\t \t\t\t\t\tforeach ($conf_eventos as $conf_evento) {\n\t \t\t\t\t\t\t$evento = $conf_evento->getAttribute('evento_id');\n\t \t\t\t\t\t\t$tag_dato = $xpath->query(\"estadisticas/estadistica[@evento_id=\".$conf_evento->getAttribute('evento_id').\"]\",$tag_paso)->item(0);\n\t \t\t\t\t\t\t$porcentaje= isset($tag_dato)?$tag_dato->getAttribute('porcentaje'):0;\n\t \t\t\t\t\t\t$acumulador_porcentaje[$evento] += $porcentaje/$conf_pasos->length;\t\n\t\t \t\t\t\t}\n\t \t\t\t\t}\n\t \t\t\t\tif($muestra_titulo){\n\t \t\t\t\t\t$conf_eventos = $xpath->query(\"/atentus/resultados/propiedades/eventos/evento\");\n\t \t\t\t\t}\n\t \t\t\t\t$muestra_titulo=false;\n\t \t\t\t}\n\t \t\t\tforeach ($conf_eventos as $conf_evento) {\n\t \t\t\t\t$evento = $conf_evento->getAttribute('evento_id');\n\t \t\t\t\t$acumulador_negocio[$evento] = $acumulador_porcentaje[$evento]/$count_obj;\n\t\t\t\t}\n\t\t\t\t//numero acumulado de eventos por negocio\n\t\t\t \t$uptime = $acumulador_negocio[1];\n\t\t\t\t$downtime = $acumulador_negocio[2];\n\t\t\t\t$downtime_parcial = $acumulador_negocio[3];\n\t\t\t\t$sin_monitoreo = $acumulador_negocio[7];\n\n\t\t\t\tif($i==0){\n\t\t\t\t\t//establece calculo para disponibilidad especial\n\t\t\t\t\t$uptime_especial = $uptime + $downtime_parcial;\n\t\t\t\t\t$total_especial = $uptime_especial + $downtime;\n\t\t\t\t\t$uptime_especial = $uptime_especial*100/$total_especial;\n\t\t\t\t\t$downtime_especial = $downtime*100/$total_especial;\n\t\t\t\t\t\n\t\t\t\t\t$uptime_td_especial = '<td class=\"txtBlanco12 celdaUptime\" align=\"right\">'.number_format($uptime_especial, 2, '.', '').'</td>';\n\t\t\t\t\t$downtime_td_especial = '<td class=\"txtBlanco12 celdaDtGlobal\" align=\"right\">'.number_format($downtime_especial, 2, '.', '').'</td>';\n\t\t\t\t\t\n\t\t\t\t\t$T->setVar('__paso_uptime', $uptime_td_especial );\n\t\t\t\t\t$T->setVar('__paso_downtime_global', $downtime_td_especial);\n\t\t\t\t\t$T->setVar('__paso_down_parcial', '');\n\t\t\t\t\t$T->setVar('__paso_sin_monitoreo', '');\n\t\t\t\t}\n\t\t\t\tif($i==1){\n\t\t\t\t\t//establece calculo para disponibilidad real\n\t\t\t\t\t$total_real = $uptime + $downtime+ $downtime_parcial;\n\t\t\t\t\t$uptime_real = $uptime*100/$total_real;\n\t\t\t\t\t$downtime_real = $downtime*100/$total_real;\n\t\t\t\t\t$downtime_parcial_real = $downtime_parcial*100/$total_real;\n\n\t\t\t\t\t$uptime_td_real = '<td class=\"txtBlanco12 celdaUptime\" align=\"right\">'.number_format($uptime_real, 2, '.', '').'</td>';\n\t\t\t\t\t$downtime_td_real = '<td class=\"txtBlanco12 celdaDtGlobal\" align=\"right\">'.number_format($downtime_real, 2, '.', '').'</td>';\n\t\t\t\t\t$downtime_td_parcial_real = '<td class=\"txtBlanco12 celdaDtParcial\" align=\"right\">'.number_format($downtime_parcial_real, 2, '.', '').'</td>';\n\t\t\t\t\t\n\t\t\t\t\t$T->setVar('__paso_uptime', $uptime_td_real);\n\t\t\t\t\t$T->setVar('__paso_downtime_global',$downtime_td_real);\n\t\t\t\t\t$T->setVar('__paso_down_parcial', $downtime_td_parcial_real);\n\t\t\t\t\t$T->setVar('__paso_sin_monitoreo', '');\n\t\t\t\t}\n\t\t\t\tif($i==2){\n\t\t\t\t\t//establece calculo para disponibilidad normal\n\t\t\t\t\t$total_disponible = $uptime + $downtime+$downtime_parcial + $sin_monitoreo;\n\t\t\t\t\t$uptime_disponible = $uptime*100/$total_disponible;\n\t\t\t\t\t$downtime_disponible = $downtime*100/$total_disponible;\n\t\t\t\t\t$downtime_parcial_disponible = $downtime_parcial*100/$total_disponible;\n\t\t\t\t\t$sin_monitoreo_disponible = $sin_monitoreo*100/$total_disponible;\n\t\t\t\t\t\n\t\t\t\t\t$uptime_td_disponible = '<td class=\"txtBlanco12 celdaUptime\" align=\"right\">'.number_format($uptime_disponible, 2, '.', '').'</td>';\n\t\t\t\t\t$downtime_td_disponible = '<td class=\"txtBlanco12 celdaDtGlobal\" align=\"right\">'.number_format($downtime_disponible, 2, '.', '').'</td>';\n\t\t\t\t\t$downtime_td_parcial_disponible = '<td class=\"txtBlanco12 celdaDtParcial\" align=\"right\">'.number_format($downtime_parcial_disponible, 2, '.', '').'</td>';\n\t\t\t\t\t$sin_monitoreo_td_disponible = '<td class=\"txtBlanco12 celdaSinMonitoreo\" align=\"right\">'.number_format($sin_monitoreo_disponible, 2, '.', '').'</td>';\n\t\t\t\t\t\n\t\t\t\t\t$T->setVar('__paso_uptime', $uptime_td_disponible);\n\t\t\t\t\t$T->setVar('__paso_downtime_global',$downtime_td_disponible);\n\t\t\t\t\t$T->setVar('__paso_down_parcial', $downtime_td_parcial_disponible);\n\t\t\t\t\t$T->setVar('__paso_sin_monitoreo', $sin_monitoreo_td_disponible);\n\t\t\t\t}\n\t\t\t\t$T->parse('lista_negocios', 'LISTA_NEGOCIOS', true);\n\t\t\t}\n\t\t\t$T->setVar('bloque_titulo_evento', '');\n\t\t\tforeach ($conf_eventos as $conf_evento) {\n\t\t\t\tif($i==0 && ($conf_evento->getAttribute('orden')==0 || $conf_evento->getAttribute('orden')==2 )){\n\t\t\t\t\t$evento = $conf_evento->getAttribute('nombre');\n\t\t\t\t\t$T->setVar('__nombre_tabla_negocio', 'Disponibilidad Especial'.'<br>');\n\t\t\t\t\t$T->setVar('__titulo_evento', $evento);\n\t\t\t\t\t$T->parse('bloque_titulo_evento', 'BLOQUE_TITULO_EVENTO',true);\n\t\t\t\t}\n\t\t\t\tif($i==1 && ($conf_evento->getAttribute('orden')==0 || $conf_evento->getAttribute('orden')==2 || $conf_evento->getAttribute('orden')==1)){\n\t\t\t\t\t$evento = $conf_evento->getAttribute('nombre');\n\t\t\t\t\t$T->setVar('__nombre_tabla_negocio', 'Disponibilidad Real'.'<br>');\n\t\t\t\t\t$T->setVar('__titulo_evento', $evento);\n\t\t\t\t\t$T->parse('bloque_titulo_evento', 'BLOQUE_TITULO_EVENTO',true);\n\t\t\t\t}\n\t\t\t\tif($i==2 && ($conf_evento->getAttribute('orden')==0 || $conf_evento->getAttribute('orden')==2 || $conf_evento->getAttribute('orden')==1||$conf_evento->getAttribute('orden')==3 )){\n\t\t\t\t\t$evento = $conf_evento->getAttribute('nombre');\n\t\t\t\t\t$T->setVar('__nombre_tabla_negocio', 'Disponibilidad Normal'.'<br>');\n\t\t\t\t\t$T->setVar('__titulo_evento', $evento);\n\t\t\t\t\t$T->parse('bloque_titulo_evento', 'BLOQUE_TITULO_EVENTO',true);\n\t\t\t\t}\n\t\t\t}\n\t\t\t$T->parse('bloque_disponibilidad', 'BLOQUE_DISPONIBILIDAD', true);\n\t\t}\n\t\t$this->tiempo_expiracion = $parser->tiempo_expiracion;\n\t\t\t$this->resultado = $T->parse('out', 'tpl_tabla');\n\t}", "public function getFECHAINGRESO_PROVEEDORES(){\n return $this->FECHAINGRESO_PROVEEDORES;\n }", "public function getNOMBREEMPLEADO_PROVEEDORES(){\n return $this->NOMBREEMPLEADO_PROVEEDORES;\n }" ]
[ "0.63145834", "0.6286612", "0.61418337", "0.6130937", "0.61284554", "0.59976745", "0.5950395", "0.5935296", "0.59213513", "0.5897326", "0.58645564", "0.58216345", "0.5799415", "0.5782876", "0.5776759", "0.57624215", "0.57621", "0.5729964", "0.5728574", "0.57277954", "0.57267714", "0.5720184", "0.57189417", "0.57115537", "0.56771046", "0.56724507", "0.56641406", "0.56636333", "0.5660963", "0.5659443", "0.56499773", "0.5648459", "0.5642082", "0.56363106", "0.56207925", "0.5616876", "0.5598746", "0.5595203", "0.5585547", "0.5581831", "0.5581129", "0.55705124", "0.5564809", "0.55483556", "0.55261976", "0.55187875", "0.5513402", "0.55110115", "0.54959184", "0.54933965", "0.5478962", "0.54781455", "0.5475992", "0.5473132", "0.54710954", "0.54664874", "0.5458808", "0.5456172", "0.5455888", "0.5439624", "0.5438805", "0.54313016", "0.54312867", "0.54304826", "0.54256546", "0.5417998", "0.5416389", "0.5410812", "0.54089767", "0.5403783", "0.5403173", "0.5402426", "0.5396844", "0.5395883", "0.5393226", "0.5390494", "0.5389185", "0.5386717", "0.5384918", "0.5376887", "0.53757644", "0.5374694", "0.53726274", "0.53694296", "0.5367083", "0.53645575", "0.53642374", "0.53584015", "0.535121", "0.5347681", "0.5346793", "0.5343692", "0.5340822", "0.5338697", "0.5338424", "0.5337755", "0.53365237", "0.533361", "0.5333589", "0.53334606" ]
0.62678397
2
afficher un produit pour le valider dans BackOffice
public function viewOneProductAction($id) { $em=$this->getDoctrine()->getManager(); $product=$em->getRepository('HologramBundle:Product')->find($id); $videoPath = ('../web/Uploads/'.$product->getVideo()); $imgPath = ('../web/Uploads/'.$product->getProductPhoto()); $date=$product->getProductDate(); $form=$this->createForm(new ValidateProductForm(),$product); $requete=$this->get('request'); $form->handleRequest($requete); return $this->render('HologramBundle:Back:oneProductNotValidated.hml.twig', array('f'=>$form->createView(),'p'=>$product,'video'=>$videoPath,'img'=>$imgPath,"d"=>$date)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function wtsProPaiement($ar){\n $p = new XParam($ar, array());\n $orderoid = $p->get('orderoid');\n // verification du client de la commande et du compte connecte\n list($okPaiement, $mess) = $this->paiementEnCompte($orderoid);\n if (!$okPaiement){\n XLogs::critical(get_class($this), 'paiement pro refusé '.$orderoid.' '.$mess);\n XShell::setNext($GLOBALS['TZR_SESSION_MANAGER']::complete_self(true, true).'&alias='.$this->aliasvente.'&moid='.$this->_moid.'&function=wtsLireOffres');\n return;\n }\n // traitement post commande std\n clearSessionVar('caddie');\n XLogs::critical(get_class($this), 'enregistrement paiement en compte '.$orderoid);\n // traitement standards après validation\n $this->postOrderActions($orderoid, true);\n\n // traitement post order - devrait être dans postOrderActions\n $this->proPostOrderActions($orderoid);\n\n // retour \n if (defined('EPL_ALIAS_PAIEMENT_ENCOMPTE')){\n XShell::setNext($GLOBALS['TZR_SESSION_MANAGER']::complete_self().'alias='.EPL_ALIAS_PAIEMENT_ENCOMPTE);} else {\n XShell::setNext($GLOBALS['TZR_SESSION_MANAGER']::complete_self(true, true).'&alias='.$this->aliasvente.'&moid='.$this->_moid.'&function=wtsLireOffres');\n }\n }", "function proposition($CONNEXION, $PRODUIT, $QTE, $PRIX, $DATE){\n\n\t\t/* select pour id du produit à partir du nom! */\n\t\t$queryID=\"SELECT idType FROM TypeProduit\n\t\t\t\t\tWHERE nomProd=\".$PRODUIT.\";\"\n\t\t$result=sybase_query($queryID, $CONNEXION);\n\t\t$idProd=sybase_result($result);\n\t\n\t\t/* select pour récupérer le RCS du fournisseur à partir de la table Users avec $USERNAME= LOGIN */\n\t\t$queryRCS=\"SELECT idU from Users\n\t\t\t\t\tWHERE typeU=2\n\t\t\t\t\tAND loginU=\".$USERNAME\";\"\n\t\t$result=sybase_query($queryRCS, $CONNEXION);\n\t\t$RCS=SYBASE_RESULT($result);\n\t\t\n\t\n\t\t$query = \"INSERT INTO Produit VALUES (getdate(), \".$qte.\", \".$prix.\", \".$date.\", \".$RCS.\", null, \".$idProd.\";\n\t\t$result = sybase_query($query, $CONNEXION);\n\n\t}", "public function produits()\n {\n $data[\"list\"]= $this->produit->list();\n $this->template_admin->displayad('liste_Produits');\n }", "public function get_compte(){retrun($id_local_compte); }", "public function ajoutProduitEncore()\n {\n Produit::create(\n [\n 'uuid' => Str::uuid(),\n 'designation' => 'Mangue',\n 'description' => 'Mangue bien grosse et sucrée! Yaa Proprè !',\n 'prix' => 1500,\n 'like' => 63,\n 'pays_source' => 'Togo',\n 'poids' => 89.5,\n ]\n );\n }", "function ajouterProduit($code, $nom, $prix) {\n\t // echo \"<p>ajouter $code $nom $prix </p> \";\n\t \n\t /* on verifie si le panier n'est pas vide */ \n\t if ( $this->nbProduits == 0) {\n\t // echo \"<p>premier produit </p> \";\n\t \n\t /* le panier etait vide - on y ajoute un nouvel produit */\n\t $prod = new Produit($code, $nom, $prix);\n\t \n\t /* le produit dans la ligne de panier */ \n\t $lp = new LignePanier($prod);\n\t \n\t /* on garde chaque ligne dans un tableau associatif, avec le code produit en clé */\n\t\t\t $this->lignes[$code] = $lp;\n\t\t\t \n\t \n\t // echo \"<p>\" . $lp->prod->code . \" \" . $lp->qte . \"</p>\" ;\n\t \n\t $this->nbProduits = 1;\n\t }\n\t else {\n\t /* il y a deja des produits dans le panier */\n\t /* on verifie alors si $code n'y est pas deja */\n\t \n\t if ( isset ($this->lignes[$code]) ) {\n\t /* le produit y figure deja, on augmente la quantite */\n\t $lp = $this->lignes[$code] ; //on recupere la ligne du panier\n\t $qte = $lp->qte; \n\t $lp->qte = $qte + 1;\n\t \n\t // echo \"<p> nouvelle qte ($qte) : \" . $lp->qte .\"</p>\" ;\n\t \n\t }\n\t else { \n\t /* le produit n'etait pas encore dans le panier, on n'y ajoute */\n\t $prod = new Produit($code, $nom, $prix);\n\t $lp = new LignePanier($prod);\n\t \n\t $this->lignes[$code] = $lp;\n\t $this->nbProduits = $this->nbProduits + 1;\n\t \n\t\t\t\t // echo \"<p>\" . $this->lignes[$code]->prod->code . \" \" . $this->lignes[$code]->qte . \"</p>\" ;\n\t\t\t\t \n\n\t } \n\t \n\t }\t \n\t \n\t }", "function commandes_bank_traiter_reglement($flux){\r\n\t// Si on est dans le bon cas d'un paiement de commande et qu'il y a un id_commande et que la commande existe toujours\r\n\tif (\r\n\t\t$id_transaction = $flux['args']['id_transaction']\r\n\t\tand $transaction = sql_fetsel(\"*\",\"spip_transactions\",\"id_transaction=\".intval($id_transaction))\r\n\t\tand $id_commande = $transaction['id_commande']\r\n\t\tand $commande = sql_fetsel('id_commande, statut, id_auteur, echeances, reference', 'spip_commandes', 'id_commande='.intval($id_commande))\r\n\t){\r\n\t\t$statut_commande = $commande['statut'];\r\n\t\t$montant_regle = $transaction['montant_regle'];\r\n\t\t$transaction_mode = $transaction['mode'];\r\n\t\t$statut_nouveau = 'paye';\r\n\r\n\r\n\t\t// Si la commande n'a pas d'échéance, le montant attendu est celui du prix de la commande\r\n\t\tinclude_spip('inc/commandes_echeances');\r\n\t\tif (!$commande['echeances']\r\n\t\t\tor !$echeances = unserialize($commande['echeances'])\r\n\t\t or !$desc = commandes_trouver_prochaine_echeance_desc($id_commande, $echeances, true)\r\n\t\t or !isset($desc['montant'])) {\r\n\t\t\t$fonction_prix = charger_fonction('prix', 'inc/');\r\n\t\t\t$montant_attendu = $fonction_prix('commande', $id_commande);\r\n\t\t}\r\n\t\t// Sinon le montant attendu est celui de la prochaine échéance (en ignorant la dernière transaction OK que justement on cherche à tester)\r\n\t\telse {\r\n\t\t\t$montant_attendu = $desc['montant'];\r\n\t\t}\r\n\t\tspip_log(\"commande #$id_commande attendu:$montant_attendu regle:$montant_regle\", 'commandes');\r\n\r\n\t\t// Si le plugin n'était pas déjà en payé et qu'on a pas assez payé\r\n\t\t// (si le plugin était déjà en payé, ce sont possiblement des renouvellements)\r\n\t\tif (\r\n\t\t\t$statut_commande != 'paye'\r\n\t\t\tand (floatval($montant_attendu) - floatval($montant_regle)) >= 0.01\r\n\t\t){\r\n\t\t\t$statut_nouveau = 'partiel';\r\n\t\t}\r\n\t\t\r\n\t\t// S'il y a bien un statut à changer\r\n\t\tif ($statut_nouveau !== $statut_commande){\r\n\t\t\tspip_log(\"commandes_bank_traiter_reglement marquer la commande #$id_commande statut: $statut_commande -> $statut_nouveau mode=$transaction_mode\",'commandes');\r\n\t\t\t// On met a jour la commande\r\n\t\t\tinclude_spip(\"action/editer_commande\");\r\n\t\t\tcommande_modifier($id_commande, array('statut'=>$statut_nouveau, 'mode'=>$transaction_mode));\r\n\t\t}\r\n\r\n\t\t// un message gentil pour l'utilisateur qui vient de payer, on lui rappelle son numero de commande\r\n\t\t$flux['data'] .= \"<br />\"._T('commandes:merci_de_votre_commande_paiement',array('reference'=>$commande['reference']));\r\n\t}\r\n\r\n\treturn $flux;\r\n}", "public function show(Produit $produit)\n {\n //\n }", "public function show(Produit $produit)\n {\n //\n }", "public function affichageAction() {\r\n \r\n $em=$this->getDoctrine()->getManager();\r\n $products=$em->getRepository('HologramBundle:Product')->findBy(array('etat'=>'en attente'));\r\n return $this->render('HologramBundle:Back:produitsNonValides.html.twig',array('prod'=>$products));\r\n }", "function ctrlChoix($ar){\n $p = new XParam($ar, array());\n $ajax = $p->get('_ajax');\n $offre = $p->get('offre');\n $wtspool = $p->get('wtspool');\n $wtsvalidfrom = $p->get('wtsvalidfrom');\n $wtsperson = $p->get('wtspersonnumber');\n $wtsticket = $p->get('wtsticket');\n $context = array('wtspersonnumber'=>$wtsperson);\n $r = (object)array('ok'=>1, 'message'=>'', 'iswarn'=>0);\n // on recherche toutes les offres proposant un meilleur prix\n $bestoffers = array();\n $bettertickets = array();\n $betterproducts = array();\n // si nb = zero : ne pas prendre en compte\n foreach($wtsperson as $personoid=>$personnb){\n if (empty($personnb) || $personnb<1){\n\tunset($context['wtspersonnumber'][$personoid]);\n }\n }\n foreach($wtsperson as $personoid=>$personnb){\n if (empty($personnb) || $personnb<1){\n continue;\n }\n $dp = $this->modcatalog->displayProduct($offre, $wtspool, $wtsticket, $personoid);\n if ($dp == NULL)\n continue;\n $bp = $this->modcatalog->betterProductPrice($wtsvalidfrom, NULL, $context, $dp);\n // les différentes offres trouvées\n if ($bp['ok'] && !isset($bestoffers[$bp['product']['offer']['offrename']])){\n $bestoffers[$bp['product']['offer']['offrename']] = $bp['product']['offer']['offeroid'];\n }\n // meilleur produit par type de personne ...\n if ($bp['ok']){\n\t$bpd = $this->modcatalog->displayProductQ($bp['product']['oid']);\n\t$betterproducts[] = array('nb'=>$personnb, 'oid'=>$bp['product']['oid'], '');\n\t$bettertickets[$bp['product']['oid']] = array('currentprice'=>$bp['product']['currentprice'], \n\t\t\t\t\t\t 'betterprice'=>$bp['product']['price']['tariff'],\n\t\t\t\t\t\t 'label'=>$bpd['label'], \n\t\t\t\t\t\t 'offer'=>$bp['product']['offer']['offrename'],\n\t\t\t\t\t\t 'offeroid'=>$bp['product']['offer']['offeroid']);\n }\n }\n if (count($bestoffers)>0){\n $r->offers = array_keys($bestoffers);\n $r->message = implode(',', $r->offers);\n $r->nboffers = count($r->offers);\n $r->offeroids = array_values($bestoffers);\n $r->bettertickets = $bettertickets;\n $r->iswarn = 1;\n $r->ok = 0;\n $r->redirauto = false;\n // on peut enchainer vers une meilleure offre ?\n if ($r->nboffers == 1 && (count($betterproducts) == count($context['wtspersonnumber']))){\n\t$r->redirauto = true;\n\t$r->redirparms = '&offre='.$r->offeroids[0].'&validfrom='.$wtsvalidfrom;\n\tforeach($betterproducts as $bestproduct){\n\t $r->redirparms .= '&products['.$bestproduct['oid'].']='.$bestproduct['nb'];\n\t}\n }\n }\n if ($ajax)\n die(json_encode($r));\n return $r;\n }", "function commandes_trig_bank_reglement_en_attente($flux){\r\n\t// Si on est dans le bon cas d'un paiement de commande et qu'il y a un id_commande et que la commande existe toujours\r\n\tif ($id_transaction = $flux['args']['id_transaction']\r\n\t AND $transaction = sql_fetsel(\"*\",\"spip_transactions\",\"id_transaction=\".intval($id_transaction))\r\n\t\tAND $id_commande = $transaction['id_commande']\r\n\t\tAND $commande = sql_fetsel('id_commande, statut, id_auteur, mode', 'spip_commandes', 'id_commande='.intval($id_commande))){\r\n\r\n\t\t$statut_commande = $commande['statut'];\r\n\t\t$transaction_mode = $transaction['mode'];\r\n\t\t$commande_mode = $commande['mode'];\r\n\t\t$statut_nouveau = 'attente';\r\n\t\tif ($statut_nouveau !== $statut_commande OR $transaction_mode !==$commande_mode){\r\n\t\t\tspip_log(\"commandes_trig_bank_reglement_en_attente marquer la commande #$id_commande statut=$statut_nouveau mode=$transaction_mode\",'commandes');\r\n\t\t\t//on met a jour la commande\r\n\t\t\tinclude_spip(\"action/editer_commande\");\r\n\t\t\tcommande_modifier($id_commande,array('statut'=>$statut_nouveau,'mode'=>$transaction_mode));\r\n\t\t}\r\n\t}\r\n\r\n\treturn $flux;\r\n}", "function sevenconcepts_formulaire_charger($flux){\n $form=$flux['args']['form'];\n if($form=='inscription'){\n include_spip('cextras_pipelines');\n $champs_extras=champs_extras_objet(table_objet_sql('auteur'));\n foreach($champs_extras as $value){\n $flux['data'][$value['options']['nom']]=''; \n if(isset($value['options']['obligatoire']))$flux['data']['obligatoire'][$value['options']['nom']]='on';\n }\n $flux['data']['nom_inscription']='';\n $flux['data']['mail_inscription']='';\n }\n \n return $flux;\n}", "function commandes_trig_bank_reglement_en_echec($flux){\r\n\t// Si on est dans le bon cas d'un paiement de commande et qu'il y a un id_commande et que la commande existe toujours\r\n\tif ($id_transaction = $flux['args']['id_transaction']\r\n\t AND $transaction = sql_fetsel(\"*\",\"spip_transactions\",\"id_transaction=\".intval($id_transaction))\r\n\t\tAND $id_commande = $transaction['id_commande']\r\n\t\tAND $commande = sql_fetsel('id_commande, statut, id_auteur', 'spip_commandes', 'id_commande='.intval($id_commande))){\r\n\r\n\t\t$statut_commande = $commande['statut'];\r\n\t\t$transaction_mode = $transaction['mode'];\r\n\t\t$statut_nouveau = $statut_commande;\r\n\r\n\t\t// on ne passe la commande en erreur que si le reglement a effectivement echoue,\r\n\t\t// pas si c'est une simple annulation (retour en arriere depuis la page de paiement bancaire)\r\n\t\tif (strncmp($transaction['statut'],\"echec\",5)==0){\r\n\t\t\t$statut_nouveau = 'erreur';\r\n\t\t}\r\n\t\tif ($statut_nouveau !== $statut_commande){\r\n\t\t\tspip_log(\"commandes_trig_bank_reglement_en_attente marquer la commande #$id_commande statut=$statut_nouveau\",'commandes');\r\n\t\t\t//on met a jour la commande\r\n\t\t\tinclude_spip(\"action/editer_commande\");\r\n\t\t\tcommande_modifier($id_commande,array('statut'=>$statut_nouveau,'mode'=>$transaction_mode));\r\n\t\t}\r\n\t}\r\n\r\n\treturn $flux;\r\n}", "function afficher_produits()\n{\n\t$sql = \"SELECT * FROM produit\";\n\tglobal $connection;\n\treturn mysqli_query($connection, $sql);\n}", "public function get_Code_produit()\n\t\t{\n\t\t\treturn $this->Code_produit;\n\t\t}", "private function recepcion_repuesta(){\n $this->cdr = $this->respuesta->getCdrResponse(); // CLASE BillResult\n $this->actualizar_docxpagarcpe_recepcion();\n\n // GUARDAR ZIP RESPUESTA SUNAT\n $zip = $this->respuesta->getCdrZip(); // CLASE BillResult\n $this->guardar_respuesta_xml($zip);\n\n }", "public function getId_produit()\n {\n return $this->id_produit;\n }", "public function getProduitid()\n {\n return $this->produitid;\n }", "public function show(Produit $produit)\n {\n //\n dd($produit) ;\n\n }", "public function afficherPanier(){ \n $txt = \"\";\n foreach($this->listeProduits as $value){\n\t$p = $value[0]; // objet produit\n\t$q = $value[1]; // quantité\n\t$txt .= $q . \" unités x \" . $p->getNomProduit() . \" à \" .\n\t$p->getPrixHTVA() . \" euros\\n\";\n\t}\t\n\treturn $txt;\n }", "public function videPanier()\n {\n $this->CollProduit->vider();\n }", "public function edit(produit $produit)\n {\n //\n }", "function afficherProduits(){\n\t\t$sql=\"SElECT * From product\";\n\t\t$db = config::getConnexion();\n\t\ttry{\n\t\t$liste=$db->query($sql);\n\t\treturn $liste;\n\t\t}\n catch (Exception $e){\n die('Erreur: '.$e->getMessage());\n }\t\n\t}", "function voirDerniereCommande(){\n\t$order = array();\n\tarray_push($order, array('nameChamps'=>'idCommande','sens'=>'desc'));\n\t$req = new myQueryClass('commande','',$order,'','limit 1');\n\t$r = $req->myQuerySelect();\n\treturn $r[0] ;\n\t}", "public function rechercherUn() {\n\n // query to read single record\n $query = \"SELECT * FROM \" . $this->sNomTable . \"\n LEFT JOIN produit ON idProduit = iNoProduit\n WHERE idContenuCommande = :idContenuCommande\";\n\n // prepare query statement\n $stmt = $this->oConnexion->prepare($query);\n\n // bind id of product to be updated\n $stmt->bindParam(\":idContenuCommande\", $this->idContenuCommande);\n\n // execute query\n $stmt->execute();\n\n // get retrieved row\n $row = $stmt->fetch(PDO::FETCH_ASSOC);\n\n // set values to object properties\n $this->idContenuCommande = $row['idContenuCommande'];\n $this->iQteProduitCommande = $row['iQteProduitCommande'];\n $this->fPrixCommande = $row['fPrixCommande'];\n $this->iNoCommande = $row['iNoCommande'];\n\n // Produit\n $this->iNoProduit = $row['iNoProduit'];\n $this->sSKUProduit = $row['sSKUProduit'];\n $this->sNomProduit = $row['sNomProduit'];\n $this->sMarque = $row['sMarque'];\n $this->fPrixProduit = $row['fPrixProduit'];\n $this->fPrixSolde = $row['fPrixSolde'];\n $this->sDescCourteProduit = $row['sDescCourteProduit'];\n $this->sCouleur = $row['sCouleur'];\n $this->sCapacite = $row['sCapacite'];\n }", "public function edit(Produits $produit)\n {\n //\n }", "public function accueil() {\r\n $tickets = $this->ticket->getTickets();\r\n $vue = new Vue(\"Accueil\");\r\n $vue->generer(array('tickets' => $tickets));\r\n }", "function reporteCotizacion(){\n\t\t$this->procedimiento='adq.f_cotizacion_sel';\n\t\t$this->transaccion='ADQ_COTREP_SEL';\n\t\t$this->tipo_procedimiento='SEL';//tipo de transaccion\n\t\t$this->setCount(false);\n\t\t\n\t\t$this->setParametro('id_cotizacion','id_cotizacion','int4');\n\t\t\t\t\n\t\t//Definicion de la lista del resultado del query\n\t\t$this->captura('estado','varchar');\n\t\t$this->captura('fecha_adju','date');\n\t\t$this->captura('fecha_coti','date');\n\t\t$this->captura('fecha_entrega','date');\n\t\t$this->captura('fecha_venc','date');\n\t\t$this->captura('id_moneda','int4');\n\t\t$this->captura('moneda','varchar');\n\t\t$this->captura('id_proceso_compra','int4');\n\t\t$this->captura('codigo_proceso','varchar');\n\t\t$this->captura('num_cotizacion','varchar');\n\t\t$this->captura('num_tramite','varchar');\n\t\t$this->captura('id_proveedor','int4');\n\t\t$this->captura('desc_proveedor','varchar');\n\t\t$this->captura('id_persona','int4');\n\t\t$this->captura('id_institucion','int4');\n\t\t$this->captura('dir_per', 'varchar');\n\t\t$this->captura('tel_per1', 'varchar');\n\t\t$this->captura('tel_per2', 'varchar');\n\t\t$this->captura('cel_per','varchar');\n\t\t$this->captura('correo','varchar');\n\t\t$this->captura('nombre_ins','varchar');\n\t\t$this->captura('cel_ins','varchar');\n\t\t$this->captura('dir_ins','varchar');\n\t\t$this->captura('fax','varchar');\n\t\t$this->captura('email_ins','varchar');\n\t\t$this->captura('tel_ins1','varchar');\n\t\t$this->captura('tel_ins2','varchar');\t\t\n\t\t$this->captura('lugar_entrega','varchar');\n\t\t$this->captura('nro_contrato','varchar');\t\t\n\t\t$this->captura('numero_oc','varchar');\n\t\t$this->captura('obs','text');\n\t\t$this->captura('tipo_entrega','varchar');\n\t\t\n\t\t//Ejecuta la instruccion\n\t\t$this->armarConsulta();\n\t\t$this->ejecutarConsulta();\n\t\t\n\t\t//Devuelve la respuesta\n\t\treturn $this->respuesta;\n\t}", "public function actionAfficherecartcomptage()\n {\n \t$i=0;\n \t$cpt1=0;\n \t$cpt2=0;\n \t$cpttotal=0;\n \t$cptstr=0;\n \t$data=null;\n \t$model= new Inventorier();\n \t$searchModel = new InventorierSearch();\n \t$dataProvider = $searchModel->search(Yii::$app->request->queryParams);\n \t$cpttotal=$dataProvider->getTotalCount();\n \t$models=$dataProvider->getModels();\n \t\n \t/**************************traiter ecart entre les deux comptages **************************************/\n \t\n \t$selection=(array)Yii::$app->request->post('selection');//typecasting\n \t\n \tforeach($selection as $id)\n \t{\n \t\t$modeltr=$this->findModel($id);\n \t\t$modeltr->comptage1='1';\n \t\t$modeltr->comptage2='1';\n \t\t$modeltr->save();\n \t\t\n \t\t\n \t\t\n \t}\n \t\n \tif ($model->load(Yii::$app->request->post()))\n \t{\n \t\t$querystr = Structure::find();\n \t\t\n \t\t$dataProviderstr = new ActiveDataProvider([\n \t\t\t\t'query' => $querystr,\n \t\t\t\t]);\n \t\t$modelsstr=$dataProviderstr->getModels();\n \t\tforeach ($modelsstr as $rowstr)\n \t\t{\n \t\t\tif(intval($model->codestructure)==$rowstr->codestructure)\n \t\t\t{\n \t\t\t\t$model->designationstructure=$rowstr->designation;\n \t\t\t}\n \t\t}\n \t\t\n \t\t$searchModelbur = new BureauSearch();\n \t\t$dataProviderbur = $searchModelbur->search(Yii::$app->request->queryParams);\n \t\t$modelsbur=$dataProviderbur->getModels();\n \t\tforeach ($modelsbur as $rowbur)\n \t\t{\n \t\t\tif($rowbur->codestructure == intval($model->codestructure))\n \t\t\t{\n \t\t\t\t$searchModelaff = new AffecterSearch();\n \t\t\t\t$dataProvideraff = $searchModelaff->searchCodbur(Yii::$app->request->queryParams,$rowbur->codebureau);\n \t\t\t\t$modelsaff = $dataProvideraff->getModels();\n \t\t\n \t\t\t\tforeach ($modelsaff as $rowaff)\n \t\t\t\t{\n \t\t\t\t\t$searchModelbien = new BienSearch();\n \t\t\t\t\t$dataProviderbien = $searchModelbien->searchConsultationBienSelonCodestatut(Yii::$app->request->queryParams, $rowaff->codebien);\n \t\t\t\t\t$modelbien=$dataProviderbien->getModels();\n \t\t\n \t\t\t\t\tforeach ($modelbien as $rowbien)\n \t\t\t\t\t{\n \t\t\n \t\t\t\t\t\tif($rowbien->statutbien==\"affecte\")\n \t\t\t\t\t\t{\n \t\t\t\t\t\t\t$modeltrouv = Inventorier::findOne($rowbien->codebien);\n \t\t\t\t \t\t\t\t\n \t\t\t\t\t\t\tif ((($modeltrouv = Inventorier::findOne($rowbien->codebien)) !== null))\n \t\t\t\t\t\t\t\t{ \n \t\t\t\t\t\t\t\t\t$cptstr++;\n \t\t\t\t\t\t\t\t\tif(($modeltrouv->comptage1!=='1'&&$modeltrouv->comptage2=='1')||($modeltrouv->comptage1=='1'&&$modeltrouv->comptage2!=='1'))\n \t\t\t\t\t\t\t\t\t{ \n \t\t\t\t\t\t\t\t\t\tif(($modeltrouv->comptage1=='1'&&$modeltrouv->comptage2=='1'))\n \t\t\t\t\t\t\t\t\t\t{\n \t\t\t\t\t\t\t\t\t\t\t\n \t\t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t\t\telse\n \t\t\t\t\t\t\t\t\t\t{\n \t\t\t\t\t\t\t\t$data[$i] = ['codebien'=>$rowbien->codebien, 'designation'=>$rowbien->designationbien,'bureau'=>$rowbur->codebureau,'etat'=>$rowbien->etatbien,];\n \t\t\t\t\t\t\t\t $i++;\n \t\t\t\t\t\t\t\t $cpt1++;\n \t\t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t}\n \t\t\t\t\t\t}\n \t\t\t\t\t\telse\n \t\t\t\t\t\t{\n \t\t\t\t\t\t\t\t\n \t\t\t\t\t\t\tif($rowbien->statutbien==\"transfere\")\n \t\t\t\t\t\t\t{\n \t\t\t\t\t\t\t\t$bur=$this->dernierTransfert($rowbien->codebien);\n \t\t\t\t\t\t\t\t$modeltrouv = Inventorier::findOne($rowbien->codebien);\n \t\t\t\t\t\t\t\t\n \t\t\t\t\t\t\t\tif ((($modeltrouv = Inventorier::findOne($rowbien->codebien)) !== null))\n \t\t\t\t\t\t\t\t{ $cptstr++;\n \t\t\t\t\t\t\t\t\tif(($modeltrouv->comptage1=='1'&&$modeltrouv->comptage2!=='1')||($modeltrouv->comptage1!=='1'&&$modeltrouv->comptage2=='1'))\n \t\t\t\t\t\t\t\t\t {\n \t\t\t\t\t\t\t\t\t\tif(($modeltrouv->comptage1=='1'&&$modeltrouv->comptage2=='1')){\n \t\t\t\t\t\t\t\t\t\t\t\t\n \t\t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t\t\telse\n \t\t\t\t\t\t\t\t\t\t{\n \t\t\t\t\t\t\t\t\t\n \t\t\t\t\t\t\t\t\t$data[$i] = ['codebien'=>$rowbien->codebien, 'designation'=>$rowbien->designationbien,'bureau'=>$bur,'etat'=>$rowbien->etatbien,];\n \t\t\t\t\t\t\t\t\t$i++;\n \t\t\t\t\t\t\t\t\t$cpt1++;\n \t\t\t\t\t\t\t\t\t\t\n \t\t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t}\n \t\t\t\t\t\t}\n \t\t\t\t\t}\n \t\t\t\t}\n \t\t\t}\n \t\t}\n \t\t$prc=0;\n \t\tif($cptstr!=0)\n \t\t{ \n \t\t$prc=($cpt1)/$cptstr;\n \t\t$prc=$prc*100;\n \t\t}\n \t\t$prc=number_format($prc, 2, ',', ' ');\n \t\t\n \t\t$model->pourcentageecart=$prc.\" %\";\n \t\t\n \t\t$dataProviderRes = new ArrayDataProvider([\n \t\t\t\t'allModels' => $data,\n \t\t\t\t'key' =>'codebien',\n \t\t\t\t'sort' => [\n \t\t\t\t'attributes' => ['codebien','designation','bureau','etat',],\n \t\t\t\t\t\n \t\t\t\t],\n \t\t\t\t]);\n \t\t \n \t\t// $modeltest=$dataProviderRes->getModels();\n \t\t\n \t\t$dataProvider=$dataProviderRes;\n \t\t\n \t}\n \t\n \telse {\n \t\t\n \t\t\n \tforeach ($models as $row)\n \t{\n \t\tif(($row->comptage1=='1'&&$row->comptage2!='1'))\n \t\t{ \n \t\t\t$rowbien=Bien::findOne($row->codebien); \n \t\t\t$data[$i] = ['codebien'=>$row->codebien, 'designation'=>$rowbien->designationbien,'bureau'=>$row->bureau,'etat'=>$rowbien->etatbien,];\n \t\t\t$i++;\n \t\t\t$cpt1++; \n \t\t}\n \t\telse\n \t\t{\n\n \t\tif($row->comptage1!='1' && $row->comptage2=='1')\n \t\t{\n \t\t\t$rowbien=Bien::findOne($row->codebien); \n \t\t\t$data[$i] = ['codebien'=>$row->codebien, 'designation'=>$rowbien->designationbien,'bureau'=>$row->bureau,'etat'=>$rowbien->etatbien,];\n \t\t\t$i++;\n \t\t\t$cpt1++;\n \t\t}\n \t\t}\n \t\t\n \t}\n \t$prc=0;\n \tif ($cpttotal!=0)\n \t$prc=($cpt1)/$cpttotal;\n \t$prc=$prc*100;\n \t\n \t$seuil=0;\n \t$modelin=new Exerciceinventaire();\n \t$searchModelexerc= new ExerciceinventaireSearch();\n \t$dataProviderexerc = $searchModelexerc->search(Yii::$app->request->queryParams);\n \t\n \t\t$modelsexerc=$dataProviderexerc->getModels();\n \t\tforeach ($modelsexerc as $rowex)\n \t\t{ \n \t\t\tif($rowex->anneeinv==date('Y'))\n \t\t\t{\n \t\t\t\t\n \t\t\t\t$seuil=$rowex->seuil_compte;\n \t\t\t\tif($seuil<=$prc)\n \t\t\t\t{\n \t\t\t\t\t\\Yii::$app->getSession()->setFlash('info', \"L'écart entre les deux comptage est arrivé au seil, Vous devez passer au troisième comptage.\");\n \t\t\t\t\t\t\n \t\t\t\t}\n \t\t\t}\n \t\t\t\n \t\t}\n \t\t$prc=number_format($prc, 2, ',', ' ');\n \t\t\n \t\t$prc=$prc.\" %\";\n \t\t$model->pourcentageecart=$prc;\n \t$dataProviderRes = new ArrayDataProvider([\n \t\t\t'allModels' => $data,\n \t\t\t'key' =>'codebien',\n \t\t\t'sort' => [\n \t\t\t'attributes' => ['codebien','designation','bureau','etat',],\n \t\t\t\t\n \t\t\t],\n \t\t\t]);\n \t \n \t// $modeltest=$dataProviderRes->getModels();\n \t\n \t$dataProvider=$dataProviderRes;\n \t\n \t\n \t}\n \t \n \t \treturn $this->render('extraireEcartComptage', [\n \t\t\t'searchModel' => $searchModel,\n \t\t\t'dataProvider' => $dataProvider,\n \t\t\t'model'=>$model,\n \t\t\t]);\n }", "public function edit(Produit $produit)\n {\n //\n }", "public function edit(Produit $produit)\n {\n //\n }", "function SchedullerPO(){\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Cek --> Update PO List, Update Quantity PO Open\n\t\t// echo \"hahah\";\t\t\n\t\trequire_once APPPATH.'third_party/sapclasses/sap.php';\n\t\t$sap = new SAPConnection();\n\t\t$sap->Connect(APPPATH.\"third_party/sapclasses/logon_dataDev.conf\");\n\t\tif ($sap->GetStatus() == SAPRFC_OK ) $sap->Open ();\n\t\tif ($sap->GetStatus() != SAPRFC_OK ) {\n\t\t\techo $sap->PrintStatus();\n\t\t\texit;\n\t\t}\n\n\t\t$fce = &$sap->NewFunction (\"Z_ZCMM_VMI_PO_DETAILC\");\n\t\t\n\t\tif ($fce == false) {\n\t\t\t$sap->PrintStatus();\n\t\t\texit;\n\t\t}\n\t\t\n\t\t$start \t= date(\"20170101\");\t\t\t\t\t// Date start VMI apps\n\t\t$end \t= date(\"Ymd\");\t\t\t\t\t\t// Date Now\n\t\t$opco\t\t\t\t\t= '7000';\n\t\t$fce->COMPANY \t\t\t= \"$opco\";\t\t// BUKRS\n\t\t// $fce->PO_TYPE \t\t= 'ZK17';\n\t\t// $fce->VENDOR \t\t= ;\n\t\t$fce->DATE['SIGN'] \t= 'I';\n\t\t$fce->DATE['OPTION']\t= 'BT';\n\t\t$fce->DATE['LOW'] \t= $start;\n\t\t$fce->DATE['HIGH'] \t= $end;\n\t\t\n\t\t$fce->PO_TYPE->row['SIGN'] \t= 'I';\n\t\t$fce->PO_TYPE->row['OPTION'] \t= 'EQ';\n\t\t$fce->PO_TYPE->row['LOW'] \t= 'ZK10';\n\t\t$fce->PO_TYPE->row['HIGH'] \t= '';\n\t\t$fce->PO_TYPE->Append($fce->PO_TYPE->row);\n\t\t\n\t\t$fce->PO_TYPE->row['SIGN'] \t= 'I';\n\t\t$fce->PO_TYPE->row['OPTION'] \t= 'EQ';\n\t\t$fce->PO_TYPE->row['LOW'] \t= 'ZK17';\n\t\t$fce->PO_TYPE->row['HIGH'] \t= '';\n\t\t$fce->PO_TYPE->Append($fce->PO_TYPE->row);\n\t\t\t\n $fce->call();\n\n if ($fce->GetStatus() == SAPRFC_OK) {\n $fce->T_ITEM->Reset();\n $data=array();\n $empty=0;\n $tampildata=array();\n while ($fce->T_ITEM->Next()) {\n\t\t\t\t$matnr \t\t= $fce->T_ITEM->row[\"MATNR\"];\t// Kode Material\n\t\t\t\t$lifnr \t\t= $fce->T_ITEM->row[\"LIFNR\"];\t// Kode Vendor\n\t\t\t\t$ebeln \t\t= $fce->T_ITEM->row[\"EBELN\"];\t// No PO\n\t\t\t\t$menge \t\t= intval($fce->T_ITEM->row[\"MENGE\"]);\t// Quantity PO\n\t\t\t\t$sisaqty\t= intval($fce->T_ITEM->row[\"DELIV_QTY\"]);\t// Quantity PO Open\n\t\t\t\t$werks \t\t= $fce->T_ITEM->row[\"WERKS\"];\t// Plant\n\t\t\t\t$vendor\t\t= $fce->T_ITEM->row[\"VENDNAME\"];\t// Nama Vendor\n\t\t\t\t$material \t= $fce->T_ITEM->row[\"MAKTX\"];\t// Nama Material\n\t\t\t\t$potype \t= $fce->T_ITEM->row[\"BSART\"];\t// Type PO\n\t\t\t\t// $mins \t\t= $fce->T_ITEM->row[\"EISBE\"];\t// Safety Stock\n\t\t\t\t$mins \t\t= $fce->T_ITEM->row[\"MINBE\"];\t// Re Order Point\n\t\t\t\t$maxs \t\t= $fce->T_ITEM->row[\"MABST\"];\t// Max\n\t\t\t\t$statuspo\t= $fce->T_ITEM->row[\"ELIKZ\"];\t// Max\n\t\t\t\t$start \t\t= date_format(date_create($fce->T_ITEM->row[\"BEDAT\"]),'d M Y');\n\t\t\t\t$end \t\t= date_format(date_create($fce->T_ITEM->row[\"EINDT\"]),'d M Y');\n\t\t\t\t\n\t\t\t\tif($statuspo == 'X' || $statuspo == 'x')\n\t\t\t\t{\n\t\t\t\t\t$sts = 0;\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$sts = 1;\n\t\t\t\t}\n\t\t\t\t$sqlread= \"SELECT count(id_list) ADA\n\t\t\t\t\t\t\tFROM VMI_MASTER \n\t\t\t\t\t\t\twhere NO_PO = '$ebeln' and\n\t\t\t\t\t\t\tKODE_MATERIAL = '$matnr' and \n\t\t\t\t\t\t\tKODE_VENDOR = '$lifnr' and\n\t\t\t\t\t\t\tPLANT = '$werks' \n\t\t\t\t\t\t\t\";\n\t\t\t\t\t\t\t//and QUANTITY = '$menge'\n\t\t\t\t$jum \t= $this->db->query($sqlread)->row();\n\t\t\t\t$nilai \t= $jum->ADA;\n\t\t\t\t// echo $nilai.\"->\".$matnr.\" | \".$lifnr.\" | \".$ebeln.\" | \".$menge.\" | \".$werks.\" | \".$vendor.\" | \".$material.\" | \".$start.\" | \".$end.\" ==> \".$potype.\"<br/>\";\n\t\t\t\t// $ebeln == \"6310000038\" || $ebeln == \"6310000039\" || $ebeln == \"6310000040\" || $ebeln == \"6310000041\" || $ebeln == \"6310000042\" || $ebeln == \"6310000043\")\n\t\t\t\t\n\t\t\t\tif($nilai < 1){\n\t\t\t\t\tif($ebeln == \"6310000038\" || $ebeln == \"6310000039\" || $ebeln == \"6310000040\" || $ebeln == \"6310000041\" || $ebeln == \"6310000042\" || $ebeln == \"6310000043\"\n\t\t\t\t\t\t|| $lifnr == \"0000113004\" || $lifnr == \"0000110091\" || $lifnr == \"0000110253\" || $lifnr == \"0000110015\" || $lifnr == \"0000112369\" || $lifnr == \"0000110016\"){\t\t\t\t\t\t\n\t\t\t\t\t\t$sqlcount \t= \"SELECT max(ID_LIST) MAXX FROM VMI_MASTER\";\n\t\t\t\t\t\t$maxid \t\t= $this->db->query($sqlcount)->row();\t\t\n\t\t\t\t\t\t$max_list \t= $maxid->MAXX+1;\n\t\t\t\t\t\t$insert\t\t= \"insert into VMI_MASTER(ID_LIST,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tPLANT,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tKODE_MATERIAL,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tNAMA_MATERIAL,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tUNIT,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tKODE_VENDOR,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tNAMA_VENDOR,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tNO_PO,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tPO_ITEM,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tCONTRACT_ACTIVE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tCONTRACT_END,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tDOC_DATE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tSLOC,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tMIN_STOCK,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tMAX_STOCK,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tSTOCK_AWAL,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tSTOCK_VMI,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tQUANTITY,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tID_COMPANY,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tSTATUS)\n\t\t\t\t\t\t\t\t\t\t\t\tvalues('$max_list',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'$werks',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'$matnr',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'$material',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'\".$fce->T_ITEM->row[\"MEINS\"].\"',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'$lifnr',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'$vendor',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'$ebeln',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'\".$fce->T_ITEM->row[\"EBELP\"].\"',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tTO_DATE('\".date_format(date_create($start),'Y-m-d').\"','YYYY-MM-DD'),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tTO_DATE('\".date_format(date_create($end),'Y-m-d').\"','YYYY-MM-DD'),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tTO_DATE('\".date_format(date_create($start),'Y-m-d').\"','YYYY-MM-DD'),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'\".$fce->T_ITEM->row[\"LGORT\"].\"',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'\".$fce->T_ITEM->row[\"EISBE\"].\"',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'\".$fce->T_ITEM->row[\"MABST\"].\"',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'0',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'0',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'$sisaqty',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'$opco',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'$sts'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\";\n\t\t\t\t\t\t$save \t= $this->db->query($insert);\n\t\t\t\t\t\techo \"Baru ==> $ebeln | $material | $vendor | $opco | $werks | $potype<br/>\";\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\techo \"Skip ==> $ebeln | $material | $vendor | $opco | $werks | $potype<br/>\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telseif($nilai >= 1){\n\t\t\t\t\t$sqlread1 = \"SELECT ID_LIST\n\t\t\t\t\t\t\tFROM VMI_MASTER \n\t\t\t\t\t\t\twhere NO_PO = '$ebeln' and\n\t\t\t\t\t\t\tKODE_MATERIAL = '$matnr' and \n\t\t\t\t\t\t\tKODE_VENDOR = '$lifnr' and\n\t\t\t\t\t\t\tPLANT = '$werks' \n\t\t\t\t\t\t\t\";\n\t\t\t\t\t\t\t//and QUANTITY = '$menge'\n\t\t\t\t\t$getlist= $this->db->query($sqlread1)->row();\n\t\t\t\t\t$idlist = $getlist->ID_LIST;\n\t\t\t\t\t$update\t\t= \"update VMI_MASTER set quantity = '$sisaqty',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tmin_stock = '$mins',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tmax_stock = '$maxs',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tSTATUS = '$sts'\n\t\t\t\t\t\t\t\t\t\t\t\t\twhere ID_LIST = '$idlist'\n\t\t\t\t\t\t\t\t\";\n\t\t\t\t\t$update_data\t= $this->db->query($update);\n\t\t\t\t\t\techo \"$update <br/>\";\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\t\techo \"Skip ==> $ebeln | $material | $vendor | $opco| $werks | $potype<br/>\";\n\t\t\t\t}\n\t\t\t\t// echo \"<hr/>\"; \n\t\t\t}\n\t\t// echo \"<pre>\";\n\t\t// print_r($fce);\n\t\t// echo \"hahaha\";\n $fce->Close();\n\t\t}\n }", "function sevenconcepts_pre_insertion($flux){\n if ($flux['args']['table']=='spip_auteurs'){\n include_spip('cextras_pipelines');\n $champs_extras=champs_extras_objet(table_objet_sql('auteur'));\n foreach($champs_extras as $value){\n $flux['data'][$value['options']['nom']]=_request($value['options']['nom']); \n }\n $flux['data']['name']=_request('nom_inscription'); \n }\nreturn $flux;\n}", "public function transactServicePro__()\n {\n //var_dump($this->paramGET); die();\n $param = [\n \"button\" => [\n \"modal\" => [\n [\"reporting/detailTransactServModal\", \"reporting/detailTransactServModal\", \"fa fa-search\"],\n ],\n \"default\" => [\n ]\n ],\n \"tooltip\" => [\n \"modal\" => [\"Détail\"]\n ],\n \"classCss\" => [\n \"modal\" => [],\n \"default\" => [\"confirm\"]\n ],\n \"attribut\" => [],\n \"args\" => $this->paramGET,\n \"dataVal\" => [\n ],\n \"fonction\" => [\"date_transaction\"=>\"getDateFR\",\"montant\"=>\"getFormatMoney\",\"commission\"=>\"getFormatMoney\"]\n ];\n $this->processing($this->reportingModels, 'getAllTransactionService', $param);\n }", "public function commissionPartenaire()\n {\n $data['liste_part'] = $this->partenaireModels->getPartenaire();\n $this->views->setData($data);\n\n $this->views->getTemplate('reporting/commissionPartenaire');\n }", "function wtsCaddieDisp($ar){\n $caddie = $this->getCaddie();\n $mobile = false;\n $web = false;\n $source = $this->getSource();\n if ($source == self::$WTSORDER_SOURCE_SITE_INTERNET)\n $web = true;\n if ($source == self::$WTSORDER_SOURCE_SITE_MOBILE)\n $mobile = true;\n $offres = $this->modcatalog->listeOffres($mobile, $web);\n $caddie['offres'] = $offres;\n if ($this->customerIsPro()){\n $this->summarizeCaddie($caddie);\n }\n XShell::toScreen2('wts', 'caddie', $caddie);\n }", "function getLesIdProduitsDuPanier()\n{\n\treturn $_SESSION['produits'];\n\n}", "function wtssaisieforfaits($ar){\n $p = new XParam($ar, array());\n $offre = $p->get('offre');\n // lecture des informations à partir des produits (oid=>nb) \n // par exemple si appel offre de meilleur prix\n if ($p->is_set('products')){\n $products = $p->get('products');\n $wtsvalidfrom = $p->get('validfrom');\n $perror = false;\n $wtspools = array();\n $wtspersons = array();\n $wtstickets = array();\n foreach($products as $poid=>$pnb){\n\t$rsp = selectQuery('select wtspool, wtsperson, wtsticket from '.self::$tableCATALOG.' where PUBLISH=1 and LANG=\"FR\" and KOID=\"'.$poid.'\"');\n\tif($rsp->rowCount() != 1){\n\t XLogs::critical(get_class($this). '::wtssaisieforfaits erreur appel via produits produit : '.$poid);\n\t $perror = true;\n\t}\n\t$orsp = $rsp->fetch();\n\t$wtspools[] = $orsp['wtspool'];\n\t$wtstickets[] = $orsp['wtsticket'];\n\t$wtspersons[$orsp['wtsperson']] = $pnb;\n }\n $rsp->closeCursor();\n unset($orsp);\n unset($products);\n unset($poid);\n unset($pnb);\n $wtspool = array_unique($wtspools);\n $wtsticket = array_unique($wtstickets);\n if (count($wtspool) != 1 || count($wtsticket) != 1){\n\t XLogs::critical(get_class($this). '::wtssaisieforfaits erreur appel via produits plusieurs pools, plusieurs tickets '.implode($wtspools).' '.implode($wtstickets));\n\t $perror = true;\n }\n $wtspool = $wtspools[0];\n $wtsticket = $wtstickets[0];\n $wtsperson = $wtspersons;\n unset($wtspools);\n unset($wtstickets);\n unset($wtspersons);\n if ($perror){\n\tXLogs::critical(get_class($this). '::wtssaisieforfaits erreur appel via produits');\n\tXShell::setNext($GLOBALS['HOME_ROOT_URL']);\n\treturn;\n }\n } else {\n $wtspool = $p->get('wtspool');\n $wtsperson = $p->get('wtspersonnumber');\n $wtsticket = $p->get('wtsticket');\n $wtsvalidfrom = $p->get('wtsvalidfrom');\n }\n $personpackid = uniqid('ppid_');\n $tpl = 'wts';\n // l'offre doit être valide\n if (!$this->modcatalog->validOffer($offre)){\n XLogs::critical(get_class($this). '::wtssaisieforfaits acces offre offline ');\n XShell::setNext($GLOBALS['HOME_ROOT_URL']);\n return;\n }\n if ($p->is_set('wtspersonnumbermo')){\n unset($_REQUEST['wtspersonnumber']);\n $_REQUEST['wtspersonnumber'] = $wtsperson = array($p->get('wtspersonnumbermo')=>1);\n }\n $lines = array();\n // saison\n $season = $this->getSeason();\n // lecture de l'offre en cours\n $doffre = $this->modcatalog->displayOffre(array('_options'=>array('local'=>true),\n\t\t\t\t\t\t 'tplentry'=>$tpl.'_offre',\n\t\t\t\t\t\t 'offre'=>$offre,\n\t\t\t\t\t\t 'caddie'=>true\n\t\t\t\t\t\t )\n\t\t\t\t\t );\n // correction saison dans le cas des offres flashs\n if ($doffre['doffre']['oflash']->raw == 1){\n $season['odatedeb'] = $season['odatedebflash'];\n $season['odelaitrans'] = $season['odelaitransflash'];\n $season['odelaifab'] = $season['odelaifabflash'];\n }\n // premier jour de ski pour controle des dispo cartes\n $firstdaynewcard = $this->getFirstDayNewCard($season);\n\n // lecture des produits (pour ensuite avoir le prix)\n foreach($wtsperson as $personoid=>$personnb){\n if (empty($personnb) || $personnb<1)\n continue;\n $dp = $this->modcatalog->displayProduct($offre, $wtspool, $wtsticket, $personoid);\n if ($dp == NULL)\n continue;\n $dpc = $this->modcatalog->getPrdConf($dp);\n// jcp, bloquant, c'est sur le module => xmodeplspecialoffer::getSpecialOffer\n// $dpsp = $this->dsspoffer->getSpecialOffer($dp);\n\n // ajout des assurances ...\n $assur = $this->modcatalog->getProductAssurance($dp, $dpc);\n\n // ajout des prix de cartes si achat possible a cette date pour ce produit\n $newcard = $this->modcatalog->getNewCard($dp, $dpc, $wtsvalidfrom);\n $availablesNewCards = $this->modcatalog->getAvailablesNewCards($dp, $dpc, $wtsvalidfrom, $firstdaynewcard);\n // recherche des prix fidelite (complements sur le bloc forfait)\n $loyaltymess = $loyaltyprice = $loyaltyProductOid = NULL;\n if ($this->modcustomer->loyaltyActive()){\n list($loyaltymess, $loyaltyprice, $loyaltyProductOid) = $this->modcustomer->preCheckLoyaltyReplacementProduct(array('season'=>$season, 'doffre'=>$doffre['doffre'], 'dp'=>$dp, 'dpc'=>$dpc, 'validfrom'=>$wtsvalidfrom, 'availablesNewCards'=>$availablesNewCards));\n }\n // creation des lignes pour chaque personne\n for($i = 0; $i<$personnb; $i++){\n $lines[] = array('assur'=>$assur,\n 'personpackid'=>$personpackid,\n 'productconf'=>$dpc,\n 'validfrom'=>$wtsvalidfrom,\n 'product'=>$dp,\n 'newcard'=>$newcard, /* a virer */\n 'availablesnewcards'=>$availablesNewCards,\n 'id'=>'line_'.str_replace(':', '', $dp['oid']).sprintf('_%04d', $i),\n 'label'=>$dp['owtsperson']->link['olabel']->raw.' '.($i+1),\n 'amin'=>$dp['owtsperson']->link['oamin']->raw,\n 'amax'=>$dp['owtsperson']->link['oamax']->raw,\n\t\t\t 'personoid'=>$dp['owtsperson']->raw,\n 'saisieident'=>$dp['owtsperson']->link['osaisieident']->raw,\n 'saisiedob'=>$dp['owtsperson']->link['osaisiedob']->raw,\n 'loyaltyproductoid'=>($loyaltyProductOid == NULL)?false:$loyaltyProductOid,\n 'loyaltyprice'=>($loyaltyProductOid == NULL)?false:$loyaltyprice,\n 'loyaltymess'=>($loyaltyProductOid != NULL && $loyaltymess != 'found')?$loyaltymess:false);\n }\n }\n \n // lecture des prix par validfrom/produit\n // calcul validtill\n // disponbilité des cartes / validfrom : forfaits déja présent, delais (cas des nouvelles cartes)\n $caddie = $this->getCaddie();\n $carddispo = $caddie['cards'];\n foreach($lines as $il=>&$line){\n $t = $this->modcatalog->getProductTariff($line['product'], $wtsvalidfrom);\n $line['validtill'] = $this->getValidtill($line['validfrom'], $line['product'], $line['productconf']);\n if ($t['tariff'] != 'NOT FOUND'){\n $line['price'] = $t['tariff'];\n } else {\n $line['price'] = 'NOT FOUND';\n }\n foreach($caddie['lines'] as $lineid=>$pline){\n // exclusions par date de forfaits\n if ($pline['type'] == 'forfait'){\n if (($pline['validfrom']<=$line['validtill'] && $line['validtill']<=$pline['validtill']) || \n\t ($pline['validfrom'] <= $line['validfrom'] && $line['validfrom'] <= $pline['validtill']))\n $carddispo[$pline['cardid']] = false;\n }\n // exclusion par nombre (? a paramétrer ?)\n if (count($caddie['bycards'][$pline['cardid']]['cardlines'])>=3){\n $carddispo[$pline['cardid']] = false;\n }\n // exclusion par type de carte \n }\n /* -- vente de cartes seules -- */\n /* et de toute façon */\n foreach($caddie['bycards'] as $cardid=>$carditems){\n if ($carditems['newcard'] !== false && $line['validfrom']<=$firstdaynewcard)\n $carddispo[$cardid] = false;\n }\n $line['cardsdispo'] = $carddispo;\n }\n unset($line);\n // calcul du meilleur prix (si l'offre ne l'interdit pas)\n if ($doffre['doffre']['obetterprice'] && $doffre['doffre']['obetterprice']->raw == 1){\n $rbo = $this->ctrlChoix($ar);\n if ($r->ok == 0){\n XShell::toScreen2($tpl, 'betteroffers', $rbo);\n }\n }\n // gestion du compte client : raccourcis\n if (!empty($this->aliasmyaccount)){\n $custcards = $this->modcustomer->dispCustCards();\n if (count($custcards['custcardnos'])>0)\n XShell::toScreen2($tpl, 'custcards', $custcards);\n } \n // totaux car catégories (pour offre pro entre autres)\n $summary = array('lines'=>array(), 'totforfait'=>0, 'needAssur'=>false, 'needDob'=>false, 'needIdent'=>false);\n foreach($lines as $il=>$aline){\n $aproductoid = $aline['product']['oid'];\n if (!isset($summary['lines'][$aproductoid])){\n $summary['lines'][$aproductoid] = array('label'=>$aline['product']['label'], 'nb'=>0, 'price'=>$aline['price'], 'tot'=>0);\n }\n $summary['lines'][$aproductoid]['nb'] += 1;\n $summary['lines'][$aproductoid]['tot'] += $aline['price'];\n $summary['totforfait'] += $aline['price'];\n if (isset($aline['assur']))\n $summary['needAssur'] = true;\n if ($aline['saisieident'] == 1)\n $summary['needIdent'] = true;\n if ($aline['saisiedob'] == 1)\n $summary['needDob'] = true;\n }\n // cas offre saisie modification de skieurs ! offre \"coherente ?\" \n $advanced = array('on'=>false);\n if (isset($doffre['doffre']['oadvancedinput']) && $doffre['doffre']['oadvancedinput']->raw == 1){\n //&& count($caddie['lines']) == 0){ \n $advanced['on'] = true;\n $this->defaultStepTemplates['commande2'] = $this->templatesdir.'choix-produit2.html';\n foreach($lines as $il=>&$line){\n\tforeach($doffre['tickets'] as $ticketoid=>$aticket){\n\t if (in_array($wtspool, $aticket['pools'])){\n\t $odp = $this->modcatalog->displayProduct($offre, $wtspool, $ticketoid, $line['personoid']);\n\t if ($odp != NULL){\n\t $line['advanced']['calendar'] = $this->modcatalog->configureOneCalendar($season, array($opd['oprdconf']), $doffre['doffre']);\n\t if ($line['product']['owtsticket']->raw == $ticketoid){\n\t\t$aticket['selected'] = true;\n\t }\n\t $aticket['productoid'] = $odp['oid'];\n\t $line['advanced']['tickets'][$ticketoid] = $aticket;\n\t }\n\t }\n\t}\n }\n }\n XShell::toScreen2($tpl, 'advanced', $advanced);\n XShell::toScreen2($tpl, 'summary', $summary);\n //\n XShell::toScreen2($tpl, 'lines', $lines);\n // blocage du pave haut\n XShell::toScreen1($tpl.'_offre', $doffre);\n XShell::toScreen2($tpl.'_offre', 'lock', true);\n\n // valeurs choisies\n $choix = array('wtsvalidfrom'=>$wtsvalidfrom,\n 'wtspool'=>$wtspool,\n 'wtspersonnumber'=>$wtsperson,\n 'wtsticket'=>$wtsticket);\n\n XShell::toScreen2($tpl.'_offre', 'current', $choix);\n\n $choix['wtsoffre'] = $offre;\n setSessionVar('wts_offre_current', $choix);\n\n $_REQUEST['insidefile'] = $this->defaultStepTemplates['commande2'];\n $this->setOffreLabels($doffre['doffre']);\n $this->wtscallback();\n\n }", "public static function addPanier() {\n //Si le produit n'existe pas\n if (!isset($_GET['id'])) {\n self::error();\n } else {\n $idProduit = $_GET['id'];\n //Si le panier est vide\n if (!isset($_SESSION['panier'])) {\n $stockProduit = 1;\n $_SESSION['panier'] = array('produit' . $idProduit => array('id' => $idProduit,\n 'stock' => $stockProduit),);\n } else {\n //Si le produit n'est pas deja present dans le panier\n if (!isset($_SESSION[\"panier\"][\"produit\" . $idProduit])) {\n $stockProduit = 1;\n $_SESSION[\"panier\"]['produit' . $idProduit] = array('id' => $idProduit,\n 'stock' => $stockProduit);\n } else {\n $_SESSION[\"panier\"][\"produit\" . $idProduit][\"stock\"] ++;\n }\n }\n }\n self::readPanier();\n }", "public function show(AttributProduit $attributProduit)\n {\n //\n }", "public function inscription(){\n // envoi de mail lors de l'inscription d'un produit ?\n $this->load->model('produit');\n\t\t\t\t$this->load->helper('form');\n\t\t\t\t$this->load->view('produit/inscription');\n $data=array(\n \"nomProduit\"=> htmlspecialchars($_GET['nomProduit']),\n \"descriptionProduit\"=> htmlspecialchars($_GET['descriptionProduit']),\n \"prixUnitaireProduit\" => htmlspecialchars($_GET['prixUnitaireProduit']),\n \"reducProduit\" => htmlspecialchars($_GET['reducProduit']),\n\t\t\t );\n \t\t $this->produit->insert($data);\n\t }", "public function setForAuteur()\n {\n //met à jour les proposition qui n'ont pas de base contrat et qui ne sont pas null\n /*PLUS BESOIN DE BASE CONTRAT\n \t\t$dbP = new Model_DbTable_Iste_proposition();\n \t\t$dbP->update(array(\"base_contrat\"=>null), \"base_contrat=''\");\n */\n\t \t//récupère les vente qui n'ont pas de royalty\n\t \t$sql = \"SELECT \n ac.id_auteurxcontrat, ac.id_livre\n , ac.id_isbn, ac.pc_papier, ac.pc_ebook\n , a.prenom, a.nom, c.type, IFNULL(a.taxe_uk,'oui') taxe_uk\n ,i.num\n , v.id_vente, v.date_vente, v.montant_livre, v.id_boutique, v.type typeVente\n , i.id_editeur, i.type typeISBN\n , impF.conversion_livre_euro\n FROM iste_vente v\n INNER JOIN iste_isbn i ON v.id_isbn = i.id_isbn \n INNER JOIN iste_importdata impD ON impD.id_importdata = v.id_importdata\n INNER JOIN iste_importfic impF ON impF.id_importfic = impD.id_importfic\n INNER JOIN iste_auteurxcontrat ac ON ac.id_isbn = v.id_isbn\n INNER JOIN iste_contrat c ON c.id_contrat = ac.id_contrat\n INNER JOIN iste_auteur a ON a.id_auteur = ac.id_auteur\n INNER JOIN iste_livre l ON l.id_livre = i.id_livre \n LEFT JOIN iste_royalty r ON r.id_vente = v.id_vente AND r.id_auteurxcontrat = ac.id_auteurxcontrat\n WHERE pc_papier is not null AND pc_ebook is not null AND pc_papier != 0 AND pc_ebook != 0\n AND r.id_royalty is null \";\n\n $stmt = $this->_db->query($sql);\n \n \t\t$rs = $stmt->fetchAll(); \n \t\t$arrResult = array();\n \t\tforeach ($rs as $r) {\n\t\t\t//calcule les royalties\n \t\t\t//$mtE = floatval($r[\"montant_euro\"]) / intval($r[\"nbA\"]);\n \t\t\t//$mtE *= floatval($r[\"pc_papier\"])/100;\n \t\t\tif($r[\"typeVente\"]==\"ebook\")$pc = $r[\"pc_ebook\"];\n \t\t\telse $pc = $r[\"pc_papier\"];\n $mtL = floatval($r[\"montant_livre\"])*floatval($pc)/100;\n //ATTENTION le taux de conversion est passé en paramètre à l'import et le montant des ventes est calculé à ce moment\n \t\t\t//$mtD = $mtL*floatval($r[\"taux_livre_dollar\"]);\n \t\t\t$mtE = $mtL*floatval($r['conversion_livre_euro']);\n //ajoute les royalties pour l'auteur et la vente\n //ATTENTION les taxes de déduction sont calculer lors de l'édition avec le taux de l'année en cours\n $dt = array(\"pourcentage\"=>$pc,\"id_vente\"=>$r[\"id_vente\"]\n ,\"id_auteurxcontrat\"=>$r[\"id_auteurxcontrat\"],\"montant_euro\"=>$mtE,\"montant_livre\"=>$mtL\n ,\"conversion_livre_euro\"=>$r['conversion_livre_euro']);\n\t \t\t$arrResult[]= $this->ajouter($dt\n ,true,true);\n //print_r($dt);\n \t\t}\n \t\t\n \t\treturn $arrResult;\n }", "public function show(FamilleProduit $familleProduit)\n {\n //\n }", "function ajouterProduit($id_produit, $quantite, $photo, $titre, $prix){\n\n\tcreationPanier();\n\n\t $_SESSION['panier']['id_produit'][] = $id_produit; \n\t $_SESSION['panier']['quantite'] [] = $id_quantite;\n\t\t$_SESSION['panier']['produit'] [] = $id_produit;\n\t\t$_SESSION['panier']['prix'][] = $id_prix;\n\t\t$_SESSION['panier']['titre'][] = $id_titre;\n\t\t$_SESSION['panier']['photo'][] = $id_photo;\n// le crochet vide permet de stocker la valeur au prochain indice disponible...\n}", "public function showAction(Request $request, Produits_1 $produit)\n {\n $user = $this->getUser();\n $form = $this->createForm('Kountac\\KountacBundle\\Form\\ProduitsAddPriceCommandeType');\n $form_stock = $this->createForm('Kountac\\KountacBundle\\Form\\ProduitsAddStockType');\n if ($request->getMethod() == 'POST') {\n $form->handleRequest($request);\n if ($form->isSubmitted() && $form->isValid()) {\n $em = $this->getDoctrine()->getManager();\n $prixCommande = $form[\"prixCommande\"]->getData();\n $produit->getEuro()->setPrixCommande($prixCommande);\n $produit->setDateupdate(new \\DateTime('now'));\n $em->persist($produit);\n $em->flush();\n \n $this->get('session')->getFlashBag()->add('success','Le prix de la commande sur mesure a été ajouté avec succès');\n return $this->redirectToRoute('produit_pro_show', array('id' => $produit->getId()));\n }\n }\n return $this->render('produits/show.html.twig', array(\n 'produit' => $produit,\n 'user' => $user,\n 'form' => $form->createView(),\n 'form_stock' => $form_stock->createView(),\n ));\n }", "function profil($content) {\n\t\t$this -> vue -> afficheProfil($this -> modele -> getCompte($_SESSION['id']), $content);\n\t}", "public function getProduit() {\n $id = $_GET['produit_id'];\n $produit = Produit::where('id',$id)->get();\n $type = Typeproduit::get();\n $data['produit'] = $produit;\n $data['type'] = $type;\n\n return json_encode($data);\n }", "function formidablepaiement_bank_traiter_reglement($flux){\n\n\t// si c'est une transaction associee a un form\n\tif ($id_transaction = $flux['args']['id_transaction']\n\t AND preg_match(\",form\\d+:,\",$flux['args']['avant']['parrain'])\n\t AND $id_formulaires_reponse = $flux['args']['avant']['tracking_id']){\n\n\t\t$reponse = sql_fetsel('*','spip_formulaires_reponses','id_formulaires_reponse='.intval($id_formulaires_reponse));\n\t\t$formulaire = sql_fetsel('*','spip_formulaires','id_formulaire='.intval($reponse['id_formulaire']));\n\n\t\t$traitements = unserialize($formulaire['traitements']);\n\t\tif ($message = trim($traitements['paiement']['message'])){\n\t\t\tinclude_spip(\"inc/texte\");\n\t\t\t$flux['data'] .= propre($message);\n\t\t}\n\t}\n\n\treturn $flux;\n}", "function proyinforsup(){\n\t\t\t$proyectos = $this->Proyinforsup->find('all',\n\t\t\tarray(\n\t\t\t\t'fields' => array('DISTINCT idproyecto','numeroproyecto')\t\n\t\t\t\t));\n\t\t\t$this->set('proyectos',Hash::extract($proyectos,'{n}.Proyinforsup'));\n\t\t\t$this->set('_serialize', 'proyectos');\n\t\t\t$this->render('/json/proyinforsup');\n\t\t}", "public function hookDisplayBackOfficeTop()\n {\n $objectifCoach = array();\n $this->context->controller->addCSS($this->_path . 'views/css/compteur.css', 'all');\n $this->context->controller->addJS($this->_path . 'views/js/compteur.js');\n $objectifCoach[] = CaTools::getObjectifCoach($this->context->employee->id);\n $objectif = CaTools::isProjectifAtteint($objectifCoach);\n $objectif[0]['appels'] = (isset($_COOKIE['appelKeyyo'])) ? (int)$_COOKIE['appelKeyyo'] : '0';\n\n $this->smarty->assign(array(\n 'objectif' => $objectif[0]\n ));\n return $this->display(__FILE__, 'compteur.tpl');\n }", "public function saisie() {\r\n if (!isAuth(315)) {\r\n return;\r\n }\r\n if (!empty($this->request->punipar)) {\r\n $params = [\"eleve\" => $this->request->comboEleves,\r\n \"datepunition\" => $this->request->datepunition,\r\n \"dateenregistrement\" => date(\"Y-m-d\", time()),\r\n \"duree\" => $this->request->duree,\r\n \"typepunition\" => $this->request->comboTypes,\r\n \"motif\" => $this->request->motif,\r\n \"description\" => $this->request->description,\r\n \"punipar\" => $this->request->punipar,\r\n \"enregistrerpar\" => $this->session->user,\r\n \"anneeacademique\" => $this->session->anneeacademique];\r\n $this->Punition->insert($params);\r\n $this->sendNotification($this->request->comboEleves, $this->request->datepunition, \r\n $this->request->duree, $this->request->motif, $this->request->comboTypes);\r\n header(\"Location:\" . Router::url(\"punition\"));\r\n }\r\n $this->view->clientsJS(\"punition\" . DS . \"punition\");\r\n $view = new View();\r\n\r\n $type = $this->Typepunition->selectAll();\r\n $comboTypes = new Combobox($type, \"comboTypes\", $this->Typepunition->getKey(), $this->Typepunition->getLibelle());\r\n $comboTypes->first = \" \";\r\n $view->Assign(\"comboTypes\", $comboTypes->view());\r\n $view->Assign(\"comboClasses\", $this->comboClasses->view());\r\n\r\n $personnels = $this->Personnel->selectAll();\r\n $comboPersonnels = new Combobox($personnels, \"comboPersonnels\", $this->Personnel->getKey(), $this->Personnel->getLibelle());\r\n $comboPersonnels->first = \" \";\r\n $view->Assign(\"comboPersonnels\", $comboPersonnels->view());\r\n\r\n $content = $view->Render(\"punition\" . DS . \"saisie\", false);\r\n $this->Assign(\"content\", $content);\r\n //$this->Assign(\"content\", (new View())->output());\r\n }", "function advlicence ($nom,$prenom=\"\")\n\t{\n\t\tglobal $gCms;\n\t\t$ping = cms_utils::get_module('Ping'); \n\t\t//echo \"le nom est : \".$nom;\n\t\t//echo \"<br /> le prénom est : \".$prenom;\n\t\t$nom_final = str_replace(' ','%20',$nom);\n\t\t$db = cmsms()->GetDb();\n\t\t$now = trim($db->DBTimeStamp(time()), \"'\");\n\t\t$saison = $ping->GetPreference('saison_en_cours');\n\t\t$page = \"xml_liste_joueur\";\n\t\t$var =\"nom=\".$nom_final.\"&prenom=\".$prenom;\n\t\t$lignes = 0;\n\t\t\n\t\t//\t$var.=\"&action=poule\";\n\n\t\t\n\t\t$service = new Servicen();\n\t\t$lien = $service->GetLink($page, $var);\n\t\t//echo \"<br />\".$lien.\"<br />\";\n\t\t$xml = simplexml_load_string($lien, 'SimpleXMLElement', LIBXML_NOCDATA);\n\t\t//var_dump($xml);\n\t\tif($xml === FALSE)\n\t\t{\n\t\t\t//le service est coupé\n\t\t\t$array = 0;\n\t\t\t$lignes = 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$array = json_decode(json_encode((array)$xml), TRUE);\n\t\t\t$lignes = count($array['joueur']);\n\t\t}\n\t\t//echo \"le nb de lignes est : \".$lignes;\n\t\t$i = 0;\n\t\t\n\t\tif($lignes == 1 )//&& $lignes <2)//un seul joueur\n\t\t{\n\t\t\tforeach($xml as $tab)\n\t\t\t{\n\t\t\t\t$licence = (isset($tab->licence)?\"$tab->licence\":\"\");\n\t\t\t\t//echo \"la licence est : <br />\".$licence;\n\t\t\t\t$nom = (isset($tab->nom)?\"$tab->nom\":\"\");\n\t\t\t\t$prenom = (isset($tab->prenom)?\"$tab->prenom\":\"\");\n\t\t\t\t$club = (isset($tab->club)?\"$tab->club\":\"\");\n\t\t\t\t$nclub = (isset($tab->classement)?\"$tab->classement\":\"\");\n\t\t\t\t$clast = (isset($tab->clast)?\"$tab->clast\":\"\");\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t\treturn $licence;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\t\t\t\n\t}", "function updatepanier($user, $product, $quantite, $poids){ \t\t// Fonction pour update la quantite d'un produit au panier\n\n\t\tinclude(\"../../modele/modele.php\");\n\n\t\t$sql = 'UPDATE `detailcommande` SET `quantite`='.$quantite.', `poids`='.$poids.' WHERE id_user='.$user.' AND id_product='.$product.' AND actif = 1'; \n\t\t$reponse = $bdd->prepare($sql);\n\t\t$reponse ->execute();\n\t}", "public function ajoutProduit()\n {\n $produit = new Produit();\n\n $produit->uuid = Str::uuid();\n $produit->designation = 'Tomate';\n $produit->description = 'Lorem ipsum dolor sit amet consectetur adipisicing elit. Eaque deleniti quisquam beatae deserunt dicta ipsam tenetur at necessitatibus in, eligendi voluptatibus doloribus earum sed error maiores nam possimus sunt assumenda?';\n $produit->prix = '1000';\n $produit->like = '21';\n $produit->pays_source = 'Burkina Faso';\n $produit->poids = '45.10';\n\n $produit->save();\n }", "public function envoiCourrielRappel() {\n\t\t\n\t\t$this->log->debug(\"Usager::envoiCourrielRappel() Début\");\n\t\t\n\t\t$succes = 0;\n\t\t\n\t\t// Préparer le code de rappel pour l'utilisateur\n\t\t$this->set(\"code_rappel\", Securite::genererChaineAleatoire(16));\n\t\t$this->enregistrer();\n\t\t\n\t\t// Préparer le courriel\n\t\t$gabaritCourriel = REPERTOIRE_GABARITS_COURRIELS . \"identification-rappel.php\";\n\t\t\n\t\t// Vérifier si le fichier existe, sinon erreur\n\t\tif (!file_exists($gabaritCourriel)) {\n\t\t\t$this->log->erreur(\"Le gabarit du courriel '$gabaritCourriel' ne peut être localisé.\");\n\t\t}\n\t\t\n\t\t// Obtenir le contenu\n\t\t$contenu = Fichiers::getContenuElement($gabaritCourriel , $this);\n\t\t\n\t\t// Envoi du courriel\n\t\t$courriel = new Courriel($this->log);\n\t\t$succes = $courriel->envoiCourriel($this->get(\"courriel\"), TXT_COURRIEL_RAPPEL_OBJET, $contenu);\n\t\t\t\t \n\t\t$this->log->debug(\"Usager::envoiCourrielRappel() Début\");\n\t\t\n\t\treturn $succes;\n\t}", "public function TresorieCommerciaux() {\n \n $em = $this->getDoctrine()->getManager();\n $entityCommercial=$em->getRepository('RuffeCardUserGestionBundle:User')->findClientNoPaiment(1);\n return $this->render ( \"RuffeCardTresorieBundle:Default:commerciauxPaiement.html.twig\", array ('Commercial'=>$entityCommercial));\n \n }", "function informationsMonCompte() {\n $this->vue = new V_Vue(\"../vues/templates/template.inc.php\");\n $this->vue->ecrireDonnee(\"titreVue\",\"Margo : Mon Compte\");\n $this->vue->ecrireDonnee('centre',\"../vues/includes/gestionDeCompte/centreMonCompte.inc.php\");\n \n $this->vue->ecrireDonnee(\"titreSection\",\"Mon Compte: Informations\");\n // Centre : formulaire de connexion\n $this->vue->ecrireDonnee('loginAuthentification',MaSession::get('login')); \n \n // ... depuis la BDD \n $daoPers = new M_DaoPersonne();\n $daoPers->connecter();\n $perso = $daoPers->getOneByLogin(MaSession::get('login'));\n \n $this->vue->ecrireDonnee(\"infoPerso\",$perso);\n \n $this->vue->afficher();\n }", "function afficherProduits(){\n\t\t$sql=\"SElECT * From paniers \";\n\t\t$db = config::getConnexion();\n\t\ttry{\n\t\t$liste=$db->query($sql);\n\t\treturn $liste;\n\t\t}\n catch (Exception $e){\n die('Erreur: '.$e->getMessage());\n }\t\n\t\n }", "function apropos(){\n\t\t\t$this->data->content=\"aProposView.php\";\n\t\t\t$this->prepView();\n\t\t\t// Selectionne et charge la vue\n\t\t\trequire_once(\"view/mainView.php\");\n\t\t}", "function voirDerniereCommandeAvecFacture(){\n\t$conditions = array();\n\t$order = array();\n\tarray_push($order, array('nameChamps'=>'idFacture','sens'=>'desc'));\n\tarray_push($conditions, array('nameChamps'=>'idFacture','type'=>'is not null','name'=>'','value'=>''));\n\t$req = new myQueryClass('commande',$conditions,$order,'','limit 1');\n\t$r = $req->myQuerySelect();\n\treturn $r[0];\n}", "function affiche_relais_demande () {\n\t\tglobal $bdd;\n\t\t\n\t\t$req = $bdd->query(\"SELECT * FROM relais_mail JOIN utilisateur ON relais_mail.utilisateur_id_utilisateur = utilisateur.id_utilisateur WHERE status_relais = '2'\");\n\t\treturn $req;\n\t\t\n\t\t$req->closeCursor();\n\t}", "function nbProduit(){\n\t$nombre = 0; \n\t\n\tif(isset($_SESSION['panier']['quantite'])){\n\t\tfor($i=0; $i < count($_SESSION['panier']['quantite']); $i++){\n\t\t// On tourne autant de fois qu'il y a de références dans le panier (nombre de ligne dans le petit tableau des quantités)\n\t\t\t$nombre += $_SESSION['panier']['quantite'][$i];\n\t\t}\n\t}\n\t\n\treturn $nombre;\n}", "public function getNom_produit()\n {\n return $this->nom_produit;\n }", "function listarCotizacionProcesoCompra(){\n\t\t$this->procedimiento='adq.f_cotizacion_sel';\n\t\t$this->transaccion='ADQ_COTPROC_SEL';\n\t\t$this->tipo_procedimiento='SEL';//tipo de transaccion\n\t\t$this->setCount(false);\n\t\t\n\t\t$this->setParametro('id_proceso_compra','id_proceso_compra','int4');\n\t\t//Definicion de la lista del resultado del query\n\t\t$this->captura('id_cotizacion','int4');\t \n\t\t\n\t\t//Ejecuta la instruccion\n\t\t$this->armarConsulta();\n\t\t$this->ejecutarConsulta();\n\t\t//Devuelve la respuesta\n\t\treturn $this->respuesta;\n\t}", "function addpanier($user, $product, $quantite, $poids){\t// Fonction pour ajouter un produit au panier\n\n\t\tinclude(\"../../modele/modele.php\"); // Inclue la base de donnée + connexion.\n\t\t\n\t\t$actif = '1' ;\n\t\t$sql = 'INSERT INTO detailcommande(id_product, id_user, quantite, poids, actif) VALUES (:id_product , :id_user , :quantite , :poids, :actif) '; // Ajout d'une ligne dans la table detailCommande \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t // suivant les informations entrer dans la fonction panier.\n\t\t$reponse = $bdd->prepare($sql);\t\t\t// Preparation de la requete SQL.\n\t\t$reponse -> bindParam(':id_product', $product);\n\t\t$reponse -> bindParam(':id_user', $user);\n\t\t$reponse -> bindParam(':quantite', $quantite);\n\t\t$reponse -> bindParam(':poids', $poids);\n\t\t$reponse -> bindParam(':actif', $actif );\n\t\t$reponse ->execute();\t\t\t\t\t// Execution de la requete SQL.\n\n\t\t$sql3 = 'SELECT * FROM detailcommande WHERE id_product = \"'.$product.'\" AND id_user = \"'.$user.'\" AND quantite = \"'.$quantite.'\" AND poids=\"'.$poids.'\" AND actif = 1 ';\n\t\t$reponse3 = $bdd->query($sql3);\n\t\twhile ($donnees = $reponse3 -> fetch())\t\t// Mise en forme de tableau.\n\t\t\t{\n\t\t\t\t$actif = '1' ;\n\t\t\t\t$id_detailCommande = $donnees['id'];\n\t\t\t\t$sql2 = 'INSERT INTO commande(id_user, id_detailCommande, date, actif) VALUES (:id_user, :id_detailCommande, CURDATE(), :actif)'; \t// Ajout d'une ligne dans la table commande\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// suivant les informations d'entrées\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Ajout date ???\n\t\t\t\t$reponse2 = $bdd->prepare($sql2);\n\t\t\t\t$reponse2 -> bindParam(':id_user', $user);\n\t\t\t\t$reponse2 -> bindParam(':id_detailCommande', $id_detailCommande);\n\t\t\t\t$reponse2 -> bindParam(':actif', $actif );\n\t\t\t\t$reponse2 ->execute();\n\t\t\t}\n\t}", "public function buy()\n\t{\n\t\t$data['aktif']\t= 'prospektus';\n\t\t$this->template->load('template','prospektus/V_buy', $data);\n\t}", "public function rechercherUn() {\n\n // query to read single record\n $query = \"SELECT * FROM \" . $this->sNomTable . \"\n LEFT JOIN panier ON idPanier = iNoPanier\n LEFT JOIN produit ON idProduit = iNoProduit\n WHERE iNoPanier = :iNoPanier\";\n\n // prepare query statement\n $stmt = $this->oConnexion->prepare($query);\n\n // bind id of product to be updated\n $stmt->bindParam(\":iNoPanier\", $this->iNoPanier);\n\n // execute query\n $stmt->execute();\n\n // get retrieved row\n $row = $stmt->fetch(PDO::FETCH_ASSOC);\n\n // set values to object properties\n $this->idContenuPanier = $row['idContenuPanier'];\n $this->iQteProduit = $row['iQteProduit'];\n\n // Produit\n $this->iNoProduit = $row['iNoProduit'];\n $this->sSKUProduit = $row['sSKUProduit'];\n $this->sNomProduit = $row['sNomProduit'];\n $this->sMarque = $row['sMarque'];\n $this->fPrixProduit = $row['fPrixProduit'];\n $this->fPrixSolde = $row['fPrixSolde'];\n $this->sDescCourteProduit = $row['sDescCourteProduit'];\n $this->sDescLongProduit = $row['sDescLongProduit'];\n $this->sCouleur = $row['sCouleur'];\n $this->sCapacite = $row['sCapacite'];\n $this->sDateAjout = $row['sDateAjout'];\n $this->bAfficheProduit = $row['bAfficheProduit'];\n $this->iNoCategorie = $row['iNoCategorie'];\n $this->sNomCategorie = $row['sNomCategorie'];\n $this->sUrlCategorie = $row['sUrlCategorie'];\n\n // Panier\n $this->iNoPanier = $row['iNoPanier'];\n $this->sNumPanier = $row['sNumPanier'];\n $this->sDateModification = $row['sDateModification'];\n }", "public function AddStockProduitsEntreprise()\n\t{\n\t\t$produits_entreprise = Entreprise::where(['id' => 1])->first()->liste_produits;\n\t\tforeach ($produits_entreprise as $i => $produit)\n\t\t{\n\t\t\t$produits_entreprise[$i]['stocks'] = [\n\t\t\t\t0 => [\n\t\t\t\t\t\"id\" => 0,\n\t\t\t\t\t\"model\" => \"Piece\",\n\t\t\t\t\t\"couleur\" => [\n\t\t\t\t\t\t'nom' => \"Aucune\",\n\t\t\t\t\t\t'code_hexa' => \"\"\n\t\t\t\t\t],\n\t\t\t\t\t\"prix\" => 5,\n\t\t\t\t\t\"activer\" => true,\n\t\t\t\t\t\"longueur\" => 1,\n\t\t\t\t\t\"largeur\" => 2,\n\t\t\t\t\t\"hauteur\" => 3,\n\t\t\t\t\t\"volume\" => 6,\n\t\t\t\t\t\"poids\" => 5,\n\t\t\t\t\t\"stock\" => 20,\n\t\t\t\t\t\"afficher\" => true\n\t\t\t\t]\n\t\t\t];\n\t\t}\n\t\tEntreprise::where(['id' => 1])->update(['liste_produits' => json_encode($produits_entreprise)]);\n\t}", "public function show(ProduitEntrer $produitEntrer)\n {\n //\n }", "public function getIdFamilleproduit()\n {\n return $this->Id_familleproduit;\n }", "public function data_pros()\n {\n $data = [ 'aktif' => 'pros',\n 'prospektus' => $this->M_prospektus->get_data_prospektus()\n ];\n\n $this->template->load('template', 'prospektus/V_data_pros', $data);\n }", "function imprimir_voucher_estacionamiento($numero,$chofer,$patente,$horainicio,$horatermino,$montototal,$comentario,$correlativopapel,$cliente,$fecha_termino,$fecha_inicio_2){\ntry {\n // Enter the share name for your USB printer here\n //$connector = null; \n //$connector = new WindowsPrintConnector(\"EPSON TM-T81 Receipt\");\n $connector = new WindowsPrintConnector(\"EPSON TM-T20 Receipt\");\n // $connector = new WindowsPrintConnector(\"doPDF 8\");\n /* Print a \"Hello world\" receipt\" */\n $printer = new Printer($connector);\n\n \n $date=new DateTime();\n $fecha = $date->format('d-m-Y');\n\n\n $Chofer = $chofer;\n $Patente = $patente;\n $serie = $numero;\n $img = EscposImage::load(\"logo1.png\");\n $printer -> graphics($img);\n \n \n $printer -> text(\"Numero : $serie\\n\");\n $printer -> text(\"Chofer : $Chofer\\n\");\n $printer -> text(\"Patente: $Patente\\n\");\n\n if ($cliente != 0) {\n include_once(\"conexion.php\");\n $con = new DB;\n $buscarpersona = $con->conectar();\n $strConsulta = \"select * from cliente where rut_cliente ='$cliente'\";\n $buscarpersona = mysql_query($strConsulta);\n $numfilas = mysql_num_rows($buscarpersona);\n $row = mysql_fetch_assoc($buscarpersona);\n $nombre_cliente = $row['nombre_cliente'];\n //var_dump($numfilas);\n if($numfilas >= 1){\n $printer -> text(\"Cliente: $nombre_cliente\\n\");\n }\n \n }\n \n if ($correlativopapel != 0) {\n $printer -> text(\"\\nCorrelativo : $correlativopapel\\n\");\n }\n $printer -> text(\"Fecha Inicio : $fecha_inicio_2\\n\");\n $printer -> text(\"Hora de inicio : $horainicio\\n\");\n\n\n\n if ($horatermino != 0) {\n $printer -> text(\"Fecha de Termino: $fecha_termino\\n\");\n $printer -> text(\"Hora de Termino : $horatermino\\n\"); \n }\n \n \n if ($montototal != 0) {\n $printer -> text('Monto total : $'.$montototal);\n }\n \n if ($horatermino != 0) {\n $printer -> text(\"\\n\");\n $printer -> text(\"\\n\\n\");\n $printer -> text(\"Firma: _________________\\n\");\n \n }\n $printer -> text(\"$comentario\\n\");\n $printer -> cut();\n /* Close printer */\n $printer -> close();\n\n echo \"<div class='alert alert-success'><strong>Impresion Correcta $comentario</strong></div>\";\n} catch (Exception $e) {\n echo \"No se pudo imprimir \" . $e -> getMessage() . \"\\n\";\n}\n}", "public function productcompareaddAction() {\n // neu chua khoi tao\n // neu roi add them 1 phan tu vao sesion voi id va uenc da duoc tao\n $this->layout('layout/bags');\n $getuser = $this->forward()->dispatch('Admin\\Controller\\Index', array(\n 'action' => 'getuser'\n ));\n // var_dump($getuser);\n $this->layout()->getuser = $getuser;\n\n $id = $this->params()->fromRoute('id');\n $uenc = $this->params()->fromRoute('uenc');\n\n echo \"id :\";\n var_dump($id);\n echo \"</br>\";\n echo \"uenc :\";\n var_dump($uenc);\n }", "public function getCodeProduit() {\n return $this->codeProduit;\n }", "function AfficherEntreprise($entreprise)\n {\n require(\"db/connect.php\");\n $requete=$BDD->prepare(\"SELECT * FROM entreprise WHERE entreprise_id = ?\");\n $requete->execute(array($entreprise));\n //on vérifie que l'entreprise existe\n if($requete->rowcount()==0) {\n print (\"Cette entreprise n'existe pas\");\n }\n else {\n //on obtient la ligne entière de la BDD décrivant l'entreprise, stockée dans $entreprise\n $entreprise=$requete->fetch();\n print '<a href=\"entreprises.php\"><img class=\"imageTailleLogo\" alt=\"retour\" src=\"images/fleche.png\"/> </a>'\n . '<h1>'.$entreprise['entreprise_nom'].'</h1></br>';\n //logo + site internet\n print '<div class=\"row centreOffre fondFonce bordureTresDouce\" >\n <div class=\"col-xs-3 col-sm-3 col-md-4 col-lg-4 fondFonce\" \n style=\"height:240px;\"></br>\n <img class=\"imageEntreprise\" alt=\"LogoEntreprise\" src=\"logos/'.$entreprise['entreprise_logo'].'\"/></a>\n </div>\n <div class=\"col-xs-9 col-sm-9 col-md-8 col-lg-8 centreVertical fondFonce\" \n style=\"height:240px;\"> \n Site Internet <a href=\"'.$entreprise['entreprise_siteInternet'].'\">'.\n $entreprise['entreprise_siteInternet'].'</a>\n </div><br/></div>';\n //description longue\n print '<div class=\"row centreOffre bordureTresDouce\" ><h2>Description de l\\'entreprise </h2>';\n print '<div class=\"fondFonce\"></br>'.$entreprise['entreprise_descrLong'].'<br/></br></div>';\n \n //sites\n print '<h2>Adresse(s)</h2>';\n //on récupère les informations des adresses liées à l'entreprise si elle existe \n $requete=$BDD->prepare('SELECT adresse_id FROM liaison_entrepriseadresse WHERE entreprise_id =?;');\n $requete->execute(array($entreprise [\"entreprise_id\"]));\n if ($requete->rowcount()!=0)\n {\n //on stocke les résultats de la requete dans un tableau, une ligne par adresse liée a l'entreprise\n $tableauAdresse=$requete->fetchAll();\n //le booléen permet d'alterner les couleurs\n $bool=true;\n foreach($tableauAdresse as $liaison)\n {\n $bool=!$bool;\n if ($bool) print '<div class=\"col-xs-3 col-sm-3 col-md-4 col-lg-4 fondClair\" \n style=\"height:120px;\">';\n if (!$bool) print '<div class=\"col-xs-3 col-sm-3 col-md-4 col-lg-4 fondFonce\" \n style=\"height:120px;\">';\n $adresse_id=$liaison['adresse_id'];\n AfficherAdresse($adresse_id);\n print '</div>';\n } \n }\n else print '<i>Pas d\\'adresse renseignée.</i>';\n print '</div>'; \n \n //contacts\n print '<div class=\"row centreOffre\" style=\"border:1px solid #ddd;\">';\n print '<h2>Contact(s)</h2>';\n $requete=$BDD->prepare(\"SELECT * FROM contact WHERE contact.entreprise_id =?;\");\n $requete-> execute(array($entreprise['entreprise_id']));\n if ($requete->rowcount()!=0)\n {\n //on stocke les résultats de la requete dans un tableau, une ligne par contact lié a l'entreprise\n $tableauContact=$requete->fetchAll();\n $bool=true;\n foreach($tableauContact as $contact)\n {\n $bool=!$bool;\n if ($bool) print '<div class=\"col-xs-3 col-sm-3 col-md-4 col-lg-4 fondClair\" \n style=\"height:150px;\">';\n if (!$bool) print '<div class=\"col-xs-3 col-sm-3 col-md-4 col-lg-4 fondFonce\" \n style=\"height:150px;\">';\n AfficherContact($contact);\n } \n }\n else print\"<i>Pas de contact renseigné.</i>\";\n print '</div>';\n //offres proposées\n print '<div class=\"row centreOffre\" style=\"border:1px solid #ddd;\">';\n print '<h2>Offre(s) proposée(s)</h2>';\n //l'utilisateur normal ne peut voir les offres de moins d'une semaine\n if ($_SESSION['statut']==\"normal\")\n {\n $requete=$BDD->prepare(\"SELECT * FROM offre WHERE offre.entreprise_id =? AND offre_valide=1 AND offre_signalee=0 AND offre_datePoste<DATE_ADD(NOW(),INTERVAL -1 WEEK) ;\");\n }\n else {$requete=$BDD->prepare(\"SELECT * FROM offre WHERE offre.entreprise_id =? AND offre_valide=1 AND offre_signalee=0 ;\");}\n $requete-> execute(array($entreprise['entreprise_id']));\n $bool=true;\n if ($requete->rowcount()!=0)\n {\n //on stocke les résultats de la requete dans un tableau, une ligne par offre liée a l'entreprise\n $tableauOffre=$requete->fetchAll();\n foreach($tableauOffre as $offre)\n {\n $bool=!$bool;\n AfficherOffre($offre,$bool);\n } \n }\n else print \"<i>Pas d'offre proposée en ce moment.</i>\";\n print '</div>';\n }\n }", "function stocks_affiche_milieu($flux) {\n\t$texte = \"\";\n\tif ($flux['args']['exec'] == 'produit') {\n\t\t$flux['data'] .= recuperer_fond(\n\t\t\t'prive/squelettes/inclure/gerer_stock',\n\t\t\t$flux['args'] // On passe le contexte au squelette\n\t\t);\n\t}\n\tif($texte){\n\t\tif ($p = strpos($flux['data'], \"<!--affiche_milieu-->\")) {\n\t\t\t$flux['data'] = substr_replace($flux['data'], $texte, $p, 0);\n\t\t} else {\n\t\t\t$flux['data'] .= $texte;\n\t\t}\n\t}\n\treturn $flux;\n}", "public static function stockAttribu() {\n $results = ModelStockAttribu::getAllIdcentre();\n $results1= ModelStockAttribu::getAllIdvaccin();\n // ----- Construction chemin de la vue\n include 'config.php';\n $vue = $root . '/app/view/stock/viewAttribution.php';\n require ($vue);\n }", "public function RicercaPerIngredienti(){\n $pm = FPersistentManager::getInstance();\n $cibi = $pm->loadAllObjects();\n $view = new VRicerca();\n $view->mostraIngredienti($cibi);\n }", "public function commandeSpecialFormTraitement(){\n\n // Récupération des informations du formulaire de contact\n $nom = $this->verifierSaisie(\"nom\");\n $prenom = $this->verifierSaisie(\"prenom\");\n $email = $this->verifierSaisie(\"email\");\n $sujet = $this->verifierSaisie(\"sujet\");\n $message = $this->verifierSaisie(\"message\");\n\n // Sécurité\n if ( $this->verifierEmail($email)\n && ($nom != \"\")\n && ($prenom != \"\")\n && ($sujet != \"\")\n && ($message != \"\") ){\n\n \n // message pour l'utilisateur\n // $GLOBALS[\"contactRetour\"] = \"<p class='bg-success'>Merci $prenom, votre message est bien envoyé !</p>\";\n $GLOBALS[\"commandeSpecialRetour\"] = \"<span class='glyphicon glyphicon-ok' aria-hidden='true'></span> Merci $prenom, votre message a bien été envoyé !\";\n }\n\n else{\n // $GLOBALS[\"contactRetour\"] = \"Il manque des informations\";\n $GLOBALS[\"commandeSpecialRetour\"] = \"<span class='glyphicon glyphicon-alert' aria-hidden='true'></span> Il manque des informations !\";\n }\n\n }", "public function modifierBouteilleCatalogue($data){\n\t\t$requete =\"UPDATE vino__bouteille\n\t\tSET fk__vino__type_id = $data->type\" ;\n\n\t\t//Initialise un tableau pour inserer des erreurs\n\t\t$erreur = array();\n\n\t\t//Verification du nom\n\t\tif($data->nom == \"\" ){\n\t\t\t$erreur[\"nom\"] = true;\n\t\t}else{\n\t\t\t//Permet de construire la requete\n\t\t\t$requete .= \", nom = '\" .utf8_encode($data->nom) .\"'\";\n\t\t}\n\n\t\t//Verification du code de la SAQ ne doit pas etre vide contenir que des chiffres\n\t\t$regExp = \"/^\\d+$/i\";\n\t\tif($data->code_saq == \"\" || !preg_match($regExp, $data->code_saq)){\n\t\t\t$erreur[\"code_saq\"] = true;\n\t\t}else{\n\t\t\t//Permet de construire la requete\n\t\t\t$requete .= \", code_saq = '\" . $data->code_saq .\"'\";\n\t\t}\n\t\t\n\n\t\t//Verification bon format de pays\n\t\t$regExp = \"/^[ÉÈÀéèàa-zA-Z-]+$/i\";\n\t\tif($data->pays == \"\" || !preg_match($regExp, $data->pays)){\n\t\t\t$erreur[\"pays\"] = true;\n\t\t}else{\n\t\t\t$requete .= \", pays = '\" . utf8_encode($data->pays) .\"'\";\n\t\t}\n\n\t\t//Verification prix\n\t\t$regExp = \"/^[1-9]\\d*(\\.\\d{1,2})?$/i\";\n\t\tif($data->prix !== \"\"){\n\t\t\t//Permet de construire la requete\n\t\t\t$requete .= \", prix_saq = \" . $data->prix ;\n\t\t\tif(!preg_match($regExp, $data->prix)){\n\t\t\t\t$erreur[\"prix\"] = true;\n\t\t\t}\n\t\t}\n\n\t\t\n\t\t//Verification du code de la SAQ ne doit pas etre vide contenir que des chiffres\n\t\tif($data->format == \"\" ){\n\t\t\t$erreur[\"format\"] = true;\n\t\t}else{\n\t\t\t//Permet de construire la requete\n\t\t\t$requete .= \", format = '\" . utf8_encode($data->format) .\"'\";\n\t\t}\n\n\n\t\t//Verification du millesime\n\t\tif($data->description !== \"\"){\n\t\t\t//Permet de construire la requete\n\t\t\t$requete .= \", description = '\".utf8_encode($data->description) . \"'\";\n\t\t}\n\n\t\t//Permet de construire la requete\n\t\t$requete .= \" WHERE id = \" . $data->id;\n\n\t\t//Verifie si il y a des erreurs\n\t\tif(count($erreur) == 0){\n\t\t\t$res = $this->_db->query($requete);\n\t\t}else{\n\t\t\t//Si contient erreur envoie quelle sont les erreurs\n\t\t\t$res = $erreur;\n\n\t\t}\n \n\t\treturn $res;\n\t}", "public function partirAuTravail(): void\n\t{\n\t}", "function Geral() {\r\n \r\n extract($GLOBALS);\r\n global $w_Disabled;\r\n $w_chave = $_REQUEST['w_chave'];\r\n $w_sq_tipo_lancamento = $_REQUEST['w_sq_tipo_lancamento'];\r\n $w_readonly = '';\r\n $w_erro = '';\r\n\r\n // Carrega o segmento cliente\r\n $sql = new db_getCustomerData; $RS = $sql->getInstanceOf($dbms,$w_cliente); \r\n $w_segmento = f($RS,'segmento');\r\n \r\n // Verifica se há necessidade de recarregar os dados da tela a partir\r\n // da própria tela (se for recarga da tela) ou do banco de dados (se não for inclusão)\r\n if ($w_troca>'' && $O!='E') {\r\n // Se for recarga da página\r\n $w_codigo_interno = $_REQUEST['w_codigo_interno'];\r\n $w_sq_tipo_lancamento = $_REQUEST['w_sq_tipo_lancamento'];\r\n $w_sq_tipo_documento = $_REQUEST['w_sq_tipo_documento'];\r\n $w_descricao = $_REQUEST['w_descricao'];\r\n $w_valor = $_REQUEST['w_valor'];\r\n $w_fim = $_REQUEST['w_fim'];\r\n $w_conta_debito = $_REQUEST['w_conta_debito'];\r\n $w_sq_forma_pagamento = $_REQUEST['w_sq_forma_pagamento'];\r\n $w_cc_debito = $_REQUEST['w_cc_debito'];\r\n $w_cc_credito = $_REQUEST['w_cc_credito'];\r\n\r\n } elseif(strpos('AEV',$O)!==false || $w_copia>'') {\r\n // Recupera os dados do lançamento\r\n $sql = new db_getSolicData; \r\n $RS = $sql->getInstanceOf($dbms,nvl($w_copia,$w_chave),$SG);\r\n if (count($RS)>0) {\r\n $w_codigo_interno = f($RS,'codigo_interno');\r\n $w_sq_tipo_lancamento = f($RS,'sq_tipo_lancamento');\r\n $w_conta_debito = f($RS,'sq_pessoa_conta');\r\n $w_descricao = f($RS,'descricao');\r\n $w_fim = formataDataEdicao(f($RS,'fim'));\r\n $w_valor = formatNumber(f($RS,'valor'));\r\n $w_sq_forma_pagamento = f($RS,'sq_forma_pagamento');\r\n $w_cc_debito = f($RS,'cc_debito');\r\n $w_cc_credito = f($RS,'cc_credito');\r\n }\r\n }\r\n\r\n // Recupera dados do comprovante\r\n if (nvl($w_troca,'')=='' && (nvl($w_copia,'')!='' || nvl($w_chave,'')!='')) {\r\n $sql = new db_getLancamentoDoc; $RS = $sql->getInstanceOf($dbms,nvl($w_copia,$w_chave),null,null,null,null,null,null,'DOCS');\r\n $RS = SortArray($RS,'sq_tipo_documento','asc');\r\n foreach ($RS as $row) {$RS=$row; break;}\r\n if (nvl($w_copia,'')=='') $w_chave_doc = f($RS,'sq_lancamento_doc'); // Se cópia, não copia a chave do documento \r\n $w_sq_tipo_documento = f($RS,'sq_tipo_documento');\r\n $w_numero = f($RS,'numero');\r\n $w_data = FormataDataEdicao(f($RS,'data'));\r\n $w_serie = f($RS,'serie');\r\n $w_valor_doc = formatNumber(f($RS,'valor'));\r\n $w_patrimonio = f($RS,'patrimonio');\r\n $w_tributo = f($RS,'calcula_tributo');\r\n $w_retencao = f($RS,'calcula_retencao'); \r\n }\r\n\r\n // Default: pagamento para pessoa jurídica\r\n $w_tipo_pessoa = nvl($w_tipo_pessoa,2);\r\n \r\n // Recupera o trâmite de conclusão\r\n $sql = new db_getTramiteList; $RS = $sql->getInstanceOf($dbms, $w_menu,null,null,null);\r\n $RS = SortArray($RS,'ordem','asc');\r\n foreach ($RS as $row) {\r\n if (f($row,'sigla')=='AT') {\r\n $w_tramite_conc = f($row,'sq_siw_tramite');\r\n break;\r\n }\r\n }\r\n \r\n // Verifica as formas de pagamento possíveis. Se apenas uma, atribui direto\r\n $sql = new db_getFormaPagamento; $RS = $sql->getInstanceOf($dbms, $w_cliente, null, $SG, null,'S',null);\r\n $w_exibe_fp = true;\r\n if (count($RS)==1 || nvl($w_sq_forma_pagamento,'')!='') {\r\n foreach($RS as $row) { \r\n if (nvl($w_sq_forma_pagamento,f($row,'sq_forma_pagamento'))==f($row,'sq_forma_pagamento')) {\r\n $w_sq_forma_pagamento = f($row,'sq_forma_pagamento'); \r\n $w_forma_pagamento = f($row,'sigla'); \r\n $w_nm_forma_pagamento = f($row,'nome'); \r\n break; \r\n }\r\n }\r\n if (count($RS)==1) $w_exibe_fp = false;\r\n }\r\n \r\n // Verifica os tipos de documento possíveis. Se apenas um, atribui direto\r\n $sql = new db_getTipoDocumento; $RS = $sql->getInstanceOf($dbms,null,$w_cliente,$w_menu,null);\r\n $w_exibe_dc = true;\r\n if (count($RS)==1) {\r\n foreach($RS as $row) { \r\n $w_sq_tipo_documento = f($row,'chave'); \r\n $w_tipo_documento = f($row,'sigla'); \r\n $w_nm_tipo_documento = f($row,'nome'); \r\n break; \r\n }\r\n $w_exibe_dc = false;\r\n }\r\n\r\n // Se o tipo de lançamento já foi informado, recupera o código externo para definir a conta contábil de débito\r\n if ($w_sq_tipo_lancamento) {\r\n $sql = new db_getTipoLancamento; $RS = $sql->getInstanceOf($dbms,$w_sq_tipo_lancamento,null,$w_cliente,null);\r\n $w_cc_debito = f($RS[0],'codigo_externo');\r\n }\r\n \r\n // Retorna as contas contábeis do lançamento\r\n retornaContasContabeis($RS_Menu, $w_cliente, $w_sq_tipo_lancamento, $w_sq_forma_pagamento, $w_conta_debito, $w_cc_debito, $w_cc_credito);\r\n \r\n Cabecalho();\r\n head();\r\n Estrutura_CSS($w_cliente);\r\n // Monta o código JavaScript necessário para validação de campos e preenchimento automático de máscara,\r\n // tratando as particularidades de cada serviço\r\n ScriptOpen('JavaScript');\r\n CheckBranco();\r\n FormataData();\r\n SaltaCampo();\r\n FormataDataHora();\r\n FormataValor();\r\n ShowHTML('function botoes() {');\r\n ShowHTML(' document.Form.Botao[0].disabled = true;');\r\n ShowHTML(' document.Form.Botao[1].disabled = true;');\r\n ShowHTML('}');\r\n ValidateOpen('Validacao');\r\n if ($O=='I' || $O=='A') {\r\n Validate('w_sq_tipo_lancamento','Tipo do lançamento','SELECT',1,1,18,'','0123456789');\r\n if ($w_exibe_fp) Validate('w_sq_forma_pagamento','Forma de pagamento','SELECT',1,1,18,'','0123456789');\r\n Validate('w_conta_debito','Conta bancária', 'SELECT', 1, 1, 18, '', '0123456789');\r\n if ($w_exibe_dc) Validate('w_sq_tipo_documento','Tipo de documento','SELECT',1,1,18,'','0123456789');\r\n Validate('w_fim','Data da operação', 'DATA', '1', '10', '10', '', '0123456789/');\r\n Validate('w_valor','Valor total do documento','VALOR','1',4,18,'','0123456789.,-');\r\n CompValor('w_valor','Valor total do documento','>','0,00','zero');\r\n Validate('w_descricao','Observação','1','',5,2000,'1','1');\r\n \r\n Validate('w_cc_debito','Conta Débito','','','2','25','ABCDEFGHIJKLMNOPQRSTUVWXYZ','0123456789');\r\n Validate('w_cc_credito','Conta Crédito','','','2','25','ABCDEFGHIJKLMNOPQRSTUVWXYZ','0123456789');\r\n \r\n ShowHTML(' if ((theForm.w_cc_debito.value != \"\" && theForm.w_cc_credito.value == \"\") || (theForm.w_cc_debito.value == \"\" && theForm.w_cc_credito.value != \"\")) {');\r\n ShowHTML(' alert (\"Informe ambas as contas contábeis ou nenhuma delas!\");');\r\n ShowHTML(' theForm.w_cc_debito.focus();');\r\n ShowHTML(' return false;');\r\n ShowHTML(' }');\r\n \r\n } \r\n Validate('w_assinatura',$_SESSION['LABEL_ALERTA'], '1', '1', '3', '30', '1', '1');\r\n ValidateClose();\r\n ScriptClose();\r\n ShowHTML('<BASE HREF=\"'.$conRootSIW.'\">');\r\n ShowHTML('</HEAD>');\r\n if ($w_troca>'') BodyOpen('onLoad=\\'document.Form.'.$w_troca.'.focus()\\';');\r\n elseif (!(strpos('EV',$O)===false)) BodyOpen('onLoad=\\'this.focus()\\';');\r\n else BodyOpen('onLoad=\\'document.Form.w_sq_tipo_lancamento.focus()\\';');\r\n Estrutura_Topo_Limpo();\r\n Estrutura_Menu();\r\n Estrutura_Corpo_Abre();\r\n Estrutura_Texto_Abre();\r\n ShowHTML('<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">');\r\n if ($w_chave>'') ShowHTML(' <tr><td><font size=\"2\"><b>'.$w_codigo_interno.' ('.$w_chave.')</b></td>');\r\n if (strpos('IAEV',$O)!==false) {\r\n if (strpos('EV',$O)!==false) {\r\n $w_Disabled=' DISABLED ';\r\n if ($O=='V') $w_Erro = Validacao($w_sq_solicitacao,$SG);\r\n } \r\n if (Nvl($w_pais,'')=='') {\r\n // Carrega os valores padrão para país, estado e cidade\r\n $sql = new db_getCustomerData; $RS = $sql->getInstanceOf($dbms,$w_cliente);\r\n $w_pais = f($RS,'sq_pais');\r\n $w_uf = f($RS,'co_uf');\r\n $w_cidade = Nvl(f($RS_Menu,'sq_cidade'),f($RS,'sq_cidade_padrao'));\r\n } \r\n AbreForm('Form',$w_dir.$w_pagina.'Grava','POST','return(Validacao(this));',null,$P1,$P2,$P3,$P4,$TP,$SG,$R,$O);\r\n ShowHTML(MontaFiltro('POST'));\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_troca\" value=\"\">');\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_copia\" value=\"'.$w_copia.'\">');\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_chave\" value=\"'.$w_chave.'\">');\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_codigo_interno\" value=\"'.$w_codigo_interno.'\">');\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_menu\" value=\"'.f($RS_Menu,'sq_menu').'\">');\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_data_hora\" value=\"'.f($RS_Menu,'data_hora').'\">');\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_cidade\" value=\"'.$w_cidade.'\">');\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_tramite\" value=\"'.$w_tramite_conc.'\">');\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_tipo\" value=\"'.$w_tipo.'\">');\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_chave_doc\" value=\"'.$w_chave_doc.'\">');\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_tipo_pessoa\" value=\"'.$w_tipo_pessoa.'\">');\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_aviso\" value=\"N\">');\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_dias\" value=\"0\">');\r\n ShowHTML('<tr bgcolor=\"'.$conTrBgColor.'\"><td>');\r\n ShowHTML(' <table width=\"100%\" border=\"0\">');\r\n ShowHTML(' <tr><td colspan=3 align=\"center\" height=\"2\" bgcolor=\"#000000\"></td></tr>');\r\n ShowHTML(' <tr><td colspan=3 align=\"center\" height=\"1\" bgcolor=\"#000000\"></td></tr>');\r\n ShowHTML(' <tr><td colspan=3 align=\"center\" bgcolor=\"#D0D0D0\"><b>Identificação</td></td></tr>');\r\n ShowHTML(' <tr><td colspan=3 align=\"center\" height=\"1\" bgcolor=\"#000000\"></td></tr>');\r\n ShowHTML(' <tr><td colspan=3>Os dados deste bloco serão utilizados para identificação do lançamento, bem como para o controle de sua execução.</td></tr>');\r\n ShowHTML(' <tr><td colspan=3 align=\"center\" height=\"1\" bgcolor=\"#000000\"></td></tr>');\r\n\r\n ShowHTML(' <tr valign=\"top\">');\r\n selecaoTipoLancamento('Tipo de lançamento:',null,null,$w_sq_tipo_lancamento,$w_menu,$w_cliente,'w_sq_tipo_lancamento',$SG, 'onChange=\"document.Form.action=\\''.$w_dir.$w_pagina.$par.'\\'; document.Form.O.value=\\''.$O.'\\'; document.Form.w_troca.value=\\''.(($w_exibe_fp) ? 'w_sq_forma_pagamento' : 'w_conta_debito').'\\'; document.Form.submit();\"',3);\r\n ShowHTML(' <tr valign=\"top\">');\r\n if ($w_exibe_fp) {\r\n SelecaoFormaPagamento('<u>F</u>orma de pagamento:','F','Selecione na lista a forma desejada para esta aplicação.',$w_sq_forma_pagamento,$SG,'w_sq_forma_pagamento',null,'onChange=\"document.Form.action=\\''.$w_dir.$w_pagina.$par.'\\'; document.Form.O.value=\\''.$O.'\\'; document.Form.w_troca.value=\\'w_conta_debito\\'; document.Form.submit();\"');\r\n } else {\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_sq_forma_pagamento\" value=\"'.$w_sq_forma_pagamento.'\">');\r\n }\r\n SelecaoContaBanco('<u>C</u>onta bancária:','C','Selecione a conta bancária envolvida no lançamento.',$w_conta_debito,null,'w_conta_debito',null,'onChange=\"document.Form.action=\\''.$w_dir.$w_pagina.$par.'\\'; document.Form.O.value=\\''.$O.'\\'; document.Form.w_troca.value=\\''.(($w_exibe_dc) ? 'w_sq_tipo_documento' : 'w_fim').'\\'; document.Form.submit();\"');\r\n ShowHTML(' </tr>');\r\n ShowHTML(' <tr valign=\"top\">');\r\n if ($w_exibe_dc) {\r\n SelecaoTipoDocumento('<u>T</u>ipo do documento:','T', 'Selecione o tipo de documento.', $w_sq_tipo_documento,$w_cliente,$w_menu,'w_sq_tipo_documento',null,null);\r\n } else {\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_sq_tipo_documento\" value=\"'.$w_sq_tipo_documento.'\">');\r\n }\r\n ShowHTML(' <td><b><u>D</u>ata da operação:</b><br><input '.$w_Disabled.' accesskey=\"D\" type=\"text\" name=\"w_fim\" class=\"sti\" SIZE=\"10\" MAXLENGTH=\"10\" VALUE=\"'.$w_fim.'\" onKeyDown=\"FormataData(this,event);\" onKeyUp=\"SaltaCampo(this.form.name,this,10,event);\">'.ExibeCalendario('Form','w_fim').'</td>');\r\n ShowHTML(' <td><b><u>V</u>alor:</b><br><input '.$w_Disabled.' accesskey=\"V\" type=\"text\" name=\"w_valor\" class=\"sti\" SIZE=\"18\" MAXLENGTH=\"18\" VALUE=\"'.$w_valor.'\" style=\"text-align:right;\" onKeyDown=\"FormataValor(this,18,2,event);\" title=\"Informe o valor total do documento.\"></td>');\r\n ShowHTML(' <tr><td colspan=3><b><u>O</u>bservação:</b><br><textarea '.$w_Disabled.' accesskey=\"O\" name=\"w_descricao\" class=\"sti\" ROWS=3 cols=75 title=\"Observação sobre a aplicação.\">'.$w_descricao.'</TEXTAREA></td>');\r\n\r\n ShowHTML(' <tr valign=\"top\">');\r\n ShowHTML(' <td><b><u>C</u>onta contábil de débito:</b></br><input type=\"text\" name=\"w_cc_debito\" class=\"sti\" SIZE=\"11\" MAXLENGTH=\"25\" VALUE=\"'.$w_cc_debito.'\"></td>');\r\n ShowHTML(' <td><b><u>C</u>onta contábil de crédito:</b></br><input type=\"text\" name=\"w_cc_credito\" class=\"sti\" SIZE=\"11\" MAXLENGTH=\"25\" VALUE=\"'.$w_cc_credito.'\"></td>');\r\n \r\n ShowHTML(' <tr><td align=\"LEFT\" colspan=4><b>'.$_SESSION['LABEL_CAMPO'].':<BR> <INPUT ACCESSKEY=\"A\" class=\"sti\" type=\"PASSWORD\" name=\"w_assinatura\" size=\"30\" maxlength=\"30\" value=\"\"></td></tr>');\r\n ShowHTML(' <tr><td align=\"center\" colspan=\"3\" height=\"1\" bgcolor=\"#000000\"></TD></TR>');\r\n ShowHTML(' <tr><td align=\"center\" colspan=\"3\">');\r\n ShowHTML(' <input class=\"stb\" type=\"submit\" name=\"Botao\" value=\"Gravar\">');\r\n if ($P1==0) {\r\n ShowHTML(' <input class=\"STB\" type=\"button\" onClick=\"location.href=\\''.montaURL_JS($w_dir,'tesouraria.php?par=inicial&O=L&P1='.$P1.'&P2='.$P2.'&P3='.$P3.'&P4='.$P4.'&TP='.$TP.'&SG='.MontaFiltro('GET')).'\\';\" name=\"Botao\" value=\"Abandonar\">');\r\n } else {\r\n $sql = new db_getMenuData; $RS = $sql->getInstanceOf($dbms,$w_menu);\r\n ShowHTML(' <input class=\"stb\" type=\"button\" onClick=\"location.href=\\''.montaURL_JS($w_dir,$R.'&w_copia='.$w_copia.'&O=L&SG='.f($RS,'sigla').'&P1='.$P1.'&P2='.$P2.'&P3='.$P3.'&P4='.$P4.'&TP='.$TP.MontaFiltro('GET')).'\\';\" name=\"Botao\" value=\"Cancelar\">');\r\n }\r\n ShowHTML(' </td>');\r\n \r\n ShowHTML(' </tr>');\r\n ShowHTML(' </table>');\r\n ShowHTML(' </TD>');\r\n ShowHTML('</tr>');\r\n ShowHTML('</FORM>');\r\n } else {\r\n ScriptOpen('JavaScript');\r\n ShowHTML(' alert(\"Opção não disponível\");');\r\n ScriptClose();\r\n } \r\n ShowHTML('</table>');\r\n ShowHTML('</center>');\r\n Estrutura_Texto_Fecha();\r\n Estrutura_Fecha();\r\n Estrutura_Fecha();\r\n Estrutura_Fecha();\r\n Rodape();\r\n}", "function afficher_produits_commande($id_resto) {\n global $connexion;\n try {\n $select = $connexion -> prepare(\"SELECT * \n FROM lunchr_commandes as lc, \n lunchr_ligne_commande as lcl, \n lunchr_produits as lp\n WHERE lc.lc_id = lcl.lc_id\n AND lp.lp_id = lcl.lp_id\n AND lc.lc_id = :id_resto\");\n $select -> execute(array(\"id_resto\" => $id_resto));\n $select -> setFetchMode(PDO::FETCH_ASSOC);\n $resultat = $select -> fetchAll();\n return $resultat;\n }\n \n catch (Exception $e) {\n print $e->getMessage();\n return false;\n }\n }", "function setColeccion() {\n $this->query = \"SELECT * FROM PROFESOR\";\n $this->datos = BDConexionSistema::getInstancia()->query($this->query);\n\n for ($x = 0; $x < $this->datos->num_rows; $x++) {\n $this->addElemento($this->datos->fetch_object(\"Profesor\"));\n }\n }", "function compte($alert) {\n\t\t$this -> profil($this -> vue -> afficheCompte($this -> modele -> getCompte($_SESSION['id']), $alert));\n\t}", "function modificarProcesoCompra(){\n\t\t$this->procedimiento='adq.f_proceso_compra_ime';\n\t\t$this->transaccion='ADQ_PROC_MOD';\n\t\t$this->tipo_procedimiento='IME';\n\t\t\t\t\n\t\t//Define los parametros para la funcion\n\t\t$this->setParametro('id_proceso_compra','id_proceso_compra','int4');\n\t\t$this->setParametro('id_depto','id_depto','int4');\n\t\t$this->setParametro('num_convocatoria','num_convocatoria','varchar');\n\t\t$this->setParametro('id_solicitud','id_solicitud','int4');\n\t\t$this->setParametro('id_estado_wf','id_estado_wf','int4');\n\t\t$this->setParametro('fecha_ini_proc','fecha_ini_proc','date');\n\t\t$this->setParametro('obs_proceso','obs_proceso','varchar');\n\t\t$this->setParametro('id_proceso_wf','id_proceso_wf','int4');\n\t\t$this->setParametro('num_tramite','num_tramite','varchar');\n\t\t$this->setParametro('codigo_proceso','codigo_proceso','varchar');\n\t\t$this->setParametro('estado_reg','estado_reg','varchar');\n\t\t$this->setParametro('estado','estado','varchar');\n\t\t$this->setParametro('num_cotizacion','num_cotizacion','varchar');\n\n\t\t//Ejecuta la instruccion\n\t\t$this->armarConsulta();\n\t\t$this->ejecutarConsulta();\n\n\t\t//Devuelve la respuesta\n\t\treturn $this->respuesta;\n\t}", "function listarProcesoCompra(){\n\t\t$this->procedimiento='adq.f_proceso_compra_sel';\n\t\t$this->transaccion='ADQ_PROC_SEL';\n\t\t$this->tipo_procedimiento='SEL';//tipo de transaccion\n\t\t\t\t\n\t\t//Definicion de la lista del resultado del query\n\t\t$this->captura('id_proceso_compra','int4');\n\t\t$this->captura('id_depto','int4');\n\t\t$this->captura('num_convocatoria','varchar');\n\t\t$this->captura('id_solicitud','int4');\n\t\t$this->captura('id_estado_wf','int4');\n\t\t$this->captura('fecha_ini_proc','date');\n\t\t$this->captura('obs_proceso','varchar');\n\t\t$this->captura('id_proceso_wf','int4');\n\t\t$this->captura('num_tramite','varchar');\n\t\t$this->captura('codigo_proceso','varchar');\n\t\t$this->captura('estado_reg','varchar');\n\t\t$this->captura('estado','varchar');\n\t\t$this->captura('num_cotizacion','varchar');\n\t\t$this->captura('id_usuario_reg','int4');\n\t\t$this->captura('fecha_reg','timestamp');\n\t\t$this->captura('fecha_mod','timestamp');\n\t\t$this->captura('id_usuario_mod','int4');\n\t\t$this->captura('usr_reg','varchar');\n\t\t$this->captura('usr_mod','varchar');\n\t\t\n\t\t$this->captura('desc_depto','varchar');\n\t\t$this->captura('desc_funcionario','text');\n\t\t$this->captura('desc_solicitud','varchar');\n\t\t$this->captura('desc_moneda','varchar');\n\t\t\n\t\t \n\t\t\n\t\t//Ejecuta la instruccion\n\t\t$this->armarConsulta();\n\t\t$this->ejecutarConsulta();\n\t\t\n\t\t//Devuelve la respuesta\n\t\treturn $this->respuesta;\n\t}", "public function getComContenu()\n {\n return $this->Com_contenu;\n }", "function exec_raper_voir_journal () {\n\n\tglobal $connect_statut\n\t\t, $connect_toutes_rubriques\n\t\t, $connect_id_auteur\n\t\t;\n\n\t// la configuration est re'serve'e aux admins tt rubriques\n\t$autoriser = ($connect_statut == \"0minirezo\") && $connect_toutes_rubriques;\n\n////////////////////////////////////\n// PAGE CONTENU\n////////////////////////////////////\n\n\t$titre_page = _T('raper:titre_page_voir_journal');\n\t$rubrique = \"voir_journal\";\n\t$sous_rubrique = _RAPER_PREFIX;\n\n\t$commencer_page = charger_fonction('commencer_page', 'inc');\n\techo($commencer_page($titre_page, $rubrique, $sous_rubrique));\n\n\tif(!$autoriser) {\n\t\tdie (raper_terminer_page_non_autorisee() . fin_page());\n\t}\n\n\t$page_result = \"\"\n\t\t. \"<br /><br /><br />\\n\"\n\t\t. raper_gros_titre($titre_page, '', true)\n\t\t. barre_onglets($rubrique, $sous_rubrique)\n\t\t. debut_gauche($rubrique, true)\n\t\t. raper_boite_plugin_info()\n\t\t//. raper_boite_info_raper(true)\n\t\t. pipeline('affiche_gauche', array('args'=>array('exec'=>'raper_config'),'data'=>''))\n\t\t. creer_colonne_droite($rubrique, true)\n\t\t. raper_boite_raccourcis($rubrique, true)\n\t\t. pipeline('affiche_droite', array('args'=>array('exec'=>'raper_config'),'data'=>''))\n\t\t. debut_droite($rubrique, true)\n\t\t;\n\t\n\t// affiche milieu\n\t$page_result .= \"\"\n\t\t. debut_cadre_trait_couleur(\"administration-24.gif\", true, \"\", $titre_page)\n\t\t. raper_journal_lire(_RAPER_PREFIX)\n\t\t. fin_cadre_trait_couleur(true)\n\t\t;\n\t\t\n\t// Fin de la page\n\techo($page_result);\n\techo pipeline('affiche_milieu',array('args'=>array('exec'=>$sous_rubrique),'data'=>''))\n\t\t, raper_html_signature()\n\t\t, fin_gauche(), fin_page();\n}", "function exec_tabledata()\r\n{\r\n/* global $intPremierEnreg, $options, $spip_lang_right, $visiteurs, $connect_id_auteur\r\n , $connect_statut, $connect_toutes_rubriques;\r\n*/\r\n global $boolDebrid;\r\n\r\n // récupérer les données de la requete HTTP\r\n $table = _request('table');\r\n $intPremierEnreg = _request('intPremierEnreg');\r\n $serveur = _request('serveur');\r\n $mode = _request('mode');\r\n $idLigne = _request('id_ligne');\r\n $trisens = _request('trisens');\r\n $trival = _request('trival');\r\n $get_Debrid = _request('debrid');\r\n if ($get_Debrid==\"aGnFJwE\") $boolDebrid=true;\r\n\r\n // Vérifier login : Si administrateur = OK\r\n if (!autoriser('administrer','zone',0))\r\n {\r\n echo minipres();\r\n exit;\r\n }\r\n\r\n $commencer_page = charger_fonction('commencer_page', 'inc');\r\n echo $commencer_page(_T('tabledata:tabledata'));\r\n\r\n // Affichage menu de la page\r\n echo debut_gauche('TableDATA', true);\r\n\r\n echo debut_boite_info(true);\r\n // Par la suite, c'est ici qu'il faudrait inscrire les messages pour l'utilisateur...\r\n // mais il faut remanier tout le code.\r\n echo \"<p class='arial1'>\"\r\n ,\"<b>Cde & Informations...</b>\"\r\n ,\"<hr/>\"\r\n ,\"<a href='\"\r\n , tabledata_url_generer_ecrire('tabledata',\"table\")\r\n , \"'>- Voir toutes les tables -</a>\";\r\n\r\n echo \"<hr/>\";\r\n echo \"table s&#233;lectionn&#233;e:<br/>\";\r\n echo \"<center><b>\";\r\n if ($table==\"\")\r\n {\r\n echo \"Aucune n'est s&#233;lectionn&#233;e\";\r\n }\r\n else\r\n {\r\n echo \"<a href='\",tabledata_url_generer_ecrire('tabledata',\"table=\".$table).\"'>\"\r\n ,$table,\"</a>\";\r\n }\r\n echo \"</b></center>\";\r\n\r\n // Afficher \"Voir tables SPIP\"\r\n if (autoriser('webmestre'))\r\n {\r\n if ($boolDebrid)\r\n {\r\n $texte_tablespip= \"<hr/>\"\r\n .\"<a href='\"\r\n .tabledata_url_generer_ecrire('tabledata',\"table\",\"masquer\")\r\n .\"'>SPIP</a>\"\r\n .\" : Masquer les tables SPIP. (pr&#233;fixe : \".tabledata_table_prefix().\")<br/>\";\r\n }\r\n else\r\n {\r\n $texte_tablespip= \"<hr/>\"\r\n .\"<a href='\"\r\n .tabledata_url_generer_ecrire('tabledata',\"table\",\"voir\")\r\n .\"'>SPIP</a>\"\r\n .\" : Voir les tables SPIP. (pr&#233;fixe : \".tabledata_table_prefix().\")<br/>\";\r\n }\r\n echo $texte_tablespip;\r\n }\r\n // echo propre(_T('tabledata:tabledata'));\r\n echo fin_boite_info(true);\r\n\r\n\r\n // Par la suite, c'est ici qu'il faudrait mettre l'aide des commandes.\r\n $texte_bloc_des_raccourcis = \"<p class='arial1'>\"\r\n .\"<b>LISTER</b> : Affichage par groupe de 20 enregistrements.\"\r\n .\" (Tri&#233;s sur la clef primaire si elle existe)\"\r\n .\"<br/><br/><u>Les Qq Commandes</u><br/>\"\r\n .\"<br/><b>TRIER</b> : Cliquer sur l'icone ^v dans l'ent&#234;te du champ\"\r\n .\" (bascule &#224; chaque clic Ascendant, Decsendant, Aucun)<br/>\"\r\n .\"<br/><b>AJOUTER</b> : Pour ajouter un nouvel enregistrement, voir le formulaire du bas de page<br/>\"\r\n .\"<br/><b>SUPPRIMER</b> : Lister le contenu de la table et cliquer sur la croix rouge &#224; gauche de la ligne.<br/>\"\r\n .\"<br/><b>MODIFIER</b> : Cliquer sur l'enregistement<br/>\";\r\n\r\n\r\n echo bloc_des_raccourcis($texte_bloc_des_raccourcis);\r\n\r\n // Afficher page centrale\r\n echo debut_droite('TableDATA', true);\r\n\r\n // ======== Teste si le nom de la table est mentionné\r\n if ($table==\"\")\r\n {\r\n if ($boolDebrid)\r\n {\r\n echo gros_titre('<br/>ATTENTION :','',false);\r\n echo \"La modification du contenu des tables de SPIP peut engendrer\"\r\n ,\" des dysfontionnements graves.<br/>\"\r\n ,\"Faite une sauvegarde de la base, elle \"\r\n ,\"permettra une r&#233;paration en cas de probl&#232;me.<br/>\";\r\n }\r\n echo gros_titre('<br/>Choisir une table :','',false);\r\n echo debut_cadre_relief(\"../\"._DIR_PLUGIN_TABLEDATA.\"/img_pack/tabledata.gif\",true,'','');\r\n echo \"Le nom de la table est manquant.<br/><br/>\";\r\n echo tabledata_Cadre_voirlestables ($serveur,$boolDebrid);\r\n echo fin_cadre_relief(true);\r\n tabledata_Page_fin();\r\n exit;\r\n } // if ($table==\"\")\r\n\r\n // ======== Recherche si la table existe ? ===========\r\n if (!preg_match('/^[\\w_]+$/', $table))\r\n {\r\n echo debut_cadre_relief(\"../\"._DIR_PLUGIN_TABLEDATA.\"/img_pack/tabledata.gif\");\r\n echo \"'\".$table.\"': nom incorrect\";\r\n echo fin_cadre_relief(true);\r\n echo \"<center><a href='\"\r\n , tabledata_url_generer_ecrire('tabledata',\"table\")\r\n , \"'>- Retour &#224; la liste des tables -</a></center>\";\r\n tabledata_Page_fin();\r\n exit;\r\n } // if (!preg_match('/^[\\w_]+$/', $table))\r\n\r\n if (strpos($table,tabledata_table_prefix(),0)===0) // cas d'une table SPIP\r\n {\r\n if ($boolDebrid)\r\n { // cas table SPIP autorisée\r\n echo gros_titre('<br/>ATTENTION :','',false);\r\n echo \"Vous intervenez sur une table interne de SPIP.\"\r\n ,\" Agissez avec pr&#233;cautions.<br/>\";\r\n }\r\n else\r\n { // protection active et table SPIP !!\r\n echo debut_cadre_relief(\"../\"._DIR_PLUGIN_TABLEDATA.\"/img_pack/tabledata.gif\");\r\n echo \"<br/>Le param&#232;tre <i>table</i> (valeur: '\"\r\n ,$table\r\n ,\"') indique une table prot&#233;g&#233;e de SPIP.<br/><br/>\";\r\n echo fin_cadre_relief(true);\r\n echo \"<center><a href='\"\r\n , tabledata_url_generer_ecrire('tabledata',\"table\")\r\n , \"'>- Retour &#224; la liste des tables -</a></center>\";\r\n tabledata_Page_fin();\r\n exit;\r\n }\r\n } // if (!$description)\r\n\r\n $description = sql_showtable($table, $serveur);\r\n\r\n $table2 = \"\";\r\n if ($boolDebrid && !$description)\r\n {\r\n // recherche avec l'extention définie pour SPIP tabledata_table_prefix()\r\n $table2 = tabledata_table_prefix().'_'. $table;\r\n $description = sql_showtable($table2, $serveur);\r\n } // if (!$description)\r\n\r\n spip_log(\"description \".$description);\r\n $field = $description['field'];\r\n $key = $description['key'];\r\n //$intClefPrimaireNbChamp= (count($key)>0?count(explode(\",\",$key[\"PRIMARY KEY\"])):0);\r\n\r\n $intNbClef = count($key);\r\n if (array_key_exists(\"PRIMARY KEY\",$key))\r\n {\r\n $intClefPrimaireNbChamp= count(explode(\",\",$key[\"PRIMARY KEY\"]));\r\n }\r\n else\r\n {\r\n $intClefPrimaireNbChamp = 0 ;\r\n }\r\n\r\n //tabledata_debug(\"Nombre de clef :\".$intNbClef.\" Primaire : \".$intClefPrimaireNbChamp, $key) ;\r\n\r\n // if (! ($field && $key))\r\n if (! ($field))\r\n {\r\n // la table n'existe pas !!\r\n echo debut_cadre_relief(\"../\"._DIR_PLUGIN_TABLEDATA.\"/img_pack/tabledata.gif\");\r\n echo \"Le param&#232;tre <i>table</i> (valeur: '\"\r\n ,$table\r\n ,\"') n'indique pas une table exploitable par le serveur SQL \",$serveur;\r\n echo fin_cadre_relief(true);\r\n echo \"<center><a href='\"\r\n , tabledata_url_generer_ecrire('tabledata',\"table\")\r\n , \"'>- Retour &#224; la liste des tables -</a></center>\";\r\n } // if (! ($field && $key))\r\n else\r\n {\r\n // la table existe.\r\n if ($table2) $table = $table2;\r\n\r\n switch ($intClefPrimaireNbChamp)\r\n {\r\n case 0 :\r\n // Il n'y a pas de clef primaire => désactiver modification...\r\n // désactiver modif\r\n $boolFntAjout = true;\r\n $boolFntModif = true ; // false;\r\n $txtMsgInfoTable= \"<br/>Votre table ne contient pas de clef primaire. \"\r\n .\"<I>La modification des enregistrements est <!--d&#233;s-->activ&#233;e\"\r\n .\"<I>(&#224; vos risques et p&#233;rils, surtout si plusieurs enregistrement sont &#233;gaux)\"\r\n .\"</i><br/>\";\r\n\r\n foreach($field as $k=>$d)\r\n {\r\n $key[\"PRIMARY KEY\"][] = $k;\r\n }\r\n\r\n break;\r\n\r\n case 1 :\r\n // il y a une clé primaire sur champ unique =OK\r\n if (strpos(strtoupper($field[$key[\"PRIMARY KEY\"]]),\"AUTO_INCREMENT\",0)===False)\r\n {\r\n // Si pas d'autoincrement : désactiver ajout\r\n // $boolFntAjout = false;\r\n $txtMsgInfoTable= \"<br/>La clef primaire de la table n'est pas\"\r\n .\" autoincr&#233;ment&#233;e. \"\r\n //.\"<I>(L'insertion d'un nouvel enregistrement est d&#233;sactiv&#233;e)\"\r\n .\"</i><br/>\";\r\n } //if (strpos($field[$key[\"PRIMARY KEY\"]]\r\n // else\r\n // {\r\n // Si autoincrement : Activer ajout\r\n $boolFntAjout = true;\r\n $txtMsgInfoTable= \"\";\r\n //} //if (strpos($field[$key[\"PRIMARY KEY\"]]\r\n $boolFntModif = true;\r\n $key[\"PRIMARY KEY\"] = explode(\",\",$key[\"PRIMARY KEY\"]);\r\n break;\r\n\r\n default :\r\n // il y a une clé primaire sur champs multiple\r\n //$boolFntAjout = false;\r\n $boolFntAjout = true;\r\n $boolFntModif = true;\r\n\r\n //$txtMsgInfoTable= \"<br/>La clef primaire contient plusieurs champs: \".$key[\"PRIMARY KEY\"]\r\n // .\"<br/><I>(L'insertion est d&#233;sactiv&#233;e)</i><br/>\";\r\n $txtMsgInfoTable= \"<br/>La clef primaire contient plusieurs champs: \".$key[\"PRIMARY KEY\"];\r\n\r\n $key[\"PRIMARY KEY\"] = explode(\",\",$key[\"PRIMARY KEY\"]);\r\n } //switch ($intClefPrimaireNbChamp)\r\n\r\n // CHOIX DE L'ACTION A REALISER => de l'affichage\r\n\r\n if ($_SERVER['REQUEST_METHOD'] == 'POST')\r\n {\r\n // la page est arrivée en POST\r\n switch ($_POST['tdaction'])\r\n {\r\n case \"ordresuplig\" :\r\n // la page est arrivée en POST avec action=ordresuplig\r\n // ==> Demande d'effacer la fiche (enregistrement)\r\n tabledata_Cadre_InfoEffacer($table , $field, $key, $serveur, $idLigne) ;\r\n echo \"<center><a href='\"\r\n , tabledata_url_generer_ecrire('tabledata',\"table\")\r\n , \"'>- Retour &#224; la liste des tables -</a></center>\";\r\n echo $txtMsgInfoTable;\r\n tabledata_Cadre_Lister($table, $serveur, $field, $key, $boolFntModif,$trisens,$trival,$intPremierEnreg);\r\n if ($boolFntAjout) tabledata_Cadre_Ajouter($table, $serveur, $field, $key);\r\n echo \"<center><a href='\"\r\n , tabledata_url_generer_ecrire('tabledata',\"table\")\r\n , \"'>- Retour &#224; la liste des tables -</a></center>\";\r\n break;\r\n case \"maj\" :\r\n // la page est arrivée en POST avec action=maj\r\n // ==> Demande Enregistrement des valeurs.\r\n tabledata_Cadre_InfoModifier($table , $field, $key, $serveur, $idLigne) ;\r\n echo \"<center><a href='\"\r\n , tabledata_url_generer_ecrire('tabledata',\"table\")\r\n , \"'>- Retour &#224; la liste des tables -</a></center>\";\r\n echo $txtMsgInfoTable;\r\n tabledata_Cadre_Lister($table, $serveur, $field, $key, $boolFntModif,$trisens,$trival,$intPremierEnreg);\r\n if ($boolFntAjout) tabledata_Cadre_Ajouter($table, $serveur, $field, $key);\r\n echo \"<center><a href='\"\r\n , tabledata_url_generer_ecrire('tabledata',\"table\")\r\n , \"'>- Retour &#224; la liste des tables -</a></center>\";\r\n break;\r\n default:\r\n // la page est arrivée en POST sans action ou autre\r\n // ==> Demande Insertion des valeurs.\r\n tabledata_Cadre_InfoInserer($table, $serveur);\r\n // Afficher la liste\r\n echo \"<center><a href='\"\r\n , tabledata_url_generer_ecrire('tabledata',\"table\")\r\n , \"'>- Retour &#224; la liste des tables -</a></center>\";\r\n\r\n echo $txtMsgInfoTable;\r\n $intPremierEnreg = \"-1\";\r\n tabledata_Cadre_Lister($table, $serveur, $field, $key, $boolFntModif,$trisens,$trival,$intPremierEnreg);\r\n // Afficher cadre Ajout\r\n if ($boolFntAjout) tabledata_Cadre_Ajouter($table, $serveur, $field, $key);\r\n echo \"<center><a href='\"\r\n , tabledata_url_generer_ecrire('tabledata',\"table\")\r\n , \"'>- Retour &#224; la liste des tables -</a></center>\";\r\n break;\r\n } // switch ($_POST['tdaction'])\r\n } // if ($_SERVER['REQUEST_METHOD'] == 'POST')\r\n else\r\n {\r\n // la page n'est pas arrivée en POST => en GET\r\n switch ($_GET['tdaction'])\r\n {\r\n case \"edit\" :\r\n // avec action=maj\r\n // ==> Affichage formulaire de modification\r\n tabledata_Cadre_Modifier($table, $serveur, $field, $key, $idLigne);\r\n break;\r\n case \"suplig\" :\r\n // avec action=sup\r\n // ==> Affichage formulaire de modification\r\n\r\n tabledata_Cadre_Supprimer($table, $serveur, $field, $key, $idLigne);\r\n break;\r\n default :\r\n // sans action ou autre\r\n // ==> Affichage de la liste\r\n echo \"<center><a href='\"\r\n , tabledata_url_generer_ecrire('tabledata',\"table\")\r\n , \"'>- Retour &#224; la liste des tables -</a></center>\";\r\n echo $txtMsgInfoTable;\r\n echo tabledata_Cadre_Lister($table, $serveur, $field, $key, $boolFntModif,$trisens,$trival,$intPremierEnreg);\r\n if ($boolFntAjout) tabledata_Cadre_Ajouter($table, $serveur, $field, $key);\r\n echo \"<center><a href='\"\r\n , tabledata_url_generer_ecrire('tabledata',\"table\")\r\n , \"'>- Retour &#224; la liste des tables -</a></center>\";\r\n break;\r\n } // switch ($_GET['action'])\r\n } // if ($_SERVER['REQUEST_METHOD'] == 'POST')\r\n } // if (! ($field && $key))\r\n\r\n\t// inclusion du bouton d'export\r\n\ttabledata_cadre($table);\r\n\r\n tabledata_Page_fin();\r\n\r\n}", "public function afficherClientAction($identifiant)\n {\n $em = $this->getDoctrine()->getManager();\n $client = $em->getRepository('CoutureGestionBundle:Client')->findOneBy(array('identifiant' => $identifiant));\n $mesure = $em->getRepository('CoutureGestionBundle:Mesure')->findOneBy(array('identifiant' => $identifiant));\n if ($client->getMesure() == NULL)\n {\n return $this->render('CoutureGestionBundle:Couture:afficherClientBis.html.twig', array(\n 'client' => $client, 'mesure' => $mesure\n ));\n }\n else {\n return $this->render('CoutureGestionBundle:Couture:afficherClient.html.twig', array(\n 'client' => $client, 'mesure' => $mesure\n ));\n }\n }", "public function afficheEntete()\r\n\t\t{\r\n\t\t//appel de la vue de l'entête\r\n\t\trequire 'Vues/entete.php';\r\n\t\t}", "function fProcesaBanco(){\n global $db, $cla, $agPar, $igNumChq, $igSecue, $ogDet;\n $alDet = fIniDetalle();\n $alDet[\"det_codcuenta\"]\t= $cla->cla_ctaorigen; \n $alDet[\"det_glosa\"] \t= substr($agPar[\"com_Concepto\"],0, 50) . ' ' . substr($agPar[\"slBenef\"],0,20);\n $alDet['det_idauxiliar']= $agPar[\"com_Emisor\"];\n $alDet[\"det_numcheque\"]\t= $igNumChq;\t\t\t// es el numero de cheque\n $alDet[\"det_feccheque\"]\t= $agPar[\"com_FechCheq\"];\n $alDet['det_valdebito']\t= $agPar[\"flValor\"] * $cla->cla_indicador; // segun el signo del indicador, se aplica como DB/CR al grabar;\n $alDet['det_valcredito']\t= 0;\n $alDet['det_secuencia']\t= $igSecue;\n\tif(fGetParam(\"pAppDbg\",0)){\n\t\tprint_r($alDet);\n\t}\n\tfInsdetalleCont($db, $alDet);\n}", "private function buscar_proveedor()\n {\n $this->template = FALSE;\n \n $json = array();\n foreach($this->proveedor->search($_REQUEST['buscar_proveedor']) as $pro)\n {\n $json[] = array('value' => $pro->nombre, 'data' => $pro->codproveedor);\n }\n \n header('Content-Type: application/json');\n echo json_encode( array('query' => $_REQUEST['buscar_proveedor'], 'suggestions' => $json) );\n }", "function produit(){\n \n require(\"./modele/visiteur/visiteurBD.php\");\n if (count($_POST) == 0) {\n $view = new View('visiteur/produit');\n $view->generate();\n }else{\n $view = new View('visiteur/produit');\n $contenu = array();\n $contenu=recupProduit($_POST['produit']);\n $view->setContentArray($contenu);\n $view->generate();\n }\n\n \n}", "public function suprRegimentAppartenance()\n {\n //sécurité :\n $action = 'deleteFolderInformation';\n $error = AccessControll::checkRight($action);\n if ( empty($error) ){ //ok\n //on réccupère l'id à supr (clée primaire)\n $id = $this->request->getGetAttribute('id');\n //ajout d'une entrée dans le fichier de log\n $data = DossierManager::getAppartenanceByClef($id);\n $auth = AuthenticationManager::getInstance();\n $username = $auth->getMatricule();\n $type = 'appartenanceRegiment';\n self::logDeletedInformation($data, $username, $type);\n //on supprime (retourne le matricule)\n $matricule = DossierManager::suprRegimentAppartenanceById($id);\n //on réaffiche le dossier actualisé\n $dossier = DossierManager::getOneFromId($matricule);\n $prez = self::afficheDossierComplet($dossier);\n $this->response->setPart('contenu', $prez);\n } else{\n header(\"location: index.php\");\n die($error);\n }\n }", "static function verifVentePro($ar){\n $datas = array('WTSCUSTOMER'=>array('pro', 'progroup', 'skdb2bcode'),\n 'WTSCARDSGROUP'=>array('OUTOFSTOCK', 'shortwtp'),\n 'WTSGROUPS'=>array('comments'),\n 'WTSORDER'=>array('ISPROORDER')\n );\n foreach($datas as $atable=>$sommeFields){\n if(!XSystem::tableExists($atable)){\n $mess .= 'La table '.$atable.' n\\'existe pas <br>';\n continue;\n }\n $mess .= 'La table '.$atable.' existe<br>';\n $ds = XDataSource::objectFactoryHelper8('BCLASS=XDSTable&SPECS='.$atable);\n foreach($sommeFields as $fn){\n if (!$ds->fieldExists($fn)){\n $mess .= '-'.$fn.' existe pas<br>';\n } else {\n $mess .= '-'.$fn.' ok<br>';\n }\n }\n }\n $rs = selectQuery('select * from SETS where STAB=\"WTSORDER\" and FIELD=\"MODEPAIEMENT\" and SOID=\"ENCOMPTE\" and SLANG=\"FR\"');\n if (!$rs || $rs->rowCount() < 1)\n $mess .= 'Ajouter le mode de paiement (MODEPAIEMENT) \"ENCOMPTE\" dans WTSORDER<br>';\n else\n $mess .= 'OK MODEPAIEMENT \"ENCOMPTE\" existe dans WTSORDER';\n return $mess;\n }", "function send_complaint()\n\t{\n\t\t\t//?=usercode=12&complaint_code=1&description=hello sir\n\t\t \t$user_dt = $this->ObjM->get_user_by_usercode($_REQUEST['usercode']);\n\t\t\t\n\t\t\t$data['send_status'] \t\t= \t($user_dt[0]['user_type_id']=='2')? \"1\" : \"0\";\n\t\t\t$data['complaint_code']\t\t=\t$_REQUEST['complaint_code'];\n\t\t\t$data['description']\t\t=\t$_REQUEST['description'];\n\t\t\t$data['timedt']\t\t\t\t=\ttime();\n\t\t\t$id\t\t=\t$this->ObjM->addItem($data,'complaint_detail');\n\t\t\t$res\t=\tarray();\n\t\t\t$result[0]['validation']='true';\n\t\t\techo json_encode($result);\n\t}", "static function retrieve_parties_fftt( $licence )\n { \n\tglobal $gCms;\n\t$db = cmsms()->GetDb();\n\t$ping = cms_utils::get_module('Ping');\n\t//require_once(dirname(__FILE__).'/function.calculs.php');\n\t$saison_courante = $ping->GetPreference('saison_en_cours');\n\t$now = trim($db->DBTimeStamp(time()), \"'\");\n\t$aujourdhui = date('Y-m-d');\n\t$designation = \"\";\n\t$annee_courante = date('Y');\n\t$lignes = 0; //on instancie le nb de lignes 0 par défaut\n\t\n\t//les classes\n\t$service = new Servicen;\n\t$spid_ops = new spid_ops;\n\t\n\t$page = \"xml_partie_mysql\";\n\t$var = \"licence=\".$licence;\n\t$lien = $service->GetLink($page, $var);\n\t$xml = simplexml_load_string($lien,'SimpleXMLElement', LIBXML_NOCDATA);\n\t\n\tif($xml === FALSE)\n\t{\n\t\t$array = 0;\n\t\t$lignes = 0;\n\t\t$message = \"Service coupé ou pas de résultats disponibles\"; \n\t\t$status = 'Echec';\n\t\t$designation.= $message;\n\t\t$action = \"mass_action\";\n\t\tping_admin_ops::ecrirejournal($status, $designation,$action);\n\t}\n\telse\n\t{\n\t\t$array = json_decode(json_encode((array)$xml), TRUE);\n\t\tif(isset($array['partie']))\n\t\t{\n\t\t\t$lignes = count($array['partie']);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$lignes = 0;\n\t\t}\n\t\t\n\t\t//var_dump($xml);\n\t}\n\t\t\n\t\t\n\t\t$i = 0;\n\t\t$compteur = 0;\n\t\tforeach($xml as $cle =>$tab)\n\t\t{\n\t\t\t$compteur++;\n\n\t\t\t$licence = (isset($tab->licence)?\"$tab->licence\":\"\");\n\t\t\t$advlic = (isset($tab->advlic)?\"$tab->advlic\":\"\");\n\t\t\t$vd = (isset($tab->vd)?\"$tab->vd\":\"\");\n\n\t\t\t\tif ($vd =='V')\n\t\t\t\t{\n\t\t\t\t\t$vd = 1;\n\t\t\t\t}\n\t\t\t\telse \n\t\t\t\t{\n\t\t\t\t\t$vd = 0;\n\t\t\t\t}\n\n\t\t\t$numjourn = (isset($tab->numjourn)?\"$tab->numjourn\":\"0\");\n\n\t\t\t\tif(is_array($numjourn))\n\t\t\t\t{\n\t\t\t\t\t$numjourn = '0';\n\t\t\t\t}\n\t\t\t$nj = (int) $numjourn;\n\t\t\t\n\t\t\t$codechamp = (isset($tab->codechamp)?\"$tab->codechamp\":\"\");\n\n\t\t\t//on essaie de déterminer le nom de cette compet ?\n\t\t\t//$query = \"SELECT * FROM \".cms_db_prefix().\"module_ping_type_competition WHERE code_compet = ?\";\n\n\t\t\t$dateevent = (isset($tab->date)?\"$tab->date\":\"\");\n\t\t\t$chgt = explode(\"/\",$dateevent);\n\t\t\t//on va en déduire la saison\n\t\t\tif($chgt[1] < 7)\n\t\t\t{\n\t\t\t\t//on est en deuxième phase\n\t\t\t\t//on sait donc que l'année est la deuxième année\n\t\t\t\t$annee_debut = ($chgt[2]-1);\n\t\t\t\t$annee_fin = $chgt[2];\n\n\t\t\t}\n\t\t\telseif($chgt[1]>=7)\n\t\t\t{\n\t\t\t\t//on est en première phase\n\t\t\t\t$annee_debut = $chgt[2];\n\t\t\t\t$annee_fin = ($chgt[2]+1);\n\t\t\t}\n\t\t\t$saison = $annee_debut.\"-\".$annee_fin;\n\t\t\t$date_event = $chgt[2].\"-\".$chgt[1].\"-\".$chgt[0];\n\t\t\t//echo \"la date est\".$date_event;\n\n\t\t//\t$date_event = conv_date_vers_mysql($dateevent);\n\t\t\t$advsexe = (isset($tab->advsexe)?\"$tab->advsexe\":\"\");\n\t\t\t//$advnompre = mysqli_real_escape_string($link,(isset($tab->advnompre)?\"$tab->advnompre\":\"\"));\n\t\t\t$advnompre =(isset($tab->advnompre)?\"$tab->advnompre\":\"\");\n\t\t\t$pointres = (isset($tab->pointres)?\"$tab->pointres\":\"\");\n\t\t\t$coefchamp = (isset($tab->coefchamp)?\"$tab->coefchamp\":\"\");\n\t\t\t$advclaof = (isset($tab->advclaof)?\"$tab->advclaof\":\"\");\n\t\t\t$idpartie = (isset($tab->idpartie)?\"$tab->idpartie\":\"\");\n\t\t\t\n\t\t\t$add_fftt = $spid_ops->add_fftt($saison,$licence, $advlic, $vd, $nj, $codechamp, $date_event, $advsexe, $advnompre, $pointres, $coefchamp, $advclaof,$idpartie);\n\t\t\t\n\t\t\t\n\t\t}\n\t\treturn $compteur;\n\n }", "public function nuovoProvvedimento($pagina) {\r\n \r\n $nuovoProvvedimento = new Provvedimento();\r\n \r\n $pagina->setJsFile(\"\");\r\n $operatore = $_SESSION[\"op\"];\r\n $ruolo = $operatore->getFunzione();\r\n $pagina->setHeaderFile(\"./view/header.php\");\r\n $pagina->setTitle(\"Nuovo provvedimento\");\r\n OperatoreController::setruolo($pagina);\r\n $pagina->setMsg('');\r\n $pagina->setContentFile(\"./view/operatore/nuovoProvvedimento.php\");\r\n $operatori = OperatoreFactory::getListaOp();\r\n $rows = count($operatori);\r\n \r\n if ($_REQUEST[\"cmd\"] == \"salvaProvvedimento\") {\r\n $pagina->setTitle(\"Salvataggio Provvedimento\");\r\n $numeroProvvedimento = isset($_REQUEST[\"numeroProvvedimento\"]) ? $_REQUEST[\"numeroProvvedimento\"] : null;\r\n $dataProvvedimento = isset($_REQUEST[\"dataProvvedimento\"]) ? $_REQUEST[\"dataProvvedimento\"] : null;\r\n $numeroProtocollo = isset($_REQUEST[\"numeroProtocollo\"]) ? $_REQUEST[\"numeroProtocollo\"] : null;\r\n $dataProtocollo = isset($_REQUEST[\"dataProtocollo\"]) ? $_REQUEST[\"dataProtocollo\"] : null;\r\n $praticaCollegata = isset($_REQUEST[\"praticaCollegata\"]) ? $_REQUEST[\"praticaCollegata\"] : null;\r\n $update = isset($_REQUEST[\"update\"]) && $_REQUEST[\"update\"] == true ? true : false;\r\n $id = isset($_REQUEST[\"id\"]) ? $_REQUEST[\"id\"] : null;\r\n \r\n $messaggio = '<div class=\"erroreInput\"><p>Errore, per proseguire occorre: </p><ul>';\r\n $errori = 0;\r\n \r\n if (!($nuovoProvvedimento->setNumeroProvvedimento($numeroProvvedimento))) {\r\n $messaggio .= '<li>Specificare il numero del provvedimento</li>';\r\n $errori++;\r\n }\r\n if (!($nuovoProvvedimento->setDataProvvedimento($dataProvvedimento))) {\r\n $messaggio .= '<li>Specificare la data del provvedimento</li>';\r\n $errori++;\r\n }\r\n if (!($nuovoProvvedimento->setNumeroProtocollo($numeroProtocollo))) {\r\n $messaggio .= '<li>Specificare il protocollo</li>';\r\n \r\n }\r\n if (!($nuovoProvvedimento->setDataProtocollo($dataProtocollo))) {\r\n $messaggio .= '<li>Specificare la data del protocollo</li>';\r\n \r\n }\r\n if (!($nuovoProvvedimento->setPraticaCollegata($praticaCollegata))) {\r\n $messaggio .= '<li>Specificare la pratica collegata/li>';\r\n $errori++;\r\n }\r\n\r\n $messaggio .='</ul></div>';\r\n \r\n if ($errori > 0) {\r\n $pagina->setMsg($messaggio);\r\n } else if (!$update) {\r\n $setNewProvvedimento = ProvvedimentoFactory::salvaProvvedimento($nuovoProvvedimento);\r\n\r\n if ($setNewProvvedimento === 0) {\r\n $pagina->setContentFile(\"./view/operatore/okNuovoProvvedimento.php\");\r\n $pagina->setTitle(\"Inserimento nuovo Provvedimento Unico\");\r\n } elseif ($setNewProvvedimento === 1062) {\r\n $pagina->setMsg('<div class=\"erroreInput\"><p>Errore, dati ripetuti</p></div>');\r\n }\r\n } else {\r\n $nuovoProvvedimento->setId($id);\r\n echo $id;\r\n $updateProvvedimento = ProvvedimentoFactory::updateProvvedimento($nuovoProvvedimento);\r\n\r\n if ($updateProvvedimento === 0) {\r\n $pagina->setContentFile(\"./view/operatore/okNuovoProvvedimento.php\");\r\n $pagina->setTitle(\"Modifica operatore\");\r\n } elseif ($updateProvvedimento === 1062) {\r\n $pagina->setMsg('<div class=\"erroreInput\"><p>Errore, dati ripetuti</p></div>');\r\n } else {\r\n $pagina->setMsg('<div class=\"erroreInput\"><p>Errore, non è possibile aggiornare</p></div>');\r\n }\r\n }\r\n }\r\n\r\n include \"./view/masterPage.php\";\r\n }" ]
[ "0.6371605", "0.6307951", "0.6303901", "0.61269045", "0.6061136", "0.59381", "0.5922541", "0.5882537", "0.5882537", "0.5874604", "0.58630663", "0.58295786", "0.58049875", "0.57859856", "0.576723", "0.57538044", "0.57390887", "0.56993663", "0.56442267", "0.5634447", "0.563319", "0.5632248", "0.56152046", "0.56140864", "0.56079364", "0.5604384", "0.55978847", "0.5570609", "0.5562741", "0.5557296", "0.55515194", "0.55515194", "0.5540492", "0.5530062", "0.55251426", "0.5521897", "0.5510373", "0.55049616", "0.55013156", "0.5499324", "0.5494727", "0.54940903", "0.54716974", "0.54640216", "0.54604715", "0.5449876", "0.54450583", "0.54422385", "0.5431169", "0.5430489", "0.5421658", "0.5410187", "0.5403852", "0.5403574", "0.5401316", "0.5399475", "0.538198", "0.53819245", "0.5381238", "0.5377512", "0.537686", "0.5373301", "0.5363419", "0.53631717", "0.5354941", "0.5349775", "0.5349099", "0.53444576", "0.5343787", "0.53393316", "0.53371495", "0.5335981", "0.53356445", "0.53303844", "0.5329129", "0.5326432", "0.53247356", "0.53240937", "0.5316155", "0.53111297", "0.5295531", "0.5288374", "0.5287829", "0.52870995", "0.52864856", "0.52793115", "0.5278723", "0.52532965", "0.5251469", "0.52439594", "0.5242296", "0.52396786", "0.523522", "0.5230726", "0.5224737", "0.5218081", "0.5215955", "0.5209622", "0.5208552", "0.51891524", "0.5187227" ]
0.0
-1
refuser un produit backoffice
public function refuseProductAction($id){ $em=$this->getDoctrine()->getManager(); $product=$em->getRepository('HologramBundle:Product')->find($id); $em->remove($product); $em->flush(); return $this->redirectToRoute('esprit_hologram'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function hookDisplayBackOfficeTop()\n {\n $objectifCoach = array();\n $this->context->controller->addCSS($this->_path . 'views/css/compteur.css', 'all');\n $this->context->controller->addJS($this->_path . 'views/js/compteur.js');\n $objectifCoach[] = CaTools::getObjectifCoach($this->context->employee->id);\n $objectif = CaTools::isProjectifAtteint($objectifCoach);\n $objectif[0]['appels'] = (isset($_COOKIE['appelKeyyo'])) ? (int)$_COOKIE['appelKeyyo'] : '0';\n\n $this->smarty->assign(array(\n 'objectif' => $objectif[0]\n ));\n return $this->display(__FILE__, 'compteur.tpl');\n }", "function apropos(){\n\t\t\t$this->data->content=\"aProposView.php\";\n\t\t\t$this->prepView();\n\t\t\t// Selectionne et charge la vue\n\t\t\trequire_once(\"view/mainView.php\");\n\t\t}", "function cl_db_projetoscliente() { \n //classes dos rotulos dos campos\n $this->rotulo = new rotulo(\"db_projetoscliente\"); \n $this->pagina_retorno = basename($GLOBALS[\"HTTP_SERVER_VARS\"][\"PHP_SELF\"]);\n }", "function fdl_contenu($err) {\n\t\n\t$source = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '../index.php';\n\t\n\techo\n\t\t'<h1>Connexion à BookShop</h1>', \n\t\t($err != 0) ? '<p class=\"erreur\">Echec de l\\'authentification</p>' : '',\n\t\t'<form action=\"connexion.php\" method=\"post\" class=\"bcFormulaireBoite\">',\t\t\t\n\t\t\t'<p class=\"enteteBloc\">Déjà inscrit ?</p>',\n\t\t\t'<input type=\"hidden\" name=\"source\" value=\"', $source,'\">', \n\t\t\t'<table style=\"margin: 0px auto;\">', \n\t\t\t\tfd_form_ligne('Email :', fd_form_input(FD_Z_TEXT,'email','',20)),\n\t\t\t\tfd_form_ligne('Mot de passe :', fd_form_input(FD_Z_PASSWORD,'password','',20)),\n\t\t\t'</table>',\n\t\t\t'<p class=\"centered bottomed\"><input type=\"submit\" style=\"margin-top: 0px\" value=\"Se connecter\" name=\"btnConnexion\"></p>',\n\t\t'</form>',\n\t\t\n\t\t'<form action=\"inscription.php\" method=\"post\" class=\"bcFormulaireBoite\">',\t\t\t\n\t\t\t'<p class=\"enteteBloc\">Pas encore inscrit ?</p>',\n\t\t\t'<input type=\"hidden\" name=\"source\" value=\"', $source,'\">', \n\t\t\t'<p>L\\'inscription est gratuite et ne prend que quelques secondes.</p>', // <br>N\\'hésitez pas.</p>',\n\t\t\t'<p class=\"centered bottomed\"><input type=\"submit\" value=\"S\\'inscrire\" name=\"btnInscription\"></p>',\n\t\t'</form>'; \n}", "public function Preferiti() {\n $session = Sessione::getInstance();\n if($session->isLoggedUtente()){\n $utente = $session->getUtente();\n $idutente = $utente->getId();\n $pm = FPersistentManager::getInstance();\n $ut = $pm->loadById(\"utente\", $idutente);\n $ricette = $ut->getPreferiti();\n if($ricette!=null){\n $msg = \"\";\n } else {\n $msg = \"Non hai ricette preferite\";\n }\n $view = new VPreferiti();\n $view->mostraPreferiti($ricette, $msg);\n\n } else {\n header('Location: /myRecipes/web/Utente/Login');\n }\n }", "function exec_raper_voir_journal () {\n\n\tglobal $connect_statut\n\t\t, $connect_toutes_rubriques\n\t\t, $connect_id_auteur\n\t\t;\n\n\t// la configuration est re'serve'e aux admins tt rubriques\n\t$autoriser = ($connect_statut == \"0minirezo\") && $connect_toutes_rubriques;\n\n////////////////////////////////////\n// PAGE CONTENU\n////////////////////////////////////\n\n\t$titre_page = _T('raper:titre_page_voir_journal');\n\t$rubrique = \"voir_journal\";\n\t$sous_rubrique = _RAPER_PREFIX;\n\n\t$commencer_page = charger_fonction('commencer_page', 'inc');\n\techo($commencer_page($titre_page, $rubrique, $sous_rubrique));\n\n\tif(!$autoriser) {\n\t\tdie (raper_terminer_page_non_autorisee() . fin_page());\n\t}\n\n\t$page_result = \"\"\n\t\t. \"<br /><br /><br />\\n\"\n\t\t. raper_gros_titre($titre_page, '', true)\n\t\t. barre_onglets($rubrique, $sous_rubrique)\n\t\t. debut_gauche($rubrique, true)\n\t\t. raper_boite_plugin_info()\n\t\t//. raper_boite_info_raper(true)\n\t\t. pipeline('affiche_gauche', array('args'=>array('exec'=>'raper_config'),'data'=>''))\n\t\t. creer_colonne_droite($rubrique, true)\n\t\t. raper_boite_raccourcis($rubrique, true)\n\t\t. pipeline('affiche_droite', array('args'=>array('exec'=>'raper_config'),'data'=>''))\n\t\t. debut_droite($rubrique, true)\n\t\t;\n\t\n\t// affiche milieu\n\t$page_result .= \"\"\n\t\t. debut_cadre_trait_couleur(\"administration-24.gif\", true, \"\", $titre_page)\n\t\t. raper_journal_lire(_RAPER_PREFIX)\n\t\t. fin_cadre_trait_couleur(true)\n\t\t;\n\t\t\n\t// Fin de la page\n\techo($page_result);\n\techo pipeline('affiche_milieu',array('args'=>array('exec'=>$sous_rubrique),'data'=>''))\n\t\t, raper_html_signature()\n\t\t, fin_gauche(), fin_page();\n}", "public function vistaRecomendacion()\n { \n \n require_once 'Vista/Header.php';\n require_once 'Vista/Recomendaciones/MainRecomendaciones.php'; \n require_once 'Vista/Footer.php'; \n\n }", "function cl_liccomissao() {\n //classes dos rotulos dos campos\n $this->rotulo = new rotulo(\"liccomissao\");\n $this->pagina_retorno = basename($GLOBALS[\"HTTP_SERVER_VARS\"][\"PHP_SELF\"]);\n }", "public function get_compte(){retrun($id_local_compte); }", "function cl_clientesmodulosproc() { \n //classes dos rotulos dos campos\n $this->rotulo = new rotulo(\"clientesmodulosproc\"); \n $this->pagina_retorno = basename($GLOBALS[\"HTTP_SERVER_VARS\"][\"PHP_SELF\"]);\n }", "function commandes_trig_bank_reglement_en_echec($flux){\r\n\t// Si on est dans le bon cas d'un paiement de commande et qu'il y a un id_commande et que la commande existe toujours\r\n\tif ($id_transaction = $flux['args']['id_transaction']\r\n\t AND $transaction = sql_fetsel(\"*\",\"spip_transactions\",\"id_transaction=\".intval($id_transaction))\r\n\t\tAND $id_commande = $transaction['id_commande']\r\n\t\tAND $commande = sql_fetsel('id_commande, statut, id_auteur', 'spip_commandes', 'id_commande='.intval($id_commande))){\r\n\r\n\t\t$statut_commande = $commande['statut'];\r\n\t\t$transaction_mode = $transaction['mode'];\r\n\t\t$statut_nouveau = $statut_commande;\r\n\r\n\t\t// on ne passe la commande en erreur que si le reglement a effectivement echoue,\r\n\t\t// pas si c'est une simple annulation (retour en arriere depuis la page de paiement bancaire)\r\n\t\tif (strncmp($transaction['statut'],\"echec\",5)==0){\r\n\t\t\t$statut_nouveau = 'erreur';\r\n\t\t}\r\n\t\tif ($statut_nouveau !== $statut_commande){\r\n\t\t\tspip_log(\"commandes_trig_bank_reglement_en_attente marquer la commande #$id_commande statut=$statut_nouveau\",'commandes');\r\n\t\t\t//on met a jour la commande\r\n\t\t\tinclude_spip(\"action/editer_commande\");\r\n\t\t\tcommande_modifier($id_commande,array('statut'=>$statut_nouveau,'mode'=>$transaction_mode));\r\n\t\t}\r\n\t}\r\n\r\n\treturn $flux;\r\n}", "function afficher()\r\n\t{\r\n\t\t\r\n\t\tif (!empty($this->zones) || !empty($this->blocs) )\r\n\t\t{\r\n\t\t\t//:: On configure les zones obligatoires\r\n\t\t\t\tif (empty($this->zones['Menu_Log'])) $this->zone('Menu_Log', menu('membre'));\r\n\r\n\t\t\t\tif (empty($this->zones['description'])) $this->zone('description', DESCRIPTION);\r\n\t\t\t\tif (empty($this->zones['keywords'])) $this->zone('keywords', KEYWORDS);\r\n\t\t\t\t$this->zone('nom', NOM);\r\n\t\t\t\t\r\n\t\t\t\t// On s'occupe du chemin des fichiers\r\n\t\t\t\t$this->zone( 'baseUrl', URL ); $this->zone( 'design', $this->style );\r\n\t\t\t\t\r\n\t\t\t\tif (is_admin()) $this->zone('jvs-admin', '<script type=\"text/javascript\" src=\"javascript/-admin.js\"></script>');\r\n\t\t\t\t\r\n\t\t\t\t// Nouveaux messages \r\n\t\t\t\r\n\t\t\t\t// Antibug\r\n\t\t\t\tif ($this->zones['img_titre']!=\"<!-- rien -->\") $this->zone('img_titre', '<img src=\"theme/images/content.png\" class=\"title\" alt=\"\" />');\r\n\t\t\t\t\t\t\t\r\n\t\t\t// Ouverture du template //\r\n\t\t\t$fichier=$this->chemin.$this->template.'.tpl.php';\r\n\t\t\t$source = fopen($fichier, 'r');\r\n\t\t\t$this->design = fread($source, filesize ($fichier));\r\n\t\t\tfclose($source);\r\n\t\t\t\r\n\t\t\t// Parsage du template\r\n\t\t\tforeach ($this->zones as $zone => $contenu)\r\n\t\t\t{\r\n\t\t\t\t$this->design = preg_replace ('/{::'.$zone.'::}/', $contenu, $this->design);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Suppresion des {::xxxx::} inutilisées\r\n\t\t\t$this->design = preg_replace ('/{::[-_\\w]+::}/', '', $this->design);\r\n\r\n\t\t\t// On remplace les blocs par leurs contenus //\r\n\t\t\tforeach($this->blocs as $nomBloc => $occurences)\r\n\t\t\t{\r\n\t\t\t\tpreg_match( '#{--'.$nomBloc.'--}(.*){--/'.$nomBloc.'/--}#ms', $this->design, $contenuBloc );\r\n\t\t\t\t$contenuBloc=$contenuBloc[1];\r\n\t\t\t\t\r\n\t\t\t\t$idNewTab=0; unset($nomZones);\r\n\t\t\t\tforeach($occurences as $occurence => $zones)\r\n\t\t\t\t{\r\n\t\t\t\t\tif (!isset($nomZones))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$nomZones=$zones;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$i=0;\r\n\t\t\t\t\t\t$newBloc[$idNewTab]=$contenuBloc;\r\n\t\t\t\t\t\tforeach($zones as $remplacement)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$newBloc[$idNewTab]=preg_replace ('/{:'.$nomZones[$i].':}/', $remplacement, $newBloc[$idNewTab]);\r\n\t\t\t\t\t\t\t$i++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$idNewTab++;\r\n\t\t\t\t}\r\n\t\t\t\r\n\t\t\t\t$newContenuBloc=implode(\"\", $newBloc);\r\n\t\t\t\t$this->design = preg_replace ('#{--'.$nomBloc.'--}(.*){--/'.$nomBloc.'/--}#ms', $newContenuBloc, $this->design);\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Suppression des blocs inutilisés\r\n\t\t\t$this->design = preg_replace ('#{--(.*)--}(.*){--/(.*)/--}#ms', '', $this->design);\r\n\r\n\t\t\t\r\n\t\t\t// Affichage du résultat final\r\n\t\t\t//$this->design = preg_replace ('/('.CHR(9).'|'.CHR(13).'|'.CHR(10).')/', \"\", $this->design);\r\n\r\n\t\t\t// Affichage du résultat final\r\n\t\t\techo $this->design;\r\n\t\t}\r\n\t}", "public function compteenattente()\n {\n $this->utils->Restreindre($this->userConnecter->admin, $this->utils->Est_autoriser(37, $this->userConnecter->profil));\n $data['lang'] = $this->lang->getLangFile($this->getSession()->getAttribut('lang'));\n $params = array('view' => 'compte/compteenattente');\n $this->view($params, $data);\n }", "function open() {\n\t\t//recuperation de la page demande\n\t\tif (!empty($this->client_path_info)) {\n\t\t\t$actions=$this->compile_url($this->client_path_info);\n\t\t\tif (sizeof($actions)==0) { // page par defaut du site\n\t\t\t\t//a remplacer par l'index utilisateur\n\t\t\t\t//BASE_URL\n\t\t\t\t$base_url=CFG::get(\"BASE_URL\",\"Context\");\n\t\t\t\t$url=$base_url.MAIN.\".\".INDEX;\n\t\t\t\t//echo $url;\n\t\t\t\tURL::redirect($url);\n\t\t\t\texit;\n\t\t\t\t\n\t\t\t}\n\t\t\t$this->actions=$actions;\n\t\t} else { //page par defaut du site\n\t\t\t//a remplacer par l'index utilisateur\n\t\t\t$base_url=CFG::get(\"BASE_URL\",\"Context\");\n\t\t\t$url=$base_url.MAIN.\".\".INDEX;\n\t\t\t//echo $url;\n\t\t\tURL::redirect($url);\n\t\t\texit;\n\t\t\t\t\n\t\t}\n\n\t\tif ($this->validate()) {\n\t\t//if (Bleetz::config[\"Auth\"]===true) {//TODO\n\t\t\tif (true) {\n\n\t\t\tUS::checkpoint();\n\n\t\t\tif (!$this->authorize()) {\n\t\t\t\t//perform login\n\t\t\t\t//redirect to login page...\n\t\t\t\t//US::login...\n\t\t\t\t//URL::login...\n\t\t\t\theader('HTTP/1.1 401 Unauthorized');\n\t\t\t\t//ou page de demande de connection ou retour\n\t\t\t\t// exemple : vous n'avez pas accs ˆ la page demandŽe\n\t\t\t\t// connectez vous....\n\t\t\t\tURL::redirect(\"admin.login\");\n\t\t\t\texit;\n\t\t\t};\n\n\t\t\t}\n\t\t} else {\n\t\t\t$this->actions=array();\n\t\t\t//par la suite\n\t\t\t//BZ::E404\n\t\t\tif (!CT::validate_action(E404)) {\n\t\t\t\tER::Report();\n\t\t\t\texit;\n\t\t\t}\n\t\t\t$ar=explode('.',E404);\n\t\t\t$controller=$ar[0];\n\t\t\t$action=$ar[1];\n\t\t\t$this->actions[]=array(\"controller\"=>$controller, \"action\"=>$action, \"case_items\"=>0 );\n/*\n\t\t\tif (!isset($this->admin)) {\n\t\t\t\t//BZ::LoadController(\"admin\");\n\t\t\t\techo CTLPATH;\n\t\t\t\trequire_once CTLPATH.\"admin.php\";\n\t\t\t\t$this->admin=$admin;\t\t\t//\n\t\t\t}\n*/\n\t\t}\n\t}", "function commandes_trig_bank_reglement_en_attente($flux){\r\n\t// Si on est dans le bon cas d'un paiement de commande et qu'il y a un id_commande et que la commande existe toujours\r\n\tif ($id_transaction = $flux['args']['id_transaction']\r\n\t AND $transaction = sql_fetsel(\"*\",\"spip_transactions\",\"id_transaction=\".intval($id_transaction))\r\n\t\tAND $id_commande = $transaction['id_commande']\r\n\t\tAND $commande = sql_fetsel('id_commande, statut, id_auteur, mode', 'spip_commandes', 'id_commande='.intval($id_commande))){\r\n\r\n\t\t$statut_commande = $commande['statut'];\r\n\t\t$transaction_mode = $transaction['mode'];\r\n\t\t$commande_mode = $commande['mode'];\r\n\t\t$statut_nouveau = 'attente';\r\n\t\tif ($statut_nouveau !== $statut_commande OR $transaction_mode !==$commande_mode){\r\n\t\t\tspip_log(\"commandes_trig_bank_reglement_en_attente marquer la commande #$id_commande statut=$statut_nouveau mode=$transaction_mode\",'commandes');\r\n\t\t\t//on met a jour la commande\r\n\t\t\tinclude_spip(\"action/editer_commande\");\r\n\t\t\tcommande_modifier($id_commande,array('statut'=>$statut_nouveau,'mode'=>$transaction_mode));\r\n\t\t}\r\n\t}\r\n\r\n\treturn $flux;\r\n}", "function AfficherEntreprise($entreprise)\n {\n require(\"db/connect.php\");\n $requete=$BDD->prepare(\"SELECT * FROM entreprise WHERE entreprise_id = ?\");\n $requete->execute(array($entreprise));\n //on vérifie que l'entreprise existe\n if($requete->rowcount()==0) {\n print (\"Cette entreprise n'existe pas\");\n }\n else {\n //on obtient la ligne entière de la BDD décrivant l'entreprise, stockée dans $entreprise\n $entreprise=$requete->fetch();\n print '<a href=\"entreprises.php\"><img class=\"imageTailleLogo\" alt=\"retour\" src=\"images/fleche.png\"/> </a>'\n . '<h1>'.$entreprise['entreprise_nom'].'</h1></br>';\n //logo + site internet\n print '<div class=\"row centreOffre fondFonce bordureTresDouce\" >\n <div class=\"col-xs-3 col-sm-3 col-md-4 col-lg-4 fondFonce\" \n style=\"height:240px;\"></br>\n <img class=\"imageEntreprise\" alt=\"LogoEntreprise\" src=\"logos/'.$entreprise['entreprise_logo'].'\"/></a>\n </div>\n <div class=\"col-xs-9 col-sm-9 col-md-8 col-lg-8 centreVertical fondFonce\" \n style=\"height:240px;\"> \n Site Internet <a href=\"'.$entreprise['entreprise_siteInternet'].'\">'.\n $entreprise['entreprise_siteInternet'].'</a>\n </div><br/></div>';\n //description longue\n print '<div class=\"row centreOffre bordureTresDouce\" ><h2>Description de l\\'entreprise </h2>';\n print '<div class=\"fondFonce\"></br>'.$entreprise['entreprise_descrLong'].'<br/></br></div>';\n \n //sites\n print '<h2>Adresse(s)</h2>';\n //on récupère les informations des adresses liées à l'entreprise si elle existe \n $requete=$BDD->prepare('SELECT adresse_id FROM liaison_entrepriseadresse WHERE entreprise_id =?;');\n $requete->execute(array($entreprise [\"entreprise_id\"]));\n if ($requete->rowcount()!=0)\n {\n //on stocke les résultats de la requete dans un tableau, une ligne par adresse liée a l'entreprise\n $tableauAdresse=$requete->fetchAll();\n //le booléen permet d'alterner les couleurs\n $bool=true;\n foreach($tableauAdresse as $liaison)\n {\n $bool=!$bool;\n if ($bool) print '<div class=\"col-xs-3 col-sm-3 col-md-4 col-lg-4 fondClair\" \n style=\"height:120px;\">';\n if (!$bool) print '<div class=\"col-xs-3 col-sm-3 col-md-4 col-lg-4 fondFonce\" \n style=\"height:120px;\">';\n $adresse_id=$liaison['adresse_id'];\n AfficherAdresse($adresse_id);\n print '</div>';\n } \n }\n else print '<i>Pas d\\'adresse renseignée.</i>';\n print '</div>'; \n \n //contacts\n print '<div class=\"row centreOffre\" style=\"border:1px solid #ddd;\">';\n print '<h2>Contact(s)</h2>';\n $requete=$BDD->prepare(\"SELECT * FROM contact WHERE contact.entreprise_id =?;\");\n $requete-> execute(array($entreprise['entreprise_id']));\n if ($requete->rowcount()!=0)\n {\n //on stocke les résultats de la requete dans un tableau, une ligne par contact lié a l'entreprise\n $tableauContact=$requete->fetchAll();\n $bool=true;\n foreach($tableauContact as $contact)\n {\n $bool=!$bool;\n if ($bool) print '<div class=\"col-xs-3 col-sm-3 col-md-4 col-lg-4 fondClair\" \n style=\"height:150px;\">';\n if (!$bool) print '<div class=\"col-xs-3 col-sm-3 col-md-4 col-lg-4 fondFonce\" \n style=\"height:150px;\">';\n AfficherContact($contact);\n } \n }\n else print\"<i>Pas de contact renseigné.</i>\";\n print '</div>';\n //offres proposées\n print '<div class=\"row centreOffre\" style=\"border:1px solid #ddd;\">';\n print '<h2>Offre(s) proposée(s)</h2>';\n //l'utilisateur normal ne peut voir les offres de moins d'une semaine\n if ($_SESSION['statut']==\"normal\")\n {\n $requete=$BDD->prepare(\"SELECT * FROM offre WHERE offre.entreprise_id =? AND offre_valide=1 AND offre_signalee=0 AND offre_datePoste<DATE_ADD(NOW(),INTERVAL -1 WEEK) ;\");\n }\n else {$requete=$BDD->prepare(\"SELECT * FROM offre WHERE offre.entreprise_id =? AND offre_valide=1 AND offre_signalee=0 ;\");}\n $requete-> execute(array($entreprise['entreprise_id']));\n $bool=true;\n if ($requete->rowcount()!=0)\n {\n //on stocke les résultats de la requete dans un tableau, une ligne par offre liée a l'entreprise\n $tableauOffre=$requete->fetchAll();\n foreach($tableauOffre as $offre)\n {\n $bool=!$bool;\n AfficherOffre($offre,$bool);\n } \n }\n else print \"<i>Pas d'offre proposée en ce moment.</i>\";\n print '</div>';\n }\n }", "public static function FrontEnvio()\n\t{\n\t\t$article_id = Util::getvalue('article_id');\n\t\t$emailRCP = Util::getvalue('email');\n\t\t$mensaje = strip_tags(Util::getvalue('mensaje'));\n\t\t$copia = Util::getvalue('copia', false);\n\n\n\t\t$interface = SkinController::loadInterface($baseXsl='article/article.envio.xsl');\n\t\t$article = Article::getById($article_id);\n\t\t$article['mensaje'] = $mensaje;\n\t\t\n\t\t$userArray = Session::getvalue('proyectounder');\n\t\t\n\t\tif($userArray):\n\t\t\t$article['user'] = $userArray;\n\t\tendif;\n\t\t\n\t\t$emailhtml = self::envio_email($article);\n\t\t$email = new Email();\n\t\t$email->SetFrom('[email protected]', 'Proyectounder.com');\n\t\t$email->SetSubject(utf8_encode($article['titulo']));\n\t\t$emailList = preg_split(\"/[;,]+/\", $emailRCP);\n\n\t\tforeach ($emailList as $destination)\n\t\t{\n\t\t\t$email->AddTo($destination);\n\t\t}\n\t\tif($copia):\n\t\t\t$email->AddCC($userArray['email']);\n\t\tendif;\n\n\t\t\n\t\t$email->ClearAttachments();\n\t\t$email->ClearImages();\n\t\t$email->SetHTMLBody(utf8_encode($emailhtml));\n\t\t$email->Send();\n\t\t\n\t\t\n\t\t$interface->setparam('enviado', 1);\n\t\t$interface->display();\n\t}", "function archobjet_autoriser() {\n}", "public function action_derivar() {\r\n $id = Arr::get($_GET, 'id_doc', 0);\r\n $documento = ORM::factory('documentos')\r\n ->where('id', '=', $id)\r\n //->and_where('original','=',1)\r\n ->find();\r\n\r\n // Modificado por Freddy\r\n // Obtenemos el id del via o destinatario\r\n if($documento->nombre_via!=''){\r\n $user_id = ORM::factory('users')->where('nombre','=',$documento->nombre_via)->find();\r\n }else{\r\n $user_id = ORM::factory('users')->where('nombre','=',$documento->nombre_destinatario)->find();\r\n }\r\n\r\n\r\n\r\n $nur = $documento->nur;\r\n if ($documento->loaded()) {\r\n $session = Session::instance();\r\n $session->delete('destino');\r\n\r\n $proceso = ORM::factory('procesos', $documento->id_proceso);\r\n $errors = array();\r\n $user = $this->user;\r\n if ($documento->estado == 0) {\r\n $acciones = $this->acciones();\r\n $destinatarios = $this->destinatarios($this->user->id, $this->user->superior);\r\n $id_seguimiento = 0;\r\n $oficial = 1;\r\n $hijo = 0;\r\n $this->template->title.=' | Derivar';\r\n $this->template->styles = array('media/css/tablas.css' => 'screen', 'media/css/fcbk.css' => 'screen', 'media/css/modal.css' => 'screen');\r\n $this->template->scripts = array('media/js/jquery.fcbkcomplete.min.js');\r\n $this->template->content = View::factory('hojaruta/frm_derivacion')\r\n ->bind('documento', $documento)\r\n ->bind('acciones', $acciones)\r\n ->bind('destinatarios', $destinatarios)\r\n ->bind('id_seguimiento', $id_seguimientos)\r\n ->bind('oficial', $oficial)\r\n ->bind('hijo', $hijo)\r\n ->bind('proceso', $proceso)\r\n ->bind('errors', $errors)\r\n ->bind('user', $user)\r\n ->bind('user_id', $user_id);\r\n } else {\r\n //verificamos que la hora de ruta esta en sus pendientes\r\n $pendiente = ORM::factory('seguimiento')\r\n ->where('nur', '=', $nur)\r\n ->and_where('derivado_a', '=', $this->user->id)\r\n ->and_where('estado', '=', 2)\r\n ->find();\r\n if ($pendiente->loaded()) {\r\n\r\n $acciones = $this->acciones();\r\n $destinatarios = $this->destinatarios($this->user->id, $this->user->superior);\r\n $id_seguimiento = $pendiente->id;\r\n $oficial = $pendiente->oficial;\r\n $hijo = $pendiente->hijo;\r\n\r\n $this->template->title.=' | Derivar';\r\n $this->template->styles = array('media/css/tablas.css' => 'screen', 'media/css/fcbk.css' => 'screen', 'media/css/modal.css' => 'screen');\r\n $this->template->scripts = array('media/js/jquery.fcbkcomplete.min.js');\r\n $this->template->content = View::factory('hojaruta/frm_derivacion')\r\n ->bind('documento', $documento)\r\n ->bind('acciones', $acciones)\r\n ->bind('destinatarios', $destinatarios)\r\n ->bind('id_seguimiento', $id_seguimiento)\r\n ->bind('oficial', $oficial)\r\n ->bind('hijo', $hijo)\r\n ->bind('proceso', $proceso)\r\n ->bind('user', $user)\r\n ->bind('user_id', $user_id)\r\n ->bind('errors', $errors);\r\n } else {\r\n $this->request->redirect('seguimiento/?nur=' . $nur);\r\n }\r\n }\r\n } else {\r\n $this->template->content = 'Nur inexistente';\r\n }\r\n }", "public function acessarRelatorios(){\n\n }", "public function contarInventario(){\n\t}", "function sevenconcepts_formulaire_charger($flux){\n $form=$flux['args']['form'];\n if($form=='inscription'){\n include_spip('cextras_pipelines');\n $champs_extras=champs_extras_objet(table_objet_sql('auteur'));\n foreach($champs_extras as $value){\n $flux['data'][$value['options']['nom']]=''; \n if(isset($value['options']['obligatoire']))$flux['data']['obligatoire'][$value['options']['nom']]='on';\n }\n $flux['data']['nom_inscription']='';\n $flux['data']['mail_inscription']='';\n }\n \n return $flux;\n}", "function print_bouton_retour($tpl,$url_retour=\"\",$ou=\"retour_fiche\",$balise=\"bouton_retour\"){\n\tif (empty($url_retour)) $url_retour=\"javascript:history.back();\";\n\t$tpl->assignGlobal($balise, get_bouton_retour($url_retour,$ou));\n}", "function main()\t{\n\t\t\t\t\tglobal $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;\n\n\t\t\t\t\t// Access check!\n\t\t\t\t\t// The page will show only if there is a valid page and if this page may be viewed by the user\n\t\t\t\t\t$this->pageinfo = t3lib_BEfunc::readPageAccess($this->id,$this->perms_clause);\n\t\t\t\t\t$access = is_array($this->pageinfo) ? 1 : 0;\n\t\t\t\t\n\t\t\t\t\tif (($this->id && $access) || ($BE_USER->user['admin'] && !$this->id))\t{\n\n\t\t\t\t\t\t\t// Draw the header.\n\t\t\t\t\t\t$this->doc = t3lib_div::makeInstance('mediumDoc');\n\t\t\t\t\t\t$this->doc->backPath = $BACK_PATH;\n\t\t\t\t\t\t$this->doc->form='<form action=\"\" method=\"post\" enctype=\"multipart/form-data\">';\n\n\t\t\t\t\t\t\t// JavaScript\n\t\t\t\t\t\t$this->doc->JScode = '\n\t\t\t\t\t\t\t<script language=\"javascript\" type=\"text/javascript\">\n\t\t\t\t\t\t\t\tscript_ended = 0;\n\t\t\t\t\t\t\t\tfunction jumpToUrl(URL)\t{\n\t\t\t\t\t\t\t\t\tdocument.location = URL;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tfunction confirmURL(text,URL){\n\t\t\t\t\t\t\t\t\tvar agree=confirm(text);\n\t\t\t\t\t\t\t\t\tif (agree) {\n\t\t\t\t\t\t\t\t\t\tjumpToUrl(URL);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t</script>\n\t\t\t\t\t\t';\n\t\t\t\t\t\t$this->doc->postCode='\n\t\t\t\t\t\t\t<script language=\"javascript\" type=\"text/javascript\">\n\t\t\t\t\t\t\t\tscript_ended = 1;\n\t\t\t\t\t\t\t\tif (top.fsMod) top.fsMod.recentIds[\"web\"] = 0;\n\t\t\t\t\t\t\t</script>\n\t\t\t\t\t\t';\n\n\t\t\t\t\t\t$headerSection = $this->doc->getHeader('pages', $this->pageinfo, $this->pageinfo['_thePath']) . '<br />'\n\t\t\t\t\t\t\t. $LANG->sL('LLL:EXT:lang/locallang_core.xml:labels.path') . ': ' . t3lib_div::fixed_lgd_cs($this->pageinfo['_thePath'], -50);\n\n\t\t\t\t\t\t$this->content.=$this->doc->startPage($LANG->getLL('title'));\n\t\t\t\t\t\t$this->content.=$this->doc->header($LANG->getLL('title'));\n\t\t\t\t\t\t$this->content.=$this->doc->spacer(5);\n\t\t\t\t\t\t$this->content.=$this->doc->section('',$this->doc->funcMenu($headerSection,t3lib_BEfunc::getFuncMenu($this->id,'SET[function]',$this->MOD_SETTINGS['function'],$this->MOD_MENU['function'])));\n\t\t\t\t\t\t$this->content.=$this->doc->divider(5);\n\n\n\t\t\t\t\t\t// Render content:\n\t\t\t\t\t\t$this->moduleContent();\n\n\n\t\t\t\t\t\t// ShortCut\n\t\t\t\t\t\tif ($BE_USER->mayMakeShortcut())\t{\n\t\t\t\t\t\t\t$this->content.=$this->doc->spacer(20).$this->doc->section('',$this->doc->makeShortcutIcon('id',implode(',',array_keys($this->MOD_MENU)),$this->MCONF['name']));\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$this->content.=$this->doc->spacer(10);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// If no access or if ID == zero\n\n\t\t\t\t\t\t$this->doc = t3lib_div::makeInstance('mediumDoc');\n\t\t\t\t\t\t$this->doc->backPath = $BACK_PATH;\n\n\t\t\t\t\t\t$this->content.=$this->doc->startPage($LANG->getLL('title'));\n\t\t\t\t\t\t$this->content.=$this->doc->header($LANG->getLL('title'));\n\t\t\t\t\t\t$this->content.=$this->doc->spacer(5);\n\t\t\t\t\t\t$this->content.=$this->doc->spacer(10);\n\t\t\t\t\t}\n\t\t\t\t\n\t\t\t\t}", "public function principal()\n\t {\n\t\t require_once('../../site_media/html/asignar_cursos/ac_Admin.php');\n\t }", "function exec_suivi() {\n\t$id_auteur = (int) _request('id_auteur');\n\t$id_article = (int) _request('id_article');\n\t$nouv_auteur = (int) _request('nouv_auteur');\n\t$contexte = array();\n\t$idper = '';\n\t$nom = '';\n\t$prenom = '';\n\t$statutauteur = '6forum';\n\t$inscrit = '';\n\t$statutsuivi = '';\n\t$date_suivi = '';\n\t$heure_suivi = '';\n\n\t//Addon fields\n\t$sante_comportement = '';\n\t$alimentation = '';\n\t$remarques_inscription = '';\n\t$ecole = '';\n\t$places_voitures = '';\n\t$brevet_animateur = '';\n\t$historique_payement = '';\n\t$extrait_de_compte = '';\n\t$statut_payement = '';\n\t$tableau_exception = '';\n\t$recus_fiche_medical = '';\n $facture = '';\n $adresse_facturation = '';\n\n\n\t//----------- lire DB ---------- AND id_secteur=2\n\t$req = sql_select('id_article,idact,titre,date_debut', 'spip_articles', \"id_article=$id_article\");\n\tif ($data = sql_fetch($req)) {\n $idact = $data['idact'];\n\t\t$titre = $data['titre'];\n $date_debut = $data['date_debut'];\n\t}\n\telse\n\t\t$id_article = 0;\n\n\t$req = sql_select('*', \n \"spip_auteurs AS A LEFT JOIN spip_auteurs_articles AS S ON S.id_auteur=$id_auteur AND S.id_article=$id_article AND S.inscrit<>''\", \"A.id_auteur=$id_auteur\");\n\tif ($data = sql_fetch($req)) {\n\t\t$idper = $data['idper'];\n\t\t$nom = $data['nom'];\n\t\t$prenom = $data['prenom'];\n\t\t$statutauteur = $data['statut'];\n\t\tif ($data['inscrit']) {\n\t\t\t$inscrit = 'Y';\n\t\t\t$statutsuivi = $data['statutsuivi'];\n\t\t\t$date_suivi = $data['date_suivi'];\n\t\t\t$heure_suivi = $data['heure_suivi'];\n\n\t\t\t$sante_comportement = $data['sante_comportement'];\n\t\t\t$alimentation = $data['alimentation'];\n\t\t\t$remarques_inscription = $data['remarques_inscription'];\n\t\t\t$ecole = $data['ecole'];\n\t\t\t$places_voitures = $data['places_voitures'];\n\t\t\t$brevet_animateur = $data['brevet_animateur'];\n\t\t\t$historique_payement = $data['historique_payement'];\n\t\t\t$extrait_de_compte = $data['extrait_de_compte'];\n\t\t\t$statut_payement = $data['statut_payement'];\n\t\t\t$tableau_exception = $data['tableau_exception'];\n\t\t\t$recus_fiche_medical = $data['recus_fiche_medical'];\n\t\t\t$prix_special = $data['prix_special'];\n $facture = $data['facture'];\n $adresse_facturation = $data['adresse_facturation'];\n\t\t}\n\t}\n\telse\n\t\t$id_auteur = 0;\n\n\t//-------- form soumis -----------\n\tif (_request('okconfirm') && $id_article && ($id_auteur || $nouv_auteur))\n\t\tif ($GLOBALS['connect_statut']!='0minirezo' || ! autoriser('modifier', 'article', $id_article))\n\t\t\t$contexte['message_erreur'] = 'Autorisation refusée';\n\t\telse {\n\t\t\t$statutsuivi = _request('statutsuivi');\n\t\t\t$date_suivi = _request('date_suivi');\n\t\t\t$heure_suivi = _request('heure_suivi');\n \n $sante_comportement = _request('sante_comportement');\n $alimentation = _request('alimentation');\n $remarques_inscription = _request('remarques_inscription');\n $ecole = _request('ecole');\n $places_voitures = _request('places_voitures');\n $brevet_animateur = _request('brevet_animateur');\n $extrait_de_compte = _request('extrait_de_compte');\n $historique_payement = str_replace(',', '.', _request('historique_payement'));\n $statut_payement = _request('statut_payement');\n $tableau_exception = _request('tableau_exception');\n $recus_fiche_medical = _request('recus_fiche_medical');\n $prix_special = _request('prix_special');\n $facture = _request('facture');\n $adresse_facturation = _request('adresse_facturation');\n\n\t\t\tinclude_spip('inc/date_gestion');\n\t\t\t$contexte['erreurs'] = array();\n\t\t\tif (@verifier_corriger_date_saisie('suivi', false, $contexte['erreurs']))\n\t\t\t\t$date_suivi = substr($date_suivi, 6, 4).'-'.substr($date_suivi, 3, 2).'-'.substr($date_suivi, 0, 2);\n\t\t\telse\n\t\t\t\t$contexte['message_erreur'] = 'Erreur';\n\n\t\t\tif (! $contexte['message_erreur'])\n\t\t\t\tif ($nouv_auteur) {\n\t\t\t\t\t$req = sql_select('A.id_auteur,id_article',\"spip_auteurs AS A LEFT JOIN spip_auteurs_articles AS S ON S.id_auteur=$nouv_auteur AND S.id_article=$id_article\", \"A.id_auteur=$nouv_auteur\");\n\t\t\t\t\tif ($data = sql_fetch($req)) {\n\t\t\t\t\t\t$id_auteur = $data['id_auteur'];\n\t\t\t\t\t\tif (! $data['id_article'])\n\t\t\t\t\t\t\tsql_insertq('spip_auteurs_articles', array('id_auteur'=>$id_auteur, 'id_article'=>$id_article, 'inscrit'=>'Y'));\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t$contexte['message_erreur'] = 'Erreur';\n\t\t\t\t\t\t$contexte['erreurs']['nouv_auteur'] = 'auteur ID inconnu';\n\t\t\t\t\t\t$id_auteur = 0;\n\t\t\t\t\t\t$inscrit = '';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tif ($id_auteur && ! $contexte['message_erreur']) {\n\t\t\t\tsql_updateq('spip_auteurs_articles', \n array(\n \t\t'inscrit'=>'Y', \n \t\t'statutsuivi'=>$statutsuivi, \n \t\t'date_suivi'=>$date_suivi, \n \t\t'heure_suivi'=>$heure_suivi,\n \t'sante_comportement'=>$sante_comportement,\n \t'alimentation'=>$alimentation,\n \t'remarques_inscription'=>$remarques_inscription,\n \t'ecole'=>$ecole,\n \t'brevet_animateur'=>$brevet_animateur,\n \t'places_voitures'=>$places_voitures,\n \t'extrait_de_compte' => $extrait_de_compte,\n \t'historique_payement' => $historique_payement,\n \t'statut_payement' => $statut_payement,\n \t'tableau_exception' => $tableau_exception,\n \t'recus_fiche_medical' => $recus_fiche_medical,\n \t'prix_special' => $prix_special,\n 'facture' => $facture,\n 'adresse_facturation' => $adresse_facturation\n ), \"id_auteur=$id_auteur AND id_article=$id_article\");\n\n // On fait l'update de la date_validation via sql_update plutôt que sql_updateq.\n sql_update('spip_auteurs_articles', array('date_validation' => 'NOW()'), 'id_auteur='.sql_quote($id_auteur).' AND id_article='.sql_quote($id_article));\n\t\t\t\t$contexte['message_ok'] = 'Ok, l\\'inscription est mise à jour';\n\t\t\t\t$inscrit = 'Y';\n\n /*\n * Si c'est une nouvelle inscription faite par un admin, on envoie un mail\n */\n if (_request('new') == 'oui') {\n $p = 'Bonjour,'.\"\\n\\n\".'Voici une nouvelle inscription :'.\"\\n\\n\";\n $p .= 'Sexe : '.$data['codecourtoisie'].\"\\n\";\n $p .= 'Prénom : '.$prenom.\"\\n\";\n $p .= 'Nom : '.$nom.\"\\n\";\n $p .= 'e-mail : '.$data['email'].\"\\n\";\n $p .= 'Date naissance : '.$data['date_naissance'].\"\\n\";\n $p .= 'Lieu naissance : '.$data['lieunaissance'].\"\\n\";\n \n $p .= 'Adresse : '.$data['adresse'].\"\\n\";\n $p .= 'No : '.$data['adresse_no'].\"\\n\";\n $p .= 'Code postal : '.$data['codepostal'].\"\\n\";\n $p .= 'Localité : '.$data['localite'].\"\\n\";\n $p .= 'Téléphone : '.$data['tel1'].\"\\n\";\n $p .= 'GSM : '.$data['gsm1'].\"\\n\";\n $p .= 'Fax : '.$data['fax1'].\"\\n\";\n \n $p .= \"\\n*******\\n\\n\";\n \n $p .= 'Études en cours et établissement : '.$data['etude_etablissement'].\"\\n\";\n $p .= 'Profession : '.$data['profession'].\"\\n\";\n $p .= 'Demandeur d’emploi : '.$data['demandeur_emploi'].\"\\n\";\n $p .= 'Membre d’une association : '.$data['membre_assoc'].\"\\n\";\n $p .= 'Pratique : '.$data['pratique'].\"\\n\";\n $p .= 'Formations : '.$data['formation'].\"\\n\";\n $p .= 'Facture : '.$data['facture'].\"\\n\";\n $p .= 'Adresse de facturation : '.$data['adresse_facturation'].\"\\n\";\n $p .= 'Régime alimentaire : '.$alimentation.\"\\n\";\n $p .= 'Places dans votre voiture : '.$places_voitures.\"\\n\";\n $p .= 'Brevet d’animateur : '.$brevet_animateur.\"\\n\";\n $p .= 'Remarques : '.$remarques_inscription.\"\\n\";\n \n $p .= \"\\n*******\\n\\n\";\n \n $p .= 'id_auteur : '.$id_auteur.\"\\n\";\n $p .= 'Statut : '.$statutsuivi.\"\\n\";\n $p .= 'Action : '.$titre.\"\\n\";\n $p .= 'Dates : '.$date_debut.\"\\n\";\n $p .= 'id_article : '.$id_article.\"\\n\";\n $p .= \"\\n\".'-----'.\"\\n\";\n\n\n $envoyer_mail = charger_fonction('envoyer_mail','inc');\n \n $p = $envoyer_mail(\n $GLOBALS['meta']['email_webmaster'].', [email protected]',\n $GLOBALS['meta']['nom_site'].' : nouvelle inscription '.$data['idact'].'-'.$id_auteur, \n $p,\n $GLOBALS['meta']['email_webmaster']);\n \n }\n\n\n\t\t\t\tinclude_spip('inc/headers');\n\t\t\t\tredirige_par_entete(parametre_url('?exec=articles', 'id_article', $id_article, '&'));\n\t\t\t\texit();\n\t\t\t}\n\t\t}\n\n\t//-------- desinscrire -----------\n\tif (_request('noinscr') && $id_article && $id_auteur)\n\t\tif ($GLOBALS['connect_statut']!='0minirezo' || ! autoriser('modifier', 'article', $id_article))\n\t\t\t$contexte['message_erreur'] = 'Autorisation refusée';\n\t\telse {\n\t\t\tif ($statutauteur == '6forum')\n\t\t\t\tsql_delete('spip_auteurs_articles', \"id_auteur=$id_auteur AND id_article=$id_article\");\n\t\t\telse\n\t\t\t\tsql_updateq('spip_auteurs_articles', array('inscrit'=>''), \"id_auteur=$id_auteur AND id_article=$id_article\");\n\t\t\t$inscrit = '';\n\t\t\t$contexte['message_ok'] = 'Ok, la désinscription est faite';\n\t\t\tinclude_spip('inc/headers');\n\t\t\tredirige_par_entete(parametre_url('?exec=articles', 'id_article', $id_article, '&'));\n\t\t\texit();\n\t\t}\n\n\t//--------- page + formulaire ---------\n\t\t$commencer_page = charger_fonction('commencer_page', 'inc');\n\t\techo $commencer_page('Suivi des inscriptions', '', '');\n\n\t\techo '<br />',gros_titre('Suivi des inscriptions');\n\n\t\techo debut_gauche('', true);\n\t\techo debut_boite_info(true);\n\t\techo 'Suivi des inscriptions<br /><br />Explications',\"\\n\";\n\t\techo fin_boite_info(true);\n\n\t\techo debut_droite('', true);\n\n\t\tinclude_spip('fonctions_gestion_cemea');\n\t\tinclude_spip('prive/gestion_update_db');\n\n\t\techo debut_cadre_relief('', true, '', '');\n\n\t\t$contexte['id_article'] = $id_article;\n\t\t$contexte['id_auteur'] = $id_auteur;\n\t\t$contexte['idact'] = $idact;\n\t\t$contexte['titre'] = $titre;\n\t\t$contexte['idper'] = $idper;\n\t\t$contexte['nom'] = $nom;\n\t\t$contexte['prenom'] = $prenom;\n\t\t$contexte['inscrit'] = $inscrit;\n\t\t$contexte['statutsuivi'] = $statutsuivi;\n\t\t$contexte['date_suivi'] = $date_suivi;\n\t\t$contexte['heure_suivi'] = $heure_suivi;\n\n\t\t$contexte['sante_comportement'] = $sante_comportement;\n\t\t$contexte['alimentation'] = $alimentation;\n\t\t$contexte['remarques_inscription'] = $remarques_inscription;\n\t\t$contexte['ecole'] = $ecole;\n\t\t$contexte['places_voitures'] = $places_voitures;\n\t\t$contexte['brevet_animateur'] = $brevet_animateur;\n\t\t$contexte['extrait_de_compte'] = $extrait_de_compte;\n\t\t$contexte['historique_payement'] = str_replace('.', ',', $historique_payement);\n\t\t$contexte['statut_payement'] = $statut_payement;\n\t\t$contexte['tableau_exception'] = $tableau_exception;\n\t\t$contexte['recus_fiche_medical'] = $recus_fiche_medical;\n\t\t$contexte['prix_special'] = $prix_special;\n $contexte['facture'] = $facture;\n $contexte['adresse_facturation'] = $adresse_facturation;\n\n\t\t$contexte['editable'] = ' ';\n\n\t\t$milieu = recuperer_fond(\"prive/form_suivi\", $contexte);\n\t\techo pipeline('editer_contenu_objet',array('args'=>array('type'=>'auteurs_article','contexte'=>$contexte),'data'=>$milieu));\n\n\t\techo fin_cadre_relief(true);\n\t\techo fin_gauche();\n\t\techo fin_page();\n}", "public function commandeuser() {\n\t\t$users = new Model_Users();\n\t\t$id_users = '1';\n\t\t$commandeUser = $users->commandeUsers($id_users);\n\t\trequire_once($_SERVER['DOCUMENT_ROOT'].\"/ecommerce/views/users/commandeuser.php\");\n\t}", "function affiche_relais_demande () {\n\t\tglobal $bdd;\n\t\t\n\t\t$req = $bdd->query(\"SELECT * FROM relais_mail JOIN utilisateur ON relais_mail.utilisateur_id_utilisateur = utilisateur.id_utilisateur WHERE status_relais = '2'\");\n\t\treturn $req;\n\t\t\n\t\t$req->closeCursor();\n\t}", "function wtsProPaiement($ar){\n $p = new XParam($ar, array());\n $orderoid = $p->get('orderoid');\n // verification du client de la commande et du compte connecte\n list($okPaiement, $mess) = $this->paiementEnCompte($orderoid);\n if (!$okPaiement){\n XLogs::critical(get_class($this), 'paiement pro refusé '.$orderoid.' '.$mess);\n XShell::setNext($GLOBALS['TZR_SESSION_MANAGER']::complete_self(true, true).'&alias='.$this->aliasvente.'&moid='.$this->_moid.'&function=wtsLireOffres');\n return;\n }\n // traitement post commande std\n clearSessionVar('caddie');\n XLogs::critical(get_class($this), 'enregistrement paiement en compte '.$orderoid);\n // traitement standards après validation\n $this->postOrderActions($orderoid, true);\n\n // traitement post order - devrait être dans postOrderActions\n $this->proPostOrderActions($orderoid);\n\n // retour \n if (defined('EPL_ALIAS_PAIEMENT_ENCOMPTE')){\n XShell::setNext($GLOBALS['TZR_SESSION_MANAGER']::complete_self().'alias='.EPL_ALIAS_PAIEMENT_ENCOMPTE);} else {\n XShell::setNext($GLOBALS['TZR_SESSION_MANAGER']::complete_self(true, true).'&alias='.$this->aliasvente.'&moid='.$this->_moid.'&function=wtsLireOffres');\n }\n }", "function Geral() {\r\n \r\n extract($GLOBALS);\r\n global $w_Disabled;\r\n $w_chave = $_REQUEST['w_chave'];\r\n $w_sq_tipo_lancamento = $_REQUEST['w_sq_tipo_lancamento'];\r\n $w_readonly = '';\r\n $w_erro = '';\r\n\r\n // Carrega o segmento cliente\r\n $sql = new db_getCustomerData; $RS = $sql->getInstanceOf($dbms,$w_cliente); \r\n $w_segmento = f($RS,'segmento');\r\n \r\n // Verifica se há necessidade de recarregar os dados da tela a partir\r\n // da própria tela (se for recarga da tela) ou do banco de dados (se não for inclusão)\r\n if ($w_troca>'' && $O!='E') {\r\n // Se for recarga da página\r\n $w_codigo_interno = $_REQUEST['w_codigo_interno'];\r\n $w_sq_tipo_lancamento = $_REQUEST['w_sq_tipo_lancamento'];\r\n $w_sq_tipo_documento = $_REQUEST['w_sq_tipo_documento'];\r\n $w_descricao = $_REQUEST['w_descricao'];\r\n $w_valor = $_REQUEST['w_valor'];\r\n $w_fim = $_REQUEST['w_fim'];\r\n $w_conta_debito = $_REQUEST['w_conta_debito'];\r\n $w_sq_forma_pagamento = $_REQUEST['w_sq_forma_pagamento'];\r\n $w_cc_debito = $_REQUEST['w_cc_debito'];\r\n $w_cc_credito = $_REQUEST['w_cc_credito'];\r\n\r\n } elseif(strpos('AEV',$O)!==false || $w_copia>'') {\r\n // Recupera os dados do lançamento\r\n $sql = new db_getSolicData; \r\n $RS = $sql->getInstanceOf($dbms,nvl($w_copia,$w_chave),$SG);\r\n if (count($RS)>0) {\r\n $w_codigo_interno = f($RS,'codigo_interno');\r\n $w_sq_tipo_lancamento = f($RS,'sq_tipo_lancamento');\r\n $w_conta_debito = f($RS,'sq_pessoa_conta');\r\n $w_descricao = f($RS,'descricao');\r\n $w_fim = formataDataEdicao(f($RS,'fim'));\r\n $w_valor = formatNumber(f($RS,'valor'));\r\n $w_sq_forma_pagamento = f($RS,'sq_forma_pagamento');\r\n $w_cc_debito = f($RS,'cc_debito');\r\n $w_cc_credito = f($RS,'cc_credito');\r\n }\r\n }\r\n\r\n // Recupera dados do comprovante\r\n if (nvl($w_troca,'')=='' && (nvl($w_copia,'')!='' || nvl($w_chave,'')!='')) {\r\n $sql = new db_getLancamentoDoc; $RS = $sql->getInstanceOf($dbms,nvl($w_copia,$w_chave),null,null,null,null,null,null,'DOCS');\r\n $RS = SortArray($RS,'sq_tipo_documento','asc');\r\n foreach ($RS as $row) {$RS=$row; break;}\r\n if (nvl($w_copia,'')=='') $w_chave_doc = f($RS,'sq_lancamento_doc'); // Se cópia, não copia a chave do documento \r\n $w_sq_tipo_documento = f($RS,'sq_tipo_documento');\r\n $w_numero = f($RS,'numero');\r\n $w_data = FormataDataEdicao(f($RS,'data'));\r\n $w_serie = f($RS,'serie');\r\n $w_valor_doc = formatNumber(f($RS,'valor'));\r\n $w_patrimonio = f($RS,'patrimonio');\r\n $w_tributo = f($RS,'calcula_tributo');\r\n $w_retencao = f($RS,'calcula_retencao'); \r\n }\r\n\r\n // Default: pagamento para pessoa jurídica\r\n $w_tipo_pessoa = nvl($w_tipo_pessoa,2);\r\n \r\n // Recupera o trâmite de conclusão\r\n $sql = new db_getTramiteList; $RS = $sql->getInstanceOf($dbms, $w_menu,null,null,null);\r\n $RS = SortArray($RS,'ordem','asc');\r\n foreach ($RS as $row) {\r\n if (f($row,'sigla')=='AT') {\r\n $w_tramite_conc = f($row,'sq_siw_tramite');\r\n break;\r\n }\r\n }\r\n \r\n // Verifica as formas de pagamento possíveis. Se apenas uma, atribui direto\r\n $sql = new db_getFormaPagamento; $RS = $sql->getInstanceOf($dbms, $w_cliente, null, $SG, null,'S',null);\r\n $w_exibe_fp = true;\r\n if (count($RS)==1 || nvl($w_sq_forma_pagamento,'')!='') {\r\n foreach($RS as $row) { \r\n if (nvl($w_sq_forma_pagamento,f($row,'sq_forma_pagamento'))==f($row,'sq_forma_pagamento')) {\r\n $w_sq_forma_pagamento = f($row,'sq_forma_pagamento'); \r\n $w_forma_pagamento = f($row,'sigla'); \r\n $w_nm_forma_pagamento = f($row,'nome'); \r\n break; \r\n }\r\n }\r\n if (count($RS)==1) $w_exibe_fp = false;\r\n }\r\n \r\n // Verifica os tipos de documento possíveis. Se apenas um, atribui direto\r\n $sql = new db_getTipoDocumento; $RS = $sql->getInstanceOf($dbms,null,$w_cliente,$w_menu,null);\r\n $w_exibe_dc = true;\r\n if (count($RS)==1) {\r\n foreach($RS as $row) { \r\n $w_sq_tipo_documento = f($row,'chave'); \r\n $w_tipo_documento = f($row,'sigla'); \r\n $w_nm_tipo_documento = f($row,'nome'); \r\n break; \r\n }\r\n $w_exibe_dc = false;\r\n }\r\n\r\n // Se o tipo de lançamento já foi informado, recupera o código externo para definir a conta contábil de débito\r\n if ($w_sq_tipo_lancamento) {\r\n $sql = new db_getTipoLancamento; $RS = $sql->getInstanceOf($dbms,$w_sq_tipo_lancamento,null,$w_cliente,null);\r\n $w_cc_debito = f($RS[0],'codigo_externo');\r\n }\r\n \r\n // Retorna as contas contábeis do lançamento\r\n retornaContasContabeis($RS_Menu, $w_cliente, $w_sq_tipo_lancamento, $w_sq_forma_pagamento, $w_conta_debito, $w_cc_debito, $w_cc_credito);\r\n \r\n Cabecalho();\r\n head();\r\n Estrutura_CSS($w_cliente);\r\n // Monta o código JavaScript necessário para validação de campos e preenchimento automático de máscara,\r\n // tratando as particularidades de cada serviço\r\n ScriptOpen('JavaScript');\r\n CheckBranco();\r\n FormataData();\r\n SaltaCampo();\r\n FormataDataHora();\r\n FormataValor();\r\n ShowHTML('function botoes() {');\r\n ShowHTML(' document.Form.Botao[0].disabled = true;');\r\n ShowHTML(' document.Form.Botao[1].disabled = true;');\r\n ShowHTML('}');\r\n ValidateOpen('Validacao');\r\n if ($O=='I' || $O=='A') {\r\n Validate('w_sq_tipo_lancamento','Tipo do lançamento','SELECT',1,1,18,'','0123456789');\r\n if ($w_exibe_fp) Validate('w_sq_forma_pagamento','Forma de pagamento','SELECT',1,1,18,'','0123456789');\r\n Validate('w_conta_debito','Conta bancária', 'SELECT', 1, 1, 18, '', '0123456789');\r\n if ($w_exibe_dc) Validate('w_sq_tipo_documento','Tipo de documento','SELECT',1,1,18,'','0123456789');\r\n Validate('w_fim','Data da operação', 'DATA', '1', '10', '10', '', '0123456789/');\r\n Validate('w_valor','Valor total do documento','VALOR','1',4,18,'','0123456789.,-');\r\n CompValor('w_valor','Valor total do documento','>','0,00','zero');\r\n Validate('w_descricao','Observação','1','',5,2000,'1','1');\r\n \r\n Validate('w_cc_debito','Conta Débito','','','2','25','ABCDEFGHIJKLMNOPQRSTUVWXYZ','0123456789');\r\n Validate('w_cc_credito','Conta Crédito','','','2','25','ABCDEFGHIJKLMNOPQRSTUVWXYZ','0123456789');\r\n \r\n ShowHTML(' if ((theForm.w_cc_debito.value != \"\" && theForm.w_cc_credito.value == \"\") || (theForm.w_cc_debito.value == \"\" && theForm.w_cc_credito.value != \"\")) {');\r\n ShowHTML(' alert (\"Informe ambas as contas contábeis ou nenhuma delas!\");');\r\n ShowHTML(' theForm.w_cc_debito.focus();');\r\n ShowHTML(' return false;');\r\n ShowHTML(' }');\r\n \r\n } \r\n Validate('w_assinatura',$_SESSION['LABEL_ALERTA'], '1', '1', '3', '30', '1', '1');\r\n ValidateClose();\r\n ScriptClose();\r\n ShowHTML('<BASE HREF=\"'.$conRootSIW.'\">');\r\n ShowHTML('</HEAD>');\r\n if ($w_troca>'') BodyOpen('onLoad=\\'document.Form.'.$w_troca.'.focus()\\';');\r\n elseif (!(strpos('EV',$O)===false)) BodyOpen('onLoad=\\'this.focus()\\';');\r\n else BodyOpen('onLoad=\\'document.Form.w_sq_tipo_lancamento.focus()\\';');\r\n Estrutura_Topo_Limpo();\r\n Estrutura_Menu();\r\n Estrutura_Corpo_Abre();\r\n Estrutura_Texto_Abre();\r\n ShowHTML('<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">');\r\n if ($w_chave>'') ShowHTML(' <tr><td><font size=\"2\"><b>'.$w_codigo_interno.' ('.$w_chave.')</b></td>');\r\n if (strpos('IAEV',$O)!==false) {\r\n if (strpos('EV',$O)!==false) {\r\n $w_Disabled=' DISABLED ';\r\n if ($O=='V') $w_Erro = Validacao($w_sq_solicitacao,$SG);\r\n } \r\n if (Nvl($w_pais,'')=='') {\r\n // Carrega os valores padrão para país, estado e cidade\r\n $sql = new db_getCustomerData; $RS = $sql->getInstanceOf($dbms,$w_cliente);\r\n $w_pais = f($RS,'sq_pais');\r\n $w_uf = f($RS,'co_uf');\r\n $w_cidade = Nvl(f($RS_Menu,'sq_cidade'),f($RS,'sq_cidade_padrao'));\r\n } \r\n AbreForm('Form',$w_dir.$w_pagina.'Grava','POST','return(Validacao(this));',null,$P1,$P2,$P3,$P4,$TP,$SG,$R,$O);\r\n ShowHTML(MontaFiltro('POST'));\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_troca\" value=\"\">');\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_copia\" value=\"'.$w_copia.'\">');\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_chave\" value=\"'.$w_chave.'\">');\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_codigo_interno\" value=\"'.$w_codigo_interno.'\">');\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_menu\" value=\"'.f($RS_Menu,'sq_menu').'\">');\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_data_hora\" value=\"'.f($RS_Menu,'data_hora').'\">');\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_cidade\" value=\"'.$w_cidade.'\">');\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_tramite\" value=\"'.$w_tramite_conc.'\">');\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_tipo\" value=\"'.$w_tipo.'\">');\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_chave_doc\" value=\"'.$w_chave_doc.'\">');\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_tipo_pessoa\" value=\"'.$w_tipo_pessoa.'\">');\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_aviso\" value=\"N\">');\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_dias\" value=\"0\">');\r\n ShowHTML('<tr bgcolor=\"'.$conTrBgColor.'\"><td>');\r\n ShowHTML(' <table width=\"100%\" border=\"0\">');\r\n ShowHTML(' <tr><td colspan=3 align=\"center\" height=\"2\" bgcolor=\"#000000\"></td></tr>');\r\n ShowHTML(' <tr><td colspan=3 align=\"center\" height=\"1\" bgcolor=\"#000000\"></td></tr>');\r\n ShowHTML(' <tr><td colspan=3 align=\"center\" bgcolor=\"#D0D0D0\"><b>Identificação</td></td></tr>');\r\n ShowHTML(' <tr><td colspan=3 align=\"center\" height=\"1\" bgcolor=\"#000000\"></td></tr>');\r\n ShowHTML(' <tr><td colspan=3>Os dados deste bloco serão utilizados para identificação do lançamento, bem como para o controle de sua execução.</td></tr>');\r\n ShowHTML(' <tr><td colspan=3 align=\"center\" height=\"1\" bgcolor=\"#000000\"></td></tr>');\r\n\r\n ShowHTML(' <tr valign=\"top\">');\r\n selecaoTipoLancamento('Tipo de lançamento:',null,null,$w_sq_tipo_lancamento,$w_menu,$w_cliente,'w_sq_tipo_lancamento',$SG, 'onChange=\"document.Form.action=\\''.$w_dir.$w_pagina.$par.'\\'; document.Form.O.value=\\''.$O.'\\'; document.Form.w_troca.value=\\''.(($w_exibe_fp) ? 'w_sq_forma_pagamento' : 'w_conta_debito').'\\'; document.Form.submit();\"',3);\r\n ShowHTML(' <tr valign=\"top\">');\r\n if ($w_exibe_fp) {\r\n SelecaoFormaPagamento('<u>F</u>orma de pagamento:','F','Selecione na lista a forma desejada para esta aplicação.',$w_sq_forma_pagamento,$SG,'w_sq_forma_pagamento',null,'onChange=\"document.Form.action=\\''.$w_dir.$w_pagina.$par.'\\'; document.Form.O.value=\\''.$O.'\\'; document.Form.w_troca.value=\\'w_conta_debito\\'; document.Form.submit();\"');\r\n } else {\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_sq_forma_pagamento\" value=\"'.$w_sq_forma_pagamento.'\">');\r\n }\r\n SelecaoContaBanco('<u>C</u>onta bancária:','C','Selecione a conta bancária envolvida no lançamento.',$w_conta_debito,null,'w_conta_debito',null,'onChange=\"document.Form.action=\\''.$w_dir.$w_pagina.$par.'\\'; document.Form.O.value=\\''.$O.'\\'; document.Form.w_troca.value=\\''.(($w_exibe_dc) ? 'w_sq_tipo_documento' : 'w_fim').'\\'; document.Form.submit();\"');\r\n ShowHTML(' </tr>');\r\n ShowHTML(' <tr valign=\"top\">');\r\n if ($w_exibe_dc) {\r\n SelecaoTipoDocumento('<u>T</u>ipo do documento:','T', 'Selecione o tipo de documento.', $w_sq_tipo_documento,$w_cliente,$w_menu,'w_sq_tipo_documento',null,null);\r\n } else {\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_sq_tipo_documento\" value=\"'.$w_sq_tipo_documento.'\">');\r\n }\r\n ShowHTML(' <td><b><u>D</u>ata da operação:</b><br><input '.$w_Disabled.' accesskey=\"D\" type=\"text\" name=\"w_fim\" class=\"sti\" SIZE=\"10\" MAXLENGTH=\"10\" VALUE=\"'.$w_fim.'\" onKeyDown=\"FormataData(this,event);\" onKeyUp=\"SaltaCampo(this.form.name,this,10,event);\">'.ExibeCalendario('Form','w_fim').'</td>');\r\n ShowHTML(' <td><b><u>V</u>alor:</b><br><input '.$w_Disabled.' accesskey=\"V\" type=\"text\" name=\"w_valor\" class=\"sti\" SIZE=\"18\" MAXLENGTH=\"18\" VALUE=\"'.$w_valor.'\" style=\"text-align:right;\" onKeyDown=\"FormataValor(this,18,2,event);\" title=\"Informe o valor total do documento.\"></td>');\r\n ShowHTML(' <tr><td colspan=3><b><u>O</u>bservação:</b><br><textarea '.$w_Disabled.' accesskey=\"O\" name=\"w_descricao\" class=\"sti\" ROWS=3 cols=75 title=\"Observação sobre a aplicação.\">'.$w_descricao.'</TEXTAREA></td>');\r\n\r\n ShowHTML(' <tr valign=\"top\">');\r\n ShowHTML(' <td><b><u>C</u>onta contábil de débito:</b></br><input type=\"text\" name=\"w_cc_debito\" class=\"sti\" SIZE=\"11\" MAXLENGTH=\"25\" VALUE=\"'.$w_cc_debito.'\"></td>');\r\n ShowHTML(' <td><b><u>C</u>onta contábil de crédito:</b></br><input type=\"text\" name=\"w_cc_credito\" class=\"sti\" SIZE=\"11\" MAXLENGTH=\"25\" VALUE=\"'.$w_cc_credito.'\"></td>');\r\n \r\n ShowHTML(' <tr><td align=\"LEFT\" colspan=4><b>'.$_SESSION['LABEL_CAMPO'].':<BR> <INPUT ACCESSKEY=\"A\" class=\"sti\" type=\"PASSWORD\" name=\"w_assinatura\" size=\"30\" maxlength=\"30\" value=\"\"></td></tr>');\r\n ShowHTML(' <tr><td align=\"center\" colspan=\"3\" height=\"1\" bgcolor=\"#000000\"></TD></TR>');\r\n ShowHTML(' <tr><td align=\"center\" colspan=\"3\">');\r\n ShowHTML(' <input class=\"stb\" type=\"submit\" name=\"Botao\" value=\"Gravar\">');\r\n if ($P1==0) {\r\n ShowHTML(' <input class=\"STB\" type=\"button\" onClick=\"location.href=\\''.montaURL_JS($w_dir,'tesouraria.php?par=inicial&O=L&P1='.$P1.'&P2='.$P2.'&P3='.$P3.'&P4='.$P4.'&TP='.$TP.'&SG='.MontaFiltro('GET')).'\\';\" name=\"Botao\" value=\"Abandonar\">');\r\n } else {\r\n $sql = new db_getMenuData; $RS = $sql->getInstanceOf($dbms,$w_menu);\r\n ShowHTML(' <input class=\"stb\" type=\"button\" onClick=\"location.href=\\''.montaURL_JS($w_dir,$R.'&w_copia='.$w_copia.'&O=L&SG='.f($RS,'sigla').'&P1='.$P1.'&P2='.$P2.'&P3='.$P3.'&P4='.$P4.'&TP='.$TP.MontaFiltro('GET')).'\\';\" name=\"Botao\" value=\"Cancelar\">');\r\n }\r\n ShowHTML(' </td>');\r\n \r\n ShowHTML(' </tr>');\r\n ShowHTML(' </table>');\r\n ShowHTML(' </TD>');\r\n ShowHTML('</tr>');\r\n ShowHTML('</FORM>');\r\n } else {\r\n ScriptOpen('JavaScript');\r\n ShowHTML(' alert(\"Opção não disponível\");');\r\n ScriptClose();\r\n } \r\n ShowHTML('</table>');\r\n ShowHTML('</center>');\r\n Estrutura_Texto_Fecha();\r\n Estrutura_Fecha();\r\n Estrutura_Fecha();\r\n Estrutura_Fecha();\r\n Rodape();\r\n}", "function cl_rhemitecontracheque() { \n //classes dos rotulos dos campos\n $this->rotulo = new rotulo(\"rhemitecontracheque\"); \n $this->pagina_retorno = basename($GLOBALS[\"HTTP_SERVER_VARS\"][\"PHP_SELF\"]);\n }", "public function saisie() {\r\n if (!isAuth(315)) {\r\n return;\r\n }\r\n if (!empty($this->request->punipar)) {\r\n $params = [\"eleve\" => $this->request->comboEleves,\r\n \"datepunition\" => $this->request->datepunition,\r\n \"dateenregistrement\" => date(\"Y-m-d\", time()),\r\n \"duree\" => $this->request->duree,\r\n \"typepunition\" => $this->request->comboTypes,\r\n \"motif\" => $this->request->motif,\r\n \"description\" => $this->request->description,\r\n \"punipar\" => $this->request->punipar,\r\n \"enregistrerpar\" => $this->session->user,\r\n \"anneeacademique\" => $this->session->anneeacademique];\r\n $this->Punition->insert($params);\r\n $this->sendNotification($this->request->comboEleves, $this->request->datepunition, \r\n $this->request->duree, $this->request->motif, $this->request->comboTypes);\r\n header(\"Location:\" . Router::url(\"punition\"));\r\n }\r\n $this->view->clientsJS(\"punition\" . DS . \"punition\");\r\n $view = new View();\r\n\r\n $type = $this->Typepunition->selectAll();\r\n $comboTypes = new Combobox($type, \"comboTypes\", $this->Typepunition->getKey(), $this->Typepunition->getLibelle());\r\n $comboTypes->first = \" \";\r\n $view->Assign(\"comboTypes\", $comboTypes->view());\r\n $view->Assign(\"comboClasses\", $this->comboClasses->view());\r\n\r\n $personnels = $this->Personnel->selectAll();\r\n $comboPersonnels = new Combobox($personnels, \"comboPersonnels\", $this->Personnel->getKey(), $this->Personnel->getLibelle());\r\n $comboPersonnels->first = \" \";\r\n $view->Assign(\"comboPersonnels\", $comboPersonnels->view());\r\n\r\n $content = $view->Render(\"punition\" . DS . \"saisie\", false);\r\n $this->Assign(\"content\", $content);\r\n //$this->Assign(\"content\", (new View())->output());\r\n }", "function ooffice_write_referentiel( $referentiel_instance, $referentiel_referentiel, $param){\r\n global $CFG;\r\n\tglobal $odt;\r\n\tglobal $image_logo;\r\n\t\t$ok_saut_page=false;\r\n if ($referentiel_instance && $referentiel_referentiel) {\r\n $name = recode_utf8_vers_latin1(trim($referentiel_referentiel->name));\r\n $code = recode_utf8_vers_latin1(trim($referentiel_referentiel->code_referentiel));\r\n\t\t\t$description = recode_utf8_vers_latin1(trim($referentiel_referentiel->description_referentiel));\r\n\t\t\t\r\n\t\t\t$id = $referentiel_instance->id;\r\n $name_instance = recode_utf8_vers_latin1(trim($referentiel_instance->name));\r\n $description_instance = recode_utf8_vers_latin1(trim($referentiel_instance->description_instance));\r\n $label_domaine = recode_utf8_vers_latin1(trim($referentiel_instance->label_domaine));\r\n $label_competence = recode_utf8_vers_latin1(trim($referentiel_instance->label_competence));\r\n $label_item = recode_utf8_vers_latin1(trim($referentiel_instance->label_item));\r\n $date_instance = $referentiel_instance->date_instance;\r\n $course = $referentiel_instance->course;\r\n $ref_referentiel = $referentiel_instance->ref_referentiel;\r\n\t\t\t$visible = $referentiel_instance->visible;\r\n $id = $referentiel_instance->id;\r\n\t\t\t\r\n\t\t\t// $odt->SetDrawColor(128, 128, 128); \r\n\t\t\t// $odt->SetLineWidth(0.4); \r\n\t\t\t// logo\r\n\t\t\t// $posy=$odt->GetY(); \r\n\t\t\t\r\n\t\t\t//if (isset($image_logo) && ($image_logo!=\"\")){\r\n\t\t\t//\t$odt->Image($image_logo,150,$posy,40);\r\n\t\t\t// }\r\n\t\t\t// $posy=$odt->GetY()+60; \r\n \t\r\n\t\t\t$odt->SetLeftMargin(15);\r\n // $odt->SetX(20);\r\n\t\t\t\r\n \r\n\t\t\t$odt->SetFont('Arial','B',14); \r\n\t\t $odt->WriteParagraphe(0,get_string('certification','referentiel'));\r\n\t\t\t// $odt->Ln(1);\r\n\t\t\t$odt->SetFont('Arial','',12); \r\n\t\t $odt->WriteParagraphe(0, $name.'('.$code.')');\r\n\t\t\t// $odt->Ln(6);\r\n\t\t\t$odt->SetFont('Arial','',10);\r\n\t\t\t$odt->WriteParagraphe(0, $description);\r\n\t\t\t//$odt->Ln(6);\r\n if ($param->certificat_sel_referentiel){\t\t\t\t\r\n\t\t\t\t // DOMAINES\r\n\t\t\t\t // LISTE DES DOMAINES\r\n\t\t\t\t $compteur_domaine=0;\r\n\t\t\t\t $records_domaine = referentiel_get_domaines($referentiel_referentiel->id);\r\n\t\t if ($records_domaine){\r\n\t\t\t\t\t foreach ($records_domaine as $record_d){\r\n\t\t\t\t\t\t ooffice_write_domaine($record_d );\r\n\t\t\t\t\t }\r\n\t\t\t\t }\t\t\t\t\r\n $ok_saut_page=true;\t\t\t\t\r\n\t\t\t} \r\n\r\n\t\t\tif ($param->certificat_sel_referentiel_instance){\r\n $odt->SetFont('Arial','B',10); \r\n\t\t\t $odt->SetFont('Arial','B',14); \r\n\t\t\t $texte= recode_utf8_vers_latin1(get_string('certification','referentiel').' <i>'.$referentiel_instance->name.'</i>');\r\n\t \t$odt->WriteParagraphe(0,$texte);\r\n\t\t\t\r\n\t\t\t $odt->SetFont('Arial','N',12); \r\n\t\t\t $texte= \"$name : $description_instance\";\r\n\t\t\t // $texte.= \"$label_domaine, $label_competence, $label_item\";\r\n\t\t\t $odt->WriteParagraphe(0,$texte);\r\n\t\t\t\r\n /*\r\n\t\t\t$odt->Ln(2);\r\n\t\t\t$odt->Write(0,\"Cours : $course\");\r\n\t\t\t$odt->Ln();\r\n $odt->Write(0,\"R�f�rentiel : $ref_referentiel\");\r\n\t\t\t$odt->Ln();\r\n $odt->Write(0,\"Visible : $visible\");\r\n\t\t\t$odt->Ln();\r\n\t\t\t*/\r\n \r\n \t\t\t $ok_saut_page=true;\r\n }\r\n\t\t\tif ($ok_saut_page==true){ // forcer le saut de page \r\n $odt->AddPage();\r\n\t\t\t}\r\n \r\n\t\t\treturn true;\r\n }\r\n\t\treturn false;\r\n }", "public function reescalarActi(){\n }", "function index() {\n global $autorias;\n global $autores;\n global $livros;\n $autorias = buscarRegistros('tab_autorias');\n $autores = buscarRegistros('tab_autor');\n $livros = buscarRegistros('tab_livro');\n }", "function cl_disbancoprocesso() { \n //classes dos rotulos dos campos\n $this->rotulo = new rotulo(\"disbancoprocesso\"); \n $this->pagina_retorno = basename($GLOBALS[\"HTTP_SERVER_VARS\"][\"PHP_SELF\"]);\n }", "static function setPubblico($id){\n if(!CUtente::verificalogin())header('Location: /Progetto/Utente/homepagedef');\n else{\n session_start();\n if(!isset($_SESSION['location'])) header('Location: /Progetto/Utente/homepagedef');\n else{\n if(stripos($_SESSION['location'],'Watchlist')!==false && FPersistentManager::exist('id',$id,'FWatchlist')){\n $w=FPersistentManager::load('id',$id,'FWatchlist');\n if($w[0]->getProprietario()==$_SESSION['utente']->getUsername())\n FPersistentManager::update('pubblico',1,'id',$id,'FWatchlist');\n\n }\n\n header('Location: /Progetto'.$_SESSION['location']);\n\n }\n //header('Location: /Progetto/Utente/homepagedef');\n\n }\n}", "function update() {\r\n $exp_id = VAR3;\r\n $fil_id = VAR4;\r\n $seccion = VAR5;\r\n \r\n // Find ser_id\r\n $expediente = new tab_expediente ();\r\n $tab_expediente = $expediente->dbselectById($exp_id);\r\n $ser_id = $tab_expediente->getSer_id();\r\n \r\n // Tab_archivo\r\n $this->archivo = new tab_archivo();\r\n $row = $this->archivo->dbselectByField(\"fil_id\", $fil_id);\r\n $row = $row[0]; \r\n \r\n\r\n \r\n // Tab_doccorr\r\n $tab_doccorr = new Tab_doccorr();\r\n $sql = \"SELECT * \r\n FROM tab_doccorr \r\n WHERE fil_id='\" . $row->fil_id . \"'\";\r\n $doccorr = $tab_doccorr->dbSelectBySQL($sql);\r\n if($doccorr){\r\n $doccorr = $doccorr[0]; \r\n // Nur\r\n $hojas_ruta = new hojas_ruta();\r\n $this->registry->template->dco_id = $doccorr->dco_id;\r\n $this->registry->template->fil_cite = $hojas_ruta->obtenerSelect($doccorr->fil_cite);\r\n $seguimientos = new seguimientos();\r\n $this->registry->template->fil_nur_s = $seguimientos->obtenerSelect($doccorr->fil_nur_s);\r\n\r\n $this->registry->template->fil_nur = $doccorr->fil_nur;\r\n $this->registry->template->fil_asunto = $doccorr->fil_asunto;\r\n $this->registry->template->fil_sintesis = $doccorr->fil_sintesis;\r\n }else{\r\n // Nur\r\n $this->registry->template->dco_id = \"\";\r\n $this->registry->template->fil_cite = \"\";\r\n $this->registry->template->fil_nur_s = \"\";\r\n $this->registry->template->fil_nur = \"\";\r\n $this->registry->template->fil_asunto = \"\";\r\n $this->registry->template->fil_sintesis = \"\"; \r\n }\r\n// $this->registry->template->fil_nur = \"\";\r\n// $this->registry->template->fil_asunto = \"\";\r\n// $this->registry->template->fil_sintesis = \"\";\r\n// $this->registry->template->fil_cite = \"\";\r\n// $this->registry->template->fil_nur_s = \"\";\r\n \r\n \r\n\r\n\r\n // Tab_exparchivo\r\n $sql = \"SELECT * \r\n FROM tab_exparchivo \r\n WHERE fil_id='\" . $row->fil_id . \"'\";\r\n $exa_row = $this->archivo->dbSelectBySQL($sql);\r\n $exa_row = $exa_row[0];\r\n $this->registry->template->exp_id = $exp_id;\r\n $this->registry->template->tra_id = $exa_row->tra_id;\r\n $this->registry->template->cue_id = $exa_row->cue_id;\r\n $this->registry->template->exa_id = $exa_row->exa_id;\r\n \r\n $expediente = new expediente ();\r\n // Tab_archivo\r\n $this->registry->template->seccion = $seccion;\r\n $this->registry->template->fil_id = $fil_id;\r\n $this->registry->template->fil_codigo = $row->fil_codigo;\r\n $this->registry->template->fil_nro = $row->fil_nro;\r\n $this->registry->template->fil_titulo = $row->fil_titulo;\r\n $this->registry->template->fil_subtitulo = $row->fil_subtitulo;\r\n $this->registry->template->fil_fecha = $row->fil_fecha;\r\n $this->registry->template->fil_mes = $expediente->obtenerSelectMes($row->fil_mes);\r\n $this->registry->template->fil_anio = $expediente->obtenerSelectAnio($row->fil_anio); \r\n \r\n $idioma = new idioma (); \r\n $this->registry->template->idi_id = $idioma->obtenerSelect($row->idi_id);\r\n\r\n $this->registry->template->fil_proc = $row->fil_proc;\r\n $this->registry->template->fil_firma = $row->fil_firma;\r\n $this->registry->template->fil_cargo = $row->fil_cargo;\r\n // Include dynamic fields\r\n $expcampo = new expcampo();\r\n $this->registry->template->filcampo = $expcampo->obtenerSelectCampos($ser_id); \r\n $sopfisico = new sopfisico();\r\n $this->registry->template->sof_id = $sopfisico->obtenerSelect($row->sof_id);\r\n $this->registry->template->fil_nrofoj = $row->fil_nrofoj;\r\n $this->registry->template->fil_tomovol = $row->fil_tomovol;\r\n $this->registry->template->fil_nroejem = $row->fil_nroejem;\r\n $this->registry->template->fil_nrocaj = $row->fil_nrocaj;\r\n $this->registry->template->fil_sala = $row->fil_sala;\r\n $archivo = new archivo ();\r\n $this->registry->template->fil_estante = $archivo->obtenerSelectEstante($row->fil_estante);\r\n $this->registry->template->fil_cuerpo = $row->fil_cuerpo;\r\n $this->registry->template->fil_balda = $row->fil_balda;\r\n $this->registry->template->fil_tipoarch = $row->fil_tipoarch;\r\n $this->registry->template->fil_mrb = $row->fil_mrb;\r\n \r\n $this->registry->template->fil_ori = $row->fil_ori;\r\n $this->registry->template->fil_cop = $row->fil_cop;\r\n $this->registry->template->fil_fot = $row->fil_fot;\r\n \r\n $this->registry->template->fil_confidencilidad = $row->fil_confidencialidad;\r\n $this->registry->template->fil_obs = $row->fil_obs;\r\n \r\n $this->registry->template->required_archivo = \"\"; \r\n\r\n //palabras clave\r\n $palclave = new palclave();\r\n $this->registry->template->pac_nombre = $palclave->listaPC();\r\n $this->registry->template->fil_descripcion = $palclave->listaPCFile($row->fil_id);\r\n \r\n $arc = new archivo ();\r\n $this->registry->template->confidencialidad = $arc->loadConfidencialidad('1');\r\n $this->registry->template->PATH_WEB = PATH_WEB;\r\n $this->registry->template->PATH_DOMAIN = PATH_DOMAIN;\r\n $exp = new expediente ();\r\n if ($seccion == \"estrucDocumental\") {\r\n $this->registry->template->PATH_EVENT = \"update_save\";\r\n $this->registry->template->linkTree = $exp->linkTree($exp_id, $exa_row->tra_id, $exa_row->cue_id);\r\n } else {\r\n $this->registry->template->PATH_EVENT = \"update_saveReg\";\r\n $this->registry->template->linkTree = $exp->linkTreeReg($exp_id, $exa_row->tra_id, $exa_row->cue_id);\r\n }\r\n $this->menu = new menu ();\r\n $liMenu = $this->menu->imprimirMenu($seccion, $_SESSION ['USU_ID']);\r\n $this->registry->template->men_titulo = $liMenu;\r\n \r\n $this->registry->template->GRID_SW = \"true\";\r\n $this->registry->template->PATH_J = \"jquery-1.4.1\";\r\n $this->registry->template->tituloEstructura = $this->tituloEstructuraD;\r\n $this->registry->template->show('header');\r\n $this->registry->template->controller = $seccion;\r\n $this->llenaDatos(VAR3);\r\n $this->registry->template->show('regarchivo.tpl');\r\n }", "public function viewAction() {\n // neu chua khoi tao\n // neu roi add them 1 phan tu vao sesion voi id va uenc da duoc tao\n $this->layout('layout/bags');\n $getuser = $this->forward()->dispatch('Admin\\Controller\\Index', array(\n 'action' => 'getuser'\n ));\n // var_dump($getuser);\n $this->layout()->getuser = $getuser;\n\n $id = $this->params()->fromRoute('id');\n $uenc = $this->params()->fromRoute('uenc');\n\n echo \"id :\";\n var_dump($id);\n echo \"</br>\";\n echo \"uenc :\";\n var_dump($uenc);\n die(\"view is update\");\n }", "function bt_fecharClick($sender, $params)\r\n {\r\n GetConexaoPrincipal()->SQL_MGT_Cotacoes->Close();\r\n GetConexaoPrincipal()->SQL_MGT_Cotacoes->SQL = $_SESSION['comando_sql_grid'];\r\n GetConexaoPrincipal()->SQL_MGT_Cotacoes->Open();\r\n\r\n redirect('com_cotacoes.php');\r\n }", "static function rimuoviserie(){\n if(!CUtente::verificalogin())header('Location: /Progetto/Utente/homepagedef');\n else{\n session_start();\n if(!isset($_SESSION['location'])) header('Location: /Progetto/Utente/homepagedef');\n else{\n if(stripos($_SESSION['location'],'Watchlist')!==false && $_SERVER['REQUEST_METHOD'] == \"POST\"){\n $watch=$_POST[\"watchlist\"];\n $serie=$_POST[\"serie\"];\n\n if(FPersistentManager::existCorr($watch,$serie))\n FPersistentManager::deleteCorrispondenze($watch,$serie);\n }\n\n header('Location: /Progetto'.$_SESSION['location']);\n\n }\n //header('Location: /Progetto/Utente/homepagedef');\n\n }\n }", "public function ImprimerSoldeAction()\n { \t \n\t\t $em = $this->container->get('doctrine')->getManager();\t \t\t \n\t\t $request = $this->container->get('request');\t \t \n\t\t $session = $request->getSession();\n\t\t $userSimpleId = $session->get('cleuser');\t\t\n\t\t $ressource = $em->find('GCNAFNAFBundle:Ressource', $userSimpleId); \n\t\t $nom =$ressource->getNom();\n\t\t $pren=$ressource->getPrenom();\n\t\t \n\t\t $qb = $em->createQueryBuilder();\n\t\t $qb->select('c.refCpt,c.annee,c.cptInitial,c.cptSolde,c.idUser')\n\t\t\t->from('GCNAFNAFBundle:CompteurSolde', 'c')\t\n\t\t\t->where('c.idUser = :userSimpleId')\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t->orderBy('c.annee', 'ASC');\t\t\t\n\t\t $qb->setParameter('userSimpleId', $userSimpleId);\t\t\t\t\n\t\t $query = $qb->getQuery(); \n\t\t $total = $query->getResult();\t \t\t\t\t\t\t\n\t\t\n\t\t//on stock la vue à convertir en PDF en oubliant pas les paramètre twig si la vue comporte des données dynamiques\n $html = $this->renderView('GCNAFNAFBundle:User:PDFlisteSolde.html.twig', array(\n 'entities' => $total, \t\t\n\t\t\t'nom' => $nom,\n\t\t\t'prenom' => $pren,\n ));\t \n //on instancie la class Html2Pdf_Html2Pdf en lui passer en parametre\n //le sens de la page \"portrait\" => p ou \"paysage\" => l\n //le format A4,A5...\n //la langue du document fr,en,it...\n $html2pdf = new \\Html2Pdf_Html2Pdf('P','A4','fr');\n \n //SetDisplayMode définit la manière dont le document PDF va être affiché par l’utilisateur\n //fullpage : affiche la page entière sur l'écran\n //fullwidth : utilise la largeur maximum de la fenêtre\n //real : utilise la taille réelle\n $html2pdf->pdf->SetDisplayMode('real');\n \n //writeHTML va tout simplement prendre la vue stocker dans la variable $html pour la convertir en format PDF\n $html2pdf->writeHTML($html);\n \n //Output envoi le document PDF au navigateur internet avec un nom spécifique qui aura un rapport avec le contenue à convertir (exemple : Facture, Règlement…)\n $html2pdf->Output('ListeSoldes.pdf');\n \n //pour vous rappeller qu’il faut toujours retourner quelque chose dans vos methode de votre controller.\n return new Response();\n\n }", "public function suprAffectation()\n {\n //sécurité :\n $action = 'deleteFolderInformation';\n $error = AccessControll::checkRight($action);\n if ( empty($error) ){ //ok\n //on réccupère l'id à supr (clée primaire)\n $id = $this->request->getGetAttribute('id');\n //ajout d'une entrée dans le fichier de log\n $data = DossierManager::getAffectationByClef($id);\n $auth = AuthenticationManager::getInstance();\n $username = $auth->getMatricule();\n $type = 'affectationCaserne';\n self::logDeletedInformation($data, $username, $type);\n //on supprime (retourne le matricule)\n $matricule = DossierManager::suprAffectationById($id);\n //on réaffiche le dossier actualisé\n $dossier = DossierManager::getOneFromId($matricule);\n $prez = self::afficheDossierComplet($dossier);\n $this->response->setPart('contenu', $prez);\n } else{\n header(\"location: index.php\");\n die($error);\n }\n }", "function main() {\n global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;\n $config = $BE_USER->getTSConfig('x4econgress');\n\t\t$this->id = $config['properties']['pidList'];\n\t\t$this->showFields = $config['properties']['showFields'];\n\t\t\n\t\tif(empty($this->showFields)){\n\t\t\t$this->showFields = 'name,firstname,type,address,zip,city,country,email,remarks';\n\t\t}\n\t\t\n // Access check!\n // The page will show only if there is a valid page and if this page may be viewed by the user\n $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id,$this->perms_clause);\n $access = is_array($this->pageinfo) ? 1 : 0;\n\t\t\n if (($this->id && $access) || ($BE_USER->user[\"admin\"] && !$this->id)) {\n\t\t\n // Draw the header.\n $this->doc = t3lib_div::makeInstance(\"bigDoc\");\n $this->doc->backPath = $BACK_PATH;\n //$this->doc->form='<form action=\"\" method=\"POST\">';\n $backUrl = 'http://'.$_SERVER['HTTP_HOST'].'/';\n\t\t\t$backUrl .= 'typo3/mod.php?M=txx4econgressM1_txx4econgressM1';\n\t\t\tif (isset($_POST['x4econgress_congresses'])) {\n\t\t\t\t$backUrl .= '&x4econgress_congresses='.$_POST['x4econgress_congresses'];\n\t\t\t}\n // JavaScript\n $this->doc->JScode = '\n <script language=\"javascript\" type=\"text/javascript\">\n script_ended = 0;\n function jumpToUrl(URL) {\n document.location = URL;\n }\n\t\t\t\t\tfunction jump(url,modName,mainModName)\t{\n\t\t\t\t\t// Clear information about which entry in nav. tree that might have been highlighted.\n\t\t\t\t\ttop.fsMod.navFrameHighlightedID = new Array();\n\t\t\t\t\t\n\t\t\t\t\tif (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav)\t{\n\t\t\t\t\t\ttop.content.nav_frame.refresh_nav();\n\t\t\t\t\t}\n\n\t\t\t\t\ttop.nextLoadModuleUrl = url;\n\t\t\t\t\ttop.goToModule(modName);\n\t\t\t\t\t}\n\t\t\t\t\tvar T3_THIS_LOCATION = top.getModuleUrl(top.TS.PATH_typo3+\"../typo3conf/ext/x4econgress/mod1/index.php?\");\n\t\t\t\t\tT3_THIS_LOCATION = \"'.urlencode($backUrl).'\";\n </script>\n ';\n $this->doc->postCode='\n <script language=\"javascript\" type=\"text/javascript\">\n script_ended = 1;\n if (top.fsMod) top.fsMod.recentIds[\"web\"] = '.intval($this->id).';\n </script>\n ';\n\n $headerSection = $this->doc->getHeader(\"pages\",$this->pageinfo,$this->pageinfo[\"_thePath\"]).\"<br>\".$LANG->sL(\"LLL:EXT:lang/locallang_core.php:labels.path\").\": \".t3lib_div::fixed_lgd_pre($this->pageinfo[\"_thePath\"],50);\n\n $this->content.=$this->doc->startPage($LANG->getLL(\"title\"));\n $this->content.=$this->doc->header($LANG->getLL(\"title\"));\n $this->content.=$this->doc->divider(5);\n\n // Render content:\n $this->moduleContent();\n\n\n // ShortCut\n if ($BE_USER->mayMakeShortcut()) {\n $this->content.=$this->doc->spacer(20).$this->doc->section(\"\",$this->doc->makeShortcutIcon(\"id\",implode(\",\",array_keys($this->MOD_MENU)),$this->MCONF[\"name\"]));\n }\n\n $this->content.=$this->doc->spacer(10);\n } else {\n // If no access or if ID == zero\n\n $this->doc = t3lib_div::makeInstance(\"mediumDoc\");\n $this->doc->backPath = $BACK_PATH;\n\n $this->content.=$this->doc->startPage($LANG->getLL(\"title\"));\n $this->content.=$this->doc->header($LANG->getLL(\"title\"));\n $this->content.=$this->doc->spacer(5);\n $this->content.=$this->doc->spacer(10);\n }\n }", "function Menu() {\r\n extract($GLOBALS);\r\n\r\n if ($O=='L') {\r\n // Recupera os módulos contratados pelo cliente\r\n $sql = new db_getSiwCliModLis; $RS = $sql->getInstanceOf($dbms, $w_cliente, null, null);\r\n }\r\n \r\n Cabecalho();\r\n head();\r\n ShowHTML('<TITLE>'.$w_TP.'</TITLE>');\r\n ShowHTML('</HEAD>');\r\n BodyOpen('onLoad=this.focus();');\r\n ShowHTML('<B><FONT COLOR=\"#000000\">'.$w_TP.'</font></B>');\r\n ShowHTML('<HR>');\r\n ShowHTML('<div align=center><center>');\r\n ShowHTML('<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" >');\r\n if ($O==\"L\") {\r\n // Exibe a quantidade de registros apresentados na listagem e o cabeçalho da tabela de listagem\r\n ShowHTML('<tr><td align=\"right\">'.exportaOffice().'<b>Registros: '.count($RS));\r\n ShowHTML('<tr><td align=\"center\" colspan=3>');\r\n ShowHTML(' <TABLE class=\"tudo\" WIDTH=\"100%\" bgcolor='.$conTableBgColor.' BORDER='.$conTableBorder.' CELLSPACING='.$conTableCellSpacing.' CELLPADDING='.$conTableCellPadding.' BorderColorDark='.$conTableBorderColorDark.' BorderColorLight='.$conTableBorderColorLight.'>');\r\n ShowHTML(' <tr bgcolor='.$conTrBgColor.' align=\"center\">');\r\n ShowHTML(' <td><b>Módulo</td>');\r\n ShowHTML(' <td><b>Objetivo geral</td>');\r\n ShowHTML(' <td class=\"remover\"><b>Operações</td>');\r\n ShowHTML(' </tr>');\r\n if (count($RS) <= 0) {\r\n ShowHTML(' <tr bgcolor=\"'.$conTrBgColor.'\"><td colspan=6 align=\"center\"><font size=\"2\"><b>Nenhum registro encontrado.</b></td></tr>');\r\n } else {\r\n // Lista os registros selecionados para listagem\r\n foreach ($RS as $row) {\r\n if ($w_cor==$conTrBgColor || $w_cor=='') $w_cor=$conTrAlternateBgColor; else $w_cor=$conTrBgColor;\r\n ShowHTML(' <tr bgcolor=\"'.$w_cor.'\" valign=\"top\">');\r\n ShowHTML(' <td nowrap>'.f($row,'nome').'</td>');\r\n ShowHTML(' <td>'.f($row,'objetivo_geral').'</td>');\r\n ShowHTML(' <td nowrap class=\"remover\">');\r\n ShowHTML(' <A class=\"HL\" HREF=\"'.$w_pagina.'Inicial&R='.$w_pagina.$par.'&O=L&w_sq_modulo='.f($row,'sq_modulo').'&P1=1&P2='.$P2.'&P3='.$P3.'&P4='.$P4.'&TP='.$TP.'&SG='.$SG.'\">Detalhar</A> ');\r\n ShowHTML(' </td>');\r\n ShowHTML(' </tr>');\r\n } \r\n }\r\n ShowHTML(' </center>');\r\n ShowHTML(' </table>');\r\n ShowHTML(' </td>');\r\n ShowHTML('</tr>');\r\n DesConectaBD();\r\n } else {\r\n ScriptOpen('JavaScript');\r\n ShowHTML(' alert(\"Opção não disponível\");');\r\n ShowHTML(' history.back(1);');\r\n ScriptClose();\r\n }\r\n ShowHTML('</table>');\r\n ShowHTML('</center>');\r\n Rodape();\r\n}", "public function afficheEntete()\r\n\t\t{\r\n\t\t//appel de la vue de l'entête\r\n\t\trequire 'Vues/entete.php';\r\n\t\t}", "function cl_rhconsignadomovimentoservidorrubrica() { \n //classes dos rotulos dos campos\n $this->rotulo = new rotulo(\"rhconsignadomovimentoservidorrubrica\"); \n $this->pagina_retorno = basename($GLOBALS[\"HTTP_SERVER_VARS\"][\"PHP_SELF\"]);\n }", "function formConnexion() {\n\t\tif (isset($_SESSION['id'])) {\n\t\t\theader(\"Location: ?module=accueil\");\n\t\t\texit();\n\t\t}\n\t\telse\n\t\t\t$this -> vue -> afficheConnexion('');\n\t}", "public function envoiCourrielRappel() {\n\t\t\n\t\t$this->log->debug(\"Usager::envoiCourrielRappel() Début\");\n\t\t\n\t\t$succes = 0;\n\t\t\n\t\t// Préparer le code de rappel pour l'utilisateur\n\t\t$this->set(\"code_rappel\", Securite::genererChaineAleatoire(16));\n\t\t$this->enregistrer();\n\t\t\n\t\t// Préparer le courriel\n\t\t$gabaritCourriel = REPERTOIRE_GABARITS_COURRIELS . \"identification-rappel.php\";\n\t\t\n\t\t// Vérifier si le fichier existe, sinon erreur\n\t\tif (!file_exists($gabaritCourriel)) {\n\t\t\t$this->log->erreur(\"Le gabarit du courriel '$gabaritCourriel' ne peut être localisé.\");\n\t\t}\n\t\t\n\t\t// Obtenir le contenu\n\t\t$contenu = Fichiers::getContenuElement($gabaritCourriel , $this);\n\t\t\n\t\t// Envoi du courriel\n\t\t$courriel = new Courriel($this->log);\n\t\t$succes = $courriel->envoiCourriel($this->get(\"courriel\"), TXT_COURRIEL_RAPPEL_OBJET, $contenu);\n\t\t\t\t \n\t\t$this->log->debug(\"Usager::envoiCourrielRappel() Début\");\n\t\t\n\t\treturn $succes;\n\t}", "function action()\n\t{\n\n switch($_REQUEST['opcion'])\n\t\t{\n\n case \"consultar\":\n //unset ($_REQUEST['action']);\n \n $pagina= $this->configuracion[\"host\"]. $this->configuracion[\"site\"].\"/index.php?\";\n\t\t\t\t$variable=\"pagina=admin_consultarHistoricoRecibos\";\n\t\t\t\t$variable.=\"&opcion=consultarEstudiante\";\n $variable.=\"&codEstudiante=\".$_REQUEST['codEstudiante'];\n \n\t\t\t\tinclude_once($this->configuracion[\"raiz_documento\"]. $this->configuracion[\"clases\"].\"/encriptar.class.php\");\n $this->cripto=new encriptar();\n\t\t\t\t$variable=$this->cripto->codificar_url($variable, $this->configuracion);\n\n echo \"<script>location.replace('\".$pagina.$variable.\"')</script>\";\n break;\n\t\t}\n\t}", "public function suprRegimentAppartenance()\n {\n //sécurité :\n $action = 'deleteFolderInformation';\n $error = AccessControll::checkRight($action);\n if ( empty($error) ){ //ok\n //on réccupère l'id à supr (clée primaire)\n $id = $this->request->getGetAttribute('id');\n //ajout d'une entrée dans le fichier de log\n $data = DossierManager::getAppartenanceByClef($id);\n $auth = AuthenticationManager::getInstance();\n $username = $auth->getMatricule();\n $type = 'appartenanceRegiment';\n self::logDeletedInformation($data, $username, $type);\n //on supprime (retourne le matricule)\n $matricule = DossierManager::suprRegimentAppartenanceById($id);\n //on réaffiche le dossier actualisé\n $dossier = DossierManager::getOneFromId($matricule);\n $prez = self::afficheDossierComplet($dossier);\n $this->response->setPart('contenu', $prez);\n } else{\n header(\"location: index.php\");\n die($error);\n }\n }", "function cl_habitcandidatointeresseprograma() { \n //classes dos rotulos dos campos\n $this->rotulo = new rotulo(\"habitcandidatointeresseprograma\"); \n $this->pagina_retorno = basename($GLOBALS[\"HTTP_SERVER_VARS\"][\"PHP_SELF\"]);\n }", "function cl_reconhecimentocontabil() { \n //classes dos rotulos dos campos\n $this->rotulo = new rotulo(\"reconhecimentocontabil\"); \n $this->pagina_retorno = basename($GLOBALS[\"HTTP_SERVER_VARS\"][\"PHP_SELF\"]);\n }", "function commandes_bank_traiter_reglement($flux){\r\n\t// Si on est dans le bon cas d'un paiement de commande et qu'il y a un id_commande et que la commande existe toujours\r\n\tif (\r\n\t\t$id_transaction = $flux['args']['id_transaction']\r\n\t\tand $transaction = sql_fetsel(\"*\",\"spip_transactions\",\"id_transaction=\".intval($id_transaction))\r\n\t\tand $id_commande = $transaction['id_commande']\r\n\t\tand $commande = sql_fetsel('id_commande, statut, id_auteur, echeances, reference', 'spip_commandes', 'id_commande='.intval($id_commande))\r\n\t){\r\n\t\t$statut_commande = $commande['statut'];\r\n\t\t$montant_regle = $transaction['montant_regle'];\r\n\t\t$transaction_mode = $transaction['mode'];\r\n\t\t$statut_nouveau = 'paye';\r\n\r\n\r\n\t\t// Si la commande n'a pas d'échéance, le montant attendu est celui du prix de la commande\r\n\t\tinclude_spip('inc/commandes_echeances');\r\n\t\tif (!$commande['echeances']\r\n\t\t\tor !$echeances = unserialize($commande['echeances'])\r\n\t\t or !$desc = commandes_trouver_prochaine_echeance_desc($id_commande, $echeances, true)\r\n\t\t or !isset($desc['montant'])) {\r\n\t\t\t$fonction_prix = charger_fonction('prix', 'inc/');\r\n\t\t\t$montant_attendu = $fonction_prix('commande', $id_commande);\r\n\t\t}\r\n\t\t// Sinon le montant attendu est celui de la prochaine échéance (en ignorant la dernière transaction OK que justement on cherche à tester)\r\n\t\telse {\r\n\t\t\t$montant_attendu = $desc['montant'];\r\n\t\t}\r\n\t\tspip_log(\"commande #$id_commande attendu:$montant_attendu regle:$montant_regle\", 'commandes');\r\n\r\n\t\t// Si le plugin n'était pas déjà en payé et qu'on a pas assez payé\r\n\t\t// (si le plugin était déjà en payé, ce sont possiblement des renouvellements)\r\n\t\tif (\r\n\t\t\t$statut_commande != 'paye'\r\n\t\t\tand (floatval($montant_attendu) - floatval($montant_regle)) >= 0.01\r\n\t\t){\r\n\t\t\t$statut_nouveau = 'partiel';\r\n\t\t}\r\n\t\t\r\n\t\t// S'il y a bien un statut à changer\r\n\t\tif ($statut_nouveau !== $statut_commande){\r\n\t\t\tspip_log(\"commandes_bank_traiter_reglement marquer la commande #$id_commande statut: $statut_commande -> $statut_nouveau mode=$transaction_mode\",'commandes');\r\n\t\t\t// On met a jour la commande\r\n\t\t\tinclude_spip(\"action/editer_commande\");\r\n\t\t\tcommande_modifier($id_commande, array('statut'=>$statut_nouveau, 'mode'=>$transaction_mode));\r\n\t\t}\r\n\r\n\t\t// un message gentil pour l'utilisateur qui vient de payer, on lui rappelle son numero de commande\r\n\t\t$flux['data'] .= \"<br />\"._T('commandes:merci_de_votre_commande_paiement',array('reference'=>$commande['reference']));\r\n\t}\r\n\r\n\treturn $flux;\r\n}", "public function main(ChansonStorageMySQL $chansonStorage, AccountStorageMysql $accountStorage){\n session_start();\n \n // verifiacation s'il n'existe pas des information à afficher \n $feedback = key_exists('feedback', $_SESSION) ? $_SESSION['feedback'] : '';\n $_SESSION['feedback'] = '';\n\n // on passe le routeur à la vue\n if(!key_exists(\"user\",$_SESSION)){\n $this->view= new View($this,$feedback);\n }else{\n if($_SESSION[\"user\"]->getStatut()===\"admin\" ){\n $this->view= new AdminView($this,$_SESSION[\"user\"],$feedback);\n }else{\n $this->view= new PrivateView($this,$_SESSION[\"user\"],$feedback);\n }\n }\n\n \n\n // on instancie notre controller\n $controllerChansons= new Controller($this->view, $chansonStorage,$accountStorage);\n $controllerAccount= new ControllerAccount($this->view,$accountStorage);\n\n /**\n * gestion des urls afin de pouvoir afficher les pages correspondantes\n */\n // si le parametre ou action son passe en url\n if(key_exists(\"PATH_INFO\" , $_SERVER)){\n\n $tab= explode('/', $_SERVER[\"PATH_INFO\"]);\n $size=count($tab);\n $i=1;\n\n if($size===2){\n $action=htmlspecialchars($tab[1]);\n switch ($action) {\n case 'apropos':\n $this->view->makeApropos();\n break;\n case 'liste':\n $controllerChansons->showList();\n break;\n case 'listUser':\n if(key_exists(\"user\",$_SESSION)){\n if($_SESSION[\"user\"]->getStatut()===\"admin\"){\n $controllerAccount->showUserList();\n }else{\n $this->view->displayAdminPageFeedBack(\".\",\"Vous de ver etre admin pour voir la liste des utilisateur \");\n }\n \n }else{\n $this->view->displayConnexionFeedback(\"Connetez vous pour voir la liste des utilisateur attention vous devez être egalement de statut admin\"); \n }\n \n break;\n\n case 'nouveau':\n if(key_exists(\"user\",$_SESSION)){\n $controllerChansons->getView()->makeCreationFormChansonPage($controllerChansons->newChanson());\n }else{\n $this->view->displayConnexionFeedback(\"Connetez vous pour voir la page personnaliser de la chanson\");\n } \n break;\n\n case 'sauverNouveau':\n if($_SERVER[\"REQUEST_METHOD\"] === \"POST\"){\n if(key_exists(\"user\",$_SESSION)){\n $controllerChansons->saveNewChanson($_POST);\n }else{\n $this->view->displayConnexionFeedback(\"Vous devez etre connecter pour enregistrer une nouvelle chanson\");\n } \n }else{\n $this->view->makePageUnaccessible();\n }\n break;\n case '':\n $this->view->welcomePage();\n break;\n case 'connexion':\n if(!key_exists(\"user\",$_SESSION)){\n $this->view->makeLoginFormPage();\n }else{\n $this->view->displayAlreadyConnectSuccess();\n } \n break;\n case 'deconnexion':\n if(key_exists(\"user\",$_SESSION)){\n $controllerChansons->logout();\n }else{\n $this->view->displayConnexionFeedback(\"Vous devez etre connecter pour experer vous deconnecter\");\n } \n break;\n case 'inscription':\n $this->view->makeSignInFormPage($controllerAccount->newAccount());\n break;\n // à changer pour modification ie controller des account à part;\n case \"confirmConnexion\":\n if($_SERVER[\"REQUEST_METHOD\"] === \"POST\"){\n $controllerChansons->login($_POST);\n }else{\n $this->view->makePageUnaccessible();\n }\n break;\n case 'confirmInscription':\n if($_SERVER[\"REQUEST_METHOD\"] === \"POST\"){\n $controllerAccount->saveAccount($_POST);\n }else{\n $this->view->makePageUnaccessible();\n }\n default:\n if(key_exists(\"user\",$_SESSION)){\n $controllerChansons->showInformation($action);\n }else{\n $this->view->displayConnexionFeedback(\"Connetez vous pour voir la page personnaliser de la chanson\");\n } \n break;\n }\n }\n\n \n if($size===3){\n for($i; $i<$size ; $i++){\n $action= $tab[$i];\n switch ($action){\n case 'supprimer':\n if(key_exists(\"user\",$_SESSION)){\n $id= htmlspecialchars($tab[$i-1]);\n $controllerChansons->askChansonDeletion($id);\n }else{\n $this->view->displayConnexionFeedback(\"Vous devez être connecter pour supprimer des chansons\");\n }\n break;\n case 'confirmerSuppression':\n if($_SERVER[\"REQUEST_METHOD\"] === \"POST\"){\n if(key_exists(\"user\",$_SESSION)){\n $id= htmlspecialchars($tab[$i-1]);\n $controllerChansons->deleteChanson($id);\n }else{\n $this->view->displayConnexionFeedback(\"Vous devez être connecter pour supprimer des chansons\");\n }\n }else{\n $this->view->makePageUnaccessible();\n }\n break;\n case 'confirmerModification':\n if($_SERVER[\"REQUEST_METHOD\"] === \"POST\"){\n if(key_exists(\"user\",$_SESSION)){\n $id= htmlspecialchars($tab[$i-1]);\n // echo \"pas dedans\";\n $controllerChansons->updateChanson($_POST,$id);\n }else{\n $this->view->displayConnexionFeedback(\"Vous devez être connecter pour modifier des chansons\");\n }\n }else{\n $this->view->makePageUnaccessible();\n }\n break;\n case \"modifier\":\n if(key_exists(\"user\",$_SESSION)){\n $id= htmlspecialchars($tab[$i-1]);\n $controllerChansons->askChansonModification($id);\n }else{\n $this->view->displayConnexionFeedback(\"Vous devez être connecter pour modifier des chansons\");\n }\n \n break;\n break;\n case 'supprimerUser':\n if(key_exists(\"user\",$_SESSION)){\n if($_SESSION[\"user\"]->getStatut()===\"admin\"){\n $id= htmlspecialchars($tab[$i-1]);\n $controllerAccount->askDeletionUser($id);\n }else{\n $this->view->displayAdminPageFeedBack(\"Vous de ver etre admin pour supprimer un \");\n }\n }else{\n $this->view->displayConnexionFeedback(\"Connetez vous pour pouvoir supprimer un comptes\"); \n }\n break;\n case 'confirmSuppressionUser':\n if($_SERVER[\"REQUEST_METHOD\"] === \"POST\"){\n if(key_exists(\"user\",$_SESSION)){\n if($_SESSION[\"user\"]->getStatut()===\"admin\"){\n $id= htmlspecialchars($tab[$i-1]);\n $controllerAccount->DeleteAccount($id);\n }else{\n $this->view->displayAdminPageFeedBack(\"Vous devez etre admin pour supprimer un utilisateur\");\n }\n }else{\n $this->view->displayConnexionFeedback(\"Connetez vous pour pouvoir supprimer un comptes\"); \n }\n }else{\n $this->view->makePageUnaccessible();\n }\n break;\n\n default:\n $this->view->makePageUnaccessible();\n break;\n }\n \n \n }\n }\n\n if($size >4){\n //chargement de la page d'erreur \n\n }\n\n\n }else{\n // affichage de la page principale avec menu \n $this->view->welcomePage();\n }\n\n\n\n $this->view->render();\n\n }", "public function partirAuTravail(): void\n\t{\n\t}", "function connexionAdministration(){\n require 'app/views/back/connexionUsers.php';\n }", "public function hacer(){\n // renderizamos vista\n require_once 'views/pedido/hacer.php';\n }", "public function fracaso()\n\t{\n\t\textract($this->request->data);\n\t\tif ( ! $this->Auth->user() || ! $this->request->is('post') || empty($TBK_ORDEN_COMPRA) )\n\t\t{\n\t\t\t$this->redirect('/');\n\t\t}\n\n\t\t/**\n\t\t * Si existe una compra en proceso, en estado pendiente y corresponde\n\t\t * a la oc informada por webpay, cambia el estado a rechazo\n\t\t */\n\t\tif ( ( $id = $this->Session->read('Flujo.Carro.compra_id') ) && $id == $TBK_ORDEN_COMPRA && ( $this->Compra->pendiente($id) || $this->Compra->rechazada($id) ) )\n\t\t{\n\t\t\t$this->Compra->cambiarEstado($id, 'RECHAZO_TRANSBANK');\n\t\t\t//$this->redirect(array('action' => 'resumen'));\n\t\t}\n\t\t/**\n\t\t * Si no existe la oc o no cumple con las condiciones, informamos numero de oc de webpay\n\t\t */\n\t\telse\n\t\t{\n\t\t\t$id = $TBK_ORDEN_COMPRA;\n\t\t}\n\n\t\t/**\n\t\t * Camino de migas\n\t\t */\n\t\tBreadcrumbComponent::add('Reserva de uniformes', array('action' => 'add'));\n\t\tBreadcrumbComponent::add('Reserva fracasada');\n\t\t$this->set('title', 'Reserva fracasada');\n\t\t$this->set(compact('id'));\n\t}", "public function setPrenom($prenom){\n if(empty($prenom)){\n header(\"Location:../vu/formulaire_inscription.php\");\n return;\n\n\n //on declare de la variable prenom puis on appelle la varibale prive prenom\n $this->_prenom = $prenom;\n }\n\n public function setMail($mail){\n //Si mail est vide on fait\n if(empty($mail)){\n header(\"Location:../vu/formulaire_inscription.php\");\n return;\n\n }\n //on declare de la variable mail puis on appelle la varibale prive mail\n $this->_mail = $mail;\n }\n\n public function setAdresse($adresse){\n //Si adresse est vide on fait\n if(empty($adresse)){\n header(\"Location:../vu/formulaire_inscription.php\");\n return;\n }\n //on declare de la variable adresse puis on appelle la varibale prive adresse\n $this->_adresse = $adresse;\n }\n\n public function setNumero($numero){\n //Si numero est vide on fait\n if(empty($numero)){\n header(\"Location:../vu/formulaire_inscription.php\");\n return;\n\n }\n //on declare de la variable numero puis on appelle la varibale prive numero\n $this->_numero = $numero;\n }\n\n public function setMot_de_passe($mdp){\n //Si mdp est vide on fait\n if(empty($mdp)){\n header(\"Location:../vu/formulaire_inscription.php\");\n return;\n }\n //on declare de la varaible mdp puis on appelle la varibale prive mdp\n $this->_mdp = $mdp;\n }\n\n public function getNom(){return $this->_nom;} // on retourne nom\n public function getPrenom(){return $this->_prenom;} // on retourne prenom\n public function getMail(){return $this->_mail;} // on retourne mail\n public function getAdresse(){return $this->_adresse;} // on retourne adresse\n public function getNumero(){return $this->_numero;} // on retourne numero\n public function getMot_de_passe(){return $this->_mdp;} // on retourne mdp\n\n}", "private function GererUtilisateus() {\r\n if (isset($_GET['limiteBasse'])) {\r\n $limiteBasse = $_GET['limiteBasse'];\r\n } else {\r\n $limiteBasse = $_GET['limiteBasse'] = 0;\r\n }\r\n // -- Determine la pagination de l'affichage des restaurants\r\n $this->pagination = 50;\r\n $this->userCount = $this->CNX->countUsers();\r\n $this->afficherUsers = $this->CNX->showUsers(null, $limiteBasse, $this->pagination);\r\n $this->action = \"GererUtilisateurs\";\r\n }", "public function accueilAction () {\n\t\t$session = $_SESSION['ident'];\n\t\t$app_title=\"Connexion \" ;\n\t\t$app_body=\"Body_Connecte\" ;\n\t\t$app_desc=\"Comeca\" ;\n\t\t// si l admin est connecté\n\t\t$auth = $this->authModule->estConnecte();\n\n\t\trequire_once('Model/SqlModel.php');\n\t\t$AttenteModel = new SqlModel();\n\t\t\t\t \n\t\t$ListeAttente = $AttenteModel->AfficheEnAttente();\n\n\t\trequire('View/Connecte/accueil.php') ;\n\t}", "function exec_tabledata()\r\n{\r\n/* global $intPremierEnreg, $options, $spip_lang_right, $visiteurs, $connect_id_auteur\r\n , $connect_statut, $connect_toutes_rubriques;\r\n*/\r\n global $boolDebrid;\r\n\r\n // récupérer les données de la requete HTTP\r\n $table = _request('table');\r\n $intPremierEnreg = _request('intPremierEnreg');\r\n $serveur = _request('serveur');\r\n $mode = _request('mode');\r\n $idLigne = _request('id_ligne');\r\n $trisens = _request('trisens');\r\n $trival = _request('trival');\r\n $get_Debrid = _request('debrid');\r\n if ($get_Debrid==\"aGnFJwE\") $boolDebrid=true;\r\n\r\n // Vérifier login : Si administrateur = OK\r\n if (!autoriser('administrer','zone',0))\r\n {\r\n echo minipres();\r\n exit;\r\n }\r\n\r\n $commencer_page = charger_fonction('commencer_page', 'inc');\r\n echo $commencer_page(_T('tabledata:tabledata'));\r\n\r\n // Affichage menu de la page\r\n echo debut_gauche('TableDATA', true);\r\n\r\n echo debut_boite_info(true);\r\n // Par la suite, c'est ici qu'il faudrait inscrire les messages pour l'utilisateur...\r\n // mais il faut remanier tout le code.\r\n echo \"<p class='arial1'>\"\r\n ,\"<b>Cde & Informations...</b>\"\r\n ,\"<hr/>\"\r\n ,\"<a href='\"\r\n , tabledata_url_generer_ecrire('tabledata',\"table\")\r\n , \"'>- Voir toutes les tables -</a>\";\r\n\r\n echo \"<hr/>\";\r\n echo \"table s&#233;lectionn&#233;e:<br/>\";\r\n echo \"<center><b>\";\r\n if ($table==\"\")\r\n {\r\n echo \"Aucune n'est s&#233;lectionn&#233;e\";\r\n }\r\n else\r\n {\r\n echo \"<a href='\",tabledata_url_generer_ecrire('tabledata',\"table=\".$table).\"'>\"\r\n ,$table,\"</a>\";\r\n }\r\n echo \"</b></center>\";\r\n\r\n // Afficher \"Voir tables SPIP\"\r\n if (autoriser('webmestre'))\r\n {\r\n if ($boolDebrid)\r\n {\r\n $texte_tablespip= \"<hr/>\"\r\n .\"<a href='\"\r\n .tabledata_url_generer_ecrire('tabledata',\"table\",\"masquer\")\r\n .\"'>SPIP</a>\"\r\n .\" : Masquer les tables SPIP. (pr&#233;fixe : \".tabledata_table_prefix().\")<br/>\";\r\n }\r\n else\r\n {\r\n $texte_tablespip= \"<hr/>\"\r\n .\"<a href='\"\r\n .tabledata_url_generer_ecrire('tabledata',\"table\",\"voir\")\r\n .\"'>SPIP</a>\"\r\n .\" : Voir les tables SPIP. (pr&#233;fixe : \".tabledata_table_prefix().\")<br/>\";\r\n }\r\n echo $texte_tablespip;\r\n }\r\n // echo propre(_T('tabledata:tabledata'));\r\n echo fin_boite_info(true);\r\n\r\n\r\n // Par la suite, c'est ici qu'il faudrait mettre l'aide des commandes.\r\n $texte_bloc_des_raccourcis = \"<p class='arial1'>\"\r\n .\"<b>LISTER</b> : Affichage par groupe de 20 enregistrements.\"\r\n .\" (Tri&#233;s sur la clef primaire si elle existe)\"\r\n .\"<br/><br/><u>Les Qq Commandes</u><br/>\"\r\n .\"<br/><b>TRIER</b> : Cliquer sur l'icone ^v dans l'ent&#234;te du champ\"\r\n .\" (bascule &#224; chaque clic Ascendant, Decsendant, Aucun)<br/>\"\r\n .\"<br/><b>AJOUTER</b> : Pour ajouter un nouvel enregistrement, voir le formulaire du bas de page<br/>\"\r\n .\"<br/><b>SUPPRIMER</b> : Lister le contenu de la table et cliquer sur la croix rouge &#224; gauche de la ligne.<br/>\"\r\n .\"<br/><b>MODIFIER</b> : Cliquer sur l'enregistement<br/>\";\r\n\r\n\r\n echo bloc_des_raccourcis($texte_bloc_des_raccourcis);\r\n\r\n // Afficher page centrale\r\n echo debut_droite('TableDATA', true);\r\n\r\n // ======== Teste si le nom de la table est mentionné\r\n if ($table==\"\")\r\n {\r\n if ($boolDebrid)\r\n {\r\n echo gros_titre('<br/>ATTENTION :','',false);\r\n echo \"La modification du contenu des tables de SPIP peut engendrer\"\r\n ,\" des dysfontionnements graves.<br/>\"\r\n ,\"Faite une sauvegarde de la base, elle \"\r\n ,\"permettra une r&#233;paration en cas de probl&#232;me.<br/>\";\r\n }\r\n echo gros_titre('<br/>Choisir une table :','',false);\r\n echo debut_cadre_relief(\"../\"._DIR_PLUGIN_TABLEDATA.\"/img_pack/tabledata.gif\",true,'','');\r\n echo \"Le nom de la table est manquant.<br/><br/>\";\r\n echo tabledata_Cadre_voirlestables ($serveur,$boolDebrid);\r\n echo fin_cadre_relief(true);\r\n tabledata_Page_fin();\r\n exit;\r\n } // if ($table==\"\")\r\n\r\n // ======== Recherche si la table existe ? ===========\r\n if (!preg_match('/^[\\w_]+$/', $table))\r\n {\r\n echo debut_cadre_relief(\"../\"._DIR_PLUGIN_TABLEDATA.\"/img_pack/tabledata.gif\");\r\n echo \"'\".$table.\"': nom incorrect\";\r\n echo fin_cadre_relief(true);\r\n echo \"<center><a href='\"\r\n , tabledata_url_generer_ecrire('tabledata',\"table\")\r\n , \"'>- Retour &#224; la liste des tables -</a></center>\";\r\n tabledata_Page_fin();\r\n exit;\r\n } // if (!preg_match('/^[\\w_]+$/', $table))\r\n\r\n if (strpos($table,tabledata_table_prefix(),0)===0) // cas d'une table SPIP\r\n {\r\n if ($boolDebrid)\r\n { // cas table SPIP autorisée\r\n echo gros_titre('<br/>ATTENTION :','',false);\r\n echo \"Vous intervenez sur une table interne de SPIP.\"\r\n ,\" Agissez avec pr&#233;cautions.<br/>\";\r\n }\r\n else\r\n { // protection active et table SPIP !!\r\n echo debut_cadre_relief(\"../\"._DIR_PLUGIN_TABLEDATA.\"/img_pack/tabledata.gif\");\r\n echo \"<br/>Le param&#232;tre <i>table</i> (valeur: '\"\r\n ,$table\r\n ,\"') indique une table prot&#233;g&#233;e de SPIP.<br/><br/>\";\r\n echo fin_cadre_relief(true);\r\n echo \"<center><a href='\"\r\n , tabledata_url_generer_ecrire('tabledata',\"table\")\r\n , \"'>- Retour &#224; la liste des tables -</a></center>\";\r\n tabledata_Page_fin();\r\n exit;\r\n }\r\n } // if (!$description)\r\n\r\n $description = sql_showtable($table, $serveur);\r\n\r\n $table2 = \"\";\r\n if ($boolDebrid && !$description)\r\n {\r\n // recherche avec l'extention définie pour SPIP tabledata_table_prefix()\r\n $table2 = tabledata_table_prefix().'_'. $table;\r\n $description = sql_showtable($table2, $serveur);\r\n } // if (!$description)\r\n\r\n spip_log(\"description \".$description);\r\n $field = $description['field'];\r\n $key = $description['key'];\r\n //$intClefPrimaireNbChamp= (count($key)>0?count(explode(\",\",$key[\"PRIMARY KEY\"])):0);\r\n\r\n $intNbClef = count($key);\r\n if (array_key_exists(\"PRIMARY KEY\",$key))\r\n {\r\n $intClefPrimaireNbChamp= count(explode(\",\",$key[\"PRIMARY KEY\"]));\r\n }\r\n else\r\n {\r\n $intClefPrimaireNbChamp = 0 ;\r\n }\r\n\r\n //tabledata_debug(\"Nombre de clef :\".$intNbClef.\" Primaire : \".$intClefPrimaireNbChamp, $key) ;\r\n\r\n // if (! ($field && $key))\r\n if (! ($field))\r\n {\r\n // la table n'existe pas !!\r\n echo debut_cadre_relief(\"../\"._DIR_PLUGIN_TABLEDATA.\"/img_pack/tabledata.gif\");\r\n echo \"Le param&#232;tre <i>table</i> (valeur: '\"\r\n ,$table\r\n ,\"') n'indique pas une table exploitable par le serveur SQL \",$serveur;\r\n echo fin_cadre_relief(true);\r\n echo \"<center><a href='\"\r\n , tabledata_url_generer_ecrire('tabledata',\"table\")\r\n , \"'>- Retour &#224; la liste des tables -</a></center>\";\r\n } // if (! ($field && $key))\r\n else\r\n {\r\n // la table existe.\r\n if ($table2) $table = $table2;\r\n\r\n switch ($intClefPrimaireNbChamp)\r\n {\r\n case 0 :\r\n // Il n'y a pas de clef primaire => désactiver modification...\r\n // désactiver modif\r\n $boolFntAjout = true;\r\n $boolFntModif = true ; // false;\r\n $txtMsgInfoTable= \"<br/>Votre table ne contient pas de clef primaire. \"\r\n .\"<I>La modification des enregistrements est <!--d&#233;s-->activ&#233;e\"\r\n .\"<I>(&#224; vos risques et p&#233;rils, surtout si plusieurs enregistrement sont &#233;gaux)\"\r\n .\"</i><br/>\";\r\n\r\n foreach($field as $k=>$d)\r\n {\r\n $key[\"PRIMARY KEY\"][] = $k;\r\n }\r\n\r\n break;\r\n\r\n case 1 :\r\n // il y a une clé primaire sur champ unique =OK\r\n if (strpos(strtoupper($field[$key[\"PRIMARY KEY\"]]),\"AUTO_INCREMENT\",0)===False)\r\n {\r\n // Si pas d'autoincrement : désactiver ajout\r\n // $boolFntAjout = false;\r\n $txtMsgInfoTable= \"<br/>La clef primaire de la table n'est pas\"\r\n .\" autoincr&#233;ment&#233;e. \"\r\n //.\"<I>(L'insertion d'un nouvel enregistrement est d&#233;sactiv&#233;e)\"\r\n .\"</i><br/>\";\r\n } //if (strpos($field[$key[\"PRIMARY KEY\"]]\r\n // else\r\n // {\r\n // Si autoincrement : Activer ajout\r\n $boolFntAjout = true;\r\n $txtMsgInfoTable= \"\";\r\n //} //if (strpos($field[$key[\"PRIMARY KEY\"]]\r\n $boolFntModif = true;\r\n $key[\"PRIMARY KEY\"] = explode(\",\",$key[\"PRIMARY KEY\"]);\r\n break;\r\n\r\n default :\r\n // il y a une clé primaire sur champs multiple\r\n //$boolFntAjout = false;\r\n $boolFntAjout = true;\r\n $boolFntModif = true;\r\n\r\n //$txtMsgInfoTable= \"<br/>La clef primaire contient plusieurs champs: \".$key[\"PRIMARY KEY\"]\r\n // .\"<br/><I>(L'insertion est d&#233;sactiv&#233;e)</i><br/>\";\r\n $txtMsgInfoTable= \"<br/>La clef primaire contient plusieurs champs: \".$key[\"PRIMARY KEY\"];\r\n\r\n $key[\"PRIMARY KEY\"] = explode(\",\",$key[\"PRIMARY KEY\"]);\r\n } //switch ($intClefPrimaireNbChamp)\r\n\r\n // CHOIX DE L'ACTION A REALISER => de l'affichage\r\n\r\n if ($_SERVER['REQUEST_METHOD'] == 'POST')\r\n {\r\n // la page est arrivée en POST\r\n switch ($_POST['tdaction'])\r\n {\r\n case \"ordresuplig\" :\r\n // la page est arrivée en POST avec action=ordresuplig\r\n // ==> Demande d'effacer la fiche (enregistrement)\r\n tabledata_Cadre_InfoEffacer($table , $field, $key, $serveur, $idLigne) ;\r\n echo \"<center><a href='\"\r\n , tabledata_url_generer_ecrire('tabledata',\"table\")\r\n , \"'>- Retour &#224; la liste des tables -</a></center>\";\r\n echo $txtMsgInfoTable;\r\n tabledata_Cadre_Lister($table, $serveur, $field, $key, $boolFntModif,$trisens,$trival,$intPremierEnreg);\r\n if ($boolFntAjout) tabledata_Cadre_Ajouter($table, $serveur, $field, $key);\r\n echo \"<center><a href='\"\r\n , tabledata_url_generer_ecrire('tabledata',\"table\")\r\n , \"'>- Retour &#224; la liste des tables -</a></center>\";\r\n break;\r\n case \"maj\" :\r\n // la page est arrivée en POST avec action=maj\r\n // ==> Demande Enregistrement des valeurs.\r\n tabledata_Cadre_InfoModifier($table , $field, $key, $serveur, $idLigne) ;\r\n echo \"<center><a href='\"\r\n , tabledata_url_generer_ecrire('tabledata',\"table\")\r\n , \"'>- Retour &#224; la liste des tables -</a></center>\";\r\n echo $txtMsgInfoTable;\r\n tabledata_Cadre_Lister($table, $serveur, $field, $key, $boolFntModif,$trisens,$trival,$intPremierEnreg);\r\n if ($boolFntAjout) tabledata_Cadre_Ajouter($table, $serveur, $field, $key);\r\n echo \"<center><a href='\"\r\n , tabledata_url_generer_ecrire('tabledata',\"table\")\r\n , \"'>- Retour &#224; la liste des tables -</a></center>\";\r\n break;\r\n default:\r\n // la page est arrivée en POST sans action ou autre\r\n // ==> Demande Insertion des valeurs.\r\n tabledata_Cadre_InfoInserer($table, $serveur);\r\n // Afficher la liste\r\n echo \"<center><a href='\"\r\n , tabledata_url_generer_ecrire('tabledata',\"table\")\r\n , \"'>- Retour &#224; la liste des tables -</a></center>\";\r\n\r\n echo $txtMsgInfoTable;\r\n $intPremierEnreg = \"-1\";\r\n tabledata_Cadre_Lister($table, $serveur, $field, $key, $boolFntModif,$trisens,$trival,$intPremierEnreg);\r\n // Afficher cadre Ajout\r\n if ($boolFntAjout) tabledata_Cadre_Ajouter($table, $serveur, $field, $key);\r\n echo \"<center><a href='\"\r\n , tabledata_url_generer_ecrire('tabledata',\"table\")\r\n , \"'>- Retour &#224; la liste des tables -</a></center>\";\r\n break;\r\n } // switch ($_POST['tdaction'])\r\n } // if ($_SERVER['REQUEST_METHOD'] == 'POST')\r\n else\r\n {\r\n // la page n'est pas arrivée en POST => en GET\r\n switch ($_GET['tdaction'])\r\n {\r\n case \"edit\" :\r\n // avec action=maj\r\n // ==> Affichage formulaire de modification\r\n tabledata_Cadre_Modifier($table, $serveur, $field, $key, $idLigne);\r\n break;\r\n case \"suplig\" :\r\n // avec action=sup\r\n // ==> Affichage formulaire de modification\r\n\r\n tabledata_Cadre_Supprimer($table, $serveur, $field, $key, $idLigne);\r\n break;\r\n default :\r\n // sans action ou autre\r\n // ==> Affichage de la liste\r\n echo \"<center><a href='\"\r\n , tabledata_url_generer_ecrire('tabledata',\"table\")\r\n , \"'>- Retour &#224; la liste des tables -</a></center>\";\r\n echo $txtMsgInfoTable;\r\n echo tabledata_Cadre_Lister($table, $serveur, $field, $key, $boolFntModif,$trisens,$trival,$intPremierEnreg);\r\n if ($boolFntAjout) tabledata_Cadre_Ajouter($table, $serveur, $field, $key);\r\n echo \"<center><a href='\"\r\n , tabledata_url_generer_ecrire('tabledata',\"table\")\r\n , \"'>- Retour &#224; la liste des tables -</a></center>\";\r\n break;\r\n } // switch ($_GET['action'])\r\n } // if ($_SERVER['REQUEST_METHOD'] == 'POST')\r\n } // if (! ($field && $key))\r\n\r\n\t// inclusion du bouton d'export\r\n\ttabledata_cadre($table);\r\n\r\n tabledata_Page_fin();\r\n\r\n}", "public function principal()\n\t {\n\t\t require_once('../../site_media/html/cursos/cu_Admin.php');\n\t }", "public function passo1() {\n $this->Traducao->import('default.pot');\n }", "private function mprofil() {\n\t\t\t$this->_ctrlAdmin = new ControleurAdmin();\n\t\t\t$this->_ctrlAdmin->userProfil();\n\t}", "function viewAction(){\r\n\t\t//$iUnitId = Sys_Publib_Library::_getItemAttrById($_SESSION['arr_all_staff'],$_SESSION['staff_id'],'unit_id');\r\n\t\t//Lay ID phong ban cua NSD dang nhap hien thoi\r\n\t\t$pUrl = $_SERVER['REQUEST_URI'];\r\n\t\t$objFunction =\tnew\tSys_Function_DocFunctions()\t;\r\n\t\t$objFilter = new Zend_Filter();\t\t\t\r\n\t\t// Tieu de man hinh danh sach\r\n\t\t$this->view->docInfo \t\t= \"THÔNG TIN VĂN BẢN\";\r\n\t\t$sDocumentId = $this->_request->getParam('hdn_object_id','');\r\n\t\t$sType\t\t = $this->_request->getParam('hdn_type','');\r\n\t\t//Lay cac hang so dung chung\r\n\t\t$arrConst = Sys_Init_Config::_setProjectPublicConst();\r\n\t\t$this->view->arrConst = $arrConst;\r\n\t\t// Tao doi tuong Zend_Filter\r\n\t\t$objFilter = new Zend_Filter();\r\n\t\t$ojbSysLib = new Sys_Library();\r\n\t\t$objFullTextSearch = new fulltextsearch_modFulltextsearch();\r\n\t\t//Lay thong tin trong danh muc\r\n\t\t$arrDocSingle = $objFullTextSearch->DocFullTextSearchDocGetSingle($sDocumentId, $sType);\t\t\t\r\n\t\t$this->view->arrDocSingle = $arrDocSingle;\r\n\t\t//Lay gia tri tim kiem tren form\r\n\t\t\t$sfullTextSearch \t= $this->_request->getParam('txtfullTextSearch','');\r\n\t\t\t$iYear\t \t\t\t= $this->_request->getParam('year','');\r\n\t\t\t$iCurrentPage\t\t= $this->_request->getParam('hdn_current_page',0);\t\r\n\t\t\tif ($iCurrentPage <= 1){\r\n\t\t\t\t$iCurrentPage = 1;\r\n\t\t\t}\r\n\t\t\t$iNumRowOnPage = $this->_request->getParam('cbo_nuber_record_page',0);\r\n\t\t\tif ($iNumRowOnPage == 0)\r\n\t\t\t\t$iNumRowOnPage = 15;\r\n\t\t\t$arrParaSet = array(\"trangHienThoi\"=>$iCurrentPage, \"soBanGhiTrenTrang\"=>$iNumRowOnPage,\"chuoiTimKiem\"=>$sfullTextSearch,\"Nam\"=>$iYear);\r\n\t\t\t$_SESSION['seArrParameter'] = $arrParaSet;\t\r\n\t\t\r\n\t}", "function afficher(){?>\n<div id=\"zonetravail\"><div class = 'titre'>GESTION DES COMPTES.</div>\n<form action=\"<?php echo $_SERVER['PHP_SELF']; ?>\" name=\"frmgrid\" method=\"POST\" enctype=\"multipart/form-data\">\n\t<div class = 'cadre'><fieldset><legend>Liste des classes.</legend>\n <?php \n\t$print = new printlink('imprimercompte.php', false);\n\t$print->display();\n\t$query = \"SELECT c.IDCOMPTE, CONCAT(e.NOMEL, ' ', e.PRENOM) AS NOM, c.DATECREATION, c.AUTEUR \n\tFROM compte c \n\tINNER JOIN eleve e ON (e.MATEL = c.CORRESPONDANT) \n\tUNION\n\tSELECT c.IDCOMPTE, CONCAT(p.NOMPROF, ' ', p.PRENOM) AS NOM, c.DATECREATION, c.AUTEUR \n\tFROM compte c \n\tINNER JOIN professeur p ON (p.IDPROF = c.CORRESPONDANT) \n\tUNION \n\tSELECT c.IDCOMPTE, CONCAT(s.NOM, ' ', s.PRENOM) AS NOM, c.DATECREATION, c.AUTEUR \n\tFROM compte c \n\tINNER JOIN staff s ON (s.IDSTAFF = c.CORRESPONDANT)\";\n\t$grid = new grid($query, 0);\n\t$grid->addcolonne(0, \"COMPTE\", 'IDCOMPTE', true);\n\t$grid->addcolonne(1, \"PROPRIETAIRE\", 'NOM', TRUE);\n\t$grid->addcolonne(2, \"DATE CREATION\", 'DATECREATION', TRUE);\n\t$grid->addcolonne(3, \"CREATEUR\", 'AUTEUR', TRUE);\n\t$grid->setColDate(2);\n\t$grid->selectbutton = true;\n\t//On ajoute les cases a cocher que si l'utilisateur peut effectuer des suppressions en cascade\n\tif(is_autorized(\"DEL_COMPTE\"))\n\t\t$grid->selectbutton = true;\n\t//Verifie si l'utilisateur a le droit d'effectuer une suppression de professeur\n\tif(is_autorized(\"DEL_COMPTE\")){\n\t\t$grid->deletebutton = true;\n\t\t$grid->deletebuttontext = \"Supprimer\";\n\t}\n\t//Verifie si l'utilisateur a le droit d'effectuer une modification de professeur\n\tif(is_autorized(\"EDIT_COMPTE\")){\n\t\t$grid->editbutton = true;\n\t\t$grid->editbuttontext = \"Modifier\";\n\t}\n\t$grid->display();\n\t?>\n\t</fieldset></div>\n <div class=\"navigation\"><?php if(is_autorized(\"ADD_COMPTE\")) \n\t\t\tprint \"<input type = 'button' value = 'Ajouter' onclick=\\\"rediriger('ajouter.php');\\\" />\";\n\t\tif(is_autorized(\"DEL_COMPTE\"))\n\t\t\t\tprint \"<input type = 'button' onClick=\\\"deletecheck()\\\" value=\\\"Supprimer\\\"/>\";\n\t?>\n </div>\n </form></div>\n<?php }", "public function index()\n {\n $this->utils->Restreindre($this->userConnecter->admin, $this->utils->Acces_module($this->userConnecter->profil, 2));\n $data['lang'] = $this->lang->getLangFile($this->getSession()->getAttribut('lang'));\n $params = array('view' => 'compte/accueil');\n $this->view($params, $data);\n }", "function cl_aguacoletorexporta() {\n //classes dos rotulos dos campos\n $this->rotulo = new rotulo(\"aguacoletorexporta\");\n $this->pagina_retorno = basename($GLOBALS[\"HTTP_SERVER_VARS\"][\"PHP_SELF\"]);\n }", "public function setForAuteur()\n {\n //met à jour les proposition qui n'ont pas de base contrat et qui ne sont pas null\n /*PLUS BESOIN DE BASE CONTRAT\n \t\t$dbP = new Model_DbTable_Iste_proposition();\n \t\t$dbP->update(array(\"base_contrat\"=>null), \"base_contrat=''\");\n */\n\t \t//récupère les vente qui n'ont pas de royalty\n\t \t$sql = \"SELECT \n ac.id_auteurxcontrat, ac.id_livre\n , ac.id_isbn, ac.pc_papier, ac.pc_ebook\n , a.prenom, a.nom, c.type, IFNULL(a.taxe_uk,'oui') taxe_uk\n ,i.num\n , v.id_vente, v.date_vente, v.montant_livre, v.id_boutique, v.type typeVente\n , i.id_editeur, i.type typeISBN\n , impF.conversion_livre_euro\n FROM iste_vente v\n INNER JOIN iste_isbn i ON v.id_isbn = i.id_isbn \n INNER JOIN iste_importdata impD ON impD.id_importdata = v.id_importdata\n INNER JOIN iste_importfic impF ON impF.id_importfic = impD.id_importfic\n INNER JOIN iste_auteurxcontrat ac ON ac.id_isbn = v.id_isbn\n INNER JOIN iste_contrat c ON c.id_contrat = ac.id_contrat\n INNER JOIN iste_auteur a ON a.id_auteur = ac.id_auteur\n INNER JOIN iste_livre l ON l.id_livre = i.id_livre \n LEFT JOIN iste_royalty r ON r.id_vente = v.id_vente AND r.id_auteurxcontrat = ac.id_auteurxcontrat\n WHERE pc_papier is not null AND pc_ebook is not null AND pc_papier != 0 AND pc_ebook != 0\n AND r.id_royalty is null \";\n\n $stmt = $this->_db->query($sql);\n \n \t\t$rs = $stmt->fetchAll(); \n \t\t$arrResult = array();\n \t\tforeach ($rs as $r) {\n\t\t\t//calcule les royalties\n \t\t\t//$mtE = floatval($r[\"montant_euro\"]) / intval($r[\"nbA\"]);\n \t\t\t//$mtE *= floatval($r[\"pc_papier\"])/100;\n \t\t\tif($r[\"typeVente\"]==\"ebook\")$pc = $r[\"pc_ebook\"];\n \t\t\telse $pc = $r[\"pc_papier\"];\n $mtL = floatval($r[\"montant_livre\"])*floatval($pc)/100;\n //ATTENTION le taux de conversion est passé en paramètre à l'import et le montant des ventes est calculé à ce moment\n \t\t\t//$mtD = $mtL*floatval($r[\"taux_livre_dollar\"]);\n \t\t\t$mtE = $mtL*floatval($r['conversion_livre_euro']);\n //ajoute les royalties pour l'auteur et la vente\n //ATTENTION les taxes de déduction sont calculer lors de l'édition avec le taux de l'année en cours\n $dt = array(\"pourcentage\"=>$pc,\"id_vente\"=>$r[\"id_vente\"]\n ,\"id_auteurxcontrat\"=>$r[\"id_auteurxcontrat\"],\"montant_euro\"=>$mtE,\"montant_livre\"=>$mtL\n ,\"conversion_livre_euro\"=>$r['conversion_livre_euro']);\n\t \t\t$arrResult[]= $this->ajouter($dt\n ,true,true);\n //print_r($dt);\n \t\t}\n \t\t\n \t\treturn $arrResult;\n }", "public function index(){\n\t\t$this->accueil();\n\t}", "public function pageAccueilAction(){\n\t\t$cm = new ColumnManager();\n\t\t$tm = new TaskManager();\n\n\t\t$columns = $cm->getColumns(10); // arg : limit\n\t\trequire (\"vue/vue_accueil.php\");\n\n\t}", "public function enrutando()\n\t\t{\n\t\t\t$metodo \t\t\t= $this->_metodo;\n\t\t\t$argumentos \t\t= $this->_argumentos;\n\t\t\t$controlador \t\t= $this->_controlador;\n\t\t\t$claseControlador \t= $controlador . 'Controlador';\n\t\t\t$rutaControlador \t= ROOT . 'controlador' . DS . $claseControlador . '.php';\n\n\t\t\tif (!is_readable($rutaControlador)) {\n\t\t\t\theader(\"Location: \" . BASE_URL . 'accesos/paginaVacia/');\n\t\t\t}\n\t\t\telse{\n\t\t\t\tControlador::cargarControlador($rutaControlador,$claseControlador,$metodo,$argumentos);\n\t\t\t}\n\n\t\t}", "function panier2bdd() {\n\t// if (!empty($_SESSION['dims']['userid']) && !empty($_SESSION['catalogue']['panier'])) {\n\tif (!empty($_SESSION['dims']['userid'])) {\n\t\tinclude_once DIMS_APP_PATH.'/modules/catalogue/include/class_panier.php';\n\t\t$panier = new cata_panier();\n\t\t$panier->open($_SESSION['dims']['userid']);\n\t\t$panier->articles = array();\n\n\t\t$panier->fields['libelle'] = '';\n\t\t$panier->fields['id_user'] = $_SESSION['dims']['userid'];\n\t\t$panier->fields['id_module'] = $_SESSION['dims']['moduleid'];\n\n\t\tif (isset($_SESSION['catalogue']['panier'])) {\n\t\t\tforeach ($_SESSION['catalogue']['panier']['articles'] as $ref => $values) {\n\t\t\t\t$panier->articles[] = array(\n\t\t\t\t\t'ref' \t\t\t=> $ref,\n\t\t\t\t\t'qte' \t\t\t=> $values['qte'],\n\t\t\t\t\t'forced_price' \t=> (isset($values['forced_price']) ? $values['forced_price'] : 'NULL')\n\t\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t$panier->save();\n\t}\n}", "public static function stockAttribu() {\n $results = ModelStockAttribu::getAllIdcentre();\n $results1= ModelStockAttribu::getAllIdvaccin();\n // ----- Construction chemin de la vue\n include 'config.php';\n $vue = $root . '/app/view/stock/viewAttribution.php';\n require ($vue);\n }", "function main()\t{\n\t\tglobal $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;\n\n\t\t// Access check!\n\t\t// The page will show only if there is a valid page and if this page may be viewed by the user\n\t\t$this->pageinfo = t3lib_BEfunc::readPageAccess($this->id,$this->perms_clause);\n\t\t$access = is_array($this->pageinfo) ? 1 : 0;\n\n\t\tif (($this->id && $access) || ($BE_USER->user[\"admin\"] && !$this->id))\t{\n\n\t\t\t\t// Draw the header.\n\t\t\t$this->doc = t3lib_div::makeInstance(\"bigDoc\");\n\t\t\t$this->doc->backPath = $BACK_PATH;\n\t\t\t$this->doc->form='<form action=\"index.php?id='.$this->id.'\" method=\"POST\">';\n\n\t\t\t\t// JavaScript\n\t\t\t$this->doc->JScode = '\n\t\t\t\t<script language=\"javascript\" type=\"text/javascript\">\n\t\t\t\t\tscript_ended = 0;\n\t\t\t\t\tfunction jumpToUrl(URL)\t{\n\t\t\t\t\t\tdocument.location = URL;\n\t\t\t\t\t}\n\t\t\t\t</script>\n\t\t\t';\n\t\t\t$this->doc->postCode='\n\t\t\t\t<script language=\"javascript\" type=\"text/javascript\">\n\t\t\t\t\tscript_ended = 1;\n\t\t\t\t\tif (top.fsMod) top.fsMod.recentIds[\"web\"] = 0;\n\t\t\t\t</script>\n\t\t\t';\n\n\t\t\t$headerSection = $this->doc->getHeader(\"pages\",$this->pageinfo,$this->pageinfo[\"_thePath\"]).\"<br />\".$LANG->sL(\"LLL:EXT:lang/locallang_core.xml:labels.path\").\": \".t3lib_div::fixed_lgd_pre($this->pageinfo[\"_thePath\"],50);\n\n\t\t\t$this->content.=$this->doc->startPage($LANG->getLL(\"title\"));\t\n\t\t\texec('hostname',$ret);\n\t\t\t$ret=implode(\"\",$ret);\n\t\t\t$this->content.=$this->doc->header($LANG->getLL(\"title\") .\" on: $ret\");\n\t\t\t$this->content.=$this->doc->spacer(5);\n\t\t\t$this->content.=$this->doc->section(\"\",$this->doc->funcMenu($headerSection,t3lib_BEfunc::getFuncMenu($this->id,\"SET[function]\",$this->MOD_SETTINGS[\"function\"],$this->MOD_MENU[\"function\"])));\n\t\t\t$this->content.=$this->doc->divider(5);\n\n\n\t\t\t// Render content:\n\t\t\t$this->moduleContent();\n\n\n\t\t\t// ShortCut\n\t\t\tif ($BE_USER->mayMakeShortcut())\t{\n\t\t\t\t$this->content.=$this->doc->spacer(20).$this->doc->section(\"\",$this->doc->makeShortcutIcon(\"id\",implode(\",\",array_keys($this->MOD_MENU)),$this->MCONF[\"name\"]));\n\t\t\t}\n\n\t\t\t$this->content.=$this->doc->spacer(10);\n\t\t} else {\n\t\t\t\t// If no access or if ID == zero\n\n\t\t\t$this->doc = t3lib_div::makeInstance(\"mediumDoc\");\n\t\t\t$this->doc->backPath = $BACK_PATH;\n\n\t\t\t$this->content.=$this->doc->startPage($LANG->getLL(\"title\"));\n\t\t\t$this->content.=$this->doc->header($LANG->getLL(\"title\"));\n\t\t\t$this->content.=$this->doc->spacer(5);\n\t\t\t$this->content.=$this->doc->spacer(10);\n\t\t}\n\t}", "function action_outline_supp_row_dist()\n{\n\t//$arg = $securiser_action();\n\t$arg = _request('arg');\n\n\t$arg = explode(':',$arg);\n\t$id_form = $arg[0];\n\t$id_donnee = $arg[1];\n\t\n\t//Forms_supprimer_donnee($id_form,$id_donnee);\n\tForms_arbre_supprimer_donnee($id_form,$id_donnee,false);\n\n\tif ($redirect = urldecode(_request('redirect'))){\n\t\tinclude_spip('inc/headers');\n\t\tredirige_par_entete(str_replace('&amp;','&',$redirect));\n\t}\n}", "function cl_editalrua() { \n //classes dos rotulos dos campos\n $this->rotulo = new rotulo(\"editalrua\"); \n $this->pagina_retorno = basename($GLOBALS[\"HTTP_SERVER_VARS\"][\"PHP_SELF\"]);\n }", "function cl_moblevantamentoedi() { \n //classes dos rotulos dos campos\n $this->rotulo = new rotulo(\"moblevantamentoedi\"); \n $this->pagina_retorno = basename($GLOBALS[\"HTTP_SERVER_VARS\"][\"PHP_SELF\"]);\n }", "public function gestioneUtenti(){\n\t\t// Istanzio Grocery Crud\n\t\t$crud = new grocery_CRUD();\n\t\t$crud->set_model('Mod_GCR');\n\t\t$crud->set_theme('bootstrap');\n\t\t$crud->set_language('italian');\n\t\t// Determino la tabella di riferimento\n\t\t//$crud->set_table('utenti');\n\t\t$crud->set_table('users');\n\t\t// Imposto la relazione n-n\n\t\t$crud->set_relation_n_n('elenco_categorie', 'utenti_categorie', 'tasks_categorie', 'id', 'id_categoria', 'categoria');\n\t\t$crud->unset_columns(array('ip', 'password','salt'));\n\t\t//$crud->unset_fields(array('id_cliente','username','last_login','ip_address', 'password','salt','activation_code','forgotten_password_code','forgotten_password_time','remember_code','created_on','phone'));\n\t\t$crud->fields(array('last_name','first_name','email','active','elenco_categorie'));\n\t\t$crud->columns(array('last_name','first_name','email','active','elenco_categorie'));\n\t\t$crud->display_as('first_name', 'Nome');\n\t\t$crud->display_as('last_name', 'Cognome');\n\t\t$crud->display_as('active', 'Abilitato');\n\n\t\t$crud->unset_delete();\n\t\t$crud->unset_bootstrap();\n\t\t$output = $crud->render();\n\t\t// Definisco le opzioni\n\t\t$opzioni=array();\n\t\t// Carico la vista\n\t\t$this->opzioni=array();\n\t\t$this->codemakers->genera_vista_aqp('crud',$output,$this->opzioni);\n\t}", "function cl_procprocessodoc() { \n //classes dos rotulos dos campos\n $this->rotulo = new rotulo(\"procprocessodoc\"); \n $this->pagina_retorno = basename($GLOBALS[\"HTTP_SERVER_VARS\"][\"PHP_SELF\"]);\n }", "public function BestellingOverzichtView() {\r\n include_once('/var/www/filmpje.nl/backend/Stoelen.php');\r\n include_once('/var/www/filmpje.nl/backend/TotaalPrijsCalculatie.php');\r\n }", "function cl_conhistdoc() {\n //classes dos rotulos dos campos\n $this->rotulo = new rotulo(\"conhistdoc\");\n $this->pagina_retorno = basename($GLOBALS[\"HTTP_SERVER_VARS\"][\"PHP_SELF\"]);\n }", "public function productcompareaddAction() {\n // neu chua khoi tao\n // neu roi add them 1 phan tu vao sesion voi id va uenc da duoc tao\n $this->layout('layout/bags');\n $getuser = $this->forward()->dispatch('Admin\\Controller\\Index', array(\n 'action' => 'getuser'\n ));\n // var_dump($getuser);\n $this->layout()->getuser = $getuser;\n\n $id = $this->params()->fromRoute('id');\n $uenc = $this->params()->fromRoute('uenc');\n\n echo \"id :\";\n var_dump($id);\n echo \"</br>\";\n echo \"uenc :\";\n var_dump($uenc);\n }", "function informationsMonCompte() {\n $this->vue = new V_Vue(\"../vues/templates/template.inc.php\");\n $this->vue->ecrireDonnee(\"titreVue\",\"Margo : Mon Compte\");\n $this->vue->ecrireDonnee('centre',\"../vues/includes/gestionDeCompte/centreMonCompte.inc.php\");\n \n $this->vue->ecrireDonnee(\"titreSection\",\"Mon Compte: Informations\");\n // Centre : formulaire de connexion\n $this->vue->ecrireDonnee('loginAuthentification',MaSession::get('login')); \n \n // ... depuis la BDD \n $daoPers = new M_DaoPersonne();\n $daoPers->connecter();\n $perso = $daoPers->getOneByLogin(MaSession::get('login'));\n \n $this->vue->ecrireDonnee(\"infoPerso\",$perso);\n \n $this->vue->afficher();\n }", "function cl_contacorrenteregravinculo() { \n //classes dos rotulos dos campos\n $this->rotulo = new rotulo(\"contacorrenteregravinculo\"); \n $this->pagina_retorno = basename($GLOBALS[\"HTTP_SERVER_VARS\"][\"PHP_SELF\"]);\n }", "function cl_sau_receitamedica() {\n //classes dos rotulos dos campos\n $this->rotulo = new rotulo(\"sau_receitamedica\");\n $this->pagina_retorno = basename($GLOBALS[\"HTTP_SERVER_VARS\"][\"PHP_SELF\"]);\n }", "public function commissionPartenaire()\n {\n $data['liste_part'] = $this->partenaireModels->getPartenaire();\n $this->views->setData($data);\n\n $this->views->getTemplate('reporting/commissionPartenaire');\n }", "function main()\t{\n\t\tglobal $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;\n\n\t\t// Access check!\n\t\t// The page will show only if there is a valid page and if this page may be viewed by the user\n\t\t$this->pageinfo = t3lib_BEfunc::readPageAccess($this->id,$this->perms_clause);\n\t\t$access = is_array($this->pageinfo) ? 1 : 0;\n\n\t\tif (($this->id && $access) || ($BE_USER->user[\"admin\"] && !$this->id))\t{\n\n\t\t\t// Draw the header.\n\t\t\t$this->doc = t3lib_div::makeInstance(\"mediumDoc\");\n\t\t\t$this->doc->backPath = $BACK_PATH;\n\t\t\t$this->doc->form = '<form action=\"\" method=\"post\">';\n\n\t\t\t// JavaScript\n\t\t\t$this->doc->JScode = '\n\t\t\t\t<script language=\"javascript\" type=\"text/javascript\">\n\t\t\t\t\tscript_ended = 0;\n\t\t\t\t\tfunction jumpToUrl(URL) {\n\t\t\t\t\t\tdocument.location = URL;\n\t\t\t\t\t}\n\t\t\t\t</script>\n\t\t\t';\n\t\t\t$this->doc->postCode='\n\t\t\t\t<script language=\"javascript\" type=\"text/javascript\">\n\t\t\t\t\tscript_ended = 1;\n\t\t\t\t\tif (top.fsMod) top.fsMod.recentIds[\"web\"] = ' . intval($this->id) . ';\n\t\t\t\t</script>\n\t\t\t';\n\n\t\t\t$headerSection = $this->doc->getHeader(\"pages\",$this->pageinfo,$this->pageinfo[\"_thePath\"]).\"<br>\".$LANG->sL(\"LLL:EXT:lang/locallang_core.php:labels.path\").\": \".t3lib_div::fixed_lgd_pre($this->pageinfo[\"_thePath\"],50);\n\n\t\t\t$this->content .= $this->doc->startPage($LANG->getLL(\"title\"));\n\t\t\t$this->content .= $this->doc->header($LANG->getLL(\"title\"));\n\t\t\t$this->content .= $this->doc->spacer(5);\n\t\t\t$this->content.=$this->doc->section(\"\",$this->doc->funcMenu($headerSection,t3lib_BEfunc::getFuncMenu($this->id,\"SET[function]\",$this->MOD_SETTINGS[\"function\"],$this->MOD_MENU[\"function\"])));\n\t\t\t$this->content .= $this->doc->divider(5);\n\n\n\t\t\t// Render content:\n\t\t\t$this->moduleContent();\n\n\n\t\t\t// ShortCut\n\t\t\tif ($BE_USER->mayMakeShortcut())\t{\n\t\t\t\t$this->content .= $this->doc->spacer(20).$this->doc->section(\"\",$this->doc->makeShortcutIcon(\"id\",implode(\",\",array_keys($this->MOD_MENU)),$this->MCONF[\"name\"]));\n\t\t\t}\n\n\t\t\t$this->content.=$this->doc->spacer(10);\n\t\t} else {\n\t\t\t// If no access or if ID == zero\n\n\t\t\t$this->doc = t3lib_div::makeInstance(\"mediumDoc\");\n\t\t\t$this->doc->backPath = $BACK_PATH;\n\n\t\t\t$this->content.=$this->doc->startPage($LANG->getLL(\"title\"));\n\t\t\t$this->content.=$this->doc->header($LANG->getLL(\"title\"));\n\t\t\t$this->content.=$this->doc->spacer(5);\n\t\t\t$this->content.=$this->doc->spacer(10);\n\t\t}\n\t}", "function afficherU(){\n $sql=\"SElECT * From client\";\n $db = config::getConnexion();\n try{\n $liste=$db->query($sql);\n return $liste;\n }\n catch (Exception $e){\n die('Erreur: '.$e->getMessage());\n } \n }", "public function apymd()\n {\n session_start();\n\n if (!isset($_SESSION[\"Apoyo_admin\"])) {\n\n header(\"Location:\" . RUTA_URL . \"/inicio\");\n\n } else {\n\n $this->vista('apoyoAdministrador/menu');\n\n }\n\n }", "function cl_tfd_situacaopedidotfd() { \n //classes dos rotulos dos campos\n $this->rotulo = new rotulo(\"tfd_situacaopedidotfd\"); \n $this->pagina_retorno = basename($GLOBALS[\"HTTP_SERVER_VARS\"][\"PHP_SELF\"]);\n }", "public function pasaje_abonado();", "function MostrarPaginaIngresarServicio()\n {\n if ($this->admin) {\n $this->viewservices->ingresarServicio();\n } else {\n header(\"Location: \" . BASE_URL);\n }\n }", "public function transactPartenaire()\n {\n $data['liste_part'] = $this->partenaireModels->getPartenaire();\n $this->views->setData($data);\n $param['part'] = $this->paramPOST['fk_partenaire'];\n\n if (isset($this->paramPOST[\"datedeb\"]) & isset($this->paramPOST[\"datefin\"])) {\n\n $param['datedeb'] = Utils::date_aaaa_mm_jj($this->paramPOST['datedeb']) ;\n $param['datefin'] = Utils::date_aaaa_mm_jj($this->paramPOST['datefin']);\n\n }else{\n $param['datedeb'] = date('Y-m-d');\n $param['datefin'] = date('Y-m-d');\n }\n\n $this->views->setData($param);\n $this->views->getTemplate('reporting/transactPartenaire');\n }", "public function connexion()\n {\n # echo '<h1>JE SUIS LA PAGE CONNEXION</h1>';\n $this->render('membre/connexion');\n }", "function main(){\n\n switch($_SESSION[\"action\"]){\n\n case ACTION_ADD:\n Reference::select_type();\n break;\n case ACTION_SEARCH:\n if($_SESSION[\"confirm\"] == \"TRUE\"){\n Reference::search();\n unset($_SESSION[\"confirm\"]);\n } else {\n Reference::view_search();\n }\n break;\n case ACTION_BROWSE:\n Reference::browse();\n break;\n default:\n include($GLOBALS[\"draw_includes_path\"].\"/Reference/.Reference.html\");\n\n }\n\n }", "function cl_pcorcamfornelic() {\n //classes dos rotulos dos campos\n $this->rotulo = new rotulo(\"pcorcamfornelic\");\n $this->pagina_retorno = basename($GLOBALS[\"HTTP_SERVER_VARS\"][\"PHP_SELF\"]);\n }", "public function mostraElencoProvvedimenti($pagina) {\r\n \r\n $pagina->setJsFile(\"\");\r\n $operatore = $_SESSION[\"op\"];\r\n $ruolo = $operatore->getFunzione();\r\n $pagina->setHeaderFile(\"./view/header.php\"); \r\n OperatoreController::setruolo($pagina);\r\n $pagina->setMsg('');\r\n \r\n if (isset($_REQUEST['id'])) {\r\n $id = $_REQUEST['id'];\r\n $nuovoProvvedimento = ProvvedimentoFactory::getProvvedimento($id);\r\n $pagina->setTitle(\"Modifica operatore\");\r\n $pagina->setContentFile(\"./view/operatore/nuovoProvvedimento.php\");\r\n $update = true;\r\n } else {\r\n $pagina->setJsFile(\"./js/provvedimenti.js\");\r\n $pagina->setTitle(\"Elenco provvedimenti Unici\");\r\n $pagina->setContentFile(\"./view/operatore/elencoProvvedimenti.php\"); \r\n }\r\n include \"./view/masterPage.php\";\r\n }", "public function reparacion_espera()\n {\n $menu =1;\n $result = $this->reparacion->reparaciones_espera();\n $this->render('/reparacion/reparacion_espera',compact('menu','result'));\n }" ]
[ "0.63431937", "0.6277276", "0.6133261", "0.611524", "0.61041826", "0.60911864", "0.60598433", "0.60385096", "0.6027927", "0.5992345", "0.5971936", "0.5966847", "0.5953288", "0.593235", "0.59230894", "0.5916671", "0.5915536", "0.5915418", "0.5912843", "0.5906971", "0.5878741", "0.58676606", "0.58604336", "0.5817309", "0.579845", "0.5797363", "0.579446", "0.57935756", "0.57935375", "0.57928896", "0.57920146", "0.57919466", "0.579054", "0.57872826", "0.5778694", "0.5773414", "0.57694805", "0.57651407", "0.5763213", "0.5762634", "0.57624614", "0.575979", "0.5756259", "0.5755828", "0.5749594", "0.57491094", "0.5746484", "0.5744878", "0.5741497", "0.57355535", "0.57258457", "0.5725744", "0.5725689", "0.5725242", "0.57228965", "0.5721708", "0.5721121", "0.5719905", "0.57161355", "0.5713521", "0.5713405", "0.571313", "0.57118684", "0.5711698", "0.57103777", "0.5708092", "0.5698239", "0.5696213", "0.5694239", "0.5688833", "0.5687485", "0.5685778", "0.5683993", "0.5677189", "0.56759053", "0.5674548", "0.5673924", "0.5671529", "0.56704354", "0.5668112", "0.5664481", "0.5663208", "0.5658966", "0.565803", "0.56545544", "0.56478304", "0.56404227", "0.5640366", "0.5639195", "0.56380993", "0.5631102", "0.56307226", "0.5630399", "0.56229395", "0.5615321", "0.56109107", "0.5610358", "0.5606912", "0.56067175", "0.5602584", "0.55953586" ]
0.0
-1
affichage de listes de produit d'un client front office
public function viewProductsAction() { $id = $this->getUser()->getId(); $em=$this->getDoctrine()->getManager(); $products=$em->getRepository('HologramBundle:Product')->findBy(array('idUser'=>$id,'etat'=>array('en attente','valider'))); return $this->render('HologramBundle:Front:allProducts.html.twig', array('prod'=>$products)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Listar_Clientes()\n\t {\n\t\tlog_message('INFO','#TRAZA| CLIENTES | Listar_Clientes() >> ');\n\t\t$data['list'] = $this->Clientes->Listar_Clientes();\n return $data;\n\t }", "public function List_client_Physique(){\n $req = self::list(\"SELECT * FROM client_physique\");\n return $req;\n }", "function listarCliente(){\n\t\t$this->procedimiento='rec.ft_cliente_sel';\n\t\t$this->transaccion='REC_CLI_SEL';\n\t\t$this->tipo_procedimiento='SEL';//tipo de transaccion\n\t\t\t\t\n\t\t//Definicion de la lista del resultado del query\n\t\t$this->captura('id_cliente','int4');\n\t\t$this->captura('genero','varchar');\n\t\t$this->captura('ci','varchar');\n\t\t$this->captura('email','varchar');\n\t\t$this->captura('email2','varchar');\n\t\t$this->captura('direccion','varchar');\n\t\t$this->captura('celular','varchar');\n\t\t$this->captura('nombre','varchar');\n\t\t$this->captura('lugar_expedicion','varchar');\n\t\t$this->captura('apellido_paterno','varchar');\n\t\t$this->captura('telefono','varchar');\n\t\t$this->captura('ciudad_residencia','varchar');\n\t\t$this->captura('id_pais_residencia','int4');\n\t\t$this->captura('nacionalidad','varchar');\n\t\t$this->captura('barrio_zona','varchar');\n\t\t$this->captura('estado_reg','varchar');\n\t\t$this->captura('apellido_materno','varchar');\n\t\t$this->captura('id_usuario_ai','int4');\n\t\t$this->captura('fecha_reg','timestamp');\n\t\t$this->captura('usuario_ai','varchar');\n\t\t$this->captura('id_usuario_reg','int4');\n\t\t$this->captura('fecha_mod','timestamp');\n\t\t$this->captura('id_usuario_mod','int4');\n\t\t$this->captura('usr_reg','varchar');\n\t\t$this->captura('usr_mod','varchar');\n\n $this->captura('nombre_completo1','text');\n $this->captura('nombre_completo2','text');\n\t\t$this->captura('pais_residencia','varchar');\n\t\t//$this->captura('nombre','varchar');\n\n\n\n\n\t\t\n\t\t//Ejecuta la instruccion\n\t\t$this->armarConsulta();\n\t\t$this->ejecutarConsulta();\n\t\t\n\t\t//Devuelve la respuesta\n\t\treturn $this->respuesta;\n\t}", "public function display_all_client()\n {\n \n if ( ! file_exists(APPPATH.'views/pages/list.php'))\n {\n // Whoops, we don't have a page for that!\n show_404();\n }\n if (!isset($this->session->userdata['user_role']) || $this->session->userdata['user_role'] < 30)\n {\n $this->session->set_flashdata('message', 'Vous devez avoir les droits de superviseur');\n redirect($_SERVER['HTTP_REFERER']); \n } \n \n $data['title'] = 'Liste des Clients'; \n $data['membres'] = $this->member_model->get_by_type('name = \"Client\"'); \n \n // breadcrumb\n $data['breadcrumbs'] = $this->breadcrumbs('liste');\n \n $this->load->template('pages/list_members',$data);\n }", "public function indexAction()\n {\n // Récupération de la liste des clients.\n $repository = $this->getDoctrine()->getManager()->getRepository('KemistraMainBundle:Client');\n $clientsParticuliers = $repository->getListeParticuliers();\n $clientsProfessionnels = $repository->getListeProfessionels();\n \n \n \n // Génération de la vue.\n return $this->render('KemistraMainBundle:Client:index.html.twig',\n array('clientsParticuliers' => $clientsParticuliers,\n 'clientsProfessionnels' => $clientsProfessionnels));\n }", "function afficherclients(){\r\n\t\t$sql=\"SElECT * From clients\";\r\n\t\t$db = config::getConnexion();\r\n\t\ttry{\r\n\t\t$liste=$db->query($sql);\r\n\t\treturn $liste;\r\n\t\t}\r\n catch (Exception $e){\r\n die('Erreur: '.$e->getMessage());\r\n }\t\r\n\t}", "public function ctlBuscaClientes(){\n\n\t\t$respuesta = Datos::mdlClientes(\"clientes\");\n\n\t\tforeach ($respuesta as $row => $item){\n\t\t\techo '<option value=\"'.$item[\"nombre\"].'\">'.$item[\"nombre\"].'</option>';\n\t\t}\n\t}", "function afficherclientfideless(){\n\t\t$sql=\"SElECT * From clientfideles\";\n\t\t$db = config::getConnexion();\n\t\ttry{\n\t\t$liste=$db->query($sql);\n\t\treturn $liste;\n\t\t}\n catch (Exception $e){\n die('Erreur: '.$e->getMessage());\n }\t\n\t}", "public function ListarClientes()\n{\n\tself::SetNames();\n\t$sql = \" select * from clientes \";\n\tforeach ($this->dbh->query($sql) as $row)\n\t{\n\t\t$this->p[] = $row;\n\t}\n\treturn $this->p;\n\t$this->dbh=null;\n}", "function clientsListAction()\n\t{\n\t\t$searchParameters=$this->_request->getParams();\n\t\t\n\t\t$client_obj = new Ep_Quote_Client();\n\t\t$clients=$client_obj->getClients($searchParameters);\n\t\tif($clients!='NO')\n\t\t\t$this->_view->clients =$clients;\n\t\t\n\t\t$this->_view->client_creators=$client_obj->getClientCreatorUsers();\t\n\t\t\n\t\t$this->render('clients-list');\n\t}", "function listarClienteLibro()\n {\n $this->procedimiento='rec.ft_cliente_sel';\n $this->transaccion='REC_RELIBRO_SEL';\n $this->tipo_procedimiento='SEL';//tipo de transaccion\n\n $this->setParametro('id_oficina_registro_incidente','id_oficina_registro_incidente','integer');\n $this->setParametro('fecha_ini','fecha_ini','date');\n $this->setParametro('fecha_fin','fecha_fin','date');\n $this->setCount(false);\n\n $this->captura('id_reclamo','int4');\n $this->captura('nro_frd','varchar');\n $this->captura('correlativo_preimpreso_frd','int4');\n $this->captura('fecha_hora_incidente','timestamp');\n $this->captura('fecha_hora_recepcion','timestamp');\n $this->captura('fecha_hora_recepcion_sac','date');\n $this->captura('detalle_incidente','text');\n $this->captura('nombre','text');\n $this->captura('celular','varchar');\n $this->captura('telefono','varchar');\n $this->captura('nombre_incidente','varchar');\n $this->captura('sub_incidente','varchar');\n\n //Ejecuta la instruccion\n $this->armarConsulta();\n\t\t//var_dump($this->respuesta); exit;\n $this->ejecutarConsulta();\n //var_dump($this->respuesta); exit;\n //Devuelve la respuesta\n return $this->respuesta;\n\n }", "public function listClientAction()\n {\n \t$em = $this->getDoctrine()->getManager();\n $client = $em->getRepository('CoutureGestionBundle:Client')->findAll();\n $client = array_reverse($client);\n return $this->render('CoutureGestionBundle:Couture:listClient.html.twig', array(\n 'client' => $client\n ));\n }", "public function index()\n {\n $data = $this->Produit->get_by_client(auth()->user()->id);\n return $this->sendResponse($data, 'Produit list');\n }", "public function listar_clientes(){\n\t\t$sql=\"SELECT idpersona, tipo_persona, nombre, tipo_documento, num_documento, contacto, direccion, telefono, email FROM persona\n\t\tWHERE tipo_persona LIKE 'Cliente'\";\n\t\treturn ejecutarConsulta($sql);\n\t}", "public function produits()\n {\n $data[\"list\"]= $this->produit->list();\n $this->template_admin->displayad('liste_Produits');\n }", "public function getNewsByClient()\n\t{\n\t\tif(isset($_SESSION['admin'])){\n\n\t\t\t$empresas = $this->empresasRepo->all();\n\t\t\t$dev_path = \"\";\n\t\t\t $js = \"\n\t\t\t \t\t<script src='{$dev_path}/admin/js/jquery.tabledit.js' ></script>\n\t\t\t \t\t<script src='https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.11/handlebars.js'></script>\n\t\t\t \t\t\";\n \t\t$this->renderViewAdmin('showNewsSent', 'Asignación - Noticias a Clientes - ',\n \t\t\t\tcompact('empresas'), null, $js \n \t\t);\n\t\t}else{\n header( \"Location: https://{$_SERVER[\"HTTP_HOST\"]}/panel/login\");\n }\n\t}", "public function listAction()\n {\t\n\t\t$this->removeSession();\n\t\t$this->verifySessionRights();\n\t\t$this->setActivity(\"List view\");\n $em = $this->getDoctrine()->getManager();\n $oRepClient = $em->getRepository('BoAdminBundle:Client');\n\t\t$nb_tc = $oRepClient->getTotal();\n\t\t//get page\n\t\t$page = $this->get('session')->get('page');\n\t\tif($page==null){\n\t\t\t$page=1;\n\t\t\t$this->get('session')->set('page',1);\n\t\t}\n\t\t//get number line per page\n\t\t$nb_cpp = $em->getRepository('BoAdminBundle:Param')->getParam(\"display_list_page_number\",1);\n\t\t$nb_pages = ceil($nb_tc/$nb_cpp);\n\t\t$offset = $page>0?($page-1) * $nb_cpp:0;\n\t\t$clients = $em->getRepository('BoAdminBundle:Client')->findBy(array(),array('id' => 'desc'),$nb_cpp,$offset);\n $form = $this->createForm('Bo\\AdminBundle\\Form\\ClientType', new Client());\n return $this->render('client/index.html.twig', array(\n 'clients' => $clients,\n\t\t\t'page' => $page, // forward current page to view,\n\t\t\t'nb_pages' => $nb_pages, //total number page,\n 'form' => $form->createView(),\n\t\t\t'total'=>$nb_tc, // record number.\n\t\t\t'nb_cpp' => $nb_cpp,// line's number to display\n\t\t\t'pm'=>\"contracts\",\n\t\t\t'sm'=>\"client\",\n ));\n }", "function afficherU(){\n $sql=\"SElECT * From client\";\n $db = config::getConnexion();\n try{\n $liste=$db->query($sql);\n return $liste;\n }\n catch (Exception $e){\n die('Erreur: '.$e->getMessage());\n } \n }", "public function listarClientes(){\n $this->bd->getConeccion();\n $sql = \"SELECT * FROM CLIENTE\";\n $registros = $this->bd->executeQueryReturnData($sql); \n $this->bd->cerrarConeccion(); \n $clientes = array(); \n \n foreach ($registros as $cliente) {\n $cliente = new Cliente($cliente['id'],$cliente['dni'],$cliente['Nombre'],$cliente['Apellido'],$cliente['Correo'],$cliente['Telefono']);\n array_push($clientes, $cliente);\n }\n \n return $clientes; \n }", "public function listarc()\n\t{\n\t\t$sql=\"SELECT * FROM persona WHERE tipo_persona = 'Cliente';\";\n\t\treturn ejecutarConsulta($sql);\n\t}", "public function view_all_clients() {\n $datos['query'] = $this->profesional_model->findAll();\n $this->load->view('profesionales/view_clientes', $datos);\n }", "function listarCotizacionProcesoCompra(){\n\t\t$this->procedimiento='adq.f_cotizacion_sel';\n\t\t$this->transaccion='ADQ_COTPROC_SEL';\n\t\t$this->tipo_procedimiento='SEL';//tipo de transaccion\n\t\t$this->setCount(false);\n\t\t\n\t\t$this->setParametro('id_proceso_compra','id_proceso_compra','int4');\n\t\t//Definicion de la lista del resultado del query\n\t\t$this->captura('id_cotizacion','int4');\t \n\t\t\n\t\t//Ejecuta la instruccion\n\t\t$this->armarConsulta();\n\t\t$this->ejecutarConsulta();\n\t\t//Devuelve la respuesta\n\t\treturn $this->respuesta;\n\t}", "public function liste(){\n $clientMdb = new clientMoralRepository();\n \n $data['clientsM'] = $clientMdb->liste();\n return $this->view->load(\"clientMoral/liste\", $data);\n }", "public function ListeFrontAction(){\n $em=$this->getDoctrine()->getManager();\n $part=$em->getRepository(Partenaire::class)->findAll();\n return $this->render('partenaire/listeFront.html.twig',[\n 'partenaire'=>$part\n ]);\n }", "public function getAllClient() {\n $qb = $this ->createQueryBuilder('p')\n ->select('p')\n ->where('p.estEmploye = 0')\n ->orderBy('p.nom');\n return $qb->getQuery()->getResult();\n }", "public function TresorieCommerciaux() {\n \n $em = $this->getDoctrine()->getManager();\n $entityCommercial=$em->getRepository('RuffeCardUserGestionBundle:User')->findClientNoPaiment(1);\n return $this->render ( \"RuffeCardTresorieBundle:Default:commerciauxPaiement.html.twig\", array ('Commercial'=>$entityCommercial));\n \n }", "function rec_empresa_list(){\n\t\t}", "public function TresorieClient() {\n \n $em = $this->getDoctrine()->getManager();\n $entityClient = $em->getRepository('RuffeCardUserGestionBundle:Client')->findClientNoPaiment();\n return $this->render ( \"RuffeCardTresorieBundle:Default:clientPaiement.html.twig\", array ('Client'=>$entityClient));\n \n }", "function leerClientes(){\n \n try{\n $stmt = $this->dbh->prepare(\"SELECT c.idClienteTg, c.NombreCte,c.RFCCte, c.direccion, c.ciudad,c.estado, c.email, c.telefono, c.numTg,r.nombreReferencia FROM referencias r join tarjetas_clientes c on r.idreferencia=c.referenciaId where c.status=1\");\n // Especificamos el fetch mode antes de llamar a fetch()\n $stmt->execute();\n $clientes = $stmt->fetchAll(PDO::FETCH_NUM);\n } catch (PDOException $e){\n $clientes=array(\"status\"=>\"0\",\"mensaje\"=>$e->getMessage());\n }\n \n return $clientes;\n }", "function listarServicio(){\r\n\t\t$this->procedimiento='gev.f_tgv_servicio_sel';\r\n\t\t$this->transaccion='tgv_SERVIC_SEL';\r\n\t\t$this->tipo_procedimiento='SEL';//tipo de transaccion\r\n\r\n\t\t$this->setParametro('tipo_interfaz','tipo_interfaz','varchar');\t\r\n\t\t//Definicion de la lista del resultado del query\r\n\t\t$this->captura('id_servicio','int4');\r\n\t\t$this->captura('estado','varchar');\r\n\t\t$this->captura('estado_reg','varchar');\r\n\t\t$this->captura('id_lugar_destino','int4');\r\n\t\t$this->captura('id_ep','int4');\r\n\t\t$this->captura('fecha_asig_fin','date');\r\n\t\t$this->captura('fecha_sol_ini','date');\r\n\t\t$this->captura('descripcion','varchar');\r\n\t\t$this->captura('id_lugar_origen','int4');\r\n\t\t$this->captura('cant_personas','int4');\r\n\t\t$this->captura('fecha_sol_fin','date');\r\n\t\t$this->captura('id_funcionario','int4');\r\n\t\t$this->captura('fecha_asig_ini','date');\r\n\t\t$this->captura('id_usuario_reg','int4');\r\n\t\t$this->captura('fecha_reg','timestamp');\r\n\t\t$this->captura('id_usuario_mod','int4');\r\n\t\t$this->captura('fecha_mod','timestamp');\r\n\t\t$this->captura('usr_reg','varchar');\r\n\t\t$this->captura('usr_mod','varchar');\r\n\t\t$this->captura('desc_funcionario','text');\r\n\t\t$this->captura('desc_lugar_ini','varchar');\r\n\t\t$this->captura('desc_lugar_des','varchar');\r\n\t\t$this->captura('id_funcionario_autoriz','int4');\r\n\t\t$this->captura('observaciones','varchar');\r\n\t\t$this->captura('desc_funcionario_autoriz','text');\r\n\t\t\r\n\t\t//Ejecuta la instruccion\r\n\t\t$this->armarConsulta();\r\n\t\t$this->ejecutarConsulta();\r\n\t\t//echo '--->'.$this->getConsulta(); exit;\r\n\t\t//Devuelve la respuesta\r\n\t\treturn $this->respuesta;\r\n\t}", "public function index()\n {\n //dd(auth()->user()->unreadNotifications );\n //dd(Auth::user()->id );\n $clients = User::whereHas('roles', function ($q) {\n $q->whereIn('name', ['client', 'ecom']);\n })->get();\n $users = [];\n $produits = [];\n\n if (!Gate::denies('ecom')) {\n $produits_total = Produit::where('user_id', Auth::user()->id)->get();\n foreach ($produits_total as $produit) {\n $stock = DB::table('stocks')->where('produit_id', $produit->id)->get();\n if ($stock[0]->qte > 0) {\n $produits[] = $produit;\n }\n }\n //dd($produits);\n }\n\n if (!Gate::denies('ramassage-commande')) {\n //session administrateur donc on affiche tous les commandes\n $total = DB::table('commandes')->where('deleted_at', NULL)->count();\n $commandes = DB::table('commandes')->where('deleted_at', NULL)->orderBy('updated_at', 'DESC')->paginate(10);\n\n //dd($clients[0]->id);\n } else {\n $commandes = DB::table('commandes')->where('deleted_at', NULL)->where('user_id', Auth::user()->id)->orderBy('updated_at', 'DESC')->paginate(10);\n $total = DB::table('commandes')->where('deleted_at', NULL)->where('user_id', Auth::user()->id)->count();\n //dd(\"salut\");\n }\n\n\n foreach ($commandes as $commande) {\n if (!empty(User::find($commande->user_id)))\n $users[] = User::find($commande->user_id);\n }\n //$commandes = Commande::all()->paginate(3) ;\n return view('commande.colis', [\n 'commandes' => $commandes,\n 'total' => $total,\n 'users' => $users,\n 'clients' => $clients,\n 'produits' => $produits\n ]);\n }", "private function lista_clientes()\n {\n\n $lista_clientes = Cliente::where('status', 1)\n ->orderBy('nome')\n ->get();\n\n return $lista_clientes;\n }", "function afficherclient()\r\n\t{\r\n\t\t$sql=\"SElECT * From user\";\r\n\t\t$db = config::getConnexion();\r\n\t\ttry\r\n\t\t{\r\n\t\t$liste=$db->query($sql);\r\n\t\treturn $liste;\r\n\t\t}\r\n catch (Exception $e)\r\n {\r\n die('Erreur: '.$e->getMessage());\r\n }\r\n\t}", "function leerCreditos(){\n \n try{\n $stmt = $this->dbh->prepare(\"SELECT c.idcredito, t.NombreCte,c.tipoContrato, c.montoTotal, c.plazo,c.mensualidad, c.interes,\"\n . \" c.metodoPago, c.observaciones, c.status FROM tarjetas_clientes t join credito c on t.idClienteTg=c.cteId where c.status=1 or c.status=3\");\n // Especificamos el fetch mode antes de llamar a fetch()\n $stmt->execute();\n $clientes = $stmt->fetchAll(PDO::FETCH_NUM);\n } catch (PDOException $e){\n $clientes=array(\"status\"=>\"0\",\"mensaje\"=>$e->getMessage());\n }\n \n return $clientes;\n }", "public function listaCliente() {\n\n return $clientes; // array de clientes\n }", "public function possederListerTous()\n\t{\n\t\t// votre code ici\n\t\treturn Gestion::lister(\"Posseder\");//type array\n\t}", "public function equipementachatListerTous()\n\t{\n\t\t// votre code ici\n\t\treturn Gestion::lister(\"EquipementAchat\");//type array\n\t}", "function listAdviserClients(){\n \n //setup for paging ---\n $per_page = ($this->input->get('result_per_page')? $this->input->get('result_per_page') : 200);\n\t$offset = ($this->input->get('offset')? $this->input->get('offset') : ''); \n\n //Get list of all para-planners for the firm this ifa belongs to ---\n $allParaPlanners = $this->adviser_accessor->getAdvisersOfTypeForFirm( $this->hisFirmID ,'AP');\n\n //if para-planner or noamal we show both assigned and owned ---\n if($this->isSuper == TRUE)//this is a\n {\n //get all clients of the firm for super advisers\n $clients = $this->client_accessor->getClientsOfFirm($this->hisFirmID);\n $assignedClients = null;\n }\n else if($this->isParaPlanner || $this->isNormal )\n { \n $where_search[] = \"(clients.adviser_adviserID = $this->curIfaID )\";\n $clients = $this->client_accessor->searchClients($where_search, $per_page, $offset);\t\n $assignedClients = $this->client_accessor->getAssignedClients($this->curIfaID);\n }\n \n\t\n $data['clients'] = $clients; \n $data['assigned_clients'] = $assignedClients ;\n $data['para_planners'] = $allParaPlanners;\n $data['firmID'] = $this->hisFirmID;\n \n $data['can_edit_roles']= $this->can_edit_roles;\n $data['is_super'] = $this->isSuper;\n\n $data['ajax_url'] = base_url() . $this->moduleName . \"/AdviserRemoteStub/\";\n \n $data['page_title'] = \"Clients\";\n $data['page_header'] = \"Listing of Clients\";\n \n $data['content_view'] = \"adviser/list_clients\";\n $data['sidebar_view'] = \"adviser/adviser_sidebar\";\n\n $data['mod_js'] = $this->getModule_js();\n \n $this->breadcrumbs->push('Adviser', '/adviser/');\n\t$this->breadcrumbs->push('Clients', '/');\n \n $this->template->callDefaultTemplate($data);\n \n }", "public function client_list()\n {\n return ClientList::latest()->paginate(10);\n }", "public function getcliente() {\n \n $procedure = \"call sp_appweb_pt_getclienteinterno()\";\n\t\t$query = $this->db-> query($procedure);\n \n if ($query->num_rows() > 0) {\n\n $listas = '<option value=\"0\" selected=\"selected\"></option>';\n \n foreach ($query->result() as $row)\n {\n $listas .= '<option value=\"'.$row->CCLIENTE.'\">'.$row->RAZONSOCIAL.'</option>'; \n }\n return $listas;\n }{\n return false;\n }\t\n }", "function clientes_novo(){\n global $db;\n $_SESSION['view']='form';\n $msg['titulo']='Incluir clientes';\n $msg['nId']=0; //ID do Cliente -- PRI.\n $msg['cCompany']=''; //Buyer Company Name -- UNI.\n $msg['cAddress']=''; //Address -- .\n $msg['cCity']=''; //City -- .\n $msg['cCEP']=''; //Post Code -- .\n $msg['cCountry']='BRA'; //Country -- .\n $r=SqlQuery(\"SELECT cSigla, wEnglish from paises order by wEnglish\");\n while($l=$r->fetch(PDO::FETCH_ASSOC)){\n $list[$l['cSigla']]=$l['wEnglish'];\n }\n $msg['cCountry_list']=$list;\n $msg['cWeb']=''; //Website -- .\n $msg['cWhatsapp']=''; //WhatsApp (for emergency) -- .\n $msg['cPhone1']=''; //Phone -- .\n $msg['ePerson']='';\n $msg['ePerson_list']=array('MR'=>'Mr.','MS'=>'Ms', 'MRS'=>'Mrs');\n $msg['cPersonalName']=''; //Complete Name (for credential) -- .\n $msg['cCargo']=''; //Job Title (for Credential) -- .\n $msg['cEmail']=''; //Mail (for Credential) -- .\n // J. => Buyer Questionnaire\n $msg['CompanyProfile']=array(); //Company Business Profile -- .\n $msg['CompanyProfile_list']=array('1'=>'Outbound Group Travel',\n '2'=>'Outbound Individual Travel',\n '3'=>'Outbound Corporate / Business Travel',\n '4'=>'Outbound Incentive Travel',\n '5'=>'Outbound Leisure Travel',\n '6'=>'Outbound Adventure Travel',\n '7'=>'Outbound Golf Travel',\n '8'=>'Outbound Spa & Wellness Travel',\n '9'=>'Meeting & Conversations',\n '10'=>'Exhibitions',\n '11'=>'Honey Moon Tours',\n '12'=>'Dive Tours',\n '13'=>'Cruises',\n '14'=>'Events',\n '15'=>'Youth & Student Travel',\n '16'=>'Special Interest Tour Operators',\n '17'=>'Others'\n );\n $msg['ProductInterest']=array(); //Product of Interest -- .\n $msg['ProductInterest_list']=array('1'=>'Accommodation - Hotels Chains',\n '2'=>'Accommodation - Independent Hotels',\n '3'=>'Accommodation - Ressorts',\n '4'=>'Serviced Apartments',\n '5'=>'Airlines',\n '6'=>'National / Regional Tourism Organizations',\n '7'=>'Inbound Tour Operators',\n '8'=>'Professional Conference Organizers',\n '9'=>'Destination Management Companies',\n '10'=>'Day Cruise Operators',\n '11'=>'Regional / International Cruise Operators',\n '12'=>'Car Rental',\n '13'=>'Adventure Tour Operators',\n '14'=>'Dive Operators',\n '15'=>'Attractions / Museums / Galleries',\n '16'=>'Rail Travel',\n '17'=>'Theme Parks',\n '18'=>'Nature / National Parks',\n '19'=>'Restaurants',\n '20'=>'Travel Media',\n '21'=>'Travel Technology Companies',\n '22'=>'Travel Web Portal',\n '23'=>'Meeting / Convention Venue',\n '24'=>'Spass',\n '25'=>'Golf Courses',\n '26'=>'Sports / Special Events',\n '27'=>'Others'\n );\n $msg['eResponsa']=array(); //What Level of Responsibility do You Have for Outbound Business -- .\n $msg['eResponsa_list']=array(\n '1'=>'Final Decision',\n '2'=>'Research',\n '3'=>'Recommend',\n '4'=>'Plan / Organize',\n '5'=>'None',\n '6'=>'Others'\n );\n $msg['eMajorSector']=array(); //Major Selector -- .\n $msg['eMajorSector_list']=array(\n '1'=>'Leisure',\n '2'=>'MICE',\n '3'=>'Leisure + MICE',\n '4'=>'Special Interest (e-Commerce, Online Booking)'\n );\n $msg['nInbound']=''; //Inbound % -- .\n $msg['nOutbound']=''; //Outbound % -- .\n $msg['nOutboundGroup']=array(); //Number of Outbound Group Organized Per Year? -- .\n $msg['nOutboundGroup_list']=array(\n '1'=>'1-15',\n '2'=>'16-30',\n '3'=>'31-45',\n '4'=>'46-60',\n '5'=>'60+',\n '6'=>'None'\n );\n $msg['nOutboundAverage']=array(); //Average Number of Outbound Pax(s) Organized per Year? -- .\n $msg['nOutboundAverage_list']=array(\n '1'=>'1-15',\n '2'=>'16-30',\n '3'=>'31-45',\n '4'=>'46-60',\n '5'=>'60+',\n '6'=>'None'\n );\n $msg['cSeller1']=''; //Name 1 -- .\n $msg['cSeller2']=''; //Name 2 -- .\n $msg['cSeller3']=''; //Name 3 -- .\n $msg['cSeller4']=''; //Name 4 -- .\n $msg['cSeller5']=''; //Name 5 -- .\n $msg['cCountry1']='BRA'; //Country 1 -- .\n $msg['cCountry2']='ARG'; //Country 2 -- .\n $msg['cCountry3']='URY'; //Country 3 -- .\n $msg['cCountry4']='THA'; //Country 4 -- .\n $msg['cCountry5']='ECU'; //Country 5 -- .\n $msg['cDestino1']='BRA'; //Destination 1 -- .\n $msg['cDestino2']='ARG'; //Destination 2 -- .\n $msg['cDestino3']='URY'; //Destination 3 -- .\n $msg['cDestino4']='THA'; //Destination 4 -- .\n $msg['cDestino5']='ECU'; //Destination 5 -- .\n $msg['tDescription']=''; //Company Description -- .\n $msg['cPassw']='';\n return $msg;\n}", "public function listacliente()\n\t{\n\t\t$_cliente= DB::Table('cliente')-> get();\n\t\treturn View::make('cliente.lista', array('cliente' -> $_cliente));\n\t}", "public function ListarDelivery()\n\t{\n\t\tself::SetNames();\n\t\nif($_SESSION[\"acceso\"] == 'repartidor'){\n\n\t$sql = \"SELECT ventas.idventa, ventas.codventa, ventas.codcliente as cliente, ventas.totalpago, ventas.entregado, ventas.delivery, ventas.repartidor, clientes.codcliente, clientes.cedcliente, clientes.nomcliente, clientes.direccliente, usuarios.nombres, GROUP_CONCAT(cantventa, ' | ', producto SEPARATOR '. ') AS detalles FROM ventas INNER JOIN detalleventas ON detalleventas.codventa = ventas.codventa LEFT JOIN clientes ON ventas.codcliente = clientes.codcliente LEFT JOIN usuarios ON ventas.repartidor = usuarios.codigo WHERE ventas.repartidor = '\".$_SESSION[\"codigo\"].\"' AND ventas.entregado = 1 GROUP BY detalleventas.codventa\";\n foreach ($this->dbh->query($sql) as $row)\n\t\t{\n\t\t\t$this->p[] = $row;\n\t\t}\n\t\treturn $this->p;\n\t\t$this->dbh=null;\n\n\t} else {\n\n\t$sql = \"SELECT ventas.idventa, ventas.codventa, ventas.codcliente as cliente, ventas.totalpago, ventas.entregado, ventas.delivery, ventas.repartidor, clientes.codcliente, clientes.cedcliente, clientes.nomcliente, clientes.direccliente, usuarios.nombres, GROUP_CONCAT(cantventa, ' | ', producto SEPARATOR '<br>') AS detalles FROM ventas INNER JOIN detalleventas ON detalleventas.codventa = ventas.codventa LEFT JOIN clientes ON ventas.codcliente = clientes.codcliente LEFT JOIN usuarios ON ventas.repartidor = usuarios.codigo WHERE ventas.delivery = 1 AND ventas.repartidor != 0 AND ventas.entregado = 1 AND ventas.codigo = '\".$_SESSION[\"codigo\"].\"' GROUP BY detalleventas.codventa\";\n foreach ($this->dbh->query($sql) as $row)\n\t\t{\n\t\t\t$this->p[] = $row;\n\t\t}\n\t\treturn $this->p;\n\t\t$this->dbh=null;\n\t}\n}", "function rptIndividualClientAction(){\r\n// \t$this->view->staff_list = $db->getAllIndividual();\r\n// \t$key = new Application_Model_DbTable_DbKeycode();\r\n// \t$this->view->data=$key->getKeyCodeMiniInv(TRUE);\r\n }", "public function listarComentariosAceitos(){\n $this->validaAutenticacao();\n $comentario = Container::getModel('Comentarios');\n $comentario->__set('idVitima', $_POST['idVitima']);\n\n echo (json_encode($comentario->getComentariosAprovadosDashboard()));\n }", "function listarCotizacion(){\n\t\t$this->procedimiento='adq.f_cotizacion_sel';\n\t\t$this->transaccion='ADQ_COT_SEL';\n\t\t$this->tipo_procedimiento='SEL';//tipo de transaccion\n\t\t\t\t\n\t\t\n\t\t$this->setParametro('id_funcionario_usu','id_funcionario_usu','int4');\n $this->setParametro('tipo_interfaz','tipo_interfaz','varchar');\n $this->setParametro('historico','historico','varchar');\n \n\t\t$this->setParametro('id_proceso_compra','id_proceso_compra','int4');\n\t\t//Definicion de la lista del resultado del query\n\t\t$this->captura('id_cotizacion','int4');\n\t\t$this->captura('estado_reg','varchar');\n\t\t$this->captura('estado','varchar');\n\t\t$this->captura('lugar_entrega','varchar');\n\t\t$this->captura('tipo_entrega','varchar');\n\t\t$this->captura('fecha_coti','date');\n\t\t$this->captura('numero_oc','varchar');\n\t\t$this->captura('id_proveedor','int4');\n\t\t$this->captura('desc_proveedor','varchar');\n\t\t\n\t\t$this->captura('fecha_entrega','date');\n\t\t$this->captura('id_moneda','int4');\n\t\t$this->captura('moneda','varchar');\n\t\t$this->captura('id_proceso_compra','int4');\n\t\t$this->captura('fecha_venc','date');\n\t\t$this->captura('obs','text');\n\t\t$this->captura('fecha_adju','date');\n\t\t$this->captura('nro_contrato','varchar');\n\t\t\n\t\t$this->captura('fecha_reg','timestamp');\n\t\t$this->captura('id_usuario_reg','int4');\n\t\t$this->captura('fecha_mod','timestamp');\n\t\t$this->captura('id_usuario_mod','int4');\n\t\t$this->captura('usr_reg','varchar');\n\t\t$this->captura('usr_mod','varchar');\n\t\t$this->captura('id_estado_wf','integer');\n\t\t$this->captura('id_proceso_wf','integer');\n\t\t$this->captura('desc_moneda','varchar');\n\t\t$this->captura('tipo_cambio_conv','numeric');\n\t\t$this->captura('email','varchar');\n\t\t$this->captura('numero','varchar');\n\t\t$this->captura('num_tramite','varchar');\n\t\t$this->captura('id_obligacion_pago','int4');\n\t\t$this->captura('tiempo_entrega','varchar');\n\t\t$this->captura('funcionario_contacto','varchar');\n\t\t$this->captura('telefono_contacto','varchar');\n\t\t$this->captura('correo_contacto','varchar');\n\t\t$this->captura('prellenar_oferta','varchar');\n\t\t$this->captura('forma_pago','varchar');\n\t\t$this->captura('requiere_contrato','varchar');\n\t\t$this->captura('total_adjudicado','numeric');\n\t\t$this->captura('total_cotizado','numeric');\n\t\t$this->captura('total_adjudicado_mb','numeric');\n\t\t$this->captura('tiene_form500','varchar');\n\t\t$this->captura('correo_oc','varchar');\n\n\t\t$this->captura('id_gestion','int4');\n\n\t\t$this->captura('cuce','varchar');\n\t\t$this->captura('fecha_conclusion','date');\n\t\t$this->captura('id_solicitud','int4');\n\t\t$this->captura('justificacion','text');\n\n\t\t//Ejecuta la instruccion\n\t\t$this->armarConsulta();\n\t\t$this->ejecutarConsulta();\n\t\t\n\t\t//Devuelve la respuesta\n\t\treturn $this->respuesta;\n\t}", "public function index(){\n $this->getClientes();\n $cli=Cliente::all();\n foreach ($cli as $cl) {\n $this->getPendientes($cl->idcliente);\n }\n $clientes = DB::table('clientes as c')->join('facturas as f', 'f.idcliente', '=', 'c.idcliente')\n ->select('cedula', 'nombres', 'apellidos', DB::raw('sum(saldo) as saldo'))\n ->where('saldo', '>', 0)\n ->groupBy('cedula', 'nombres', 'apellidos')\n ->havingRaw('sum(saldo) > 0')\n ->orderBy('apellidos')->get();\n return $clientes;\n }", "public function getReporteClientes()\n\t{\n\t\t$spreadsheet = new Spreadsheet();\n\t\t$sheet = $spreadsheet->getActiveSheet();\n\t\t$sql = (\"SELECT \n\t\tclientes.nombre,\n\t\trazonsocial,\n\t\tagentes.codagente AS codigo_agente,\n\t\tagentes.nombre AS agente,\n\t\tclientes.telefono1 AS telefono_cliente,\n\t\tclientes.telefono2 AS telefono_cliente_secundario,\n\t\tdirclientes.direccion,\n\t\tdirclientes.provincia,\n\t\tdirclientes.ciudad\n\tFROM\n\t\t`clientes`\n\t\t\tLEFT JOIN\n\t\tagentes ON agentes.codagente = clientes.codagente\n\t\t\tINNER JOIN\n\t\tdirclientes ON dirclientes.codcliente = clientes.codcliente\n\t\twhere clientes.debaja = 0;\");\n\t\t$this->consulta('SET NAMES utf8');\n\t\t# Escribir encabezado de los productos\n\t\t$encabezado = [\"nombre\",\"razonsocial\",\"codigo_agente\",\"agente\",\"telefono_cliente\",\"telefono_cliente_secundario\",\"direccion\",\"provincia\",\"ciudad\"];\n\t\t# El último argumento es por defecto A1 pero lo pongo para que se explique mejor\n\t\t$sheet->fromArray($encabezado, null, 'A1');\n\n\t\t$resultado = $this->consulta($sql);\n\t\t$res = $resultado->fetchAll(PDO::FETCH_ASSOC);\n\t\t$numeroDeFila = 2;\n\t\tforeach ($res as $data ) {\n\t\t\t# Obtener los datos de la base de datos\n\t\t\t$nombre = $data['nombre'];\n\t\t\t$razonsocial = $data['razonsocial'];\n\t\t\t$codigo_agente = $data['codigo_agente'];\n\t\t\t$agente = $data['agente'];\n\t\t\t$telefono_cliente = $data['telefono_cliente'];\n\t\t\t$telefono_cliente_secundario = $data['telefono_cliente_secundario'];\n\t\t\t$direccion = $data['direccion'];\n\t\t\t$provincia = $data['provincia'];\n\t\t\t$ciudad = $data['ciudad'];\n\t\t\t# Escribirlos en el documento\n\t\t\t$sheet->setCellValueByColumnAndRow(1, $numeroDeFila, $nombre);\n\t\t\t$sheet->setCellValueByColumnAndRow(2, $numeroDeFila, $razonsocial);\n\t\t\t$sheet->setCellValueByColumnAndRow(3, $numeroDeFila, $codigo_agente);\n\t\t\t$sheet->setCellValueByColumnAndRow(4, $numeroDeFila, $agente);\n\t\t\t$sheet->setCellValueByColumnAndRow(5, $numeroDeFila, $telefono_cliente);\n\t\t\t$sheet->setCellValueByColumnAndRow(6, $numeroDeFila, $telefono_cliente_secundario);\n\t\t\t$sheet->setCellValueByColumnAndRow(7, $numeroDeFila, $direccion);\n\t\t\t$sheet->setCellValueByColumnAndRow(8, $numeroDeFila, $provincia);\n\t\t\t$sheet->setCellValueByColumnAndRow(9, $numeroDeFila, $ciudad);\n\t\t\t$numeroDeFila++;\n\t\t}\n\t\t$writer = new Xlsx($spreadsheet);\n\t\t$writer->save('../../reporte/reporte.xlsx');\n\t\techo \"true\";\n\t}", "public function index()\n {\n return product_client::all();\n }", "function _ConsultarClientes()\n\t\t{\n\t\t\t$query='\n\t\t\t\tSELECT\n\t\t\t\tclientes.id,\n\t\t\t\tclientes.nb_cliente,\n\t\t\t\tclientes.nb_apellidos,\n\t\t\t\tclientes.de_email,\n\t\t\t\tclientes.num_celular,\n\t\t\t\tusuarios.nb_nombre as \"Ins_nombre\", \n\t\t\t\tusuarios.nb_apellidos as \"Ins_apellido\" \n\t\t\t\tFROM sgclientes clientes\n\t\t\t\tleft join sgusuarios usuarios on clientes.id_usuario_registro=usuarios.id\n\t\t\t\twhere clientes.sn_activo=1\n\t\t\t\tORDER BY clientes.id ASC\n\t\t\t\n\t\t\t';\n\t\t\t$clientes = $this->EjecutarTransaccionAllNoParams($query);\n\t\t\treturn $clientes;\n\t\t}", "function listarCotizacionRPC(){\n $this->procedimiento='adq.f_cotizacion_sel';\n $this->transaccion='ADQ_COTRPC_SEL';\n $this->tipo_procedimiento='SEL';//tipo de transaccion\n \n \n $this->setParametro('id_funcionario_usu','id_funcionario_usu','int4');\n $this->setParametro('tipo_interfaz','tipo_interfaz','varchar');\n $this->setParametro('id_funcionario_rpc','id_funcionario_rpc','int4');\n $this->setParametro('historico','historico','varchar');\n \n //Definicion de la lista del resultado del query\n $this->captura('id_cotizacion','int4');\n $this->captura('estado_reg','varchar');\n $this->captura('estado','varchar');\n $this->captura('lugar_entrega','varchar');\n $this->captura('tipo_entrega','varchar');\n $this->captura('fecha_coti','date');\n $this->captura('numero_oc','varchar');\n $this->captura('id_proveedor','int4');\n $this->captura('desc_proveedor','varchar');\n $this->captura('fecha_entrega','date');\n $this->captura('id_moneda','int4');\n $this->captura('moneda','varchar');\n $this->captura('id_proceso_compra','int4');\n $this->captura('fecha_venc','date');\n $this->captura('obs','text');\n $this->captura('fecha_adju','date');\n $this->captura('nro_contrato','varchar');\n $this->captura('fecha_reg','timestamp');\n $this->captura('id_usuario_reg','int4');\n $this->captura('fecha_mod','timestamp');\n $this->captura('id_usuario_mod','int4');\n $this->captura('usr_reg','varchar');\n $this->captura('usr_mod','varchar');\n $this->captura('id_estado_wf','integer');\n $this->captura('id_proceso_wf','integer');\n $this->captura('desc_moneda','varchar');\n $this->captura('tipo_cambio_conv','numeric');\n $this->captura('id_solicitud','integer');\n\t\t$this->captura('id_categoria_compra','integer');\n\t\t$this->captura('numero','varchar');\n $this->captura('num_tramite','varchar');\n $this->captura('tiempo_entrega','varchar');\n\t\t$this->captura('requiere_contrato','varchar');\n\t\t$this->captura('total_adjudicado','numeric');\n\t\t$this->captura('total_cotizado','numeric');\n\t\t$this->captura('total_adjudicado_mb','numeric');\n\n\t\t$this->captura('id_gestion','int4');\n\n \n //Ejecuta la instruccion\n $this->armarConsulta();\n $this->ejecutarConsulta();\n \n //Devuelve la respuesta\n return $this->respuesta;\n }", "function listadoClientes(){\n\t\t\t\n\t\t\t//SQL\n\t\t\t$query = \"SELECT * FROM users ORDER BY rol,id DESC;\";\n\t\t\t$rst = $this->db->enviarQuery($query,'R');\n\t\t\t\n\t\t\tif(@$rst[0]['id'] != \"\"){\n\t\t\t\treturn $rst;\n\t\t\t}else{\n\t\t\t\treturn array(\"ErrorStatus\"=>true);\n\t\t\t}\n\t\t}", "function organismes()\n\t{\n\t\tglobal $gCms;\n\t\t$ping = cms_utils::get_module('Ping'); \n\t\t$db = cmsms()->GetDb();\n\t\t$designation = '';\n\t\t$tableau = array('F','Z','L','D');\n\t\t//on instancie la classe servicen\n\t\t$service = new Servicen();\n\t\t$page = \"xml_organisme\";\n\t\tforeach($tableau as $valeur)\n\t\t{\n\t\t\t$var = \"type=\".$valeur;\n\t\t\t//echo $var;\n\t\t\t$scope = $valeur;\n\t\t\t//echo \"la valeur est : \".$valeur;\n\t\t\t$lien = $service->GetLink($page,$var);\n\t\t\t//echo $lien;\n\t\t\t$xml = simplexml_load_string($lien, 'SimpleXMLElement', LIBXML_NOCDATA);\n\t\t\t\n\t\t\tif($xml === FALSE)\n\t\t\t{\n\t\t\t\t$designation.= \"service coupé\";\n\t\t\t\t$now = trim($db->DBTimeStamp(time()), \"'\");\n\t\t\t\t$status = 'Echec';\n\t\t\t\t$action = 'retrieve_ops';\n\t\t\t\tping_admin_ops::ecrirejournal($now,$status,$designation,$action);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$array = json_decode(json_encode((array)$xml), TRUE);\n\t\t\t\t///on initialise un compteur général $i\n\t\t\t\t$i=0;\n\t\t\t\t//on initialise un deuxième compteur\n\t\t\t\t$compteur=0;\n\t\t\t//\tvar_dump($xml);\n\n\t\t\t\t\tforeach($xml as $cle =>$tab)\n\t\t\t\t\t{\n\n\t\t\t\t\t\t$i++;\n\t\t\t\t\t\t$idorga = (isset($tab->id)?\"$tab->id\":\"\");\n\t\t\t\t\t\t$code = (isset($tab->code)?\"$tab->code\":\"\");\n\t\t\t\t\t\t$libelle = (isset($tab->libelle)?\"$tab->libelle\":\"\");\n\t\t\t\t\t\t// 1- on vérifie si cette épreuve est déjà dans la base\n\t\t\t\t\t\t$query = \"SELECT idorga FROM \".cms_db_prefix().\"module_ping_organismes WHERE idorga = ?\";\n\t\t\t\t\t\t$dbresult = $db->Execute($query, array($idorga));\n\n\t\t\t\t\t\t\tif($dbresult && $dbresult->RecordCount() == 0) \n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$query = \"INSERT INTO \".cms_db_prefix().\"module_ping_organismes (libelle, idorga, code, scope) VALUES (?, ?, ?, ?)\";\n\t\t\t\t\t\t\t\t//echo $query;\n\t\t\t\t\t\t\t\t$compteur++;\n\t\t\t\t\t\t\t\t$dbresultat = $db->Execute($query,array($libelle,$idorga,$code,$scope));\n\n\t\t\t\t\t\t\t\tif(!$dbresultat)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t$designation.= $db->ErrorMsg();\t\t\t\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\n\n\t\t\t\t\t}// fin du foreach\n\n\t\t\t}\n\t\t\tunset($scope);\n\t\t\tunset($var);\n\t\t\tunset($lien);\n\t\t\tunset($xml);\n\t\t\tsleep(1);\n\t\t}//fin du premier foreach\n\t\t\n\n\t\t$designation.= $compteur.\" organisme(s) récupéré(s)\";\n\t\t$now = trim($db->DBTimeStamp(time()), \"'\");\n\t\t$status = 'Ok';\n\t\t$action = 'retrieve_ops';\n\t\tping_admin_ops::ecrirejournal($now,$status,$designation,$action);\n\n\t\t\t\n\t\t\n\t}", "public function index()\n {\n $clients = Client::paginate(20);\n\n $clients->getCollection()->transform(function ($client) {\n // $clients = $clients->map(function($client){\n $client->hasWishes = DB::table('wishes')\n ->join('products', 'products.id', 'wishes.product_id')\n ->where('user_id', '=', $client->user_id)\n ->select('products.*')\n ->count();\n return $client;\n });\n $enterprises = Enterprise::all();\n return view('admin.clients.index', compact('clients', 'enterprises'));\n }", "function getSituationPartSocialeClient($id_client, $export_csv = false) {\n global $global_id_agence;\n $id = getAgenceCpteIdProd($global_id_agence);\n $id_prod_ps = $id[\"id_prod_cpte_parts_sociales\"];\n $cpte_ps = getCptPartSociale($id_client, $id_prod_ps); //Info sur tous les cptes de parts sociales du client\n $DATA_PS = array ();\n while (list ($key, $value) = each($cpte_ps)) {\n $data[\"num_complet_cpte\"] = $value[\"num_complet_cpte\"];\n $data[\"intitule_compte\"] = $value[\"intitule_compte\"];\n $data[\"id_titulaire\"] = $value[\"id_titulaire\"];\n $data[\"date_ouvert\"] = pg2phpDate($value[\"date_ouvert\"]);\n $data[\"solde_cpte\"] = afficheMontant($value[\"solde\"], false, $export_csv);\n $data[\"mnt_bloq\"] = $value[\"retrait_unique\"] == 't' ? \"Retrait unique\" : afficheMontant($value[\"mnt_bloq\"] + $value[\"mnt_min_cpte\"] + $value[\"mnt_bloq_cre\"], false, $export_csv);\n $data[\"mnt_disp\"] = $value[\"retrait_unique\"] == 't' ? \"Retrait unique\" : afficheMontant(getSoldeDisponible($value[\"id_cpte\"], false, $export_csv));\n $data[\"date_dernier_mvt\"] = pg2phpDate(getLastMvtCpt($value[\"id_cpte\"]));\n $data[\"libel_prod\"] = getLibelPrdt($id_prod_ps, \"adsys_produit_epargne\");\n $data[\"solde_calcul_interets\"] = afficheMontant($value[\"solde_calcul_interets\"], false, $export_csv);\n $data[\"devise\"] = $value[\"devise\"];\n array_push($DATA_PS, $data);\n }\n return $DATA_PS;\n}", "public function listClient()\n\t {\n\t\t$tab = array();\n\t\t\t$rqt = mysql_query(\"SELECT * FROM clients\");\n\t\t\twhile($data = mysql_fetch_assoc($rqt))\n\t\t\t\t$tab[] = $data;\n\t\t\treturn $tab;\n\t }", "public function societeListerTous()\n\t{\n\t\t// votre code ici\n\t\treturn Gestion::lister(\"Societe\");//type array\n\t}", "public function index()\n {\n // get all clients \n $clients = Client::with(['deliveries.products'])->ordered(true)->get();\n\n // return clients as json\n return $clients->toJson();\n }", "function TablaListarClientes()\n {\n //Logo\n $this->Image(\"./assets/img/logo.png\" , 35 ,12, 80 , 25 , \"PNG\"); \n //Arial bold 15\n $this->SetFont('Courier','B',18);\n //Movernos a la derecha\n $this->Cell(130);\n //Título\n $this->Cell(180,25,'LISTADO GENERAL DE CLIENTES',0,0,'C');\n //Salto de línea\n $this->Ln(30);\n\t\n\t$con = new Login();\n $con = $con->ConfiguracionPorId();\n\t\n\t$this->SetFont('courier','B',10);\n\t$this->SetFillColor(2,157,116);\n\t$this->Cell(30,5,'',0,0,'');\n\t$this->CellFitSpace(42,5,'CÉDULA GERENTE :',0,0,'');\n\t$this->CellFitSpace(95,5,$con[0]['cedresponsable'],0,0,'');\n\t$this->CellFitSpace(42,5,'NOMBRE GERENTE :',0,0,'');\n\t$this->CellFitSpace(120,5,$con[0]['nomresponsable'],0,1,'');\n \n $this->Cell(30,5,'',0,0,'');\n\t$this->CellFitSpace(42,5,'TELÉFONO GERENTE :',0,0,'');\n $this->CellFitSpace(95,5,utf8_decode($con[0]['tlfresponsable']),0,0,'');\n $this->CellFitSpace(42,5,'CORREO GERENTE :',0,0,'');\n $this->CellFitSpace(120,5,utf8_decode($con[0]['correoresponsable']),0,0,'');\n $this->Ln();\n\t\n\t$this->Ln();\n\t$this->SetFont('courier','B',10);\n\t$this->SetTextColor(255,255,255); // Establece el color del texto (en este caso es BLANCO)\n $this->SetFillColor(249, 187, 31); // establece el color del fondo de la celda (en este caso es NARANJA)\n\t$this->Cell(10,8,'N°',1,0,'C', True);\n\t$this->Cell(35,8,'CÉDULA',1,0,'C', True);\n\t$this->Cell(70,8,'NOMBRES',1,0,'C', True);\n\t$this->Cell(110,8,'DIRECCIÓN DOMICILIARIA',1,0,'C', True);\n\t$this->Cell(35,8,'N° TELÉFONO',1,0,'C', True);\n\t$this->Cell(75,8,'CORREO',1,1,'C', True);\n\t\n $tra = new Login();\n $reg = $tra->ListarClientes();\n\t$a=1;\n for($i=0;$i<sizeof($reg);$i++){\n\t$this->SetFont('courier','',8); \n\t$this->SetTextColor(3,3,3); // Establece el color del texto (en este caso es negro)\n $this->Cell(10,5,$a++,1,0,'C');\n\t$this->CellFitSpace(35,5,utf8_decode($reg[$i][\"cedcliente\"]),1,0,'C');\n $this->CellFitSpace(70,5,utf8_decode($reg[$i][\"nomcliente\"]),1,0,'C');\n $this->CellFitSpace(110,5,utf8_decode($reg[$i][\"direccliente\"]),1,0,'C');\n\t$this->Cell(35,5,utf8_decode($reg[$i][\"tlfcliente\"]),1,0,'C');\n\t$this->Cell(75,5,utf8_decode($reg[$i][\"emailcliente\"]),1,0,'C');\n $this->Ln();\n\t\n }\n $this->Ln(12); \n $this->SetFont('courier','B',9);\n $this->Cell(40,6,'',0,0,'');\n $this->Cell(140,6,'ELABORADO POR: '.utf8_decode($_SESSION[\"nombres\"]),0,0,'');\n $this->Cell(80,6,'RECIBIDO:__________________________________',0,0,'');\n $this->Ln();\n $this->Cell(40,6,'',0,0,'');\n $this->Cell(140,6,'FECHA/HORA ELABORACIÓN: '.date('d-m-Y h:i:s A'),0,0,'');\n $this->Cell(80,6,'',0,0,'');\n $this->Ln(4);\n }", "function lista_proveedores($ubicacion,$idfamilia,$idservicio,$interno,$activo,$texto)\n\t{\n\n\t\t$condicion =\" WHERE 1 \";\n\n\t\tif ($idfamilia!='') $condicion.= \" AND cs.IDFAMILIA ='$idfamilia'\";\n\t\tif ($activo!='') $condicion.= \" AND (cp.ACTIVO = $activo)\";\n\t\tif ($idservicio!='') $condicion.= \" AND (cps.IDSERVICIO = '$idservicio' OR cps.IDSERVICIO ='0' )\";\n\t\tif ($interno!='') $condicion.= \" AND cp.INTERNO = '$interno' \";\n\t\tif ($texto!='') $condicion.= \" AND (cp.NOMBRECOMERCIAL like '%$texto%' OR cp.NOMBREFISCAL like '%$texto%')\";\n\n\t\t/* QUERY BUSCA LOA PROVEEDORES QUE PRESTAN EL SERVICIO*/\n\n\t\t$sql=\"\n\t\t\tSELECT \n\t\t\t\tcp.IDPROVEEDOR\n\t\t\tFROM \n\t\t\t$this->catalogo.catalogo_proveedor cp\n\t\t\t\tLEFT JOIN $this->catalogo.catalogo_proveedor_servicio cps ON cps.IDPROVEEDOR = cp.IDPROVEEDOR \n\t\t\t\tLEFT JOIN $this->catalogo.catalogo_servicio cs ON cs.IDSERVICIO = cps.IDSERVICIO\n\t\t\t\t$condicion\n\t\t\t\t\n\t\t\tGROUP BY cps.IDPROVEEDOR\n\t\t\torder by cp.INTERNO DESC, cp.NOMBRECOMERCIAL ASC\n\t\t\";\n\n\n\t\t\t//\techo $sql;\n\t\t\t\t$res_prv= $this->query($sql);\n\t\t\t\t$lista_prov= array();\n\t\t\t\t$prov = new proveedor();\n\t\t\t\t$poli = new poligono();\n\t\t\t\t$circulo = new circulo();\n\t\t\t\t$point= array('lat'=>$ubicacion->latitud,'lng'=>$ubicacion->longitud);\n\n\t\t\t\tif ($ubicacion->cveentidad1==0){\n\t\t\t\t\twhile ($reg=$res_prv->fetch_object())\n\t\t\t\t\t{\n\t\t\t\t\t\t$lista_prov[$reg->IDPROVEEDOR][DISTANCIA]='';\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\twhile ($reg_prv=$res_prv->fetch_object())\n\t\t\t\t\t{\n\t\t\t\t\t\t$prov->carga_datos($reg_prv->IDPROVEEDOR);\n\t\t\t\t\t\t$distancia= geoDistancia($ubicacion->latitud,$ubicacion->longitud,$prov->latitud,$prov->longitud,$prov->lee_parametro('UNIDAD_LONGITUD'));\n\t\t\t\t\t\t$sw=0;\n\n\t\t\t\t\t\t$condicion=\"\";\n\t\t\t\t\t\t$condicion.= \" cuf.CVEPAIS = '$ubicacion->cvepais'\";\n\n\t\t\t\t\t\t$condicion.= \" AND (cuf.CVEENTIDAD1 in ('$ubicacion->cveentidad1','0'))\";\n\t\t\t\t\t\t$condicion.= \" AND (cuf.CVEENTIDAD2 in ('$ubicacion->cveentidad2','0'))\";\n\t\t\t\t\t\t$condicion.= \" AND (cuf.CVEENTIDAD3 in ('$ubicacion->cveentidad3','0'))\";\n\t\t\t\t\t\t$condicion.= \" AND (cuf.CVEENTIDAD4 in ('$ubicacion->cveentidad4','0'))\";\n\t\t\t\t\t\t$condicion.= \" AND (cuf.CVEENTIDAD5 in ('$ubicacion->cveentidad5','0'))\";\n\t\t\t\t\t\t$condicion.= \" AND (cuf.CVEENTIDAD6 in ('$ubicacion->cveentidad6','0'))\";\n\t\t\t\t\t\t$condicion.= \" AND (cuf.CVEENTIDAD7 in ('$ubicacion->cveentidad7','0'))\";\n\t\t\t\t\t\t\n\t\t\t\t\t\t$condicion.= \" OR (\"; \n\n\t\t\t\t\t\tif ($ubicacion->cveentidad1!='0') $condicion.= \" (cuf.CVEENTIDAD1 = '$ubicacion->cveentidad1')\";\n\t\t\t\t\t\tif ($ubicacion->cveentidad2!='0') $condicion.= \" AND (cuf.CVEENTIDAD2 = '$ubicacion->cveentidad2')\";\n\t\t\t\t\t\tif ($ubicacion->cveentidad3!='0') $condicion.= \" AND (cuf.CVEENTIDAD3 = '$ubicacion->cveentidad3')\";\n\t\t\t\t\t\tif ($ubicacion->cveentidad4!='0') $condicion.= \" AND (cuf.CVEENTIDAD4 = '$ubicacion->cveentidad4')\";\n\t\t\t\t\t\tif ($ubicacion->cveentidad5!='0') $condicion.= \" AND (cuf.CVEENTIDAD5 = '$ubicacion->cveentidad5')\";\n\t\t\t\t\t\tif ($ubicacion->cveentidad6!='0') $condicion.= \" AND (cuf.CVEENTIDAD6 = '$ubicacion->cveentidad6')\";\n\t\t\t\t\t\tif ($ubicacion->cveentidad7!='0') $condicion.= \" AND (cuf.CVEENTIDAD7 = '$ubicacion->cveentidad7')\";\n\t\t\t\t\t\t\n\t\t\t\t\t\t$condicion .= \" )\";\n\n\t\t\t\t\t\t/* QUERY BUSCA LAS UNIDADES FEDERATIVAS QUE COINCIDAN CON LA UBICACION PARA CADA PROVEEDOR*/\n\t\t\t\t\t\t$sql=\"\n\t\t\tSELECT \n\t\t\t\tcpsxuf.IDPROVEEDOR, cpsxuf.IDUNIDADFEDERATIVA,cpsxuf.ARRAMBITO\n\t\t\tFROM\n\t\t\t $this->catalogo.catalogo_proveedor_servicio_x_unidad_federativa cpsxuf\n\t\t\t\tLEFT JOIN $this->catalogo.catalogo_unidadfederativa cuf ON $condicion\n\t\t\tWHERE \n\t\t\t\tcpsxuf.IDUNIDADFEDERATIVA = cuf.IDUNIDADFEDERATIVA\n\t\t\t\tAND\tcpsxuf.IDPROVEEDOR ='$reg_prv->IDPROVEEDOR'\n\t\t\t\tand cpsxuf.IDSERVICIO IN ('$idservicio', '0')\n\t\t\t\tORDER BY 3 DESC\n\t\t\t\";\n\t\t\t\t\t//echo $sql;\n\t\t\t$res_prv_entid= $this->query($sql);\n\t\t\twhile ($reg_prv_entid= $res_prv_entid->fetch_object())\n\t\t\t{\n\t\t\t\t$lista_prov[$reg_prv_entid->IDPROVEEDOR][DISTANCIA]= $distancia;\n\t\t\t\t$lista_prov[$reg_prv_entid->IDPROVEEDOR][AMBITO]=\t$reg_prv_entid->ARRAMBITO;\n\t\t\t\t$lista_prov[$reg_prv_entid->IDPROVEEDOR][TIPOPOLIGONO] ='ENTIDAD';\n\t\t\t\t$lista_prov[$reg_prv_entid->IDPROVEEDOR][ID] = $reg_prv_entid->IDUNIDADFEDERATIVA;\n\t\t\t\tif ($reg_prv_entid->ARRAMBITO=='LOC') $sw=1; // si hubo algun entidad LOC se activa el sw\n\n\t\t\t}\n\t\t\tif (($ubicacion->latitud !='' )&& ($ubicacion->longitud!=''))\n\t\t\t{\n\t\t\t\t$sql=\"\n\t\t\t\tSELECT \n\t\t\t\t\tcpsxp.IDPROVEEDOR, cpsxp.IDPOLIGONO\n\t\t\t\tFROM \n\t\t\t\t$this->catalogo.catalogo_proveedor_servicio_x_poligono cpsxp\n\t\t\t\tWHERE\n\t\t\t\t\tcpsxp.IDPROVEEDOR ='$reg_prv->IDPROVEEDOR'\n\t\t\t\t\";\n\t\t\t\t$res_prv_poli= $this->query($sql);\n\t\t\t\twhile ($reg_prv_poli = $res_prv_poli->fetch_object())\n\t\t\t\t{\n\t\t\t\t\t// verifica si el punto esta incluido en el poligono\n\t\t\t\t\t$in = pointInPolygon($point,$poli->lee_vertices($reg_prv_poli->IDPOLIGONO));\n\t\t\t\t\tif (( $in ) && ($sw==0))\n\t\t\t\t\t{\n\t\t\t\t\t\t$lista_prov[$reg_prv_poli->IDPROVEEDOR][DISTANCIA]= $distancia;\n\t\t\t\t\t\t$lista_prov[$reg_prv_poli->IDPROVEEDOR][AMBITO]=\t$reg_prv_poli->ARRAMBITO;\n\t\t\t\t\t\t$lista_prov[$reg_prv_poli->IDPROVEEDOR][TIPOPOLIGONO] ='POLIGONO';\n\t\t\t\t\t\t$lista_prov[$reg_prv_poli->IDPROVEEDOR][ID] = $reg_prv_poli->IDPOLIGONO;\n\t\t\t\t\t\tif ($reg_prv_poli->ARRAMBITO=='LOC') $sw=1; // si hubo algun poligono LOC se activa el sw\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t$sql=\"\n\t\t\t\tSELECT \n\t\t\t\t\tcpsxc.IDPROVEEDOR, cpsxc.IDCIRCULO\n\t\t\t\tFROM\n\t\t\t\t$this->catalogo.catalogo_proveedor_servicio_x_circulo cpsxc\n\t\t\t\tWHERE\n\t\t\t\t\tcpsxc.IDPROVEEDOR='$res_prv->IDPROVEEDOR'\n\t\t\t\t\";\n\n\t\t\t\t$res_prv_circ = $this->query($sql);\n\t\t\t\twhile ($reg_prv_circ = $res_prv_circ->fetch_object())\n\t\t\t\t{\n\t\t\t\t\t$circulo->leer($reg_prv_circ->IDCIRCULO);\n\t\t\t\t\t$vertices = $circulo->verticesCircle($circulo->latitud,$circulo->longitud,$circulo->radio,$circulo->idmedida);\n\t\t\t\t\t$in= pointInPolygon($point,$vertices);\n\n\t\t\t\t\tif (($in ) && ($sw==0))\n\t\t\t\t\t{\n\t\t\t\t\t\t$lista_prov[$reg_prv_circ->IDPROVEEDOR][DISTANCIA]= $distancia;\n\t\t\t\t\t\t$lista_prov[$reg_prv_circ->IDPROVEEDOR][AMBITO]=\t$reg_prv_circ->ARRAMBITO;\n\t\t\t\t\t\t$lista_prov[$reg_prv_circ->IDPROVEEDOR][TIPOPOLIGONO] ='CIRCULO';\n\t\t\t\t\t\t$lista_prov[$reg_prv_circ->IDPROVEEDOR][ID] = $reg_prv_circ->IDCIRCULO;\n\t\t\t\t\t\tif ($reg_prv_circ->ARRAMBITO=='LOC') $sw=1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} // fin de la busqueda por LATITUD Y LONGITUD\n\n\n\n\n\n\t\t\t\t\t} // fin del while del proveedor\n\t\t\t\t}\n\n\t\t\t\t/* LEE LAS PROPORCIONES DE LA FORMULA DEL RANKING */\n\t\t\t\t$sql=\"\n\t\t\tSELECT \t\n\t\t\t\tELEMENTO,PROPORCION \n\t\t\tFROM \n\t\t\t$this->catalogo.catalogo_proporciones_ranking\n\t\t\t\";\n\t\t\t$result=$this->query($sql);\n\n\t\t\twhile($reg = $result->fetch_object())\n\t\t\t$proporcion[$reg->ELEMENTO] = $reg->PROPORCION;\n\n\n\t\t\t$max_costo_int=0;\n\t\t\t$max_costo_ext=0;\n\n\n\t\t\t/* OBTENER DATOS PARA EVALUAR EL RANKING */\n\t\t\tforeach ($lista_prov as $idproveedor=>$proveedor)\n\t\t\t{\n\t\t\t\t$sql=\"\n\t\tSELECT \n\t\t\tIF (cp.ARREVALRANKING='SKILL',IF (cp.SKILL>0,cp.SKILL/100,0), IF (cp.CDE>0,cp.CDE/100,0)) VALRANKING,\n\t\t\tIF (cpscn.MONTOLOCAL IS NULL,0,cpscn.MONTOLOCAL) COSTO,\n\t\t\tIF (cp.EVALSATISFACCION>0,cp.EVALSATISFACCION/100,0) EVALSATISFACCION ,\n\t\t\tcp.EVALINFRAESTRUCTURA EVALINFRAESTRUCTURA,\n\t\t\tcp.EVALFIDELIDAD EVALFIDELIDAD,\n\t\t\tcp.INTERNO\n\t\tFROM \n\t\t$this->catalogo.catalogo_proveedor cp\n\t\t\tLEFT JOIN $this->catalogo.catalogo_proveedor_servicio_costo_negociado cpscn ON cpscn.IDPROVEEDOR = cp.IDPROVEEDOR AND cpscn.IDSERVICIO = '$idservicio' AND cpscn.IDCOSTO = 1\n\t\tWHERE \n\t\t\tcp.IDPROVEEDOR = '$idproveedor' \n\t\t\";\n\t\t//\t\t\t\techo $sql;\n\t\t$result = $this->query($sql);\n\n\t\twhile ($reg=$result->fetch_object())\n\t\t{\n\t\t\tif ($reg->INTERNO){\n\t\t\t\t$temp_prov_int[$idproveedor][VALRANKING] = $reg->VALRANKING;\n\t\t\t\t$temp_prov_int[$idproveedor][COSTO] = $reg->COSTO;\n\t\t\t\t$temp_prov_int[$idproveedor][EVALSATISFACCION] = $reg->EVALSATISFACCION;\n\t\t\t\t$temp_prov_int[$idproveedor][EVALINFRAESTRUCTURA] = $reg->EVALINFRAESTRUCTURA;\n\t\t\t\t$temp_prov_int[$idproveedor][EVALFIDELIDAD] = $reg->EVALFIDELIDAD;\n\t\t\t\tif ($reg->COSTO > $max_costo_int) $max_costo_int= $reg->COSTO;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$temp_prov_ext[$idproveedor][VALRANKING] = $reg->VALRANKING;\n\t\t\t\t$temp_prov_ext[$idproveedor][COSTO] = $reg->COSTO;\n\t\t\t\t$temp_prov_ext[$idproveedor][EVALSATISFACCION] = $reg->EVALSATISFACCION;\n\t\t\t\t$temp_prov_ext[$idproveedor][EVALINFRAESTRUCTURA] = $reg->EVALINFRAESTRUCTURA;\n\t\t\t\t$temp_prov_ext[$idproveedor][EVALFIDELIDAD] = $reg->EVALFIDELIDAD;\n\t\t\t\tif ($reg->COSTO > $max_costo_ext) $max_costo_ext= $reg->COSTO;\n\t\t\t}\n\t\t}\n\n\t\t\t}\n\n\t\t\t/*calcula el Ranking de proveedores internos */\n\n\t\t\tforeach ($temp_prov_int as $idproveedor=>$proveedor)\n\t\t\t{\n\t\t\t\t$valranking = round($proveedor[VALRANKING] * $proporcion[CDE_SKILL],4);\n\t\t\t\t$valcosto = ($proveedor[COSTO]==0)?0:(1-($proveedor[COSTO]/$max_costo_int))*$proporcion[COSTO];\n\t\t\t\t$evalsatisfaccion = round($proveedor[EVALSATISFACCION] * $proporcion[SATISFACCION],2);\n\t\t\t\t$evalinfraestructura = round($proveedor[EVALINFRAESTRUCTURA] * $proporcion[INFRAESTRUCTURA],2);\n\t\t\t\t$evalfidelidad = round($proveedor[EVALFIDELIDAD] * $proporcion[FIDELIDAD],2);\n\t\t\t\t$lista_prov_int[$idproveedor][RANKING] = ($valranking + $valcosto+$evalsatisfaccion + $evalinfraestructura + $evalfidelidad)*100;\n\t\t\t}\n\n\t\t\t/*calcula el Ranking de proveedores externos */\n\t\t\tforeach ($temp_prov_ext as $idproveedor=>$proveedor)\n\t\t\t{\n\t\t\t\t$valranking = round($proveedor[VALRANKING] * $proporcion[CDE_SKILL],4);\n\t\t\t\t$valcosto = ($proveedor[COSTO]==0)?0:(1-($proveedor[COSTO]/$max_costo_ext))*$proporcion[COSTO];\n\t\t\t\t$evalsatisfaccion = round($proveedor[EVALSATISFACCION] * $proporcion[SATISFACCION],2);\n\t\t\t\t$evalinfraestructura = round($proveedor[EVALINFRAESTRUCTURA] * $proporcion[INFRAESTRUCTURA],2);\n\t\t\t\t$evalfidelidad = round($proveedor[EVALFIDELIDAD] * $proporcion[FIDELIDAD],2);\n\t\t\t\t$lista_prov_ext[$idproveedor][RANKING] = ($valranking + $valcosto+$evalsatisfaccion + $evalinfraestructura + $evalfidelidad)*100;\n\t\t\t}\n\n\t\t\t$temp_prov_int = ordernarArray($lista_prov_int,'RANKING',1);\n\t\t\t$temp_prov_ext = ordernarArray($lista_prov_ext,'RANKING',1);\n\n\n\t\t\tforeach ($temp_prov_int as $idproveedor => $proveedor)\n\t\t\t{\n\t\t\t\t$lista_ordenada[$idproveedor] = $lista_prov[$idproveedor];\n\t\t\t\t$lista_ordenada[$idproveedor][RANKING] = $lista_prov_int[$idproveedor][RANKING];\n\t\t\t}\n\t\t\tforeach ($temp_prov_ext as $idproveedor => $proveedor)\n\t\t\t{\n\t\t\t\t$lista_ordenada[$idproveedor] = $lista_prov[$idproveedor];\n\t\t\t\t$lista_ordenada[$idproveedor][RANKING] = $lista_prov_ext[$idproveedor][RANKING];\n\t\t\t}\n\t\t\t/* DEVUELVE EL ARRAY*/\n\t\t\treturn $lista_ordenada ;\n\n\t}", "function getClientList()\n\t{\n\t\t//Update Client List\n\t\t$this->Client_List = null;\n\t\t$assigned_clients_rows = returnRowsDeveloperAssignments($this->getUsername(), 'Client');\n\t\tforeach($assigned_clients_rows as $assigned_client)\n\t\t\t$this->Client_List[] = new Client( $assigned_client['ClientProjectTask'] );\n\t\t\n\t\treturn $this->Client_List;\n\t}", "public function fetchClients(){\n $sql = $this->db->query(\"SELECT id,dni_c,nombre_c,apellidos_c,telefono FROM cliente WHERE activo=1 ORDER BY apellidos_c\");\n $list_db = $sql->fetchAll(PDO::FETCH_ASSOC);\n\n if($list_db != NULL) {\n return $list_db;\n } else {\n return NULL;\n }\n }", "public function listaClientes(){\n\n $respuesta = Datos::mdlListaClientes(\"clientes\");\n $cont =0;\n\n foreach ($respuesta as $row => $item){\n \t$cont ++;\n\n\n echo '<tr>\n <td>'.$cont.'</td>\n <td>'.$item[\"nombre\"].'</td>\n <td>'.$item[\"razonSocial\"].'</td>\n <td>'.$item[\"rfc\"].'</td>\n <td>'.$item[\"direccion\"].'</td>\n <td>'.$item[\"ubicacion\"].'</td>\n <td>'.$item[\"telefono\"].'</td>\n <td>'.$item[\"celular\"].'</td>\n <td>'.$item[\"contacto\"].'</td>\n <td>'.$item[\"lineaCredito\"].'</td>\n <td><a href=\"updtCliente.php?idEditar='.$item[\"idCliente\"].'\"><button class=\"btn btn-warning\">Editar</button></a></td>\n <td><a href=\"listaClientes.php?idBorrar='.$item[\"idCliente\"].'\" ><button class=\"btn btn-danger\">Borrar</button></a></td>\n </tr>';\n }\n\n }", "function displayClientList()\n\t{\n\t\t$_SESSION[\"ClientId\"] = \"\";\n\n\t\t$this->tpl->addBlockFile(\"CONTENT\",\"content\",\"tpl.clientlist.html\", \"setup\");\n\t\t$this->tpl->setVariable(\"TXT_INFO\", $this->lng->txt(\"info_text_list\"));\n\t\tilUtil::sendInfo();\n\n\t\t// common\n\t\t$this->tpl->setVariable(\"TXT_HEADER\",$this->lng->txt(\"list_clients\"));\n\t\t$this->tpl->setVariable(\"TXT_LISTSTATUS\",($this->setup->ini->readVariable(\"clients\",\"list\")) ? $this->lng->txt(\"display_clientlist\") : $this->lng->txt(\"hide_clientlist\"));\n\t\t$this->tpl->setVariable(\"TXT_TOGGLELIST\",($this->setup->ini->readVariable(\"clients\",\"list\")) ? $this->lng->txt(\"disable\") : $this->lng->txt(\"enable\"));\n\n\t\tinclude_once(\"./setup/classes/class.ilClientListTableGUI.php\");\n\t\t$tab = new ilClientListTableGUI($this->setup);\n\t\t$this->tpl->setVariable(\"CLIENT_LIST\", $tab->getHTML());\n\n\t\t// create new client button\n\t\t$this->btn_next_on = true;\n\t\t$this->btn_next_lng = $this->lng->txt(\"create_new_client\").\"...\";\n\t\t$this->btn_next_cmd = \"newclient\";\n\t}", "public function listClients(){\n $mysql= $this->database->databaseConnect();\n $sql = 'SELECT * FROM client';\n $query = mysqli_query($mysql, $sql) or die(mysqli_connect_error());\n $this->database->databaseClose();\n\n while($row = mysqli_fetch_assoc($query)){\n $this->clients[] = $row;\n }\n\n return $this->clients;\n }", "public function CarregaClientes() {\n\t\t$clientes = new Model_Wpr_Clientes_ClientesIntegracao ();\n\t\t\n\t\treturn $clientes->carregaClientes ();\n\t}", "function return_listClientByName($nom = null)\n{\n return getClients(\"cli_nom\", \"asc\", ['cli_nom'=>$nom], true);\n}", "function listarPais(){\n $this->procedimiento='rec.ft_cliente_sel';\n $this->transaccion='CLI_LUG_SEL';\n $this->tipo_procedimiento='SEL';//tipo de transaccion\n $this->setCount(false);\n //Definicion de la lista del resultado del query\n $this->captura('id_lugar','int4');\n $this->captura('codigo','varchar');\n $this->captura('estado_reg','varchar');\n $this->captura('id_lugar_fk','int4');\n $this->captura('nombre','varchar');\n $this->captura('sw_impuesto','varchar');\n $this->captura('sw_municipio','varchar');\n $this->captura('tipo','varchar');\n $this->captura('fecha_reg','timestamp');\n $this->captura('id_usuario_reg','int4');\n $this->captura('fecha_mod','timestamp');\n $this->captura('id_usuario_mod','int4');\n $this->captura('usr_reg','varchar');\n $this->captura('usr_mod','varchar');\n $this->captura('es_regional','varchar');\n\n //$this->captura('nombre_lugar','varchar');\n\n //Ejecuta la instruccion\n $this->armarConsulta();\n //var_dump($this->consulta); exit;\n $this->ejecutarConsulta();\n\n //Devuelve la respuesta\n return $this->respuesta;\n }", "public function getReporteClientesCartera()\n\t{\n\t\t$spreadsheet = new Spreadsheet();\n\t\t$sheet = $spreadsheet->getActiveSheet();\n\t\t$sql = \"SELECT\n\t\t\t\t\tag.nombre,\n\t\t\t\t\tcli.nombrecliente,\n\t\t\t\t\tclientes.razonsocial,\n\t\t\t\t\tcli.codigo,\n\t\t\t\t\tcli.codpago,\n\t\t\t\t\tcli.fecha,\n\t\t\t\t\tcli.vencimiento,\n\t\t\t\t\tTIMESTAMPDIFF(DAY, CURRENT_DATE(), cli.vencimiento) AS dias_vencidos,\n\t\t\t\t\tIF(Date(cli.vencimiento) < current_date(), 'Vencido', dayname(cli.vencimiento)) as dias,\n\t\t\t\t\tcli.observaciones,\n\t\t\t\t\tcli.total\n\t\t\t\tFROM\n\t\t\t\t\tfacturascli cli\n\t\t\t\t\tinner join clientes on clientes.codcliente = cli.codcliente\n\t\t\t\t\tinner join agentes ag on ag.codagente = clientes.codagente \n\t\t\t\tWHERE YEAR(vencimiento) >= '2020' and cli.pagada = 0;\";\n\t\t\t\t\n\t\t$this->consulta('SET NAMES utf8');\n\t\t# Escribir encabezado de los productos\n\t\t$encabezado = [\"nombre\",\"nombrecliente\",\"razonsocial\",\"codigo\",\"codpago\",\"fecha\",\"vencimiento\",\"dias_vencidos\",\"dias\",\"observaciones\",\"total\"];\n\t\t# El último argumento es por defecto A1 pero lo pongo para que se explique mejor\n\t\t$sheet->fromArray($encabezado, null, 'A1');\n\t\t$resultado = $this->consulta($sql);\n\t\t$res = $resultado->fetchAll(PDO::FETCH_ASSOC);\n\t\t$numeroDeFila = 2;\n\t\tforeach ($res as $data ) {\n\t\t\t# Obtener los datos de la base de datos\n\t\t\t$nombre = $data['nombre'];\n\t\t\t$nombrecliente = $data['nombrecliente'];\n\t\t\t$razonsocial = $data['razonsocial'];\n\t\t\t$codigo = $data['codigo'];\n\t\t\t$codpago = $data['codpago'];\n\t\t\t$fecha = $data['fecha'];\n\t\t\t$vencimiento = $data['vencimiento'];\n\t\t\t$dias_vencidos = $data['dias_vencidos'];\n\t\t\t$dias = $data['dias'];\n\t\t\t$observaciones = $data['observaciones'];\n\t\t\t$total = $data['total'];\n\t\t\t# Escribirlos en el documento\n\t\t\t$sheet->setCellValueByColumnAndRow(1, $numeroDeFila, $nombre);\n\t\t\t$sheet->setCellValueByColumnAndRow(2, $numeroDeFila, $nombrecliente);\n\t\t\t$sheet->setCellValueByColumnAndRow(3, $numeroDeFila, $razonsocial);\n\t\t\t$sheet->setCellValueByColumnAndRow(4, $numeroDeFila, $codigo);\n\t\t\t$sheet->setCellValueByColumnAndRow(5, $numeroDeFila, $codpago);\n\t\t\t$sheet->setCellValueByColumnAndRow(6, $numeroDeFila, $fecha);\n\t\t\t$sheet->setCellValueByColumnAndRow(7, $numeroDeFila, $vencimiento);\n\t\t\t$sheet->setCellValueByColumnAndRow(8, $numeroDeFila, $dias_vencidos);\n\t\t\t$sheet->setCellValueByColumnAndRow(9, $numeroDeFila, $dias);\n\t\t\t$sheet->setCellValueByColumnAndRow(10, $numeroDeFila, $observaciones);\n\t\t\t$sheet->setCellValueByColumnAndRow(11, $numeroDeFila, $total);\n\t\t\t$numeroDeFila++;\n\t\t}\n\t\t$writer = new Xlsx($spreadsheet);\n\t\t$writer->save('../../reporte/reporte.xlsx');\n\t\techo \"true\";\n\t}", "public function get_compte(){retrun($id_local_compte); }", "public function liste() {\n // Charger la vue liste compteur\n $this->loadView('liste', 'content');\n // Lire les compteurs à partir de la bd et formater\n //$reglements = $this->em->selectAll('reglement');\n //$reglements = $this->em->getRefined($reglements);\n $liste = $this->em->selectAll('facture');\n $html = '';\n foreach ($liste as $key => $entity) {\n $state = 'impayée';\n if ($entity->getPaye()) {\n $state = 'payée';\n }\n $consommation = $this->em->selectById('consommation', $entity->getId());\n $compteur = $this->em->selectById('compteur', $consommation->getIdCompteur());\n $html .= '<tr>';\n $html .= '<td>' . $entity->getId() . '</td>';\n $html .= '<td><a href=\"reglements/facture/' . $entity->getNumero() . '\">' . $entity->getNumero() . '</a></td>';\n $html .= '<td>' . $compteur->getNumero() . '</td>';\n $html .= '<td>' . $consommation->getQuantiteChiffre() . ' litres</td>';\n $html .= '<td>' . $entity->getMontant() . ' FCFA</td>';\n $html .= '<td>' . $state . '</td>';\n $html .= '</tr>';\n }\n // Ajouter les compteurs à la vue\n $this->loadHtml($html, 'list');\n }", "function listClients($offset,$limit){\n\t\t$returnString = array();\n\t\t$sql = \"SELECT * FROM Client ORDER BY Client_ID ASC LIMIT $offset, $limit\";\n\t\t$data_p = mysql_query($sql);\n\t\tprint \"<table class=\\\"clients\\\"><tr><td>Client ID</td><td>Name</td><td>License Number</td><td>Policy Number</td></tr>\";\n\t\twhile($info = mysql_fetch_array( $data_p )){\n\t\t\tprint \"<tr><td><a href='client.php?action=update&client=\".$info['Client_ID'].\"'>\".$info['Client_ID'].\"</a></td><td>\";\n\t\t\tprint $info['FName'].\" \".$info['MName'].\" \".$info['LName'].\"</td><td>\";\n\t\t\tprint $info['License_No'].\"</td><td>\";\n\t\t\tprint \"<a href='policy.php?action=update&policy=\".$info['Policy_No'].\"&type=\";\n\t\t\tif($info['Company'] == 0 || $info['Company'] == null) { // Private Policy if true\n\t\t\t\tprint \"1'>P\".$info['Policy_No'].\"</a></td>\";\n\t\t\t} else { // Company Policy since false\n\t\t\t\tprint \"0'>C\".$info['Policy_No'].\"</a></td>\";\n\t\t\t}\n\t\t\t$this->printOptions($info['Client_ID']);\n\t\t\tprint \"</tr>\";\n\t\t}\n\t\tprint \"</table>\";\n\t}", "function getClientList( $warehouse = NULL ) {\n//\t\tif ($warehouse) {\n//\t\t\t$mid = \"WHERE `project_name` STARTING '$project'\";\n//\t\t} else \n\t\t{ $mid = ''; }\n\t\t$query = \"SELECT ( SELECT COUNT(PARTNO) FROM `warehouse_partlist` pro WHERE pro.`client` = cl.`client` AND pro.`quantity` > 0 ) AS `stock`, cl.*, cu.*\n\t\t\t\t FROM `warehouse_client` cl\n\t\t\t\t LEFT JOIN `warehouse_customer` cu ON cl.`client` = cu.`client`\n\t\t\t\t WHERE (cl.`fullp` + cl.`part`) > 0\n\t\t\t\t $mid ORDER BY cl.`name`\";\n\t\t$result = $this->mDb->query($query);\n\t\t$ret = array();\n\n\t\twhile ($res = $result->fetchRow()) {\n\t\t\t$res['display_url'] = WAREHOUSE_PKG_URL.'display_client.php?client_id='.trim($res['client']);\n\t\t\t$ret[] = $res;\n\t\t}\n\n\t\t$ret[\"cant\"] = count( $ret );\n\t\treturn $ret;\n\t}", "public function actionLista()\n {\n $model = Cliente::findall();\n\n// Criação do provider para uso no grid view\n\n if ($model) {\n\n $provider = new ArrayDataProvider([\n 'allModels' => $model,\n 'sort' => [\n// 'attributes' => ['cpf_cliente', 'nome', 'telefone'],\n ],\n 'pagination' => [\n 'pageSize' => 10,\n ],\n ]);\n }\n else\n $provider = null;\n return $this->render('cliente/lista', ['dataProvider' => $provider]);\n }", "public function listaChoferes(){\n\n $respuesta = Datos::mdlListaChoferes(\"choferes\");\n $cont =0;\n\n foreach ($respuesta as $row => $item){\n \t$cont ++;\n // if ($item[\"rol\"] == 0) $tipoAcceso = \"Administrator\";\n // if ($item[\"rol\"] == 1 ) $tipoAcceso = \"Usuario\";\n // if ($item[\"rol\"] == 2 ) $tipoAcceso = \"Engineer\";\n // if ($item[\"rol\"] == 3 ) $tipoAcceso = \"Accountant\";\n\n\n echo '<tr>\n <td>'.$cont.'</td>\n <td>'.$item[\"nombre\"].'</td>\n <td>'.$item[\"rfc\"].'</td>\n <td>'.$item[\"ine\"].'</td>\n <td>'.$item[\"licencia\"].'</td>\n <td>'.$item[\"telefono\"].'</td>\n <td>'.$item[\"telefono2\"].'</td>\n <td style=\"text-align: center\">'.$item[\"fechaIngreso\"].'</td>\n <td><a href=\"updtChofer.php?idEditar='.$item[\"idChofer\"].'\"><button class=\"btn btn-warning\">Editar</button></a></td>\n <td><a href=\"listaChoferes.php?idBorrar='.$item[\"idChofer\"].'\" ><button class=\"btn btn-danger\">Borrar</button></a></td>\n </tr>';\n }\n\n }", "function displayListeCommandesEnCours() {\n\t\t//On test si l'utilisateur est bien connecté\n\t\tif($_SESSION[\"connect\"] == true AND $_SESSION[\"statutUtilisateur\"] == 0) {\n\t\t\techo \"<div class='container bloc-top'>\";\n\t\t\t\techo \"<div class='row'>\";\n\t\t\t\t\techo \"<div class='col-md-6'>\";\n\t\t\t\t\t\techo \"<h2>Liste des commandes en cours</h2>\";\n\t\t\t\t\techo \"</div>\";\n\t\t\t\techo \"</div>\";\n\t\t\t\t\n\t\t\t\techo \"<div class='row mt-s'>\";\n\t\t\t\t\techo \"<div class='col-md-12'>\";\n\t\t\t\t\t\techo \"<div class='table-responsive'>\";\n\t\t\t\t\t\t\techo \"<table class='table table-bordered center'>\";\n\t\t\t\t\t\t\t\techo \"<thead>\";\n\t\t\t\t\t\t\t\t\techo \"<tr class='bg-grey'>\";\n\t\t\t\t\t\t\t\t\t\techo \"<th class='center'>Date</th>\";\n\t\t\t\t\t\t\t\t\t\techo \"<th class='center'>Numéro</th>\";\n\t\t\t\t\t\t\t\t\t\techo \"<th class='center'>Statut</th>\";\n\t\t\t\t\t\t\t\t\t\techo \"<th class='center'>Actions</th>\";\n\t\t\t\t\t\t\t\t\techo \"</tr>\";\n\t\t\t\t\t\t\t\techo \"</thead>\";\n\t\t\t\t\t\t\t\techo \"<tbody>\";\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t$selectListeCommandesEnCours = dbConnexion()->prepare(\"SELECT * FROM fichier f JOIN commande c ON f.idFichier = c.idFichier WHERE c.statutCommande <> 4 AND f.idUtilisateur = \".$_SESSION[\"idUtilisateur\"].\" ORDER BY c.dateCommande, c.numCommande;\");\n\t\t\t\t\t\t\t\t$selectListeCommandesEnCours->execute();\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tforeach($selectListeCommandesEnCours as $rowListeCommandesEnCours) {\n\t\t\t\t\t\t\t\t\t$idCommande = htmlspecialchars($rowListeCommandesEnCours[\"idCommande\"]);\n\t\t\t\t\t\t\t\t\t$dateCommande = htmlspecialchars($rowListeCommandesEnCours[\"dateCommande\"]);\n\t\t\t\t\t\t\t\t\t$numCommande = htmlspecialchars($rowListeCommandesEnCours[\"numCommande\"]);\n\t\t\t\t\t\t\t\t\t$statutCommande = htmlspecialchars($rowListeCommandesEnCours[\"statutCommande\"]);\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t$dateCommande = explode(\"-\", $dateCommande);\n\t\t\t\t\t\t\t\t\t$dateCommande = $dateCommande[2].\"/\".$dateCommande[1].\"/\".$dateCommande[0];\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tif($statutCommande == 0) {\n\t\t\t\t\t\t\t\t\t\t$color = \"danger\";\n\t\t\t\t\t\t\t\t\t\t$statut = \"En attente de préparation\";\n\t\t\t\t\t\t\t\t\t} else if($statutCommande == 1) {\n\t\t\t\t\t\t\t\t\t\t$color = \"warning\";\n\t\t\t\t\t\t\t\t\t\t$statut = \"En cours de préparation\";\n\t\t\t\t\t\t\t\t\t} else if($statutCommande == 2) {\n\t\t\t\t\t\t\t\t\t\t$color = \"warning\";\n\t\t\t\t\t\t\t\t\t\t$statut = \"Prête à être expédiée\";\n\t\t\t\t\t\t\t\t\t} else if($statutCommande == 3) {\n\t\t\t\t\t\t\t\t\t\t$color = \"success\";\n\t\t\t\t\t\t\t\t\t\t$statut = \"Expédiée\";\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t$color = \"\";\n\t\t\t\t\t\t\t\t\t\t$statut = \"N/C\";\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\techo \"<tr>\";\n\t\t\t\t\t\t\t\t\t\techo \"<td>\".$dateCommande.\"</td>\";\n\t\t\t\t\t\t\t\t\t\techo \"<td>N°\".$numCommande.\"</td>\";\n\t\t\t\t\t\t\t\t\t\techo \"<td class='\".$color.\"'>\".$statut.\"</td>\";\n\t\t\t\t\t\t\t\t\t\techo \"<td>\";\n\t\t\t\t\t\t\t\t\t\t\techo \"<div class='col-md-6'>\";\n\t\t\t\t\t\t\t\t\t\t\t\techo \"<a href='./?page=detailCommande&idCommande=\".$idCommande.\"' class='btn btn-primary btn-block'><span class='glyphicon glyphicon-eye-open' aria-hidden='true'></span>&nbsp;&nbsp;Détails</a>\";\n\t\t\t\t\t\t\t\t\t\t\techo \"</div>\";\n\t\t\t\t\t\t\t\t\t\t\techo \"<div class='col-md-6'>\";\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\tif($statutCommande == 3) {\n\t\t\t\t\t\t\t\t\t\t\t\t\techo \"<form method='post' action='.'>\";\n\t\t\t\t\t\t\t\t\t\t\t\t\t\techo \"<input type='hidden' name='form-idCommande' value='\".$idCommande.\"' />\";\n\t\t\t\t\t\t\t\t\t\t\t\t\t\techo \"<button type='submit' class='btn btn-success btn-block'><span class='glyphicon glyphicon-thumbs-up' aria-hidden='true'></span>&nbsp;&nbsp;Reçu ?</button>\";\n\t\t\t\t\t\t\t\t\t\t\t\t\t\techo \"<input type='hidden' name='action' value='ReceptionCommande' />\";\n\t\t\t\t\t\t\t\t\t\t\t\t\techo \"</form>\";\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\techo \"</div>\";\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\techo \"</td>\";\n\t\t\t\t\t\t\t\t\techo \"</tr>\";\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\techo \"</tbody>\";\n\t\t\t\t\t\t\techo \"</table>\";\n\t\t\t\t\t\techo \"</div>\";\n\t\t\t\t\techo \"</div>\";\n\t\t\t\techo \"</div>\";\n\t\t\techo \"</div>\";\n\t\t}\n\t}", "function renderClients(){\n\t\t$clients = $this->cache->getClients();\n\t\tforeach($clients as $c){\n\t\t\t$size = $c->getSize();\n\t\t\t$this->ret_clients[] = array('ip'=>$c->getIp(),'mb'=>$size['mb']);\n\t\t}\n\t}", "public function listadoPedidos(){\n $pedido=new Pedido();\n\n //Conseguimos todos los usuarios\n $allPedido=$pedido->getAll();\n print_r(json_encode($allPedido));\n //echo $allClientes\n }", "function listarServicios()\n\t{\n\t\treturn \"select servicios.servicio_id,servicios.nombre_servicio, servicios.estado_servicio, servicios.descripcion, servicios.fecha_creacion,\n trabajadores.nombre,\nsucursales.nombre_sucursal\nfrom trabajadores, servicios,sucursales where servicios.trabajador_id = trabajadores.trabajador_id \nand servicios.estado_servicio = 1 \nand servicios.sucursal_id = sucursales.sucursal_id\";\n\t}", "function listarProcesoCompraPedido(){\n\t\t$this->procedimiento='adq.f_proceso_compra_sel';\n\t\t$this->transaccion='ADQ_PROCPED_SEL';\n\t\t$this->tipo_procedimiento='SEL';//tipo de transaccion\n\t\t\t\t\n\t\t$this->setParametro('id_proceso_compra','id_proceso_compra','int4');\n\t\t//Definicion de la lista del resultado del query\n\t\t$this->captura('id_proceso_compra','int4');\n\t\t$this->captura('id_depto','int4');\n\t\t$this->captura('num_convocatoria','varchar');\n\t\t$this->captura('id_solicitud','int4');\n\t\t$this->captura('id_estado_wf','int4');\n\t\t$this->captura('fecha_ini_proc','date');\n\t\t$this->captura('obs_proceso','varchar');\n\t\t$this->captura('id_proceso_wf','int4');\n\t\t$this->captura('num_tramite','varchar');\n\t\t$this->captura('codigo_proceso','varchar');\n\t\t$this->captura('estado_reg','varchar');\n\t\t$this->captura('estado','varchar');\n\t\t$this->captura('num_cotizacion','varchar');\n\t\t$this->captura('id_usuario_reg','int4');\n\t\t$this->captura('fecha_reg','timestamp');\n\t\t$this->captura('fecha_mod','timestamp');\n\t\t$this->captura('id_usuario_mod','int4');\n\t\t$this->captura('usr_reg','varchar');\n\t\t$this->captura('usr_mod','varchar');\n\t\t\n\t\t$this->captura('desc_depto','varchar');\n\t\t$this->captura('desc_funcionario','text');\n\t\t$this->captura('desc_solicitud','varchar');\n\t\t$this->captura('desc_moneda','varchar');\n\t\t\n\t\t \n\t\t\n\t\t//Ejecuta la instruccion\n\t\t$this->armarConsulta();\n\t\t$this->ejecutarConsulta();\n\t\t\n\t\t//Devuelve la respuesta\n\t\treturn $this->respuesta;\n\t}", "function retrieve_promoter_clients_list(){\n\t\t\n\t\t$this->CI->load->model('model_users_promoters', 'users_promoters', true);\n\t\t$clients = $this->CI->users_promoters->retrieve_promoter_clients_list($this->promoter->up_id, $this->promoter->team->t_fan_page_id);\n\t\tforeach($clients as $key => &$client){\n\t\t\t\n\t\t\tif($client->pglr_user_oauth_uid === null){\n\t\t\t\tunset($clients[$key]);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t\n\t\t\t$client = $client->pglr_user_oauth_uid;\n\t\t}\n\t\treturn $clients;\n\t\t\n\t}", "public function getAllClients(){\n\t\t$sql = \"SELECT * FROM cliente;\";\n\t\treturn $this->Model->getData($sql);\n\t}", "static function listaClanaka(){\n\t\trequire_once(MODEL_ABS.'DB_DAO/Broker_baze.php');\n\t\trequire_once(MODEL_ABS.'DB_DAO/Clanak.php');\n\t\t\n\t\t$broker=new Broker();\n\t\t$clanak=new Clanak($broker);\n\t\t(isset($_GET['pag'])) ? $pag=$_GET['pag'] : $pag=0;\n\t\t(isset($_GET['korak'])) ? $korak=$_GET['korak'] : $korak=5;\n\t\t\n\t\t$rezultat['clanci']=$clanak->limitClanci($pag,$korak);\n\t\t$br_clanaka=$clanak->brojanjeClanaka();\n\t\t$rezultat['pags']=ceil($br_clanaka/$korak);\n\t\t$rezultat['pag']=$pag;\n\t\t\n\t\treturn $rezultat;\n\t}", "public function TresorieEntreprise() {\n \n $em = $this->getDoctrine()->getManager();\n $entityEntreprise= $em->getRepository('RuffeCardUserGestionBundle:Entreprise')->findClientNoPaiment();\n return $this->render ( \"RuffeCardTresorieBundle:Default:entreprisePaiement.html.twig\", array ('Entreprise'=>$entityEntreprise));\n \n }", "public function listdataPrncAction() {\n $this->view->dataList = $this->adm_listdata_serv->getDataList('PERENCANAAN');\n }", "public function listCommandeSpecifique(){\n //$demandes est utilisee a la page d'accueil apres l'authentification\n //donc necessaires pour toutes les fonction qui utilse cette page\n\n $demandes = nonConsult();\n\n $commandes=DB::table('fournisseurs')\n ->join('commandes','fournisseurs.id','=','commandes.fournisseurs_id')\n ->where([\n ['commandes.cotations_id', '=', null],\n ['commandes.etat', '=', 1]\n ])\n ->select('fournisseurs.nomSociete','fournisseurs.nomDuContact','fournisseurs.prenomDuContact',\n 'fournisseurs.telephoneDuContact', 'commandes.*')\n ->get();\n\n return view('commandes.listCommandeSansCotation', compact('demandes', 'commandes'));\n\n }", "function listarProcesoCompra(){\n\t\t$this->procedimiento='adq.f_proceso_compra_sel';\n\t\t$this->transaccion='ADQ_PROC_SEL';\n\t\t$this->tipo_procedimiento='SEL';//tipo de transaccion\n\t\t\t\t\n\t\t//Definicion de la lista del resultado del query\n\t\t$this->captura('id_proceso_compra','int4');\n\t\t$this->captura('id_depto','int4');\n\t\t$this->captura('num_convocatoria','varchar');\n\t\t$this->captura('id_solicitud','int4');\n\t\t$this->captura('id_estado_wf','int4');\n\t\t$this->captura('fecha_ini_proc','date');\n\t\t$this->captura('obs_proceso','varchar');\n\t\t$this->captura('id_proceso_wf','int4');\n\t\t$this->captura('num_tramite','varchar');\n\t\t$this->captura('codigo_proceso','varchar');\n\t\t$this->captura('estado_reg','varchar');\n\t\t$this->captura('estado','varchar');\n\t\t$this->captura('num_cotizacion','varchar');\n\t\t$this->captura('id_usuario_reg','int4');\n\t\t$this->captura('fecha_reg','timestamp');\n\t\t$this->captura('fecha_mod','timestamp');\n\t\t$this->captura('id_usuario_mod','int4');\n\t\t$this->captura('usr_reg','varchar');\n\t\t$this->captura('usr_mod','varchar');\n\t\t\n\t\t$this->captura('desc_depto','varchar');\n\t\t$this->captura('desc_funcionario','text');\n\t\t$this->captura('desc_solicitud','varchar');\n\t\t$this->captura('desc_moneda','varchar');\n\t\t\n\t\t \n\t\t\n\t\t//Ejecuta la instruccion\n\t\t$this->armarConsulta();\n\t\t$this->ejecutarConsulta();\n\t\t\n\t\t//Devuelve la respuesta\n\t\treturn $this->respuesta;\n\t}", "public function consultarClientes() {\n\n $conexion = new conexion();\n $sql = \"select nit, nombre from cliente_general where estado = 'A' group by nit,nombre order by nombre\";\n $resulConsulta = $conexion->consultar($sql);\n\n return $resulConsulta;\n }", "public function getAutoposList(){\n return $this->_get(2);\n }", "function index() {\n\t\t$this->paginate = array(\n\t\t\t'conditions'=>array('user_id'=>$this->Auth->user('id')),\n\t\t\t'limit'=>'10',\n\t\t\t'order'=>'modified DESC'\n\t\t);\n\t\t$clients = $this->paginate();\n\t\t$this->set(compact('clients'));\n\t}", "public function clientes($id, $page)\n {\n \n //\n if(!(Gate::denies('read_franqueado'))){\n\n //Selecionar franquia com segurança\n $franquia = Auth::user()\n ->franquia()\n ->where('franquias.id', $id)\n ->first(); \n\n //Verifica se tem permissão na franquia-----------------------------\n if($franquia){\n\n /* ----------------- Inicia Conexão WC ----------------------- */\n $consumer_secret = $this->decrypt($franquia->consumer_secret); \n\n $woocommerce = new Client(\n $franquia->store_url, \n $franquia->consumer_key, \n $consumer_secret,\n [\n 'wp_api' => true,\n 'version' => 'wc/v3',\n ]\n );\n\n /* ----------------- FIM Inicia Conexão WC ----------------------- */\n\n if(!isset($page)){\n $page = 1;\n } \n\n //$clientes = $woocommerce->get('products'); \n $clientes = $woocommerce->get('customers', array('per_page'=>50, 'page'=>$page)); \n\n $woocommerceHeaders = $woocommerce->http->getResponse()->getHeaders();\n\n $totalPages = $woocommerceHeaders['X-WP-TotalPages']; \n\n\n //LOG ------------------------------------------------------\n $this->log(\"franqueado.clientesFranqueado=\".$franquia);\n //----------------------------------------------------------\n\n return view('franqueado.cliente', \n array(\n 'franquia' => $franquia, \n 'clientes' => $clientes,\n 'page' => $page,\n 'totalPages' => $totalPages,\n 'linkPaginate' => 'franqueados/'.$franquia->id.'/clientes/',\n ));\n\n }else{\n return view('errors.403');\n }\n //---------------------------------------------------------------------------------------------------\n\n\n \n }\n else{\n return view('errors.403');\n }\n }", "function get_servicios_web_ofrecidos()\n\t{\n\t\t$sql = \"\n\t\t\tSELECT\n\t\t\t\titem as servicio_web,\n\t\t\t\tnombre\n\t\t\tFROM apex_item\n\t\t\tWHERE\n\t\t\t\tproyecto = '{$this->get_id()}'\n\t\t\t\tAND solicitud_tipo = 'servicio_web'\n\t\t\tORDER BY item;\n\t\t\";\n\t\treturn $this->get_db(true)->consultar($sql);\n\t}", "function show_food_list_by_rest()\n\t\t{\n\t\t\trequire(\"connection_credentials.php\");\n\t\t\t$pdo = new PDO($dsn, $username, $password, $options);\n\t\t\t$stmt = $pdo->prepare('SELECT id_polozka, nazev, popis, cena FROM Polozka WHERE id_provozovna=:id_provozovna');\n\t\t\t$stmt->execute(['id_provozovna' => $_GET['show_food_list']]);\n\t\t\t$result = $stmt->fetchAll();\n\t\t\tforeach ($result as $row) {\n\t\t\t\techo \"<strong>\" . $row[\"nazev\"]. \"</strong><br>\" . $row[\"popis\"] . \"<br>\" . $row[\"cena\"] . \" Kč\";\n\t\t\t\t?>\n\t\t\t\t<form action=\"projekt.php\" method=\"post\">\n\t\t\t\t\t<input name=\"buy_item\" type=\"submit\" value=\"Přidat do košíku\" />\n\t\t\t\t\t<input name=\"item_id\" type=\"hidden\" value=\"<?php echo $row[\"id_polozka\"]; ?>\">\n\t\t\t\t</form>\n\t\t\t\t<br>\n\t\t\t\t<?php\n\t\t\t}\n\t\t}", "public function getAllClientsInfo() {\n //Nom de famille :\n //Prénom :\n //Date de naissance :\n //Carte de fidélité :\n //Si oui, N° de carte:\n $queryResult = $this->database->query('SELECT lastName, firstName, birthDate, card, cardNumber, \n CASE card\n\tWHEN 1 THEN \"Oui\"\n\tWHEN 0 THEN \"Non\"\n END AS \"etat\"\n FROM clients'); \n $allClientsInfoData = $queryResult->fetchAll(PDO::FETCH_OBJ);\n return $allClientsInfoData;\n }", "public function list()\n\t{\n\t\t$proveedorHuevo = $this->ProveedorHuevo_model->get_ProveedorHuevo();\n\t\t\n $this->response->sendJSONResponse($proveedorHuevo);\n\n\t\t\n\t}", "public function lista() {\n $sql = \"SELECT * FROM cliente\";\n $qry = $this->db->query($sql); // query do pdo com acesso ao bd\n\n //return $qry->fetchAll(); // retorna todos os registros\n return $qry->fetchAll(\\PDO::FETCH_OBJ); // retorna todos os registros a nível de objeto\n }", "public function hookDisplayBackOfficeTop()\n {\n $objectifCoach = array();\n $this->context->controller->addCSS($this->_path . 'views/css/compteur.css', 'all');\n $this->context->controller->addJS($this->_path . 'views/js/compteur.js');\n $objectifCoach[] = CaTools::getObjectifCoach($this->context->employee->id);\n $objectif = CaTools::isProjectifAtteint($objectifCoach);\n $objectif[0]['appels'] = (isset($_COOKIE['appelKeyyo'])) ? (int)$_COOKIE['appelKeyyo'] : '0';\n\n $this->smarty->assign(array(\n 'objectif' => $objectif[0]\n ));\n return $this->display(__FILE__, 'compteur.tpl');\n }", "function listClients()\n{\n $clients = getClients();\n require('view/client/listClientsView.php');\n}", "function listarViajeroInterno(){\n\t\t$this->procedimiento='obingresos.ft_viajero_interno_sel';\n\t\t$this->transaccion='OBING_CVI_SEL';\n\t\t$this->tipo_procedimiento='SEL';//tipo de transaccion\n\t\t\t\t\n\t\t//Definicion de la lista del resultado del query\n\t\t$this->captura('id_viajero_interno','int4');\n\t\t$this->captura('estado_reg','varchar');\n\t\t$this->captura('codigo_voucher','varchar');\n\t\t$this->captura('mensaje','varchar');\n\t\t$this->captura('estado','varchar');\n\t\t$this->captura('id_usuario_reg','int4');\n\t\t$this->captura('fecha_reg','timestamp');\n\t\t$this->captura('id_usuario_ai','int4');\n\t\t$this->captura('usuario_ai','varchar');\n\t\t$this->captura('id_usuario_mod','int4');\n\t\t$this->captura('fecha_mod','timestamp');\n\t\t$this->captura('usr_reg','varchar');\n\t\t$this->captura('usr_mod','varchar');\n\t\t\n\t\t//Ejecuta la instruccion\n\t\t$this->armarConsulta();\n\t\t$this->ejecutarConsulta();\n\t\t\n\t\t//Devuelve la respuesta\n\t\treturn $this->respuesta;\n\t}", "function listadoProyectos(){\n $class=\"\";\n $this->arrayEstatusVisibles = array();\n if($this->session['rol'] == 1)\n $this->arrayEstatusVisibles = array(0,1,2,3,4,5,6,7,8,9,10);\n if ($this->session ['rol'] == 2)\n $this->arrayEstatusVisibles = array (0,1,2,3,4,5,6,7,8,9,10);\n \n if($this->session['rol'] == 3)\n $this->arrayEstatusVisibles = array(5,6,7,8,9,10);\n if($this->session['rol'] == 4)\n $this->arrayEstatusVisibles = array(1,2,3,4,5,6,7,8,9,10);\n \n $no_registros = $this->consultaNoProyectosAvances();\n $this->arrayNotificaciones = $this->notificaciones();\n $arrayDisabled = $this->recuperaPermisos(0,0);\n $trimestreId = $this->obtenTrimestre($arrayDisabled);\n $noTri = $trimestreId;\n if($trimestreId == 1)\n $noTri =\"\";\n \n if($no_registros){\n $this->pages = new Paginador();\n $this->pages->items_total = $no_registros;\n $this->pages->mid_range = 25;\n $this->pages->paginate();\n $resultados = $this->consultaProyectosAvances();\n $this->bufferExcel = $this->generaProyectosExcel();\n }\n $col=6;\n $this->buffer=\"\n <input type='hidden' name='trimestreId' id='trimestreId' value='\".$trimestreId.\"'>\n <div class='panel panel-danger spancing'>\n <div class='panel-heading'><span class='titulosBlanco'>\".str_replace(\"#\",$trimestreId,REPORTETRIMESTRAL).\"</span></div>\n <div class='panel-body'><center><span id='res'></span></center>\".$this->divFiltrosProyectos(1,0,\"\",\"\").\"\n <center>\".$this->regresaLetras().\"</center><br>\";\n if(count($resultados) > 0){\n $arrayAreas = $this->catalogoAreas();\n $arrayOpera = $this->catalogoUnidadesOperativas();\n $this->buffer.=\"\n <table width='95%' class='table tablesorter table-condensed' align='center' id='MyTableActividades'>\n <thead><tr>\n <td class='tdcenter fondotable' width='2%' >\".NO.\"</td>\n <td class='tdcenter fondotable' width='10%' >\".AREA.\"</td>\n <td class='tdcenter fondotable' width='36%' >\".PROYECTOS.\"</td>\n <td class='tdcenter fondotable' width='10%' >\".METASREPORTE.\"</td> \n <td class='tdcenter fondotable' width='10%' >\".FECHAALTA.\"</td>\n <td class='tdcenter fondotable' width='12%' >\".ESTATUSVALIDACION.\" Trimestre \".$trimestreId.\"</td> \n <td clasS='tdcenter fondotable' width='12%' >\".ENVIARCOORDINADOR.\"</td>\";\n if($this->session['rol']>=3 ){\n $this->buffer.=\"<td clasS='tdcenter fondotable' width='10%'>\".MARCAVALIDAR.\"</td>\";\n $col++;\n }\n $this->buffer.=\"</tr></thead><tbody>\";\n $contador=1;\n $varTemporal=\"\";\n if($this->session['page']<=1)\n $contadorRen= 1;\n else\n $contadorRen=$this->session['page']+1; \n \n foreach($resultados as $id => $resul){\n $rand = rand(1,99999999999999);\n $class=\"\";\n if($contador % 2 == 0)\n $class=\"active\";\n $campo = \"estatus_avance_entrega\".$noTri;\n $idEstatus=$resul[$campo]; \n $varTemporal = $resul['id'];\n if($idEstatus == 0){\n $this->arrayNotificaciones[0]['act'] = 1;\n }\n $this->buffer.=\"\n <tr class=' $class alturaComponentesA'> \n <td class='tdcenter'>\".$contador.\"</td>\n <td class='tdcenter'>\n <a class='negro' href='#'\n data-toggle='tooltip' data-placement='bottom'\n title='\".$arrayAreas[$resul['unidadResponsable_id']].\". - Unidad Operativa: \".$arrayOpera[$resul['unidadOperativaId']].\"'>\n &nbsp;\" . $resul['unidadResponsable_id']. \"</a>\n </td> \n <td class='tdleft'>\".$resul['proyecto'].\"</td>\n <td class='tdcenter'>\";\n if($resul['noAcciones'] > 0)\n {\n $this->buffer.=\"\n <a class='negro' href='\".$this->path.\"aplicacion.php?aplicacion=\".$this->session ['aplicacion'].\"&apli_com=\".$this->session ['apli_com'].\"&opc=9&folio=\".$varTemporal.\"'\n data-toggle='tooltip' data-placement='bottom' title='\".TOOLTIPMETAREP.\"' id='\".$varTemporal.\"'>\".$resul['noAcciones'].\"</a>\";\n }\n $this->buffer.=\"</td> \n <td class='tdcenter'>\".substr($resul['fecha_alta'],0,10).\"</td>\n <td class='tdcenter' style='background-color:\".$this->arrayNotificaciones[$idEstatus]['color'].\";color:#000000;'>\";\n if($idEstatus > 2){\n $this->buffer.=\"<a class='negro visualizaComentarios' href='#' onclick='return false;' id='\".$varTemporal.\"'\n data-toggle='tooltip' data-placement='bottom' title='\".TOOLTIPMUESTRACOMENTARIOS.\"'>\n &nbsp;\".$this->arrayNotificaciones[$idEstatus]['nom'].\"\n </a>\";\n }\n else{\n $this->buffer.=$this->arrayNotificaciones[$idEstatus]['nom'];\n }\n $this->buffer.=\"</td><td class='tdcenter'>\";\n //mostramos el checkbox rol 1\n if(($this->session['rol'] == 1 || $this->session['rol'] == 2) && $idEstatus>0 && $idEstatus < 4){\n //if( ($this->arrayNotificaciones[$idEstatus]['act'] == 1) && ($resul['userId'] == $this->session['userId']) ){\n if( ($this->arrayNotificaciones[$idEstatus]['act'] == 1) ){\n if($resul['noAcciones']>0)\n $this->buffer.=\"<input data-toggle='tooltip' data-placement='bottom' title='\".DESMARCAVALIDAR.\"' type='checkbox' name='enviaId' id='\".$varTemporal.\"' class='enviaIdAvance' value='\".$resul['id'].\"'>\";\n }\n }\n //mostramos el checkbox rol 2\n if($this->session['rol'] == 2 && $idEstatus >= 4 && $idEstatus < 7 && $idEstatus != 5){\n if($resul['noAcciones']>0)\n $this->buffer.=\"<input data-toggle='tooltip' data-placement='bottom' title='\".DESMARCAVALIDAR.\"' type='checkbox' name='enviaId' id='\".$varTemporal.\"' class='enviaIdAvance' value='\".$resul['id'].\"'>\";\n }\n //mostramos el checkbox rol 3\n if($this->session['rol'] == 3 && $idEstatus >= 5 && $idEstatus < 10 && $idEstatus != 6 && $idEstatus != 8){\n if($resul['noAcciones']>0)\n if($idEstatus == 5)\n $this->buffer.=$this->pintaComentarioAvance($idEstatus,$resul['id'],$trimestreId);\n else\n $this->buffer.=\"<input data-toggle='tooltip' data-placement='bottom' title='\".DESMARCAVALIDAR.\"' type='checkbox' name='enviaId' id='\".$varTemporal.\"' class='enviaIdAvance' value='\".$resul['id'].\"'>\";\n }\n //mostramos el checkbox rol 4\n if($this->session['rol'] == 4 && $idEstatus >= 6 && $idEstatus <= 10 && $idEstatus != 7){\n if($resul['noAcciones']>0)\n if($idEstatus == 8)\n $this->buffer.=$this->pintaComentarioAvance($idEstatus,$resul['id'],$trimestreId);\n }\n $this->buffer.=\"</td>\";\n \n if ($this->session['rol'] == 3){\n $this->buffer.=\"<td class='tdcenter'>\";\n if($idEstatus == 6 ){\n $this->buffer.=\"<a class='negro enviaEnlacePlaneacion' id='c-\".$varTemporal.\"-0' href='#' data-toggle='tooltip' data-placement='bottom' title='\".TOOLTIPREGRESAPROYECTOPLANEACION.\"'><span class='glyphicon glyphicon-thumbs-down'></span>&nbsp;</a>\";\n }\n $this->buffer.=\"</td>\";\n }\n if ($this->session['rol'] >= 4){\n $this->buffer.=\"<td class='tdcenter'>\";\n if($idEstatus == 9 ){\n $this->buffer.=\"<a class='negro enviaCoordinador' id='p-\".$varTemporal.\"-0' href='#' data-toggle='tooltip' data-placement='bottom' title='\".TOOLTIPREGRESAPROYECTOCOORDINADOR.\"'><span class='glyphicon glyphicon-thumbs-down'></span>&nbsp;</a>\";\n }else{\n if($idEstatus <10 )\n $this->buffer .= \"<input data-toggle='tooltip' data-placement='bottom' title='\" . DESMARCAVALIDAR . \"' type='checkbox' name='enviaId' id='\" . $varTemporal . \"' class='enviaIdAvance' value='\" . $resul ['id'] . \"'>\";\n }\n $this->buffer.=\"</td>\";\n }\n \n $this->buffer.=\"</tr>\";\n $contador++;\n } \n $this->buffer.=\"<tbody><thead><tr>\n <td colspan='\".($col-1).\"' class='tdcenter'>&nbsp;</td>\n <td colspan='2' class='tdcenter'>\".$this->Genera_Archivo($this->bufferExcel,$this->path_sis).\"</td>\n </tr></thead></table>\n <table width='100%'><tr><td class='tdcenter'>\".$this->pages->display_jump_menu().\"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\".$this->pages->display_items_per_page($this->session ['regs']).\"</td></tr></table>\"; \n }\n else{\n $this->buffer.=\"<table class='table table-condensed'><tr><td class='tdcenter'>\".SINREGISTROS.\"</td></tr></table>\";\n }\n $this->buffer.=\"</div></div>\";\n }", "public function getCourier_deliveries_list()\n {\n $sql = \"SELECT a.id, a.order_inv, a.c_driver, a.r_address, a.created, a.r_hour, a.status_courier, a.act_status, s.mod_style, s.color FROM consolidate a, styles s WHERE a.status_courier=s.mod_style AND a.c_driver = '\".$this->username.\"' AND a.act_status=1 ORDER BY a.id ASC\";\n $row = self::$db->fetch_all($sql);\n \n return ($row) ? $row : 0;\n }" ]
[ "0.70304775", "0.6843026", "0.6828918", "0.6734751", "0.6669923", "0.666392", "0.6590058", "0.65383863", "0.6536704", "0.6535793", "0.6535216", "0.6533364", "0.6528679", "0.6527088", "0.6519497", "0.6511529", "0.6487047", "0.64403516", "0.64034045", "0.64018", "0.6391739", "0.63795257", "0.6371333", "0.63613975", "0.6329192", "0.63276625", "0.63221276", "0.63205004", "0.62924665", "0.62877053", "0.628717", "0.62642187", "0.6254556", "0.6246784", "0.623837", "0.62319857", "0.6226203", "0.62169653", "0.6209478", "0.6209327", "0.62071526", "0.62007505", "0.6197866", "0.6183218", "0.6183145", "0.6180098", "0.6175034", "0.6171097", "0.61679155", "0.6156426", "0.61452043", "0.6142603", "0.6138662", "0.6131575", "0.61217666", "0.6111347", "0.6108078", "0.6106603", "0.6103944", "0.610267", "0.61014295", "0.6097536", "0.60920626", "0.6090954", "0.60896057", "0.60870194", "0.60725075", "0.60625064", "0.6059745", "0.60594994", "0.60550946", "0.60532916", "0.60529554", "0.60510015", "0.6050099", "0.604285", "0.6042817", "0.602962", "0.602558", "0.60221946", "0.6016927", "0.6008408", "0.6003747", "0.59991", "0.59960794", "0.5991762", "0.5989925", "0.59880066", "0.5982898", "0.5974263", "0.597351", "0.59681785", "0.59627146", "0.59627014", "0.59572", "0.5942743", "0.5937109", "0.5931413", "0.5926923", "0.59238136", "0.5923604" ]
0.0
-1
add new product front office
public function addProductAction() { $em = $this->getDoctrine()->getManager(); $product=new Product(); $form=$this->createForm(new ProductForm(),$product); $request=$this->get('request'); $form->handleRequest($request); if($form->isValid()) { $em=$this->getDoctrine()->getManager(); $upload = new Upload("", "../web/Uploads/", 0, 0); $productVideo=$form->get('video')->getData(); $file = array("tmp_name" => $productVideo->getPathname(), "type" => $productVideo->getMimeType() ); $productPhoto=$form->get('productPhoto')->getData(); $file1 = array("tmp_name" => $productPhoto->getPathname(), "type" => $productPhoto->getMimeType() ); $product->setVideo($upload->uploadFile($file)); $product->setProductPhoto($upload->uploadFile($file1)); $product->setProductDate(new \DateTime('now')); $product->setIdUser($this->getUser()); $em->persist($product); $em->flush(); return $this->redirectToRoute('esprit_hologram_front_products'); } return $this->render('HologramBundle:Front:newProduct.html.twig',array('f'=>$form->createView())); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function add() {\n\t\tif (True) {\n\n\t\t\t// create an empty product.\n\t\t\t$o =& new ufo_product(0);\n\t\t\t$this->addedObject =& $o;\n\t\t\n\t\t\t// create an entry in the db.\n\t\t\t$o->initialize();\n\t\t\t$o->create();\n\t\t\t$o->edit();\n\n\t\t\t// add it to the product array.\n\t\t\t$this->product[] = $o;\n\t\t}\n\t}", "function add()\n\t{\n\t\tif (!$this->checkLogin()) {\n\t\t\tredirect(base_url());\n\t\t}\n\n\t\t$pageData['header_title'] = APP_NAME . ' | Add Product';\n\t\t$pageData['page_title'] = 'Inventory Management';\n\t\t$pageData['parent_menu'] = 'inventory_management';\n\t\t$pageData['child_menu'] = 'add_new_product';\n\n\t\t//get branches\n\t\t$where = array('status_id =' => ACTIVE);\n\t\t$select = '*';\n\t\t$records = 2;\n\t\t$branches = $this->base_model->getCommon($this->branchesTable, $where, $select, $records);\n\t\t$pageData['branches'] = json_encode($branches);\n\t\t// print_r($branches);die;\n\t\t$this->load->view('admin/inventory_management/add', $pageData);\n\t}", "function add()\n\t{\n\t\t// hien thi form them san pham\n\t\t$this->layout->set('auth_layout');\n\t\t$this->view->load('product/add');\n\t}", "public function create()\n\t{\n /*if(!in_array('viewProduct', $this->permission)) {\n redirect('dashboard', 'refresh');\n }*/\n\n $this->data['vendor'] = $this->model_products->getVendorData();\n $this->data['products'] = $this->model_products->getProductData();\n\n\t\t$this->render_template('invoice/create', $this->data);\t\n\t}", "public function addOneAction()\n\t{\n\t\t//vérification du statut d'admin\n\t\t$customersManager = new CustomersManager();\n\t\t$customer = $customersManager -> getLoginInfo();\n\t\tif (empty($customer) OR $customer['email'] != ADMIN_EMAIL)\n\t\t{\n\t\t\theader('Location:'.CLIENT_ROOT.'customers/account');\n\t\t\texit();\n\t\t}\n\n\t\t//sécurisation CSRF\n\t\tif(!array_key_exists('CSRFToken', $customer) OR !array_key_exists('CSRFToken', $_POST) OR $_POST['CSRFToken'] != $customer['CSRFToken'])\n\t\t{\n\t\t\theader('Location:'.CLIENT_ROOT.'customers/account');\n exit();\n\t\t}\n\n\t\t//vérification des données reçues\n\t\t$enteredData =\n\t\t[\n\t\t\t'name' => trim($_POST['productName']),\n\t\t\t'description' => trim($_POST['description']),\n\t\t\t'imagePath' => (!empty($_POST['imagePath']))? trim($_POST['imagePath']) : null,\n\t\t\t'priceHT' => trim($_POST['priceHT']),\n\t\t\t'VATRate' => trim($_POST['VATRate']),\n\t\t\t'idCategory' => trim($_POST['idCategory']),\n\t\t];\n\n\t\t//mémorisation pour ré-afficher les données entrées en cas d'erreur\n\t\t$_SESSION['forms']['adminAddProduct']['fieldsContent'] = $enteredData;\n\t\t$requiredFields = ['name', 'description', 'imagePath', 'priceHT', 'VATRate', 'idCategory'];\n\t\t$requiredFieldsNumber = count($requiredFields);\n\n\t\tfor ($i=0; $i < $requiredFieldsNumber; $i++) { \n\t\t\tif(!array_key_exists($requiredFields[$i], $enteredData))\n\t\t\t{\n\t\t\t\t$_SESSION['alertMessages']['error'][] ='Veuillez entrer des informations valides.';\n\t\t\t\theader('Location:'.CLIENT_ROOT.'products/manageForm');\n\t\t\t\texit();\n\t\t\t}\n\t\t\tif(empty($enteredData[$requiredFields[$i]]))\n\t\t\t{\n\t\t\t\t$_SESSION['alertMessages']['error'][] = 'Veuillez remplir tous les champs obligatoires.';\n\t\t\t\theader('Location:'.CLIENT_ROOT.'products/manageForm');\n\t\t\t\texit();\n\t\t\t}\n\t\t}\n\n\t\t//ajout dans la BDD\n\t\t$requiredData = $enteredData;\n\t\t$productsManager = new ProductsManager();\n\t\t$productAdded = $productsManager -> addOne($requiredData);\n\n\t\tif($productAdded)\n\t\t{\n\t\t\t$_SESSION['alertMessages']['success'][] = 'Le produit a bien été ajouté !';\n\t\t\tunset($_SESSION['forms']['adminAddProduct']['fieldsContent']);\n\t\t\theader('Location:'.CLIENT_ROOT.'products/manageForm');\n\t\t\texit();\n\t\t\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$_SESSION['alertMessages']['error'][] = 'L\\'ajout du produit a échoué !';\n\t\t\theader('Location:'.CLIENT_ROOT.'products/manageForm');\n\t\t\texit();\n\t\t}\n\t}", "public function create(){\n return view(\"admin.addProduct\");\n }", "public function add() {\r\n if(isset($this->data) && isset($this->data['Product'])) {\r\n $product = $this->Product->save($this->data);\r\n $this->set('response', array('Products' => $this->Product->findByProductid($product['Product']['ProductID'])));\r\n $this->Links['self'] = Router::url(array('controller' => $this->name, 'action' => 'view', $product['Product']['ProductID']), true);\r\n } else {\r\n $this->Links['self'] = Router::url(array('controller' => $this->name, 'action' => 'index'), true);\r\n }\r\n }", "public function get_add()\n { \n // Render the page\n View::make($this->bundle . '::product.add')->render();\n }", "public function addEditProduct() {\n $vmAdd = ProductsVM::getAddEditInstance();\n $vm = ProductsVM::getCategoryInstance($vmAdd->category->id);\n Page::$title = 'Admin - Upload' . $vm->category->name;\n require(APP_NON_WEB_BASE_DIR . 'views/upload.php'); //old ref require(APP_NON_WEB_BASE_DIR . 'views/adminProductList.php');\n }", "public function addProductsToSaleCreate()\n {\n $products = $this->mapper->all($this->product);\n\n return include PLUGINS.'Products/views/sale-products.php';\n }", "public function addproducttopoAction() {\n $id = $this->getRequest()->getParam('id');\n $sku = $this->getRequest()->getParam('sku');\n $model = Mage::getModel('inventorypurchasing/purchaseorder_draftpo')->load($id);\n try {\n $productId = Mage::getModel('catalog/product')->getIdBySku($sku);\n if (!$productId) {\n throw new Exception($this->helper()->__('Not found sku: %s', \"<i>$sku</i>\"));\n }\n $model->addProduct($productId);\n Mage::getSingleton('vendors/session')->addSuccess(\n $this->helper()->__('Product %s has been added.', \"<i>$sku</i>\")\n );\n $this->_redirect('*/*/view', array('id' => $id));\n } catch (Exception $e) {\n Mage::getSingleton('vendors/session')->addError($this->helper()->__('There is error while adding product.'));\n Mage::getSingleton('vendors/session')->addError($e->getMessage());\n $this->_redirect('*/*/view', array('id' => $id));\n }\n }", "public function addProduct()\n {\n if (!isset($_POST['newProd'])) {\n \n $this->reqView('AddProduct');\n\n } else {\n \n // instantiate admin model\n $this->initModel('NewProduct_model');\n \n // call addProduct method in model and check if the model successfuly added a new product to database\n if($this->modelObj->addProduct() || $_POST['newProdStatus'] == 'success')\n {\n\n // require the add product view\n $this->reqView('AddProduct');\n \n } else {\n\n echo 'Error, contact site administrator';\n }\n }\n \n // check if user selected the add variant option(pushed button)\n if(isset($_POST['addVariant']['status']) && $_POST['addVariant']['status'] == 'true')\n {\n //call model to handle new variant input\n $this->initModel('AddVariant_model');\n }\n }", "public function AddAction()\n {\n \t$response = false;\n \t$product_id = $this->getRequest()->getParam('sm_product_id');\n \t\n \ttry \n \t{\n\t \t//Cree le movement\n\t\t\tmage::getModel('Purchase/StockMovement')\n\t\t\t\t->setsm_product_id($product_id)\n\t\t\t\t->setsm_qty($this->getRequest()->getParam('sm_qty'))\n\t\t\t\t->setsm_coef(mage::getModel('Purchase/StockMovement')->GetTypeCoef($this->getRequest()->getParam('sm_type')))\n\t\t\t\t->setsm_description($this->getRequest()->getParam('sm_description'))\n\t\t\t\t->setsm_type($this->getRequest()->getParam('sm_type'))\n\t\t\t\t->setsm_date($this->getRequest()->getParam('sm_date'))\n\t\t\t\t->save();\n\t\t\t\t\n\t\t\tMage::GetModel('Purchase/StockMovement')->ComputeProductStock($product_id);\n\t\t\t\t \t\t\n\t \t//Confirme\n \t Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Stock movement created'));\n \t}\n \tcatch (Exception $ex)\n \t{\n \t Mage::getSingleton('adminhtml/session')->addError($this->__('Error'));\n \t}\n \t\n\t\t//redirect to purchase product sheet\n\t\t$this->_redirect('Purchase/Products/Edit', array('product_id' => $product_id, 'tab' => 'tab_stock_movements'));\n\t\t\n }", "public function storeProduct();", "public function productAdd()\n\t{\n\t\t$this->load->view('boutique_product_add');\n }", "function shophead_add()\n {\n $this->layout = 'admin_layout';\n\n\t\tApp::import('Model', 'ProductCategory');\n\t\t$this -> ProductCategory = new ProductCategory();\n\t\t\n\t\t$this -> set('categories', $this -> ProductCategory -> find('list', array('fields' => array('ProductCategory.id', 'ProductCategory.name'), 'conditions' => array('ProductCategory.status' => 1,'ProductCategory.is_deleted'=>0))));\n\t\t$categories_list = $this->ProductCategory->find('list', array('conditions' => array('ProductCategory.is_deleted' => 0), 'fields' => array('ProductCategory.id', 'ProductCategory.name')));\n $this->set('categories_list', $categories_list);\n if ($this->request->is('post')) {\n $this->ProductItem->set($this->request->data);\n\t\t\t $this->request->data = Sanitize::clean($this->request->data, array('encode' => false));\n if ($this->ProductItem->validates()) {\n //pr($this->request->data);die;\n if ($this->ProductItem->save($this->request->data)) {\n $this->Session->write('flash', array(ADD_RECORD, 'success'));\n } else {\n $this->Session->write('flash', array(ERROR_MSG, 'failure'));\n }\n $this->redirect(array('controller' => 'ProductItems', 'action' => 'index'));\n }\n }\n }", "public function add()\r\n\r\n {\r\n\r\n $this->page_title->push(lang('menu_products_add'));\r\n\r\n $this->data['pagetitle'] = $this->page_title->show();\r\n\r\n\r\n\r\n /* Breadcrumbs :: Common */\r\n\r\n $this->breadcrumbs->unshift(1, lang('menu_products_add'), 'admin/setup/products/add');\r\n\r\n\r\n\r\n /* Breadcrumbs */\r\n\r\n $this->data['breadcrumb'] = $this->breadcrumbs->show();\r\n\r\n\r\n\r\n /* Data */\r\n\r\n $this->data['error'] = $this->session->flashdata('errors');\r\n\r\n $this->data['message'] = isset($_GET['uploaded']) ? $this->session->flashdata('message') : NULL;\r\n\r\n $this->data['charset'] = 'utf-8';\r\n\r\n $this->data['form_url'] = 'admin/setup/product/store';\r\n\r\n $this->data['form_products_upload_url'] = 'admin/setup/product/store/bulk';\r\n\r\n\r\n\r\n $categories = $this->categories->getData();\r\n\r\n $this->data['categories_option'] = '';\r\n\r\n\r\n foreach ($categories[0]->data as $category) {\r\n\r\n if ($category->parent == 0) $this->data['categories_option'] .= '<optgroup label=\"' . $category->title . '\"></optgroup>';\r\n\r\n else $this->data['categories_option'] .= '<option value=\"' . $category->bar_code . '\">' . $category->bar_code . ' -- ' . $category->title . '</option>';\r\n\r\n }\r\n\r\n\r\n /* Load Template */\r\n\r\n $this->template->admin_render('admin/products/add', $this->data);\r\n\r\n\r\n\r\n }", "public function addProducts()\n {\n $this->_rootElement->find($this->addProducts)->click();\n }", "function admin_office($product_id = null) {\n\t if (!$product_id) {\n\t $this->Session->setFlash(__('Invalid product', true));\n\t $this->redirect(array(\n\t 'controller' => 'products',\n\t 'action' => 'index'\n\t ));\n }\n\n if (!empty($this->data)) {\n $this->ProductInfo->create();\n if ($this->ProductInfo->save($this->data)) {\n $this->Session->setFlash(__('Product info has been saved', true));\n\t $this->redirect(array(\n\t 'controller' => 'product_infos',\n\t 'action' => 'office',\n\t 'product_id' => $product_id\n\t ));\n }\n } else {\n $this->data = $this->ProductInfo->find('first', array(\n 'conditions' => compact('product_id')\n ));\n }\n\n\t $product = $this->ProductInfo->Product->read(array('id', 'title'), $product_id);\n\t if (!$product) {\n\t $this->Session->setFlash(__('Invalid product', true));\n\t $this->redirect(array(\n\t 'controller' => 'products',\n\t 'action' => 'index'\n\t ));\n }\n $paths = $this->ProductInfo->Product->getPath($product_id, array('id', 'parent_id', 'title'), -1);\n\t\t$isOffice = \"active\";\n $isDetail = $isGallery = $isTabs = $isRatings = $isServices = \"\";\n $this->set(compact(\n 'isDetail', 'isOffice', 'isGallery', 'isTabs', 'isRatings', 'isServices',\n 'product', 'product_id',\n 'paths'\n ));\n\t}", "public function store(Request $request)\n {\n $dataProductoForm = $request->validate([\n 'name' => ['string', 'required'],\n 'description' => ['string', 'required'],\n 'price' => ['numeric','required'],\n 'stock' => ['numeric','required'],\n 'categories' => ['required'],\n 'available' => ['nullable']\n ]);\n\n $newProduct = new Product();\n $newProduct->name = $dataProductoForm['name'];\n $newProduct->description = $dataProductoForm['description'];\n $newProduct->price = $dataProductoForm['price'];\n //$newProduct->stock = $dataProductoForm['stock'];\n isset($dataProductoForm['available']) ? $newProduct->available = true : $newProduct->available = false;\n\n $newProduct ->save();\n\n //la facil\n // foreach ($dataProductoForm['categories'] as $category) {\n // new products_has_categories\n // ->product_id = $newProduct -> id;\n // ->category_id = $category->id \n // }\n\n // la pro\n // queda de tarea de consulta\n\n //mostrar pocos productos en el index \n\n // cuando se de click en load more\n //shop-grid-left.html (1)\n // subir imagenes de producto (2)\n\n \n\n\n }", "function createProduct($parent = null);", "public function newprodadd()\n {\n $kcalnewprod = $_POST['kcalnewprod'];\n $namenewprod = $_POST['namenewprod'];\n //Tworze instancje obiektu klasy NewprodPrototype (dodawania nowego produktu do sesji), i dodaje nowy produkt (pierwszy)\n $NewProductObject = new NewprodPrototype($namenewprod[0],$kcalnewprod);\n $NewProductObject->setNameAndKcalToSession();\n\n //Sprawdzam czy jest ich więcej ( wtedy skopiuje produkt używając Prototypu)\n if(count($namenewprod)>1)\n {\n //jeśli tak usuń pierwszy element (dodany już) i za pomocą prototypu dodawaj następne\n array_shift($namenewprod);\n\n foreach ($namenewprod as $namenewPRD)\n {\n //używam wbudowanej implementacji w php (clone) bazującej na wzorcu prototypu\n $newProduct_NewObject = clone $NewProductObject;\n //kopiuje obiekt i do skopiowanego obiektu zmieniam tylko nazwę (modyfikuję skopiowany obiekt) ( bo kalorie pozostawiam takie same )\n $newProduct_NewObject->setNameAndKcalToSession($namenewPRD);\n }\n }\n //\n\n return redirect('/');\n }", "function uc_order_pane_products_add($form, &$form_state) {\n $form_state['products_action'] = 'add_product';\n $form_state['node'] = node_load($form_state['values']['product_controls']['nid']);\n unset($form_state['refresh_products']);\n $form_state['rebuild'] = TRUE;\n}", "public function add_new() {\n $this->checkteam();\n\n if (!empty($this->data)) {\n\n $flag = 0;\n\n\n\n if ($this->data['Product']['productname'] == '') {\n $flag = 1;\n $this->set('fullname_error', 'Product Name cannot be empty!');\n }\n\n if (!$flag) {\n\n extract($this->data['Product']);\n\n $this->Product->create();\n $newproduct['Product']['name'] = $productname;\n $newproduct['Product']['description'] = $description;\n $newproduct['Product']['category_id'] = $categoris_list;\n $newproduct['Product']['auto_select'] = $auto_select;\n\n if ($this->Product->save($newproduct)) {\n $newproductid = $this->Product->getInsertID();\n\n if ((!empty($productimage)) && ($productimage[\"size\"] / 1024 > 2048)) {\n $flag = 1;\n $this->set('filename_error', 'Product picture cannot exceed 2Mb!');\n } else {\n\n if ((!empty($productimage[\"name\"])) && (!empty($productimage[\"tmp_name\"]))) {\n\n $ext = $this->file_extension($productimage[\"name\"]);\n $file_path = WWW_ROOT . \"img\" . DS . \"products\" . DS;\n $thumb_path = WWW_ROOT . \"img\" . DS . \"product_thumbs\" . DS;\n $file_name = substr(rand(), 1, 4) . str_replace(\" \", \"_\", $productimage[\"name\"]);\n move_uploaded_file($productimage[\"tmp_name\"], $file_path . $file_name);\n $this->gd_thumbnail($file_path . $file_name, $thumb_path . $file_name, $ext, false);\n\n $newimage['Image']['product_id'] = $newproductid;\n $newimage['Image']['name'] = $file_name;\n $newimage['Image']['position'] = 'main';\n\n $this->Image->create();\n $this->Image->save($newimage);\n }\n }\n\n $this->Session->setFlash(__('The Product has been added successfully!', true));\n $this->redirect(array('controller' => 'products', 'action' => '/'));\n } else {\n $this->Session->setFlash(__('Add New Product faild!', true));\n }\n }\n }\n $data_dd_select = $this->Category->generateTreeList(null, null, null, '___');\n $this->set('data_dd_select', $data_dd_select);\n }", "public function add()\n {\n // get request\n $request = $this->getRequest()->request;\n // get product ID from request\n $product_id = $request['a'];\n // get product ids from session\n $compareProducts = $this->View()->getSession('compare')?$this->View()->getSession('compare'):array();\n\n if (!in_array($product_id, $compareProducts)) {\n $compareProducts[] = $product_id;\n }\n // set products to session\n $this->View()->setSession('compare', $compareProducts);\n\n // for ajax request\n if ($request['XHR']) {\n die(json_encode([\n 'success' => true,\n 'message' => $this->View()->translating('compare_item_set'),\n 'count' => count($compareProducts),\n ]));\n }\n\n Router::redirect('compare');\n }", "public function new_product()\n\t{\n\n\t\t//Inputs the new product into the store\n\t\t$products = array(\n\t\t\"product_name\" => $this->input->post('product_name'),\n\t\t\"price\" => $this->input->post('price'),\n\t\t\"description\" => $this->input->post('description'),\n\t\t\"created_at\" => \"NOW()\",\n\t\t\"updated_at\" => \"NOW()\");\n\n\t\t$this->db->insert('products', $products);\n\n\t\t// Go back to the shop\n\t\tredirect(base_url('shop'));\n\t}", "public function add_product() {\n\t\t$values=array(\"product_name\"=>$_POST['product_name'],\"description\"=>$_POST['description']);\n\t\tif($this->insert(\"products\",$values)) {\t\t\t\n\t\t\t$result=$this->runQuery('getAll','select max(id) as id from products');\n\t\t\techo json_encode($result);\n\t\t}\n\t\telse\n\t\t\techo 'Error while inserting product tbl';\n\t}", "public function createProduct($data);", "function premio_products_create() {\n global $wpdb;\n $product_container_table = $wpdb->prefix . \"premio_product_container\";\n $program_table = $wpdb->prefix . \"premio_program\";\n $product_containers = $wpdb->get_results(\"SELECT * from $product_container_table\");\n $programs = $wpdb->get_results(\"SELECT * from $program_table\");\n\n $name = $_POST[\"name\"];\n $description = $_POST[\"description\"];\n $product_container_id = $_POST['productContainerDpw'];\n\n //insert\n if (isset($_POST['insert'])) {\n $table_name = $wpdb->prefix . \"premio_product\";\n\n $wpdb->query(\"CALL create_product('{$name}', '{$description}', '{$product_container_id}')\");\n\n if(!empty($_POST['checkbox'])) {\n foreach($_POST[\"checkbox\"] as $v) {\n $program_id_to_int = (int)$v;\n\n $last_inserted_product_id = $wpdb->get_row($wpdb->prepare(\n \"SELECT product_id as last_inserted_product_id FROM wp_premio_product ORDER BY product_id DESC LIMIT 1\"\n ));\n\n $wpdb->insert(\n $wpdb->prefix.'premio_product_by_program', \n array(\n 'product_by_program_id' => NULL,\n 'program_id_fk' => $program_id_to_int, \n 'product_id_fk' => $last_inserted_product_id->last_inserted_product_id)\n );\n }\n }\n \n $message.=\"Product inserted\";\n }\n ?>\n <link type=\"text/css\" href=\"<?php echo plugins_url(); ?>/premio-products/style-admin.css\" rel=\"stylesheet\" />\n <div class=\"wrap\">\n <h2 class=\"testJC\">Add New Product</h2>\n <?php if (isset($message)): ?><div class=\"updated\"><p><?php echo $message; ?></p></div><?php endif; ?>\n <form method=\"post\" action=\"<?php echo $_SERVER['REQUEST_URI']; ?>\">\n <table class='wp-list-table widefat fixed'>\n <tr>\n <th class=\"ss-th-width\">Name</th>\n <td><input type=\"text\" name=\"name\" value=\"<?php echo $name; ?>\" class=\"ss-field-width\" /></td>\n </tr>\n <tr>\n <th class=\"ss-th-width\">Description</th>\n <td><textarea name=\"description\" rows=\"5\" cols=\"40\" class=\"ss-field-width\" /><?php echo $description; ?></textarea></td>\n </tr>\n <tr>\n <th class=\"ss-th-width\">Container</th>\n <td>\n <select name=\"productContainerDpw\">\n <?php foreach ($product_containers as $container) { ?>\n <option value=\"<?php echo $container->product_container_id; ?>\"><?php echo $container->name; ?></option>\n <?php } ?>\n </select>\n </td>\n </tr>\n <tr>\n <th class=\"ss-th-width\">Programs</th>\n <td>\n <?php foreach ($programs as $program) { ?>\n <input name=\"checkbox[]\" type=\"checkbox\" id=\"checkbox[]\" value=\"<?php echo $program->program_id; ?>\"> <?php echo $program->name; ?> <br>\n <?php } ?>\n </td>\n </tr>\n </table>\n <input type='submit' name=\"insert\" value='Save' class='button'>\n </form>\n <div class=\"tablenav top\">\n <div class=\"alignleft actions\">\n <a href=\"<?php echo admin_url('admin.php?page=premio_products_list'); ?>\">Back to Products</a>\n </div>\n <br class=\"clear\">\n </div>\n </div>\n <?php\n}", "public function actionCreate()\n {\n\t\tif(!$this->IsAdmin())\n\t\t{\n\t\t\treturn $this->render('error', ['name' => 'Not Found (#404)', 'message' => 'Puuduvad piisavad õigused.']);\n\t\t}\n $model = new Product();\n\t\t\t$model->setAttribute('mfr', '-');\n\t\t\t$model->setAttribute('model', '-');\n\t\t\t$model->setAttribute('description', '-');\n\t\t\t$model->setAttribute('price', 0);\n\t\t\t$model->setAttribute('cut_price', 0);\n\t\t\t$model->setAttribute('stock', 0);\n\t\t\t$model->setAttribute('active', 1);\n\t\t\t\n\t\t$model->save();\n\t\t\n\t\treturn $this->redirect(['update', 'id' => $model->id]);\n\n }", "public function createnewproduct()\n {\n Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);\n $product = Mage::getModel('catalog/product');\n $websiteId = Mage::app()->getWebsite('base')->getId();\n $storeId = Mage::app()->getStore('default')->getId();\n\n //Set SKU dynamically over here\n $collection = Mage::getModel('catalog/product')\n ->getCollection()\n ->addAttributeToSort('created_at', 'desc');\n $collection->getSelect()->limit(1);\n $latestItemId = $collection->getLastItem()->getId();\n if($latestItemId) {\n $nextProid = $latestItemId + 1;\n } else {\n $nextProid = 1;\n }\n $SampleSKU = 'titechPro'.$nextProid;\n\n try {\n $product\n ->setStoreId($storeId) //you can set data in store scope\n ->setWebsiteIds(array($websiteId)) //website ID the product is assigned to, as an array\n ->setAttributeSetId(4) //ID of a attribute set named 'default'\n ->setTypeId('simple') //product type\n ->setCreatedAt(strtotime('now')) //product creation time\n ->setUpdatedAt(strtotime('now')) //product update time\n ->setSku($SampleSKU) //SKU\n ->setName('Titech sample product') //product name\n ->setWeight(4.0000)\n ->setStatus(1) //product status (1 - enabled, 2 - disabled)\n ->setTaxClassId(4) //tax class (0 - none, 1 - default, 2 - taxable, 4 - shipping)\n ->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH) //catalog and search visibility\n //->setManufacturer(28) //manufacturer id\n //->setColor(24)\n //->setNewsFromDate('06/26/2014') //product set as new from\n //->setNewsToDate('06/30/2014') //product set as new to\n ->setCountryOfManufacture('IN') //country of manufacture (2-letter country code)\n ->setPrice(11.22) //price in form 11.22\n ->setCost(22.33) //price in form 11.22\n //->setSpecialPrice(00.44) //special price in form 11.22\n //->setSpecialFromDate('06/1/2014') //special price from (MM-DD-YYYY)\n //->setSpecialToDate('06/30/2014') //special price to (MM-DD-YYYY)\n ->setMsrpEnabled(1) //enable MAP\n ->setMsrpDisplayActualPriceType(1) //display actual price (1 - on gesture, 2 - in cart, 3 - before order confirmation, 4 - use config)\n ->setMsrp(99.99) //Manufacturer's Suggested Retail Price\n ->setMetaTitle('Sample meta title 2')\n ->setMetaKeyword('Sample meta keyword 2')\n ->setMetaDescription('Sample meta description 2')\n ->setDescription('This is a long description for sample product')\n ->setShortDescription('This is a short description for sample product')\n ->setMediaGallery (array('images'=>array (), 'values'=>array ())) //media gallery initialization\n ->addImageToMediaGallery('media/catalog/product/ti/ti_logo.png', array('image','thumbnail','small_image'), false, false) //assigning image, thumb and small image to media gallery\n ->setStockData(array(\n 'use_config_manage_stock' => 0, //'Use config settings' checkbox\n 'manage_stock'=>1, //manage stock\n 'min_sale_qty'=>1, //Minimum Qty Allowed in Shopping Cart\n 'max_sale_qty'=>2, //Maximum Qty Allowed in Shopping Cart\n 'is_in_stock' => 1, //Stock Availability\n 'qty' => 999 //qty\n )\n )\n ->setCategoryIds(array(2)); //assign product to categories - Set to Default\n\n $product->save();\n return $product->getIdBySku($SampleSKU);\n } catch(Exception $e) {\n Mage::log($e->getMessage());\n }\n }", "public function onProductAdd( $param )\n {\n try\n {\n TTransaction::open('futapp');\n $data = $this->form->getData();\n \n if( (! $data->nome_atleta) || (! $data->cpf))\n throw new Exception('O nome e o CPF são obrigatorios');\n \n \n \n $sale_items = TSession::getValue('sale_items');\n \n if ($data->id_atleta) \n {\n $key = $data->id_atleta;\n }\n else\n {\n $key = uniqid();\n }\n\n $sale_items[ $key ] = ['id_atleta' => $key,\n 'nome_atleta' => $data->nome_atleta,\n 'cpf' => $data->cpf,\n 'ja_jogou' => $data->ja_jogou];\n \n TSession::setValue('sale_items', $sale_items);\n \n // clear product form fields after add\n $data->id_atleta = '';\n $data->nome_atleta = '';\n $data->cpf = '';\n $data->ja_jogou = '';\n TTransaction::close();\n $this->form->setData($data);\n\n TTransaction::open('futapp');\n $objCategoria = new CategoriaCampeonato($data->ref_categoria);\n\n $obj = new stdClass;\n\n $obj->ref_campeonato = $objCategoria->ref_campeonato;\n $obj->ref_categoria = $objCategoria->id;\n $this->fireEvents( $obj );\n TTransaction::close();\n \n $this->onReload( $param ); // reload the sale items\n }\n catch (Exception $e)\n {\n $data = $this->form->getData();\n\n $this->form->setData( $data);\n TTransaction::open('futapp');\n $objCategoria = new CategoriaCampeonato($data->ref_categoria);\n\n $obj = new stdClass;\n\n $obj->ref_campeonato = $objCategoria->ref_campeonato;\n $obj->ref_categoria = $objCategoria->id;\n $this->fireEvents( $obj );\n TTransaction::close();\n new TMessage('error', $e->getMessage());\n }\n }", "public function addAction()\n {\n\n $this->view->headTitle()->prepend('Add Product');\n\n $this->_helper->viewRenderer->setRender('form');\n\n $request = $this->getRequest();\n\n $form = new Application_Form_Product();\n \n if ($request->isPost()) {\n if ($form->isValid($request->getPost())) {\n\n $this->loadModel('product');\n $this->modelProduct->insert($form->getValues());\n\n $this->view->success = true;\n $this->view->productName = $form->getValues()['name'];\n $this->view->actionPerformed = 'added';\n $form->reset();\n }\n }\n \n $this->view->form = $form;\n }", "public function addProduct()\n {\n $this->isAdmin();\n\n if ($_POST) {\n\n if ($_POST['title'] && $_POST['vendor'] && $_POST['type'] && $_POST['price'] && $_POST['description']) {\n\n $productModel = new ProductModel();\n\n $validateResult = $productModel->validate($_POST);\n\n if ($validateResult === true) {\n\n $id = $productModel->addProduct($_POST);\n\n if ($id) {\n\n FileCache::deleteCache(CACHE_DIRECTORY);\n\n if ($this->uploadImage($_FILES['image'], $id)) {\n\n Session::set('admin-success', 'Товар добавлен c изображением');\n\n } else {\n\n Session::set('admin-success', 'Товар добавлен без изображения');\n }\n\n header(\"Location: /adminProduct\");\n die();\n\n } else {\n\n Session::set('admin-warning', 'Произошла ошибка');\n\n header(\"Location: /adminProduct\");\n die();\n }\n\n } else {\n\n $this->data['warning'] = $validateResult;\n }\n\n } else {\n\n $this->data['warning'] = 'Все поля со * должны быть заполнены';\n }\n }\n\n $this->adminRender('add');\n }", "public function add()\n\t{\n\t\t$product = ORM::factory('product', $this->input->post('product_id'));\n\t\t$quantity = $this->input->post('quantity', 1);\n\t\t$variant = ORM::factory('variant', $this->input->post('variant_id'));\n\t\t\n\t\t$this->cart->add_product($product, $variant, $quantity);\n\t\t\n\t\turl::redirect('cart');\n\t}", "function shophead_add()\n {\n $this->layout = 'admin_layout';\n if ($this->request->is('post')) {\n $this->ProductCategory->set($this->request->data);\n\t\t\t $this->request->data = Sanitize::clean($this->request->data, array('encode' => false));\n if ($this->ProductCategory->validates()) {\n if ($this->ProductCategory->save($this->request->data)) {\n $this->Session->write('flash', array(ADD_RECORD, 'success'));\n\n } else {\n $this->Session->write('flash', array(ERROR_MSG, 'failure'));\n }\n $this->redirect(array('controller' => 'ProductCategories', 'action' => 'index'));\n }\n }\n }", "public function add_product(){\n return view('product.add_product');\n }", "public function add_stock_fields(){\n global $post;\n $this->refresh_database($post->ID);\n $this->render_warehouse_stock_fields_product($post->ID);\n }", "public function create()\n\t{\n\t \n\t\t$entry = ProductService::getEntriesProducts(null, null);\n\t\t//goDie($entry);\n\t\t$entries = ProductService::getEntriesProducts (null, null);\n\n\t\t\n\t\t$attributelist = array();\n\n\t \t$attributes = Attribute::getList(null, null);\n\n\t \tif ($attributes['status'] == 0)\n\t\t{\n\t\t\treturn Redirect::route('getlanding')->with('error_message', Lang::get('core.msg_error_getting_entries'));\n\t\t}\n\n\t\tforeach ($attributes['entries'] as $attributes)\n\t\t{\n\t\t\t$attributelist[$attributes->id] = $attributes->title;\n\t\t}\n\n\t\t$categorylist = array();\n\n\t \t$categories = Category::getList(null, null);\n\n\t \tif ($categories['status'] == 0)\n\t\t{\n\t\t\treturn Redirect::route('getlanding')->with('error_message', Lang::get('core.msg_error_getting_entries'));\n\t\t}\n\n\t\tforeach ($categories['entries'] as $categories)\n\t\t{\n\t\t\t$categorylist[$categories->id] = $categories->title;\n\t\t}\n\n\n\t\t$taglist = array();\n\n\t \t$tags = Tag::getList(null, null);\n\n\t \tif ($tags['status'] == 0)\n\t\t{\n\t\t\treturn Redirect::route('getlanding')->with('error_message', Lang::get('core.msg_error_getting_entries'));\n\t\t}\n\n\t\tforeach ($tags['entries'] as $tags)\n\t\t{\n\t\t\t$taglist[$tags->id] = $tags->title;\n\t\t}\n\n\n\n\t\t$this->layout->title = 'Unos novog proizvoda | BillingCRM';\n\n\t\t$this->layout->css_files = array(\n\t\t\t'css/backend/trumbowyg.min.css',\n\t\t\t'css/backend/trumbowyg.colors.min.css',\n\n\t\t\t'css/backend/select2.css'\t\n\t\t\t);\n\n\t\t$this->layout->js_footer_files = array(\n\t\t\t'js/backend/bootstrap-filestyle.min.js',\n\t\t\t'js/backend/trumbowyg.js',\n \n\t\t\t'js/backend/trumbowyg.base64.min.js',\n\t\t\t'js/backend/trumbowyg.colors.min.js',\n\t\t\t'js/backend/trumbowyg.noembed.min.js',\n\t\t\t'js/backend/trumbowyg.pasteimage.min.js',\n\t\t\t'js/backend/trumbowyg.preformatted.min.js',\n\t\t\t'js/backend/trumbowyg.upload.js',\n\n\t\t\t'js/backend/jquery.stringtoslug.min.js',\n\t\t\t'js/backend/speakingurl.min.js',\n\t\t\t'js/backend/select2.full.js',\n\t\t\t'js/backend/datatables.js'\n\t\t);\n\n\t\t$this->layout->content = View::make('backend.product.create', array('postRoute' => 'ProductStore', 'entries' => $entries, 'entry' => $entry, 'attributelist' => $attributelist, 'categorylist' => $categorylist, 'taglist' => $taglist));\n\t}", "function add_store()\n {\n\tglobal $template;\n\tglobal $connect;\n\n\t$sys_connect = sys_db_connect();\n\t$product_id = $_REQUEST[product_id];\n\t$product_name = addslashes($_REQUEST[product_name]);\n\t$shop_price = $_REQUEST[shop_price];\n\t$options = $_REQUEST[options];\n\t$memo = addslashes($_REQUEST[memo]);\n\n\n\t$sql = \"select product_id from ez_store \n\t\t where domain = '\"._DOMAIN_.\"' \n\t\t and product_id = '$product_id'\";\n\t$list0 = mysql_fetch_array(mysql_query($sql, $sys_connect));\n\n\n\t$sql = \"select * from products where product_id = '$product_id'\";\n\t$list = mysql_fetch_array(mysql_query($sql, $connect));\n\t\n\t////////////////////////////////////////\n\t// make thumb image\n\tif ($list[img_500] && file_exists(_save_dir.$list[img_500]))\n\t{\n\t $img_150 = _save_dir . str_replace(\"_500\", \"_150\", $list[img_500]);\n\t if (!file_exists($img_150))\n\t {\n\t\t$cmd = \"/usr/local/bin/convert -resize 150x150 \"._save_dir.$list[img_500].\" \".$img_150;\n\t\texec($cmd);\n\t }\n\t $img_250 = _save_dir . str_replace(\"_500\", \"_250\", $list[img_500]);\n\t if (!file_exists($img_250))\n\t {\n\t\t$cmd = \"/usr/local/bin/convert -resize 250x250 \"._save_dir.$list[img_500].\" \".$img_250;\n\t\texec($cmd);\n\t }\n\t}\n\n\tif ($list0[product_id])\t\t// update\n\t{\n\t $upd_sql = \"update ez_store set\n\t\t\t\tname = '$product_name',\n\t\t\t\tshop_price = '$shop_price',\n\t\t\t\toptions = '$options',\n\t\t\t\tmemo = '$memo',\n\t\t\t\tis_sale = 1\n\t\t\t where domain = '\"._DOMAIN_.\"'\n\t\t\t and product_id = '$product_id'\";\n\t mysql_query($upd_sql, $sys_connect) or die(mysql_error());\n\t}\n\telse\t\t\t\t// insert\n\t{\n\t ////////////////////////////////////////\n\t $ins_sql = \"insert into ez_store set\n\t\t\tdomain \t\t= '\" . _DOMAIN_ . \"',\n\t\t\tproduct_id \t= '$list[product_id]',\n\t\t\tname\t\t= '$list[name]',\n\t\t\torigin\t\t= '$list[origin]',\n\t\t\tbrand\t\t= '$list[brand]',\n\t\t\toptions\t\t= '$list[options]',\n\t\t\tshop_price\t= '$list[shop_price]',\n\t\t\ttrans_fee\t= '$list[trans_fee]',\n\t\t\tproduct_desc\t= '$list[product_desc]',\n\t\t\timg_500\t\t= '$list[img_500]',\n\t\t\timg_desc1\t= '$list[img_desc1]',\n\t\t\timg_desc2\t= '$list[img_desc2]',\n\t\t\timg_desc3\t= '$list[img_desc3]',\n\t\t\timg_desc4\t= '$list[img_desc4]',\n\t\t\timg_desc5\t= '$list[img_desc5]',\n\t\t\timg_desc6\t= '$list[img_desc6]',\n\t\t\treg_date \t= now(),\n\t\t\treg_time \t= now(),\n\t\t\tis_sale \t= 1\n\t \";\n\t mysql_query($ins_sql, $sys_connect) or die(mysql_error());\n\t}\n\n\t// add by sy.hwang 2007.5.4\n\t$sql = \"select seq from ez_store \n\t\t where domain = '\"._DOMAIN_.\"'\n\t\t and product_id = '$product_id'\";\n\t$list = mysql_fetch_array(mysql_query($sql, $sys_connect));\n\n\t$store_id = sprintf(\"A%05d\", $list[seq]);\n\t$upd_sql = \"update ez_store set store_id = '$store_id' \n\t\t where domain = '\"._DOMAIN_.\"'\n\t\t and product_id = '$product_id'\";\n\tmysql_query($upd_sql, $sys_connect) or die(mysql_error());\n\n\t$upd_sql = \"update products set is_store = 1 where product_id = '$product_id'\";\n\tmysql_query($upd_sql, $connect) or die(mysql_error());\n\t\n $this->redirect(\"popup.htm?template=CK18&product_id=$product_id\");\n exit;\n }", "public function actionProductCreate()\n\t{\n\n\t\t$data = $_POST;\n\t\t$merchantId=$data['merchant_id'];\n\t\t$logFIle = 'product/create/'.$data['merchant_id'];\n\t\tData::createLog('Data : '.json_encode($data),$logFIle,'a');\n\t\n\t\t$connection = Yii::$app->getDb();\n\t\t$result = Jetproductinfo::saveNewRecords($data['data'],$data['merchant_id'],$connection);\n\t}", "private function addProduct($form)\n {\n // You can also use same view page for create and update\n $this->render('create')->with(array(\n 'registration' => $form->getForm(),\n 'validation_errors' => $form->errors,\n 'baseUrl' => Url::getBase(),\n 'buttonAttributes' => array(\n 'primary' => array('class' => 'btn primary', 'style' => 'border:1px solid #888;'),\n 'delete' => array('class' => 'btn danger'),\n ),\n )\n );\n\n }", "private function addProduct($product) \r\n\t{\r\n\t\t$this->newProducts[] = $product;\r\n\t}", "public function create()\n {\n $htmlOption = $this->productTypeRecusive->ProductTypeRecusiveAdd();\n return view('back_end.admin.product.add', ['htmlOption' => $htmlOption]);\n }", "public function add()\n {\n // récupérer les catégories pour l'affichage du <select>\n $categoryList = Category::findAll();\n // récupérer les types de produits pour l'affichage du <select>\n $typeList = Type::findAll();\n // récupérer les marques pour l'affichage du <select>\n $brandList = Brand::findAll();\n\n // compact est l'inverse d'extract, on s'en sert pour générer un array à partir de variables :\n // on fournit les noms (attention, sous forme de string) des variables à ajouter à l'array \n // les clés de ces valeurs seront les noms des variables\n $viewVars = compact('categoryList', 'typeList', 'brandList');\n $this->show('product/add', $viewVars);\n // équivaut à :\n // $this->show('product/add', [\n // 'categoryList' => $categoryList,\n // 'typeList' => $typeList,\n // 'brandList' => $brandList\n // ]);\n }", "public function create()\n {\n // if it's a GET request display a blank form for creating a new product\n // else it's a POST so add to the database and redirect to readAll action\n if ($_SERVER['REQUEST_METHOD'] == 'GET') {\n show_view('views/admin/bodyparts/create.php');\n } else {\n $part = filter_input(INPUT_POST, 'part', FILTER_SANITIZE_SPECIAL_CHARS);\n BodyPart::create($part);\n redirect('body_parts', 'readAll');\n }\n }", "function uc_order_edit_products_add_blank($form, &$form_state) {\n $form_state['refresh_products'] = TRUE;\n $form_state['rebuild'] = TRUE;\n\n $order = $form_state['build_info']['args'][0];\n\n $product = new stdClass();\n $product->qty = 1;\n $product->order_id = $order->order_id;\n uc_order_product_save($order->order_id, $product);\n\n $order->products[] = $product;\n\n uc_order_log_changes($order->order_id, array('add' => t('Added new product line to order.')));\n}", "public function execute()\n {\n \n $session = $this->_objectManager->get('Magento\\Customer\\Model\\Session');\n $storeId=$session->getTestKey();\n $jsHelper = $this->_objectManager->get('Magento\\Backend\\Helper\\Js');\n $data=$this->getRequest()->getPost()->toarray();\n $entityIds=$jsHelper->decodeGridSerializedInput($data['links']['newproduct']);\n if (!is_array($entityIds) || empty($entityIds)) {\n $this->messageManager->addError(__('Please select product(s).'));\n $this->_redirect('*/*/new');\n } else {\n /**display the selected product and save it in database in custom_product_collection table **/\n $records=$this->_collection->getData();\n $entityId_str= implode(\",\", $entityIds);\n $all_store=$this->_objectManager->create('\\Magento\\Store\\Api\\StoreRepositoryInterface')->getList();\n \n $customcollection= $this->_objectManager->get('Magebees\\Newproduct\\Model\\Customcollection')->getCollection()->getData();\n foreach ($all_store as $store) {\n $store_id=$store->getId();\n $store_ids[]=$store_id;\n }\n \n if ($customcollection) {\n foreach ($customcollection as $custom) {\n $custom_storeids[]=$custom['store_id'];\n }\n if (in_array($storeId, $custom_storeids)) {\n if ($storeId==0) {\n foreach ($all_store as $store) {\n $store_id=$store->getId();\n foreach ($customcollection as $custom) {\n if ($custom['store_id']==$store_id) {\n $id=$custom['id'];\n $entity= explode(\",\", $entityId_str);\n $custom_entity= explode(\",\", $custom['entity_id']);\n $result = array_unique(array_merge($entity, $custom_entity));\n $new_entityId= implode(\",\", $result);\n $data=$this->_objectManager->create('Magebees\\Newproduct\\Model\\Customcollection');\n $data->setData('entity_id', $new_entityId);\n $data->setData('store_id', $store_id);\n $data->setData('id', $id);\n $data->save();\n }\n }\n if (!in_array($store_id, $custom_storeids)) {\n $data=$this->_objectManager->create('Magebees\\Newproduct\\Model\\Customcollection');\n $data->setData('entity_id', $entityId_str);\n $data->setData('store_id', $store_id);\n $data->save();\n }\n }\n } else {\n $store_arr=[0,$storeId];\n foreach ($store_arr as $store) {\n foreach ($customcollection as $custom) {\n if ($custom['store_id']==$store) {\n $id=$custom['id'];\n if ($store==0) {\n $entity= explode(\",\", $entityId_str);\n $custom_entity= explode(\",\", $custom['entity_id']);\n $result = array_unique(array_merge($entity, $custom_entity));\n $new_entityId= implode(\",\", $result);\n $data=$this->_objectManager->create('Magebees\\Newproduct\\Model\\Customcollection');\n $data->setData('entity_id', $new_entityId);\n $data->setData('store_id', $store);\n $data->setData('id', $id);\n $data->save();\n } else {\n $new_entityId=$entityId_str.\",\".$custom['entity_id'];\n $data=$this->_objectManager->create('Magebees\\Newproduct\\Model\\Customcollection');\n $data->setData('entity_id', $new_entityId);\n $data->setData('store_id', $store);\n $data->setData('id', $id);\n $data->save();\n }\n }\n }\n }\n }\n } else {\n if ($storeId==0) {\n foreach ($all_store as $store) {\n $store_id=$store->getId();\n $data=$this->_objectManager->create('Magebees\\Newproduct\\Model\\Customcollection');\n $data->setData('entity_id', $entityId_str);\n $data->setData('store_id', $store_id);\n $data->save();\n }\n } else {\n $store_arr=[0,$storeId];\n foreach ($store_arr as $store) {\n foreach ($customcollection as $custom) {\n if ($custom['store_id']==$store) {\n $id=$custom['id'];\n if ($store==0) {\n $entity= explode(\",\", $entityId_str);\n $custom_entity= explode(\",\", $custom['entity_id']);\n $result = array_unique(array_merge($entity, $custom_entity));\n $new_entityId= implode(\",\", $result);\n $data=$this->_objectManager->create('Magebees\\Newproduct\\Model\\Customcollection');\n $data->setData('entity_id', $new_entityId);\n $data->setData('store_id', $store);\n $data->setData('id', $id);\n $data->save();\n }\n }\n }\n if (!in_array($store, $custom_storeids)) {\n $data=$this->_objectManager->create('Magebees\\Newproduct\\Model\\Customcollection');\n $data->setData('entity_id', $entityId_str);\n $data->setData('store_id', $store);\n $data->save();\n }\n }\n }\n }\n } else {\n if ($storeId==0) {\n foreach ($all_store as $store) {\n $store_id=$store->getId();\n $data=$this->_objectManager->create('Magebees\\Newproduct\\Model\\Customcollection');\n $data->setData('entity_id', $entityId_str);\n $data->setData('store_id', $store_id);\n $data->save();\n }\n } else {\n $store_arr=[0,$storeId];\n foreach ($store_arr as $store) {\n $data=$this->_objectManager->create('Magebees\\Newproduct\\Model\\Customcollection');\n $data->setData('entity_id', $entityId_str);\n $data->setData('store_id', $store);\n $data->save();\n }\n }\n }\n \n $this->_redirect('*/*/');\n }\n }", "public function actionAddProduct()\n\t{\n\t\tif(Yii::app()->request->isPostRequest)\n\t\t{\n\t\t\t$order = $this->_loadModel($_POST['order_id']);\n\t\t\t$product = StoreProduct::model()->findByPk($_POST['product_id']);\n\n\t\t\tif(!$product)\n\t\t\t\tthrow new CHttpException(404, Yii::t('OrdersModule.admin', 'Ошибка. Продукт не найден.'));\n\n\t\t\t$ordered_product = new OrderProduct;\n\t\t\t$ordered_product->order_id = $order->id;\n\t\t\t$ordered_product->product_id = $product->id;\n\t\t\t$ordered_product->name = $product->name;\n\t\t\t$ordered_product->quantity = $_POST['quantity'];\n\t\t\t$ordered_product->sku = $product->sku;\n\t\t\t$ordered_product->price = $_POST['price'];\n\t\t\t//$ordered_product->price = StoreProduct::calculatePrices($product, array(), 0);\n\t\t\t$ordered_product->save();\n\t\t}\n\t}", "public function create()\n {\n $data['rightButton']['iconClass'] = 'fa fa-list';\n $data['rightButton']['text'] = 'Product List';\n $data['rightButton']['link'] = 'products';\n $data[\"all_categories\"] = Category::where(\"parent_id\", 0)->get();\n $data[\"size_lists\"] = Attribute::Size()->orderBy('title')->pluck('title', 'id');\n $data[\"color_lists\"] = Attribute::Color()->orderBy('title')->pluck('title', 'id');\n $data[\"all_brands\"] = Brand::orderBy('title')->pluck('title', 'id');\n $data[\"all_units\"] = Unit::orderBy('title')->pluck('title', 'id');\n $data[\"author_lists\"] = Author::orderBy('title')->pluck('title', 'id');\n $data[\"publisher_lists\"] = Publisher::orderBy('title')->pluck('title', 'id');\n $data[\"country_lists\"] = Country::orderBy('name')->pluck('name', 'id');\n\n return view(\"nptl-admin/common/product/add_product\", $data);\n }", "public function admin_add() \r\n {\r\n\r\n \t// setting the layout for admin\r\n \t$this->layout = 'admin';\r\n \t\r\n \tif (!empty($this->data)) \r\n \t{\r\n \t\t$this->Product->create();\r\n \t\t\r\n \t\tif ($this->Product->save($this->data)) \r\n \t\t{\r\n \t\t\t$this->Session->setFlash(__('The product has been saved', true));\r\n \t\t\t$this->redirect(array('action' => 'index'));\r\n \t\t} \r\n \t\telse \r\n \t\t{\r\n \t\t\t$this->Session->setFlash(__('The product could not be saved. Please, try again.', true));\r\n \t\t}\r\n \t}\r\n \t\r\n\t\t$categories = $this->Product->Category->find('list');\r\n\t\r\n\t\t$firstCategories = $this->Product->Category->find('first');\r\n\t\r\n\t\t// getting the subcategories for first category which is displaying by default\r\n\t\t$subCategoriesArray = $this->Product->SubCategory->find('list',array('conditions'=>array('SubCategory.category_id'=>$firstCategories['Category']['id'])));\r\n\t\r\n\t\t$subCategories[] = 'Please select';\r\n\t\tforeach ($subCategoriesArray as $key => $subCat) \r\n\t\t{\r\n\t\t\t$subCategories[$key] = $subCat;\r\n\t\t}\r\n\r\n\t\t$this->set(compact('categories', 'subCategories'));\r\n\r\n }", "public function add()\n {\n require_code('form_templates');\n\n $to = get_param_string('to', '');\n\n $products = find_all_products();\n $list = new Tempcode();\n foreach ($products as $type_code => $details) {\n if ($details[0] == PRODUCT_INVOICE) {\n $text = do_lang_tempcode('CUSTOM_PRODUCT_' . $type_code);\n if ($details[1] != '?') {\n $text->attach(escape_html(' (' . $details[1] . ' ' . get_option('currency') . ')'));\n }\n $list->attach(form_input_list_entry($type_code, false, $text));\n }\n }\n if ($list->is_empty()) {\n inform_exit(do_lang_tempcode('NOTHING_TO_INVOICE_FOR'));\n }\n $fields = new Tempcode();\n $fields->attach(form_input_list(do_lang_tempcode('PRODUCT'), '', 'type_code', $list));\n $fields->attach(form_input_username(do_lang_tempcode('USERNAME'), do_lang_tempcode('DESCRIPTION_INVOICE_FOR'), 'to', $to, true));\n $fields->attach(form_input_float(do_lang_tempcode('AMOUNT'), do_lang_tempcode('INVOICE_AMOUNT_TEXT', escape_html(get_option('currency'))), 'amount', null, false));\n $fields->attach(form_input_line(do_lang_tempcode('INVOICE_SPECIAL'), do_lang_tempcode('DESCRIPTION_INVOICE_SPECIAL'), 'special', '', false));\n $fields->attach(form_input_text(do_lang_tempcode('NOTE'), do_lang_tempcode('DESCRIPTION_INVOICE_NOTE'), 'note', '', false));\n\n $post_url = build_url(array('page' => '_SELF', 'type' => '_add'), '_SELF');\n $submit_name = do_lang_tempcode('CREATE_INVOICE');\n\n return do_template('FORM_SCREEN', array('_GUID' => 'b8a08145bd1262c277e00a1151d6383e', 'HIDDEN' => '', 'TITLE' => $this->title, 'URL' => $post_url, 'FIELDS' => $fields, 'SUBMIT_ICON' => 'buttons__proceed', 'SUBMIT_NAME' => $submit_name, 'TEXT' => do_lang_tempcode('DESCRIPTION_INVOICE_PAGE'), 'SUPPORT_AUTOSAVE' => true));\n }", "public function index(){\n\n\t\t$data['category'] = $this->get_category();\n\t\tview_loader($data,'seller/add_product');\n\t}", "public function create()\n {\n $categories=$this->model->getCategories();\n \n $colors=$this->model->getColours();\n return view(\"admin.pages.insertProduct\",['categories'=>$categories,'colors'=>$colors]);\n \n }", "public function add()\n {\n $products = Product::all();\n return view('admin.processing.create', compact('products'));\n }", "public function productsAction()\n {\n $this->_initCoursedoc();\n $this->loadLayout();\n $this->getLayout()->getBlock('coursedoc.edit.tab.product')\n ->setCoursedocProducts($this->getRequest()->getPost('coursedoc_products', null));\n $this->renderLayout();\n }", "public function addProduct(){\n\t\t// prepares the request\n\t\t$ch = curl_init();\n\t\tcurl_setopt($ch, CURLOPT_URL, \"http://\" . IP . \"/bde_site/api/product/\");\n\t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n\t\tcurl_setopt($ch, CURLOPT_POST, true);\n\t\tcurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Authorization: ' . TOKEN));\n\n\t\t// unset unused attributes from the variable\n\t\tunset($_POST['_token']);\n\t\t\n\t\tcurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($_POST));\n\n\t\t// send the request\n\t\t$output = curl_exec($ch);\n\t\t$info = curl_getinfo($ch);\n\t\tcurl_close($ch);\n\n\t\treturn redirect('/');\n\t}", "public function create()\n {\n $categories = DB::table('categories')->where('publication_status',1)->get();\n $brands = DB::table('brands')->get();\n return view('admin.add_product')\n ->with('categories',$categories)\n ->with('brands',$brands);\n }", "public function actionCreate()\n {\n $model = new PricefallsProducts();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function add()\r\n {\r\n $data = array('view' => 'mProductAdd');\r\n if ($this->input->server('REQUEST_METHOD') === 'POST')\r\n {\r\n $post_data = $this->input->post();\r\n if($this->mproduct->addProduct($post_data))\r\n {\r\n $this->statman->setSuccessStatus(\"Úspěšně jste přidali nový produkt\");\r\n redirect('/product', 'refresh');\r\n }\r\n else\r\n {\r\n $data['data']['material'] = (object) $post_data;\r\n $data['data']['materials'] = $this->mmaterial->getMaterials();\r\n $this->load->view('_container', $this->statman->setErrorNow($post_data['error'], $data));\r\n }\r\n }\r\n else\r\n {\r\n $data['data']['materials'] = $this->mmaterial->getMaterials();\r\n $this->load->view('_container', $this->statman->setActualStatus($data));\r\n }\r\n }", "public function create()\n {\n return view('Backend.pages.product.createproduct');\n }", "public function add_affl_product_form(){\r\n\t\tif ($this->checkLogin('A') == ''){\r\n\t\t\tredirect('admin');\r\n\t\t}else {\r\n\t\t\t$this->data['heading'] = 'Add New Product';\r\n\t\t\t$this->data['Product_id'] = $this->uri->segment(4,0);\r\n\t\t\t$this->data['categoryView'] = $this->product_model->view_category_details();\r\n\t\t\t$this->data['atrributeValue'] = $this->product_model->view_atrribute_details();\r\n\t\t\t$this->data['PrdattrVal'] = $this->product_model->view_product_atrribute_details();\r\n\t\t\t$this->load->view('admin/product/add_affl_product',$this->data);\r\n\t\t}\r\n\t}", "public function store()\n {\n $this->product->name = $_POST['name'];\n $this->product->price = $_POST['price'];\n $this->product->description = $_POST['description'];\n $this->product->category_id = $_POST['category_id'];\n\n // create the product\n if($this->product->create()){\n echo \"<div class=\\\"alert alert-success alert-dismissable\\\">\";\n echo \"<button type=\\\"button\\\" class=\\\"close\\\" data-dismiss=\\\"alert\\\" aria-hidden=\\\"true\\\">&times;</button>\";\n echo \"Product was created.\";\n echo \"</div>\";\n }\n\n // if unable to create the product, tell the user\n else{\n echo \"<div class=\\\"alert alert-danger alert-dismissable\\\">\";\n echo \"<button type=\\\"button\\\" class=\\\"close\\\" data-dismiss=\\\"alert\\\" aria-hidden=\\\"true\\\">&times;</button>\";\n echo \"Unable to create product.\";\n echo \"</div>\";\n }\n }", "public function newAction(Request $request)\n {\n\n $em = $this->getDoctrine()->getManager();\n\n $product = new Product();\n $form = $this->createForm('LilWorks\\StoreBundle\\Form\\ProductType', $product);\n $form->handleRequest($request);\n\n if ($form->isSubmitted() && $form->isValid()) {\n\n foreach ($product->getPictures() as $pictureFromForm) {\n $pictureFromForm->setProduct($product);\n $em->persist($pictureFromForm);\n }\n\n\n\n if($product->getDocfiles() && count($product->getDocfiles() )>0){\n foreach ($product->getDocfiles() as $docfile) {\n $docfile->addProduct($product);\n $em->persist($docfile);\n }\n }\n\n if($product->getTags() && count($product->getTags() )>0){\n foreach ($product->getTags() as $tag) {\n $tag->addProduct($product);\n $em->persist($tag);\n }\n }\n\n $em->persist($product);\n $em->flush();\n\n return $this->redirectToRoute('product_show', array('product_id' => $product->getId()));\n }\n\n $this->get('store.setSeo')->setTitle('storebundle.title.new',array(),'storebundle.prefix.products');\n\n return $this->render('LilWorksStoreBundle:Product:new.html.twig', array(\n 'product' => $product,\n 'form' => $form->createView(),\n ));\n }", "public function addproduct() {\n\n if (!$this->customer->isLogged()) {\n $this->session->data['redirect'] = $this->url->link('account/account', '', 'SSL');\n echo $this->url->link('account/login', '', 'SSL');\n exit();\n }\n\n\n $description_product = $this->request->post['description_product'];\n $image = $this->request->post['image'];\n $link_product = $this->request->post['link_product'];\n $name_product = $this->request->post['name_product'];\n $price_product = $this->request->post['price_product'];\n\t\t$category_id = $this->request->post['category_id'];\n $option_value = $this->request->post['option'];\n\n\n\t\t$data = array(\n\t\t\t'price'=>$price_product,\n\t\t\t'image'=>$image,\n\t\t\t'viewdemo'=>$link_product,\n\t\t\t'description'=>$description_product,\n\t\t\t'name'=>$name_product,\n\t\t\t'meta_keyword'=>$name_product,\n\t\t\t'meta_description'=>$name_product,\n\t\t\t'category_id'=>$category_id\n\t\t);\n $this->load->model('catalog/product');\n\n\n\n $product_id = $this->model_catalog_product->addProduct($data);\n $options = $this->model_catalog_product->getOptions();\n foreach ($options as $option) {\n if(isset($option_value[$option['option_id']]))\n {\n if(is_numeric($option_value[$option['option_id']]))\n {\n $IsOptions = $this->model_catalog_product->IsOptions($product_id,$option['option_id']);\n\n if(count($IsOptions)==0)\n {\n $product_option_id = $this->model_catalog_product->insertOption($product_id,$option['option_id']);\n $this->model_catalog_product->insertOptionValue($product_option_id,$product_id,$option['option_id'],$option_value[$option['option_id']]);\n }\n }\n else\n {\n $IsOptions = $this->model_catalog_product->IsOptions($product_id,$option['option_id']);\n $product_option_id = 0;\n if(count($IsOptions)==0)\n {\n $product_option_id = $this->model_catalog_product->insertOption($product_id,$option['option_id']);\n }\n $reset = $option_value[$option['option_id']];\n for($i = 0; $i<count($reset); $i++) {\n $this->model_catalog_product->insertOptionValue($product_option_id,$product_id,$option['option_id'],$reset[$i]);\n }\n }\n }\n\n }\n\t\techo $product_id;\n\t\tdie();\n\n }", "function uc_order_edit_products_add($form, &$form_state) {\n $form_state['products_action'] = 'products_select';\n $form_state['refresh_products'] = TRUE;\n $form_state['rebuild'] = TRUE;\n $order = $form_state['build_info']['args'][0];\n\n $data = module_invoke_all('uc_add_to_cart_data', $form_state['values']['product_controls']);\n $product = uc_product_load_variant(intval($form_state['values']['product_controls']['nid']), $data);\n $product->qty = isset($form_state['values']['product_controls']['qty']) ? $form_state['values']['product_controls']['qty'] : $product->default_qty;\n\n drupal_alter('uc_order_product', $product, $order);\n uc_order_product_save($order->order_id, $product);\n $order->products[] = $product;\n\n uc_order_log_changes($order->order_id, array('add' => t('Added (@qty) @title to order.', array('@qty' => $product->qty, '@title' => $product->title))));\n\n // Decrement stock.\n if (module_exists('uc_stock')) {\n uc_stock_adjust_product_stock($product, 0, $order);\n }\n\n // Add this product to the form values for accurate tax calculations.\n $form_state['values']['products'][] = (array) $product;\n}", "public function create()\n {\n return view(\"admin.product.create\");\n }", "public function setProduct()\n {\n // get the existing products array\n $products = $this->getProducts();\n // push the new product to the array\n array_push($products, $this);\n $file = fopen($_SERVER['DOCUMENT_ROOT'] . \"/mpm_challenge/problem4/db/db.json\", \"w+\") or die(\"not opened\");\n fwrite($file, json_encode($products));\n fclose($file);\n }", "public function action_add()\n\t{\n $data = $this->addSelectBoxMongoData();\n\t\tif (count(input::post()) > 0) {\n\t\t\t$params = input::post();\n\t\t\t$data['val'] = $params;\n\t\t\tif (empty($params['c_logo']) === false) {\n\t\t\t\tunlink(IMAGE_TEMP_PATH. $params['c_logo']);\n\t\t\t}\n\t\t}\n\t\t$this->common_view->set('content', View::forge('career/add', $data));\n\t\treturn $this->common_view;\n\t}", "public function createAction()\n {\n\t $form = new Core_Form_Product_Create;\n $action = $this->_helper->url('create', 'product', 'default');\n $form->setAction($action);\n\n if ($this->_request->isPost()) {\n if ($form->isValid($_POST)) {\n $this->_model->create($form->getValues());\n\t \t $this->_helper->FlashMessenger('Product added successfully');\n $this->_helper->Redirector('index','product','default');\n } else {\n $form->populate($_POST);\n }\n } \n $this->view->form = $form;\n }", "public function view_create_prod()\n\t{\n\t\t$page['title'] = \"Create Product\"; \n\t\t$page['description'] = \"You can create new product here.\"; \n\n\t\t$this->load->view('items/product_create_view', $page); \n\t}", "public function create()\n {\n $data['products'] = Product::all();\n $data['categories'] = Category::where('pc_status', false)->get();\n $data['measurements'] = Measurement::where('pm_delete_at', NULL)->get();\n $data['title_page'] = 'Tambah Produk';\n $data['code_page'] = 'addproduct';\n return view('backup-dashboard.form-product')->with($data);\n }", "public function create()\n {\n return view('admin.product.add-product');\n }", "public function createNewproduct(Request $request){\n $product = new product();\n $attributes['naam'] = $request['naam'];\n $attributes['omschrijving'] = $request['omschrijving'];\n $attributes['prijs'] = $request['prijs'];\n $validator = Validator::make($attributes, $product->rules());\n\n if ($validator->fails()) {\n return redirect()->back()\n ->withErrors($validator)\n ->withInput();\n }\n $product = Product::create($attributes);\n if($request->allergieën){\n foreach($request->allergieën as $allergie){\n $product->allergieëns()->attach($allergie);\n }\n }\n return redirect()->route('products');\n }", "public function add()\n {\n $data = [\n 'property' => [\n 'template' => 'extracurricular_add',\n 'title' => 'Tambah Ekstrakurikuler',\n 'menu' => $this->menu->read(),\n ],\n 'data' => [],\n ];\n\n $this->load->view('template', $data);\n }", "public function create()\n\t{\n\t\t$shops = DB::table('shops')->orderBy('shop_id', 'desc')->get();\n\t\treturn View('admin.products.add', compact('shops'));\n\t}", "public function create()\n {\n $shop = DB::table('categories')->select(\n 'categories.*'\n )\n ->where('user_id', Auth::user()->id)\n ->orderBy('id', 'asc')\n ->get();\n\n $data['objs'] = $shop;\n\n $brander = DB::table('branders')->select(\n 'branders.*'\n )\n ->where('user_id', Auth::user()->id)\n ->orderBy('id', 'desc')\n ->get();\n\n $data['brander'] = $brander;\n\n $shop_id = DB::table('shops')->select(\n 'shops.*'\n )\n ->where('user_id', Auth::user()->id)\n ->orderBy('id', 'desc')\n ->get();\n\n $data['shop_id'] = $shop_id;\n\n\n $data['method'] = \"post\";\n $data['url'] = url('admin/product');\n $data['header'] = \"สร้างสินค้า ของคุณใหม่\";\n return view('admin.product.create', $data);\n }", "public function showCreateNewProduct(){\n $allergieën = Allergieën::all();\n return view('product/newproduct',compact(['allergieën']));\n }", "public function addAction()\n {\n $cart = $this->_getCart();\n $params = $this->getRequest()->getParams();\n// qq($params);\n try {\n if (isset($params['qty'])) {\n $filter = new Zend_Filter_LocalizedToNormalized(\n array('locale' => Mage::app()->getLocale()->getLocaleCode())\n );\n $params['qty'] = $filter->filter($params['qty']);\n }\n\n $product = $this->_initProduct();\n $related = $this->getRequest()->getParam('related_product');\n $related_products = $this->getRequest()->getParam('related_products');\n $related_qty = $this->getRequest()->getParam('related_qty');\n /**\n * Check product availability\n */\n if (!$product) {\n $this->_goBack();\n return;\n }\n \n $in_cart = $cart->getQuoteProductIds();\n if($product->getTypeId() == 'cartproduct') {\n $cart_product_id = $product->getId();\n if(in_array($cart_product_id, $in_cart)) {\n $this->_goBack();\n return;\n }\n }\n\n if($params['qty']) $cart->addProduct($product, $params);\n \n if (!empty($related_qty)) {\n foreach($related_qty as $pid=>$qty){\n if(intval($qty)>0){\n $product = $this->_initProduct(intval($pid));\n $related_params['qty'] = $filter->filter($qty);\n if(isset($related_products[$pid])){\n if($product->getTypeId() == 'bundle') {\n $related_params['bundle_option'] = $related_products[$pid]['bundle_option'];\n// qq($related_params);\n// die('test');\n } else {\n $related_params['super_attribute'] = $related_products[$pid]['super_attribute'];\n }\n }\n $cart->addProduct($product, $related_params);\n }\n }\n }\n \n $collection = Mage::getModel('cartproducts/products')->getCollection()\n ->addAttributeToFilter('type_id', 'cartproduct')\n ->addAttributeToFilter('cartproducts_selected', 1)\n ;\n \n foreach($collection as $p)\n {\n $id = $p->getId();\n if(isset($in_cart[$id])) continue;\n \n $cart = Mage::getSingleton('checkout/cart');\n $quote_id = $cart->getQuote()->getId();\n \n if(Mage::getSingleton('core/session')->getData(\"cartproducts-$quote_id-$id\")) continue;\n \n $p->load($id);\n $cart->getQuote()->addProduct($p, 1);\n }\n \n if($cart->getQuote()->getShippingAddress()->getCountryId() == '') $cart->getQuote()->getShippingAddress()->setCountryId('US');\n $cart->getQuote()->setCollectShippingRates(true);\n $cart->getQuote()->getShippingAddress()->setShippingMethod('maxshipping_standard')->collectTotals()->save();\n \n $cart->save();\n \n Mage::getSingleton('checkout/session')->resetCheckout();\n\n\n $this->_getSession()->setCartWasUpdated(true);\n\n /**\n * @todo remove wishlist observer processAddToCart\n */\n Mage::dispatchEvent('checkout_cart_add_product_complete',\n array('product' => $product, 'request' => $this->getRequest(), 'response' => $this->getResponse())\n );\n\n if (!$this->_getSession()->getNoCartRedirect(true)) {\n if (!$cart->getQuote()->getHasError() && $params['qty'] ){\n $message = $this->__('%s was added to your shopping cart.', Mage::helper('core')->htmlEscape($product->getName()));\n $this->_getSession()->addSuccess($message);\n }\n $this->_goBack();\n }\n } catch (Mage_Core_Exception $e) {\n if ($this->_getSession()->getUseNotice(true)) {\n $this->_getSession()->addNotice($e->getMessage());\n } else {\n $messages = array_unique(explode(\"\\n\", $e->getMessage()));\n foreach ($messages as $message) {\n $this->_getSession()->addError($message);\n }\n }\n\n $url = $this->_getSession()->getRedirectUrl(true);\n if ($url) {\n $this->getResponse()->setRedirect($url);\n } else {\n $this->_redirectReferer(Mage::helper('checkout/cart')->getCartUrl());\n }\n } catch (Exception $e) {\n $this->_getSession()->addException($e, $this->__('Cannot add the item to shopping cart.'));\n Mage::logException($e);\n $this->_goBack();\n }\n }", "private function createViewProducto()\n {\n $this->addView('ListProductoSample', 'ProductoSample', 'products', 'fas fa-cubes');\n $this->addSearchFields('ListProductoSample', ['referencia', 'descripcion', 'observaciones']);\n $this->addOrderBy('ListProductoSample', ['referencia'], 'reference');\n $this->addOrderBy('ListProductoSample', ['descripcion'], 'description');\n $this->addOrderBy('ListProductoSample', ['precio'], 'price');\n $this->addOrderBy('ListProductoSample', ['stockfis'], 'stock');\n $this->addOrderBy('ListProductoSample', ['actualizado'], 'update-time');\n\n $manufacturers = $this->codeModel::all('fabricantes', 'codfabricante', 'nombre');\n $this->addFilterSelect('ListProductoSample', 'codfabricante', 'manufacturer', 'codfabricante', $manufacturers);\n\n $families = $this->codeModel::all('familias', 'codfamilia', 'descripcion');\n $this->addFilterSelect('ListProductoSample', 'codfamilia', 'family', 'codfamilia', $families);\n\n $taxes = $this->codeModel::all('impuestos', 'codimpuesto', 'descripcion');\n $this->addFilterSelect('ListProductoSample', 'codimpuesto', 'tax', 'codimpuesto', $taxes);\n\n $this->addFilterCheckbox('ListProductoSample', 'nostock', 'no-stock', 'nostock');\n $this->addFilterCheckbox('ListProductoSample', 'bloqueado', 'locked', 'bloqueado');\n $this->addFilterCheckbox('ListProductoSample', 'secompra', 'for-purchase', 'secompra');\n $this->addFilterCheckbox('ListProductoSample', 'sevende', 'for-sale', 'sevende');\n $this->addFilterCheckbox('ListProductoSample', 'publico', 'public', 'publico');\n }", "function preCreateCatalog($ar){\n // lot\n $rs = selectQueryGetAll('select count(distinct categ) as nb from '.$this->wtscatalog);\n $newval = 'Groupe '.($rs[0]['nb']+1);\n $fdl = new XShortTextDef();\n $fdl->field = 'categ';\n $fdl->table = $this->wtscatalog;\n $fdl->fieldcount = '32';\n $fdl->compulsory = 1;\n $fvl = $fdl->edit($newval);\n XShell::toScreen2('br', 'ocateg', $fvl);\n // configuration\n $fdl = new XLinkDef();\n $fdl->field = 'prdconf';\n $fdl->table = $this->wtscatalog;\n $fdl->target = $this->wtsprdconf;\n $fdl->fieldcount = '1';\n $fdl->compulsory = 0;\n $fvl = $fdl->edit();\n XShell::toScreen2('br', 'oprdconf', $fvl);\n // liste des secteurs wts\n $fdl = new XLinkDef();\n $fdl->field = 'wtspool';\n $fdl->table = $this->wtscatalog;\n $fdl->target = $this->wtspool;\n $fdl->fieldcount = '1';\n $fdl->compulsory = 0;\n $fdl->checkbox = 0;\n $fvl = $fdl->edit();\n XShell::toScreen2('br', 'owtspool', $fvl);\n // liste des personnes wts\n $this->dswtsperson->browse(array('selectedfields'=>'all', 'tplentry'=>'br_wtsperson', 'pagesize'=>999));\n // liste des forfaits wts\n $this->dswtsticket->browse(array('selectedfields'=>'all', 'tplentry'=>'br_wtsticket', 'pagesize'=>999));\n // liste des pools ta\n $bpools = $this->dstapool->browse(array('selectedfields'=>'all', 'tplentry'=>'br_pool', 'pagesize'=>999));\n // liste des tickets ta par pool ta\n $tickets = array();\n foreach($bpools['lines_oid'] as $poid){\n $tickets[] = $this->dstaticket->browse(array('selectedfields'=>'all', 'tplentry'=>TZR_RETURN_DATA, 'pagesize'=>999,\n 'select'=>$this->dstaticket->select_query(array('cond'=>array('tapool'=>array('=', $poid))))\n )\n );\n }\n XShell::toScreen2('br', 'ticket', $tickets);\n // liste des types de personnes ta\n $this->dstaperson->browse(array('selectedfields'=>'all', 'tplentry'=>'br_person', 'pagesize'=>999));\n // date de recherche\n $fd = new XDateDef();\n $fd->field = 'validfrom';\n $r = $fd->edit(date('Y-m-d'));\n XShell::toScreen2('br', 'ovalidfrom', $r);\n }", "public function create()\n {\n return view('product.add_product');\n }", "public function actionCreate()\n { $this->layout='inner';\n $model = new Product();\n $cat_list = ArrayHelper::map(ProductCategory::find()->where(['parent_id'=>'0'])->all(), 'id', 'cat_name');\n $vendor = ArrayHelper::map(User::find()->where(['usertype'=>'Vendor'])->all(), 'id', 'username');\n if ($model->load(Yii::$app->request->post())) {\n //$last_cat=end($_POST['Product']['category_id']);\n if($model->save()){\n /*$product_cat= new ProductCat();\n $product_cat->product_id=$model->id;\n $product_cat->category_id=$last_cat;\n $product_cat->save();*/\n \n //Yii::$app->getSession()->setFlash('success','successful added your product');\n return $this->redirect(['add-search-terms','id'=>$model->id]);\n }\n \n } else {\n return $this->render('create', [\n 'model' => $model,\n 'cat_list'=>$cat_list,\n 'vendor'=>$vendor,\n ]);\n }\n }", "public function edit()\r\n\r\n {\r\n\r\n $this->page_title->push(lang('menu_products_add'));\r\n\r\n $this->data['pagetitle'] = $this->page_title->show();\r\n\r\n\r\n /* Breadcrumbs :: Common */\r\n\r\n $this->breadcrumbs->unshift(1, lang('menu_products_add'), 'admin/setup/product/edit');\r\n\r\n\r\n /* Breadcrumbs */\r\n\r\n $this->data['breadcrumb'] = $this->breadcrumbs->show();\r\n\r\n\r\n /* Data */\r\n\r\n $this->data['error'] = NULL;\r\n\r\n $this->data['charset'] = 'utf-8';\r\n\r\n $this->data['form_url'] = 'admin/setup/product/update';\r\n\r\n\r\n /* Load Template */\r\n\r\n $this->template->admin_render('admin/products/edit', $this->data);\r\n\r\n\r\n }", "public function create()\n {\n $port = DB::table('tpl_portfolio')\n ->orderBy('port_id', 'desc')->get();\n $cate = DB::table('tpl_category')\n ->orderBy('cate_id', 'desc')->get();\n return view('pages.server.product.add')\n ->with('cate', $cate)\n ->with('port', $port);\n }", "public function create()\n {\n $cateproducts= CateProduct::select('id','name','idParent')->get()->toArray();\n return view('admin.pages.product.add',compact('cateproducts'));\n }", "public function create()\n {\n $title=\"Products-Create\";\n return view('FrontProducts.addProduct',compact('title'));\n }", "public function create()\n {\n $this->authorize('create', Product::class);\n return view('admin.layouts.primary-reverse', [\n 'page' => 'admin.parts.product_create',\n 'categories' => Category::all(),\n ]); \n }", "protected function saveNewProducts()\r\n\t{\r\n\t\tif (count($this->newProducts) > 0) {\r\n\t\t\t// create new product in catalog\r\n\t\t\tforeach ($this->newProducts as $product) {\r\n\t\t\t \r\n\t\t\t $result = $this->client->catalogProductCreate($this->sessionid, $product->getProductType(), $product->getAttributeSet(), $product->sku, $product);\r\n\t\t\t \r\n\t\t\t\t$this->log->addInfo('created', array(\"sku\" => $product->sku, \"result\" => $result));\r\n\t\t\t}\r\n\t\t}\r\n\t\t$this->newProducts = array();\t\t\r\n\t}", "public function create()\n {\n $products = Product::all();\n return view('crm::products.create', compact('products'));\n // return view('crm::products.create');\n }", "public function create()\r\n {\r\n// return view('admin.product.create');\r\n }", "public function create()\n {\n //get categroy name by status\n $data['tags']=Tag::all();\n $data['categories']=Category::all();\n $data['subcategories']=Subcategory::all();\n $data['productlines']=ProductLine::all();\n return view('backend.product.create',compact('data'));\n }", "function createApprentice() {\n\t\t\t\t\t$addForm = new h2o('views/addApprentice.html');\n\t\t\t\t\techo $addForm->render();\n\t\t\t\t}", "function my_account_endpoint_content() {\n echo do_shortcode('[wcj_product_add_new]');\n }", "public function addAction() {\n $this->assign('dir', \"goods\");\n $this->assign('ueditor', true);\n\t}", "public function add_product_form(){\r\n\t\tif ($this->checkLogin('A') == ''){\r\n\t\t\tredirect('admin');\r\n\t\t}else {\r\n\t\t\t$this->data['heading'] = 'Add New Product';\r\n\t\t\t$this->data['Product_id'] = $this->uri->segment(4,0);\r\n\t\t\t$this->data['categoryView'] = $this->product_model->view_category_details();\r\n\t\t\t$this->data['atrributeValue'] = $this->product_model->view_atrribute_details();\r\n\t\t\t$this->data['PrdattrVal'] = $this->product_model->view_product_atrribute_details();\r\n\t\t\t$this->load->view('admin/product/add_product',$this->data);\r\n\t\t}\r\n\t}", "public function add(){\n\n\t $data = array(\n\t \t 'laptops' =>$this->Laptop_model->getLaptops() ,\n\n\t \t );\n\n\t $this->load->view('layouts/header');\n\t\t$this->load->view('layouts/aside');\n\t\t$this->load->view('admin/prestamos/add',$data); // se envia a la vista admin/laptops/add\n\t\t$this->load->view('layouts/footer');\n}", "public function create(){\n \treturn view('admin.products.create');\n\n }", "public function create()\n {\n $data['method']=\"POST\";\n return view('../product_add',$data);\n }", "public function hookBackOfficeHeader() {\n $id_product = Tools::getValue('id_product');\n $product = new Product($id_product);\n $query = 'SELECT * FROM `' . _DB_PREFIX_ . 'product_personalized_area` WHERE `id_product`=\"'.$product->id.'\" ORDER BY `id_custom`';\n $alreadyCustomisedProducts = Db::getInstance()->ExecuteS($query);\n $qtyAlreadyCustomisedProducts = (empty($alreadyCustomisedProducts)) ? 0 : count($alreadyCustomisedProducts);\n if($qtyAlreadyCustomisedProducts > 0){\n $customised_values = $alreadyCustomisedProducts;\n }else{\n $customised_values = array();\n }\n if (!empty($product) && isset($product->id)) {\n $this->context->controller->addCSS($this->_path . 'views/css/imgareaselect-animated.css');\n $this->context->controller->addJS($this->_path . 'views/js/jquery.imgareaselect.pack.js');\n $this->context->controller->addJS($this->_path . 'views/js/back.js');\n Media::addJsDef(array(\n 'customized_area' => array(\n 'customised_values' => $customised_values\n )\n ));\n }\n\n if ($this->context->shop->getContext() == Shop::CONTEXT_GROUP) {\n $this->context->controller->addCSS($this->_path . 'views/css/hide_product_tab.css');\n }\n\n }", "public function store(ProductInsertFormRequest $request)\n {\n \n $id=Product::insertGetId([\n 'name'=>$request->product_name,\n 'cat_id'=>$request->cat_id,\n 'price'=>$request->price,\n 'package_id'=>$request->package_id,\n 'foc_id'=>$request->foc_id,\n 'description'=>$request->description, \n 'img'=>$request->photo,\n 'status'=>1,\n ]);\n \n Stock::create([\n 'product_id'=>$id,\n 'balance'=>0\n ]);\n return redirect('admin/product/create')->with('status','new product has been inserted.');\n }" ]
[ "0.6695121", "0.66545445", "0.66199064", "0.65959644", "0.65817106", "0.64879215", "0.6458583", "0.64477724", "0.6418282", "0.6405825", "0.6373641", "0.6353848", "0.6344343", "0.6327545", "0.6315267", "0.63021165", "0.62904793", "0.62865704", "0.62749267", "0.6272722", "0.62649596", "0.6242227", "0.62213975", "0.6200968", "0.6198063", "0.6192847", "0.61862546", "0.61843127", "0.61746365", "0.615849", "0.6153857", "0.6139656", "0.6135465", "0.6126878", "0.61259615", "0.61192673", "0.61145365", "0.6109962", "0.61085826", "0.61043686", "0.61009604", "0.609539", "0.60919994", "0.6090289", "0.6089534", "0.6085679", "0.60819596", "0.6060569", "0.60602707", "0.60479236", "0.60472924", "0.60471827", "0.60452515", "0.603929", "0.60389173", "0.60371035", "0.60307074", "0.6027388", "0.6018379", "0.6013396", "0.5999412", "0.59964114", "0.59961617", "0.599561", "0.5980245", "0.59775805", "0.5975093", "0.59688133", "0.59671265", "0.5960753", "0.59578425", "0.59526116", "0.5952093", "0.59518826", "0.5950434", "0.59399587", "0.5937456", "0.5934464", "0.59320676", "0.59312904", "0.5923539", "0.59200585", "0.59162265", "0.5916023", "0.5914443", "0.5913405", "0.5909933", "0.59045607", "0.5899392", "0.5891413", "0.58911705", "0.58877796", "0.5885247", "0.5884001", "0.5882024", "0.5880198", "0.58762765", "0.5863911", "0.58624095", "0.5858807", "0.5849522" ]
0.0
-1
affichage d'un produit front office
public function viewProductAction($id) { $em=$this->getDoctrine()->getManager(); $product=$em->getRepository('HologramBundle:Product')->find($id); return $this->render('HologramBundle:Front:oneProduct.html.twig',array('p'=>$product)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function hookDisplayBackOfficeTop()\n {\n $objectifCoach = array();\n $this->context->controller->addCSS($this->_path . 'views/css/compteur.css', 'all');\n $this->context->controller->addJS($this->_path . 'views/js/compteur.js');\n $objectifCoach[] = CaTools::getObjectifCoach($this->context->employee->id);\n $objectif = CaTools::isProjectifAtteint($objectifCoach);\n $objectif[0]['appels'] = (isset($_COOKIE['appelKeyyo'])) ? (int)$_COOKIE['appelKeyyo'] : '0';\n\n $this->smarty->assign(array(\n 'objectif' => $objectif[0]\n ));\n return $this->display(__FILE__, 'compteur.tpl');\n }", "function wtsProPaiement($ar){\n $p = new XParam($ar, array());\n $orderoid = $p->get('orderoid');\n // verification du client de la commande et du compte connecte\n list($okPaiement, $mess) = $this->paiementEnCompte($orderoid);\n if (!$okPaiement){\n XLogs::critical(get_class($this), 'paiement pro refusé '.$orderoid.' '.$mess);\n XShell::setNext($GLOBALS['TZR_SESSION_MANAGER']::complete_self(true, true).'&alias='.$this->aliasvente.'&moid='.$this->_moid.'&function=wtsLireOffres');\n return;\n }\n // traitement post commande std\n clearSessionVar('caddie');\n XLogs::critical(get_class($this), 'enregistrement paiement en compte '.$orderoid);\n // traitement standards après validation\n $this->postOrderActions($orderoid, true);\n\n // traitement post order - devrait être dans postOrderActions\n $this->proPostOrderActions($orderoid);\n\n // retour \n if (defined('EPL_ALIAS_PAIEMENT_ENCOMPTE')){\n XShell::setNext($GLOBALS['TZR_SESSION_MANAGER']::complete_self().'alias='.EPL_ALIAS_PAIEMENT_ENCOMPTE);} else {\n XShell::setNext($GLOBALS['TZR_SESSION_MANAGER']::complete_self(true, true).'&alias='.$this->aliasvente.'&moid='.$this->_moid.'&function=wtsLireOffres');\n }\n }", "public static function FrontEnvio()\n\t{\n\t\t$article_id = Util::getvalue('article_id');\n\t\t$emailRCP = Util::getvalue('email');\n\t\t$mensaje = strip_tags(Util::getvalue('mensaje'));\n\t\t$copia = Util::getvalue('copia', false);\n\n\n\t\t$interface = SkinController::loadInterface($baseXsl='article/article.envio.xsl');\n\t\t$article = Article::getById($article_id);\n\t\t$article['mensaje'] = $mensaje;\n\t\t\n\t\t$userArray = Session::getvalue('proyectounder');\n\t\t\n\t\tif($userArray):\n\t\t\t$article['user'] = $userArray;\n\t\tendif;\n\t\t\n\t\t$emailhtml = self::envio_email($article);\n\t\t$email = new Email();\n\t\t$email->SetFrom('[email protected]', 'Proyectounder.com');\n\t\t$email->SetSubject(utf8_encode($article['titulo']));\n\t\t$emailList = preg_split(\"/[;,]+/\", $emailRCP);\n\n\t\tforeach ($emailList as $destination)\n\t\t{\n\t\t\t$email->AddTo($destination);\n\t\t}\n\t\tif($copia):\n\t\t\t$email->AddCC($userArray['email']);\n\t\tendif;\n\n\t\t\n\t\t$email->ClearAttachments();\n\t\t$email->ClearImages();\n\t\t$email->SetHTMLBody(utf8_encode($emailhtml));\n\t\t$email->Send();\n\t\t\n\t\t\n\t\t$interface->setparam('enviado', 1);\n\t\t$interface->display();\n\t}", "public function get_compte(){retrun($id_local_compte); }", "public function affichageAction() {\r\n \r\n $em=$this->getDoctrine()->getManager();\r\n $products=$em->getRepository('HologramBundle:Product')->findBy(array('etat'=>'en attente'));\r\n return $this->render('HologramBundle:Back:produitsNonValides.html.twig',array('prod'=>$products));\r\n }", "function apropos(){\n\t\t\t$this->data->content=\"aProposView.php\";\n\t\t\t$this->prepView();\n\t\t\t// Selectionne et charge la vue\n\t\t\trequire_once(\"view/mainView.php\");\n\t\t}", "public function partirAuTravail(): void\n\t{\n\t}", "public function TresorieCommerciaux() {\n \n $em = $this->getDoctrine()->getManager();\n $entityCommercial=$em->getRepository('RuffeCardUserGestionBundle:User')->findClientNoPaiment(1);\n return $this->render ( \"RuffeCardTresorieBundle:Default:commerciauxPaiement.html.twig\", array ('Commercial'=>$entityCommercial));\n \n }", "function accesrestreintobjets_affiche_milieu($flux){\n\tif ($flux[\"args\"][\"exec\"] == \"configurer_accesrestreint\") {\n\t\t$flux[\"data\"] = recuperer_fond('prive/squelettes/inclure/configurer',array('configurer'=>'configurer_accesrestreintobjets')).$flux[\"data\"];\n\t}\n\t// Ajouter la config des zones sur la vue de chaque objet autorisé\n\telseif (\n\t\t$exec = trouver_objet_exec($flux['args']['exec'])\n\t\tand include_spip('inc/config')\n\t\tand include_spip('inc/autoriser')\n\t\tand $objets_ok = lire_config('accesrestreintobjets/objets')\n\t\t// Si on a les arguments qu'il faut\n\t\tand $type = $exec['type']\n\t\tand $id = intval($flux['args'][$exec['id_table_objet']])\n\t\t// Si on est sur un objet restrictible\n\t\tand in_array($exec['table_objet_sql'], $objets_ok)\n\t\t// Et que l'on peut configurer le site\n\t\tand autoriser('configurer')\n\t) {\n\t\t$liens = recuperer_fond(\n\t\t\t'prive/objets/editer/liens',\n\t\t\tarray(\n\t\t\t\t'table_source'=>'zones',\n\t\t\t\t'objet' => $type,\n\t\t\t\t'id_objet' => $id,\n\t\t\t)\n\t\t);\n\t\tif ($liens){\n\t\t\tif ($pos = strpos($flux['data'],'<!--affiche_milieu-->'))\n\t\t\t\t$flux['data'] = substr_replace($flux['data'], $liens, $pos, 0);\n\t\t\telse\n\t\t\t\t$flux['data'] .= $liens;\n\t\t}\n\t}\n\t\n\treturn $flux;\n}", "function proposition($CONNEXION, $PRODUIT, $QTE, $PRIX, $DATE){\n\n\t\t/* select pour id du produit à partir du nom! */\n\t\t$queryID=\"SELECT idType FROM TypeProduit\n\t\t\t\t\tWHERE nomProd=\".$PRODUIT.\";\"\n\t\t$result=sybase_query($queryID, $CONNEXION);\n\t\t$idProd=sybase_result($result);\n\t\n\t\t/* select pour récupérer le RCS du fournisseur à partir de la table Users avec $USERNAME= LOGIN */\n\t\t$queryRCS=\"SELECT idU from Users\n\t\t\t\t\tWHERE typeU=2\n\t\t\t\t\tAND loginU=\".$USERNAME\";\"\n\t\t$result=sybase_query($queryRCS, $CONNEXION);\n\t\t$RCS=SYBASE_RESULT($result);\n\t\t\n\t\n\t\t$query = \"INSERT INTO Produit VALUES (getdate(), \".$qte.\", \".$prix.\", \".$date.\", \".$RCS.\", null, \".$idProd.\";\n\t\t$result = sybase_query($query, $CONNEXION);\n\n\t}", "public function commissionPartenaire()\n {\n $data['liste_part'] = $this->partenaireModels->getPartenaire();\n $this->views->setData($data);\n\n $this->views->getTemplate('reporting/commissionPartenaire');\n }", "function sevenconcepts_formulaire_charger($flux){\n $form=$flux['args']['form'];\n if($form=='inscription'){\n include_spip('cextras_pipelines');\n $champs_extras=champs_extras_objet(table_objet_sql('auteur'));\n foreach($champs_extras as $value){\n $flux['data'][$value['options']['nom']]=''; \n if(isset($value['options']['obligatoire']))$flux['data']['obligatoire'][$value['options']['nom']]='on';\n }\n $flux['data']['nom_inscription']='';\n $flux['data']['mail_inscription']='';\n }\n \n return $flux;\n}", "public function acessarRelatorios(){\n\n }", "public function encaisser_facture_stylimmo($facture_id, Request $request )\n {\n\n\n\n $facture = Facture::where('id', $facture_id)->first();\n \n if($facture->encaissee == true) return \"Déjà encaissée\";\n \n $facture->encaissee = true;\n $facture->date_encaissement = $request->date_encaissement;\n \n \n // Si c'est une facture pub, on marque le mandataire a reglé sa facture\n if($facture->type == \"pack_pub\"){\n \n $facture->reglee = true;\n $facture->date_reglement = $request->date_encaissement;\n \n $mandataire = $facture->user;\n // On met à jour le nombre de factures pub non encaissée du mandataire\n $mandataire->nb_facture_pub_retard = Facture::where([['user_id', $facture->user_id], ['type', 'pack_pub'], ['encaissee', false]])->count() - 1;\n $mandataire->update();\n }\n \n \n $facture->update();\n\n\n if($facture->type != \"stylimmo\"){\n \n $action = Auth::user()->nom.\" \".Auth::user()->prenom.\" a encaissé la facture $facture->type $facture->numero\";\n $user_id = Auth::user()->id;\n \n \n Historique::createHistorique( $user_id,$facture->id,\"facture\",$action );\n return $facture->numero;\n }\n \n \n \n if($facture->compromis != null){\n Mail::to($facture->compromis->user->email)->send(new EncaissementFacture($facture));\n }\n // Mail::to(\"[email protected]\")->send(new EncaissementFacture($facture));\n\n\n\n\n // ##### CALCUL ET DROIT DE PARRAINAGE \n\n // On determine le compromis lié au compromis\n\n $compromis = $facture->compromis;\n\n\n if($compromis != null)\n {\n \n \n \n // ########## On calucul la note d'hono du Porteur et du partage ##################################################################\n \n if($compromis->agent_id == null){\n \n $compromis->user->sauvegarder_chiffre_affaire_styl(date('Y') . '-01-01', date('Y-m-d'));\n $this->preparer_facture_honoraire_encaissement($compromis->id, true );\n \n }else{\n \n \n $compromis->user->sauvegarder_chiffre_affaire_styl(date('Y') . '-01-01', date('Y-m-d'));\n $compromis->getPartage()->sauvegarder_chiffre_affaire_styl(date('Y') . '-01-01', date('Y-m-d'));\n\n // facture du porteur de l'affaire\n $this->preparer_facture_honoraire_encaissement($compromis->id, true );\n // facture du partage de l'affaire\n $this->preparer_facture_honoraire_encaissement($compromis->id, false );\n \n }\n \n // #############################\n \n \n \n \n \n \n // ######## si l'affaire est partagée, on va vérifier si les mandataires ont un parrain Puis caluler leur commission\n \n $filleul1 = Filleul::where([['user_id',$compromis->user_id],['expire',0]])->first();\n\n $filleul2 = $compromis->agent_id != null ? Filleul::where([['user_id',$compromis->agent_id],['expire',0]])->first() : null;\n \n\n $date_encaissement = $facture->date_encaissement->format('Y-m-d');\n\n // date_12 est la date exacte 1 ans avant la date d'encaissment\n $date_12 = strtotime( $date_encaissement. \" -1 year\"); \n $date_12 = date('Y-m-d',$date_12);\n\n $deb_annee = date(\"Y\").\"-01-01\";\n\n $retour = \"\";\n // Si le porteur de l'affaire à un parrain\n if($filleul1 != null ){\n\n $mandataire1 = $filleul1->user ;\n $parrain1 = User::where('id',$filleul1->parrain_id)->first();\n\n $ca_parrain1 = Compromis::getCAStylimmo($parrain1->id,$date_12 ,$date_encaissement);\n $ca_filleul1 = Compromis::getCAStylimmo($mandataire1->id,$date_12 ,$date_encaissement);\n\n // on calcul le chiffre affaire de parrainage du parrain \n\n\n $comm_parrain1 = unserialize($mandataire1->contrat->comm_parrain);\n\n \n // 1 on determine l'ancieneté du filleul1\n \n $dt_ent = $mandataire1->contrat->date_entree->format('Y-m-d') >= \"2019-01-01\" ? $mandataire1->contrat->date_entree : \"2019-01-01\";\n $date_entree = strtotime($dt_ent); \n\n $today = strtotime (date('Y-m-d'));\n $anciennete_porteur = $today - $date_entree;\n\n if($anciennete_porteur <= 365*86400){\n $seuil_porteur = $comm_parrain1[\"seuil_fill_1\"];\n $seuil_parrain = $comm_parrain1[\"seuil_parr_1\"];\n }\n //si ancienneté est compris entre 1 et 2ans\n elseif($anciennete_porteur > 365*86400 && $anciennete_porteur <= 365*86400*2){\n $seuil_porteur = $comm_parrain1[\"seuil_fill_2\"];\n $seuil_parrain = $comm_parrain1[\"seuil_parr_2\"];\n }\n // ancienneté sup à 2 ans\n else{\n $seuil_porteur = $comm_parrain1[\"seuil_fill_3\"];\n $seuil_parrain = $comm_parrain1[\"seuil_parr_3\"];\n }\n \n \n \n $date_fin = $compromis->getFactureStylimmo()->date_encaissement->format('Y-m-d');\n \n // Vérifier le CA du parrain et du filleul sur les 12 derniers mois précédents la date d'encaissement de la facture STYL et qui respectent les critères et vérifier s'il sont à jour dans le reglèmement de leur factures stylimmo \n // Dans cette partie on détermine le jour exaxt de il y'a 12 mois avant la date d'encaissement de la facture STYL\n \n \n \n // date_fin est la date exacte 1 ans avant la date d'encaissement de la facture STYL\n $date_deb = strtotime( $date_fin. \" -1 year\"); \n $date_deb = date('Y-m-d',$date_deb);\n \n \n \n // calcul du de la comm recu par le parrain de date_deb à date_fin \n \n \n $facts_parrain = Facture::where([['user_id',$parrain1->id],['filleul_id',$filleul1->user->id], ['compromis_id','<>', $compromis->id ]])->whereIn('type',['parrainage','parrainage_partage'])->get();\n $ca_parrain_parrainage = 0;\n \n // dd($date_deb);\n foreach ($facts_parrain as $fact) {\n \n // echo $fact->compromis->getFactureStylimmo()->date_encaissement->format('Y-m-d').\"<br>\";\n if($date_fin >= $fact->compromis->getFactureStylimmo()->date_encaissement->format('Y-m-d') && $fact->compromis->getFactureStylimmo()->date_encaissement->format('Y-m-d') >= $date_deb ){\n $ca_parrain_parrainage+= $fact->montant_ht;\n }\n }\n \n \n \n \n // On vérifie que le parrain n'a pas démissionné à la date d'encaissement \n $a_demission_parrain = false;\n\n if($parrain1->contrat->a_demission == true ){\n if($parrain1->contrat->date_demission <= $compromis->getFactureStylimmo()->date_encaissement ){\n $a_demission_parrain = true;\n }\n }\n\n // On vérifie que le filleul n'a pas démissionné à la date d'encaissement \n $a_demission_filleul = false;\n\n if($mandataire1->contrat->a_demission == true ){\n if($mandataire1->contrat->date_demission <= $compromis->getFactureStylimmo()->date_encaissement ){\n $a_demission_filleul = true;\n }\n }\n \n $touch_comm = \"non\";\n // dd(\"$parrain1->id -- \".$filleul1->user->id.\" -- $ca_parrain_parrainage < \".$mandataire1->contrat->seuil_comm );\n // dd(\"$ca_filleul1 >= $seuil_porteur && $ca_parrain1 >= $seuil_parrain && $ca_parrain_parrainage < $mandataire1->contrat->seuil_comm && $a_demission_parrain == false && $a_demission_filleul == false\");\n // On n'a les seuils et les ca on peut maintenant faire les comparaisons ## // on rajoutera les conditions de pack pub \n if($ca_filleul1 >= $seuil_porteur && $ca_parrain1 >= $seuil_parrain && $ca_parrain_parrainage < $mandataire1->contrat->seuil_comm && $a_demission_parrain == false && $a_demission_filleul == false ){\n $compromis->id_valide_parrain_porteur = $parrain1->id;\n $compromis->update();\n $touch_comm = \"oui\";\n }else{\n $compromis->id_valide_parrain_porteur = null;\n $compromis->update();\n }\n\n\n // SI TOUCHE_COMM == OUI ON CALCUL LA COMMISSION DU PARRAIN DU PORTEUR\n // dd(\"$ca_filleul1 >= $seuil_porteur && $ca_parrain1 >= $seuil_parrain && $ca_parrain_parrainage < $mandataire1->contrat->seuil_comm && $a_demission_parrain == false && $a_demission_filleul == false \");\n if($touch_comm == \"oui\"){\n // dd($a_demission_parrain);\n // dd(\"$ca_filleul1 >= $seuil_porteur && $ca_parrain1 >= $seuil_parrain && $ca_parrain_parrainage < $mandataire1->contrat->seuil_comm && $a_demission_parrain == false && $a_demission_filleul == false \");\n $this->store_facture_honoraire_parrainage( $compromis, $filleul1);\n }\n \n // dd(\"ici\");\n \n // ####################################################################\n \n $retour .= \"parrain : \".$parrain1->nom.' '.$parrain1->prenom.\" ca parrain: \".$ca_parrain1.\" \\n filleul porteur: \".$mandataire1->nom.' '.$mandataire1->prenom.\" ca filleul porteur: \".$ca_filleul1.\" \\n parrain touche comm ? : \".$touch_comm;\n \n }\n\n \n\n // Si le partage a un parrain\n if($filleul2!= null){\n\n $mandataire2 = $filleul2->user ;\n $parrain2 = User::where('id',$filleul2->parrain_id)->first();\n\n // Chiffre d'affaire du filleul et son parrain sur 1 ans avant la date d'encaissement, \n $ca_parrain2 = Compromis::getCAStylimmo($parrain2->id,$date_12 ,$date_encaissement);\n $ca_filleul2 = Compromis::getCAStylimmo($mandataire2->id,$date_12 ,$date_encaissement);\n\n $comm_parrain2 = unserialize($mandataire2->contrat->comm_parrain);\n\n \n // 1 on determine l'ancieneté du filleul1\n \n $dt_ent = $mandataire2->contrat->date_entree->format('Y-m-d') >= \"2019-01-01\" ? $mandataire2->contrat->date_entree : \"2019-01-01\";\n $date_entree = strtotime($dt_ent); \n $today = strtotime (date('Y-m-d'));\n $anciennete_partage = $today - $date_entree;\n\n if($anciennete_partage <= 365*86400){\n $seuil_partage = $comm_parrain2[\"seuil_fill_1\"];\n $seuil_parrain = $comm_parrain2[\"seuil_parr_1\"];\n }\n //si ancienneté est compris entre 1 et 2ans\n elseif($anciennete_partage > 365*86400 && $anciennete_partage <= 365*86400*2){\n $seuil_partage = $comm_parrain2[\"seuil_fill_2\"];\n $seuil_parrain = $comm_parrain2[\"seuil_parr_2\"];\n }\n // ancienneté sup à 2 ans\n else{\n $seuil_partage = $comm_parrain2[\"seuil_fill_3\"];\n $seuil_parrain = $comm_parrain2[\"seuil_parr_3\"];\n }\n \n\n \n $date_fin = $compromis->getFactureStylimmo()->date_encaissement->format('Y-m-d');\n \n // Vérifier le CA du parrain et du filleul sur les 12 derniers mois précédents la date d'encaissement de la facture STYL et qui respectent les critères et vérifier s'il sont à jour dans le reglèmement de leur factures stylimmo \n // Dans cette partie on détermine le jour exaxt de il y'a 12 mois avant la date d'encaissement de la facture STYL\n \n \n // date_fin est la date exacte 1 ans avant la date d'encaissement de la facture STYL\n $date_deb = strtotime( $date_fin. \" -1 year\"); \n $date_deb = date('Y-m-d',$date_deb);\n \n \n \n \n \n // calcul du de la comm recu par le parrain de date_deb à date_fin \n $facts_parrain = Facture::where([['user_id',$parrain1->id],['filleul_id',$filleul1->user->id], ['compromis_id','<>', $compromis->id ]])->whereIn('type',['parrainage','parrainage_partage'])->get();\n $ca_parrain_parrainage = 0;\n \n // dd($date_deb);\n foreach ($facts_parrain as $fact) {\n \n // echo $fact->compromis->getFactureStylimmo()->date_encaissement->format('Y-m-d').\"<br>\";\n if($date_fin >= $fact->compromis->getFactureStylimmo()->date_encaissement->format('Y-m-d') && $fact->compromis->getFactureStylimmo()->date_encaissement->format('Y-m-d') >= $date_deb ){\n $ca_parrain_parrainage+= $fact->montant_ht;\n }\n }\n\n\n\n\n // On vérifie que le parrain n'a pas démissionné à la date d'encaissement \n $a_demission_parrain = false;\n\n if($parrain2->contrat->a_demission == true ){\n if($parrain2->contrat->date_demission <= $compromis->getFactureStylimmo()->date_encaissement ){\n $a_demission_parrain = true;\n }\n }\n\n // On vérifie que le filleul n'a pas démissionné à la date d'encaissement \n $a_demission_filleul = false;\n\n if($mandataire2->contrat->a_demission == true ){\n if($mandataire2->contrat->date_demission <= $compromis->getFactureStylimmo()->date_encaissement ){\n $a_demission_filleul = true;\n }\n }\n\n\n\n $touch_comm = \"non\";\n // On n'a les seuils et les ca on peut maintenant faire les comparaisons ## // on rajoutera les conditions de pack pub \n if($ca_filleul2 >= $seuil_partage && $ca_parrain2 >= $seuil_parrain && $ca_parrain_parrainage < $mandataire2->contrat->seuil_comm && $a_demission_parrain == false && $a_demission_filleul == false ){\n $touch_comm = \"oui\";\n \n $compromis->id_valide_parrain_partage = $parrain2->id;\n $compromis->update();\n }else{\n $compromis->id_valide_parrain_partage = null;\n $compromis->update();\n }\n \n \n // SI TOUCHE_COMM == OUI ON CALCUL LA COMMISSION DU PARRAI DU PARTAGE \n \n \n if($touch_comm == \"oui\"){\n \n $this->store_facture_honoraire_parrainage($compromis, $filleul2);\n }\n \n \n // ####################################################################\n $retour .= \"parrain : \".$parrain2->nom.' '.$parrain2->prenom.\" ca parrain: \".$ca_parrain2.\" \\n filleul porteur: \".$mandataire2->nom.' '.$mandataire2->prenom.\" ca filleul porteur: \".$ca_filleul2.\" \\n parrain touche comm ? : \".$touch_comm;\n\n\n }\n\n }\n \n $action = Auth::user()->nom.\" \".Auth::user()->prenom.\" a encaissé la facture stylimmo $facture->numero\";\n $user_id = Auth::user()->id;\n \n \n Historique::createHistorique( $user_id,$facture->id,\"facture\",$action );\n \n return $facture->numero;\n\n\n\n \n }", "function AfficherEntreprise($entreprise)\n {\n require(\"db/connect.php\");\n $requete=$BDD->prepare(\"SELECT * FROM entreprise WHERE entreprise_id = ?\");\n $requete->execute(array($entreprise));\n //on vérifie que l'entreprise existe\n if($requete->rowcount()==0) {\n print (\"Cette entreprise n'existe pas\");\n }\n else {\n //on obtient la ligne entière de la BDD décrivant l'entreprise, stockée dans $entreprise\n $entreprise=$requete->fetch();\n print '<a href=\"entreprises.php\"><img class=\"imageTailleLogo\" alt=\"retour\" src=\"images/fleche.png\"/> </a>'\n . '<h1>'.$entreprise['entreprise_nom'].'</h1></br>';\n //logo + site internet\n print '<div class=\"row centreOffre fondFonce bordureTresDouce\" >\n <div class=\"col-xs-3 col-sm-3 col-md-4 col-lg-4 fondFonce\" \n style=\"height:240px;\"></br>\n <img class=\"imageEntreprise\" alt=\"LogoEntreprise\" src=\"logos/'.$entreprise['entreprise_logo'].'\"/></a>\n </div>\n <div class=\"col-xs-9 col-sm-9 col-md-8 col-lg-8 centreVertical fondFonce\" \n style=\"height:240px;\"> \n Site Internet <a href=\"'.$entreprise['entreprise_siteInternet'].'\">'.\n $entreprise['entreprise_siteInternet'].'</a>\n </div><br/></div>';\n //description longue\n print '<div class=\"row centreOffre bordureTresDouce\" ><h2>Description de l\\'entreprise </h2>';\n print '<div class=\"fondFonce\"></br>'.$entreprise['entreprise_descrLong'].'<br/></br></div>';\n \n //sites\n print '<h2>Adresse(s)</h2>';\n //on récupère les informations des adresses liées à l'entreprise si elle existe \n $requete=$BDD->prepare('SELECT adresse_id FROM liaison_entrepriseadresse WHERE entreprise_id =?;');\n $requete->execute(array($entreprise [\"entreprise_id\"]));\n if ($requete->rowcount()!=0)\n {\n //on stocke les résultats de la requete dans un tableau, une ligne par adresse liée a l'entreprise\n $tableauAdresse=$requete->fetchAll();\n //le booléen permet d'alterner les couleurs\n $bool=true;\n foreach($tableauAdresse as $liaison)\n {\n $bool=!$bool;\n if ($bool) print '<div class=\"col-xs-3 col-sm-3 col-md-4 col-lg-4 fondClair\" \n style=\"height:120px;\">';\n if (!$bool) print '<div class=\"col-xs-3 col-sm-3 col-md-4 col-lg-4 fondFonce\" \n style=\"height:120px;\">';\n $adresse_id=$liaison['adresse_id'];\n AfficherAdresse($adresse_id);\n print '</div>';\n } \n }\n else print '<i>Pas d\\'adresse renseignée.</i>';\n print '</div>'; \n \n //contacts\n print '<div class=\"row centreOffre\" style=\"border:1px solid #ddd;\">';\n print '<h2>Contact(s)</h2>';\n $requete=$BDD->prepare(\"SELECT * FROM contact WHERE contact.entreprise_id =?;\");\n $requete-> execute(array($entreprise['entreprise_id']));\n if ($requete->rowcount()!=0)\n {\n //on stocke les résultats de la requete dans un tableau, une ligne par contact lié a l'entreprise\n $tableauContact=$requete->fetchAll();\n $bool=true;\n foreach($tableauContact as $contact)\n {\n $bool=!$bool;\n if ($bool) print '<div class=\"col-xs-3 col-sm-3 col-md-4 col-lg-4 fondClair\" \n style=\"height:150px;\">';\n if (!$bool) print '<div class=\"col-xs-3 col-sm-3 col-md-4 col-lg-4 fondFonce\" \n style=\"height:150px;\">';\n AfficherContact($contact);\n } \n }\n else print\"<i>Pas de contact renseigné.</i>\";\n print '</div>';\n //offres proposées\n print '<div class=\"row centreOffre\" style=\"border:1px solid #ddd;\">';\n print '<h2>Offre(s) proposée(s)</h2>';\n //l'utilisateur normal ne peut voir les offres de moins d'une semaine\n if ($_SESSION['statut']==\"normal\")\n {\n $requete=$BDD->prepare(\"SELECT * FROM offre WHERE offre.entreprise_id =? AND offre_valide=1 AND offre_signalee=0 AND offre_datePoste<DATE_ADD(NOW(),INTERVAL -1 WEEK) ;\");\n }\n else {$requete=$BDD->prepare(\"SELECT * FROM offre WHERE offre.entreprise_id =? AND offre_valide=1 AND offre_signalee=0 ;\");}\n $requete-> execute(array($entreprise['entreprise_id']));\n $bool=true;\n if ($requete->rowcount()!=0)\n {\n //on stocke les résultats de la requete dans un tableau, une ligne par offre liée a l'entreprise\n $tableauOffre=$requete->fetchAll();\n foreach($tableauOffre as $offre)\n {\n $bool=!$bool;\n AfficherOffre($offre,$bool);\n } \n }\n else print \"<i>Pas d'offre proposée en ce moment.</i>\";\n print '</div>';\n }\n }", "public function getChapeau();", "public function produits()\n {\n $data[\"list\"]= $this->produit->list();\n $this->template_admin->displayad('liste_Produits');\n }", "function organismes()\n\t{\n\t\tglobal $gCms;\n\t\t$ping = cms_utils::get_module('Ping'); \n\t\t$db = cmsms()->GetDb();\n\t\t$designation = '';\n\t\t$tableau = array('F','Z','L','D');\n\t\t//on instancie la classe servicen\n\t\t$service = new Servicen();\n\t\t$page = \"xml_organisme\";\n\t\tforeach($tableau as $valeur)\n\t\t{\n\t\t\t$var = \"type=\".$valeur;\n\t\t\t//echo $var;\n\t\t\t$scope = $valeur;\n\t\t\t//echo \"la valeur est : \".$valeur;\n\t\t\t$lien = $service->GetLink($page,$var);\n\t\t\t//echo $lien;\n\t\t\t$xml = simplexml_load_string($lien, 'SimpleXMLElement', LIBXML_NOCDATA);\n\t\t\t\n\t\t\tif($xml === FALSE)\n\t\t\t{\n\t\t\t\t$designation.= \"service coupé\";\n\t\t\t\t$now = trim($db->DBTimeStamp(time()), \"'\");\n\t\t\t\t$status = 'Echec';\n\t\t\t\t$action = 'retrieve_ops';\n\t\t\t\tping_admin_ops::ecrirejournal($now,$status,$designation,$action);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$array = json_decode(json_encode((array)$xml), TRUE);\n\t\t\t\t///on initialise un compteur général $i\n\t\t\t\t$i=0;\n\t\t\t\t//on initialise un deuxième compteur\n\t\t\t\t$compteur=0;\n\t\t\t//\tvar_dump($xml);\n\n\t\t\t\t\tforeach($xml as $cle =>$tab)\n\t\t\t\t\t{\n\n\t\t\t\t\t\t$i++;\n\t\t\t\t\t\t$idorga = (isset($tab->id)?\"$tab->id\":\"\");\n\t\t\t\t\t\t$code = (isset($tab->code)?\"$tab->code\":\"\");\n\t\t\t\t\t\t$libelle = (isset($tab->libelle)?\"$tab->libelle\":\"\");\n\t\t\t\t\t\t// 1- on vérifie si cette épreuve est déjà dans la base\n\t\t\t\t\t\t$query = \"SELECT idorga FROM \".cms_db_prefix().\"module_ping_organismes WHERE idorga = ?\";\n\t\t\t\t\t\t$dbresult = $db->Execute($query, array($idorga));\n\n\t\t\t\t\t\t\tif($dbresult && $dbresult->RecordCount() == 0) \n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$query = \"INSERT INTO \".cms_db_prefix().\"module_ping_organismes (libelle, idorga, code, scope) VALUES (?, ?, ?, ?)\";\n\t\t\t\t\t\t\t\t//echo $query;\n\t\t\t\t\t\t\t\t$compteur++;\n\t\t\t\t\t\t\t\t$dbresultat = $db->Execute($query,array($libelle,$idorga,$code,$scope));\n\n\t\t\t\t\t\t\t\tif(!$dbresultat)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t$designation.= $db->ErrorMsg();\t\t\t\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\n\n\t\t\t\t\t}// fin du foreach\n\n\t\t\t}\n\t\t\tunset($scope);\n\t\t\tunset($var);\n\t\t\tunset($lien);\n\t\t\tunset($xml);\n\t\t\tsleep(1);\n\t\t}//fin du premier foreach\n\t\t\n\n\t\t$designation.= $compteur.\" organisme(s) récupéré(s)\";\n\t\t$now = trim($db->DBTimeStamp(time()), \"'\");\n\t\t$status = 'Ok';\n\t\t$action = 'retrieve_ops';\n\t\tping_admin_ops::ecrirejournal($now,$status,$designation,$action);\n\n\t\t\t\n\t\t\n\t}", "function ajouterProduit($code, $nom, $prix) {\n\t // echo \"<p>ajouter $code $nom $prix </p> \";\n\t \n\t /* on verifie si le panier n'est pas vide */ \n\t if ( $this->nbProduits == 0) {\n\t // echo \"<p>premier produit </p> \";\n\t \n\t /* le panier etait vide - on y ajoute un nouvel produit */\n\t $prod = new Produit($code, $nom, $prix);\n\t \n\t /* le produit dans la ligne de panier */ \n\t $lp = new LignePanier($prod);\n\t \n\t /* on garde chaque ligne dans un tableau associatif, avec le code produit en clé */\n\t\t\t $this->lignes[$code] = $lp;\n\t\t\t \n\t \n\t // echo \"<p>\" . $lp->prod->code . \" \" . $lp->qte . \"</p>\" ;\n\t \n\t $this->nbProduits = 1;\n\t }\n\t else {\n\t /* il y a deja des produits dans le panier */\n\t /* on verifie alors si $code n'y est pas deja */\n\t \n\t if ( isset ($this->lignes[$code]) ) {\n\t /* le produit y figure deja, on augmente la quantite */\n\t $lp = $this->lignes[$code] ; //on recupere la ligne du panier\n\t $qte = $lp->qte; \n\t $lp->qte = $qte + 1;\n\t \n\t // echo \"<p> nouvelle qte ($qte) : \" . $lp->qte .\"</p>\" ;\n\t \n\t }\n\t else { \n\t /* le produit n'etait pas encore dans le panier, on n'y ajoute */\n\t $prod = new Produit($code, $nom, $prix);\n\t $lp = new LignePanier($prod);\n\t \n\t $this->lignes[$code] = $lp;\n\t $this->nbProduits = $this->nbProduits + 1;\n\t \n\t\t\t\t // echo \"<p>\" . $this->lignes[$code]->prod->code . \" \" . $this->lignes[$code]->qte . \"</p>\" ;\n\t\t\t\t \n\n\t } \n\t \n\t }\t \n\t \n\t }", "function informationsMonCompte() {\n $this->vue = new V_Vue(\"../vues/templates/template.inc.php\");\n $this->vue->ecrireDonnee(\"titreVue\",\"Margo : Mon Compte\");\n $this->vue->ecrireDonnee('centre',\"../vues/includes/gestionDeCompte/centreMonCompte.inc.php\");\n \n $this->vue->ecrireDonnee(\"titreSection\",\"Mon Compte: Informations\");\n // Centre : formulaire de connexion\n $this->vue->ecrireDonnee('loginAuthentification',MaSession::get('login')); \n \n // ... depuis la BDD \n $daoPers = new M_DaoPersonne();\n $daoPers->connecter();\n $perso = $daoPers->getOneByLogin(MaSession::get('login'));\n \n $this->vue->ecrireDonnee(\"infoPerso\",$perso);\n \n $this->vue->afficher();\n }", "public function videPanier()\n {\n $this->CollProduit->vider();\n }", "public function AggiornaPrezzi(){\n\t}", "public function showAction()\n {\n $em =$this->getDoctrine()->getManager();\n $liste = $em->getRepository('ProduitBundle:PanierProduit')->findAll();\n\n $prixtotal=0;\n $somme=0;\n foreach ($liste as $value)\n {\n $prixtotal=$value->getPrix();\n $somme=$prixtotal+$somme;\n }\n\n $tab=array(\"somme\"=>$somme);\n\n return $this->render('@Eco/Panier/page_index_panier.html.twig', array(\n 'liste'=> $liste,'tab'=> $tab));\n\n }", "public function show(Produit $produit)\n {\n //\n }", "public function show(Produit $produit)\n {\n //\n }", "public function afficheEntete()\r\n\t\t{\r\n\t\t//appel de la vue de l'entête\r\n\t\trequire 'Vues/entete.php';\r\n\t\t}", "public function saisie() {\r\n if (!isAuth(315)) {\r\n return;\r\n }\r\n if (!empty($this->request->punipar)) {\r\n $params = [\"eleve\" => $this->request->comboEleves,\r\n \"datepunition\" => $this->request->datepunition,\r\n \"dateenregistrement\" => date(\"Y-m-d\", time()),\r\n \"duree\" => $this->request->duree,\r\n \"typepunition\" => $this->request->comboTypes,\r\n \"motif\" => $this->request->motif,\r\n \"description\" => $this->request->description,\r\n \"punipar\" => $this->request->punipar,\r\n \"enregistrerpar\" => $this->session->user,\r\n \"anneeacademique\" => $this->session->anneeacademique];\r\n $this->Punition->insert($params);\r\n $this->sendNotification($this->request->comboEleves, $this->request->datepunition, \r\n $this->request->duree, $this->request->motif, $this->request->comboTypes);\r\n header(\"Location:\" . Router::url(\"punition\"));\r\n }\r\n $this->view->clientsJS(\"punition\" . DS . \"punition\");\r\n $view = new View();\r\n\r\n $type = $this->Typepunition->selectAll();\r\n $comboTypes = new Combobox($type, \"comboTypes\", $this->Typepunition->getKey(), $this->Typepunition->getLibelle());\r\n $comboTypes->first = \" \";\r\n $view->Assign(\"comboTypes\", $comboTypes->view());\r\n $view->Assign(\"comboClasses\", $this->comboClasses->view());\r\n\r\n $personnels = $this->Personnel->selectAll();\r\n $comboPersonnels = new Combobox($personnels, \"comboPersonnels\", $this->Personnel->getKey(), $this->Personnel->getLibelle());\r\n $comboPersonnels->first = \" \";\r\n $view->Assign(\"comboPersonnels\", $comboPersonnels->view());\r\n\r\n $content = $view->Render(\"punition\" . DS . \"saisie\", false);\r\n $this->Assign(\"content\", $content);\r\n //$this->Assign(\"content\", (new View())->output());\r\n }", "public function afficherPanier(){ \n $txt = \"\";\n foreach($this->listeProduits as $value){\n\t$p = $value[0]; // objet produit\n\t$q = $value[1]; // quantité\n\t$txt .= $q . \" unités x \" . $p->getNomProduit() . \" à \" .\n\t$p->getPrixHTVA() . \" euros\\n\";\n\t}\t\n\treturn $txt;\n }", "public function devuelveProductos()\n {\n parent::Conexion();\n }", "public function lectureContenu ()\n {\n\n //$metadata = simplexml_load_file(\"xmoddledata/metadata.xml\");\n\n // on Vérifie si le cours existe\n\n /* @TODO Partie à décommenter lorsque le module de navigation sera intégré au reste de l'application */\n\n // $nbrCours = $metadata->attributes()->nbrCours;\n // $isFound = false;\n // $i = 0;\n // for ($i = 0; $i < $nbrCours; $i++) {\n // if ($metadata->cours[$i]->attributes()->title == $title && $metadata->cours[$i]->attributes()->id == $id) {\n // $isFound = true;\n // break;\n // }\n // }\n\n // if ($isFound) {\n //$cours = simplexml_load_file(\"xmoddledata/\" . $metadata->cours[$i]->attributes()->id . \"_\" . $metadata->cours[$i]->attributes()->title . \"/description.xml\"); \n\n $description = simplexml_load_file('xmoddledata/2_ModeleDeSupport2/description.xml');\n $notions = simplexml_load_file('xmoddledata/2_ModeleDeSupport2/descriptionNotions.xml');\n\n // Création d'un tableau associatif de notions avec l'id comme clé\n\n $notionsArray = $this->getNotions($notions);\n\n // Construction de la navigation\n $text_parties = \"\";\n $nav_parties = [];\n for ($i = 0; $i < $description->attributes()->nbrParties; $i++) {\n $text_parties = \"<div style='\";\n $text_parties .= $this->getStyle($description->partie[$i]->attributes());\n $text_parties .= \"'\";\n $text_parties .= \" id='\".$i.\"'>\";\n $nav_chapitres = [];\n $text_parties .= $description->partie[$i]->attributes()->title;\n $text_parties .= \"</div>\";\n $text_parties .= \"<br/><br/>\";\n $text_chapitres = \"\";\n for ($j = 0; $j < $description->partie[$i]->attributes()->nbrChapitres; $j++) {\n $text_chapitres .= \"<div style='\";\n $text_chapitres .= $this->getStyle($description->partie[$i]->chapitre[$j]->attributes());\n $text_chapitres .= \"'\";\n $text_chapitres .= \" id='\".$i.\"_\".$j.\"'>\";\n $nav_paragraphes = [];\n $text_chapitres .= $description->partie[$i]->chapitre[$j]->attributes()->title;\n $text_chapitres .= \"</div>\";\n $text_chapitres .= \"<br/><br/>\";\n $text_paragraphes = \"\";\n for ($k = 0; $k < $description->partie[$i]->chapitre[$j]->attributes()->nbrParagraphes; $k++) {\n // On renseigne le titre du paragraphe\n $text_paragraphes .= \"<div style='\";\n $text_paragraphes .= $this->getStyle($description->partie[$i]->chapitre[$j]->paragraphe[$k]->attributes());\n $text_paragraphes .= \"'\";\n // Ajout d'un ancre de navigation\n $text_paragraphes .= \" id='\".$i.\"_\".$j.\"_\".$k.\"'>\";\n $text_paragraphes .= $description->partie[$i]->chapitre[$j]->paragraphe[$k]->attributes()->title;\n $text_paragraphes .= \"</div>\";\n $text_paragraphes .= \"<br/>\";\n // Navigation avec paragraphes\n $nav_paragraphes[\"\".$i.\"_\".$j.\"_\".$k] = $description->partie[$i]->chapitre[$j]->paragraphe[$k]->attributes()->title;\n // On remplit les notions contenus dans le paragraphe\n for ($l = 0; $l < $description->partie[$i]->chapitre[$j]->paragraphe[$k]->attributes()->nbrNotions; $l++) {\n $text_paragraphes .= $notionsArray[\"\".$description->partie[$i]->chapitre[$j]->paragraphe[$k]->notion[$l]->attributes()->id];\n }\n }\n $text_chapitres .= $text_paragraphes;\n $nav_chapitres[\"\".$i.\"_\".$j] = $nav_paragraphes;\n }\n $text_parties .= $text_chapitres;\n $nav_parties[\"\".$i] = $nav_chapitres;\n }\n// dd($nav_parties);\n// dd($navigation);\n// dd($description);\n\n // Construction de la page web\n $titre = $description->attributes()->title;\n// dd($description);\n// forearch( $navigation->partie[] as $partie) {\n// dd($pantie);\n// }\n// dd($titre);\n\n\n // $notions = simplexml_load_file(\"../../../fichiersdestructuration/descriptionNotions.xml\");\n\n\n // $nbrNotions = $cours->attributes()->nbrNotions;\n // $notionsConvertis = array();\n // for ($i = 0; $i < $nbrNotions; $i++) {\n // $attributs = $cours->notion[$i]->attributes();\n // $style = \"\";\n // if ($attributs['font-weight'] != null) {\n // $style .= 'font-weight:' . $attributs['font-weight'] . \";\";\n // }\n // if ($attributs['font-size'] != null) {\n // $style .= 'font-size:' . $attributs['font-size'] . \";\";\n // }\n\n // if ($attributs['font-family'] != null) {\n // $style .= 'font-family:' . $attributs['font-family'] . \";\";\n // }\n\n // if ($attributs['color'] != null) {\n // $style .= 'color:' . $attributs['color'] . \";\";\n // }\n\n // if ($attributs['text-decoration'] != null) {\n // $style .= 'text-decoration:' . $attributs['text-decoration'] . \";\";\n // }\n\n // $text = \"\";\n // foreach ($cours->notion[$i]->children() as $child) {\n // $text .= $child->asXML();\n // }\n // $notionHtml = \"<div style='\";\n // $notionHtml .= $style;\n // $notionHtml .= \"'>\";\n // $notionHtml .= $text;\n // $notionHtml .= \"</div>\";\n\n\n // //dd(strval($text));\n // array_push($notionsConvertis, $notionHtml);\n\n // }\n // }else{\n // return view(\"/\");\n // }\n //$notions = $notionsConvertis;\n // return response()->json($notions,200);\n\n // return \"lecture cours\";\n return 0;\n }", "function Geral() {\r\n \r\n extract($GLOBALS);\r\n global $w_Disabled;\r\n $w_chave = $_REQUEST['w_chave'];\r\n $w_sq_tipo_lancamento = $_REQUEST['w_sq_tipo_lancamento'];\r\n $w_readonly = '';\r\n $w_erro = '';\r\n\r\n // Carrega o segmento cliente\r\n $sql = new db_getCustomerData; $RS = $sql->getInstanceOf($dbms,$w_cliente); \r\n $w_segmento = f($RS,'segmento');\r\n \r\n // Verifica se há necessidade de recarregar os dados da tela a partir\r\n // da própria tela (se for recarga da tela) ou do banco de dados (se não for inclusão)\r\n if ($w_troca>'' && $O!='E') {\r\n // Se for recarga da página\r\n $w_codigo_interno = $_REQUEST['w_codigo_interno'];\r\n $w_sq_tipo_lancamento = $_REQUEST['w_sq_tipo_lancamento'];\r\n $w_sq_tipo_documento = $_REQUEST['w_sq_tipo_documento'];\r\n $w_descricao = $_REQUEST['w_descricao'];\r\n $w_valor = $_REQUEST['w_valor'];\r\n $w_fim = $_REQUEST['w_fim'];\r\n $w_conta_debito = $_REQUEST['w_conta_debito'];\r\n $w_sq_forma_pagamento = $_REQUEST['w_sq_forma_pagamento'];\r\n $w_cc_debito = $_REQUEST['w_cc_debito'];\r\n $w_cc_credito = $_REQUEST['w_cc_credito'];\r\n\r\n } elseif(strpos('AEV',$O)!==false || $w_copia>'') {\r\n // Recupera os dados do lançamento\r\n $sql = new db_getSolicData; \r\n $RS = $sql->getInstanceOf($dbms,nvl($w_copia,$w_chave),$SG);\r\n if (count($RS)>0) {\r\n $w_codigo_interno = f($RS,'codigo_interno');\r\n $w_sq_tipo_lancamento = f($RS,'sq_tipo_lancamento');\r\n $w_conta_debito = f($RS,'sq_pessoa_conta');\r\n $w_descricao = f($RS,'descricao');\r\n $w_fim = formataDataEdicao(f($RS,'fim'));\r\n $w_valor = formatNumber(f($RS,'valor'));\r\n $w_sq_forma_pagamento = f($RS,'sq_forma_pagamento');\r\n $w_cc_debito = f($RS,'cc_debito');\r\n $w_cc_credito = f($RS,'cc_credito');\r\n }\r\n }\r\n\r\n // Recupera dados do comprovante\r\n if (nvl($w_troca,'')=='' && (nvl($w_copia,'')!='' || nvl($w_chave,'')!='')) {\r\n $sql = new db_getLancamentoDoc; $RS = $sql->getInstanceOf($dbms,nvl($w_copia,$w_chave),null,null,null,null,null,null,'DOCS');\r\n $RS = SortArray($RS,'sq_tipo_documento','asc');\r\n foreach ($RS as $row) {$RS=$row; break;}\r\n if (nvl($w_copia,'')=='') $w_chave_doc = f($RS,'sq_lancamento_doc'); // Se cópia, não copia a chave do documento \r\n $w_sq_tipo_documento = f($RS,'sq_tipo_documento');\r\n $w_numero = f($RS,'numero');\r\n $w_data = FormataDataEdicao(f($RS,'data'));\r\n $w_serie = f($RS,'serie');\r\n $w_valor_doc = formatNumber(f($RS,'valor'));\r\n $w_patrimonio = f($RS,'patrimonio');\r\n $w_tributo = f($RS,'calcula_tributo');\r\n $w_retencao = f($RS,'calcula_retencao'); \r\n }\r\n\r\n // Default: pagamento para pessoa jurídica\r\n $w_tipo_pessoa = nvl($w_tipo_pessoa,2);\r\n \r\n // Recupera o trâmite de conclusão\r\n $sql = new db_getTramiteList; $RS = $sql->getInstanceOf($dbms, $w_menu,null,null,null);\r\n $RS = SortArray($RS,'ordem','asc');\r\n foreach ($RS as $row) {\r\n if (f($row,'sigla')=='AT') {\r\n $w_tramite_conc = f($row,'sq_siw_tramite');\r\n break;\r\n }\r\n }\r\n \r\n // Verifica as formas de pagamento possíveis. Se apenas uma, atribui direto\r\n $sql = new db_getFormaPagamento; $RS = $sql->getInstanceOf($dbms, $w_cliente, null, $SG, null,'S',null);\r\n $w_exibe_fp = true;\r\n if (count($RS)==1 || nvl($w_sq_forma_pagamento,'')!='') {\r\n foreach($RS as $row) { \r\n if (nvl($w_sq_forma_pagamento,f($row,'sq_forma_pagamento'))==f($row,'sq_forma_pagamento')) {\r\n $w_sq_forma_pagamento = f($row,'sq_forma_pagamento'); \r\n $w_forma_pagamento = f($row,'sigla'); \r\n $w_nm_forma_pagamento = f($row,'nome'); \r\n break; \r\n }\r\n }\r\n if (count($RS)==1) $w_exibe_fp = false;\r\n }\r\n \r\n // Verifica os tipos de documento possíveis. Se apenas um, atribui direto\r\n $sql = new db_getTipoDocumento; $RS = $sql->getInstanceOf($dbms,null,$w_cliente,$w_menu,null);\r\n $w_exibe_dc = true;\r\n if (count($RS)==1) {\r\n foreach($RS as $row) { \r\n $w_sq_tipo_documento = f($row,'chave'); \r\n $w_tipo_documento = f($row,'sigla'); \r\n $w_nm_tipo_documento = f($row,'nome'); \r\n break; \r\n }\r\n $w_exibe_dc = false;\r\n }\r\n\r\n // Se o tipo de lançamento já foi informado, recupera o código externo para definir a conta contábil de débito\r\n if ($w_sq_tipo_lancamento) {\r\n $sql = new db_getTipoLancamento; $RS = $sql->getInstanceOf($dbms,$w_sq_tipo_lancamento,null,$w_cliente,null);\r\n $w_cc_debito = f($RS[0],'codigo_externo');\r\n }\r\n \r\n // Retorna as contas contábeis do lançamento\r\n retornaContasContabeis($RS_Menu, $w_cliente, $w_sq_tipo_lancamento, $w_sq_forma_pagamento, $w_conta_debito, $w_cc_debito, $w_cc_credito);\r\n \r\n Cabecalho();\r\n head();\r\n Estrutura_CSS($w_cliente);\r\n // Monta o código JavaScript necessário para validação de campos e preenchimento automático de máscara,\r\n // tratando as particularidades de cada serviço\r\n ScriptOpen('JavaScript');\r\n CheckBranco();\r\n FormataData();\r\n SaltaCampo();\r\n FormataDataHora();\r\n FormataValor();\r\n ShowHTML('function botoes() {');\r\n ShowHTML(' document.Form.Botao[0].disabled = true;');\r\n ShowHTML(' document.Form.Botao[1].disabled = true;');\r\n ShowHTML('}');\r\n ValidateOpen('Validacao');\r\n if ($O=='I' || $O=='A') {\r\n Validate('w_sq_tipo_lancamento','Tipo do lançamento','SELECT',1,1,18,'','0123456789');\r\n if ($w_exibe_fp) Validate('w_sq_forma_pagamento','Forma de pagamento','SELECT',1,1,18,'','0123456789');\r\n Validate('w_conta_debito','Conta bancária', 'SELECT', 1, 1, 18, '', '0123456789');\r\n if ($w_exibe_dc) Validate('w_sq_tipo_documento','Tipo de documento','SELECT',1,1,18,'','0123456789');\r\n Validate('w_fim','Data da operação', 'DATA', '1', '10', '10', '', '0123456789/');\r\n Validate('w_valor','Valor total do documento','VALOR','1',4,18,'','0123456789.,-');\r\n CompValor('w_valor','Valor total do documento','>','0,00','zero');\r\n Validate('w_descricao','Observação','1','',5,2000,'1','1');\r\n \r\n Validate('w_cc_debito','Conta Débito','','','2','25','ABCDEFGHIJKLMNOPQRSTUVWXYZ','0123456789');\r\n Validate('w_cc_credito','Conta Crédito','','','2','25','ABCDEFGHIJKLMNOPQRSTUVWXYZ','0123456789');\r\n \r\n ShowHTML(' if ((theForm.w_cc_debito.value != \"\" && theForm.w_cc_credito.value == \"\") || (theForm.w_cc_debito.value == \"\" && theForm.w_cc_credito.value != \"\")) {');\r\n ShowHTML(' alert (\"Informe ambas as contas contábeis ou nenhuma delas!\");');\r\n ShowHTML(' theForm.w_cc_debito.focus();');\r\n ShowHTML(' return false;');\r\n ShowHTML(' }');\r\n \r\n } \r\n Validate('w_assinatura',$_SESSION['LABEL_ALERTA'], '1', '1', '3', '30', '1', '1');\r\n ValidateClose();\r\n ScriptClose();\r\n ShowHTML('<BASE HREF=\"'.$conRootSIW.'\">');\r\n ShowHTML('</HEAD>');\r\n if ($w_troca>'') BodyOpen('onLoad=\\'document.Form.'.$w_troca.'.focus()\\';');\r\n elseif (!(strpos('EV',$O)===false)) BodyOpen('onLoad=\\'this.focus()\\';');\r\n else BodyOpen('onLoad=\\'document.Form.w_sq_tipo_lancamento.focus()\\';');\r\n Estrutura_Topo_Limpo();\r\n Estrutura_Menu();\r\n Estrutura_Corpo_Abre();\r\n Estrutura_Texto_Abre();\r\n ShowHTML('<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">');\r\n if ($w_chave>'') ShowHTML(' <tr><td><font size=\"2\"><b>'.$w_codigo_interno.' ('.$w_chave.')</b></td>');\r\n if (strpos('IAEV',$O)!==false) {\r\n if (strpos('EV',$O)!==false) {\r\n $w_Disabled=' DISABLED ';\r\n if ($O=='V') $w_Erro = Validacao($w_sq_solicitacao,$SG);\r\n } \r\n if (Nvl($w_pais,'')=='') {\r\n // Carrega os valores padrão para país, estado e cidade\r\n $sql = new db_getCustomerData; $RS = $sql->getInstanceOf($dbms,$w_cliente);\r\n $w_pais = f($RS,'sq_pais');\r\n $w_uf = f($RS,'co_uf');\r\n $w_cidade = Nvl(f($RS_Menu,'sq_cidade'),f($RS,'sq_cidade_padrao'));\r\n } \r\n AbreForm('Form',$w_dir.$w_pagina.'Grava','POST','return(Validacao(this));',null,$P1,$P2,$P3,$P4,$TP,$SG,$R,$O);\r\n ShowHTML(MontaFiltro('POST'));\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_troca\" value=\"\">');\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_copia\" value=\"'.$w_copia.'\">');\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_chave\" value=\"'.$w_chave.'\">');\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_codigo_interno\" value=\"'.$w_codigo_interno.'\">');\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_menu\" value=\"'.f($RS_Menu,'sq_menu').'\">');\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_data_hora\" value=\"'.f($RS_Menu,'data_hora').'\">');\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_cidade\" value=\"'.$w_cidade.'\">');\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_tramite\" value=\"'.$w_tramite_conc.'\">');\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_tipo\" value=\"'.$w_tipo.'\">');\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_chave_doc\" value=\"'.$w_chave_doc.'\">');\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_tipo_pessoa\" value=\"'.$w_tipo_pessoa.'\">');\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_aviso\" value=\"N\">');\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_dias\" value=\"0\">');\r\n ShowHTML('<tr bgcolor=\"'.$conTrBgColor.'\"><td>');\r\n ShowHTML(' <table width=\"100%\" border=\"0\">');\r\n ShowHTML(' <tr><td colspan=3 align=\"center\" height=\"2\" bgcolor=\"#000000\"></td></tr>');\r\n ShowHTML(' <tr><td colspan=3 align=\"center\" height=\"1\" bgcolor=\"#000000\"></td></tr>');\r\n ShowHTML(' <tr><td colspan=3 align=\"center\" bgcolor=\"#D0D0D0\"><b>Identificação</td></td></tr>');\r\n ShowHTML(' <tr><td colspan=3 align=\"center\" height=\"1\" bgcolor=\"#000000\"></td></tr>');\r\n ShowHTML(' <tr><td colspan=3>Os dados deste bloco serão utilizados para identificação do lançamento, bem como para o controle de sua execução.</td></tr>');\r\n ShowHTML(' <tr><td colspan=3 align=\"center\" height=\"1\" bgcolor=\"#000000\"></td></tr>');\r\n\r\n ShowHTML(' <tr valign=\"top\">');\r\n selecaoTipoLancamento('Tipo de lançamento:',null,null,$w_sq_tipo_lancamento,$w_menu,$w_cliente,'w_sq_tipo_lancamento',$SG, 'onChange=\"document.Form.action=\\''.$w_dir.$w_pagina.$par.'\\'; document.Form.O.value=\\''.$O.'\\'; document.Form.w_troca.value=\\''.(($w_exibe_fp) ? 'w_sq_forma_pagamento' : 'w_conta_debito').'\\'; document.Form.submit();\"',3);\r\n ShowHTML(' <tr valign=\"top\">');\r\n if ($w_exibe_fp) {\r\n SelecaoFormaPagamento('<u>F</u>orma de pagamento:','F','Selecione na lista a forma desejada para esta aplicação.',$w_sq_forma_pagamento,$SG,'w_sq_forma_pagamento',null,'onChange=\"document.Form.action=\\''.$w_dir.$w_pagina.$par.'\\'; document.Form.O.value=\\''.$O.'\\'; document.Form.w_troca.value=\\'w_conta_debito\\'; document.Form.submit();\"');\r\n } else {\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_sq_forma_pagamento\" value=\"'.$w_sq_forma_pagamento.'\">');\r\n }\r\n SelecaoContaBanco('<u>C</u>onta bancária:','C','Selecione a conta bancária envolvida no lançamento.',$w_conta_debito,null,'w_conta_debito',null,'onChange=\"document.Form.action=\\''.$w_dir.$w_pagina.$par.'\\'; document.Form.O.value=\\''.$O.'\\'; document.Form.w_troca.value=\\''.(($w_exibe_dc) ? 'w_sq_tipo_documento' : 'w_fim').'\\'; document.Form.submit();\"');\r\n ShowHTML(' </tr>');\r\n ShowHTML(' <tr valign=\"top\">');\r\n if ($w_exibe_dc) {\r\n SelecaoTipoDocumento('<u>T</u>ipo do documento:','T', 'Selecione o tipo de documento.', $w_sq_tipo_documento,$w_cliente,$w_menu,'w_sq_tipo_documento',null,null);\r\n } else {\r\n ShowHTML('<INPUT type=\"hidden\" name=\"w_sq_tipo_documento\" value=\"'.$w_sq_tipo_documento.'\">');\r\n }\r\n ShowHTML(' <td><b><u>D</u>ata da operação:</b><br><input '.$w_Disabled.' accesskey=\"D\" type=\"text\" name=\"w_fim\" class=\"sti\" SIZE=\"10\" MAXLENGTH=\"10\" VALUE=\"'.$w_fim.'\" onKeyDown=\"FormataData(this,event);\" onKeyUp=\"SaltaCampo(this.form.name,this,10,event);\">'.ExibeCalendario('Form','w_fim').'</td>');\r\n ShowHTML(' <td><b><u>V</u>alor:</b><br><input '.$w_Disabled.' accesskey=\"V\" type=\"text\" name=\"w_valor\" class=\"sti\" SIZE=\"18\" MAXLENGTH=\"18\" VALUE=\"'.$w_valor.'\" style=\"text-align:right;\" onKeyDown=\"FormataValor(this,18,2,event);\" title=\"Informe o valor total do documento.\"></td>');\r\n ShowHTML(' <tr><td colspan=3><b><u>O</u>bservação:</b><br><textarea '.$w_Disabled.' accesskey=\"O\" name=\"w_descricao\" class=\"sti\" ROWS=3 cols=75 title=\"Observação sobre a aplicação.\">'.$w_descricao.'</TEXTAREA></td>');\r\n\r\n ShowHTML(' <tr valign=\"top\">');\r\n ShowHTML(' <td><b><u>C</u>onta contábil de débito:</b></br><input type=\"text\" name=\"w_cc_debito\" class=\"sti\" SIZE=\"11\" MAXLENGTH=\"25\" VALUE=\"'.$w_cc_debito.'\"></td>');\r\n ShowHTML(' <td><b><u>C</u>onta contábil de crédito:</b></br><input type=\"text\" name=\"w_cc_credito\" class=\"sti\" SIZE=\"11\" MAXLENGTH=\"25\" VALUE=\"'.$w_cc_credito.'\"></td>');\r\n \r\n ShowHTML(' <tr><td align=\"LEFT\" colspan=4><b>'.$_SESSION['LABEL_CAMPO'].':<BR> <INPUT ACCESSKEY=\"A\" class=\"sti\" type=\"PASSWORD\" name=\"w_assinatura\" size=\"30\" maxlength=\"30\" value=\"\"></td></tr>');\r\n ShowHTML(' <tr><td align=\"center\" colspan=\"3\" height=\"1\" bgcolor=\"#000000\"></TD></TR>');\r\n ShowHTML(' <tr><td align=\"center\" colspan=\"3\">');\r\n ShowHTML(' <input class=\"stb\" type=\"submit\" name=\"Botao\" value=\"Gravar\">');\r\n if ($P1==0) {\r\n ShowHTML(' <input class=\"STB\" type=\"button\" onClick=\"location.href=\\''.montaURL_JS($w_dir,'tesouraria.php?par=inicial&O=L&P1='.$P1.'&P2='.$P2.'&P3='.$P3.'&P4='.$P4.'&TP='.$TP.'&SG='.MontaFiltro('GET')).'\\';\" name=\"Botao\" value=\"Abandonar\">');\r\n } else {\r\n $sql = new db_getMenuData; $RS = $sql->getInstanceOf($dbms,$w_menu);\r\n ShowHTML(' <input class=\"stb\" type=\"button\" onClick=\"location.href=\\''.montaURL_JS($w_dir,$R.'&w_copia='.$w_copia.'&O=L&SG='.f($RS,'sigla').'&P1='.$P1.'&P2='.$P2.'&P3='.$P3.'&P4='.$P4.'&TP='.$TP.MontaFiltro('GET')).'\\';\" name=\"Botao\" value=\"Cancelar\">');\r\n }\r\n ShowHTML(' </td>');\r\n \r\n ShowHTML(' </tr>');\r\n ShowHTML(' </table>');\r\n ShowHTML(' </TD>');\r\n ShowHTML('</tr>');\r\n ShowHTML('</FORM>');\r\n } else {\r\n ScriptOpen('JavaScript');\r\n ShowHTML(' alert(\"Opção não disponível\");');\r\n ScriptClose();\r\n } \r\n ShowHTML('</table>');\r\n ShowHTML('</center>');\r\n Estrutura_Texto_Fecha();\r\n Estrutura_Fecha();\r\n Estrutura_Fecha();\r\n Estrutura_Fecha();\r\n Rodape();\r\n}", "public function contarInventario(){\n\t}", "public function show(FamilleProduit $familleProduit)\n {\n //\n }", "public function suprRegimentAppartenance()\n {\n //sécurité :\n $action = 'deleteFolderInformation';\n $error = AccessControll::checkRight($action);\n if ( empty($error) ){ //ok\n //on réccupère l'id à supr (clée primaire)\n $id = $this->request->getGetAttribute('id');\n //ajout d'une entrée dans le fichier de log\n $data = DossierManager::getAppartenanceByClef($id);\n $auth = AuthenticationManager::getInstance();\n $username = $auth->getMatricule();\n $type = 'appartenanceRegiment';\n self::logDeletedInformation($data, $username, $type);\n //on supprime (retourne le matricule)\n $matricule = DossierManager::suprRegimentAppartenanceById($id);\n //on réaffiche le dossier actualisé\n $dossier = DossierManager::getOneFromId($matricule);\n $prez = self::afficheDossierComplet($dossier);\n $this->response->setPart('contenu', $prez);\n } else{\n header(\"location: index.php\");\n die($error);\n }\n }", "public function Preferiti() {\n $session = Sessione::getInstance();\n if($session->isLoggedUtente()){\n $utente = $session->getUtente();\n $idutente = $utente->getId();\n $pm = FPersistentManager::getInstance();\n $ut = $pm->loadById(\"utente\", $idutente);\n $ricette = $ut->getPreferiti();\n if($ricette!=null){\n $msg = \"\";\n } else {\n $msg = \"Non hai ricette preferite\";\n }\n $view = new VPreferiti();\n $view->mostraPreferiti($ricette, $msg);\n\n } else {\n header('Location: /myRecipes/web/Utente/Login');\n }\n }", "function reporteCotizacion(){\n\t\t$this->procedimiento='adq.f_cotizacion_sel';\n\t\t$this->transaccion='ADQ_COTREP_SEL';\n\t\t$this->tipo_procedimiento='SEL';//tipo de transaccion\n\t\t$this->setCount(false);\n\t\t\n\t\t$this->setParametro('id_cotizacion','id_cotizacion','int4');\n\t\t\t\t\n\t\t//Definicion de la lista del resultado del query\n\t\t$this->captura('estado','varchar');\n\t\t$this->captura('fecha_adju','date');\n\t\t$this->captura('fecha_coti','date');\n\t\t$this->captura('fecha_entrega','date');\n\t\t$this->captura('fecha_venc','date');\n\t\t$this->captura('id_moneda','int4');\n\t\t$this->captura('moneda','varchar');\n\t\t$this->captura('id_proceso_compra','int4');\n\t\t$this->captura('codigo_proceso','varchar');\n\t\t$this->captura('num_cotizacion','varchar');\n\t\t$this->captura('num_tramite','varchar');\n\t\t$this->captura('id_proveedor','int4');\n\t\t$this->captura('desc_proveedor','varchar');\n\t\t$this->captura('id_persona','int4');\n\t\t$this->captura('id_institucion','int4');\n\t\t$this->captura('dir_per', 'varchar');\n\t\t$this->captura('tel_per1', 'varchar');\n\t\t$this->captura('tel_per2', 'varchar');\n\t\t$this->captura('cel_per','varchar');\n\t\t$this->captura('correo','varchar');\n\t\t$this->captura('nombre_ins','varchar');\n\t\t$this->captura('cel_ins','varchar');\n\t\t$this->captura('dir_ins','varchar');\n\t\t$this->captura('fax','varchar');\n\t\t$this->captura('email_ins','varchar');\n\t\t$this->captura('tel_ins1','varchar');\n\t\t$this->captura('tel_ins2','varchar');\t\t\n\t\t$this->captura('lugar_entrega','varchar');\n\t\t$this->captura('nro_contrato','varchar');\t\t\n\t\t$this->captura('numero_oc','varchar');\n\t\t$this->captura('obs','text');\n\t\t$this->captura('tipo_entrega','varchar');\n\t\t\n\t\t//Ejecuta la instruccion\n\t\t$this->armarConsulta();\n\t\t$this->ejecutarConsulta();\n\t\t\n\t\t//Devuelve la respuesta\n\t\treturn $this->respuesta;\n\t}", "function wtsCaddieDisp($ar){\n $caddie = $this->getCaddie();\n $mobile = false;\n $web = false;\n $source = $this->getSource();\n if ($source == self::$WTSORDER_SOURCE_SITE_INTERNET)\n $web = true;\n if ($source == self::$WTSORDER_SOURCE_SITE_MOBILE)\n $mobile = true;\n $offres = $this->modcatalog->listeOffres($mobile, $web);\n $caddie['offres'] = $offres;\n if ($this->customerIsPro()){\n $this->summarizeCaddie($caddie);\n }\n XShell::toScreen2('wts', 'caddie', $caddie);\n }", "public function accueil() {\r\n $tickets = $this->ticket->getTickets();\r\n $vue = new Vue(\"Accueil\");\r\n $vue->generer(array('tickets' => $tickets));\r\n }", "function afficher()\r\n\t{\r\n\t\t\r\n\t\tif (!empty($this->zones) || !empty($this->blocs) )\r\n\t\t{\r\n\t\t\t//:: On configure les zones obligatoires\r\n\t\t\t\tif (empty($this->zones['Menu_Log'])) $this->zone('Menu_Log', menu('membre'));\r\n\r\n\t\t\t\tif (empty($this->zones['description'])) $this->zone('description', DESCRIPTION);\r\n\t\t\t\tif (empty($this->zones['keywords'])) $this->zone('keywords', KEYWORDS);\r\n\t\t\t\t$this->zone('nom', NOM);\r\n\t\t\t\t\r\n\t\t\t\t// On s'occupe du chemin des fichiers\r\n\t\t\t\t$this->zone( 'baseUrl', URL ); $this->zone( 'design', $this->style );\r\n\t\t\t\t\r\n\t\t\t\tif (is_admin()) $this->zone('jvs-admin', '<script type=\"text/javascript\" src=\"javascript/-admin.js\"></script>');\r\n\t\t\t\t\r\n\t\t\t\t// Nouveaux messages \r\n\t\t\t\r\n\t\t\t\t// Antibug\r\n\t\t\t\tif ($this->zones['img_titre']!=\"<!-- rien -->\") $this->zone('img_titre', '<img src=\"theme/images/content.png\" class=\"title\" alt=\"\" />');\r\n\t\t\t\t\t\t\t\r\n\t\t\t// Ouverture du template //\r\n\t\t\t$fichier=$this->chemin.$this->template.'.tpl.php';\r\n\t\t\t$source = fopen($fichier, 'r');\r\n\t\t\t$this->design = fread($source, filesize ($fichier));\r\n\t\t\tfclose($source);\r\n\t\t\t\r\n\t\t\t// Parsage du template\r\n\t\t\tforeach ($this->zones as $zone => $contenu)\r\n\t\t\t{\r\n\t\t\t\t$this->design = preg_replace ('/{::'.$zone.'::}/', $contenu, $this->design);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Suppresion des {::xxxx::} inutilisées\r\n\t\t\t$this->design = preg_replace ('/{::[-_\\w]+::}/', '', $this->design);\r\n\r\n\t\t\t// On remplace les blocs par leurs contenus //\r\n\t\t\tforeach($this->blocs as $nomBloc => $occurences)\r\n\t\t\t{\r\n\t\t\t\tpreg_match( '#{--'.$nomBloc.'--}(.*){--/'.$nomBloc.'/--}#ms', $this->design, $contenuBloc );\r\n\t\t\t\t$contenuBloc=$contenuBloc[1];\r\n\t\t\t\t\r\n\t\t\t\t$idNewTab=0; unset($nomZones);\r\n\t\t\t\tforeach($occurences as $occurence => $zones)\r\n\t\t\t\t{\r\n\t\t\t\t\tif (!isset($nomZones))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$nomZones=$zones;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$i=0;\r\n\t\t\t\t\t\t$newBloc[$idNewTab]=$contenuBloc;\r\n\t\t\t\t\t\tforeach($zones as $remplacement)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$newBloc[$idNewTab]=preg_replace ('/{:'.$nomZones[$i].':}/', $remplacement, $newBloc[$idNewTab]);\r\n\t\t\t\t\t\t\t$i++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$idNewTab++;\r\n\t\t\t\t}\r\n\t\t\t\r\n\t\t\t\t$newContenuBloc=implode(\"\", $newBloc);\r\n\t\t\t\t$this->design = preg_replace ('#{--'.$nomBloc.'--}(.*){--/'.$nomBloc.'/--}#ms', $newContenuBloc, $this->design);\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Suppression des blocs inutilisés\r\n\t\t\t$this->design = preg_replace ('#{--(.*)--}(.*){--/(.*)/--}#ms', '', $this->design);\r\n\r\n\t\t\t\r\n\t\t\t// Affichage du résultat final\r\n\t\t\t//$this->design = preg_replace ('/('.CHR(9).'|'.CHR(13).'|'.CHR(10).')/', \"\", $this->design);\r\n\r\n\t\t\t// Affichage du résultat final\r\n\t\t\techo $this->design;\r\n\t\t}\r\n\t}", "public function RicercaPerIngredienti(){\n $pm = FPersistentManager::getInstance();\n $cibi = $pm->loadAllObjects();\n $view = new VRicerca();\n $view->mostraIngredienti($cibi);\n }", "public function setForAuteur()\n {\n //met à jour les proposition qui n'ont pas de base contrat et qui ne sont pas null\n /*PLUS BESOIN DE BASE CONTRAT\n \t\t$dbP = new Model_DbTable_Iste_proposition();\n \t\t$dbP->update(array(\"base_contrat\"=>null), \"base_contrat=''\");\n */\n\t \t//récupère les vente qui n'ont pas de royalty\n\t \t$sql = \"SELECT \n ac.id_auteurxcontrat, ac.id_livre\n , ac.id_isbn, ac.pc_papier, ac.pc_ebook\n , a.prenom, a.nom, c.type, IFNULL(a.taxe_uk,'oui') taxe_uk\n ,i.num\n , v.id_vente, v.date_vente, v.montant_livre, v.id_boutique, v.type typeVente\n , i.id_editeur, i.type typeISBN\n , impF.conversion_livre_euro\n FROM iste_vente v\n INNER JOIN iste_isbn i ON v.id_isbn = i.id_isbn \n INNER JOIN iste_importdata impD ON impD.id_importdata = v.id_importdata\n INNER JOIN iste_importfic impF ON impF.id_importfic = impD.id_importfic\n INNER JOIN iste_auteurxcontrat ac ON ac.id_isbn = v.id_isbn\n INNER JOIN iste_contrat c ON c.id_contrat = ac.id_contrat\n INNER JOIN iste_auteur a ON a.id_auteur = ac.id_auteur\n INNER JOIN iste_livre l ON l.id_livre = i.id_livre \n LEFT JOIN iste_royalty r ON r.id_vente = v.id_vente AND r.id_auteurxcontrat = ac.id_auteurxcontrat\n WHERE pc_papier is not null AND pc_ebook is not null AND pc_papier != 0 AND pc_ebook != 0\n AND r.id_royalty is null \";\n\n $stmt = $this->_db->query($sql);\n \n \t\t$rs = $stmt->fetchAll(); \n \t\t$arrResult = array();\n \t\tforeach ($rs as $r) {\n\t\t\t//calcule les royalties\n \t\t\t//$mtE = floatval($r[\"montant_euro\"]) / intval($r[\"nbA\"]);\n \t\t\t//$mtE *= floatval($r[\"pc_papier\"])/100;\n \t\t\tif($r[\"typeVente\"]==\"ebook\")$pc = $r[\"pc_ebook\"];\n \t\t\telse $pc = $r[\"pc_papier\"];\n $mtL = floatval($r[\"montant_livre\"])*floatval($pc)/100;\n //ATTENTION le taux de conversion est passé en paramètre à l'import et le montant des ventes est calculé à ce moment\n \t\t\t//$mtD = $mtL*floatval($r[\"taux_livre_dollar\"]);\n \t\t\t$mtE = $mtL*floatval($r['conversion_livre_euro']);\n //ajoute les royalties pour l'auteur et la vente\n //ATTENTION les taxes de déduction sont calculer lors de l'édition avec le taux de l'année en cours\n $dt = array(\"pourcentage\"=>$pc,\"id_vente\"=>$r[\"id_vente\"]\n ,\"id_auteurxcontrat\"=>$r[\"id_auteurxcontrat\"],\"montant_euro\"=>$mtE,\"montant_livre\"=>$mtL\n ,\"conversion_livre_euro\"=>$r['conversion_livre_euro']);\n\t \t\t$arrResult[]= $this->ajouter($dt\n ,true,true);\n //print_r($dt);\n \t\t}\n \t\t\n \t\treturn $arrResult;\n }", "public function RicercaAvanzata(){\n $view = new VRicerca();\n $view->mostraFiltri();\n }", "public function ListeFrontAction(){\n $em=$this->getDoctrine()->getManager();\n $part=$em->getRepository(Partenaire::class)->findAll();\n return $this->render('partenaire/listeFront.html.twig',[\n 'partenaire'=>$part\n ]);\n }", "function exec_suivi() {\n\t$id_auteur = (int) _request('id_auteur');\n\t$id_article = (int) _request('id_article');\n\t$nouv_auteur = (int) _request('nouv_auteur');\n\t$contexte = array();\n\t$idper = '';\n\t$nom = '';\n\t$prenom = '';\n\t$statutauteur = '6forum';\n\t$inscrit = '';\n\t$statutsuivi = '';\n\t$date_suivi = '';\n\t$heure_suivi = '';\n\n\t//Addon fields\n\t$sante_comportement = '';\n\t$alimentation = '';\n\t$remarques_inscription = '';\n\t$ecole = '';\n\t$places_voitures = '';\n\t$brevet_animateur = '';\n\t$historique_payement = '';\n\t$extrait_de_compte = '';\n\t$statut_payement = '';\n\t$tableau_exception = '';\n\t$recus_fiche_medical = '';\n $facture = '';\n $adresse_facturation = '';\n\n\n\t//----------- lire DB ---------- AND id_secteur=2\n\t$req = sql_select('id_article,idact,titre,date_debut', 'spip_articles', \"id_article=$id_article\");\n\tif ($data = sql_fetch($req)) {\n $idact = $data['idact'];\n\t\t$titre = $data['titre'];\n $date_debut = $data['date_debut'];\n\t}\n\telse\n\t\t$id_article = 0;\n\n\t$req = sql_select('*', \n \"spip_auteurs AS A LEFT JOIN spip_auteurs_articles AS S ON S.id_auteur=$id_auteur AND S.id_article=$id_article AND S.inscrit<>''\", \"A.id_auteur=$id_auteur\");\n\tif ($data = sql_fetch($req)) {\n\t\t$idper = $data['idper'];\n\t\t$nom = $data['nom'];\n\t\t$prenom = $data['prenom'];\n\t\t$statutauteur = $data['statut'];\n\t\tif ($data['inscrit']) {\n\t\t\t$inscrit = 'Y';\n\t\t\t$statutsuivi = $data['statutsuivi'];\n\t\t\t$date_suivi = $data['date_suivi'];\n\t\t\t$heure_suivi = $data['heure_suivi'];\n\n\t\t\t$sante_comportement = $data['sante_comportement'];\n\t\t\t$alimentation = $data['alimentation'];\n\t\t\t$remarques_inscription = $data['remarques_inscription'];\n\t\t\t$ecole = $data['ecole'];\n\t\t\t$places_voitures = $data['places_voitures'];\n\t\t\t$brevet_animateur = $data['brevet_animateur'];\n\t\t\t$historique_payement = $data['historique_payement'];\n\t\t\t$extrait_de_compte = $data['extrait_de_compte'];\n\t\t\t$statut_payement = $data['statut_payement'];\n\t\t\t$tableau_exception = $data['tableau_exception'];\n\t\t\t$recus_fiche_medical = $data['recus_fiche_medical'];\n\t\t\t$prix_special = $data['prix_special'];\n $facture = $data['facture'];\n $adresse_facturation = $data['adresse_facturation'];\n\t\t}\n\t}\n\telse\n\t\t$id_auteur = 0;\n\n\t//-------- form soumis -----------\n\tif (_request('okconfirm') && $id_article && ($id_auteur || $nouv_auteur))\n\t\tif ($GLOBALS['connect_statut']!='0minirezo' || ! autoriser('modifier', 'article', $id_article))\n\t\t\t$contexte['message_erreur'] = 'Autorisation refusée';\n\t\telse {\n\t\t\t$statutsuivi = _request('statutsuivi');\n\t\t\t$date_suivi = _request('date_suivi');\n\t\t\t$heure_suivi = _request('heure_suivi');\n \n $sante_comportement = _request('sante_comportement');\n $alimentation = _request('alimentation');\n $remarques_inscription = _request('remarques_inscription');\n $ecole = _request('ecole');\n $places_voitures = _request('places_voitures');\n $brevet_animateur = _request('brevet_animateur');\n $extrait_de_compte = _request('extrait_de_compte');\n $historique_payement = str_replace(',', '.', _request('historique_payement'));\n $statut_payement = _request('statut_payement');\n $tableau_exception = _request('tableau_exception');\n $recus_fiche_medical = _request('recus_fiche_medical');\n $prix_special = _request('prix_special');\n $facture = _request('facture');\n $adresse_facturation = _request('adresse_facturation');\n\n\t\t\tinclude_spip('inc/date_gestion');\n\t\t\t$contexte['erreurs'] = array();\n\t\t\tif (@verifier_corriger_date_saisie('suivi', false, $contexte['erreurs']))\n\t\t\t\t$date_suivi = substr($date_suivi, 6, 4).'-'.substr($date_suivi, 3, 2).'-'.substr($date_suivi, 0, 2);\n\t\t\telse\n\t\t\t\t$contexte['message_erreur'] = 'Erreur';\n\n\t\t\tif (! $contexte['message_erreur'])\n\t\t\t\tif ($nouv_auteur) {\n\t\t\t\t\t$req = sql_select('A.id_auteur,id_article',\"spip_auteurs AS A LEFT JOIN spip_auteurs_articles AS S ON S.id_auteur=$nouv_auteur AND S.id_article=$id_article\", \"A.id_auteur=$nouv_auteur\");\n\t\t\t\t\tif ($data = sql_fetch($req)) {\n\t\t\t\t\t\t$id_auteur = $data['id_auteur'];\n\t\t\t\t\t\tif (! $data['id_article'])\n\t\t\t\t\t\t\tsql_insertq('spip_auteurs_articles', array('id_auteur'=>$id_auteur, 'id_article'=>$id_article, 'inscrit'=>'Y'));\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t$contexte['message_erreur'] = 'Erreur';\n\t\t\t\t\t\t$contexte['erreurs']['nouv_auteur'] = 'auteur ID inconnu';\n\t\t\t\t\t\t$id_auteur = 0;\n\t\t\t\t\t\t$inscrit = '';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tif ($id_auteur && ! $contexte['message_erreur']) {\n\t\t\t\tsql_updateq('spip_auteurs_articles', \n array(\n \t\t'inscrit'=>'Y', \n \t\t'statutsuivi'=>$statutsuivi, \n \t\t'date_suivi'=>$date_suivi, \n \t\t'heure_suivi'=>$heure_suivi,\n \t'sante_comportement'=>$sante_comportement,\n \t'alimentation'=>$alimentation,\n \t'remarques_inscription'=>$remarques_inscription,\n \t'ecole'=>$ecole,\n \t'brevet_animateur'=>$brevet_animateur,\n \t'places_voitures'=>$places_voitures,\n \t'extrait_de_compte' => $extrait_de_compte,\n \t'historique_payement' => $historique_payement,\n \t'statut_payement' => $statut_payement,\n \t'tableau_exception' => $tableau_exception,\n \t'recus_fiche_medical' => $recus_fiche_medical,\n \t'prix_special' => $prix_special,\n 'facture' => $facture,\n 'adresse_facturation' => $adresse_facturation\n ), \"id_auteur=$id_auteur AND id_article=$id_article\");\n\n // On fait l'update de la date_validation via sql_update plutôt que sql_updateq.\n sql_update('spip_auteurs_articles', array('date_validation' => 'NOW()'), 'id_auteur='.sql_quote($id_auteur).' AND id_article='.sql_quote($id_article));\n\t\t\t\t$contexte['message_ok'] = 'Ok, l\\'inscription est mise à jour';\n\t\t\t\t$inscrit = 'Y';\n\n /*\n * Si c'est une nouvelle inscription faite par un admin, on envoie un mail\n */\n if (_request('new') == 'oui') {\n $p = 'Bonjour,'.\"\\n\\n\".'Voici une nouvelle inscription :'.\"\\n\\n\";\n $p .= 'Sexe : '.$data['codecourtoisie'].\"\\n\";\n $p .= 'Prénom : '.$prenom.\"\\n\";\n $p .= 'Nom : '.$nom.\"\\n\";\n $p .= 'e-mail : '.$data['email'].\"\\n\";\n $p .= 'Date naissance : '.$data['date_naissance'].\"\\n\";\n $p .= 'Lieu naissance : '.$data['lieunaissance'].\"\\n\";\n \n $p .= 'Adresse : '.$data['adresse'].\"\\n\";\n $p .= 'No : '.$data['adresse_no'].\"\\n\";\n $p .= 'Code postal : '.$data['codepostal'].\"\\n\";\n $p .= 'Localité : '.$data['localite'].\"\\n\";\n $p .= 'Téléphone : '.$data['tel1'].\"\\n\";\n $p .= 'GSM : '.$data['gsm1'].\"\\n\";\n $p .= 'Fax : '.$data['fax1'].\"\\n\";\n \n $p .= \"\\n*******\\n\\n\";\n \n $p .= 'Études en cours et établissement : '.$data['etude_etablissement'].\"\\n\";\n $p .= 'Profession : '.$data['profession'].\"\\n\";\n $p .= 'Demandeur d’emploi : '.$data['demandeur_emploi'].\"\\n\";\n $p .= 'Membre d’une association : '.$data['membre_assoc'].\"\\n\";\n $p .= 'Pratique : '.$data['pratique'].\"\\n\";\n $p .= 'Formations : '.$data['formation'].\"\\n\";\n $p .= 'Facture : '.$data['facture'].\"\\n\";\n $p .= 'Adresse de facturation : '.$data['adresse_facturation'].\"\\n\";\n $p .= 'Régime alimentaire : '.$alimentation.\"\\n\";\n $p .= 'Places dans votre voiture : '.$places_voitures.\"\\n\";\n $p .= 'Brevet d’animateur : '.$brevet_animateur.\"\\n\";\n $p .= 'Remarques : '.$remarques_inscription.\"\\n\";\n \n $p .= \"\\n*******\\n\\n\";\n \n $p .= 'id_auteur : '.$id_auteur.\"\\n\";\n $p .= 'Statut : '.$statutsuivi.\"\\n\";\n $p .= 'Action : '.$titre.\"\\n\";\n $p .= 'Dates : '.$date_debut.\"\\n\";\n $p .= 'id_article : '.$id_article.\"\\n\";\n $p .= \"\\n\".'-----'.\"\\n\";\n\n\n $envoyer_mail = charger_fonction('envoyer_mail','inc');\n \n $p = $envoyer_mail(\n $GLOBALS['meta']['email_webmaster'].', [email protected]',\n $GLOBALS['meta']['nom_site'].' : nouvelle inscription '.$data['idact'].'-'.$id_auteur, \n $p,\n $GLOBALS['meta']['email_webmaster']);\n \n }\n\n\n\t\t\t\tinclude_spip('inc/headers');\n\t\t\t\tredirige_par_entete(parametre_url('?exec=articles', 'id_article', $id_article, '&'));\n\t\t\t\texit();\n\t\t\t}\n\t\t}\n\n\t//-------- desinscrire -----------\n\tif (_request('noinscr') && $id_article && $id_auteur)\n\t\tif ($GLOBALS['connect_statut']!='0minirezo' || ! autoriser('modifier', 'article', $id_article))\n\t\t\t$contexte['message_erreur'] = 'Autorisation refusée';\n\t\telse {\n\t\t\tif ($statutauteur == '6forum')\n\t\t\t\tsql_delete('spip_auteurs_articles', \"id_auteur=$id_auteur AND id_article=$id_article\");\n\t\t\telse\n\t\t\t\tsql_updateq('spip_auteurs_articles', array('inscrit'=>''), \"id_auteur=$id_auteur AND id_article=$id_article\");\n\t\t\t$inscrit = '';\n\t\t\t$contexte['message_ok'] = 'Ok, la désinscription est faite';\n\t\t\tinclude_spip('inc/headers');\n\t\t\tredirige_par_entete(parametre_url('?exec=articles', 'id_article', $id_article, '&'));\n\t\t\texit();\n\t\t}\n\n\t//--------- page + formulaire ---------\n\t\t$commencer_page = charger_fonction('commencer_page', 'inc');\n\t\techo $commencer_page('Suivi des inscriptions', '', '');\n\n\t\techo '<br />',gros_titre('Suivi des inscriptions');\n\n\t\techo debut_gauche('', true);\n\t\techo debut_boite_info(true);\n\t\techo 'Suivi des inscriptions<br /><br />Explications',\"\\n\";\n\t\techo fin_boite_info(true);\n\n\t\techo debut_droite('', true);\n\n\t\tinclude_spip('fonctions_gestion_cemea');\n\t\tinclude_spip('prive/gestion_update_db');\n\n\t\techo debut_cadre_relief('', true, '', '');\n\n\t\t$contexte['id_article'] = $id_article;\n\t\t$contexte['id_auteur'] = $id_auteur;\n\t\t$contexte['idact'] = $idact;\n\t\t$contexte['titre'] = $titre;\n\t\t$contexte['idper'] = $idper;\n\t\t$contexte['nom'] = $nom;\n\t\t$contexte['prenom'] = $prenom;\n\t\t$contexte['inscrit'] = $inscrit;\n\t\t$contexte['statutsuivi'] = $statutsuivi;\n\t\t$contexte['date_suivi'] = $date_suivi;\n\t\t$contexte['heure_suivi'] = $heure_suivi;\n\n\t\t$contexte['sante_comportement'] = $sante_comportement;\n\t\t$contexte['alimentation'] = $alimentation;\n\t\t$contexte['remarques_inscription'] = $remarques_inscription;\n\t\t$contexte['ecole'] = $ecole;\n\t\t$contexte['places_voitures'] = $places_voitures;\n\t\t$contexte['brevet_animateur'] = $brevet_animateur;\n\t\t$contexte['extrait_de_compte'] = $extrait_de_compte;\n\t\t$contexte['historique_payement'] = str_replace('.', ',', $historique_payement);\n\t\t$contexte['statut_payement'] = $statut_payement;\n\t\t$contexte['tableau_exception'] = $tableau_exception;\n\t\t$contexte['recus_fiche_medical'] = $recus_fiche_medical;\n\t\t$contexte['prix_special'] = $prix_special;\n $contexte['facture'] = $facture;\n $contexte['adresse_facturation'] = $adresse_facturation;\n\n\t\t$contexte['editable'] = ' ';\n\n\t\t$milieu = recuperer_fond(\"prive/form_suivi\", $contexte);\n\t\techo pipeline('editer_contenu_objet',array('args'=>array('type'=>'auteurs_article','contexte'=>$contexte),'data'=>$milieu));\n\n\t\techo fin_cadre_relief(true);\n\t\techo fin_gauche();\n\t\techo fin_page();\n}", "function ctrlChoix($ar){\n $p = new XParam($ar, array());\n $ajax = $p->get('_ajax');\n $offre = $p->get('offre');\n $wtspool = $p->get('wtspool');\n $wtsvalidfrom = $p->get('wtsvalidfrom');\n $wtsperson = $p->get('wtspersonnumber');\n $wtsticket = $p->get('wtsticket');\n $context = array('wtspersonnumber'=>$wtsperson);\n $r = (object)array('ok'=>1, 'message'=>'', 'iswarn'=>0);\n // on recherche toutes les offres proposant un meilleur prix\n $bestoffers = array();\n $bettertickets = array();\n $betterproducts = array();\n // si nb = zero : ne pas prendre en compte\n foreach($wtsperson as $personoid=>$personnb){\n if (empty($personnb) || $personnb<1){\n\tunset($context['wtspersonnumber'][$personoid]);\n }\n }\n foreach($wtsperson as $personoid=>$personnb){\n if (empty($personnb) || $personnb<1){\n continue;\n }\n $dp = $this->modcatalog->displayProduct($offre, $wtspool, $wtsticket, $personoid);\n if ($dp == NULL)\n continue;\n $bp = $this->modcatalog->betterProductPrice($wtsvalidfrom, NULL, $context, $dp);\n // les différentes offres trouvées\n if ($bp['ok'] && !isset($bestoffers[$bp['product']['offer']['offrename']])){\n $bestoffers[$bp['product']['offer']['offrename']] = $bp['product']['offer']['offeroid'];\n }\n // meilleur produit par type de personne ...\n if ($bp['ok']){\n\t$bpd = $this->modcatalog->displayProductQ($bp['product']['oid']);\n\t$betterproducts[] = array('nb'=>$personnb, 'oid'=>$bp['product']['oid'], '');\n\t$bettertickets[$bp['product']['oid']] = array('currentprice'=>$bp['product']['currentprice'], \n\t\t\t\t\t\t 'betterprice'=>$bp['product']['price']['tariff'],\n\t\t\t\t\t\t 'label'=>$bpd['label'], \n\t\t\t\t\t\t 'offer'=>$bp['product']['offer']['offrename'],\n\t\t\t\t\t\t 'offeroid'=>$bp['product']['offer']['offeroid']);\n }\n }\n if (count($bestoffers)>0){\n $r->offers = array_keys($bestoffers);\n $r->message = implode(',', $r->offers);\n $r->nboffers = count($r->offers);\n $r->offeroids = array_values($bestoffers);\n $r->bettertickets = $bettertickets;\n $r->iswarn = 1;\n $r->ok = 0;\n $r->redirauto = false;\n // on peut enchainer vers une meilleure offre ?\n if ($r->nboffers == 1 && (count($betterproducts) == count($context['wtspersonnumber']))){\n\t$r->redirauto = true;\n\t$r->redirparms = '&offre='.$r->offeroids[0].'&validfrom='.$wtsvalidfrom;\n\tforeach($betterproducts as $bestproduct){\n\t $r->redirparms .= '&products['.$bestproduct['oid'].']='.$bestproduct['nb'];\n\t}\n }\n }\n if ($ajax)\n die(json_encode($r));\n return $r;\n }", "public function transactPartenaire()\n {\n $data['liste_part'] = $this->partenaireModels->getPartenaire();\n $this->views->setData($data);\n $param['part'] = $this->paramPOST['fk_partenaire'];\n\n if (isset($this->paramPOST[\"datedeb\"]) & isset($this->paramPOST[\"datefin\"])) {\n\n $param['datedeb'] = Utils::date_aaaa_mm_jj($this->paramPOST['datedeb']) ;\n $param['datefin'] = Utils::date_aaaa_mm_jj($this->paramPOST['datefin']);\n\n }else{\n $param['datedeb'] = date('Y-m-d');\n $param['datefin'] = date('Y-m-d');\n }\n\n $this->views->setData($param);\n $this->views->getTemplate('reporting/transactPartenaire');\n }", "public function cercaP() {\r\n $operatore = $_SESSION[\"op\"];\r\n $ruolo = $operatore->getFunzione();\r\n\r\n $ricerca = array();\r\n $ricerca[\"numeroPratica\"] = isset($_REQUEST[\"numeroPratica\"]) ? $_REQUEST[\"numeroPratica\"] : null;\r\n $ricerca[\"statoPratica\"] = isset($_REQUEST[\"statoPratica\"]) ? $_REQUEST[\"statoPratica\"] : null;\r\n $ricerca[\"tipoPratica\"] = isset($_REQUEST[\"tipoPratica\"]) ? $_REQUEST[\"tipoPratica\"] : null;\r\n $ricerca[\"incaricato\"] = isset($_REQUEST[\"incaricato\"]) ? $_REQUEST[\"incaricato\"] : null;\r\n $ricerca[\"flagAllaFirma\"] = isset($_REQUEST[\"flagAllaFirma\"]) ? $_REQUEST[\"flagAllaFirma\"] : null;\r\n $ricerca[\"flagFirmata\"] = isset($_REQUEST[\"flagFirmata\"]) ? $_REQUEST[\"flagFirmata\"] : null;\r\n $ricerca[\"flagInAttesa\"] = isset($_REQUEST[\"flagInAttesa\"]) ? $_REQUEST[\"flagInAttesa\"] : null;\r\n $ricerca[\"flagSoprintendenza\"] = isset($_REQUEST[\"flagSoprintendenza\"]) ? $_REQUEST[\"flagSoprintendenza\"] : null;\r\n $offset = isset($_REQUEST[\"offset\"]) ? $_REQUEST[\"offset\"] : 0;\r\n $numero = isset($_REQUEST[\"numero\"]) ? $_REQUEST[\"numero\"] : 15;\r\n $richiestaFirmate = isset($_REQUEST[\"richiestaFirmate\"]) ? $_REQUEST[\"richiestaFirmate\"] : 0;\r\n\r\n if ($ruolo < 2) {\r\n $ricerca[\"incaricato\"] = $operatore->getId();\r\n }\r\n\r\n //$numeroPratiche = PraticaFactory::numeroTotalePratiche();\r\n $numeroPratiche= PraticaFactory::elencoNumeroP($ricerca);\r\n \r\n if ($offset >= $numeroPratiche) {\r\n $offset = 0;\r\n }\r\n if ($offset < 1) {\r\n $offset = 0;\r\n }\r\n\r\n if ($richiestaFirmate === 0) {\r\n $href = '<a href=\"index.php?page=operatore&cmd=aggiornaP&numeroP=';\r\n } elseif ($ruolo > 2) {\r\n $href = '<a href=\"index.php?page=responsabile&cmd=firmaP&numeroP=';\r\n }\r\n\r\n $pratiche = PraticaFactory::elencoP($ricerca, $offset, $numero);\r\n \r\n $x = count($pratiche);\r\n $data = \"\";\r\n for ($i = 0; $i < $x; $i++) {\r\n $data.= \"<tr class=\\\"\" . ($i % 2 == 1 ? \"a\" : \"b\") . \"\\\"><td>\" . $href\r\n . $pratiche[$i]->getNumeroPratica() . \"\\\">\" . $pratiche[$i]->getNumeroPratica() . \"</a></td>\"\r\n . \"<td>\" . $pratiche[$i]->getDataCaricamento(true) . \"</td>\"\r\n . \"<td>\" . $pratiche[$i]->getRichiedente() . \"</td>\"\r\n . \"<td>\" . PraticaFactory::tipoPratica($pratiche[$i]->getTipoPratica()) . \"</td>\"\r\n . \"<td>\" . PraticaFactory::statoPratica($pratiche[$i]->getStatoPratica()) . \"</td>\"\r\n . \"<td>\" . OperatoreFactory::getOperatore($pratiche[$i]->getIncaricato())->getNominativo() . \"</td>\"\r\n . \"</tr>\";\r\n }\r\n\r\n header('Cache-Control: no-cache, must-revalidate');\r\n header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');\r\n header('Content-type: application/json');\r\n $json = array();\r\n $json[\"testo\"] = $data;\r\n $json[\"numeroPratiche\"] = $numeroPratiche;\r\n $json[\"numRow\"] = $x;\r\n echo json_encode($json);\r\n }", "public static function stockAttribu() {\n $results = ModelStockAttribu::getAllIdcentre();\n $results1= ModelStockAttribu::getAllIdvaccin();\n // ----- Construction chemin de la vue\n include 'config.php';\n $vue = $root . '/app/view/stock/viewAttribution.php';\n require ($vue);\n }", "public function cercaPrenotazioni() {\r\n $fPrenotazioni = USingleton::getInstance('FPrenotazione');\r\n return $fPrenotazioni->cercaPrenotazioniClinica($this->_partitaIVA);\r\n }", "public function show(AttributProduit $attributProduit)\n {\n //\n }", "public function stampaDipendenti() {\n echo '<p> Nome: ' . $this->nome . '</p>';\n echo '<p> Cognome: ' . $this->cognome . '</p>';\n echo '<p> Software utilizzati: ' . $this->software . '</p>';\n }", "private function getCodigoPresupuestarioPropagandaComercial()\r\n\t\t{\r\n\t\t\t$codigoPresupuesto['codigo'] = '301020900';\r\n\t\t\treturn $codigo = self::getCodigoPresupuestarioByCodigo($codigoPresupuesto['codigo']);\r\n\t\t}", "function showMenu(){\n\t\t//\t con su respectivo tipo\n\n\t\t\t$cadena_sql=$this->sql->cadena_sql(\"userByID\",$this->idUser);\n\t\t\t$user=$this->miRecursoDB->ejecutarAcceso($cadena_sql,\"busqueda\");\n\n\t\t\t$cadena_sql=$this->sql->cadena_sql(\"commerceByUser\",$this->idUser);\n\t\t\t$commerceList=$this->miRecursoDB->ejecutarAcceso($cadena_sql,\"busqueda\");\n\t\t\t$total=count($commerceList);\n\n\t\t//2. Traigo listado de tipos de comercio\n\n\t\t\t$cadena_sql=$this->sql->cadena_sql(\"commerceTypes\",$this->idUser);\n\t\t\t$commerceTypes=$this->miRecursoDB->ejecutarAcceso($cadena_sql,\"busqueda\");\n\t\t\t$commerceTypes=$this->orderArrayKeyBy($commerceTypes,'IDTYPE',TRUE);\n\n\t\t//3. Separo comercios dependiendo del tipo\n\n\t\t\t$commercesByType=$this->orderArrayKeyBy($commerceList,'TYPECOMMERCE');\n\t\t\t/*echo \"<pre>\";\n\t\t\tvar_dump($commercesByType);\n\t\t\techo \"</pre>\";*/\n\n\t\t//4. Verifico si existe alguna peticion de tipo de comercio o si esta almacenado en sesion\n\n\t\t\t$typeSession=$this->miSesion->getValorSesion('typecommerce');\n\n\t\t\tif(isset($_REQUEST['typecommerce'])){\n\t\t\t\t$currentType=$_REQUEST['typecommerce'];\n\t\t\t}elseif($typeSession<>\"\"){\n\t\t\t\t$currentType=$typeSession;\n\t\t\t}else{\n\t\t\t\t$currentType=$commerceList[0]['TYPECOMMERCE'];\n\t\t\t}\n\n\n\t\t//5.Filtro comercios de acuerdo al actual tipo\n\t\t// y los tipos de acuerdo a los tipos permitidos\n\n\t\t\t$commerceList=$commercesByType[$currentType];\n\t\t\t$typesList=array_keys($commercesByType);\n\n\t\t//6.Verifico si existe algun comercio almacenado en sesion\n\n\t\t\t$commerce=$this->miSesion->getValorSesion('commerce');\n\n\n\t\t\tif(!isset($_REQUEST['commerce']) || $_REQUEST['commerce']==\"\"){\n\t\t\t\t$_REQUEST['commerce']=$commerceList[0]['IDCOMMERCE'];\n\t\t\t}\n\n\t\tif($this->miSesion->getValorSesion('dbms')==\"\"){\n\n\t\t\t$this->miSesion->guardarValorSesion('commerce',$_REQUEST['commerce']);\n\t\t\t$this->miSesion->guardarValorSesion('typecommerce',$currentType);\n\t\t\t$this->miSesion->guardarValorSesion('dbms',$commerceList[0]['DBMS']);\n\n\t\t\t//echo \"<script>location.reload()</script>\";\n\n\t\t}\n\n\t\tif(!isset($_REQUEST['saramodule'])){\n\n\t\t\t$formSaraData=\"pagina=\".$this->miConfigurador->getVariableConfiguracion(\"pagina\");\n\t\t\t$formSaraData.=\"&saramodule=\".$commerceList[0]['DBMS'];\n\t\t\t$formSaraData=$this->miConfigurador->fabricaConexiones->crypto->codificar_url($formSaraData,$this->enlace);\n\t\t\techo \"<script>location.replace('\".$formSaraData.\"')</script>\";\n\t\t}\n\n\t\t$formSaraDataCommerce=\"bloque=master\";\n\t\t$formSaraDataCommerce.=\"&bloqueGrupo=gui\";\n\t\t$formSaraDataCommerce.=\"&currentPage=\".$this->miConfigurador->getVariableConfiguracion(\"pagina\");\n\t\t$formSaraDataCommerce.=\"&currentModule=\".$this->miConfigurador->getVariableConfiguracion(\"module\");\n\t\t$formSaraDataCommerce.=\"&action=master\";\n\t\t$formSaraDataCommerce=$this->miConfigurador->fabricaConexiones->crypto->codificar($formSaraDataCommerce);\n\n\t\t/*\n\t\t$menuList=$this->orderArrayKeyBy($menuList,\"PADRE\");\n\n\t\t$cadena_sql=$this->sql->cadena_sql(\"roleList\");\n\t\t$roleList=$this->miRecursoDB->ejecutarAcceso($cadena_sql,\"busqueda\");\n\t\t*/\n\t\t$linkEnd=$userName=$rutaTema=\"\";\n\n\t\tif($total>1){\n\t\t\tinclude_once($this->ruta.\"/html/menu.php\");\n\t\t}\n\t}", "public function TresorieEntreprise() {\n \n $em = $this->getDoctrine()->getManager();\n $entityEntreprise= $em->getRepository('RuffeCardUserGestionBundle:Entreprise')->findClientNoPaiment();\n return $this->render ( \"RuffeCardTresorieBundle:Default:entreprisePaiement.html.twig\", array ('Entreprise'=>$entityEntreprise));\n \n }", "public static function modificaProfiloAzienda()\n {\n $vd = new ViewDescriptor();\n $vd->setTitolo(\"SardiniaInFood: Profilo\");\n $vd->setLogoFile(\"../view/in/logo.php\");\n $vd->setMenuFile(\"../view/in/menu_modifica_profilo.php\");\n $vd->setContentFile(\"../view/in/azienda/modifica_profilo_azienda.php\");\n $vd->setErrorFile(\"../view/in/error_in.php\");\n $vd->setFooterFile(\"../view/in/footer_empty.php\");\n \n require_once \"../view/Master.php\";\n }", "public function factureAction()\n {//on stocke la vue à convertir en PDF, en n'oubliant pas les paramètres twig si la vue comporte des données dynamiques\n\t\t$html = $this -> render('GestionAdminBundle:Offre:facture.html.twig');\n\t//le sens de la page \"portrait\" => p ou \"paysage\" => l\n\t\t//le format A4,A5...\n\t\t//la langue du document fr,en,it...\n\t\t$html2pdf = $this -> get('html2pdf_factory') -> create();\n\t\t$html2pdf = $this -> get('html2pdf_factory') -> create('P', 'A4', 'fr', true, 'UTF-8', array(10, 15, 10, 15));\n\t\t//SetDisplayMode définit la manière dont le document PDF va être affiché par l’utilisateur\n\t\t//fullpage : affiche la page entière sur l'écran\n\t\t//fullwidth : utilise la largeur maximum de la fenêtre\n\t\t//real : utilise la taille réelle\n\t\t$html2pdf -> pdf -> SetDisplayMode('real');\n\t\t//writeHTML va tout simplement prendre la vue stocker dans la variable $html pour la convertir en format PDF\n\t\t$html2pdf -> writeHTML($html);\n\t\t//Output envoit le document PDF au navigateur internet avec un nom spécifique qui aura un rapport avec le contenu à convertir (exemple : Facture, Règlement…)\n\t\t$html2pdf -> Output('Factureyy.pdf'); \n \n \n \n\t\treturn new Response();\n }", "public function compteenattente()\n {\n $this->utils->Restreindre($this->userConnecter->admin, $this->utils->Est_autoriser(37, $this->userConnecter->profil));\n $data['lang'] = $this->lang->getLangFile($this->getSession()->getAttribut('lang'));\n $params = array('view' => 'compte/compteenattente');\n $this->view($params, $data);\n }", "function wtssaisieforfaits($ar){\n $p = new XParam($ar, array());\n $offre = $p->get('offre');\n // lecture des informations à partir des produits (oid=>nb) \n // par exemple si appel offre de meilleur prix\n if ($p->is_set('products')){\n $products = $p->get('products');\n $wtsvalidfrom = $p->get('validfrom');\n $perror = false;\n $wtspools = array();\n $wtspersons = array();\n $wtstickets = array();\n foreach($products as $poid=>$pnb){\n\t$rsp = selectQuery('select wtspool, wtsperson, wtsticket from '.self::$tableCATALOG.' where PUBLISH=1 and LANG=\"FR\" and KOID=\"'.$poid.'\"');\n\tif($rsp->rowCount() != 1){\n\t XLogs::critical(get_class($this). '::wtssaisieforfaits erreur appel via produits produit : '.$poid);\n\t $perror = true;\n\t}\n\t$orsp = $rsp->fetch();\n\t$wtspools[] = $orsp['wtspool'];\n\t$wtstickets[] = $orsp['wtsticket'];\n\t$wtspersons[$orsp['wtsperson']] = $pnb;\n }\n $rsp->closeCursor();\n unset($orsp);\n unset($products);\n unset($poid);\n unset($pnb);\n $wtspool = array_unique($wtspools);\n $wtsticket = array_unique($wtstickets);\n if (count($wtspool) != 1 || count($wtsticket) != 1){\n\t XLogs::critical(get_class($this). '::wtssaisieforfaits erreur appel via produits plusieurs pools, plusieurs tickets '.implode($wtspools).' '.implode($wtstickets));\n\t $perror = true;\n }\n $wtspool = $wtspools[0];\n $wtsticket = $wtstickets[0];\n $wtsperson = $wtspersons;\n unset($wtspools);\n unset($wtstickets);\n unset($wtspersons);\n if ($perror){\n\tXLogs::critical(get_class($this). '::wtssaisieforfaits erreur appel via produits');\n\tXShell::setNext($GLOBALS['HOME_ROOT_URL']);\n\treturn;\n }\n } else {\n $wtspool = $p->get('wtspool');\n $wtsperson = $p->get('wtspersonnumber');\n $wtsticket = $p->get('wtsticket');\n $wtsvalidfrom = $p->get('wtsvalidfrom');\n }\n $personpackid = uniqid('ppid_');\n $tpl = 'wts';\n // l'offre doit être valide\n if (!$this->modcatalog->validOffer($offre)){\n XLogs::critical(get_class($this). '::wtssaisieforfaits acces offre offline ');\n XShell::setNext($GLOBALS['HOME_ROOT_URL']);\n return;\n }\n if ($p->is_set('wtspersonnumbermo')){\n unset($_REQUEST['wtspersonnumber']);\n $_REQUEST['wtspersonnumber'] = $wtsperson = array($p->get('wtspersonnumbermo')=>1);\n }\n $lines = array();\n // saison\n $season = $this->getSeason();\n // lecture de l'offre en cours\n $doffre = $this->modcatalog->displayOffre(array('_options'=>array('local'=>true),\n\t\t\t\t\t\t 'tplentry'=>$tpl.'_offre',\n\t\t\t\t\t\t 'offre'=>$offre,\n\t\t\t\t\t\t 'caddie'=>true\n\t\t\t\t\t\t )\n\t\t\t\t\t );\n // correction saison dans le cas des offres flashs\n if ($doffre['doffre']['oflash']->raw == 1){\n $season['odatedeb'] = $season['odatedebflash'];\n $season['odelaitrans'] = $season['odelaitransflash'];\n $season['odelaifab'] = $season['odelaifabflash'];\n }\n // premier jour de ski pour controle des dispo cartes\n $firstdaynewcard = $this->getFirstDayNewCard($season);\n\n // lecture des produits (pour ensuite avoir le prix)\n foreach($wtsperson as $personoid=>$personnb){\n if (empty($personnb) || $personnb<1)\n continue;\n $dp = $this->modcatalog->displayProduct($offre, $wtspool, $wtsticket, $personoid);\n if ($dp == NULL)\n continue;\n $dpc = $this->modcatalog->getPrdConf($dp);\n// jcp, bloquant, c'est sur le module => xmodeplspecialoffer::getSpecialOffer\n// $dpsp = $this->dsspoffer->getSpecialOffer($dp);\n\n // ajout des assurances ...\n $assur = $this->modcatalog->getProductAssurance($dp, $dpc);\n\n // ajout des prix de cartes si achat possible a cette date pour ce produit\n $newcard = $this->modcatalog->getNewCard($dp, $dpc, $wtsvalidfrom);\n $availablesNewCards = $this->modcatalog->getAvailablesNewCards($dp, $dpc, $wtsvalidfrom, $firstdaynewcard);\n // recherche des prix fidelite (complements sur le bloc forfait)\n $loyaltymess = $loyaltyprice = $loyaltyProductOid = NULL;\n if ($this->modcustomer->loyaltyActive()){\n list($loyaltymess, $loyaltyprice, $loyaltyProductOid) = $this->modcustomer->preCheckLoyaltyReplacementProduct(array('season'=>$season, 'doffre'=>$doffre['doffre'], 'dp'=>$dp, 'dpc'=>$dpc, 'validfrom'=>$wtsvalidfrom, 'availablesNewCards'=>$availablesNewCards));\n }\n // creation des lignes pour chaque personne\n for($i = 0; $i<$personnb; $i++){\n $lines[] = array('assur'=>$assur,\n 'personpackid'=>$personpackid,\n 'productconf'=>$dpc,\n 'validfrom'=>$wtsvalidfrom,\n 'product'=>$dp,\n 'newcard'=>$newcard, /* a virer */\n 'availablesnewcards'=>$availablesNewCards,\n 'id'=>'line_'.str_replace(':', '', $dp['oid']).sprintf('_%04d', $i),\n 'label'=>$dp['owtsperson']->link['olabel']->raw.' '.($i+1),\n 'amin'=>$dp['owtsperson']->link['oamin']->raw,\n 'amax'=>$dp['owtsperson']->link['oamax']->raw,\n\t\t\t 'personoid'=>$dp['owtsperson']->raw,\n 'saisieident'=>$dp['owtsperson']->link['osaisieident']->raw,\n 'saisiedob'=>$dp['owtsperson']->link['osaisiedob']->raw,\n 'loyaltyproductoid'=>($loyaltyProductOid == NULL)?false:$loyaltyProductOid,\n 'loyaltyprice'=>($loyaltyProductOid == NULL)?false:$loyaltyprice,\n 'loyaltymess'=>($loyaltyProductOid != NULL && $loyaltymess != 'found')?$loyaltymess:false);\n }\n }\n \n // lecture des prix par validfrom/produit\n // calcul validtill\n // disponbilité des cartes / validfrom : forfaits déja présent, delais (cas des nouvelles cartes)\n $caddie = $this->getCaddie();\n $carddispo = $caddie['cards'];\n foreach($lines as $il=>&$line){\n $t = $this->modcatalog->getProductTariff($line['product'], $wtsvalidfrom);\n $line['validtill'] = $this->getValidtill($line['validfrom'], $line['product'], $line['productconf']);\n if ($t['tariff'] != 'NOT FOUND'){\n $line['price'] = $t['tariff'];\n } else {\n $line['price'] = 'NOT FOUND';\n }\n foreach($caddie['lines'] as $lineid=>$pline){\n // exclusions par date de forfaits\n if ($pline['type'] == 'forfait'){\n if (($pline['validfrom']<=$line['validtill'] && $line['validtill']<=$pline['validtill']) || \n\t ($pline['validfrom'] <= $line['validfrom'] && $line['validfrom'] <= $pline['validtill']))\n $carddispo[$pline['cardid']] = false;\n }\n // exclusion par nombre (? a paramétrer ?)\n if (count($caddie['bycards'][$pline['cardid']]['cardlines'])>=3){\n $carddispo[$pline['cardid']] = false;\n }\n // exclusion par type de carte \n }\n /* -- vente de cartes seules -- */\n /* et de toute façon */\n foreach($caddie['bycards'] as $cardid=>$carditems){\n if ($carditems['newcard'] !== false && $line['validfrom']<=$firstdaynewcard)\n $carddispo[$cardid] = false;\n }\n $line['cardsdispo'] = $carddispo;\n }\n unset($line);\n // calcul du meilleur prix (si l'offre ne l'interdit pas)\n if ($doffre['doffre']['obetterprice'] && $doffre['doffre']['obetterprice']->raw == 1){\n $rbo = $this->ctrlChoix($ar);\n if ($r->ok == 0){\n XShell::toScreen2($tpl, 'betteroffers', $rbo);\n }\n }\n // gestion du compte client : raccourcis\n if (!empty($this->aliasmyaccount)){\n $custcards = $this->modcustomer->dispCustCards();\n if (count($custcards['custcardnos'])>0)\n XShell::toScreen2($tpl, 'custcards', $custcards);\n } \n // totaux car catégories (pour offre pro entre autres)\n $summary = array('lines'=>array(), 'totforfait'=>0, 'needAssur'=>false, 'needDob'=>false, 'needIdent'=>false);\n foreach($lines as $il=>$aline){\n $aproductoid = $aline['product']['oid'];\n if (!isset($summary['lines'][$aproductoid])){\n $summary['lines'][$aproductoid] = array('label'=>$aline['product']['label'], 'nb'=>0, 'price'=>$aline['price'], 'tot'=>0);\n }\n $summary['lines'][$aproductoid]['nb'] += 1;\n $summary['lines'][$aproductoid]['tot'] += $aline['price'];\n $summary['totforfait'] += $aline['price'];\n if (isset($aline['assur']))\n $summary['needAssur'] = true;\n if ($aline['saisieident'] == 1)\n $summary['needIdent'] = true;\n if ($aline['saisiedob'] == 1)\n $summary['needDob'] = true;\n }\n // cas offre saisie modification de skieurs ! offre \"coherente ?\" \n $advanced = array('on'=>false);\n if (isset($doffre['doffre']['oadvancedinput']) && $doffre['doffre']['oadvancedinput']->raw == 1){\n //&& count($caddie['lines']) == 0){ \n $advanced['on'] = true;\n $this->defaultStepTemplates['commande2'] = $this->templatesdir.'choix-produit2.html';\n foreach($lines as $il=>&$line){\n\tforeach($doffre['tickets'] as $ticketoid=>$aticket){\n\t if (in_array($wtspool, $aticket['pools'])){\n\t $odp = $this->modcatalog->displayProduct($offre, $wtspool, $ticketoid, $line['personoid']);\n\t if ($odp != NULL){\n\t $line['advanced']['calendar'] = $this->modcatalog->configureOneCalendar($season, array($opd['oprdconf']), $doffre['doffre']);\n\t if ($line['product']['owtsticket']->raw == $ticketoid){\n\t\t$aticket['selected'] = true;\n\t }\n\t $aticket['productoid'] = $odp['oid'];\n\t $line['advanced']['tickets'][$ticketoid] = $aticket;\n\t }\n\t }\n\t}\n }\n }\n XShell::toScreen2($tpl, 'advanced', $advanced);\n XShell::toScreen2($tpl, 'summary', $summary);\n //\n XShell::toScreen2($tpl, 'lines', $lines);\n // blocage du pave haut\n XShell::toScreen1($tpl.'_offre', $doffre);\n XShell::toScreen2($tpl.'_offre', 'lock', true);\n\n // valeurs choisies\n $choix = array('wtsvalidfrom'=>$wtsvalidfrom,\n 'wtspool'=>$wtspool,\n 'wtspersonnumber'=>$wtsperson,\n 'wtsticket'=>$wtsticket);\n\n XShell::toScreen2($tpl.'_offre', 'current', $choix);\n\n $choix['wtsoffre'] = $offre;\n setSessionVar('wts_offre_current', $choix);\n\n $_REQUEST['insidefile'] = $this->defaultStepTemplates['commande2'];\n $this->setOffreLabels($doffre['doffre']);\n $this->wtscallback();\n\n }", "public function show(ProduitEntrer $produitEntrer)\n {\n //\n }", "public function transactServicePro__()\n {\n //var_dump($this->paramGET); die();\n $param = [\n \"button\" => [\n \"modal\" => [\n [\"reporting/detailTransactServModal\", \"reporting/detailTransactServModal\", \"fa fa-search\"],\n ],\n \"default\" => [\n ]\n ],\n \"tooltip\" => [\n \"modal\" => [\"Détail\"]\n ],\n \"classCss\" => [\n \"modal\" => [],\n \"default\" => [\"confirm\"]\n ],\n \"attribut\" => [],\n \"args\" => $this->paramGET,\n \"dataVal\" => [\n ],\n \"fonction\" => [\"date_transaction\"=>\"getDateFR\",\"montant\"=>\"getFormatMoney\",\"commission\"=>\"getFormatMoney\"]\n ];\n $this->processing($this->reportingModels, 'getAllTransactionService', $param);\n }", "public function actionAfficherecartcomptage()\n {\n \t$i=0;\n \t$cpt1=0;\n \t$cpt2=0;\n \t$cpttotal=0;\n \t$cptstr=0;\n \t$data=null;\n \t$model= new Inventorier();\n \t$searchModel = new InventorierSearch();\n \t$dataProvider = $searchModel->search(Yii::$app->request->queryParams);\n \t$cpttotal=$dataProvider->getTotalCount();\n \t$models=$dataProvider->getModels();\n \t\n \t/**************************traiter ecart entre les deux comptages **************************************/\n \t\n \t$selection=(array)Yii::$app->request->post('selection');//typecasting\n \t\n \tforeach($selection as $id)\n \t{\n \t\t$modeltr=$this->findModel($id);\n \t\t$modeltr->comptage1='1';\n \t\t$modeltr->comptage2='1';\n \t\t$modeltr->save();\n \t\t\n \t\t\n \t\t\n \t}\n \t\n \tif ($model->load(Yii::$app->request->post()))\n \t{\n \t\t$querystr = Structure::find();\n \t\t\n \t\t$dataProviderstr = new ActiveDataProvider([\n \t\t\t\t'query' => $querystr,\n \t\t\t\t]);\n \t\t$modelsstr=$dataProviderstr->getModels();\n \t\tforeach ($modelsstr as $rowstr)\n \t\t{\n \t\t\tif(intval($model->codestructure)==$rowstr->codestructure)\n \t\t\t{\n \t\t\t\t$model->designationstructure=$rowstr->designation;\n \t\t\t}\n \t\t}\n \t\t\n \t\t$searchModelbur = new BureauSearch();\n \t\t$dataProviderbur = $searchModelbur->search(Yii::$app->request->queryParams);\n \t\t$modelsbur=$dataProviderbur->getModels();\n \t\tforeach ($modelsbur as $rowbur)\n \t\t{\n \t\t\tif($rowbur->codestructure == intval($model->codestructure))\n \t\t\t{\n \t\t\t\t$searchModelaff = new AffecterSearch();\n \t\t\t\t$dataProvideraff = $searchModelaff->searchCodbur(Yii::$app->request->queryParams,$rowbur->codebureau);\n \t\t\t\t$modelsaff = $dataProvideraff->getModels();\n \t\t\n \t\t\t\tforeach ($modelsaff as $rowaff)\n \t\t\t\t{\n \t\t\t\t\t$searchModelbien = new BienSearch();\n \t\t\t\t\t$dataProviderbien = $searchModelbien->searchConsultationBienSelonCodestatut(Yii::$app->request->queryParams, $rowaff->codebien);\n \t\t\t\t\t$modelbien=$dataProviderbien->getModels();\n \t\t\n \t\t\t\t\tforeach ($modelbien as $rowbien)\n \t\t\t\t\t{\n \t\t\n \t\t\t\t\t\tif($rowbien->statutbien==\"affecte\")\n \t\t\t\t\t\t{\n \t\t\t\t\t\t\t$modeltrouv = Inventorier::findOne($rowbien->codebien);\n \t\t\t\t \t\t\t\t\n \t\t\t\t\t\t\tif ((($modeltrouv = Inventorier::findOne($rowbien->codebien)) !== null))\n \t\t\t\t\t\t\t\t{ \n \t\t\t\t\t\t\t\t\t$cptstr++;\n \t\t\t\t\t\t\t\t\tif(($modeltrouv->comptage1!=='1'&&$modeltrouv->comptage2=='1')||($modeltrouv->comptage1=='1'&&$modeltrouv->comptage2!=='1'))\n \t\t\t\t\t\t\t\t\t{ \n \t\t\t\t\t\t\t\t\t\tif(($modeltrouv->comptage1=='1'&&$modeltrouv->comptage2=='1'))\n \t\t\t\t\t\t\t\t\t\t{\n \t\t\t\t\t\t\t\t\t\t\t\n \t\t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t\t\telse\n \t\t\t\t\t\t\t\t\t\t{\n \t\t\t\t\t\t\t\t$data[$i] = ['codebien'=>$rowbien->codebien, 'designation'=>$rowbien->designationbien,'bureau'=>$rowbur->codebureau,'etat'=>$rowbien->etatbien,];\n \t\t\t\t\t\t\t\t $i++;\n \t\t\t\t\t\t\t\t $cpt1++;\n \t\t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t}\n \t\t\t\t\t\t}\n \t\t\t\t\t\telse\n \t\t\t\t\t\t{\n \t\t\t\t\t\t\t\t\n \t\t\t\t\t\t\tif($rowbien->statutbien==\"transfere\")\n \t\t\t\t\t\t\t{\n \t\t\t\t\t\t\t\t$bur=$this->dernierTransfert($rowbien->codebien);\n \t\t\t\t\t\t\t\t$modeltrouv = Inventorier::findOne($rowbien->codebien);\n \t\t\t\t\t\t\t\t\n \t\t\t\t\t\t\t\tif ((($modeltrouv = Inventorier::findOne($rowbien->codebien)) !== null))\n \t\t\t\t\t\t\t\t{ $cptstr++;\n \t\t\t\t\t\t\t\t\tif(($modeltrouv->comptage1=='1'&&$modeltrouv->comptage2!=='1')||($modeltrouv->comptage1!=='1'&&$modeltrouv->comptage2=='1'))\n \t\t\t\t\t\t\t\t\t {\n \t\t\t\t\t\t\t\t\t\tif(($modeltrouv->comptage1=='1'&&$modeltrouv->comptage2=='1')){\n \t\t\t\t\t\t\t\t\t\t\t\t\n \t\t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t\t\telse\n \t\t\t\t\t\t\t\t\t\t{\n \t\t\t\t\t\t\t\t\t\n \t\t\t\t\t\t\t\t\t$data[$i] = ['codebien'=>$rowbien->codebien, 'designation'=>$rowbien->designationbien,'bureau'=>$bur,'etat'=>$rowbien->etatbien,];\n \t\t\t\t\t\t\t\t\t$i++;\n \t\t\t\t\t\t\t\t\t$cpt1++;\n \t\t\t\t\t\t\t\t\t\t\n \t\t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t}\n \t\t\t\t\t\t}\n \t\t\t\t\t}\n \t\t\t\t}\n \t\t\t}\n \t\t}\n \t\t$prc=0;\n \t\tif($cptstr!=0)\n \t\t{ \n \t\t$prc=($cpt1)/$cptstr;\n \t\t$prc=$prc*100;\n \t\t}\n \t\t$prc=number_format($prc, 2, ',', ' ');\n \t\t\n \t\t$model->pourcentageecart=$prc.\" %\";\n \t\t\n \t\t$dataProviderRes = new ArrayDataProvider([\n \t\t\t\t'allModels' => $data,\n \t\t\t\t'key' =>'codebien',\n \t\t\t\t'sort' => [\n \t\t\t\t'attributes' => ['codebien','designation','bureau','etat',],\n \t\t\t\t\t\n \t\t\t\t],\n \t\t\t\t]);\n \t\t \n \t\t// $modeltest=$dataProviderRes->getModels();\n \t\t\n \t\t$dataProvider=$dataProviderRes;\n \t\t\n \t}\n \t\n \telse {\n \t\t\n \t\t\n \tforeach ($models as $row)\n \t{\n \t\tif(($row->comptage1=='1'&&$row->comptage2!='1'))\n \t\t{ \n \t\t\t$rowbien=Bien::findOne($row->codebien); \n \t\t\t$data[$i] = ['codebien'=>$row->codebien, 'designation'=>$rowbien->designationbien,'bureau'=>$row->bureau,'etat'=>$rowbien->etatbien,];\n \t\t\t$i++;\n \t\t\t$cpt1++; \n \t\t}\n \t\telse\n \t\t{\n\n \t\tif($row->comptage1!='1' && $row->comptage2=='1')\n \t\t{\n \t\t\t$rowbien=Bien::findOne($row->codebien); \n \t\t\t$data[$i] = ['codebien'=>$row->codebien, 'designation'=>$rowbien->designationbien,'bureau'=>$row->bureau,'etat'=>$rowbien->etatbien,];\n \t\t\t$i++;\n \t\t\t$cpt1++;\n \t\t}\n \t\t}\n \t\t\n \t}\n \t$prc=0;\n \tif ($cpttotal!=0)\n \t$prc=($cpt1)/$cpttotal;\n \t$prc=$prc*100;\n \t\n \t$seuil=0;\n \t$modelin=new Exerciceinventaire();\n \t$searchModelexerc= new ExerciceinventaireSearch();\n \t$dataProviderexerc = $searchModelexerc->search(Yii::$app->request->queryParams);\n \t\n \t\t$modelsexerc=$dataProviderexerc->getModels();\n \t\tforeach ($modelsexerc as $rowex)\n \t\t{ \n \t\t\tif($rowex->anneeinv==date('Y'))\n \t\t\t{\n \t\t\t\t\n \t\t\t\t$seuil=$rowex->seuil_compte;\n \t\t\t\tif($seuil<=$prc)\n \t\t\t\t{\n \t\t\t\t\t\\Yii::$app->getSession()->setFlash('info', \"L'écart entre les deux comptage est arrivé au seil, Vous devez passer au troisième comptage.\");\n \t\t\t\t\t\t\n \t\t\t\t}\n \t\t\t}\n \t\t\t\n \t\t}\n \t\t$prc=number_format($prc, 2, ',', ' ');\n \t\t\n \t\t$prc=$prc.\" %\";\n \t\t$model->pourcentageecart=$prc;\n \t$dataProviderRes = new ArrayDataProvider([\n \t\t\t'allModels' => $data,\n \t\t\t'key' =>'codebien',\n \t\t\t'sort' => [\n \t\t\t'attributes' => ['codebien','designation','bureau','etat',],\n \t\t\t\t\n \t\t\t],\n \t\t\t]);\n \t \n \t// $modeltest=$dataProviderRes->getModels();\n \t\n \t$dataProvider=$dataProviderRes;\n \t\n \t\n \t}\n \t \n \t \treturn $this->render('extraireEcartComptage', [\n \t\t\t'searchModel' => $searchModel,\n \t\t\t'dataProvider' => $dataProvider,\n \t\t\t'model'=>$model,\n \t\t\t]);\n }", "function wtsadd2caddie($ar){\n $dps = array();\n $dos = array();\n $persByType = array();\n $switchTo = array();\n $p = new XParam($ar, array());\n $oldcaddie = $this->getCaddie();\n $linesid = $p->get('lineid');\n $formparms = array('personpackid', 'validfrom', 'offreoid', 'productoid',\n 'card', 'CHIPID', 'ACCNO', 'CRC', 'assurance',\n 'NEWCARDLabel', 'joursbonus', 'justphotoidentnom',\n 'justphotoidentprenom', 'justphotoident', 'justphotoidentdob',\n 'justetatciv', 'justdomicile', 'justgrp', 'justgrpname','customercard');\n $lineparms = array('validfrom', 'offreoid', 'productoid');\n foreach($formparms as $parm){\n $$parm = $p->get($parm);\n }\n $season = $this->getSeason();\n $lines = array();\n $cptf = 1;\n foreach($linesid as $lineid){\n $id1 = date('dhis').$cptf.uniqid('_');\n $cptf ++;\n $line = array('type'=>'forfait');\n foreach($lineparms as $parm){\n $v = $$parm;\n if (isset($v[$lineid]))\n $line[$parm]=$v[$lineid];\n else\n $line[$parm]=NULL;\n }\n // passage d'options par prog seulement\n if (isset($ar['linesOptions'][$lineid])){\n $line['options'] = $ar['linesOptions'][$lineid];\n }\n // lecture du produit et des produits associés\n if (!isset($dps[$line['productoid']])){\n\t$dps[$line['productoid']] = $this->productInfos($line['productoid'], $line['validfrom']);\n\t// cause est utilisé directement ...\n\t$dpc = $dps[$line['productoid']]['dpc'];\n }\n // lecture des offre (la meme ... ) pour avoir le flash\n if (!isset($dos[$line['offreoid']])){\n $dos[$line['offreoid']] = $this->modcatalog->displayOffre(array('_options'=>array('local'=>true),\n\t\t\t\t\t\t\t\t\t'tplentry'=>TZR_RETURN_DATA,\n\t\t\t\t\t\t\t\t\t'offre'=>$line['offreoid'],\n\t\t\t\t\t\t\t\t\t'caddie'=>false)); // le stock importe pas ici\n }\n\n // remplacement du produit si existe (fidelite - voir wtssaisieforfaits)\n if ($this->modcustomer->loyaltyActive()){\n\n // carte du forfait (!! mêmes tests que dessous)\n $rpcard2 = substr($card[$lineid], 0, 8);\n if ($rpcard2 == 'NEWCARD_'){\n $rpwtp['cardoid'] = substr($card[$lineid], 8);\n $rpwtp['cardlabel'] = $NEWCARDLabel[$lineid];\n } elseif($card[$lineid] == 'WTPCARD'){\n //$rpnewwtp = strtoupper($CHIPID[$lineid].'-'.$CRC[$lineid].'-'.$ACCNO[$lineid]);\n $rpnewwtp = $this->modresort->formatWTPParts(array($CHIPID[$lineid], $CRC[$lineid], $ACCNO[$lineid]));\n $rpwtp['cardlabel'] = $rpnewwtp;\n $rpwtp['cardoid'] = NULL;\n } elseif(!empty($card[$lineid])){ \n $rpwtp['cardlabel'] = $NEWCARDLabel[$lineid];\n $rpwtp['cardoid'] = NULL;\n $rpcardid = $card[$lineid];\n if (isset($oldcaddie['bycards']) && $oldcaddie['bycards'][$rpcardid]['newcard'] !== false){\n $rplineid = $oldcaddie['bycards'][$rpcardid]['newcard'];\n $rpwtp['cardoid'] = $oldcaddie['lines'][$rplineid]['productoid'];\n }\n }\n\n list($loyaltymess, $loyaltyprice, $loyaltyProductOid) = $this->modcustomer->checkLoyaltyReplacementProduct(array('season'=>$season, 'doffre'=>$dos[$line['offreoid']]['doffre'], 'dp'=>$dps[$line['productoid']], 'dpc'=>$dps[$line['productoid']]['dpc'], 'validfrom'=>$line['validfrom'], 'availablesNewCards'=>$dps[$line['productoid']]['availablesNewCards'],'wtp'=>$rpwtp));\n if ($loyaltyProductOid != NULL){\n XLogs::notice(get_class($this), '::wtsadd2caddie replace product '.$line['productoid'].' -> '.$loyaltyProductOid.' '.$loyaltyprice);\n $ldps = $this->productInfos($loyaltyProductOid , $line['validfrom']);\n // on remplace ... \n \n $line['productoid'] = $loyaltyProductOid;\n $dps[$line['productoid']] = $ldps;\n } else {\n XLogs::notice(get_class($this), '::wtsadd2caddie no replacement product '.$line['productoid']);\n }\n }\n // top des des produtis non dates - date si rechargement\n $line['validfrom_hidden'] = 0;\n if ($dps[$line['productoid']]['dpc']['ocalendar']->link['otype']->raw == 'NO-DATE'){\n list($drech, $dnew, $dliv) = $this->getFirstDayNoDate(date('Y-m-d h:i:s'));\n $line['validfrom_hidden'] = 1;\n if ($card[$lineid] == 'WTPCARD'){\n $line['validfrom'] = $drech;\n $line['calendar-NO-DATE'] = 0;\n } else {\n $line['calendar-NO-DATE'] = 1;\n }\n }\n // ajout d'un top flash et de l'id de la vente\n if ($dos[$line['offreoid']]['doffre']['oflash']->raw == 1){\n $line['isflash'] = true;\n foreach($dos[$line['offreoid']]['doffre']['_flash']['ventes'] as $i=>$vente){\n if (in_array($line['validfrom'], $vente['dates'])){\n $line['flashoid'] = $vente['oid'];\n break;\n }\n }\n } else {\n $line['isflash'] = false;\n }\n // ajout de l'id packpersonne et du type de personne (pour la suppression)\n if (isset($personpackid[$lineid])){\n $line['ispersonpack'] = true;\n $line['personpackid'] = $personpackid[$lineid];\n // replacement type de personne suivant composition pack\n $personType = $dps[$line['productoid']]['owtsperson']->raw;\n $persByType[$personType]++;\n if ($dos[$line['offreoid']]['persons'][$personType]->switchTo && $dos[$line['offreoid']]['persons'][$personType]->switchLimit && $persByType[$personType] == $dos[$line['offreoid']]['persons'][$personType]->switchLimit) {\n $personType = $dos[$line['offreoid']]['persons'][$personType]->switchTo;\n if (!isset($switchTo[$personType])) {\n $switchTo[$personType] = selectQuery(\"select WTSCATALOG.koid from WTSCATALOG join WTSCATALOG c2 using (wtsticket) where WTSCATALOG.wtsperson='$personType' and c2.koid='{$line['productoid']}'\")->fetch(PDO::FETCH_COLUMN);\n // lecture du produit et des produits associés\n if (!isset($dps[$switchTo[$personType]])){\n $dps[$switchTo[$personType]] = $this->productInfos($switchTo[$personType], $line['validfrom']);\n // cause est utilisé directement ...\n $dpc = $dps[$switchTo[$personType]]['dpc'];\n }\n }\n $line['productoid'] = $switchTo[$personType];\n }\n $line['wtsperson'] = $personType;\n } else {\n $line['ispersonpack'] = false;\n $line['personpackid'] = NULL;\n $line['wtsperson'] = NULL;\n }\n // ajout des champs issus du produit etc ...\n $line['validtill'] = $this->getValidtill($line['validfrom'], $dps[$line['productoid']], $dps[$line['productoid']]['dpc']);\n $line['price'] = $dps[$line['productoid']]['price']['tariff'];\n $line['label'] = $dps[$line['productoid']]['label'];\n\n // ajout carte du forfait\n $line['cardid'] = $card[$lineid];\n $line['lineid'] = $lineid;\n\n // traitement des justifs (cartes ce/ coupons ..)\n if (isset($dpc['ojustgrps']) && $dpc['ojustgrps']->raw == 1){\n $line['justifgrps'] = $justgrpname[$lineid].' '.$justgrp[$lineid];\n }\n // traitement des pièces justficaves\n if ($dpc['ojustphotoident']->raw == 1 \n && $dps[$line['productoid']]['owtsticket']->link['oduree']->raw >= $dpc['ojustphotonbjour']->raw){\n $needphotoident = true;\n } else {\n $needphotoident = false;\n }\n if (($justphotoidentnom[$lineid] && $justphotoidentprenom[$lineid])\n\t || $justphotoidentdob[$lineid]\n\t || $dpc['ojustetatciv']->raw == 1\n\t || $dpc['ojustdomicile']->raw == 1\n\t || $needphotoident){\n\t$nom = $justphotoidentnom[$lineid];\n\t$prenom = $justphotoidentprenom[$lineid];\n\t$dob = $justphotoidentdob[$lineid];\n\tif ($this->dsjustifs == NULL)\n\t $this->dsjustifs = XDataSource::objectFactoryHelper8('BCLASS=XDSTable&SPECS='.self::$tableJUSTIFS);\n\t$jar = array('lineid'=>$lineid, 'nom'=>$nom, 'prenom'=>$prenom, 'dob'=>$dob, 'photoident'=>0, 'etatciv'=>0, 'domicile'=>0, 'customercard'=>0);\n\t// utilisation d'une carte client\n\tif (isset($customercard[$lineid])){\n\t $jar['customercard'] = $customercard[$line_id];\n\t if ($needphotoident){\n\t if (!isset($dscustomercards)){\n\t $dscustomercards = XDataSource::objectFactoryHelper8('BCLASS=XDSTable&SPECS='.self::$tableCUSTOMERCARDS);\n\t }\n\t $dcard = $dscustomercards->rdisplay($customercard[$lineid]);\n\t $tmpfile = TZR_TMP_DIR.uniqid('customercard');\n\t copy($dcard['ophoto']->filename, $tmpfile);\n\t $_FILES['justphotoident']['tmp_name'][$lineid] = $tmpfile;\n\t $_FILES['justphotoident']['type'][$lineid] = $dcard['ophoto']->mime;\n\t $_FILES['justphotoident']['name'][$lineid] = $dcard['ophoto']->originalname;\n\t $_FILES['justphotoident']['type'][$lineid] = filesize($tmpfile);\n\t }\n\t}\n\tif ($dpc['ojustetatciv']->raw == 1)\n\t $jar['etatciv'] = 1;\n\tif ($dpc['ojustdomicile']->raw == 1)\n\t $jar['domicile'] = 1;\n\tif ($dpc['ojustphotoident']->raw == 1){\n\t $jar['photoident'] = 1;\n\t}\n\t$justifoid = $this->saveJustif($jar);\n\t$line['justifoid'] = $justifoid;\n }\n // ajout des lignes cartes : NEWCARD = commander; WTPCARD = saisie du WTP; autres : id de cartes deja dans le panier\n // !!! NEWCARD_WTSCATLOG:xxx = ajouter nouvelle carte, NEWCARDuniqid = nouvelle carte du panier - sera rattachée\n // !!! on a la meme chose (ou presque pour le remplacement de produit)\n $card2 = substr($line['cardid'], 0, 8);\n if ($card2 == 'NEWCARD_'){\n $cardid = uniqid('NEWCARD');\n $line['cardid'] = $cardid;\n $cardoid = substr($card[$lineid], 8);\n // trouver le bon prix et intitulé des cartes en commande\n $cardok = 0;\n foreach($dps[$line['productoid']]['availablesNewCards'] as $acarddesc){\n if($cardoid == $acarddesc['oid']){\n $cardok=1;\n break;\n }\n }\n if ($cardok !== 1){ // on doit trouver !!! sauf si on enlève\n XLogs::notice(get_class($this), '::wtsadd2caddie erreur recherche produit carte');\n //die('An error occured'.$cardoid);\n // on cherche le prix directement (DSR : rp + produit public ...)\n $ct = $this->modcatalog->getProductTariff(NULL, $line['validfrom'], $cardoid);\n if ($ct['tariff'] == 'NOT FOUND'){\n XLogs::critical(get_class($this), '::wtsadd2caddie erreur recherche produit carte');\n die('An error occured'.$cardoid);\n } else {\n $acarddesc['price'] = $ct['tariff'];\n }\n }\n $lines[$id1.'_0000'] = array('linesid'=>$lineid, 'type'=>'carte',\n\t\t\t\t 'label'=>$NEWCARDLabel[$lineid], 'cardid'=>$cardid,\n\t\t\t\t 'productoid'=>$cardoid,\n\t\t\t\t 'price'=>$acarddesc['price']);\n //les cartes ne sont pas dans le pack car elle peuvent avoir d'autres forfaits dessus\n $line['cardlabel'] = $NEWCARDLabel[$lineid];\n\t/*saisie WTP */\n } elseif($line['cardid'] == 'WTPCARD'){\n $newwtp = $this->modresort->formatWTPParts(array($CHIPID[$lineid], $CRC[$lineid], $ACCNO[$lineid]));\n // regarder si cette carte n'est pas déjà dans le panier si oui recup de sont cardid\n $cardid = array_search($newwtp, $oldcaddie['cards']);\n if ($cardid === false)\n $cardid = uniqid('WTPCARD');\n $line['cardlabel'] = $newwtp;\n $line['cardid'] = $cardid;\n\t/* autres cas : cartes du panier (WTPCARDuniq ou cartes en commandes NEWCARuniqid)*/\n } elseif(!empty($line['cardid'])){ \n $line['cardlabel'] = $NEWCARDLabel[$lineid];\n $line['cardid'] = $card[$lineid];\n }\n // ajout des lignes assurances\n if (isset($assurance[$lineid])){\n $lines[$id1.'_0020'] = array('lineid'=>$lineid, 'type'=>'assurance',\n\t\t\t\t 'label'=>$dps[$line['productoid']]['assur']['label'],\n\t\t\t\t 'productoid'=>$dps[$line['productoid']]['assur']['oid'],\n\t\t\t\t 'price'=>$dps[$line['productoid']]['assur']['price'], \n\t\t\t\t 'options'=>array());\n if (isset($dps[$line['productoid']]['assur']['options'])){\n $lines[$id1.'_0020']['options'] = $dps[$line['productoid']]['assur']['options'];\n }\n $lines[$id1.'_0020']['ispersonpack'] = $line['ispersonpack'];\n $lines[$id1.'_0020']['personpackid'] = $line['personpackid'];\n }\n // ajout des lignes bonus et calcul du bonus\n if (isset($joursbonus[$lineid]) && $joursbonus[$lineid]>0){\n // calcul du forfait bonus\n list($rline, $bline) = $this->modloyalty->getForfaitBonus($line, $joursbonus[$lineid], $dps[$line['productoid']]);\n if ($bline != NULL && $rline != NULL){\n $bline['jours'] = $joursbonus[$lineid];\n // ev garder ... $line[$id1.'_0009'] = $line\n $bline['ispersonpack'] = $line['ispersonpack'];\n $bline['personpackid'] = $line['personpackid'];\n $line = $rline;\n $lines[$id1.'_0015'] = $bline;\n }\n if ($bline != NULL && $rline == NULL){\n $bline['ispersonpack'] = $line['ispersonpack'];\n $bline['personpackid'] = $line['personpackid'];\n $lines[$id1.'_0010'] = $bline;\n $line = NULL;\n }\n }\n if ($line != NULL){\n $lines[$id1.'_0010'] = $line;\n }\n }\n // ajout des lignes au caddie\n $this->addLines2Caddie($lines);\n }", "public function ajoutProduitEncore()\n {\n Produit::create(\n [\n 'uuid' => Str::uuid(),\n 'designation' => 'Mangue',\n 'description' => 'Mangue bien grosse et sucrée! Yaa Proprè !',\n 'prix' => 1500,\n 'like' => 63,\n 'pays_source' => 'Togo',\n 'poids' => 89.5,\n ]\n );\n }", "function cinotif_trouver_objet_courrier_et_destinataire($id_courrier, $id_auteur=0, $id_abonne=0) {\n\t$return = array('objet'=>'','id_objet'=>0);\n\t$id_courrier = intval($id_courrier);\n\t$id_auteur = intval($id_auteur);\n\t$id_abonne = intval($id_abonne);\n\t$evenement_recherche = 0;\n\n\tif ($id_courrier>0 AND ($id_auteur OR $id_abonne)) {\n\t\t\n\t\t// contenu notifie\n\t\t$quoi = '';\n\t\t$objet = '';\n\t\t$id_objet = 0;\n\t\t$row = sql_fetsel('*', 'spip_cinotif_courriers', 'id_courrier='.$id_courrier);\n\t\tif ($row) {\n\t\t\t$quoi = $row['quoi'];\n\t\t\t$objet = $row['objet'];\n\t\t\t$id_objet = intval($row['id_objet']);\n\t\t\t$parent = $row['parent'];\n\t\t\t$id_parent = intval($row['id_parent']);\n\t\t}\n\n\t\t// article\n\t\tif ($parent=='article'){\n\t\t\t$evenement_recherche = cinotif_evenement_recherche($id_auteur,$id_abonne,$quoi,$parent,array($id_parent));\n\t\t\t\n\t\t\tif (!$evenement_recherche) {\n\t\t\t\t$t = sql_fetsel(\"id_rubrique\", \"spip_articles\", \"id_article=\".$id_parent);\n\t\t\t\t$id_parent = $t['id_rubrique'];\n\t\t\t\t$parent = 'rubrique';\n\t\t\t}\n\t\t}\t\t\t\n\n\t\t// rubrique\n\t\tif ($parent=='rubrique'){\n\t\t\t$ascendance = cinotif_ascendance($id_parent);\n\t\t\t$evenement_recherche = cinotif_evenement_recherche($id_auteur,$id_abonne,$quoi,$parent,$ascendance);\n\t\t\t\n\t\t\t// cas particulier ou on s'abonne a un article a l'evenement modification d'article\n\t\t\tif (!$evenement_recherche AND $quoi=='articlemodifie')\n\t\t\t\t$evenement_recherche = cinotif_evenement_recherche($id_auteur,$id_abonne,$quoi,$objet,array($id_objet));\n\t\t}\n\t\t\n\t\t// site\n\t\tif (!$evenement_recherche) {\n\t\t\t$evenement_recherche = cinotif_evenement_recherche($id_auteur,$id_abonne,$quoi,'site',array());\n\t\t}\n\t\tif ($evenement_recherche) {\n\t\t\t$row = sql_fetsel('*', 'spip_cinotif_evenements', \"id_evenement=\".$evenement_recherche);\n\t\t\t$return = array('objet'=>$row['objet'],'id_objet'=>$row['id_objet']);\n\t\t}\n\t}\n\t\n\treturn $return;\n}", "function entetecarte($IDDNR,$TYPECARTE)\n {\n\t//1ere page\n\t//face droite\n\t$this->AddPage('p','A5');\n\t$this->SetDisplayMode('fullpage','single');//mode d affichage \n\t$this->Image('../public/images/photos/LOGOAO.GIF',105,25,15,15,0);//image (url,x,y,hauteur,largeur,0)\n\t$this->SetFont('Arial','B',6);\n\t$this->RoundedRect(78, 1, 70, 100, 2, $style = '');\n\t$this->SetTextColor(225,0,0); \n\t$this->Text(82,10,\"REPUBLIQUE ALGERIENNE DEMOCRATIQUE ET POPULAIRE \");\n\t$this->Text(96,15,\"AGENCE NATIONALE DU SANG\");\n\t$this->Text(90,20,\"AGENCE REGIONALE DU SANG \".$this->nbrtostring($this->db_name,\"ars\",\"IDARS\",$this->REGION(),\"WILAYAS\"));\n\t$this->SetTextColor(0,0,0); \n\t$this->Line(80 ,23 ,145 ,23 );\n\t$this->SetFont('Arial','B',14);\n\t$this->Text(104,48,\"CARTE\");\n\t$this->Text(88,53,$TYPECARTE);\n\t$this->SetFont('Arial','B',8);\n\t$this->Text(90,60,\"Structure de Transfusion Sanguine:\");\n\t$this->Text(90,65,$this->nbrtostring($this->db_name,\"cts\",\"IDCTS\",$this->STRUCTURE(),\"CTS\"));\n\t$this->Text(90,70,\"wilaya de \".$this->nbrtostring($this->db_name,\"wrs\",\"IDWIL\",$this->WILAYA(),\"WILAYAS\"));\n\t$this->SetFont('Arial','B',7);\n\t$this->Text(80,84,\"Numéro d'identification du donneur:\");//\n\t$this->Text(80,98,\"Delivrée le:\");\n\t$this->SetFont('Arial','B',8);\n\t$this->SetTextColor(225,0,0);\n\t$this->Text(93,98,date('d/m/Y'));\n\t$this->SetTextColor(0,0,0);\n\t$this->Code39(80,85 , $IDDNR, $baseline=0.5, $height=5);\n\t}", "function imprimir_voucher_estacionamiento($numero,$chofer,$patente,$horainicio,$horatermino,$montototal,$comentario,$correlativopapel,$cliente,$fecha_termino,$fecha_inicio_2){\ntry {\n // Enter the share name for your USB printer here\n //$connector = null; \n //$connector = new WindowsPrintConnector(\"EPSON TM-T81 Receipt\");\n $connector = new WindowsPrintConnector(\"EPSON TM-T20 Receipt\");\n // $connector = new WindowsPrintConnector(\"doPDF 8\");\n /* Print a \"Hello world\" receipt\" */\n $printer = new Printer($connector);\n\n \n $date=new DateTime();\n $fecha = $date->format('d-m-Y');\n\n\n $Chofer = $chofer;\n $Patente = $patente;\n $serie = $numero;\n $img = EscposImage::load(\"logo1.png\");\n $printer -> graphics($img);\n \n \n $printer -> text(\"Numero : $serie\\n\");\n $printer -> text(\"Chofer : $Chofer\\n\");\n $printer -> text(\"Patente: $Patente\\n\");\n\n if ($cliente != 0) {\n include_once(\"conexion.php\");\n $con = new DB;\n $buscarpersona = $con->conectar();\n $strConsulta = \"select * from cliente where rut_cliente ='$cliente'\";\n $buscarpersona = mysql_query($strConsulta);\n $numfilas = mysql_num_rows($buscarpersona);\n $row = mysql_fetch_assoc($buscarpersona);\n $nombre_cliente = $row['nombre_cliente'];\n //var_dump($numfilas);\n if($numfilas >= 1){\n $printer -> text(\"Cliente: $nombre_cliente\\n\");\n }\n \n }\n \n if ($correlativopapel != 0) {\n $printer -> text(\"\\nCorrelativo : $correlativopapel\\n\");\n }\n $printer -> text(\"Fecha Inicio : $fecha_inicio_2\\n\");\n $printer -> text(\"Hora de inicio : $horainicio\\n\");\n\n\n\n if ($horatermino != 0) {\n $printer -> text(\"Fecha de Termino: $fecha_termino\\n\");\n $printer -> text(\"Hora de Termino : $horatermino\\n\"); \n }\n \n \n if ($montototal != 0) {\n $printer -> text('Monto total : $'.$montototal);\n }\n \n if ($horatermino != 0) {\n $printer -> text(\"\\n\");\n $printer -> text(\"\\n\\n\");\n $printer -> text(\"Firma: _________________\\n\");\n \n }\n $printer -> text(\"$comentario\\n\");\n $printer -> cut();\n /* Close printer */\n $printer -> close();\n\n echo \"<div class='alert alert-success'><strong>Impresion Correcta $comentario</strong></div>\";\n} catch (Exception $e) {\n echo \"No se pudo imprimir \" . $e -> getMessage() . \"\\n\";\n}\n}", "function Geral() {\r\n extract($GLOBALS);\r\n if ($P1==1 && $O=='I' &&f($RS_Menu,'envio_inclusao')=='S') {\r\n // Recupera a chave do trâmite de cadastramento\r\n $sql = new db_getTramiteList; $RS = $sql->getInstanceOf($dbms,$w_menu,null,null,null);\r\n $RS = SortArray($RS,'ordem','asc');\r\n foreach($RS as $row) { \r\n $w_tramite = f($row,'sq_siw_tramite'); \r\n break; \r\n }\r\n \r\n $w_envio_inclusao = 'S';\r\n } else {\r\n $w_envio_inclusao = 'N';\r\n }\r\n if ($SG=='SRTRANSP') {\r\n include_once('transporte_gerais.php');\r\n } elseif ($SG=='SRSOLCEL') {\r\n include_once('celular_gerais.php');\r\n } else {\r\n include_once('geral_gerais.php');\r\n }\r\n}", "function cl_clientesmodulosproc() { \n //classes dos rotulos dos campos\n $this->rotulo = new rotulo(\"clientesmodulosproc\"); \n $this->pagina_retorno = basename($GLOBALS[\"HTTP_SERVER_VARS\"][\"PHP_SELF\"]);\n }", "function commandes_bank_traiter_reglement($flux){\r\n\t// Si on est dans le bon cas d'un paiement de commande et qu'il y a un id_commande et que la commande existe toujours\r\n\tif (\r\n\t\t$id_transaction = $flux['args']['id_transaction']\r\n\t\tand $transaction = sql_fetsel(\"*\",\"spip_transactions\",\"id_transaction=\".intval($id_transaction))\r\n\t\tand $id_commande = $transaction['id_commande']\r\n\t\tand $commande = sql_fetsel('id_commande, statut, id_auteur, echeances, reference', 'spip_commandes', 'id_commande='.intval($id_commande))\r\n\t){\r\n\t\t$statut_commande = $commande['statut'];\r\n\t\t$montant_regle = $transaction['montant_regle'];\r\n\t\t$transaction_mode = $transaction['mode'];\r\n\t\t$statut_nouveau = 'paye';\r\n\r\n\r\n\t\t// Si la commande n'a pas d'échéance, le montant attendu est celui du prix de la commande\r\n\t\tinclude_spip('inc/commandes_echeances');\r\n\t\tif (!$commande['echeances']\r\n\t\t\tor !$echeances = unserialize($commande['echeances'])\r\n\t\t or !$desc = commandes_trouver_prochaine_echeance_desc($id_commande, $echeances, true)\r\n\t\t or !isset($desc['montant'])) {\r\n\t\t\t$fonction_prix = charger_fonction('prix', 'inc/');\r\n\t\t\t$montant_attendu = $fonction_prix('commande', $id_commande);\r\n\t\t}\r\n\t\t// Sinon le montant attendu est celui de la prochaine échéance (en ignorant la dernière transaction OK que justement on cherche à tester)\r\n\t\telse {\r\n\t\t\t$montant_attendu = $desc['montant'];\r\n\t\t}\r\n\t\tspip_log(\"commande #$id_commande attendu:$montant_attendu regle:$montant_regle\", 'commandes');\r\n\r\n\t\t// Si le plugin n'était pas déjà en payé et qu'on a pas assez payé\r\n\t\t// (si le plugin était déjà en payé, ce sont possiblement des renouvellements)\r\n\t\tif (\r\n\t\t\t$statut_commande != 'paye'\r\n\t\t\tand (floatval($montant_attendu) - floatval($montant_regle)) >= 0.01\r\n\t\t){\r\n\t\t\t$statut_nouveau = 'partiel';\r\n\t\t}\r\n\t\t\r\n\t\t// S'il y a bien un statut à changer\r\n\t\tif ($statut_nouveau !== $statut_commande){\r\n\t\t\tspip_log(\"commandes_bank_traiter_reglement marquer la commande #$id_commande statut: $statut_commande -> $statut_nouveau mode=$transaction_mode\",'commandes');\r\n\t\t\t// On met a jour la commande\r\n\t\t\tinclude_spip(\"action/editer_commande\");\r\n\t\t\tcommande_modifier($id_commande, array('statut'=>$statut_nouveau, 'mode'=>$transaction_mode));\r\n\t\t}\r\n\r\n\t\t// un message gentil pour l'utilisateur qui vient de payer, on lui rappelle son numero de commande\r\n\t\t$flux['data'] .= \"<br />\"._T('commandes:merci_de_votre_commande_paiement',array('reference'=>$commande['reference']));\r\n\t}\r\n\r\n\treturn $flux;\r\n}", "public function inventario()\n {\n $productos=Producto::orderBy('categoria_id','Asc')->get();\n\n $config=Config::first();\n $pdf=PDF::loadview('pdf.inventario',compact('productos','config'));\n #$pdf->setPaper(array(0,0,285,10000)); \n $fecha=date('d-m-y');\n return $pdf->stream('Inventario-'.$fecha.'.pdf');\n\n \n }", "public function casutapostalaAction()\r\n {\r\n // $this->_checkFurnizoriGroup();\r\n \r\n /**\r\n * Check if customer has this option available\r\n */\r\n // if (!$this->_getSession()->getCustomer()->getAcOpNotificariEmail()) {\r\n // $this->_redirect('customer/account/');\r\n // return;\r\n // }\r\n \r\n /**\r\n * continue if customer is furnizor and is enabled notifications \r\n */\r\n \r\n if (!Mage::getSingleton('customer/session')->isLoggedIn()) {\r\n $this->_redirect('customer/account/');\r\n return;\r\n }\r\n \r\n Mage::getSingleton('catalog/layer')->setReplyTo('');\r\n \r\n $this->loadLayout();\r\n \r\n $this->_initLayoutMessages('customer/session');\r\n $this->_initLayoutMessages('catalog/session');\r\n \r\n $this->getLayout()->getBlock('head')->setTitle($this->__('Casuta postala'));\r\n $this->renderLayout();\r\n }", "function AfficherOffre($offre,$bool)\n {\n require(\"db/connect.php\");\n //on récupère les informations de l'adresse liée à l'offre\n if ($offre [\"adresse_id\"]!=null)\n {\n $requete='SELECT * FROM adresse WHERE adresse_id ='. $offre [\"adresse_id\"];\n $resultat=$BDD->query($requete);\n $adresse=$resultat->fetch();\n }\n if ($bool) print '<div class=\"col-xs-8 col-sm-4 col-md-4 col-lg-4 fondClair\" \n style=\"height:200px;\">';\n if (!$bool) print '<div class=\"col-xs-8 col-sm-4 col-md-4 col-lg-4 fondFonce\" \n style=\"height:200px;\">';\n print '\n <div class=\"margeSimpson\">\n <h2> <a href=\"detailEmploi.php?offre='.$offre['offre_id'].'\">'.\n $offre['offre_nom'].'</a></h2>';\n if ($offre [\"adresse_id\"]!=null)\n {$adresse['adresse_ville'];} \n print '<br/>'\n . 'Durée : '.$offre['offre_duree']\n . '<br/>Remunération : '.$offre['offre_renum'].\n '<br/><br/><br/><i>postée le '.$offre['offre_datePoste'].'</i>\n </div>\n </div>';\n if ($bool) print '<div class=\"col-xs-12 col-sm-12 col-md-8 col-lg-8 fondClair\" \n style=\"height:200px;\"> ';\n if (!$bool) print '<div class=\"col-xs-12 col-sm-12 col-md-8 col-lg-8 fondFonce\" \n style=\"height:200px;\"> ';\n print '\n <div class=\"margeSimpson2\">'.\n $offre['offre_descrCourte'].\n '</div>\n </div>';\n }", "public function accionesParticulares($str_accion, $objDatos) {\n \n\t\t//throw new Exception('Se ha intentado ejecutar la acción '.$str_accion.' y no está programada.'); \n\n\t\t//IgepDebug::setDebug(DEBUG_USER,\"El valor es: <pre>\".$str_accion.\"</pre>\");\n //$num=IgepSession::dameCampoTuplaSeleccionada('TcomintComunicaciones','edi_numorden');\n //$anyo=IgepSession::dameCampoTuplaSeleccionada('TcomintComunicaciones','edi_anyo');\n $id_animal=$objDatos->getValue('id_animal');\n $fecha=$objDatos->getValue('edi_fecha');\n switch ($str_accion) {\n case 'verInformeAnalisis':\n //Bucle para crear un listado para cada peticion seleccionada:\n // $objDatos->setOperation(\"seleccionar\");\n //$m_datosSeleccionados = $objDatos->currentTupla();\n $res = $this->consultar(\"SELECT nombre_fichero,informe from tasoka_historial_analitica\n WHERE id_animal ='\".$id_animal.\"' and fecha='\".$this->getConnection()->prepararFecha( $fecha).\"'\");\n if(is_array($res)&&$res[0]['informe']!=''){ \n $trozos = explode(\".\", $res[0]['nombre_fichero']); \n $extension =strtolower(end($trozos));\n if($extension===\"pdf\") \n header('Content-Type: application/pdf');\n elseif($extension===\"doc\" || $extension===\"docx\")\n header(\"Content-type: application/msword\");\n elseif($extension===\"odt\") \n header(\"Content-type: application/vnd.oasis.opendocument.text\");\n else {\n $this->showMessage('APL-11');\n $actionForward = new ActionForward('gvHidraValidationError');\n $actionForward->put('IGEPclaseManejadora','Tasoka_salud_analitica2D');\n break;\n }\n \n \n header('Content-Disposition: attachment; filename=\"'.$res[0]['nombre_fichero'].'\"');\n \n /*\n * header(\"Content-type: application/msword\");\nheader(\"Content-Disposition: inline; filename=word.doc\");\n\n */\n //print(pg_unescape_bytea($res[0]['doc_entrada']));\n\t\t\t\t\tprint($res[0]['informe']);\n ob_end_flush ();\n //Para que no continue la ejecuci\\F3n de la p\\E1gina\n die; \n } \n else {\n $this->showMessage('APL-44');\n $actionForward = new ActionForward('gvHidraValidationError');\n $actionForward->put('IGEPclaseManejadora','Tasoka_salud_analitica2D');\n \n } \n \n break;\n \n case 'borrarInformeAnalisis': \n // $objDatos->setOperation(\"actualizar\");\n if($objDatos->getValue('edi_nombre_fichero','actualizar')!='') {\n \n if(!empty($id_animal) && !empty($fecha)) {\n \n $sql=\"update tasoka_historial_analitica set informe=null , nombre_fichero=null where id_animal=$id_animal and fecha='\".$this->getConnection()->prepararFecha($fecha).\"' \";\n $error=$this->operar($sql);\n if($error==0) {\n $this->showMessage('APL-49',array('ENTRADA'));\n $actionForward = $objDatos->getForward('gvHidraSuccess');\n $this->refreshSearch(false);\n }\n else {\n $this->showMessage('APL-48',array('ENTRADA'));\n $actionForward = $objDatos->getForward('gvHidraError');\n }\n }\n //IgepDebug::setDebug(DEBUG_USER,\"El codigo es: <pre>\".print_r($objDatos->getValue('edi_doc_entrada_nombre'),true).\"</pre>\");\n //$objDatos->setValue('edi_asunto','');\n //die;\n } \n else {\n $this->showMessage('APL-52',array('ENTRADA'));\n $actionForward = new ActionForward('gvHidraValidationError');\n $actionForward->put('IGEPclaseManejadora','Tasoka_salud_analitica2D');\n }\n break;\n }\n \t\n }", "public function index()\n {\n\n $page_filleul=null;\n if(Route::currentRouteName() == \"compromis.filleul.index\"){\n $page_filleul = \"page_filleul\";\n }\n $parametre = Parametre::first();\n $comm_parrain = unserialize($parametre->comm_parrain) ;\n $nb_jour_max_demande = $parametre->nb_jour_max_demande ;\n\n if(auth::user()->role == \"admin\"){\n $page_filleul = null;\n }\n\n // On réccupère l'id des filleuls pour retrouver leurs affaires\n $filleuls = Filleul::where([['parrain_id',Auth::user()->id],['expire',false]])->select('user_id')->get()->toArray();\n $fill_ids = array();\n foreach ($filleuls as $fill) {\n\n $fill_ids[]= $fill['user_id'];\n }\n\n \n //########## TYPE AFFAIRE\n\n \n $tab_compromisEncaissee_id = array();\n $tab_compromisEnattente_id = array();\n $tab_compromisPrevisionnel_id = array();\n\n $compromisEncaissee_id = Facture::where([['encaissee',1],['type','stylimmo'],['a_avoir',0]])->select('compromis_id')->get();\n $compromisEnattente_id = Facture::where([['encaissee',0],['type','stylimmo'],['a_avoir',0]])->get();\n\n foreach ($compromisEncaissee_id as $encaiss) {\n $tab_compromisEncaissee_id[] = $encaiss[\"compromis_id\"];\n }\n foreach ($compromisEnattente_id as $attente) {\n $tab_compromisEnattente_id[] = $attente[\"compromis_id\"];\n }\n \n// dd($compromisEnattente_id);\n\n if(auth::user()->role == \"admin\"){\n $compromisEncaissee = Compromis::whereIn('id',$tab_compromisEncaissee_id)->where([['archive',false],['cloture_affaire','<',2]])->get();\n $compromisEnattente = Compromis::whereIn('id',$tab_compromisEnattente_id)->where([['archive',false],['cloture_affaire','<',2]])->get();\n $compromisSousOffre = Compromis::where([['demande_facture','<',2],['pdf_compromis',null],['archive',false],['cloture_affaire','<',2]])->get();\n $compromisSousCompromis = Compromis::where([['demande_facture','<',2],['pdf_compromis','<>',null],['archive',false]])->get();\n }else{\n\n // On reccupère les affaires du mandataire ou de ses filleuls\n \n $this->users_id []= auth::user()->id;\n // Si le paramètre filleul existe, alors nous somme sur la page du filleul\n if($page_filleul != \"mes_filleuls\"){\n $this->users_id = $fill_ids;\n }\n \n \n\n $compromisEncaissee = Compromis::whereIn('id',$tab_compromisEncaissee_id)->where([['archive',false],['cloture_affaire','<',2]])->where(function($query){\n $query->where('user_id', auth::user()->id)\n ->orWhere('agent_id', auth::user()->id);\n })->get();\n\n $compromisEnattente = Compromis::whereIn('id',$tab_compromisEnattente_id)->where([['archive',false],['cloture_affaire','<',2]])->where(function($query){\n $query->where('user_id', auth::user()->id)\n ->orWhere('agent_id', auth::user()->id);\n })->get();\n\n\n $compromisSousOffre = Compromis::where([['demande_facture','<',2],['pdf_compromis',null],['archive',false],['cloture_affaire','<',2]])->where(function($query){\n $query->where('user_id', auth::user()->id)\n ->orWhere('agent_id', auth::user()->id);\n })->get();\n\n $compromisSousCompromis = Compromis::where([['demande_facture','<',2],['pdf_compromis','<>',null],['archive',false],['cloture_affaire','<',2]])->where(function($query){\n $query->where('user_id', auth::user()->id)\n ->orWhere('agent_id', auth::user()->id);\n })->get();\n }\n// ############ FIN TYPE AFFAIRE\n\n $compromis = array();\n if(Auth::user()->role ==\"admin\") {\n $compromis = Compromis::where([['je_renseigne_affaire',true],['archive',false],['cloture_affaire','<',2]])->latest()->get();\n $compromisParrain = Compromis::where([['je_renseigne_affaire',true],['archive',false],['cloture_affaire','<',2]])->latest()->get();\n }else{\n $compromis = Compromis::where([['user_id',Auth::user()->id],['je_renseigne_affaire',true],['archive',false],['cloture_affaire','<',2]])->orWhere([['agent_id',Auth::user()->id],['archive',false]])->latest()->get();\n \n \n \n\n\n // ########### Mise en place des conditions de parrainnage ############\n // Vérifier le CA du parrain et du filleul sur les 12 derniers mois précédents la date de vente et qui respectent les critères et vérifier s'il sont à jour dans le reglèmement de leur factures stylimmo \n // Dans cette partie on détermine le jour exaxt de il y'a 12 mois avant la date de vente\n \n \n // $compromisParrain = Compromis::where('archive',false)->where(function($query){\n \n // $filleuls = Filleul::where([['parrain_id',Auth::user()->id],['expire',false]])->select('user_id')->get()->toArray();\n // $fill_ids = array();\n // foreach ($filleuls as $fill) {\n // $fill_ids[]= $fill['user_id'];\n // }\n\n // $query->whereIn('user_id',$fill_ids )\n // ->orWhereIn('agent_id',$fill_ids );\n // })->latest()->get();\n \n $filleuls = Filleul::where([['parrain_id',Auth::user()->id],['expire',false]])->select('user_id')->get()->toArray();\n $fill_ids = array();\n foreach ($filleuls as $fill) {\n $fill_ids[]= $fill['user_id'];\n }\n\n // Les affaires des filleuls qui portent l'affaire \n $filleul1s = Compromis::where('archive',false)->whereIn('user_id',$fill_ids )->get();\n\n // Les affaires des filleuls qui ne portent pas l'affaire \n $filleul2s = Compromis::where('archive',false)->whereIn('agent_id',$fill_ids )->get();\n\n \n $id_fill1 = array();\n foreach ($filleul1s as $fill1) {\n $id_fill1[] = $fill1->id;\n }\n $id_fill2 = array();\n foreach ($filleul2s as $fill2) {\n $id_fill2[] = $fill2->id;\n }\n\n\n $compromisParrain = $filleul2s->concat($filleul1s);\n $compro_ids1 = array_intersect($id_fill1, $id_fill2);\n $compro_ids2 = $compro_ids1;\n // dd($compro_ids2);\n \n\n $valide_compro_id = array();\n \n // foreach ($fill_ids as $fill_id) {\n \n if($compromisParrain != null){\n foreach ($compromisParrain as $compro_parrain) {\n\n if($compro_parrain->id_valide_parrain_porteur == Auth::user()->id || $compro_parrain->id_valide_parrain_partage == Auth::user()->id){\n $valide_compro_id [] = $compro_parrain->id;\n\n }\n\n }\n }\n \n // }\n \n\n\n\n// ###################\n\n\n\n return view ('compromis.index',compact('compromis','compromisParrain','fill_ids','compro_ids1','compro_ids2','valide_compro_id','compromisEncaissee','compromisEnattente','compromisSousOffre','compromisSousCompromis','page_filleul','nb_jour_max_demande'));\n\n }\n // dd($compromis);\n return view ('compromis.index',compact('compromis','compromisParrain','compromisEncaissee','compromisEnattente','compromisSousOffre','compromisSousCompromis','page_filleul','nb_jour_max_demande'));\n }", "public function detail($context) {\n if (isset($this->post->compteur)) {\n $arrCompteur = $this->em->selectByAttr('compteur', 'numero', $this->post->compteur);\n $back_btn = '<div class=\"align-content-center\"><a href=\"reglements\" class=\"btn btn-primary\"><i class=\"glyphicon glyphicon-backward\"></i> Retour </a></div>';\n if (empty($arrCompteur)) {\n $this->handleStatus('Compteur introuvable.');\n $this->loadHtml($back_btn, 'content');\n return;\n }\n $compteur = $arrCompteur[0];\n $arrConso = $this->em->selectByAttr('consommation', 'idCompteur', $compteur->getId());\n if (empty($arrConso)) {\n $this->handleStatus('Aucune consommation pour ce compteur.');\n $this->loadHtml($back_btn, 'content');\n return;\n }\n $conso = $arrConso[0];\n //$facture = $this->em->selectById('facture', $conso->getId());\n $condition = 'cs.idCompteur=' . $compteur->getId() . ' AND f.idConsommation=cs.id AND f.paye=0';\n $this->em->entityName = 'facture';\n $arrFacture = $this->em->select('f.*')->from('facture f, consommation cs')->where($condition)->queryExcec();\n //var_dump($arrFacture); exit;\n if (empty($arrFacture)) {\n $facture = $this->em->selectById('facture', $conso->getId());\n if (empty($facture)) {\n $this->handleStatus('Facture non éditée.');\n } else {\n $this->handleStatus('Aucune facture à payer.');\n }\n $this->loadHtml($back_btn, 'content');\n return;\n }\n } elseif (isset($this->post->facture)) {\n $arrFacture = $this->em->selectByAttr('facture', 'numero', $this->post->facture);\n $back_btn = '<div class=\"align-content-center\"><a href=\"reglements\" class=\"btn btn-primary\"><i class=\"glyphicon glyphicon-backward\"></i> Retour </a></div>';\n if (empty($arrFacture)) {\n $this->handleStatus('Facture introuvable.');\n $this->loadHtml($back_btn, 'content');\n return;\n } else {\n $conso = $this->em->selectById('consommation', $arrFacture[0]->getId());\n }\n }\n $facture = $arrFacture[0];\n $this->loadView('detail', 'content');\n $this->dom->getElementById('facture')->innertext = $facture->getNumero();\n $this->dom->getElementById('consommation')->innertext = $conso->getQuantiteChiffre() . ' Litres';\n $this->dom->getElementById('montant')->innertext = $facture->getMontant() . ' FCFA';\n $this->dom->getElementById('dateConso')->innertext = Helper::getDate($conso->getDate());\n $this->dom->getElementById('dateFacturation')->innertext = Helper::getDate($facture->getDateFacturation());\n $this->dom->getElementById('dateLimitePaiement')->innertext = Helper::getDate($facture->getDateLimitePaiement());\n if ($facture->getPaye()) {\n $montant = 'Déja payée';\n } else {\n $montant = $facture->getMontant();\n if ($this->date > $facture->getDateLimitePaiement()) {\n $montant += $montant * 0.05;\n }\n $montant .= ' FCFA';\n $form = '<form method=\"POST\" class=\"margin-20px clearfix align-content-center\">';\n $form .= '<button type=\"submit\" name=\"payFacture\" id=\"payFacture\" value=\"' . $facture->getId() . '\" class=\"btn btn-primary\"><i class=\"glyphicon glyphicon-play\"></i> Payer </button>';\n $form .= '</form>';\n $this->dom->getElementById('payForm')->innertext = $form;\n }\n $this->dom->getElementById('montant2')->innertext = $montant;\n }", "public function todaInfoProductos(){\n\n for($i = 0; $i < count($this -> listProducto); $i++){\n $this -> listProducto[$i][0] -> getInfoBasic();\n }\n }", "function dsp_single_office_info()\n {\n $VIEW_DATA['arr_single_office_info'] = $this->model->qry_single_office_info();\n $this->view->render('dsp_single_office_info',$VIEW_DATA);\n }", "public function index()\n {\n //\n //au lieu de all nous allons utiliser paginate $produits = Produit::all() ;\n\n $produits = Produit::orderByDesc('id')->paginate(15) ;\n\n // $produits500 = Produit::where([\"prix\"=>500 , \"designation\"=>\"Cahier\"])->get();\n // 1 $premier = Produit::first() ;\n // $produit = Produit::find(20);\n // 1 dd($premier) ;\n // dd($produit) ;\n // dd($produits500);\n // dd($produits) ;\n //dump($produits) ;\n\n return view(\"front-office.produits.index\" , [\n \"produits\" => $produits\n ]) ;\n\n }", "function info()\n{\nglobal $client; ←\u0004\nLa programmation objet\nCHAPITRE 9 249\n//Utilisation de variables globales et d'un tableau superglobal\necho \"<h2> Bonjour $client, vous êtes sur le serveur: \",\n➥$_SERVER[\"HTTP_HOST\"],\"</h2>\"; ←\u0007\necho \"<h3>Informations en date du \",date(\"d/m/Y H:i:s\"),\"</h3>\";\necho \"<h3>Bourse de {$this–>bourse[0]} Cotations de {$this–>bourse[1]}\n➥à {$this–>bourse[2]} </h3>\"; ←\u0005\n//Informations sur les horaires d'ouverture\n$now=getdate();\n$heure= $now[\"hours\"];\n$jour= $now[\"wday\"];\necho \"<hr />\";\necho \"<h3>Heures des cotations</h3>\";\nif(($heure>=9 && $heure <=17)&& ($jour!=0 && $jour!=6))\n{ echo \"La Bourse de Paris ( \", self:: PARIS,\" ) est ouverte\n➥<br>\"; } ←\u0006\nelse\n{ echo \"La Bourse de Paris ( \", self:: PARIS,\" ) est fermée <br>\"; }", "function get_espacio_stocks_pdf()\n\t{\n\t\t$u = new Espacio_stock();\n\t\t$sql=\"select c.*, e.tag as estatus from cespacio_stocks as c left join estatus_general as e on e.id=c.estatus_general_id order by c.razon_social\";\n\t\t//Buscar en la base de datos\n\t\t$u->query($sql);\n\t\tif($u->c_rows > 0){\n\t\t\treturn $u;\n\t\t} else {\n\t\t\treturn FALSE;\n\t\t}\n\t}", "private function factuurAction()\n {\n if (isset($_POST) && !empty($_POST))\n {\n //productenOud zijn de producten die gekozen zijn in de webpagina\n // productenNieuw zijn de producten die gekozen zijn en daarna zijn verkregen van de database.\n $productenOud = $this->model->maakPDF();\n if ($productenOud === 'DUPS')\n {\n $this->model->foutGoedMelding('danger', '<strong> Foutmelding </strong> U heeft 2 dezelfde producten gekozen, gebruik hiervoor het aantal!');\n } else\n {\n $productNieuw = $this->model->geefBesteldeProducten($productenOud);\n $t = 1;\n for ($i = 0; $i < count($productenOud); $i++)\n {\n // van alle producten die zijn gekozen wordt de aantal voorraad gepakt\n $voorraadNieuw[$i] = $productNieuw[$i][0]->geefVoorraad();\n $gekozenAantal[$i] = $productenOud[$i][1];\n //de einde van de producten wordt d.m.v. count verkregen\n $eindeArray = count($productenOud);\n\n if ($voorraadNieuw[$i] > $gekozenAantal[$i])\n {\n $goeieVoorraad = true;\n } else\n {\n $goeieVoorraad = false;\n }\n\n if ($goeieVoorraad !== true)\n {\n $this->model->foutGoedMelding('danger', 'Gekozen product(en) is(zijn) niet op voorraad! Controleer het <a href=\".?action=magazijn&control=admin\">Magazijn <span class=\"glyphicon glyphicon-link\"></span></a>');\n } else\n {\n if ($t === $eindeArray)\n {\n $_SESSION['geselecteerdeProducten'] = $productenOud;\n $this->model->pdfToevoegen();\n $this->forward('factuurVerzend', 'admin');\n }\n }\n\n $goeieVoorraad = false;\n $t++;\n }\n }\n }\n\n $producten = $this->model->geefProducten();\n $this->view->set('producten', $producten);\n $klanten = $this->model->geefKlanten();\n $this->view->set('klanten', $klanten);\n }", "function commandes_trig_bank_reglement_en_attente($flux){\r\n\t// Si on est dans le bon cas d'un paiement de commande et qu'il y a un id_commande et que la commande existe toujours\r\n\tif ($id_transaction = $flux['args']['id_transaction']\r\n\t AND $transaction = sql_fetsel(\"*\",\"spip_transactions\",\"id_transaction=\".intval($id_transaction))\r\n\t\tAND $id_commande = $transaction['id_commande']\r\n\t\tAND $commande = sql_fetsel('id_commande, statut, id_auteur, mode', 'spip_commandes', 'id_commande='.intval($id_commande))){\r\n\r\n\t\t$statut_commande = $commande['statut'];\r\n\t\t$transaction_mode = $transaction['mode'];\r\n\t\t$commande_mode = $commande['mode'];\r\n\t\t$statut_nouveau = 'attente';\r\n\t\tif ($statut_nouveau !== $statut_commande OR $transaction_mode !==$commande_mode){\r\n\t\t\tspip_log(\"commandes_trig_bank_reglement_en_attente marquer la commande #$id_commande statut=$statut_nouveau mode=$transaction_mode\",'commandes');\r\n\t\t\t//on met a jour la commande\r\n\t\t\tinclude_spip(\"action/editer_commande\");\r\n\t\t\tcommande_modifier($id_commande,array('statut'=>$statut_nouveau,'mode'=>$transaction_mode));\r\n\t\t}\r\n\t}\r\n\r\n\treturn $flux;\r\n}", "public function solicitud_pdf_comfiar() {\n require_once(\"application/controllers/wsonline2/facturaElectronica.php\");\n\n $libfacturaElectronica = new FacturaElectronica();\n log_info($this->iniciLog);\n log_info($this->logHeader . ' Entro a solicitud_pdf_comfiar');\n\n $sqlfacturasinpdf = $this->db->query(\"SELECT pk_xml_codigo,xmlcom.url_pdf,xmlcom.pk_factura_codigo,xmlcom.id_transaccion_comfiar,fac.numero_factura\n FROM modfactur.factblxmlcomfiar xmlcom\n JOIN modfactur.factblfactur fac\n ON xmlcom.pk_factura_codigo = fac.pk_factur_codigo\n WHERE xmlcom.pk_tipo_xml_codigo =1\n and url_pdf is null order by pk_xml_codigo asc\");\n $facturas = $sqlfacturasinpdf->result_array;\n $total_sinpdf=count($facturas);\n log_info($this->logHeader . ' TOTAL FACTURAS SIN PDF = '.$total_sinpdf);\n \n if($total_sinpdf>0){\n //se consultan parametros consumo ws solo una vez para no \n $cuitId = $this->facturacionelectronica->retornarValorConfiguracion(3); //Cuit, RUC o NIT del emisor del comprobante. \n $puntoVentaId = $this->facturacionelectronica->retornarValorConfiguracion(5); //Número de punto de venta a procesar 01 factura\n $tipoComprobanteId = $this->facturacionelectronica->retornarValorConfiguracion(6); //Número del tipo de comprobante a procesar. Ejemplo 01:Factura\n $prefijoPeople = $this->facturacionelectronica->retornarValorConfiguracion(24); // Pefrijo factura ejemplo SETT\n }\n foreach ($facturas as $factura) {\n log_info($this->queryData . ' DATOS FACTURA: URL_PDF= ' . $factura['URL_PDF'] . ' PK_FACTURA_CODIGO= ' .\n $factura['PK_FACTURA_CODIGO'] . ' ID_TRANSACCION_COMFIAR= ' . $factura['ID_TRANSACCION_COMFIAR'] . ' NÚMERO_FACTURA= ' . $factura['NUMERO_FACTURA']);\n\n $urlWsdl = $this->facturacionelectronica->retornarValorConfiguracion(30);\n $wsdl = $urlWsdl;\n $options = array(\n 'cache_wsdl' => 0,\n 'trace' => 1,\n 'stream_context' => stream_context_create(array(\n 'ssl' => array(\n 'verify_peer' => false,\n 'verify_peer_name' => false,\n 'allow_self_signed' => true\n )\n ))\n );\n $client = new SoapClient($wsdl, $options);\n $transaccionId = $factura['ID_TRANSACCION_COMFIAR'];\n $nroComprobante = $factura['NUMERO_FACTURA'];\n $respuesta_token = $libfacturaElectronica->verificar_token_comfiar();\n\n log_info($this->logHeader . '::::RESPUESTA_VERIFICAR_TOKEN::::' . $respuesta_token);\n\n $sessionId = $this->facturacionelectronica->retornarValorConfiguracion(32);\n $fechaVenc = $this->facturacionelectronica->retornarValorConfiguracion(33);\n $pk_xml_codigo = $factura['PK_XML_CODIGO'];\n\n // web service input params\n $request_param = array(\n \"transaccionId\" => $transaccionId, //274 id transaccion confiar\n \"cuitId\" => $cuitId,\n \"puntoDeVentaId\" => $puntoVentaId,\n \"tipoComprobanteId\" => $tipoComprobanteId, // tipo comprobante factura 01\n \"numeroComprobante\" => $nroComprobante, //418 Número de factura enviado SETT418\n \"token\" => array(\n \"SesionId\" => $sessionId,\n \"FechaVencimiento\" => $fechaVenc\n )\n );\n log_info($this->logHeader . $this->postData . 'Id_Tx_Comfiar: ' . $transaccionId .\n ' cuitId: ' . $cuitId .\n ' puntoDeVentaId: ' . $puntoVentaId .\n ' tipoComprobanteId: ' . $tipoComprobanteId .\n ' numeroComprobante: ' . $nroComprobante .\n ' SesionId: ' . $sessionId .\n ' FechaVencimiento: ' . $fechaVenc .\n ' PK_xml_codigo: ' . $pk_xml_codigo);\n\n try {\n $responce_param = $client->DescargarPdf($request_param);\n log_info($this->postData . 'RESPUESTA COMSUMO DESCARGARPDF::' . json_encode($responce_param));\n if (isset($responce_param->DescargarPdfResult)) {\n\n\n $b64 = $responce_param->DescargarPdfResult;\n $data = base64_encode($b64);\n $urlpublica = $this->db->query(\"select VALOR_PARAMETRO from modgeneri.gentblpargen where pk_pargen_codigo =96\");\n $urlpublica = $urlpublica->result_array[0];\n //guarda y genera url factura pdf\n $folderPath = \"uploads/facturacomfiar/\";\n $date = date('Y-m-d');\n $random = rand(1000, 9999);\n $fact = strtolower($prefijoPeople) . '-' . $nroComprobante . '-';\n $name = $fact . strtolower($date . '-' . $random . '.pdf');\n $file_dir = $folderPath . $name;\n $url = $urlpublica['VALOR_PARAMETRO'] . '/' . $folderPath . $name;\n $pdf_decoded = base64_decode($data); //Write data back to pdf file\n try {\n $pdf = fopen($file_dir, 'w');\n fwrite($pdf, $pdf_decoded);\n //close output file\n fclose($pdf);\n $dataReturn = $url;\n// echo $url . '+++' . $fact;\n } catch (Exception $e) {\n $response = 'Excepción capturada: ' . $e->getMessage();\n }\n\n log_info($this->logHeader . '::Consumo Correcto soap DescargarPdf::URL PDF COMFIAR::' . $dataReturn);\n\n $response = $dataReturn;\n //llamar procedimiento actualiza url factura transmitida comfiar\n $sql = \"BEGIN modfactur.facpkgdatacomfiar.prcactualizapdffacturacomfiar(\n parpkxmlcodigo=>:parpkxmlcodigo,\n parurlpdf=>:parurlpdf,\n parrespuesta=>:parrespuesta);\n END;\";\n\n $conn = $this->db->conn_id;\n $stmt = oci_parse($conn, $sql);\n oci_bind_by_name($stmt, ':parpkxmlcodigo', $pk_xml_codigo, 32);\n oci_bind_by_name($stmt, ':parurlpdf', $dataReturn, 1000);\n oci_bind_by_name($stmt, ':parrespuesta', $parrespuesta, 32);\n if (!oci_execute($stmt)) {\n $e = oci_error($stmt);\n// VAR_DUMP($e);\n log_info($this->finLog . ' ERROR ACTUALIZANDO FACTURA -prcactualizapdffacturacomfiar- '\n . $e['message'] . '[*] parpkxmlcodigo=' . $pk_xml_codigo . '[*] parurlpdf=' . $dataReturn);\n }\n } else {\n $response = 'Error consumo Soap';\n }\n } catch (Exception $e) {\n log_info($this->logHeader . 'ERROR SOAP::' . $e->getMessage());\n\n $response = 'Error consumo DescargarPdf :' . $e->getMessage();\n }\n log_info($this->finLog . ' FACTURA NÚMERO= ' . $nroComprobante . ' PK_XML_CODIGO =' . $pk_xml_codigo . ' URL PDF ACTUALIZADA ::RESPONSE::' . $response);\n }\n }", "static function retrieve_parties_fftt( $licence )\n { \n\tglobal $gCms;\n\t$db = cmsms()->GetDb();\n\t$ping = cms_utils::get_module('Ping');\n\t//require_once(dirname(__FILE__).'/function.calculs.php');\n\t$saison_courante = $ping->GetPreference('saison_en_cours');\n\t$now = trim($db->DBTimeStamp(time()), \"'\");\n\t$aujourdhui = date('Y-m-d');\n\t$designation = \"\";\n\t$annee_courante = date('Y');\n\t$lignes = 0; //on instancie le nb de lignes 0 par défaut\n\t\n\t//les classes\n\t$service = new Servicen;\n\t$spid_ops = new spid_ops;\n\t\n\t$page = \"xml_partie_mysql\";\n\t$var = \"licence=\".$licence;\n\t$lien = $service->GetLink($page, $var);\n\t$xml = simplexml_load_string($lien,'SimpleXMLElement', LIBXML_NOCDATA);\n\t\n\tif($xml === FALSE)\n\t{\n\t\t$array = 0;\n\t\t$lignes = 0;\n\t\t$message = \"Service coupé ou pas de résultats disponibles\"; \n\t\t$status = 'Echec';\n\t\t$designation.= $message;\n\t\t$action = \"mass_action\";\n\t\tping_admin_ops::ecrirejournal($status, $designation,$action);\n\t}\n\telse\n\t{\n\t\t$array = json_decode(json_encode((array)$xml), TRUE);\n\t\tif(isset($array['partie']))\n\t\t{\n\t\t\t$lignes = count($array['partie']);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$lignes = 0;\n\t\t}\n\t\t\n\t\t//var_dump($xml);\n\t}\n\t\t\n\t\t\n\t\t$i = 0;\n\t\t$compteur = 0;\n\t\tforeach($xml as $cle =>$tab)\n\t\t{\n\t\t\t$compteur++;\n\n\t\t\t$licence = (isset($tab->licence)?\"$tab->licence\":\"\");\n\t\t\t$advlic = (isset($tab->advlic)?\"$tab->advlic\":\"\");\n\t\t\t$vd = (isset($tab->vd)?\"$tab->vd\":\"\");\n\n\t\t\t\tif ($vd =='V')\n\t\t\t\t{\n\t\t\t\t\t$vd = 1;\n\t\t\t\t}\n\t\t\t\telse \n\t\t\t\t{\n\t\t\t\t\t$vd = 0;\n\t\t\t\t}\n\n\t\t\t$numjourn = (isset($tab->numjourn)?\"$tab->numjourn\":\"0\");\n\n\t\t\t\tif(is_array($numjourn))\n\t\t\t\t{\n\t\t\t\t\t$numjourn = '0';\n\t\t\t\t}\n\t\t\t$nj = (int) $numjourn;\n\t\t\t\n\t\t\t$codechamp = (isset($tab->codechamp)?\"$tab->codechamp\":\"\");\n\n\t\t\t//on essaie de déterminer le nom de cette compet ?\n\t\t\t//$query = \"SELECT * FROM \".cms_db_prefix().\"module_ping_type_competition WHERE code_compet = ?\";\n\n\t\t\t$dateevent = (isset($tab->date)?\"$tab->date\":\"\");\n\t\t\t$chgt = explode(\"/\",$dateevent);\n\t\t\t//on va en déduire la saison\n\t\t\tif($chgt[1] < 7)\n\t\t\t{\n\t\t\t\t//on est en deuxième phase\n\t\t\t\t//on sait donc que l'année est la deuxième année\n\t\t\t\t$annee_debut = ($chgt[2]-1);\n\t\t\t\t$annee_fin = $chgt[2];\n\n\t\t\t}\n\t\t\telseif($chgt[1]>=7)\n\t\t\t{\n\t\t\t\t//on est en première phase\n\t\t\t\t$annee_debut = $chgt[2];\n\t\t\t\t$annee_fin = ($chgt[2]+1);\n\t\t\t}\n\t\t\t$saison = $annee_debut.\"-\".$annee_fin;\n\t\t\t$date_event = $chgt[2].\"-\".$chgt[1].\"-\".$chgt[0];\n\t\t\t//echo \"la date est\".$date_event;\n\n\t\t//\t$date_event = conv_date_vers_mysql($dateevent);\n\t\t\t$advsexe = (isset($tab->advsexe)?\"$tab->advsexe\":\"\");\n\t\t\t//$advnompre = mysqli_real_escape_string($link,(isset($tab->advnompre)?\"$tab->advnompre\":\"\"));\n\t\t\t$advnompre =(isset($tab->advnompre)?\"$tab->advnompre\":\"\");\n\t\t\t$pointres = (isset($tab->pointres)?\"$tab->pointres\":\"\");\n\t\t\t$coefchamp = (isset($tab->coefchamp)?\"$tab->coefchamp\":\"\");\n\t\t\t$advclaof = (isset($tab->advclaof)?\"$tab->advclaof\":\"\");\n\t\t\t$idpartie = (isset($tab->idpartie)?\"$tab->idpartie\":\"\");\n\t\t\t\n\t\t\t$add_fftt = $spid_ops->add_fftt($saison,$licence, $advlic, $vd, $nj, $codechamp, $date_event, $advsexe, $advnompre, $pointres, $coefchamp, $advclaof,$idpartie);\n\t\t\t\n\t\t\t\n\t\t}\n\t\treturn $compteur;\n\n }", "public function retraitEspeceCarte()\n {\n $fkagence = $this->userConnecter->fk_agence;\n $data['typeagence'] = $this->userConnecter->idtype_agence;\n $data['lang'] = $this->lang->getLangFile($this->getSession()->getAttribut('lang'));\n $telephone = trim(str_replace(\"+\", \"00\", $this->utils->securite_xss($_POST['phone'])));\n $data['benef'] = $this->compteModel->beneficiaireByTelephone1($telephone);\n $data['soldeAgence'] = $this->utils->getSoldeAgence($fkagence);\n\n $typecompte = $this->compteModel->getTypeCompte($telephone);\n if ($typecompte == 0) {\n $username = 'Numherit';\n $userId = 1;\n $token = $this->utils->getToken($userId);\n $response = $this->api_numherit->soldeCompte($username, $token, $telephone);\n $decode_response = json_decode($response);\n if ($decode_response->{'statusCode'} == 000) {\n $data['soldeCarte'] = $decode_response->{'statusMessage'};\n } else $data['soldeCarte'] = 0;\n } else if ($typecompte == 1) {\n $numcarte = $this->compteModel->getNumCarte($telephone);\n $numeroserie = $this->utils->returnCustomerId($numcarte);\n $solde = $this->api_gtp->ConsulterSolde($numeroserie, '6325145878');\n $json = json_decode(\"$solde\");\n $responseData = $json->{'ResponseData'};\n if ($responseData != NULL && is_object($responseData)) {\n if (array_key_exists('ErrorNumber', $responseData)) {\n $message = $responseData->{'ErrorNumber'};\n $data['soldeCarte'] = 0;\n } else {\n $data['soldeCarte'] = $responseData->{'Balance'};\n $currencyCode = $responseData->{'CurrencyCode'};\n }\n } else $data['soldeCarte'] = 0;\n }\n\n $params = array('view' => 'compte/retrait-espece-carte');\n $this->view($params, $data);\n }", "function commandes_trig_bank_reglement_en_echec($flux){\r\n\t// Si on est dans le bon cas d'un paiement de commande et qu'il y a un id_commande et que la commande existe toujours\r\n\tif ($id_transaction = $flux['args']['id_transaction']\r\n\t AND $transaction = sql_fetsel(\"*\",\"spip_transactions\",\"id_transaction=\".intval($id_transaction))\r\n\t\tAND $id_commande = $transaction['id_commande']\r\n\t\tAND $commande = sql_fetsel('id_commande, statut, id_auteur', 'spip_commandes', 'id_commande='.intval($id_commande))){\r\n\r\n\t\t$statut_commande = $commande['statut'];\r\n\t\t$transaction_mode = $transaction['mode'];\r\n\t\t$statut_nouveau = $statut_commande;\r\n\r\n\t\t// on ne passe la commande en erreur que si le reglement a effectivement echoue,\r\n\t\t// pas si c'est une simple annulation (retour en arriere depuis la page de paiement bancaire)\r\n\t\tif (strncmp($transaction['statut'],\"echec\",5)==0){\r\n\t\t\t$statut_nouveau = 'erreur';\r\n\t\t}\r\n\t\tif ($statut_nouveau !== $statut_commande){\r\n\t\t\tspip_log(\"commandes_trig_bank_reglement_en_attente marquer la commande #$id_commande statut=$statut_nouveau\",'commandes');\r\n\t\t\t//on met a jour la commande\r\n\t\t\tinclude_spip(\"action/editer_commande\");\r\n\t\t\tcommande_modifier($id_commande,array('statut'=>$statut_nouveau,'mode'=>$transaction_mode));\r\n\t\t}\r\n\t}\r\n\r\n\treturn $flux;\r\n}", "function cabecalhoRelatorio($oPdf, $oFiltros, $oTurma) {\n\n $sNomeEscola = $oTurma->getEscola()->getNome();\n $iCodigoReferencia = $oTurma->getEscola()->getCodigoReferencia();\n\n if ( $iCodigoReferencia != null ) {\n $sNomeEscola = \"{$iCodigoReferencia} - {$sNomeEscola}\";\n }\n\n $sDadosCabecalho = $oTurma->getEscola()->getDepartamento()->getInstituicao()->getDescricao().\"\\n\";\n $sDadosCabecalho .= \"SECRETÁRIA MUNICIPAL DE EDUCAÇÃO\".\"\\n\";\n $sDadosCabecalho .= $sNomeEscola.\"\\n\\n\";\n $sDadosCabecalho .= $oFiltros->sTituloCabecalho.\"\\n\";\n $sDadosCabecalho .= $oTurma->getBaseCurricular()->getCurso()->getEnsino()->getNome().\"\\n\\n\\n\";\n\n $oPdf->SetFont('arial', 'b', 8);\n $oPdf->SetXY(90, 10);\n $oPdf->MultiCell(100, 3, $sDadosCabecalho, 0, \"C\");\n\n $iPosicaoY = $oPdf->GetY();\n\n /**\n * Verificamos se existe o logo do municipio para impressao\n */\n if ($oTurma->getEscola()->getLogo() != '') {\n\n $oPdf->SetXY(30, 10);\n $oPdf->Image(\"imagens/files/\".$oTurma->getEscola()->getLogo(), $oPdf->GetX(), $oPdf->GetY()-6, 18);\n }\n\n /**\n * Verificamos se existe o logo da escola para impressao\n */\n if ($oTurma->getEscola()->getLogoEscola() != '') {\n\n $oPdf->SetXY(90, 10);\n $oPdf->Image(\"imagens/\".$oTurma->getEscola()->getLogoEscola(), 230, $oPdf->GetY()-6, 18);\n }\n\n $oPdf->SetXY(30, $iPosicaoY);\n $oPdf->Cell(60, 4, \"Etapa: {$oFiltros->sEtapa}\", 0, 0, \"C\");\n $oPdf->Cell(20, 4, \"Ano: {$oFiltros->iAno}\", 0, 0, \"C\");\n $oPdf->Cell(100, 4, \"Turma: {$oFiltros->sTurma}\", 0, 0, \"C\");\n $oPdf->Cell(30, 4, \"Turno: {$oFiltros->sTurno}\", 0, 1, \"C\");\n\n $oPdf->SetXY(10, 45);\n $oPdf->SetFont('arial', 'b', 7);\n $oPdf->Cell($oFiltros->iColunaNumero, $oFiltros->iAlturaLinhaCabecalho, \"Nº\", 1, 0, \"C\");\n $oPdf->Cell($oFiltros->iColunaAluno, $oFiltros->iAlturaLinhaCabecalho, \"Nome do Aluno\", 1, 0, \"C\");\n $oPdf->Cell($oFiltros->iColunaSexo, $oFiltros->iAlturaLinhaCabecalho, \"Sexo\", 1, 0, \"C\");\n $oPdf->Cell($oFiltros->iColunaDataNascimento, $oFiltros->iAlturaLinhaCabecalho, \"Data de Nascimento\", 1, 0, \"C\");\n $oPdf->Cell($oFiltros->iColunaIdadeMeses, $oFiltros->iAlturaLinhaCabecalho, \"Idade / Meses\", 1, 0, \"C\");\n\n switch ($oFiltros->sTipoModelo) {\n\n /**\n * 1 - Matricula Inicial\n * 2 - Demais Cursos\n */\n case (\"12\"):\n\n $oPdf->Cell($oFiltros->iColunaSituacaoMatricula, $oFiltros->iAlturaLinhaCabecalho, \"Situação de Matrícula\", 1, 0, \"C\");\n\n if ($oFiltros->iPreEscola == 2) {\n $oPdf->Cell($oFiltros->iColunaPreEscola, $oFiltros->iAlturaLinhaCabecalho, \"Pré-Escola\", 1, 0, \"C\");\n }\n break;\n\n /**\n * 2 - Matricula Final\n * 1 - Educacao Infantil\n */\n case (\"21\"):\n\n colunasMatriculaFinal($oPdf, $oFiltros);\n break;\n\n /**\n * 2 - Matricula Final\n * 2 - Demais Cursos\n */\n case (\"22\"):\n\n $oPdf->MultiCell($oFiltros->iColunaSituacaoMatricula, 6, \"Situação de Matrícula\", 1, \"C\");\n $oPdf->SetXY(163, 45);\n colunasMatriculaFinal($oPdf, $oFiltros);\n break;\n }\n\n $oPdf->Cell($oFiltros->iColunaCorRaca, $oFiltros->iAlturaLinhaCabecalho, \"Cor / Raça\", 1, 1, \"C\");\n\n $oFiltros->iPosicaoX = $oPdf->GetX();\n $oFiltros->iPosicaoY = $oPdf->GetY();\n}", "public function setPrenom($prenom){\n if(empty($prenom)){\n header(\"Location:../vu/formulaire_inscription.php\");\n return;\n\n\n //on declare de la variable prenom puis on appelle la varibale prive prenom\n $this->_prenom = $prenom;\n }\n\n public function setMail($mail){\n //Si mail est vide on fait\n if(empty($mail)){\n header(\"Location:../vu/formulaire_inscription.php\");\n return;\n\n }\n //on declare de la variable mail puis on appelle la varibale prive mail\n $this->_mail = $mail;\n }\n\n public function setAdresse($adresse){\n //Si adresse est vide on fait\n if(empty($adresse)){\n header(\"Location:../vu/formulaire_inscription.php\");\n return;\n }\n //on declare de la variable adresse puis on appelle la varibale prive adresse\n $this->_adresse = $adresse;\n }\n\n public function setNumero($numero){\n //Si numero est vide on fait\n if(empty($numero)){\n header(\"Location:../vu/formulaire_inscription.php\");\n return;\n\n }\n //on declare de la variable numero puis on appelle la varibale prive numero\n $this->_numero = $numero;\n }\n\n public function setMot_de_passe($mdp){\n //Si mdp est vide on fait\n if(empty($mdp)){\n header(\"Location:../vu/formulaire_inscription.php\");\n return;\n }\n //on declare de la varaible mdp puis on appelle la varibale prive mdp\n $this->_mdp = $mdp;\n }\n\n public function getNom(){return $this->_nom;} // on retourne nom\n public function getPrenom(){return $this->_prenom;} // on retourne prenom\n public function getMail(){return $this->_mail;} // on retourne mail\n public function getAdresse(){return $this->_adresse;} // on retourne adresse\n public function getNumero(){return $this->_numero;} // on retourne numero\n public function getMot_de_passe(){return $this->_mdp;} // on retourne mdp\n\n}", "function spiplistes_formulaire_abonnement (\n\t\t\t\t\t\t\t\t\t\t\t$type\n\t\t\t\t\t\t\t\t\t\t\t, $acces_membres\n\t\t\t\t\t\t\t\t\t\t\t, $formulaire\n\t\t\t\t\t\t\t\t\t\t\t, $nom_site_spip\n\t\t\t\t\t\t\t\t\t\t\t, $inscription_redacteur\n\t\t\t\t\t\t\t\t\t\t\t, $inscription_visiteur\n\t\t\t\t\t\t\t\t\t\t\t) {\n\t\n\t$mail_inscription_ = trim(strtolower(_request('mail_inscription_')));\n\t$nom_inscription_ = trim(_request('nom_inscription_'));\n\t$type_abo = _request('suppl_abo') ;\n\t$listes_demande = _request('list');\n\t$desabo = ($type_abo == 'non') ? 'oui' : 'non';\n\t\n\t$adresse_site = $GLOBALS['meta']['adresse_site'];\n\n\t$reponse_formulaire = '';\n\t$email_a_envoyer = $mode_modifier = $sql_where = false;\n\t$abonne = array();\n\t\n\t/**\n\t * Le formulaire est (re) activé\n\t * sauf si c'est un retour d'inscription\n\t * (qui attend confirmation via mail)\n\t */\n\t$activer_formulaire = 'oui';\n\t\n\t/**\n\t * La variable d est transmise via URL proposé en pied de mail\n\t * du courrier envoyé.\n\t * Elle n'est pas utilisée dans le squelette\n\t * d'abonnement.\n\t */\n\t$d = _request('d');\n\t\n\tif(!empty($d)) {\n\t\t$sql_where = array(\n\t\t\t\t'cookie_oubli='.sql_quote($d)\n\t\t\t\t, 'statut<>'.sql_quote('5poubelle')\n\t\t\t\t, 'pass<>'.sql_quote('')\n\t\t\t);\n\t}\n\t// ou si identifie'\n\telse if($connect_id_auteur = intval($GLOBALS['auteur_session']['id_auteur']))\n\t{\n\t\t$sql_where = array(\"id_auteur=$connect_id_auteur\");\n\t}\n\t\n\tif ($sql_where) {\n\t\t// cherche les coordonnees de l'abonne'\n\t\t$sql_select = 'id_auteur,statut,nom,email,cookie_oubli';\n\t\t$sql_result = sql_select(\n\t\t\t$sql_select\n\t\t\t, 'spip_auteurs'\n\t\t\t, $sql_where\n\t\t\t, '', '', 1\n\t\t);\n\t\tif($row = sql_fetch($sql_result)) {\n\t\t\tforeach(explode(',', $sql_select) as $key) {\n\t\t\t\t$abonne[$key] = $row[$key];\n\t\t\t}\n\t\t}\n\t\t$abonne['format'] = spiplistes_format_abo_demande($abonne['id_auteur']);\n\t\t\n\t}\n\t\n\t\n\t\n\t// si identifie' par cookie ou login... effectuer les modifications demandees\n\tif(count($abonne)) {\n\t\t\n\t\t/**\n\t\t * Créer un nouveau cookie pour ce compte\n\t\t * afin de le transmettre par mail\n\t\t * pour lien direct sur le formulaire sans auth.\n\t\t */\n\t\t$abonne['cookie_oubli'] = creer_uniqid();\n\t\tspiplistes_auteurs_cookie_oubli_updateq(\n\t\t\t\t\t\t\t\t\t\t\t\t$abonne['cookie_oubli'],\n\t\t\t\t\t\t\t\t\t\t\t\t$abonne['email']\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t//spiplistes_debug_log ('COOKIE: '.$abonne['cookie_oubli']);\n\t\n\t\t// toujours rester en mode modif pour permettre la correction\n\t\t$mode_modifier = 'oui';\n\t\t\n\t\tif($desabo == 'oui')\n\t\t{\n\t\t\tspiplistes_format_abo_modifier($abonne['id_auteur']);\n\t\t\t$reponse_formulaire = _T('spiplistes:vous_etes_desabonne');\n\t\t\t$email_a_envoyer = true;\n\t\t}\n\t\t\n\t\telse if($listes_demande)\n\t\t{\n\t\t\t//spiplistes_debug_log(\"demande modification abonnements listes \" . implode(\",\", $listes_demande));\n\t\t\t\n\t\t\tif(is_array($listes_demande) && count($listes_demande))\n\t\t\t{\n\t\t\t\t$listes_ajoutees = spiplistes_abonnements_ajouter($abonne['id_auteur']\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t, array_map('intval', $listes_demande)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t$curr_abos_auteur = spiplistes_abonnements_listes_auteur($abonne['id_auteur']);\n\t\t\t\t\n\t\t\t\tforeach($curr_abos_auteur as $id_liste) {\n\t\t\t\t\tif(!in_array($id_liste, $listes_demande)) {\n\t\t\t\t\t\tspiplistes_abonnements_auteur_desabonner($abonne['id_auteur']\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t , $id_liste\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// modifier le format de reception ?\n\t\t\tif(spiplistes_format_valide($type_abo) && ($type_abo != $abonne['format']))\n\t\t\t{\n\t\t\t\tspiplistes_format_abo_modifier($abonne['id_auteur'], $abonne['format'] = $type_abo);\n\t\t\t\t//$abonne['ids_abos'] = spiplistes_abonnements_listes_auteur($abonne['id_auteur']);\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t$reponse_formulaire = _T('spiplistes:demande_enregistree_retour_mail');\n\t\t\t$email_a_envoyer = true;\n\t\t}\n\t\telse if ( isset($abonne['nom']) )\n\t\t{\n\t\t\tspiplistes_debug_log('pas de demande, afficher formulaire de modif au complet');\n\t\t\t$reponse_formulaire = ''\n\t\t\t\t. '<span class=\"nom\">' . $abonne['nom'] . \"</span>\\n\"\n\t\t\t\t. '<span class=\"souhait\">' . _T('spiplistes:effectuez_modif_validez', array('s'=>$abonne['nom'])). \"</span>\\n\"\n\t\t\t\t;\n\t\t}\n\t\t\n\t\t$id_abonne = $abonne['id_auteur'];\n\t\t$objet_email = _T('spiplistes:votre_abo_listes');\n\t\t$contexte = array('titre' => $objet_email);\n\t\t\n\t}\n\telse // non identifie' ? gestion par cookie_oubli.\n\t{\n\t\t\n\t\t$texte_intro = _T('form_forum_message_auto') . '<br /><br />'._T('spiplistes:bonjour') . \"<br />\\n\";\n\t\t\n\t\t$abonne = array(\n\t\t\t'email' => email_valide($mail_inscription_),\n\t\t\t'cookie_oubli' => creer_uniqid()\n\t\t\t);\n\t\t\n\t\tif($abonne['email'])\n\t\t{\n\t\t\t// si l'abonne existe deja mais pas d'action demandee,\n\t\t\t// affiche formulaire complet\n\t\t\tif ($row = \n\t\t\t\tspiplistes_auteurs_auteur_select ('id_auteur,login,nom,statut,lang'\n\t\t\t\t\t\t\t\t\t\t\t\t , 'email='.sql_quote($abonne['email'])\n\t\t\t\t\t\t\t\t\t\t\t\t )\n\t\t\t) {\n\t\t\t\t\n\t\t\t\t$abonne['id_auteur'] = intval($row['id_auteur']);\n\t\t\t\t$abonne['statut'] = $row['statut'];\n\t\t\t\t$abonne['login'] = $row['login'];\n\t\t\t\t$abonne['nom'] = $row['nom'];\n\t\t\t\t$abonne['lang'] = $row['lang'];\n\t\t\t\t$abonne['format'] =\n\t\t\t\t\t($f = spiplistes_format_abo_demande($abonne['id_auteur']))\n\t\t\t\t\t? $f\n\t\t\t\t\t: 'texte'\n\t\t\t\t\t;\n\t\n\t\t\t\tif($abonne['statut'] == '5poubelle')\n\t\t\t\t{\n\t\t\t\t\t$reponse_formulaire = _T('form_forum_access_refuse');\n\t\t\t\t}\n\t\t\t\t// si encore nouveau, c'est qu'il ne s'est jamais identifie'\n\t\t\t\telse if($abonne['statut'] == 'nouveau')\n\t\t\t\t{\n\t\t\t\t\t// le supprimer. Il sera re-cree plus loin\n\t\t\t\t\tspiplistes_auteurs_auteur_delete('id_auteur='.sql_quote($abonne['id_auteur']));\n\t\t\t\t\t$abonne['id_auteur'] = false;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t// demande de modifier l'abonnement ? envoie le cookie de relance par mail\n\t\t\t\t\tspiplistes_auteurs_cookie_oubli_updateq($abonne['cookie_oubli']\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t, $abonne['email']\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t$objet_email = _T('spiplistes:abonnement_titre_mail');\n\t\t\t\t\t$texte_email = spiplistes_texte_inventaire_abos($abonne['id_auteur']\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t, $type_abo\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t, $nom_site_spip\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t$contexte = array('titre' => $objet_email);\n\t\t\t\t\t$id_abonne = $abonne['id_auteur'];\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t/**\n\t\t\t * Si l'adresse mail n'existe pas dans la base,\n\t\t\t * créer le compte\n\t\t\t */\n\t\t\telse \n\t\t\t{\n\t\t\t\t$activer_formulaire = 'non';\n\t\t\t\t\n\t\t\t\t$abonne['login'] = spiplistes_login_from_email($abonne['email']);\n\t\t\t\t$abonne['nom'] =\n\t\t\t\t\t(($acces_membres == 'non') || empty($nom_inscription_))\n\t\t\t\t\t? ucfirst($abonne['login'])\n\t\t\t\t\t: $nom_inscription_\n\t\t\t\t\t;\n\t\t\t\t\n\t\t\t\t// ajouter l'abonne\n\t\t\t\t$pass = creer_pass_aleatoire(8, $abonne['email']);\n\t\t\t\t$abonne['zepass'] = $pass;\n\t\t\t\t$abonne['mdpass'] = md5($pass);\n\t\t\t\t$abonne['htpass'] = generer_htpass($pass);\n\t\t\t\t\n\t\t\t\t$abonne['statut'] = ($inscription_redacteur == 'oui') ? 'nouveau' : '6forum';\n\t\n\t\t\t\t// format d'envoi par defaut pour le premier envoi de confirmation\n\t\t\t\t$abonne['format'] = spiplistes_format_abo_default();\n\t\t\t\t\n\t\t\t\t/**\n\t\t\t\t * creation du compte\n\t\t\t\t */\n\t\t\t\tif($id_abonne = spiplistes_auteurs_auteur_insertq(\n\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t'nom' => $abonne['nom']\n\t\t\t\t\t\t\t, 'email' => $abonne['email']\n\t\t\t\t\t\t\t, 'login' => $abonne['login']\n\t\t\t\t\t\t\t, 'pass' => $abonne['mdpass']\n\t\t\t\t\t\t\t, 'statut' => $abonne['statut']\n\t\t\t\t\t\t\t, 'htpass' => $abonne['htpass']\n\t\t\t\t\t\t\t, 'cookie_oubli' => $abonne['cookie_oubli']\n\t\t\t\t\t\t\t)\n\t\t\t\t\t)) {\n\t\t\t\t\t// creation .htpasswd & LDAP si besoin systeme\n\t\t\t\t\tecrire_acces();\n\t\t\t\t\t\n\t\t\t\t\t// premier format de reception par defaut\n\t\t\t\t\tspiplistes_format_abo_modifier($id_abonne, $abonne['format']);\n\t\t\t\t}\n\n\t\t\t\t$objet_email = _T('spiplistes:confirmation_inscription');\n\t\t\t\t\n\t\t\t\t$contexte = array(\n\t\t\t\t\t\t\t\t'titre' => $objet_email\n\t\t\t\t\t\t\t\t, 'nouvel_inscription' => 'oui'\n\t\t\t\t\t\t\t\t, 'inscription_redacteur' => $inscription_redacteur\n\t\t\t\t\t\t\t\t, 'inscription_visiteur' => $inscription_visiteur\n\t\t\t\t\t\t\t);\n\t\t\t}\n\t\t\t\n\t\t\t$email_a_envoyer = true;\n\t\t\t\n\t\t}\n\t\telse if(!empty($mail_inscription_)) {\n\t\t\t//Non email o non valida\n\t\t\treturn(array(true, _T('spiplistes:erreur_adresse'), $mode_modifier, false));\n\t\t}\n\t}\n\t\n\tif($id_abonne && $email_a_envoyer) {\n\t\t\n\t\t$abonne['ids_abos'] = spiplistes_abonnements_listes_auteur($abonne['id_auteur']);\n\n\t\t$abonne['format'] = spiplistes_format_valide($abonne['format']);\n\t\t\n\t\tlist ($message_html, $message_texte) = spiplistes_preparer_message(\n\t\t\t\t\t($objet_email = \"[$nom_site_spip] \" . $objet_email)\n\t\t\t\t\t, spiplistes_patron_message()\n\t\t\t\t\t, array_merge($contexte, $abonne)\n\t\t\t\t\t);\n\t\tif(\n\t\t\tspiplistes_envoyer_mail (\n\t\t\t\t$abonne['email']\n\t\t\t\t, $objet_email\n\t\t\t\t, array ('html' => $message_html, 'texte' => $message_texte)\n\t\t\t\t, false\n\t\t\t\t, ''\n\t\t\t\t, $abonne['format']\n\t\t\t)\n\t\t) {\n\t\t\t$reponse_formulaire =\n\t\t\t\t($acces_membres == 'oui')\n\t\t\t\t? _T('form_forum_identifiant_mail')\n\t\t\t\t: _T('spiplistes:demande_enregistree_retour_mail')\n\t\t\t\t;\n\t\t}\n\t\telse {\n\t\t\t$reponse_formulaire = _T('form_forum_probleme_mail');\n\t\t}\n\t}\n\t\n\t$result = array(\n\t\tTRUE,\n\t\t$reponse_formulaire,\n\t\t$mode_modifier,\n\t\t$abonne,\n\t\t$activer_formulaire\n\t);\n\n\treturn($result);\n}", "public function afficherClientAction($identifiant)\n {\n $em = $this->getDoctrine()->getManager();\n $client = $em->getRepository('CoutureGestionBundle:Client')->findOneBy(array('identifiant' => $identifiant));\n $mesure = $em->getRepository('CoutureGestionBundle:Mesure')->findOneBy(array('identifiant' => $identifiant));\n if ($client->getMesure() == NULL)\n {\n return $this->render('CoutureGestionBundle:Couture:afficherClientBis.html.twig', array(\n 'client' => $client, 'mesure' => $mesure\n ));\n }\n else {\n return $this->render('CoutureGestionBundle:Couture:afficherClient.html.twig', array(\n 'client' => $client, 'mesure' => $mesure\n ));\n }\n }", "public function gestionCompteAction(Request $request, $email)\n { \n $saison = new Saison;\n $annee = $saison->connaitreSaison();\n \n $repository = $this\n ->getDoctrine()\n ->getManager()\n ->getRepository('SCUserBundle:User');\n \n $user= $repository->findOneby(['email' => $email]);\n \n \n $em = $this->getDoctrine()->getManager();\n \n \n //on le rentre dans la table adhesion si il est pas encore inscrit \n $adhesion = $em->getRepository('SCUserBundle:Adhesion')->findOneby(\n array('user' => $email,\n 'saison'=> $annee\n ));\n if ($adhesion == null){\n \n $saison_actuel = $em->getRepository('SC\\ActiviteBundle\\Entity\\Saison')->find($annee);\n $adhesion = new Adhesion;\n $adhesion->setAdhesionAnnuel(false);\n $adhesion->setModalite(0);\n $adhesion->setMontantPaye(0);\n $adhesion->setRemise(0);\n $adhesion->setSaison($saison_actuel);\n $adhesion->setUser($user);\n $em->persist($adhesion);\n $em->flush();\n }\n \n // on recupere les donnees de la table adheion d'uinn user\n $repository = $this\n ->getDoctrine()\n ->getManager()\n ->getRepository('SCUserBundle:Adhesion');\n \n $adhesion = $repository->findOneby( array('user' => $email,'saison'=> $annee));\n \n //On cherche le montant que l'utilisateur doit au total pour une saison \n $dette = $em->getRepository('SCActiviteBundle:InscriptionActivite')->getSommeApayer($email);\n \n \n \n return $this->render('SCUserBundle:Admin:gestionCompte.html.twig',\n array('user'=>$user ,\n 'adhesion'=>$adhesion,\n 'dette'=>$dette\n )\n \n );\n \n }", "public function index()\n {\n //dd(auth()->user()->unreadNotifications );\n //dd(Auth::user()->id );\n $clients = User::whereHas('roles', function ($q) {\n $q->whereIn('name', ['client', 'ecom']);\n })->get();\n $users = [];\n $produits = [];\n\n if (!Gate::denies('ecom')) {\n $produits_total = Produit::where('user_id', Auth::user()->id)->get();\n foreach ($produits_total as $produit) {\n $stock = DB::table('stocks')->where('produit_id', $produit->id)->get();\n if ($stock[0]->qte > 0) {\n $produits[] = $produit;\n }\n }\n //dd($produits);\n }\n\n if (!Gate::denies('ramassage-commande')) {\n //session administrateur donc on affiche tous les commandes\n $total = DB::table('commandes')->where('deleted_at', NULL)->count();\n $commandes = DB::table('commandes')->where('deleted_at', NULL)->orderBy('updated_at', 'DESC')->paginate(10);\n\n //dd($clients[0]->id);\n } else {\n $commandes = DB::table('commandes')->where('deleted_at', NULL)->where('user_id', Auth::user()->id)->orderBy('updated_at', 'DESC')->paginate(10);\n $total = DB::table('commandes')->where('deleted_at', NULL)->where('user_id', Auth::user()->id)->count();\n //dd(\"salut\");\n }\n\n\n foreach ($commandes as $commande) {\n if (!empty(User::find($commande->user_id)))\n $users[] = User::find($commande->user_id);\n }\n //$commandes = Commande::all()->paginate(3) ;\n return view('commande.colis', [\n 'commandes' => $commandes,\n 'total' => $total,\n 'users' => $users,\n 'clients' => $clients,\n 'produits' => $produits\n ]);\n }", "public function affichePiedPage()\r\n\t\t{\r\n\t\t//appel de la vue du pied de page\r\n\t\trequire 'Vues/piedPage.php';\r\n\t\t}", "public function BestellingOverzichtView() {\r\n include_once('/var/www/filmpje.nl/backend/Stoelen.php');\r\n include_once('/var/www/filmpje.nl/backend/TotaalPrijsCalculatie.php');\r\n }", "function exec_raper_voir_journal () {\n\n\tglobal $connect_statut\n\t\t, $connect_toutes_rubriques\n\t\t, $connect_id_auteur\n\t\t;\n\n\t// la configuration est re'serve'e aux admins tt rubriques\n\t$autoriser = ($connect_statut == \"0minirezo\") && $connect_toutes_rubriques;\n\n////////////////////////////////////\n// PAGE CONTENU\n////////////////////////////////////\n\n\t$titre_page = _T('raper:titre_page_voir_journal');\n\t$rubrique = \"voir_journal\";\n\t$sous_rubrique = _RAPER_PREFIX;\n\n\t$commencer_page = charger_fonction('commencer_page', 'inc');\n\techo($commencer_page($titre_page, $rubrique, $sous_rubrique));\n\n\tif(!$autoriser) {\n\t\tdie (raper_terminer_page_non_autorisee() . fin_page());\n\t}\n\n\t$page_result = \"\"\n\t\t. \"<br /><br /><br />\\n\"\n\t\t. raper_gros_titre($titre_page, '', true)\n\t\t. barre_onglets($rubrique, $sous_rubrique)\n\t\t. debut_gauche($rubrique, true)\n\t\t. raper_boite_plugin_info()\n\t\t//. raper_boite_info_raper(true)\n\t\t. pipeline('affiche_gauche', array('args'=>array('exec'=>'raper_config'),'data'=>''))\n\t\t. creer_colonne_droite($rubrique, true)\n\t\t. raper_boite_raccourcis($rubrique, true)\n\t\t. pipeline('affiche_droite', array('args'=>array('exec'=>'raper_config'),'data'=>''))\n\t\t. debut_droite($rubrique, true)\n\t\t;\n\t\n\t// affiche milieu\n\t$page_result .= \"\"\n\t\t. debut_cadre_trait_couleur(\"administration-24.gif\", true, \"\", $titre_page)\n\t\t. raper_journal_lire(_RAPER_PREFIX)\n\t\t. fin_cadre_trait_couleur(true)\n\t\t;\n\t\t\n\t// Fin de la page\n\techo($page_result);\n\techo pipeline('affiche_milieu',array('args'=>array('exec'=>$sous_rubrique),'data'=>''))\n\t\t, raper_html_signature()\n\t\t, fin_gauche(), fin_page();\n}", "function SolicitarContrato(){\n $this->procedimiento = 'adq.f_cotizacion_ime';\n $this->transaccion = 'ADQ_SOLCON_IME';\n $this->tipo_procedimiento='IME';\n \n //Define los parametros para la funcion\n $this->setParametro('id_proceso_wf','id_proceso_wf','int4');\n\n //Ejecuta la instruccion\n $this->armarConsulta();\n $this->ejecutarConsulta();\n\n //Devuelve la respuesta\n return $this->respuesta;\n }", "function preCreateCatalog($ar){\n // lot\n $rs = selectQueryGetAll('select count(distinct categ) as nb from '.$this->wtscatalog);\n $newval = 'Groupe '.($rs[0]['nb']+1);\n $fdl = new XShortTextDef();\n $fdl->field = 'categ';\n $fdl->table = $this->wtscatalog;\n $fdl->fieldcount = '32';\n $fdl->compulsory = 1;\n $fvl = $fdl->edit($newval);\n XShell::toScreen2('br', 'ocateg', $fvl);\n // configuration\n $fdl = new XLinkDef();\n $fdl->field = 'prdconf';\n $fdl->table = $this->wtscatalog;\n $fdl->target = $this->wtsprdconf;\n $fdl->fieldcount = '1';\n $fdl->compulsory = 0;\n $fvl = $fdl->edit();\n XShell::toScreen2('br', 'oprdconf', $fvl);\n // liste des secteurs wts\n $fdl = new XLinkDef();\n $fdl->field = 'wtspool';\n $fdl->table = $this->wtscatalog;\n $fdl->target = $this->wtspool;\n $fdl->fieldcount = '1';\n $fdl->compulsory = 0;\n $fdl->checkbox = 0;\n $fvl = $fdl->edit();\n XShell::toScreen2('br', 'owtspool', $fvl);\n // liste des personnes wts\n $this->dswtsperson->browse(array('selectedfields'=>'all', 'tplentry'=>'br_wtsperson', 'pagesize'=>999));\n // liste des forfaits wts\n $this->dswtsticket->browse(array('selectedfields'=>'all', 'tplentry'=>'br_wtsticket', 'pagesize'=>999));\n // liste des pools ta\n $bpools = $this->dstapool->browse(array('selectedfields'=>'all', 'tplentry'=>'br_pool', 'pagesize'=>999));\n // liste des tickets ta par pool ta\n $tickets = array();\n foreach($bpools['lines_oid'] as $poid){\n $tickets[] = $this->dstaticket->browse(array('selectedfields'=>'all', 'tplentry'=>TZR_RETURN_DATA, 'pagesize'=>999,\n 'select'=>$this->dstaticket->select_query(array('cond'=>array('tapool'=>array('=', $poid))))\n )\n );\n }\n XShell::toScreen2('br', 'ticket', $tickets);\n // liste des types de personnes ta\n $this->dstaperson->browse(array('selectedfields'=>'all', 'tplentry'=>'br_person', 'pagesize'=>999));\n // date de recherche\n $fd = new XDateDef();\n $fd->field = 'validfrom';\n $r = $fd->edit(date('Y-m-d'));\n XShell::toScreen2('br', 'ovalidfrom', $r);\n }", "public function catalogos() \n\t{\n\t}", "function tacta($curso){\n\t\t\t//require('C:/Program Files (x86)/VertrigoServ/www/ingenieria/library/fpdf/fpdf.php');\n\t\t\t\n\t\t\tif(Session::get_data('tipousuario')!=\"PROFESOR\"){\n\t\t\t\t$this->redirect('/');\n\t\t\t}\n\n\t\t\t//ELIMINAR CONTENIDO DE LAS VARIABLES QUE PERTENECERÁN A LA CLASE\n\t\t\tunset($this -> excel);\n\t\t\tunset($this -> alumnado);\n\t\t\tunset($this -> registro);\n\t\t\tunset($this -> nombre);\n\t\t\tunset($this -> curso);\n\t\t\tunset($this -> materia);\n\t\t\tunset($this -> clave);\n\t\t\tunset($this -> situacion);\n\t\t\tunset($this -> especialidad);\n\t\t\tunset($this -> profesor);\n\t\t\tunset($this -> periodo);\n\t\t\tunset($this -> nomina);\n\t\t\tunset($this -> parcial);\n\n\t\t\t$id = Session::get_data('registro');\n\t\t\t//$periodo = $this -> actual;\n\t\t\t$Periodos = new Periodos();\n\t\t\t$periodo = $Periodos -> get_periodo_actual_();\n\n\t\t\t//Tendrá que llegar por medio de un post\n\t\t\t$parcial = $this -> post(\"tparcial\");\n\n\t\t\t$maestros = new Maestros();\n\t\t\t$maestro = $maestros -> find_first(\"nomina=\".$id);\n\n\t\t\t$xcursos = new Xtcursos();\n\t\t\t$materias = new Materia();\n\t\t\t$calificaciones = new Xtalumnocursos();\n\t\t\t$alumnos = new Alumnos();\n\t\t\t$Carrera = new Carrera();\n\n\t\t\tswitch($parcial){\n\t\t\t\tcase 1: $parcialito = \"PRIMER PARCIAL\"; break;\n\t\t\t\tcase 2: $parcialito = \"SEGUNDO PARCIAL\"; break;\n\t\t\t\tcase 3: $parcialito = \"TERCER PARCIAL\"; break;\n\t\t\t}\n\n\n\t\t\t$xcurso = $xcursos -> find_first(\"clavecurso='\".$curso.\"'\");\n\t\t\t$materia = $materias -> find_first(\"clave='\".$xcurso -> materia.\"'\");\n\n\t\t\t$this -> set_response(\"view\");\n\n\t\t\t$reporte = new FPDF();\n\n\t\t\t$reporte -> Open();\n\t\t\t$reporte -> AddPage();\n\n\t\t\t$reporte -> AddFont('Verdana','','verdana.php');\n\n\t\t\t$reporte -> Image('http://ase.ceti.mx/ingenieria/img/logoceti.jpg', 5, 0);\n\n\t\t\t$reporte -> SetX(45);\n\t\t\t$reporte -> SetFont('Verdana','',14);\n\t\t\t$reporte -> MultiCell(0,3,\"CENTRO DE ENSEÑANZA TÉCNICA INDUSTRIAL\",0,'C',0);\n\n\t\t\t$reporte -> Ln();\n\n\t\t\t$reporte -> SetX(45);\n\t\t\t$reporte -> SetFont('Verdana','',12);\n\t\t\t$reporte -> MultiCell(0,3,\"SUBDIRECCIÓN DE OPERACION ACADÉMICA\",0,'C',0);\n\n\t\t\t$reporte -> Ln();\n\t\t\t$reporte -> Ln();\n\n\t\t\t$reporte -> SetX(45);\n\t\t\t$reporte -> SetFont('Verdana','',12);\n\t\t\t$reporte -> MultiCell(0,2,\"NIVEL INGENIERÍA\",0,'C',0);\n\t\t\t$reporte -> Ln();\n\n\t\t\t$reporte -> SetX(45);\n\t\t\t$reporte -> SetFont('Verdana','',8);\n\t\t\t$reporte -> MultiCell(0,2,\"PLANTEL TONALA\",0,'C',0);\n\n\t\t\t$reporte -> Ln();\n\t\t\t$reporte -> Ln();\n\n\t\t\tif( substr( $periodo, 0, 1) == 1 )\n\t\t\t\t$periodo2 = \"FEB - JUN, \";\n\t\t\telse\n\t\t\t\t$periodo2 = \"AGO - DIC, \";\n\n\t\t\t$periodo2 .= substr($periodo,1,4);\n\n\t\t\t$reporte -> SetX(45);\n\t\t\t$reporte -> SetFont('Verdana','',8);\n\t\t\t$reporte -> MultiCell(0,2,\"REPORTE DE CALIFICACIONES PERIODO: \".$periodo2.\"\",0,'C',0);\n\n\t\t\t$reporte -> Ln();\n\t\t\t$reporte -> Ln();\n\t\t\t$reporte -> Ln();\n\n\t\t\t$reporte -> SetFillColor(0xDD,0xDD,0xDD);\n\t\t\t$reporte -> SetTextColor(0);\n\t\t\t$reporte -> SetDrawColor(0xFF,0x66,0x33);\n\t\t\t$reporte -> SetFont('Verdana','',6);\n\n\t\t\t$reporte -> Cell(20,4,\"NOMINA\",1,0,'C',1);\n\t\t\t$reporte -> Cell(60,4,\"NOMBRE DEL PROFESOR\",1,0,'C',1);\n\t\t\t$reporte -> Cell(25,4,\"PLANTEL\",1,0,'C',1);\n\t\t\t$reporte -> Cell(25,4,\"CLAVE CURSO\",1,0,'C',1);\n\t\t\t$reporte -> Cell(60,4,\"MATERIA\",1,0,'C',1);\n\n\t\t\t$reporte -> Ln();\n\t\t\t$reporte -> SetFillColor(0xFF,0xFF,0xFF);\n\t\t\t$reporte -> Cell(20,4,$id,1,0,'C',1);\n\t\t\t$reporte -> Cell(60,4,$maestro -> nombre,1,0,'C',1);\n\t\t\t$reporte -> Cell(25,4,\"TONALA\",1,0,'C',1);\n\t\t\t$reporte -> Cell(25,4,$curso,1,0,'C',1);\n\t\t\t$reporte -> Cell(60,4,$materia -> clave.\" - \".$materia -> nombre,1,0,'C',1);\n\n\t\t\t$reporte -> Ln();\n\t\t\t$reporte -> Ln();\n\n\t\t\t$reporte -> SetFillColor(0xDD,0xDD,0xDD);\n\t\t\t$reporte -> SetTextColor(0);\n\t\t\t$reporte -> SetDrawColor(0xFF,0x66,0x33);\n\t\t\t$reporte -> SetFont('Verdana','',8);\n\n\t\t\t$reporte -> SetFillColor(0xFF,0xFF,0xFF);\n\t\t\t$reporte -> Cell(127,6,\"\",1,0,'C',1);\n\t\t\t$reporte -> SetFillColor(0xDD,0xDD,0xDD);\n\t\t\t$reporte -> Cell(69,6,$parcialito,1,0,'C',1);\n\n\t\t\t$reporte -> Ln();\n\n\t\t\t$reporte -> SetFont('Verdana','',6);\n\n\t\t\t$reporte -> Cell(8,4,\"No.\",1,0,'C',1);\n\t\t\t$reporte -> Cell(18,4,\"REGISTRO\",1,0,'C',1);\n\t\t\t$reporte -> Cell(55,4,\"NOMBRE DEL ALUMNO\",1,0,'C',1);\n\t\t\t$reporte -> Cell(31,4,\"CARRERA\",1,0,'C',1);\n\t\t\t$reporte -> Cell(15,4,\"SITUACION\",1,0,'C',1);\n\t\t\t$reporte -> Cell(30,4,\"FALTAS\",1,0,'C',1);\n\t\t\t$reporte -> Cell(39,4,\"CALIFICACION\",1,0,'C',1);\n\n\t\t\t$reporte -> Ln();\n\n\t\t\t$reporte -> SetFillColor(0xFF,0xFF,0xFF);\n\t\t\t$np = 0;\n\t\t\tforeach($calificaciones -> find(\"curso_id='\".$xcurso->id.\"' ORDER BY registro\") as $calificacion){\n\t\t\t\t\t$n++;\n\n\t\t\t\t\tswitch($parcial){\n\t\t\t\t\t\t\tcase 1: if($calificacion -> calificacion1 >= 70 && $calificacion -> calificacion1 <= 100){ $aprobados++; } else { $reprobados++; } if( $calificacion -> calificacion1 >= 0 && $calificacion -> calificacion1 <= 100 ) { $promedio += $calificacion -> calificacion1; $np++;} break;\n\t\t\t\t\t\t\tcase 2: if($calificacion -> calificacion2 >= 70 && $calificacion -> calificacion2 <= 100){ $aprobados++; } else { $reprobados++; } if( $calificacion -> calificacion2 >= 0 && $calificacion -> calificacion2 <= 100 ) { $promedio += $calificacion -> calificacion2; $np++;} break;\n\t\t\t\t\t\t\tcase 3: if($calificacion -> calificacion3 >= 70 && $calificacion -> calificacion3 <= 100){ $aprobados++; } else { $reprobados++; } if( $calificacion -> calificacion3 >= 0 && $calificacion -> calificacion3 <= 100 ) { $promedio += $calificacion -> calificacion3; $np++;} break;\n\t\t\t\t\t}\n\n\t\t\t\t\tswitch($parcial){\n\t\t\t\t\t\t\tcase 1: $faltas = $calificacion -> faltas1; break;\n\t\t\t\t\t\t\tcase 2: $faltas = $calificacion -> faltas2; break;\n\t\t\t\t\t\t\tcase 3: $faltas = $calificacion -> faltas3; break;\n\t\t\t\t\t}\n\n\t\t\t\t\tswitch($parcial){\n\t\t\t\t\t\t\tcase 1: $cal = $calificacion -> calificacion1; break;\n\t\t\t\t\t\t\tcase 2: $cal = $calificacion -> calificacion2; break;\n\t\t\t\t\t\t\tcase 3: $cal = $calificacion -> calificacion3; break;\n\t\t\t\t\t}\n\n\t\t\t\t\tswitch($cal){\n\t\t\t\t\t\t\tcase 300: $cal=\"-\"; $faltas=\"-\"; break;\n\t\t\t\t\t\t\tcase 500: $cal=\"PND\"; break;\n\t\t\t\t\t\t\tcase 999: $cal=\"NP\"; $nps++; break;\n\t\t\t\t\t}\n\n\t\t\t\t\t$faltasletra = $this -> numero_letra($faltas);\n\t\t\t\t\t$calletra = $this -> numero_letra($cal);\n\n\t\t\t\t\tif($alumno = $alumnos -> find_first(\"miReg=\".$calificacion -> registro)){\n\t\t\t\t\t\t$carrera = $Carrera -> get_nombre_carrera_and_areadeformacion_($alumno);\n\t\t\t\t\t\t$reporte -> Cell(8,4,$n,1,0,'C',1);\n\t\t\t\t\t\t$reporte -> Cell(18,4,$calificacion -> registro,1,0,'C',1);\n\t\t\t\t\t\t$reporte -> Cell(55,4,$alumno -> vcNomAlu,1,0,'L',1);\n\t\t\t\t\t\t$reporte -> Cell(31,4, substr($carrera, 0, 26),1,0,'C',1);\n\t\t\t\t\t\t$reporte -> Cell(15,4,$alumno -> enTipo,1,0,'C',1);\n\t\t\t\t\t\t$reporte -> Cell(10,4,$faltas,1,0,'C',1);\n\t\t\t\t\t\t$reporte -> Cell(20,4,$faltasletra,1,0,'C',1);\n\t\t\t\t\t\t$reporte -> Cell(10,4,$cal,1,0,'C',1);\n\t\t\t\t\t\t$reporte -> Cell(29,4,$calletra,1,0,'C',1);\n\t\t\t\t\t\t$reporte -> Ln();\n\t\t\t\t\t}\n\t\t\t}\n\n\t\t\t$promedio /= $np;\n\t\t\t$aprobados += 0;\n\t\t\t$reprobados += 0;\n\t\t\t$nps += 0;\n\n\t\t\t$reporte -> Ln();\n\n\t\t\t$reporte -> SetFont('Verdana','',7);\n\n\t\t\t$reporte -> SetFillColor(0xDD,0xDD,0xDD);\n\t\t\t$reporte -> Cell(25,5,\"HORAS CLASE\",1,0,'C',1);\n\t\t\t$reporte -> Cell(25,5,\"AVANCE\",1,0,'C',1);\n\t\t\t$reporte -> Cell(26,5,\"NUMERO DE NPs\",1,0,'C',1);\n\t\t\t$reporte -> Cell(38,5,\"ALUMNOS APROBADOS\",1,0,'C',1);\n\t\t\t$reporte -> Cell(38,5,\"ALUMNOS REPROBADOS\",1,0,'C',1);\n\t\t\t$reporte -> Cell(38,5,\"PROMEDIO DEL GRUPO\",1,0,'C',1);\n\n\t\t\t$reporte -> Ln();\n\n\t\t\t$avance = $xcursos -> find_first(\"id='\".$xcurso->id.\"'\");\n\n\t\t\t$reporte -> SetFillColor(0xFF,0xFF,0xFF);\n\t\t\tswitch($parcial){\n\t\t\t\tcase 1: $reporte -> Cell(25,5,$avance -> horas1,1,0,'C',1); $reporte -> Cell(25,5,$avance -> avance1.\"%\",1,0,'C',1);break;\n\t\t\t\tcase 2: $reporte -> Cell(25,5,$avance -> horas2,1,0,'C',1); $reporte -> Cell(25,5,$avance -> avance2.\"%\",1,0,'C',1);break;\n\t\t\t\tcase 3: $reporte -> Cell(25,5,$avance -> horas3,1,0,'C',1); $reporte -> Cell(25,5,$avance -> avance3.\"%\",1,0,'C',1);break;\n\t\t\t}\n\n\t\t\t$reporte -> Cell(26,5,$nps,1,0,'C',1);\n\t\t\t$reporte -> Cell(38,5,$aprobados,1,0,'C',1);\n\t\t\t$reporte -> Cell(38,5,$reprobados,1,0,'C',1);\n\n\t\t\t$promedio = round($promedio*100)/100;\t//REDONDEO A DOS DECIMALES\n\n\t\t\t$reporte -> Cell(38,5,$promedio,1,0,'C',1);\n\n\t\t\t$reporte -> Ln();\n\t\t\t$reporte -> Ln();\n\n\t\t\t$reporte -> SetX(70);\n\t\t\t$reporte -> SetFillColor(0xDD,0xDD,0xDD);\n\t\t\t$reporte -> Cell(70,4,\"FIRMA DEL PROFESOR\",1,0,'C',1);\n\n\t\t\t$reporte -> Ln();\n\t\t\t$reporte -> SetX(70);\n\t\t\t$reporte -> SetFillColor(0xFF,0xFF,0xFF);\n\t\t\t$reporte -> Cell(70,15,\"\",1,0,'C',1);\n\n\t\t\t$reporte -> Ln();\n\t\t\t$reporte -> SetX(70);\n\t\t\t$reporte -> SetFillColor(0xDD,0xDD,0xDD);\n\t\t\t$reporte -> Cell(70,5,$maestro -> nombre,1,0,'C',1);\n\t\t\t\n\t\t\t$reporte -> Ln();\n\t\t\t$reporte -> Ln();\n\t\t\t$reporte -> Ln();\n\t\t\t$reporte -> SetX(165);\n\t\t\t$reporte -> SetFont('Verdana','',8);\n\t\t\t$reporte -> MultiCell(0,2,\"FSGC-217-7.INS-005\",0,'C',0);\n\t\t\t\n\t\t\t// /datos/calculo/ingenieria/apps/default/controllers\n\t\t\t$reporte -> Output(\"public/files/reportes/\".$periodo.\"/\".$parcial.\"/\".$curso.\".pdf\");\n\n\t\t\t$this->redirect(\"public/files/reportes/\".$periodo.\"/\".$parcial.\"/\".$curso.\".pdf\");\n }", "public function getProdFront()\n {\n return $this->prod_front;\n }", "public function getAproposUrl(){\n // return \"chanson.php/\".$id; \n return $this->rootUrl().\"apropos\"; \n }" ]
[ "0.6683356", "0.64476615", "0.62574404", "0.6222986", "0.62200797", "0.61618686", "0.6105604", "0.6039797", "0.60173196", "0.60048485", "0.5986522", "0.5942242", "0.59391785", "0.59286934", "0.59247583", "0.5918956", "0.5905682", "0.58997756", "0.5898244", "0.58957744", "0.5869641", "0.5861953", "0.5851538", "0.5850208", "0.5850208", "0.58496666", "0.58492225", "0.5813206", "0.5812925", "0.58104235", "0.57647336", "0.57546055", "0.5746945", "0.5746311", "0.5743891", "0.57328326", "0.5721064", "0.5719595", "0.5718693", "0.57090443", "0.5697052", "0.5694886", "0.5684419", "0.5683999", "0.56827486", "0.5680122", "0.56784266", "0.5671446", "0.5671177", "0.56657887", "0.56601095", "0.5649351", "0.5645953", "0.5643011", "0.5634823", "0.5634163", "0.5633551", "0.5624381", "0.56142974", "0.56106555", "0.5603455", "0.559311", "0.5587546", "0.5586522", "0.5585827", "0.5585821", "0.55842596", "0.5583906", "0.5583374", "0.5581971", "0.55792123", "0.55755293", "0.5570104", "0.5568743", "0.5566835", "0.556353", "0.5557535", "0.554741", "0.55400634", "0.5531874", "0.55311775", "0.5530319", "0.5528695", "0.55251986", "0.552048", "0.552006", "0.55199325", "0.5517458", "0.5517052", "0.55161154", "0.5511239", "0.55095965", "0.5508484", "0.5505664", "0.55046624", "0.55046296", "0.54999036", "0.5498622", "0.549718", "0.54940134", "0.5493306" ]
0.0
-1
modifier un produit front offcie
public function editProductAction($id){ $em=$this->getDoctrine()->getManager(); $product=$em->getRepository('HologramBundle:Product')->find($id); $p=$product->getProductPhoto(); $v=$product->getVideo(); /*$form = $this->createFormBuilder($product) ->add('video','file', array('data_class' => null, 'required' => false,'attr' =>array('class'=>' form-control custom-file-input'),'label'=>'Update your video ')) ->add('productPhoto','file', array('data_class' => null, 'required' => false,'attr' =>array('class'=>' form-control custom-file-input'),'label'=>'Update your logo ')) ->getForm(); */ $request = $this->get('request'); if($request->getMethod()=='POST') { $upload = new Upload("", "../web/Uploads/", 0, 0); $video=$this->getRequest()->files->get('file'); $productPhoto = $this->getRequest()->files->get('upload2'); if($productPhoto != null) { $file1 = array("tmp_name" => $productPhoto->getPathname(), "type" => $productPhoto->getMimeType() ); $product->setProductPhoto($upload->uploadFile($file1)); }else{ $product->setProductPhoto($p); } //video if($video != null) { $file2 = array("tmp_name" => $video->getPathname(), "type" => $video->getMimeType() ); $product->setVideo($upload->uploadFile($file2)); }else{ $product->setVideo($v); } $n=$request->get('nomp'); $c=$request->get('contenup'); if ($product->getEtat() == "valider"){ $product->setEtat("en attente"); } $product->setProductName($n); $product->setProductContent($c); $em->persist($product); $em->flush(); return $this->redirectToRoute('esprit_hologram_front_products'); } return $this->render('HologramBundle:Front:oneProduct.html.twig', array('p'=>$product,'id'=>$id)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function wtsProPaiement($ar){\n $p = new XParam($ar, array());\n $orderoid = $p->get('orderoid');\n // verification du client de la commande et du compte connecte\n list($okPaiement, $mess) = $this->paiementEnCompte($orderoid);\n if (!$okPaiement){\n XLogs::critical(get_class($this), 'paiement pro refusé '.$orderoid.' '.$mess);\n XShell::setNext($GLOBALS['TZR_SESSION_MANAGER']::complete_self(true, true).'&alias='.$this->aliasvente.'&moid='.$this->_moid.'&function=wtsLireOffres');\n return;\n }\n // traitement post commande std\n clearSessionVar('caddie');\n XLogs::critical(get_class($this), 'enregistrement paiement en compte '.$orderoid);\n // traitement standards après validation\n $this->postOrderActions($orderoid, true);\n\n // traitement post order - devrait être dans postOrderActions\n $this->proPostOrderActions($orderoid);\n\n // retour \n if (defined('EPL_ALIAS_PAIEMENT_ENCOMPTE')){\n XShell::setNext($GLOBALS['TZR_SESSION_MANAGER']::complete_self().'alias='.EPL_ALIAS_PAIEMENT_ENCOMPTE);} else {\n XShell::setNext($GLOBALS['TZR_SESSION_MANAGER']::complete_self(true, true).'&alias='.$this->aliasvente.'&moid='.$this->_moid.'&function=wtsLireOffres');\n }\n }", "public function videPanier()\n {\n $this->CollProduit->vider();\n }", "public function AggiornaPrezzi(){\n\t}", "public function extra_voor_verp()\n\t{\n\t}", "function ajouterProduit($code, $nom, $prix) {\n\t // echo \"<p>ajouter $code $nom $prix </p> \";\n\t \n\t /* on verifie si le panier n'est pas vide */ \n\t if ( $this->nbProduits == 0) {\n\t // echo \"<p>premier produit </p> \";\n\t \n\t /* le panier etait vide - on y ajoute un nouvel produit */\n\t $prod = new Produit($code, $nom, $prix);\n\t \n\t /* le produit dans la ligne de panier */ \n\t $lp = new LignePanier($prod);\n\t \n\t /* on garde chaque ligne dans un tableau associatif, avec le code produit en clé */\n\t\t\t $this->lignes[$code] = $lp;\n\t\t\t \n\t \n\t // echo \"<p>\" . $lp->prod->code . \" \" . $lp->qte . \"</p>\" ;\n\t \n\t $this->nbProduits = 1;\n\t }\n\t else {\n\t /* il y a deja des produits dans le panier */\n\t /* on verifie alors si $code n'y est pas deja */\n\t \n\t if ( isset ($this->lignes[$code]) ) {\n\t /* le produit y figure deja, on augmente la quantite */\n\t $lp = $this->lignes[$code] ; //on recupere la ligne du panier\n\t $qte = $lp->qte; \n\t $lp->qte = $qte + 1;\n\t \n\t // echo \"<p> nouvelle qte ($qte) : \" . $lp->qte .\"</p>\" ;\n\t \n\t }\n\t else { \n\t /* le produit n'etait pas encore dans le panier, on n'y ajoute */\n\t $prod = new Produit($code, $nom, $prix);\n\t $lp = new LignePanier($prod);\n\t \n\t $this->lignes[$code] = $lp;\n\t $this->nbProduits = $this->nbProduits + 1;\n\t \n\t\t\t\t // echo \"<p>\" . $this->lignes[$code]->prod->code . \" \" . $this->lignes[$code]->qte . \"</p>\" ;\n\t\t\t\t \n\n\t } \n\t \n\t }\t \n\t \n\t }", "public function partirAuTravail(): void\n\t{\n\t}", "final function velcom(){\n }", "public function get_compte(){retrun($id_local_compte); }", "public function ajoutProduitEncore()\n {\n Produit::create(\n [\n 'uuid' => Str::uuid(),\n 'designation' => 'Mangue',\n 'description' => 'Mangue bien grosse et sucrée! Yaa Proprè !',\n 'prix' => 1500,\n 'like' => 63,\n 'pays_source' => 'Togo',\n 'poids' => 89.5,\n ]\n );\n }", "public function affichageAction() {\r\n \r\n $em=$this->getDoctrine()->getManager();\r\n $products=$em->getRepository('HologramBundle:Product')->findBy(array('etat'=>'en attente'));\r\n return $this->render('HologramBundle:Back:produitsNonValides.html.twig',array('prod'=>$products));\r\n }", "public function rechercherUn() {\n\n // query to read single record\n $query = \"SELECT * FROM \" . $this->sNomTable . \"\n LEFT JOIN produit ON idProduit = iNoProduit\n WHERE idContenuCommande = :idContenuCommande\";\n\n // prepare query statement\n $stmt = $this->oConnexion->prepare($query);\n\n // bind id of product to be updated\n $stmt->bindParam(\":idContenuCommande\", $this->idContenuCommande);\n\n // execute query\n $stmt->execute();\n\n // get retrieved row\n $row = $stmt->fetch(PDO::FETCH_ASSOC);\n\n // set values to object properties\n $this->idContenuCommande = $row['idContenuCommande'];\n $this->iQteProduitCommande = $row['iQteProduitCommande'];\n $this->fPrixCommande = $row['fPrixCommande'];\n $this->iNoCommande = $row['iNoCommande'];\n\n // Produit\n $this->iNoProduit = $row['iNoProduit'];\n $this->sSKUProduit = $row['sSKUProduit'];\n $this->sNomProduit = $row['sNomProduit'];\n $this->sMarque = $row['sMarque'];\n $this->fPrixProduit = $row['fPrixProduit'];\n $this->fPrixSolde = $row['fPrixSolde'];\n $this->sDescCourteProduit = $row['sDescCourteProduit'];\n $this->sCouleur = $row['sCouleur'];\n $this->sCapacite = $row['sCapacite'];\n }", "public function paroleAction() {\n\t\t \t\t\t\t\n\t\t\n\t}", "public function rechercherUn() {\n\n // query to read single record\n $query = \"SELECT * FROM \" . $this->sNomTable . \"\n LEFT JOIN panier ON idPanier = iNoPanier\n LEFT JOIN produit ON idProduit = iNoProduit\n WHERE iNoPanier = :iNoPanier\";\n\n // prepare query statement\n $stmt = $this->oConnexion->prepare($query);\n\n // bind id of product to be updated\n $stmt->bindParam(\":iNoPanier\", $this->iNoPanier);\n\n // execute query\n $stmt->execute();\n\n // get retrieved row\n $row = $stmt->fetch(PDO::FETCH_ASSOC);\n\n // set values to object properties\n $this->idContenuPanier = $row['idContenuPanier'];\n $this->iQteProduit = $row['iQteProduit'];\n\n // Produit\n $this->iNoProduit = $row['iNoProduit'];\n $this->sSKUProduit = $row['sSKUProduit'];\n $this->sNomProduit = $row['sNomProduit'];\n $this->sMarque = $row['sMarque'];\n $this->fPrixProduit = $row['fPrixProduit'];\n $this->fPrixSolde = $row['fPrixSolde'];\n $this->sDescCourteProduit = $row['sDescCourteProduit'];\n $this->sDescLongProduit = $row['sDescLongProduit'];\n $this->sCouleur = $row['sCouleur'];\n $this->sCapacite = $row['sCapacite'];\n $this->sDateAjout = $row['sDateAjout'];\n $this->bAfficheProduit = $row['bAfficheProduit'];\n $this->iNoCategorie = $row['iNoCategorie'];\n $this->sNomCategorie = $row['sNomCategorie'];\n $this->sUrlCategorie = $row['sUrlCategorie'];\n\n // Panier\n $this->iNoPanier = $row['iNoPanier'];\n $this->sNumPanier = $row['sNumPanier'];\n $this->sDateModification = $row['sDateModification'];\n }", "public function devuelveProductos()\n {\n parent::Conexion();\n }", "function AfficherOffre($offre,$bool)\n {\n require(\"db/connect.php\");\n //on récupère les informations de l'adresse liée à l'offre\n if ($offre [\"adresse_id\"]!=null)\n {\n $requete='SELECT * FROM adresse WHERE adresse_id ='. $offre [\"adresse_id\"];\n $resultat=$BDD->query($requete);\n $adresse=$resultat->fetch();\n }\n if ($bool) print '<div class=\"col-xs-8 col-sm-4 col-md-4 col-lg-4 fondClair\" \n style=\"height:200px;\">';\n if (!$bool) print '<div class=\"col-xs-8 col-sm-4 col-md-4 col-lg-4 fondFonce\" \n style=\"height:200px;\">';\n print '\n <div class=\"margeSimpson\">\n <h2> <a href=\"detailEmploi.php?offre='.$offre['offre_id'].'\">'.\n $offre['offre_nom'].'</a></h2>';\n if ($offre [\"adresse_id\"]!=null)\n {$adresse['adresse_ville'];} \n print '<br/>'\n . 'Durée : '.$offre['offre_duree']\n . '<br/>Remunération : '.$offre['offre_renum'].\n '<br/><br/><br/><i>postée le '.$offre['offre_datePoste'].'</i>\n </div>\n </div>';\n if ($bool) print '<div class=\"col-xs-12 col-sm-12 col-md-8 col-lg-8 fondClair\" \n style=\"height:200px;\"> ';\n if (!$bool) print '<div class=\"col-xs-12 col-sm-12 col-md-8 col-lg-8 fondFonce\" \n style=\"height:200px;\"> ';\n print '\n <div class=\"margeSimpson2\">'.\n $offre['offre_descrCourte'].\n '</div>\n </div>';\n }", "public function serch()\n {\n }", "public function pasaje_abonado();", "public function attaquerAdversaire() {\n\n }", "function cinotif_trouver_objet_courrier_et_destinataire($id_courrier, $id_auteur=0, $id_abonne=0) {\n\t$return = array('objet'=>'','id_objet'=>0);\n\t$id_courrier = intval($id_courrier);\n\t$id_auteur = intval($id_auteur);\n\t$id_abonne = intval($id_abonne);\n\t$evenement_recherche = 0;\n\n\tif ($id_courrier>0 AND ($id_auteur OR $id_abonne)) {\n\t\t\n\t\t// contenu notifie\n\t\t$quoi = '';\n\t\t$objet = '';\n\t\t$id_objet = 0;\n\t\t$row = sql_fetsel('*', 'spip_cinotif_courriers', 'id_courrier='.$id_courrier);\n\t\tif ($row) {\n\t\t\t$quoi = $row['quoi'];\n\t\t\t$objet = $row['objet'];\n\t\t\t$id_objet = intval($row['id_objet']);\n\t\t\t$parent = $row['parent'];\n\t\t\t$id_parent = intval($row['id_parent']);\n\t\t}\n\n\t\t// article\n\t\tif ($parent=='article'){\n\t\t\t$evenement_recherche = cinotif_evenement_recherche($id_auteur,$id_abonne,$quoi,$parent,array($id_parent));\n\t\t\t\n\t\t\tif (!$evenement_recherche) {\n\t\t\t\t$t = sql_fetsel(\"id_rubrique\", \"spip_articles\", \"id_article=\".$id_parent);\n\t\t\t\t$id_parent = $t['id_rubrique'];\n\t\t\t\t$parent = 'rubrique';\n\t\t\t}\n\t\t}\t\t\t\n\n\t\t// rubrique\n\t\tif ($parent=='rubrique'){\n\t\t\t$ascendance = cinotif_ascendance($id_parent);\n\t\t\t$evenement_recherche = cinotif_evenement_recherche($id_auteur,$id_abonne,$quoi,$parent,$ascendance);\n\t\t\t\n\t\t\t// cas particulier ou on s'abonne a un article a l'evenement modification d'article\n\t\t\tif (!$evenement_recherche AND $quoi=='articlemodifie')\n\t\t\t\t$evenement_recherche = cinotif_evenement_recherche($id_auteur,$id_abonne,$quoi,$objet,array($id_objet));\n\t\t}\n\t\t\n\t\t// site\n\t\tif (!$evenement_recherche) {\n\t\t\t$evenement_recherche = cinotif_evenement_recherche($id_auteur,$id_abonne,$quoi,'site',array());\n\t\t}\n\t\tif ($evenement_recherche) {\n\t\t\t$row = sql_fetsel('*', 'spip_cinotif_evenements', \"id_evenement=\".$evenement_recherche);\n\t\t\t$return = array('objet'=>$row['objet'],'id_objet'=>$row['id_objet']);\n\t\t}\n\t}\n\t\n\treturn $return;\n}", "function commandes_trig_bank_reglement_en_attente($flux){\r\n\t// Si on est dans le bon cas d'un paiement de commande et qu'il y a un id_commande et que la commande existe toujours\r\n\tif ($id_transaction = $flux['args']['id_transaction']\r\n\t AND $transaction = sql_fetsel(\"*\",\"spip_transactions\",\"id_transaction=\".intval($id_transaction))\r\n\t\tAND $id_commande = $transaction['id_commande']\r\n\t\tAND $commande = sql_fetsel('id_commande, statut, id_auteur, mode', 'spip_commandes', 'id_commande='.intval($id_commande))){\r\n\r\n\t\t$statut_commande = $commande['statut'];\r\n\t\t$transaction_mode = $transaction['mode'];\r\n\t\t$commande_mode = $commande['mode'];\r\n\t\t$statut_nouveau = 'attente';\r\n\t\tif ($statut_nouveau !== $statut_commande OR $transaction_mode !==$commande_mode){\r\n\t\t\tspip_log(\"commandes_trig_bank_reglement_en_attente marquer la commande #$id_commande statut=$statut_nouveau mode=$transaction_mode\",'commandes');\r\n\t\t\t//on met a jour la commande\r\n\t\t\tinclude_spip(\"action/editer_commande\");\r\n\t\t\tcommande_modifier($id_commande,array('statut'=>$statut_nouveau,'mode'=>$transaction_mode));\r\n\t\t}\r\n\t}\r\n\r\n\treturn $flux;\r\n}", "function accesrestreintobjets_affiche_milieu($flux){\n\tif ($flux[\"args\"][\"exec\"] == \"configurer_accesrestreint\") {\n\t\t$flux[\"data\"] = recuperer_fond('prive/squelettes/inclure/configurer',array('configurer'=>'configurer_accesrestreintobjets')).$flux[\"data\"];\n\t}\n\t// Ajouter la config des zones sur la vue de chaque objet autorisé\n\telseif (\n\t\t$exec = trouver_objet_exec($flux['args']['exec'])\n\t\tand include_spip('inc/config')\n\t\tand include_spip('inc/autoriser')\n\t\tand $objets_ok = lire_config('accesrestreintobjets/objets')\n\t\t// Si on a les arguments qu'il faut\n\t\tand $type = $exec['type']\n\t\tand $id = intval($flux['args'][$exec['id_table_objet']])\n\t\t// Si on est sur un objet restrictible\n\t\tand in_array($exec['table_objet_sql'], $objets_ok)\n\t\t// Et que l'on peut configurer le site\n\t\tand autoriser('configurer')\n\t) {\n\t\t$liens = recuperer_fond(\n\t\t\t'prive/objets/editer/liens',\n\t\t\tarray(\n\t\t\t\t'table_source'=>'zones',\n\t\t\t\t'objet' => $type,\n\t\t\t\t'id_objet' => $id,\n\t\t\t)\n\t\t);\n\t\tif ($liens){\n\t\t\tif ($pos = strpos($flux['data'],'<!--affiche_milieu-->'))\n\t\t\t\t$flux['data'] = substr_replace($flux['data'], $liens, $pos, 0);\n\t\t\telse\n\t\t\t\t$flux['data'] .= $liens;\n\t\t}\n\t}\n\t\n\treturn $flux;\n}", "public function liberar() {}", "public function trasnaction(){\n\n\t}", "function commandes_trig_bank_reglement_en_echec($flux){\r\n\t// Si on est dans le bon cas d'un paiement de commande et qu'il y a un id_commande et que la commande existe toujours\r\n\tif ($id_transaction = $flux['args']['id_transaction']\r\n\t AND $transaction = sql_fetsel(\"*\",\"spip_transactions\",\"id_transaction=\".intval($id_transaction))\r\n\t\tAND $id_commande = $transaction['id_commande']\r\n\t\tAND $commande = sql_fetsel('id_commande, statut, id_auteur', 'spip_commandes', 'id_commande='.intval($id_commande))){\r\n\r\n\t\t$statut_commande = $commande['statut'];\r\n\t\t$transaction_mode = $transaction['mode'];\r\n\t\t$statut_nouveau = $statut_commande;\r\n\r\n\t\t// on ne passe la commande en erreur que si le reglement a effectivement echoue,\r\n\t\t// pas si c'est une simple annulation (retour en arriere depuis la page de paiement bancaire)\r\n\t\tif (strncmp($transaction['statut'],\"echec\",5)==0){\r\n\t\t\t$statut_nouveau = 'erreur';\r\n\t\t}\r\n\t\tif ($statut_nouveau !== $statut_commande){\r\n\t\t\tspip_log(\"commandes_trig_bank_reglement_en_attente marquer la commande #$id_commande statut=$statut_nouveau\",'commandes');\r\n\t\t\t//on met a jour la commande\r\n\t\t\tinclude_spip(\"action/editer_commande\");\r\n\t\t\tcommande_modifier($id_commande,array('statut'=>$statut_nouveau,'mode'=>$transaction_mode));\r\n\t\t}\r\n\t}\r\n\r\n\treturn $flux;\r\n}", "function apropos(){\n\t\t\t$this->data->content=\"aProposView.php\";\n\t\t\t$this->prepView();\n\t\t\t// Selectionne et charge la vue\n\t\t\trequire_once(\"view/mainView.php\");\n\t\t}", "function citrace_post_edition($tableau){\n\t// contourner le cas d'un double appel du pipeline sur la meme table avec la meme action\n\tstatic $actions = array();\n\tif (isset($tableau['args']['table'])){\n\t\t$table = $tableau['args']['table'];\n\t\tif ($actions AND isset($tableau['args']['action']) AND in_array($table.'/'.$tableau['args']['action'],$actions)) \n\t\t\treturn $tableau;\n\t\telse\n\t\t\t$actions[] = $table.'/'.$tableau['args']['action'];\n\t}\n\t\n\t// action sur un article\n\tif (isset($tableau['args']['action']) \n\t AND isset($tableau['args']['table']) AND $tableau['args']['table']=='spip_articles') {\n\t \t$id_article = intval($tableau['args']['id_objet']);\n\t\t if ($id_article>0) {\n\t\t\t\tinclude_spip('inc/texte');\n\t\t\t\t$row = sql_fetsel('*', 'spip_articles', 'id_article='.$id_article);\n\t\t\t\t$id_rubrique = $row['id_rubrique'];\n\t\t\t\t$article_msg = '('.interdire_scripts(supprimer_numero($row['titre'])).')'.\" - id_rubrique:\".$id_rubrique;\n\n\t\t\t\t$citrace = charger_fonction('citrace', 'inc');\n\t\t\t\t\n\t\t\t\t// instituer un article\n\t\t\t\tif ($tableau['args']['action']=='instituer' AND isset($tableau['args']['statut_ancien'])){\n\t\t \t\tif ($row['statut'] != $tableau['args']['statut_ancien']){\n\t\t\t\t\t\t$article_msg .= \" - statut_new:\".$row['statut'].\" - statut_old:\".$tableau['args']['statut_ancien'].\" - date_publication:\".$row['date'].\" (meta post_dates :\".$GLOBALS['meta'][\"post_dates\"].\")\";\n\t\t\t\t\t\t$action = \"changement de statut de l'article\";\n\t\t\t\t\t\t\n\t\t\t\t\t\t// publication d'un article\n\t\t\t \t\tif ($row['statut'] == 'publie')\n\t\t\t\t\t\t\t$action = \"publication article\";\n\t\t\t\t\t\t// depublication d'un article\n\t\t\t \t\telseif ($tableau['args']['statut_ancien'] == 'publie')\n\t\t\t\t\t\t\t$action = \"depublication article\";\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t// mise a la poubelle d'un article\n\t\t\t \t\tif ($row['statut'] == 'poubelle')\n\t\t\t\t\t\t\t$action = \"poubelle article\";\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t$citrace('article', $id_article, $action, $article_msg, $id_rubrique);\n\t\t \t\t}\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t// modifier un article\n\t\t\t\telseif ($tableau['args']['action']=='modifier'){\n\t\t\t\t\t// uniquement pour les articles publies\n\t\t \t\tif ($row['statut'] == 'publie')\n\t\t\t\t\t\t$citrace('article', $id_article, 'modification article', $article_msg, $id_rubrique);\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n }\t\n\n\t// action sur une rubrique\n\tif (isset($tableau['args']['action']) \n\t AND isset($tableau['args']['table']) AND $tableau['args']['table']=='spip_rubriques') {\n\t \t$id_rubrique = intval($tableau['args']['id_objet']);\n\t\t if ($id_rubrique>0) {\n\t\t\t\tinclude_spip('inc/texte');\n\t\t\t\t$row = sql_fetsel('*', 'spip_rubriques', 'id_rubrique='.$id_rubrique);\n\t\t\t\t$rubrique_msg = '('.interdire_scripts(supprimer_numero($row['titre'])).')';\n\t\t\t\t\n\t\t\t\t// modifier un rubrique\n\t\t\t\tif ($tableau['args']['action']=='modifier'){\n\t\t\t\t\t// uniquement pour les rubriques publies\n\t\t \t\tif ($row['statut'] == 'publie'){\n\t\t\t\t\t\t$citrace = charger_fonction('citrace', 'inc');\n\t\t\t\t\t\t$citrace('rubrique', $id_rubrique, 'modification rubrique', $rubrique_msg, $id_rubrique);\n\t\t \t\t}\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n }\t\n \n // action sur un document ou une image\n\tif (isset($tableau['args']['operation']) \n\t\tAND ((isset($tableau['args']['table']) AND $tableau['args']['table']=='spip_documents') \n\t\t\tOR (isset($tableau['args']['table_objet']) AND $tableau['args']['table_objet']=='documents'))) {\n\t\t$id_document = intval($tableau['args']['id_objet']);\n\t\tif ($id_document>0) {\n\t\t\t$row = sql_fetsel('*', 'spip_documents', 'id_document='.$id_document);\n\t\t\t$document_msg = '('.$row['fichier'].')';\n\n\t\t // ajout ou remplacement de document ou d'image\n\t\t\tif ($tableau['args']['operation']=='ajouter_document'){\n\t\t\t\t\t\t\t\n\t\t\t\t// le pipeline n'indique pas si c'est un remplacement, aussi il faut indiquer date et maj\n\t\t\t\t$commentaire = $document_msg.\" - champ date:\".$row['date'].\" - champ maj:\".$row['maj'];\n\t\n\t\t\t\t// le pipeline ne passe pas le lien, aussi il faut les indiquer\n\t\t\t\t$commentaire .= \" - liens :\";\n\t\t\t\t$id_rubrique = '';\n\t\t\t\t$res = sql_select('*', 'spip_documents_liens', 'id_document='.$id_document);\n\t\t\t\twhile ($row = sql_fetch($res)){\n\t\t\t\t\t$commentaire .= \" \".$row['objet'].$row['id_objet'];\n\t\t\t\t\tif (!$id_rubrique)\n\t\t\t\t\t\t$id_rubrique = citrace_rubrique_de_objet($row['objet'], $row['id_objet']);\n\t\t\t\t}\n\n\t\t\t\t$citrace = charger_fonction('citrace', 'inc');\n\t\t\t\t$citrace('document', $id_document, 'ajouter document', $commentaire, $id_rubrique);\n\t\t\t}\n\t\t\t\n\t\t // delier un document ou une image\n\t\t\tif ($tableau['args']['operation']=='delier_document'){\n\t\t\t\tif (isset($tableau['args']['objet']) AND isset($tableau['args']['id'])) {\n\t\t\t\t\t$commentaire = $document_msg.\" - lien : \".$tableau['args']['objet'].$tableau['args']['id'];\n\t\t\t\t\t$id_rubrique = citrace_rubrique_de_objet($tableau['args']['objet'], $tableau['args']['id']);\n\t\t\t\t\t$citrace = charger_fonction('citrace', 'inc');\n\t\t\t\t\t$citrace('document', $id_document, 'delier document', $commentaire, $id_rubrique);\n\t\t\t\t}\n\t\t\t}\n\n\t\t // supprimer un document ou une image\n\t\t\tif ($tableau['args']['operation']=='supprimer_document'){\n\t\t\t\t$commentaire = $id_document;\n\t\t\t\t$citrace = charger_fonction('citrace', 'inc');\n\t\t\t\t$citrace('document', $id_document, 'supprimer document', $commentaire);\n\t\t\t}\n\t\t}\n\t}\n\n\t// action sur un forum\n\tif (isset($tableau['args']['action']) AND in_array($tableau['args']['action'], array('instituer','modifier'))\n\t AND isset($tableau['args']['table']) AND $tableau['args']['table']=='spip_forum') {\n\n \t$id_forum = intval($tableau['args']['id_objet']);\n\t if ($id_forum>0) {\n\t\t\t$row = sql_fetsel('*', 'spip_forum', 'id_forum='.$id_forum);\n\n\t\t\t// forum public uniquement\n\t\t\tif (substr($row['statut'],0,3)!='pri') {\t\t\t\t\t\t\t\t\n\t\t\t\t$commentaire = 'statut:'.$row['statut'];\n\t\t\t\t$f_objet = '';\n\t\t\t\t$f_id_objet = '';\n\t\t\t\t\n\t\t\t\tif (spip_version()>=3) {\n\t\t\t\t\t$f_objet = $row['objet'];\n\t\t\t\t\t$f_id_objet = $row['id_objet'];\n\t\t\t\t} else {\n\t\t\t\t\tif (intval($row['id_article'])>0){\n\t\t\t\t\t\t$f_objet = 'article';\n\t\t\t\t\t\t$f_id_objet = $row['id_article'];\n\t\t\t\t\t} elseif (intval($row['id_rubrique'])>0){\n\t\t\t\t\t\t$f_objet = 'rubrique';\n\t\t\t\t\t\t$f_id_objet = $row['id_rubrique'];\n\t\t\t\t\t} elseif (intval($row['id_breve'])>0){\n\t\t\t\t\t\t$f_objet = 'breve';\n\t\t\t\t\t\t$f_id_objet = $row['id_breve'];\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t$accepter_forum = $GLOBALS['meta'][\"forums_publics\"];\n\t\t\t\tif ($f_objet=='article'){\n\t\t\t\t\t$art_accepter_forum = sql_getfetsel('accepter_forum', 'spip_articles', \"id_article = \". intval($f_id_objet));\n\t\t\t\t\tif ($art_accepter_forum)\n\t\t\t\t\t\t$accepter_forum = $art_accepter_forum;\n\t\t\t\t}\n\n\t\t\t\t$commentaire .= \" - lien: \".$f_objet.$f_id_objet.\" (accepter_forum: \".$accepter_forum.\")\";\n\n\t\t\t\t$id_rubrique = citrace_rubrique_de_objet($f_objet, $f_id_objet);\n\t\t\t\t\n\t\t\t\t$citrace = charger_fonction('citrace', 'inc');\n\t\t\t\t$citrace('forum', $id_forum, ($row['statut']=='publie' ? 'publication ' : 'depublication').'forum', $commentaire, $id_rubrique);\n\t\t\t}\n\t\t}\n }\t\n\t\n\treturn $tableau;\n}", "function stocks_pre_boucle($boucle) {\n $id_table = $boucle->id_table;\n\n //Savoir si on consulté la table organisations_liens\n if ($jointure = array_keys($boucle->from, 'spip_stocks')) {\n //Vérifier qu'on est bien dans le cas d'une jointure automatique\n if (isset($boucle->join[$jointure[0]])\n and isset($boucle->join[$jointure[0]][3])\n and $boucle->join[$jointure[0]]\n and $boucle->join[$jointure[0]][3]\n ) {\n //Le critere ON de la jointure (index 3 dans le tableau de jointure) est incompléte\n //on fait en sorte de retomber sur ses pattes, en indiquant l'objet à joindre\n $boucle->join[$jointure[0]][3] = \"'L1.objet='.sql_quote('\".objet_type($id_table).\"')\";\n\t\t}\n }\n\n return $boucle;\n}", "function citrace_pre_edition($tableau){\n\tstatic $actions = array();\n\tif (isset($tableau['args']['table'])){\n\t\t$table = $tableau['args']['table'];\n\t\tif ($actions AND isset($tableau['args']['action']) AND in_array($table.'/'.$tableau['args']['action'],$actions)) \n\t\t\treturn $tableau;\n\t\telse\n\t\t\t$actions[] = $table.'/'.$tableau['args']['action'];\n\t}\n\n\t// changement de rubrique pour un article publie\n\tif (isset($tableau['args']['action']) AND $tableau['args']['action']=='instituer' \n\t AND isset($tableau['args']['table']) AND $tableau['args']['table']=='spip_articles') {\n\t \t$id_article = intval($tableau['args']['id_objet']);\n\t\t if ($id_article>0) {\n\t\t\t\tinclude_spip('inc/texte');\n\t\t\t\t$row = sql_fetsel('*', 'spip_articles', 'id_article='.$id_article);\n\t\t\t\tif ($row){\n\t\t\t\t\t$old_rubrique = $row['id_rubrique'];\n\t\t\t\t\tif ($row['statut']=='publie'){\n\t\t\t\t\t\t$new_rubrique = (isset($tableau['data']['id_rubrique']) ? intval($tableau['data']['id_rubrique']) : 0);\n\t\t\n\t\t\t \t\tif ($new_rubrique>=1 AND $new_rubrique!=$old_rubrique){\n\t\t\t\t\t\t\t$commentaire = '('.interdire_scripts(supprimer_numero($row['titre'])).')'.\" - id_rubrique_new:\".$new_rubrique.\" - id_rubrique_old:\".$old_rubrique;\n\t\t\t\t\t\t\t$citrace = charger_fonction('citrace', 'inc');\n\t\t\t\t\t\t\t$citrace('article', $id_article, 'changement de rubrique pour article', $commentaire, $new_rubrique);\n\t\t\t \t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n }\t\n\n\t// changement de statut ou de l'email d'un auteur\n\tif (isset($tableau['args']['action']) \n\t AND isset($tableau['args']['table']) AND $tableau['args']['table']=='spip_auteurs') {\n\n \t$id_auteur = intval($tableau['args']['id_objet']);\n\t if ($id_auteur>0) {\n\t\t\tinclude_spip('inc/texte');\n\t\t\t$row = sql_fetsel('*', 'spip_auteurs', 'id_auteur='.$id_auteur);\n\t\t\tif ($row){\n\t\t\t\t// changement de statut d'un auteur\n\t\t\t\tif ($tableau['args']['action']=='instituer'){\n\t\t\t\t\t$old_statut = $row['statut'];\n\t\t\t\t\t$new_statut = (isset($tableau['data']['statut']) ? $tableau['data']['statut'] : '');\n\t\t\t\t\t$old_webmestre = $row['webmestre'];\n\t\t\t\t\t$new_webmestre = (isset($tableau['data']['webmestre']) ? $tableau['data']['webmestre'] : '');\n\t\n\t\t \t\tif ($new_statut AND $new_statut!=$old_statut){\n\t\t\t\t\t\t$commentaire = interdire_scripts(supprimer_numero($row['nom']))\n\t\t\t\t\t\t.' ('.interdire_scripts($row['email']).')'\n\t\t\t\t\t\t.\" - statut_new:\".$new_statut.\" - statut_old:\".$old_statut \n\t\t\t\t\t\t.\" - webmestre_new:\".$new_webmestre.\" - webmestre_old:\".$old_webmestre;\n\t\t\t\t\t\t$citrace = charger_fonction('citrace', 'inc');\n\t\t\t\t\t\t$citrace('auteur', $id_auteur, \"changement de statut pour l'auteur\", $commentaire);\n\t\t \t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// modifier l'email d'un auteur\n\t\t\t\tif ($tableau['args']['action']=='modifier'){\n\t\t\t\t\t$old_email = $row['email'];\n\t\t\t\t\t$new_email = (isset($tableau['data']['email']) ? $tableau['data']['email'] : '');\n\t\n\t\t \t\tif ($new_email!=$old_email){\n\t\t\t\t\t\t$commentaire = '('.interdire_scripts(supprimer_numero($row['nom'])).')'\n\t\t\t\t\t\t.\" - email_new:\".$new_email.\" - email_old:\".$old_email; \n\t\t\t\t\t\t$citrace = charger_fonction('citrace', 'inc');\n\t\t\t\t\t\t$citrace('auteur', $id_auteur, \"changement d'email pour l'auteur\", $commentaire);\n\t\t \t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n }\t\n \n\t// changement de date de publication (ou de depublication) d'un article\n\tif (isset($tableau['args']['action']) \n\t AND isset($tableau['args']['table']) AND $tableau['args']['table']=='spip_articles') {\n\t \t$id_article = intval($tableau['args']['id_objet']);\n\t\t if ($id_article>0) {\n\t\t \t// lors du changement de statut, la date de publication est tracee par le pipeline post_edition\n\t\t \t// aussi ne pas doublonner\n\t \t\tif (!isset($tableau['data']['statut']) OR !isset($tableau['args']['statut_ancien']) OR $tableau['data']['statut'] == $tableau['args']['statut_ancien']){\n\t\t\t\t\tinclude_spip('inc/texte');\n\t\t\t\t\t$row = sql_fetsel('*', 'spip_articles', 'id_article='.$id_article);\n\t\t\t\t\t$date_old = $row['date'];\n\t\t\t\t\t$id_rubrique = $row['id_rubrique'];\n\t\t\t\t\n\t\t\t\t\tif (isset($tableau['data']['date']) AND $date_old != $tableau['data']['date']){\n\t\t\t\t\t\t$article_msg = '('.interdire_scripts(supprimer_numero($row['titre'])).')'.\" - id_rubrique:\".$id_rubrique;\n\t\t\t\t\t\t$article_msg .= \" - date_publication:\".$tableau['data']['date'].\" - date_publication_old:\".$date_old.\" (meta post_dates :\".$GLOBALS['meta'][\"post_dates\"].\")\";\n\t\t\t\t\t\t$citrace = charger_fonction('citrace', 'inc');\n\t\t\t\t\t\t$citrace('article', $id_article, 'modifier_date', $article_msg, $id_rubrique);\t\t\t\t\t\n\t\t\t\t\t}\n\t \t\t}\n\t\t }\n }\n\n\treturn $tableau;\n}", "public function Preferiti() {\n $session = Sessione::getInstance();\n if($session->isLoggedUtente()){\n $utente = $session->getUtente();\n $idutente = $utente->getId();\n $pm = FPersistentManager::getInstance();\n $ut = $pm->loadById(\"utente\", $idutente);\n $ricette = $ut->getPreferiti();\n if($ricette!=null){\n $msg = \"\";\n } else {\n $msg = \"Non hai ricette preferite\";\n }\n $view = new VPreferiti();\n $view->mostraPreferiti($ricette, $msg);\n\n } else {\n header('Location: /myRecipes/web/Utente/Login');\n }\n }", "function sevenconcepts_formulaire_charger($flux){\n $form=$flux['args']['form'];\n if($form=='inscription'){\n include_spip('cextras_pipelines');\n $champs_extras=champs_extras_objet(table_objet_sql('auteur'));\n foreach($champs_extras as $value){\n $flux['data'][$value['options']['nom']]=''; \n if(isset($value['options']['obligatoire']))$flux['data']['obligatoire'][$value['options']['nom']]='on';\n }\n $flux['data']['nom_inscription']='';\n $flux['data']['mail_inscription']='';\n }\n \n return $flux;\n}", "function commandes_bank_traiter_reglement($flux){\r\n\t// Si on est dans le bon cas d'un paiement de commande et qu'il y a un id_commande et que la commande existe toujours\r\n\tif (\r\n\t\t$id_transaction = $flux['args']['id_transaction']\r\n\t\tand $transaction = sql_fetsel(\"*\",\"spip_transactions\",\"id_transaction=\".intval($id_transaction))\r\n\t\tand $id_commande = $transaction['id_commande']\r\n\t\tand $commande = sql_fetsel('id_commande, statut, id_auteur, echeances, reference', 'spip_commandes', 'id_commande='.intval($id_commande))\r\n\t){\r\n\t\t$statut_commande = $commande['statut'];\r\n\t\t$montant_regle = $transaction['montant_regle'];\r\n\t\t$transaction_mode = $transaction['mode'];\r\n\t\t$statut_nouveau = 'paye';\r\n\r\n\r\n\t\t// Si la commande n'a pas d'échéance, le montant attendu est celui du prix de la commande\r\n\t\tinclude_spip('inc/commandes_echeances');\r\n\t\tif (!$commande['echeances']\r\n\t\t\tor !$echeances = unserialize($commande['echeances'])\r\n\t\t or !$desc = commandes_trouver_prochaine_echeance_desc($id_commande, $echeances, true)\r\n\t\t or !isset($desc['montant'])) {\r\n\t\t\t$fonction_prix = charger_fonction('prix', 'inc/');\r\n\t\t\t$montant_attendu = $fonction_prix('commande', $id_commande);\r\n\t\t}\r\n\t\t// Sinon le montant attendu est celui de la prochaine échéance (en ignorant la dernière transaction OK que justement on cherche à tester)\r\n\t\telse {\r\n\t\t\t$montant_attendu = $desc['montant'];\r\n\t\t}\r\n\t\tspip_log(\"commande #$id_commande attendu:$montant_attendu regle:$montant_regle\", 'commandes');\r\n\r\n\t\t// Si le plugin n'était pas déjà en payé et qu'on a pas assez payé\r\n\t\t// (si le plugin était déjà en payé, ce sont possiblement des renouvellements)\r\n\t\tif (\r\n\t\t\t$statut_commande != 'paye'\r\n\t\t\tand (floatval($montant_attendu) - floatval($montant_regle)) >= 0.01\r\n\t\t){\r\n\t\t\t$statut_nouveau = 'partiel';\r\n\t\t}\r\n\t\t\r\n\t\t// S'il y a bien un statut à changer\r\n\t\tif ($statut_nouveau !== $statut_commande){\r\n\t\t\tspip_log(\"commandes_bank_traiter_reglement marquer la commande #$id_commande statut: $statut_commande -> $statut_nouveau mode=$transaction_mode\",'commandes');\r\n\t\t\t// On met a jour la commande\r\n\t\t\tinclude_spip(\"action/editer_commande\");\r\n\t\t\tcommande_modifier($id_commande, array('statut'=>$statut_nouveau, 'mode'=>$transaction_mode));\r\n\t\t}\r\n\r\n\t\t// un message gentil pour l'utilisateur qui vient de payer, on lui rappelle son numero de commande\r\n\t\t$flux['data'] .= \"<br />\"._T('commandes:merci_de_votre_commande_paiement',array('reference'=>$commande['reference']));\r\n\t}\r\n\r\n\treturn $flux;\r\n}", "public static function FrontEnvio()\n\t{\n\t\t$article_id = Util::getvalue('article_id');\n\t\t$emailRCP = Util::getvalue('email');\n\t\t$mensaje = strip_tags(Util::getvalue('mensaje'));\n\t\t$copia = Util::getvalue('copia', false);\n\n\n\t\t$interface = SkinController::loadInterface($baseXsl='article/article.envio.xsl');\n\t\t$article = Article::getById($article_id);\n\t\t$article['mensaje'] = $mensaje;\n\t\t\n\t\t$userArray = Session::getvalue('proyectounder');\n\t\t\n\t\tif($userArray):\n\t\t\t$article['user'] = $userArray;\n\t\tendif;\n\t\t\n\t\t$emailhtml = self::envio_email($article);\n\t\t$email = new Email();\n\t\t$email->SetFrom('[email protected]', 'Proyectounder.com');\n\t\t$email->SetSubject(utf8_encode($article['titulo']));\n\t\t$emailList = preg_split(\"/[;,]+/\", $emailRCP);\n\n\t\tforeach ($emailList as $destination)\n\t\t{\n\t\t\t$email->AddTo($destination);\n\t\t}\n\t\tif($copia):\n\t\t\t$email->AddCC($userArray['email']);\n\t\tendif;\n\n\t\t\n\t\t$email->ClearAttachments();\n\t\t$email->ClearImages();\n\t\t$email->SetHTMLBody(utf8_encode($emailhtml));\n\t\t$email->Send();\n\t\t\n\t\t\n\t\t$interface->setparam('enviado', 1);\n\t\t$interface->display();\n\t}", "public function Panier() \n {\n $this->CollProduit = new Collection;\n }", "public function prepararSopa(){\n\n echo(\"Revuelva los ingredientes y deje cocinar por 20 minutos\");\n\n}", "function exec_suivi() {\n\t$id_auteur = (int) _request('id_auteur');\n\t$id_article = (int) _request('id_article');\n\t$nouv_auteur = (int) _request('nouv_auteur');\n\t$contexte = array();\n\t$idper = '';\n\t$nom = '';\n\t$prenom = '';\n\t$statutauteur = '6forum';\n\t$inscrit = '';\n\t$statutsuivi = '';\n\t$date_suivi = '';\n\t$heure_suivi = '';\n\n\t//Addon fields\n\t$sante_comportement = '';\n\t$alimentation = '';\n\t$remarques_inscription = '';\n\t$ecole = '';\n\t$places_voitures = '';\n\t$brevet_animateur = '';\n\t$historique_payement = '';\n\t$extrait_de_compte = '';\n\t$statut_payement = '';\n\t$tableau_exception = '';\n\t$recus_fiche_medical = '';\n $facture = '';\n $adresse_facturation = '';\n\n\n\t//----------- lire DB ---------- AND id_secteur=2\n\t$req = sql_select('id_article,idact,titre,date_debut', 'spip_articles', \"id_article=$id_article\");\n\tif ($data = sql_fetch($req)) {\n $idact = $data['idact'];\n\t\t$titre = $data['titre'];\n $date_debut = $data['date_debut'];\n\t}\n\telse\n\t\t$id_article = 0;\n\n\t$req = sql_select('*', \n \"spip_auteurs AS A LEFT JOIN spip_auteurs_articles AS S ON S.id_auteur=$id_auteur AND S.id_article=$id_article AND S.inscrit<>''\", \"A.id_auteur=$id_auteur\");\n\tif ($data = sql_fetch($req)) {\n\t\t$idper = $data['idper'];\n\t\t$nom = $data['nom'];\n\t\t$prenom = $data['prenom'];\n\t\t$statutauteur = $data['statut'];\n\t\tif ($data['inscrit']) {\n\t\t\t$inscrit = 'Y';\n\t\t\t$statutsuivi = $data['statutsuivi'];\n\t\t\t$date_suivi = $data['date_suivi'];\n\t\t\t$heure_suivi = $data['heure_suivi'];\n\n\t\t\t$sante_comportement = $data['sante_comportement'];\n\t\t\t$alimentation = $data['alimentation'];\n\t\t\t$remarques_inscription = $data['remarques_inscription'];\n\t\t\t$ecole = $data['ecole'];\n\t\t\t$places_voitures = $data['places_voitures'];\n\t\t\t$brevet_animateur = $data['brevet_animateur'];\n\t\t\t$historique_payement = $data['historique_payement'];\n\t\t\t$extrait_de_compte = $data['extrait_de_compte'];\n\t\t\t$statut_payement = $data['statut_payement'];\n\t\t\t$tableau_exception = $data['tableau_exception'];\n\t\t\t$recus_fiche_medical = $data['recus_fiche_medical'];\n\t\t\t$prix_special = $data['prix_special'];\n $facture = $data['facture'];\n $adresse_facturation = $data['adresse_facturation'];\n\t\t}\n\t}\n\telse\n\t\t$id_auteur = 0;\n\n\t//-------- form soumis -----------\n\tif (_request('okconfirm') && $id_article && ($id_auteur || $nouv_auteur))\n\t\tif ($GLOBALS['connect_statut']!='0minirezo' || ! autoriser('modifier', 'article', $id_article))\n\t\t\t$contexte['message_erreur'] = 'Autorisation refusée';\n\t\telse {\n\t\t\t$statutsuivi = _request('statutsuivi');\n\t\t\t$date_suivi = _request('date_suivi');\n\t\t\t$heure_suivi = _request('heure_suivi');\n \n $sante_comportement = _request('sante_comportement');\n $alimentation = _request('alimentation');\n $remarques_inscription = _request('remarques_inscription');\n $ecole = _request('ecole');\n $places_voitures = _request('places_voitures');\n $brevet_animateur = _request('brevet_animateur');\n $extrait_de_compte = _request('extrait_de_compte');\n $historique_payement = str_replace(',', '.', _request('historique_payement'));\n $statut_payement = _request('statut_payement');\n $tableau_exception = _request('tableau_exception');\n $recus_fiche_medical = _request('recus_fiche_medical');\n $prix_special = _request('prix_special');\n $facture = _request('facture');\n $adresse_facturation = _request('adresse_facturation');\n\n\t\t\tinclude_spip('inc/date_gestion');\n\t\t\t$contexte['erreurs'] = array();\n\t\t\tif (@verifier_corriger_date_saisie('suivi', false, $contexte['erreurs']))\n\t\t\t\t$date_suivi = substr($date_suivi, 6, 4).'-'.substr($date_suivi, 3, 2).'-'.substr($date_suivi, 0, 2);\n\t\t\telse\n\t\t\t\t$contexte['message_erreur'] = 'Erreur';\n\n\t\t\tif (! $contexte['message_erreur'])\n\t\t\t\tif ($nouv_auteur) {\n\t\t\t\t\t$req = sql_select('A.id_auteur,id_article',\"spip_auteurs AS A LEFT JOIN spip_auteurs_articles AS S ON S.id_auteur=$nouv_auteur AND S.id_article=$id_article\", \"A.id_auteur=$nouv_auteur\");\n\t\t\t\t\tif ($data = sql_fetch($req)) {\n\t\t\t\t\t\t$id_auteur = $data['id_auteur'];\n\t\t\t\t\t\tif (! $data['id_article'])\n\t\t\t\t\t\t\tsql_insertq('spip_auteurs_articles', array('id_auteur'=>$id_auteur, 'id_article'=>$id_article, 'inscrit'=>'Y'));\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t$contexte['message_erreur'] = 'Erreur';\n\t\t\t\t\t\t$contexte['erreurs']['nouv_auteur'] = 'auteur ID inconnu';\n\t\t\t\t\t\t$id_auteur = 0;\n\t\t\t\t\t\t$inscrit = '';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tif ($id_auteur && ! $contexte['message_erreur']) {\n\t\t\t\tsql_updateq('spip_auteurs_articles', \n array(\n \t\t'inscrit'=>'Y', \n \t\t'statutsuivi'=>$statutsuivi, \n \t\t'date_suivi'=>$date_suivi, \n \t\t'heure_suivi'=>$heure_suivi,\n \t'sante_comportement'=>$sante_comportement,\n \t'alimentation'=>$alimentation,\n \t'remarques_inscription'=>$remarques_inscription,\n \t'ecole'=>$ecole,\n \t'brevet_animateur'=>$brevet_animateur,\n \t'places_voitures'=>$places_voitures,\n \t'extrait_de_compte' => $extrait_de_compte,\n \t'historique_payement' => $historique_payement,\n \t'statut_payement' => $statut_payement,\n \t'tableau_exception' => $tableau_exception,\n \t'recus_fiche_medical' => $recus_fiche_medical,\n \t'prix_special' => $prix_special,\n 'facture' => $facture,\n 'adresse_facturation' => $adresse_facturation\n ), \"id_auteur=$id_auteur AND id_article=$id_article\");\n\n // On fait l'update de la date_validation via sql_update plutôt que sql_updateq.\n sql_update('spip_auteurs_articles', array('date_validation' => 'NOW()'), 'id_auteur='.sql_quote($id_auteur).' AND id_article='.sql_quote($id_article));\n\t\t\t\t$contexte['message_ok'] = 'Ok, l\\'inscription est mise à jour';\n\t\t\t\t$inscrit = 'Y';\n\n /*\n * Si c'est une nouvelle inscription faite par un admin, on envoie un mail\n */\n if (_request('new') == 'oui') {\n $p = 'Bonjour,'.\"\\n\\n\".'Voici une nouvelle inscription :'.\"\\n\\n\";\n $p .= 'Sexe : '.$data['codecourtoisie'].\"\\n\";\n $p .= 'Prénom : '.$prenom.\"\\n\";\n $p .= 'Nom : '.$nom.\"\\n\";\n $p .= 'e-mail : '.$data['email'].\"\\n\";\n $p .= 'Date naissance : '.$data['date_naissance'].\"\\n\";\n $p .= 'Lieu naissance : '.$data['lieunaissance'].\"\\n\";\n \n $p .= 'Adresse : '.$data['adresse'].\"\\n\";\n $p .= 'No : '.$data['adresse_no'].\"\\n\";\n $p .= 'Code postal : '.$data['codepostal'].\"\\n\";\n $p .= 'Localité : '.$data['localite'].\"\\n\";\n $p .= 'Téléphone : '.$data['tel1'].\"\\n\";\n $p .= 'GSM : '.$data['gsm1'].\"\\n\";\n $p .= 'Fax : '.$data['fax1'].\"\\n\";\n \n $p .= \"\\n*******\\n\\n\";\n \n $p .= 'Études en cours et établissement : '.$data['etude_etablissement'].\"\\n\";\n $p .= 'Profession : '.$data['profession'].\"\\n\";\n $p .= 'Demandeur d’emploi : '.$data['demandeur_emploi'].\"\\n\";\n $p .= 'Membre d’une association : '.$data['membre_assoc'].\"\\n\";\n $p .= 'Pratique : '.$data['pratique'].\"\\n\";\n $p .= 'Formations : '.$data['formation'].\"\\n\";\n $p .= 'Facture : '.$data['facture'].\"\\n\";\n $p .= 'Adresse de facturation : '.$data['adresse_facturation'].\"\\n\";\n $p .= 'Régime alimentaire : '.$alimentation.\"\\n\";\n $p .= 'Places dans votre voiture : '.$places_voitures.\"\\n\";\n $p .= 'Brevet d’animateur : '.$brevet_animateur.\"\\n\";\n $p .= 'Remarques : '.$remarques_inscription.\"\\n\";\n \n $p .= \"\\n*******\\n\\n\";\n \n $p .= 'id_auteur : '.$id_auteur.\"\\n\";\n $p .= 'Statut : '.$statutsuivi.\"\\n\";\n $p .= 'Action : '.$titre.\"\\n\";\n $p .= 'Dates : '.$date_debut.\"\\n\";\n $p .= 'id_article : '.$id_article.\"\\n\";\n $p .= \"\\n\".'-----'.\"\\n\";\n\n\n $envoyer_mail = charger_fonction('envoyer_mail','inc');\n \n $p = $envoyer_mail(\n $GLOBALS['meta']['email_webmaster'].', [email protected]',\n $GLOBALS['meta']['nom_site'].' : nouvelle inscription '.$data['idact'].'-'.$id_auteur, \n $p,\n $GLOBALS['meta']['email_webmaster']);\n \n }\n\n\n\t\t\t\tinclude_spip('inc/headers');\n\t\t\t\tredirige_par_entete(parametre_url('?exec=articles', 'id_article', $id_article, '&'));\n\t\t\t\texit();\n\t\t\t}\n\t\t}\n\n\t//-------- desinscrire -----------\n\tif (_request('noinscr') && $id_article && $id_auteur)\n\t\tif ($GLOBALS['connect_statut']!='0minirezo' || ! autoriser('modifier', 'article', $id_article))\n\t\t\t$contexte['message_erreur'] = 'Autorisation refusée';\n\t\telse {\n\t\t\tif ($statutauteur == '6forum')\n\t\t\t\tsql_delete('spip_auteurs_articles', \"id_auteur=$id_auteur AND id_article=$id_article\");\n\t\t\telse\n\t\t\t\tsql_updateq('spip_auteurs_articles', array('inscrit'=>''), \"id_auteur=$id_auteur AND id_article=$id_article\");\n\t\t\t$inscrit = '';\n\t\t\t$contexte['message_ok'] = 'Ok, la désinscription est faite';\n\t\t\tinclude_spip('inc/headers');\n\t\t\tredirige_par_entete(parametre_url('?exec=articles', 'id_article', $id_article, '&'));\n\t\t\texit();\n\t\t}\n\n\t//--------- page + formulaire ---------\n\t\t$commencer_page = charger_fonction('commencer_page', 'inc');\n\t\techo $commencer_page('Suivi des inscriptions', '', '');\n\n\t\techo '<br />',gros_titre('Suivi des inscriptions');\n\n\t\techo debut_gauche('', true);\n\t\techo debut_boite_info(true);\n\t\techo 'Suivi des inscriptions<br /><br />Explications',\"\\n\";\n\t\techo fin_boite_info(true);\n\n\t\techo debut_droite('', true);\n\n\t\tinclude_spip('fonctions_gestion_cemea');\n\t\tinclude_spip('prive/gestion_update_db');\n\n\t\techo debut_cadre_relief('', true, '', '');\n\n\t\t$contexte['id_article'] = $id_article;\n\t\t$contexte['id_auteur'] = $id_auteur;\n\t\t$contexte['idact'] = $idact;\n\t\t$contexte['titre'] = $titre;\n\t\t$contexte['idper'] = $idper;\n\t\t$contexte['nom'] = $nom;\n\t\t$contexte['prenom'] = $prenom;\n\t\t$contexte['inscrit'] = $inscrit;\n\t\t$contexte['statutsuivi'] = $statutsuivi;\n\t\t$contexte['date_suivi'] = $date_suivi;\n\t\t$contexte['heure_suivi'] = $heure_suivi;\n\n\t\t$contexte['sante_comportement'] = $sante_comportement;\n\t\t$contexte['alimentation'] = $alimentation;\n\t\t$contexte['remarques_inscription'] = $remarques_inscription;\n\t\t$contexte['ecole'] = $ecole;\n\t\t$contexte['places_voitures'] = $places_voitures;\n\t\t$contexte['brevet_animateur'] = $brevet_animateur;\n\t\t$contexte['extrait_de_compte'] = $extrait_de_compte;\n\t\t$contexte['historique_payement'] = str_replace('.', ',', $historique_payement);\n\t\t$contexte['statut_payement'] = $statut_payement;\n\t\t$contexte['tableau_exception'] = $tableau_exception;\n\t\t$contexte['recus_fiche_medical'] = $recus_fiche_medical;\n\t\t$contexte['prix_special'] = $prix_special;\n $contexte['facture'] = $facture;\n $contexte['adresse_facturation'] = $adresse_facturation;\n\n\t\t$contexte['editable'] = ' ';\n\n\t\t$milieu = recuperer_fond(\"prive/form_suivi\", $contexte);\n\t\techo pipeline('editer_contenu_objet',array('args'=>array('type'=>'auteurs_article','contexte'=>$contexte),'data'=>$milieu));\n\n\t\techo fin_cadre_relief(true);\n\t\techo fin_gauche();\n\t\techo fin_page();\n}", "public function productcompareaddAction() {\n // neu chua khoi tao\n // neu roi add them 1 phan tu vao sesion voi id va uenc da duoc tao\n $this->layout('layout/bags');\n $getuser = $this->forward()->dispatch('Admin\\Controller\\Index', array(\n 'action' => 'getuser'\n ));\n // var_dump($getuser);\n $this->layout()->getuser = $getuser;\n\n $id = $this->params()->fromRoute('id');\n $uenc = $this->params()->fromRoute('uenc');\n\n echo \"id :\";\n var_dump($id);\n echo \"</br>\";\n echo \"uenc :\";\n var_dump($uenc);\n }", "public function traerCualquiera()\n {\n }", "public function cloture()\n {\n // On prépare la modification pour enregistrer la fermeture de la mission\n $sql = 'UPDATE `mission`\n SET `mission_statut` = 0\n WHERE `mission_id` = :mission';\n $query = $this->_link->prepare($sql);\n $query->bindParam(':mission', $this->_data['mission_id'], PDO::PARAM_INT);\n\n // On effectue la modification\n $query->execute();\n }", "function ctrlChoix($ar){\n $p = new XParam($ar, array());\n $ajax = $p->get('_ajax');\n $offre = $p->get('offre');\n $wtspool = $p->get('wtspool');\n $wtsvalidfrom = $p->get('wtsvalidfrom');\n $wtsperson = $p->get('wtspersonnumber');\n $wtsticket = $p->get('wtsticket');\n $context = array('wtspersonnumber'=>$wtsperson);\n $r = (object)array('ok'=>1, 'message'=>'', 'iswarn'=>0);\n // on recherche toutes les offres proposant un meilleur prix\n $bestoffers = array();\n $bettertickets = array();\n $betterproducts = array();\n // si nb = zero : ne pas prendre en compte\n foreach($wtsperson as $personoid=>$personnb){\n if (empty($personnb) || $personnb<1){\n\tunset($context['wtspersonnumber'][$personoid]);\n }\n }\n foreach($wtsperson as $personoid=>$personnb){\n if (empty($personnb) || $personnb<1){\n continue;\n }\n $dp = $this->modcatalog->displayProduct($offre, $wtspool, $wtsticket, $personoid);\n if ($dp == NULL)\n continue;\n $bp = $this->modcatalog->betterProductPrice($wtsvalidfrom, NULL, $context, $dp);\n // les différentes offres trouvées\n if ($bp['ok'] && !isset($bestoffers[$bp['product']['offer']['offrename']])){\n $bestoffers[$bp['product']['offer']['offrename']] = $bp['product']['offer']['offeroid'];\n }\n // meilleur produit par type de personne ...\n if ($bp['ok']){\n\t$bpd = $this->modcatalog->displayProductQ($bp['product']['oid']);\n\t$betterproducts[] = array('nb'=>$personnb, 'oid'=>$bp['product']['oid'], '');\n\t$bettertickets[$bp['product']['oid']] = array('currentprice'=>$bp['product']['currentprice'], \n\t\t\t\t\t\t 'betterprice'=>$bp['product']['price']['tariff'],\n\t\t\t\t\t\t 'label'=>$bpd['label'], \n\t\t\t\t\t\t 'offer'=>$bp['product']['offer']['offrename'],\n\t\t\t\t\t\t 'offeroid'=>$bp['product']['offer']['offeroid']);\n }\n }\n if (count($bestoffers)>0){\n $r->offers = array_keys($bestoffers);\n $r->message = implode(',', $r->offers);\n $r->nboffers = count($r->offers);\n $r->offeroids = array_values($bestoffers);\n $r->bettertickets = $bettertickets;\n $r->iswarn = 1;\n $r->ok = 0;\n $r->redirauto = false;\n // on peut enchainer vers une meilleure offre ?\n if ($r->nboffers == 1 && (count($betterproducts) == count($context['wtspersonnumber']))){\n\t$r->redirauto = true;\n\t$r->redirparms = '&offre='.$r->offeroids[0].'&validfrom='.$wtsvalidfrom;\n\tforeach($betterproducts as $bestproduct){\n\t $r->redirparms .= '&products['.$bestproduct['oid'].']='.$bestproduct['nb'];\n\t}\n }\n }\n if ($ajax)\n die(json_encode($r));\n return $r;\n }", "function fast_plugin_fast_plug($flux){\r\n\t\r\n\r\n\t// traitement des parametres envoye par le plugin \r\n\t// $exec : exec = demo\r\n\t// $type : affichage complet(appel des pipelines classiques) ou simple\r\n\t// $template : on souhaite un autre affichage que l'admin de spip, on precise le template\r\n\t// $fond : doit on utiliser un fond particulier ?\r\n\t$exec = $flux[\"args\"][\"exec\"];\r\n\t$type = $flux[\"args\"][\"type\"];\r\n\t$template = $flux[\"args\"][\"template\"];\r\n\t$fond = $flux[\"args\"][\"fond\"];\r\n\t\r\n\t\r\n\t// chargemenr debut de page de spip\r\n\tinclude_spip('inc/presentation');\r\n\tinclude_spip('inc/utils');\r\n\t$commencer_page = charger_fonction('commencer_page', 'inc');\r\n\t\r\n\t\r\n\t// On verifie que la personne a bien acces a cette page\r\n\t$exec_get = _request(\"exec\");\r\n\tif (!autoriser('acces','fast_plugin',$exec_get)){\r\n\t\techo $commencer_page();\r\n\t\tdie(\"pas les droits\");\r\n\t}\r\n\t\r\n\tif(!$fond) $fond = $exec;\r\n\t\r\n\t// on recupere la page \r\n\t$page =recuperer_fond(\"fonds/$fond\",array_merge( $_GET, $_POST ));\r\n\t\r\n\t// utilisation d'un template ou utilisation classique\r\n\tif ($template){\r\n\t\t\r\n\t\t// pour les templates on place dans la page de template \r\n\t\t// le commentaire html <!-- content_here --> \r\n\t\t// reste l'inclusion du css qui ne peut pour le \r\n\t\t// momment ne peut être dans un fichier de plugin prevoir une autre\r\n\t\t// position , un repertoire css a la racine ?\r\n\t\t\r\n\t\techo $commencer_page();\r\n\t\tpipeline('exec_init',array('args'=>array('exec'=>\"$exec\"),'data'=>''));\r\n\t\t$new_template = recuperer_fond(\"fonds/template/$template/$template\",array_merge( $_GET, $_POST ));\r\n\t\t$new_template = str_replace(\"<!-- content_here -->\",$page,$new_template);\r\n\t\techo $new_template;\r\n\t}else{\r\n\t\techo $commencer_page();\r\n\t\tpipeline('exec_init',array('args'=>array('exec'=>\"$exec\"),'data'=>''));\r\n\t\tif ($type=='complet'){\r\n\t\t\techo debut_gauche('', true);\r\n\t\t\techo pipeline('affiche_gauche',array('args'=>array('exec'=>$exec),'data'=>''));\r\n\t\t\techo creer_colonne_droite('', true);\r\n\t\t\techo pipeline('affiche_droite',array('args'=>array('exec'=>$exec),'data'=>''));\r\n\t\t\techo debut_droite('', true);\r\n\t\t\techo pipeline('affiche_milieu',array('args'=>array('exec'=>$exec),'data'=>''));\r\n\t\t\techo $page;\r\n\t\t\techo fin_gauche(), fin_page();\r\n\t\t}\r\n\t\telse if ($type=='simple'){\r\n\t\t\techo $page;\r\n\t\t\techo fin_page();\r\n\t\t}\r\n\t}\r\n\t\r\n\treturn $flux;\r\n}", "public function afficheEntete()\r\n\t\t{\r\n\t\t//appel de la vue de l'entête\r\n\t\trequire 'Vues/entete.php';\r\n\t\t}", "public function cortesia()\n {\n $this->costo = 0;\n }", "public function contarInventario(){\n\t}", "function suppProduit($id_produit) // example ref 30\n{\n //on transmet à la foncton predefini araay_search l'id_produit du produit en rupture de stock\n // array_search() retourne l'indice du tableau ARRAY auquel se trouve l'id_produit à supprimer\n\n //recupere l'indice du tableau afin de pouvoir supprime tt les lignes du tableau panier\n $positionProduit = array_search($id_produit, $_SESSION['panier']['id_produit']); //[1] example car produit rupture de stock\n\n\n //si la valeur de $positionProduit est different de FALSE, cela veut dire que l'id produit a supprimer a bien été trouvé\n //dans le panier de la session\n if ($positionProduit !== false) {\n\n\n //array_splice() permet de supprimer des elements d'un tableay ARRAY\n //on supprime chaque ligne dans les tableaux ARRAY du produit en rupture de stock\n //array_splice() re organise les tableaux ARRAY, c'est à dire que tout les elements aux indices inférieur\n //remontent aux indices superieur, le produit stocké à l'indice 3 du teableau ARRAY remonte à l'indice 2 du tableau ARRAY\n\n\n // supprimer dans tab photo ==> indice $positionproduit et 1 correspond à 1 element\n array_splice($_SESSION['panier']['id_produit'], $positionProduit, 1);\n array_splice($_SESSION['panier']['photo'], $positionProduit, 1);\n array_splice($_SESSION['panier']['reference'], $positionProduit, 1);\n array_splice($_SESSION['panier']['titre'], $positionProduit, 1);\n array_splice($_SESSION['panier']['quantite'], $positionProduit, 1);\n array_splice($_SESSION['panier']['prix'], $positionProduit, 1);\n }\n}", "public function encender() {\n $respuesta=self::$plasma->estadoPlasma();\n\tif ( $respuesta == 'OFF' ){\n\t $respuesta=self::$plasma->encender();\n\t}\n\n }", "public function setForAuteur()\n {\n //met à jour les proposition qui n'ont pas de base contrat et qui ne sont pas null\n /*PLUS BESOIN DE BASE CONTRAT\n \t\t$dbP = new Model_DbTable_Iste_proposition();\n \t\t$dbP->update(array(\"base_contrat\"=>null), \"base_contrat=''\");\n */\n\t \t//récupère les vente qui n'ont pas de royalty\n\t \t$sql = \"SELECT \n ac.id_auteurxcontrat, ac.id_livre\n , ac.id_isbn, ac.pc_papier, ac.pc_ebook\n , a.prenom, a.nom, c.type, IFNULL(a.taxe_uk,'oui') taxe_uk\n ,i.num\n , v.id_vente, v.date_vente, v.montant_livre, v.id_boutique, v.type typeVente\n , i.id_editeur, i.type typeISBN\n , impF.conversion_livre_euro\n FROM iste_vente v\n INNER JOIN iste_isbn i ON v.id_isbn = i.id_isbn \n INNER JOIN iste_importdata impD ON impD.id_importdata = v.id_importdata\n INNER JOIN iste_importfic impF ON impF.id_importfic = impD.id_importfic\n INNER JOIN iste_auteurxcontrat ac ON ac.id_isbn = v.id_isbn\n INNER JOIN iste_contrat c ON c.id_contrat = ac.id_contrat\n INNER JOIN iste_auteur a ON a.id_auteur = ac.id_auteur\n INNER JOIN iste_livre l ON l.id_livre = i.id_livre \n LEFT JOIN iste_royalty r ON r.id_vente = v.id_vente AND r.id_auteurxcontrat = ac.id_auteurxcontrat\n WHERE pc_papier is not null AND pc_ebook is not null AND pc_papier != 0 AND pc_ebook != 0\n AND r.id_royalty is null \";\n\n $stmt = $this->_db->query($sql);\n \n \t\t$rs = $stmt->fetchAll(); \n \t\t$arrResult = array();\n \t\tforeach ($rs as $r) {\n\t\t\t//calcule les royalties\n \t\t\t//$mtE = floatval($r[\"montant_euro\"]) / intval($r[\"nbA\"]);\n \t\t\t//$mtE *= floatval($r[\"pc_papier\"])/100;\n \t\t\tif($r[\"typeVente\"]==\"ebook\")$pc = $r[\"pc_ebook\"];\n \t\t\telse $pc = $r[\"pc_papier\"];\n $mtL = floatval($r[\"montant_livre\"])*floatval($pc)/100;\n //ATTENTION le taux de conversion est passé en paramètre à l'import et le montant des ventes est calculé à ce moment\n \t\t\t//$mtD = $mtL*floatval($r[\"taux_livre_dollar\"]);\n \t\t\t$mtE = $mtL*floatval($r['conversion_livre_euro']);\n //ajoute les royalties pour l'auteur et la vente\n //ATTENTION les taxes de déduction sont calculer lors de l'édition avec le taux de l'année en cours\n $dt = array(\"pourcentage\"=>$pc,\"id_vente\"=>$r[\"id_vente\"]\n ,\"id_auteurxcontrat\"=>$r[\"id_auteurxcontrat\"],\"montant_euro\"=>$mtE,\"montant_livre\"=>$mtL\n ,\"conversion_livre_euro\"=>$r['conversion_livre_euro']);\n\t \t\t$arrResult[]= $this->ajouter($dt\n ,true,true);\n //print_r($dt);\n \t\t}\n \t\t\n \t\treturn $arrResult;\n }", "public function boleta()\n\t{\n\t\t//\n\t}", "private function mprofil() {\n\t\t\t$this->_ctrlAdmin = new ControleurAdmin();\n\t\t\t$this->_ctrlAdmin->userProfil();\n\t}", "public function retraitEspeceCarte()\n {\n $fkagence = $this->userConnecter->fk_agence;\n $data['typeagence'] = $this->userConnecter->idtype_agence;\n $data['lang'] = $this->lang->getLangFile($this->getSession()->getAttribut('lang'));\n $telephone = trim(str_replace(\"+\", \"00\", $this->utils->securite_xss($_POST['phone'])));\n $data['benef'] = $this->compteModel->beneficiaireByTelephone1($telephone);\n $data['soldeAgence'] = $this->utils->getSoldeAgence($fkagence);\n\n $typecompte = $this->compteModel->getTypeCompte($telephone);\n if ($typecompte == 0) {\n $username = 'Numherit';\n $userId = 1;\n $token = $this->utils->getToken($userId);\n $response = $this->api_numherit->soldeCompte($username, $token, $telephone);\n $decode_response = json_decode($response);\n if ($decode_response->{'statusCode'} == 000) {\n $data['soldeCarte'] = $decode_response->{'statusMessage'};\n } else $data['soldeCarte'] = 0;\n } else if ($typecompte == 1) {\n $numcarte = $this->compteModel->getNumCarte($telephone);\n $numeroserie = $this->utils->returnCustomerId($numcarte);\n $solde = $this->api_gtp->ConsulterSolde($numeroserie, '6325145878');\n $json = json_decode(\"$solde\");\n $responseData = $json->{'ResponseData'};\n if ($responseData != NULL && is_object($responseData)) {\n if (array_key_exists('ErrorNumber', $responseData)) {\n $message = $responseData->{'ErrorNumber'};\n $data['soldeCarte'] = 0;\n } else {\n $data['soldeCarte'] = $responseData->{'Balance'};\n $currencyCode = $responseData->{'CurrencyCode'};\n }\n } else $data['soldeCarte'] = 0;\n }\n\n $params = array('view' => 'compte/retrait-espece-carte');\n $this->view($params, $data);\n }", "public function cercaP() {\r\n $operatore = $_SESSION[\"op\"];\r\n $ruolo = $operatore->getFunzione();\r\n\r\n $ricerca = array();\r\n $ricerca[\"numeroPratica\"] = isset($_REQUEST[\"numeroPratica\"]) ? $_REQUEST[\"numeroPratica\"] : null;\r\n $ricerca[\"statoPratica\"] = isset($_REQUEST[\"statoPratica\"]) ? $_REQUEST[\"statoPratica\"] : null;\r\n $ricerca[\"tipoPratica\"] = isset($_REQUEST[\"tipoPratica\"]) ? $_REQUEST[\"tipoPratica\"] : null;\r\n $ricerca[\"incaricato\"] = isset($_REQUEST[\"incaricato\"]) ? $_REQUEST[\"incaricato\"] : null;\r\n $ricerca[\"flagAllaFirma\"] = isset($_REQUEST[\"flagAllaFirma\"]) ? $_REQUEST[\"flagAllaFirma\"] : null;\r\n $ricerca[\"flagFirmata\"] = isset($_REQUEST[\"flagFirmata\"]) ? $_REQUEST[\"flagFirmata\"] : null;\r\n $ricerca[\"flagInAttesa\"] = isset($_REQUEST[\"flagInAttesa\"]) ? $_REQUEST[\"flagInAttesa\"] : null;\r\n $ricerca[\"flagSoprintendenza\"] = isset($_REQUEST[\"flagSoprintendenza\"]) ? $_REQUEST[\"flagSoprintendenza\"] : null;\r\n $offset = isset($_REQUEST[\"offset\"]) ? $_REQUEST[\"offset\"] : 0;\r\n $numero = isset($_REQUEST[\"numero\"]) ? $_REQUEST[\"numero\"] : 15;\r\n $richiestaFirmate = isset($_REQUEST[\"richiestaFirmate\"]) ? $_REQUEST[\"richiestaFirmate\"] : 0;\r\n\r\n if ($ruolo < 2) {\r\n $ricerca[\"incaricato\"] = $operatore->getId();\r\n }\r\n\r\n //$numeroPratiche = PraticaFactory::numeroTotalePratiche();\r\n $numeroPratiche= PraticaFactory::elencoNumeroP($ricerca);\r\n \r\n if ($offset >= $numeroPratiche) {\r\n $offset = 0;\r\n }\r\n if ($offset < 1) {\r\n $offset = 0;\r\n }\r\n\r\n if ($richiestaFirmate === 0) {\r\n $href = '<a href=\"index.php?page=operatore&cmd=aggiornaP&numeroP=';\r\n } elseif ($ruolo > 2) {\r\n $href = '<a href=\"index.php?page=responsabile&cmd=firmaP&numeroP=';\r\n }\r\n\r\n $pratiche = PraticaFactory::elencoP($ricerca, $offset, $numero);\r\n \r\n $x = count($pratiche);\r\n $data = \"\";\r\n for ($i = 0; $i < $x; $i++) {\r\n $data.= \"<tr class=\\\"\" . ($i % 2 == 1 ? \"a\" : \"b\") . \"\\\"><td>\" . $href\r\n . $pratiche[$i]->getNumeroPratica() . \"\\\">\" . $pratiche[$i]->getNumeroPratica() . \"</a></td>\"\r\n . \"<td>\" . $pratiche[$i]->getDataCaricamento(true) . \"</td>\"\r\n . \"<td>\" . $pratiche[$i]->getRichiedente() . \"</td>\"\r\n . \"<td>\" . PraticaFactory::tipoPratica($pratiche[$i]->getTipoPratica()) . \"</td>\"\r\n . \"<td>\" . PraticaFactory::statoPratica($pratiche[$i]->getStatoPratica()) . \"</td>\"\r\n . \"<td>\" . OperatoreFactory::getOperatore($pratiche[$i]->getIncaricato())->getNominativo() . \"</td>\"\r\n . \"</tr>\";\r\n }\r\n\r\n header('Cache-Control: no-cache, must-revalidate');\r\n header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');\r\n header('Content-type: application/json');\r\n $json = array();\r\n $json[\"testo\"] = $data;\r\n $json[\"numeroPratiche\"] = $numeroPratiche;\r\n $json[\"numRow\"] = $x;\r\n echo json_encode($json);\r\n }", "function actionModifSousproduit($twig, $db){\n $form = array();\n $typeproduit = new Typeproduit($db); //Classe Typeproduit\n $liste = $typeproduit->select(); //On selectionne ce qui est contenu dans la table Typeproduit grace à la requete select() \n $form['typeproduits']=$liste; //liste des types de produits\n\n if(isset($_GET['id'])){ //On recupère l'id contenu dans le lien\n $sousproduit = new Sousproduit($db); //Classe sousproduit\n\n $unSousproduit = $sousproduit->selectById($_GET['id']); //On selectionne un produit grace à son id\n if ($unSousproduit!=null){ // Si le produit est renseigné\n $form['sousproduit'] = $unSousproduit;\n }\n else{ //Si le produit n'est pas renseigner\n $form['message'] = 'Produit incorrect'; //Msg d'erreur\n }\n }\n else{\n if(isset($_POST['btModifier'])){ //Si le bouton pour modifier est cliqué\n $sousproduit = new Sousproduit($db);\n $id = $_POST['id']; //Valeurs du form\n $libelle = $_POST['libelle'];\n $qte = $_POST['qte'];\n $fabricant = $_POST['fabricant'];\n $commentaire = $_POST['commentaire'];\n $seuil = $_POST['seuil'];\n $reference = $_POST['reference'];\n $idTypeproduit = $_POST['idTypeproduit'];\n //On execute la requete permettant de modifier toute une ligne de la table sousproduit\n $exec=$sousproduit->updateAll($id, $libelle, $qte, $fabricant, $commentaire, $seuil, $reference, $idTypeproduit);\n if(!$exec){//Si la requete ne s'execute pas\n $form['valide'] = false;\n $form['message'] = 'Échec de la modification';\n }\n else{//Sinon\n $form['valide'] = true;\n $form['message'] = 'Modification réussie';\n }\n }\n else{ //Produit non précisé\n $form['message'] = 'Produit non précisé';\n }\n }\n echo $twig->render('modif-sousproduit.html.twig', array('form'=>$form,'liste'=>$liste));\n}", "protected function metodo_protegido() {\n }", "public function enfocarCamaraPresidencia() {\n\n self::$presidencia->enfocar();\n\n }", "public function pesquisarParteInteressadaAction()\n {\n }", "abstract public function getPasiekimai();", "public function Afficher_Panier($id_commande) {\n \n // requete sur la base de donnée\n $sql = \"SELECT tb_article.id_article,a_designation,a_pht,qte_cmde,url_image,t_taux, tb_ligne_commande.id_commande, a_pht*(1+tb_tva.t_taux) AS PRIX\n FROM tb_article,tb_commande,tb_ligne_commande, tb_tva \n WHERE tb_article.id_article = tb_ligne_commande.id_article \n AND tb_ligne_commande.id_commande = tb_commande.id_commande \n AND tb_article.id_tva = tb_tva.id_tva \n AND tb_commande.id_commande =$id_commande\";\n \n $req = $this->db->query($sql);\n\n $enteteTableau = '<table class=\"tableauPanier\">\n <caption>Contenu du panier</caption>\n <tr>\n <th>image</th>\n <th>Désignation</th>\n <th>Prix</th>\n <th>Quantité</th>\n <th></th>\n <th>modification</th>\n <th></th>\n </tr>';\n $contenuTableau =\"\"; \n while ($resultat =$req->fetch(PDO::FETCH_OBJ)) {\n\n $contenuTableau .= \"\n\n <tr>\n <td><img src= \\\"$resultat->url_image\\\"/> </td>\n <td>$resultat->a_designation</td>\n <td>$resultat->PRIX €</td>\n <td>$resultat->qte_cmde</td>\n <td><a href=\\\"?id_article=$resultat->id_article&action=add\\\"> Ajouter</a></td>\n// <td><a href=\\\"?id_article=$resultat->id_article&action=substract\\\">RETIRER</a> </td>\n <td><a href=\\\"?id_article=$resultat->id_article&action=del\\\"> Supprimer</a></td>\n </tr>\n \";\n }\n $finTableau = '</table>';\n \n $tableau = $enteteTableau\n .$contenuTableau\n .$finTableau;\n \n return $tableau;\n \n }", "function proposition($CONNEXION, $PRODUIT, $QTE, $PRIX, $DATE){\n\n\t\t/* select pour id du produit à partir du nom! */\n\t\t$queryID=\"SELECT idType FROM TypeProduit\n\t\t\t\t\tWHERE nomProd=\".$PRODUIT.\";\"\n\t\t$result=sybase_query($queryID, $CONNEXION);\n\t\t$idProd=sybase_result($result);\n\t\n\t\t/* select pour récupérer le RCS du fournisseur à partir de la table Users avec $USERNAME= LOGIN */\n\t\t$queryRCS=\"SELECT idU from Users\n\t\t\t\t\tWHERE typeU=2\n\t\t\t\t\tAND loginU=\".$USERNAME\";\"\n\t\t$result=sybase_query($queryRCS, $CONNEXION);\n\t\t$RCS=SYBASE_RESULT($result);\n\t\t\n\t\n\t\t$query = \"INSERT INTO Produit VALUES (getdate(), \".$qte.\", \".$prix.\", \".$date.\", \".$RCS.\", null, \".$idProd.\";\n\t\t$result = sybase_query($query, $CONNEXION);\n\n\t}", "function top_produit()\n{\n\t$sql = \"SELECT produit.id_produit,nom_produit,description_produit,desc_courte_produit,prix,qte,images from produit inner join commande_produit on produit.id_produit = commande_produit.id_produit\n\tinner join commande on commande_produit.id_commande = commande.id_commande limit 1\";\n\tglobal $connection;\n\treturn mysqli_query($connection, $sql);\n}", "public function videoconferenciaNoInterrumpir( ) {\n $this->setNoInterrumpir(\"OFF\");\n //$this->setNoInterrumpir(\"ALLOCATED\");\n }", "function wtsCtrlSaisieForfaits($ar){\n\n $p = new XParam($ar, array('mode'=>'a'));\n $mode = $p->get('mode');\n $r = array('ok'=>1, 'errors'=>array(), 'message'=>'');\n $cards = $p->get('card');\n $chips = $p->get('CHIPID');\n $accs = $p->get('ACCNO');\n $crcs = $p->get('CRC');\n $cardlabels = $p->get('NEWCARDLabel');\n $usedcards = array();\n // lecture de l'offre\n $offresoid = $p->get('offreoid');\n $productsoid = $p->get('productoid');\n $validfroms = $p->get('validfrom');\n $validtills = $p->get('validtill');\n \n $justgrps = $p->get('justgrp');\n\n // parcours des lignes et controles\n foreach($cards as $lineid => $card){\n $card2 = substr($card, 0, 7);\n /*\n\t$card = \n\tNEWCARD_'oidproduit' = achat nouvelle carte\n\tNEWCARD'uniqid' = carte en commande issue du panier\n\tWTPCARD strictement = saisie du numéro ou copie choix depuis les cartes du compte\n\tWTPCARD'unidiq'= carte saisie sélectionnée dans le panier\n\tdonc si substr(card, 0, 7) == NEWCARD : controles sur cartes en achat \n si substr(card, 0, 7) == WTPCARD : controles sur cartes en rechargement\n */\n if ($card2 == 'WTPCARD'){\n //$wtp = sprintf(\"%s-%s-%s\", $chips[$lineid], $crcs[$lineid], $accs[$lineid]);\n $wtp = $this->modresort->formatWTPParts(array($chips[$lineid], $crcs[$lineid], $accs[$lineid]));\n // TA, SKD 01- ou 1- le reste est fait dans le module\n if (strlen($wtp) != 16 && strlen($wtp) != 25 && strlen($wtp) != 24){\n $r['ok'] = 0;\n $r['message'] = $GLOBALS['XSHELL']->labels->getCustomSysLabel('wts_remplirwtp');\n break;\n } else if (!isset($usedcards[$wtp])){\n $usedcards[$wtp] = 1;\n // verification du WTP\n $r2 = $this->wtsCheckWTP(array('mode'=>'r', 'b'=>0, 'chipid'=>$chips[$lineid], 'accno'=>$accs[$lineid], 'crc'=>$crcs[$lineid]));\n if ($r2['ok'] != 1){\n $r['ok'] = 0; \n\t if (isset($r2['errormess'])){\n\t $r['message'] = $r2['errormess'];\n\t } else {\n\t $r['message'] = $GLOBALS['XSHELL']->labels->getCustomSysLabel('wts_wtpinvalide');\n\t }\n\t array_push($r['errors'], \n\t\t array(\"CHIPDID[$lineid]\", '', $lineid), \n\t\t array(\"ACCNO[$lineid]\", '', $lineid), \n\t\t array(\"CRC[$lineid]\", '', $lineid),\n\t\t array(\"WTPMASK[$lineid]\", '', $lineid)\n\t\t );\n }\n // autres controles :\n $productoid = $productsoid[$lineid];\n $offreoid = $productsoid[$lineid];\n $validfrom = $validfroms[$lineid];\n $validtill = $validtills[$lineid];\n $justgrp = $justgrps[$lineid];\n if ($r['ok'] == 1){\n $r3 = $this->localWTPCheck($wtp, $offreoid, $productoid, $justgrp, false, $validfrom, $validtill, $lineid);\n if ($r3['ok'] != 1){\n $r['ok'] = 0;\n $r['message'] = $r3['message'];\n }\n }\n if (($r['ok'] == 1 || $r['ok'] == 0 && $r['iswarn'])){\n $r41 = $this->checkProductInCaddie($wtp, $offreoid, $productoid, $validfrom, $validtill);\n if ($r41['ok'] != 1){\n $r['ok'] = 0;\n $r['iswarn'] = $r41['iswarn'];\n if ($r['iswarn']){\n if ($r['message'] == '')\n $r['message'] = $r41['message'];\n else\n $r['message'] .= \"\\n\".$r41['message'];\n } else {\n $r['message'] = $r41['message'];\n }\n }\n }\n if (($r['ok'] == 1 || $r['ok'] == 0 && $r['iswarn'])){\n\t $r4 = $this->checkProductInOrder($wtp, $offreoid, $productoid, $validfrom, $validtill);\n if ($r4['ok'] != 1){\n $r['ok'] = 0;\n $r['iswarn'] = $r4['iswarn'];\n if ($r['iswarn']){\n if ($r['message'] == '')\n $r['message'] = $r4['message'];\n else\n $r['message'] .= \"\\n\".$r4['message'];\n } else {\n $r['message'] = $r4['message'];\n }\n }\n }\n // verifier que la carte n'est pas déjà dans le panier\n // si oui que ces forfaits sont compatibles ... avec le validfrom\n }else{\n $r['ok'] = 0;\n $r['message'] = $GLOBALS['XSHELL']->labels->getCustomSysLabel('wts_cartesuniques');\n break;\n }\n } else if ($card2 == 'NEWCARD'){\n $wtp = $cardlabels[$lineid];\n $justgrp = $justgrps[$lineid];\n $productoid = $productsoid[$lineid];\n $validfrom = $validfroms[$lineid];\n $validtill = $validtills[$lineid];\n $r31 = $this->localWTPCheck($wtp, $offreoid, $productoid, $justgrp, true, $validfrom, $validtill, $lineid);\n if ($r31['ok'] != 1){\n $r['ok'] = 0;\n $r['message'] = $r31['message'];\n break;\n }\n if (!isset($usedcards[$wtp])){\n $usedcards[$wtp] = 1;\n }else{\n $r['ok'] = 0;\n $r['message'] = $GLOBALS['XSHELL']->labels->getCustomSysLabel('wts_cartesuniques');\n break;\n }\n }\n }\n // sleep(10);\n\n // si ok vérification des dates (on prend le premier produit, tous devant avoir les même caractériqiques)\n if ($r['ok'] == 1){\n $this->checkDelais($r, $productsoid, $validfroms);\n }\n\n // if ($r['ok'] == 1){\n // $r['ok'] = 0; $r['message']='tests '.$r['message'];\n // $r['iswarn'] = 1;\n // }\n\n\n // TESTS PENDNT AJOUT PANIER\n // $r = array('ok'=>1,'iswarn'=>1, 'errors'=>array('kk'), 'message'=>'PAS DE CONTROLES');\n\n\n if (count($r['errors'])>0)\n $r['ok'] = 0;\n if ($mode == 'a'){\n header('Content-Type:application/json; charset=UTF-8');\n die(json_encode($r));\n }\n return $r;\n }", "public function hookDisplayBackOfficeTop()\n {\n $objectifCoach = array();\n $this->context->controller->addCSS($this->_path . 'views/css/compteur.css', 'all');\n $this->context->controller->addJS($this->_path . 'views/js/compteur.js');\n $objectifCoach[] = CaTools::getObjectifCoach($this->context->employee->id);\n $objectif = CaTools::isProjectifAtteint($objectifCoach);\n $objectif[0]['appels'] = (isset($_COOKIE['appelKeyyo'])) ? (int)$_COOKIE['appelKeyyo'] : '0';\n\n $this->smarty->assign(array(\n 'objectif' => $objectif[0]\n ));\n return $this->display(__FILE__, 'compteur.tpl');\n }", "function peupler_base_produits_demos() {\n\n\t// données des 3 produits à insérer\n\t$set = array(\n\t\tarray('titre'=>'Cube', 'prix'=>'12.5'),\n\t\tarray('titre'=>'Sphere', 'prix'=>'8'),\n\t\tarray('titre'=>'Cylindre','prix'=>'23.99')\n\t);\n\n\t// insertion des 3 produits\n\tsql_insertq_multi('spip_produits_demos', $set);\n\n\t// ajout des logos d'après les fichiers présents dans demo/images (produitdemo_sphere.png etc.)\n\tforeach ($set as $k=>$produit) {\n\n\t\t$titre = $produit['titre'];\n\t\t$id_produitdemo = sql_getfetsel('id_produitdemo',table_objet_sql('produitdemo'),\"titre=\".sql_quote($titre));\n\n\t\t// copie temporaire de l'image dans /tmp\n\t\t$fichier = find_in_path('demo/images/produitdemo_'.strtolower($titre).'.png');\n\t\t$fichier_tmp = _DIR_TMP.pathinfo($image, PATHINFO_FILENAME).'_tmp.png';\n\t\tif (!copy($fichier,$fichier_tmp))\n\t\t\treturn;\n\t\t$name = pathinfo($fichier_tmp, PATHINFO_BASENAME);\n\t\t$type = 'image/png';\n\t\t$size = filesize($fichier_tmp);\n\n\t\t// variable de téléversement\n\t\t$_FILES['logo_on'] = array(\n\t\t\t'name' => $name,\n\t\t\t'tmp_name' => $fichier_tmp,\n\t\t\t'type' => $type,\n\t\t\t'size' => $size,\n\t\t\t'error' => ''\n\t\t);\n\n\t\t// traitements de « editer_logo »\n\t\t$traiter_logo = charger_fonction('traiter','formulaires/editer_logo');\n\t\t$res = $traiter_logo('produitdemo',$id_produitdemo);\n\n\t\t// suppression du fichier temporaire\n\t\tinclude_spip('inc/flock');\n\t\tsupprimer_fichier(find_in_path($fichier_tmp));\n\n\t}\n\n}", "public function relatorioAction() { \r\n \r\n }", "public function apagarProyectorCentral( ) {\n $this->setEncendidoProyector(0);\n $this->setComando(self::$PROYECTOR_CENTRAL, \"OFF\");\n\n }", "function fTraeAuxiliar($pTip, $pCod){\n global $db, $cla, $olEsq;\n $slDato= substr($olEsq->par_Clave,4,2);\n if ($slDato == \"CL\") { // el movimiento se asocia al Cliente\n $iAuxi = $cla->codProv;\n }\n else {\n $iAuxi = NZ(fDBValor($db, \"fistablassri\", \"tab_txtData3\", \"tab_codTabla = '\" . $pTip . \"' AND tab_codigo = '\" . $pCod . \"'\" ),0);\n }\n//echo \"<br>aux\" . $olEsq->par_Clave. \" / \" .$slDato . \" $iAuxi <br>\";\n error_log(\" aux: \" . $iAuxi. \" \\n\", 3,\"/tmp/dimm_log.err\");\t\n return $iAuxi;\n}", "function stocks_affiche_milieu($flux) {\n\t$texte = \"\";\n\tif ($flux['args']['exec'] == 'produit') {\n\t\t$flux['data'] .= recuperer_fond(\n\t\t\t'prive/squelettes/inclure/gerer_stock',\n\t\t\t$flux['args'] // On passe le contexte au squelette\n\t\t);\n\t}\n\tif($texte){\n\t\tif ($p = strpos($flux['data'], \"<!--affiche_milieu-->\")) {\n\t\t\t$flux['data'] = substr_replace($flux['data'], $texte, $p, 0);\n\t\t} else {\n\t\t\t$flux['data'] .= $texte;\n\t\t}\n\t}\n\treturn $flux;\n}", "function cl_sau_prochabilitacao() { \n //classes dos rotulos dos campos\n $this->rotulo = new rotulo(\"sau_prochabilitacao\"); \n $this->pagina_retorno = basename($GLOBALS[\"HTTP_SERVER_VARS\"][\"PHP_SELF\"]);\n }", "function sevenconcepts_pre_insertion($flux){\n if ($flux['args']['table']=='spip_auteurs'){\n include_spip('cextras_pipelines');\n $champs_extras=champs_extras_objet(table_objet_sql('auteur'));\n foreach($champs_extras as $value){\n $flux['data'][$value['options']['nom']]=_request($value['options']['nom']); \n }\n $flux['data']['name']=_request('nom_inscription'); \n }\nreturn $flux;\n}", "public function produits()\n {\n $data[\"list\"]= $this->produit->list();\n $this->template_admin->displayad('liste_Produits');\n }", "public function pretragaIdeja(){\n $data['kor_ime']=$this->session->get('kor_tip');\n $idejaModel=new IdejaModel();\n $korisnik= $this->request->getVar(\"pretraga\");\n $ideje=$idejaModel->dohvati_ideje_po_korisnickom_imenu($korisnik);\n $data['ideje']=$ideje;\n $this->prikaz('pregled_ideja', $data);\n }", "public function mostraElencoProvvedimenti($pagina) {\r\n \r\n $pagina->setJsFile(\"\");\r\n $operatore = $_SESSION[\"op\"];\r\n $ruolo = $operatore->getFunzione();\r\n $pagina->setHeaderFile(\"./view/header.php\"); \r\n OperatoreController::setruolo($pagina);\r\n $pagina->setMsg('');\r\n \r\n if (isset($_REQUEST['id'])) {\r\n $id = $_REQUEST['id'];\r\n $nuovoProvvedimento = ProvvedimentoFactory::getProvvedimento($id);\r\n $pagina->setTitle(\"Modifica operatore\");\r\n $pagina->setContentFile(\"./view/operatore/nuovoProvvedimento.php\");\r\n $update = true;\r\n } else {\r\n $pagina->setJsFile(\"./js/provvedimenti.js\");\r\n $pagina->setTitle(\"Elenco provvedimenti Unici\");\r\n $pagina->setContentFile(\"./view/operatore/elencoProvvedimenti.php\"); \r\n }\r\n include \"./view/masterPage.php\";\r\n }", "public function setProducto($pro){ $this->producto = $pro;}", "public function show(Produit $produit)\n {\n //\n }", "public function show(Produit $produit)\n {\n //\n }", "function setAgregarUnPais(){\n\t\t$this->comienza_con++;\n\t}", "public function commissionPartenaire()\n {\n $data['liste_part'] = $this->partenaireModels->getPartenaire();\n $this->views->setData($data);\n\n $this->views->getTemplate('reporting/commissionPartenaire');\n }", "function addpanier($user, $product, $quantite, $poids){\t// Fonction pour ajouter un produit au panier\n\n\t\tinclude(\"../../modele/modele.php\"); // Inclue la base de donnée + connexion.\n\t\t\n\t\t$actif = '1' ;\n\t\t$sql = 'INSERT INTO detailcommande(id_product, id_user, quantite, poids, actif) VALUES (:id_product , :id_user , :quantite , :poids, :actif) '; // Ajout d'une ligne dans la table detailCommande \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t // suivant les informations entrer dans la fonction panier.\n\t\t$reponse = $bdd->prepare($sql);\t\t\t// Preparation de la requete SQL.\n\t\t$reponse -> bindParam(':id_product', $product);\n\t\t$reponse -> bindParam(':id_user', $user);\n\t\t$reponse -> bindParam(':quantite', $quantite);\n\t\t$reponse -> bindParam(':poids', $poids);\n\t\t$reponse -> bindParam(':actif', $actif );\n\t\t$reponse ->execute();\t\t\t\t\t// Execution de la requete SQL.\n\n\t\t$sql3 = 'SELECT * FROM detailcommande WHERE id_product = \"'.$product.'\" AND id_user = \"'.$user.'\" AND quantite = \"'.$quantite.'\" AND poids=\"'.$poids.'\" AND actif = 1 ';\n\t\t$reponse3 = $bdd->query($sql3);\n\t\twhile ($donnees = $reponse3 -> fetch())\t\t// Mise en forme de tableau.\n\t\t\t{\n\t\t\t\t$actif = '1' ;\n\t\t\t\t$id_detailCommande = $donnees['id'];\n\t\t\t\t$sql2 = 'INSERT INTO commande(id_user, id_detailCommande, date, actif) VALUES (:id_user, :id_detailCommande, CURDATE(), :actif)'; \t// Ajout d'une ligne dans la table commande\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// suivant les informations d'entrées\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Ajout date ???\n\t\t\t\t$reponse2 = $bdd->prepare($sql2);\n\t\t\t\t$reponse2 -> bindParam(':id_user', $user);\n\t\t\t\t$reponse2 -> bindParam(':id_detailCommande', $id_detailCommande);\n\t\t\t\t$reponse2 -> bindParam(':actif', $actif );\n\t\t\t\t$reponse2 ->execute();\n\t\t\t}\n\t}", "function suppr_tache_dossier($id_dossier)\r\n{\r\n\tglobal $objet;\r\n\tif(droit_acces($objet[\"tache_dossier\"],$id_dossier)==3 && $id_dossier>1)\r\n\t{\r\n\t\t// on créé la liste des dossiers & on supprime chaque dossier\r\n\t\t$liste_dossiers_suppr = arborescence($objet[\"tache_dossier\"], $id_dossier, \"tous\");\r\n\t\tforeach($liste_dossiers_suppr as $infos_dossier)\r\n\t\t{\r\n\t\t\t// On supprime chaque tache du dossier puis le dossier en question\r\n\t\t\t$liste_taches = db_tableau(\"SELECT * FROM gt_tache WHERE id_dossier='\".$infos_dossier[\"id_dossier\"].\"'\");\r\n\t\t\tforeach($liste_taches as $infos_tache)\t\t{ suppr_tache($infos_tache[\"id_tache\"]); }\r\n\t\t\tsuppr_objet($objet[\"tache_dossier\"], $infos_dossier[\"id_dossier\"]);\r\n\t\t}\r\n\t}\r\n}", "public function suprAffectation()\n {\n //sécurité :\n $action = 'deleteFolderInformation';\n $error = AccessControll::checkRight($action);\n if ( empty($error) ){ //ok\n //on réccupère l'id à supr (clée primaire)\n $id = $this->request->getGetAttribute('id');\n //ajout d'une entrée dans le fichier de log\n $data = DossierManager::getAffectationByClef($id);\n $auth = AuthenticationManager::getInstance();\n $username = $auth->getMatricule();\n $type = 'affectationCaserne';\n self::logDeletedInformation($data, $username, $type);\n //on supprime (retourne le matricule)\n $matricule = DossierManager::suprAffectationById($id);\n //on réaffiche le dossier actualisé\n $dossier = DossierManager::getOneFromId($matricule);\n $prez = self::afficheDossierComplet($dossier);\n $this->response->setPart('contenu', $prez);\n } else{\n header(\"location: index.php\");\n die($error);\n }\n }", "function voirDerniereCommande(){\n\t$order = array();\n\tarray_push($order, array('nameChamps'=>'idCommande','sens'=>'desc'));\n\t$req = new myQueryClass('commande','',$order,'','limit 1');\n\t$r = $req->myQuerySelect();\n\treturn $r[0] ;\n\t}", "public function contrato()\r\n\t{\r\n\t}", "public function __construct(){\n $this->pegaProjetos();\n }", "function wtsCaddieDisp($ar){\n $caddie = $this->getCaddie();\n $mobile = false;\n $web = false;\n $source = $this->getSource();\n if ($source == self::$WTSORDER_SOURCE_SITE_INTERNET)\n $web = true;\n if ($source == self::$WTSORDER_SOURCE_SITE_MOBILE)\n $mobile = true;\n $offres = $this->modcatalog->listeOffres($mobile, $web);\n $caddie['offres'] = $offres;\n if ($this->customerIsPro()){\n $this->summarizeCaddie($caddie);\n }\n XShell::toScreen2('wts', 'caddie', $caddie);\n }", "public function reescalarActi(){\n }", "public function recap(){\n\t\techo \"----- INFO\" . $this->getNom() . \" ----- <br>\";\n\t\techo $this->getNom() . \" a \" . $this->getVie() . ' points de vie <br>';\n\t}", "function cl_pcorcamfornelic() {\n //classes dos rotulos dos campos\n $this->rotulo = new rotulo(\"pcorcamfornelic\");\n $this->pagina_retorno = basename($GLOBALS[\"HTTP_SERVER_VARS\"][\"PHP_SELF\"]);\n }", "function actualiser_etat_objet($objet) {\n try {\n $m = $_SESSION[\"mascotte\"];\n foreach ($objet->effets as $e) {\n switch($e->attribut) {\n case \"sante\": changer_etat($m->sante, $e->coef); break;\n case \"bonheur\": changer_etat($m->bonheur, $e->coef); break;\n case \"faim\": changer_etat($m->faim, $e->coef); break;\n case \"maladie\": changer_etat($m->pourc_maladie, $e->coef); break;\n }\n }\n }\n catch(Exception $ex) {\n throw $ex;\n }\n }", "function autorizar_esp_pm_acumulado_servicio_tecnico($id_mov){\r\n\r\nglobal $db;\t\r\n \r\n $db->starttrans();\r\n \r\n //traigo el deposito origen\r\n $sql = \"select deposito_origen from movimiento_material where id_movimiento_material = $id_mov\"; \r\n $res = sql($sql) or fin_pagina();\r\n $id_deposito_oriden = $res->fields[\"deposito_origen\"];\r\n \t \r\n //traigo el detalle de los movimientos a liberar \t \r\n $sql=\"select * from detalle_movimiento where id_movimiento_material=$id_mov\";\r\n $res = sql($sql) or fin_pagina();\r\n\r\n $comentario = \" Autorizacion de PM acumulado de servicio tecnico nro: $id_mov\";\r\n $id_tipo_movimiento = 7;\r\n\r\n //por cada detalle voy liberando las reservas del pm autorizado \r\n for($i=0;$i<$res->recordcount();$i++) {\r\n \t $id_prod_esp = $res->fields[\"id_prod_esp\"];\r\n $cantidad = $res->fields[\"cantidad\"];\r\n $id_detalle_movimiento = $res->fields[\"id_detalle_movimiento\"];\r\n descontar_reserva($id_prod_esp,$cantidad,$id_deposito_oriden,$comentario,$id_tipo_movimiento,\"\",$id_detalle_movimiento,\"\");\r\n $res->movenext(); \r\n }//del for\r\n \t \r\n \t \r\n //Inserto la Mercaderia entrante en el stock BS AS \r\n \r\n $sql = \"select * from mercaderia_entrante where id_movimiento_material = $id_mov\";\r\n $res = sql($sql) or fin_pagina();\r\n\t\t\t \r\n\t\t\t \r\n $comentario = \"Producto de lista de mercaderia entrante del PM nro: $id_mov, a travez de una Autorizacion Especial\";\r\n\t\t\t \r\n for($i=0;$i<$res->recordcount();$i++){\r\n\t $id_prod_esp = $res->fields[\"id_prod_esp\"];\r\n\t $cantidad = $res->fields[\"cantidad\"];\r\n\t $descripcion = $res->fields[\"descripcion\"]; \r\n\t //el deposito origen es Buenos Aires que es igual a 2 segun la tabla general.depositos \r\n\t $deposito_origen='2';\r\n\t //el id_tipo_movimiento le hardcodeo uno de la tabla stock.tipo_movimiento\r\n\t $id_tipo_movimiento='13';\r\n\t //el ingreso del producto es a \"disponible\" por lo tanto la funcion no toma en cuenta los parametros que siguen\r\n\t $a_stock='disponible';\r\n\t agregar_stock($id_prod_esp,$cantidad,$deposito_origen,$comentario,$id_tipo_movimiento,$a_stock,$id_tipo_reserva,\"\",$id_detalle_movimiento,$id_licitacion,$nro_caso);\r\n\t $res->movenext();\r\n }//del for\r\n $db->completetrans();\r\n\r\n }", "public function preRetrieve();", "function action_outline_supp_row_dist()\n{\n\t//$arg = $securiser_action();\n\t$arg = _request('arg');\n\n\t$arg = explode(':',$arg);\n\t$id_form = $arg[0];\n\t$id_donnee = $arg[1];\n\t\n\t//Forms_supprimer_donnee($id_form,$id_donnee);\n\tForms_arbre_supprimer_donnee($id_form,$id_donnee,false);\n\n\tif ($redirect = urldecode(_request('redirect'))){\n\t\tinclude_spip('inc/headers');\n\t\tredirige_par_entete(str_replace('&amp;','&',$redirect));\n\t}\n}", "public function transactServicePro__()\n {\n //var_dump($this->paramGET); die();\n $param = [\n \"button\" => [\n \"modal\" => [\n [\"reporting/detailTransactServModal\", \"reporting/detailTransactServModal\", \"fa fa-search\"],\n ],\n \"default\" => [\n ]\n ],\n \"tooltip\" => [\n \"modal\" => [\"Détail\"]\n ],\n \"classCss\" => [\n \"modal\" => [],\n \"default\" => [\"confirm\"]\n ],\n \"attribut\" => [],\n \"args\" => $this->paramGET,\n \"dataVal\" => [\n ],\n \"fonction\" => [\"date_transaction\"=>\"getDateFR\",\"montant\"=>\"getFormatMoney\",\"commission\"=>\"getFormatMoney\"]\n ];\n $this->processing($this->reportingModels, 'getAllTransactionService', $param);\n }", "function procCtrl($ar){\n $ok = true;\n \n $p = new XParam($ar, array());\n \n // dtff !empty = date valide = écran edition\n // age si < 18 => champs complémentaire\n $dtnaiss = $this->xset->desc['dtnaiss']->post_edit($p->get('dtnaiss'));\n $diff = date_diff(new DateTime(date('Y-m-d')), new DateTime($dtnaiss->raw));\n if ($diff->y < 18){\n foreach($this->eplmodule->modcustomer->parentMandFields as $fn){\n $v = trim($p->get($fn));\n if (empty($v)){\n $ok = false;\n }\n }\n if (!$ok){\n $_REQUEST['message'] .= \"Pour un mineur renseigner les champs 'Responsable légal'\";\n }\n }\n if ($ok && $ar['_typecontrol'] == 'insert'){\n $wtpcard = trim($p->get('wtpcard'));\n if (empty($wtpcard)){\n $ok = false;\n $_REQUEST['message'] = 'Merci de renseigner le numéro de carte'; \n } else {\n list($okcard, $messcard) = $this->checkNewWTPCard($wtpcard);\n if (!$okcard){\n $ok = false;\n $_REQUEST['message'] .= $messcard;\n }\n }\n }\n// $_REQUEST['message'] .= 'TESTS';\n// $ok = false;\n$this->erreurCtrl = !$ok;\n return $ok;\n\n }", "public function moverse(){\n\t\techo \"Soy $this->nombre y me estoy moviendo a \" . $this->getVelocidad();\n\t}", "function supprimerProduit($code) {\n\t // echo \"<p> supprimer $code </p>\";\n\t \n\t /* on verifie si le produit est dans le panier */\n\t if ( isset($this->lignes[$code]) ) {\n\t /* il y est, donc on retrouve la ligne de panier */\n\t $lp = $this->lignes[$code] ;\n\t \n\t /* on supprime 1 de la quantite */\n\t $lp->qte = $lp->qte - 1 ; \n\t \n\t // echo \"<p> nouvelle qte : \" . $lp->qte . \"</p>\" ;\n\t \n\t /* si qte<1, on supprime toute la ligne du tableau */\n\t if ( $lp->qte < 1) {\n\t unset($this->lignes[$code]);\n\t // echo \"<p> produit $code supprime \" . count($this->lignes) . \"</p>\";\n\t \n\t /* on enleve un produit de nbProduits */\n\t $this->nbProduits = $this->nbProduits - 1;\n\t }\n\t }\t \n\t }", "private function setExercicio(){\n\t\t$this->Enunciado = $this->Data['enunciado'];\n\t\t$this->A = $this->Data['opA'];\n\t\t$this->B = $this->Data['opB'];\n\t\t$this->C = $this->Data['opC'];\n\t\t$this->D = $this->Data['opD'];\n\t\t$this->E = $this->Data['opE'];\n\t\t$this->Correta = $this->Data['correta'];\n\n\t\t$this->Query = ['c_enumexer' => $this->Enunciado,\n\t\t\t\t\t\t'c_altaexer' => $this->A,\n\t\t\t\t\t\t'c_altbexer' => $this->B,\n\t\t\t\t\t\t'c_altcexer' => $this->C,\n\t\t\t\t\t\t'c_altdexer' => $this->D,\n\t\t\t\t\t\t'c_alteexer' => $this->E,\n\t\t\t\t\t\t'c_correxer' => $this->Correta];\n\n\t}", "function cortDrive(){\n \n // an o xrhsths einai guest (mh syndedemenos): vale sth $_SESSION['cortTable'] ena keno pinaka\n // kai kane return\n if (UserType::$userType != UserType::notAdmin && UserType::$userType != UserType::admin){\n \n $_SESSION['cortTable']=[];\n \n return;\n }\n \n // an den einai orismenh h $_SESSION['cortTable'], arxikopoihsete thn me keno pinaka\n if (! isset($_SESSION['cortTable'])){\n \n $_SESSION['cortTable']=[];\n }\n \n // ta koumpia kalathiou exoyn html name btnPr_i,opou i anhkei [0,1,2,3]. h arithmish\n // mpainei apo aristera pros deksia. Antistoixa einai ta name twn allwn elements\n // ths kathe formas\n // etsi diatrexontai ola ta parathira proiontwn - tsekarete an to post aforouse auta\n // kai sth synexeia diatrexontai ola ta elements ths formas kai kataxwroyntai \n // ston pinaka me onoma $product\n // Se kathe anoigma selidas me koumpi submit kalathiou, mono ena apo ta $_POST['btnPr_' . $i]\n // tha einai orismeno\n // Opote se kathe anoigma ths selidas, an den einai guest o xrhsths\n // tha dhmiourghthei 0 h 1 $product\n \n $products =[];\n \n for ($i=0;$i<6;$i++){\n \n// if (isset($_POST['btnPr_' . $i])){\n if (isset($_POST['prodCode_' . $i])){\n \n $product = [\"prodCode\"=>$_POST['prodCode_' . $i],\n \"quantity\"=>$_POST['quantity_' . $i],\n \"prodValue\"=>$_POST['prodValue_' . $i],\n \"deleted\" => false, // auto exei mpei gia thn periptwsh pou kapoio proion\n // pou exei mpei sto kalathi, mhdenistei h posothta toy\n \"prodName\" => $_POST['prodName_' . $i],\n \"prodStock\" => $_POST['prodStock_' . $i]\n ];\n \n $products [] = $product;\n }\n }\n\n //print_r($products);\n \n \n \n// if (isset($product)){\n// //echo \"yes \";\n// }\n// else{\n// //echo \"no\";\n// }\n\n // an dhmiourghthike ena proion\n foreach ($products as $product){\n \n // arxika tha psaksei an o sugkekrimenos kwdikos proiontos\n // uparxei ston pinaka $_SESSION['cortTable']\n \n // an yparxei, \n // tote an to $product['quantity'] einai 0, tha kanei to deleted bit true, enw\n // an to $product['quantity'] einai <> tou 0, tha kanei to deleted bit false kai tha \n // thesei to $_SESSION['cortTable'][$i]['quantity'] = $product['quantity']\n \n $found=false;\n $nextIndex = count($_SESSION['cortTable']);\n \n for($i=0;$i<$nextIndex;$i++){\n \n if ($_SESSION['cortTable'][$i]['prodCode'] == $product['prodCode']){\n \n if ($product['quantity'] != 0){\n \n $_SESSION['cortTable'][$i]['quantity'] = $product['quantity'];\n $_SESSION['cortTable'][$i]['deleted'] = false;\n }\n \n else {\n \n //unset($_SESSION['cortTable'][$i]);\n //$_SESSION['cortTable'] = array_values($_SESSION['cortTable']);\n \n $_SESSION['cortTable'][$i]['deleted'] = true;\n }\n \n $found=true;\n }\n }\n \n // an den yparxei o sugkekrimenos kwdikos proiontos\n // ston pinaka $_SESSION['cortTable'] kai to $product['quantity']!=0\n // tote vale ston pinaka $_SESSION['cortTable'], ws epomeno element\n // ton pinaka $product\n \n if ($found==false && ($product['quantity']!=0)){\n \n $_SESSION['cortTable'][$nextIndex]=$product;\n } \n }\n }", "public function tocar(){\n echo \"Tocando no volume: \" . $this->volume . \" decibéis. <br>\";\n }", "function actualiser_etat() {\n try {\n $m = $_SESSION[\"mascotte\"];\n\n // Actualisation de base\n changer_etat($m->sante, -20);\n changer_etat($m->bonheur, -20);\n changer_etat($m->faim, 10);\n changer_etat($m->pourc_maladie, 10);\n\n // Actualisation selon l'environnement\n $decos = array();\n if (isset($_SESSION[\"mascotte\"]->decorations))\n $decos = $_SESSION[\"mascotte\"]->decorations;\n foreach ($decos as $d) {\n actualiser_etat_objet($d);\n }\n\n // Actualisation selon les vetements\n $vets = array();\n if (isset($_SESSION[\"mascotte\"]->vetements))\n $vets = $_SESSION[\"mascotte\"]->vetements;\n foreach ($vets as $v) {\n actualiser_etat_objet($v);\n }\n\n $m->sante = intval($m->sante);\n $m->bonheur = intval($m->bonheur);\n $m->faim = intval($m->faim);\n $m->pourc_maladie = intval($m->pourc_maladie);\n\n retourner_succes(array(\"sante\" => $m->sante,\n \"bonheur\" => $m->bonheur,\n \"faim\" => $m->faim,\n \"maladie\" => $m->pourc_maladie));\n }\n catch(Exception $ex) {\n retourner_erreur($ex->getMessage());\n }\n }", "function AfficherEntreprise($entreprise)\n {\n require(\"db/connect.php\");\n $requete=$BDD->prepare(\"SELECT * FROM entreprise WHERE entreprise_id = ?\");\n $requete->execute(array($entreprise));\n //on vérifie que l'entreprise existe\n if($requete->rowcount()==0) {\n print (\"Cette entreprise n'existe pas\");\n }\n else {\n //on obtient la ligne entière de la BDD décrivant l'entreprise, stockée dans $entreprise\n $entreprise=$requete->fetch();\n print '<a href=\"entreprises.php\"><img class=\"imageTailleLogo\" alt=\"retour\" src=\"images/fleche.png\"/> </a>'\n . '<h1>'.$entreprise['entreprise_nom'].'</h1></br>';\n //logo + site internet\n print '<div class=\"row centreOffre fondFonce bordureTresDouce\" >\n <div class=\"col-xs-3 col-sm-3 col-md-4 col-lg-4 fondFonce\" \n style=\"height:240px;\"></br>\n <img class=\"imageEntreprise\" alt=\"LogoEntreprise\" src=\"logos/'.$entreprise['entreprise_logo'].'\"/></a>\n </div>\n <div class=\"col-xs-9 col-sm-9 col-md-8 col-lg-8 centreVertical fondFonce\" \n style=\"height:240px;\"> \n Site Internet <a href=\"'.$entreprise['entreprise_siteInternet'].'\">'.\n $entreprise['entreprise_siteInternet'].'</a>\n </div><br/></div>';\n //description longue\n print '<div class=\"row centreOffre bordureTresDouce\" ><h2>Description de l\\'entreprise </h2>';\n print '<div class=\"fondFonce\"></br>'.$entreprise['entreprise_descrLong'].'<br/></br></div>';\n \n //sites\n print '<h2>Adresse(s)</h2>';\n //on récupère les informations des adresses liées à l'entreprise si elle existe \n $requete=$BDD->prepare('SELECT adresse_id FROM liaison_entrepriseadresse WHERE entreprise_id =?;');\n $requete->execute(array($entreprise [\"entreprise_id\"]));\n if ($requete->rowcount()!=0)\n {\n //on stocke les résultats de la requete dans un tableau, une ligne par adresse liée a l'entreprise\n $tableauAdresse=$requete->fetchAll();\n //le booléen permet d'alterner les couleurs\n $bool=true;\n foreach($tableauAdresse as $liaison)\n {\n $bool=!$bool;\n if ($bool) print '<div class=\"col-xs-3 col-sm-3 col-md-4 col-lg-4 fondClair\" \n style=\"height:120px;\">';\n if (!$bool) print '<div class=\"col-xs-3 col-sm-3 col-md-4 col-lg-4 fondFonce\" \n style=\"height:120px;\">';\n $adresse_id=$liaison['adresse_id'];\n AfficherAdresse($adresse_id);\n print '</div>';\n } \n }\n else print '<i>Pas d\\'adresse renseignée.</i>';\n print '</div>'; \n \n //contacts\n print '<div class=\"row centreOffre\" style=\"border:1px solid #ddd;\">';\n print '<h2>Contact(s)</h2>';\n $requete=$BDD->prepare(\"SELECT * FROM contact WHERE contact.entreprise_id =?;\");\n $requete-> execute(array($entreprise['entreprise_id']));\n if ($requete->rowcount()!=0)\n {\n //on stocke les résultats de la requete dans un tableau, une ligne par contact lié a l'entreprise\n $tableauContact=$requete->fetchAll();\n $bool=true;\n foreach($tableauContact as $contact)\n {\n $bool=!$bool;\n if ($bool) print '<div class=\"col-xs-3 col-sm-3 col-md-4 col-lg-4 fondClair\" \n style=\"height:150px;\">';\n if (!$bool) print '<div class=\"col-xs-3 col-sm-3 col-md-4 col-lg-4 fondFonce\" \n style=\"height:150px;\">';\n AfficherContact($contact);\n } \n }\n else print\"<i>Pas de contact renseigné.</i>\";\n print '</div>';\n //offres proposées\n print '<div class=\"row centreOffre\" style=\"border:1px solid #ddd;\">';\n print '<h2>Offre(s) proposée(s)</h2>';\n //l'utilisateur normal ne peut voir les offres de moins d'une semaine\n if ($_SESSION['statut']==\"normal\")\n {\n $requete=$BDD->prepare(\"SELECT * FROM offre WHERE offre.entreprise_id =? AND offre_valide=1 AND offre_signalee=0 AND offre_datePoste<DATE_ADD(NOW(),INTERVAL -1 WEEK) ;\");\n }\n else {$requete=$BDD->prepare(\"SELECT * FROM offre WHERE offre.entreprise_id =? AND offre_valide=1 AND offre_signalee=0 ;\");}\n $requete-> execute(array($entreprise['entreprise_id']));\n $bool=true;\n if ($requete->rowcount()!=0)\n {\n //on stocke les résultats de la requete dans un tableau, une ligne par offre liée a l'entreprise\n $tableauOffre=$requete->fetchAll();\n foreach($tableauOffre as $offre)\n {\n $bool=!$bool;\n AfficherOffre($offre,$bool);\n } \n }\n else print \"<i>Pas d'offre proposée en ce moment.</i>\";\n print '</div>';\n }\n }", "function traiter_lien_implicite ($ref, $texte='', $pour='url', $connect='')\n{\n\t$cible = ($connect ? $connect : (isset($GLOBALS['lien_implicite_cible_public'])?$GLOBALS['lien_implicite_cible_public']:null));\n\tif (!($match = typer_raccourci($ref))) return false;\n\t@list($type,,$id,,$args,,$ancre) = $match;\n# attention dans le cas des sites le lien doit pointer non pas sur\n# la page locale du site, mais directement sur le site lui-meme\n\tif ($f = charger_fonction(\"implicite_$type\",\"liens\",true))\n\t\t$url = $f($texte,$id,$type,$args,$ancre,$connect);\n\tif (!$url)\n\t\t$url = generer_url_entite($id,$type,$args,$ancre,$cible);\n\tif (!$url) return false;\n\tif (is_array($url)) {\n\t\t@list($type,$id) = $url;\n\t\t$url = generer_url_entite($id,$type,$args,$ancre,$cible);\n\t}\n\tif ($pour === 'url') return $url;\n\t$r = traiter_raccourci_titre($id, $type, $connect);\n\tif ($r) $r['class'] = ($type == 'site')?'spip_out':'spip_in';\n\tif ($texte = trim($texte)) $r['titre'] = $texte;\n\tif (!@$r['titre']) $r['titre'] = _T($type) . \" $id\";\n\tif ($pour=='titre') return $r['titre'];\n\t$r['url'] = $url;\n\n\t// dans le cas d'un lien vers un doc, ajouter le type='mime/type'\n\tif ($type == 'document'\n\tAND $mime = sql_getfetsel('mime_type', 'spip_types_documents',\n\t\t\t\"extension IN (SELECT extension FROM spip_documents where id_document =\".intval($id).\")\",\n\t\t\t'','','','',$connect)\n\t)\n\t\t$r['mime'] = $mime;\n\n\treturn $r;\n}", "function cl_reconhecimentocontabil() { \n //classes dos rotulos dos campos\n $this->rotulo = new rotulo(\"reconhecimentocontabil\"); \n $this->pagina_retorno = basename($GLOBALS[\"HTTP_SERVER_VARS\"][\"PHP_SELF\"]);\n }" ]
[ "0.6408087", "0.63547933", "0.6327955", "0.61076504", "0.585736", "0.58299625", "0.5789285", "0.5789124", "0.5747148", "0.56809586", "0.56410384", "0.56113577", "0.55801743", "0.55415815", "0.5501369", "0.5492027", "0.5483786", "0.54769427", "0.547046", "0.54492134", "0.5445172", "0.54445875", "0.5434667", "0.54330236", "0.54086643", "0.54080844", "0.540775", "0.5399458", "0.53916436", "0.5383531", "0.5374204", "0.53667086", "0.5366508", "0.536046", "0.5356874", "0.5353768", "0.5350812", "0.53477126", "0.53440005", "0.5337678", "0.5325852", "0.5325254", "0.53198814", "0.5315738", "0.5315635", "0.5314621", "0.5306616", "0.5297926", "0.52961975", "0.5288754", "0.5287739", "0.5287458", "0.5278965", "0.5270768", "0.5257988", "0.5251724", "0.52481455", "0.5233203", "0.52268153", "0.5225511", "0.5225367", "0.52235925", "0.5221943", "0.5219768", "0.52123165", "0.52118707", "0.5211381", "0.5210483", "0.52103186", "0.5207698", "0.52051926", "0.5202978", "0.51953137", "0.51953137", "0.5193317", "0.5175327", "0.5171273", "0.5170415", "0.51699895", "0.51684594", "0.5165356", "0.51649356", "0.5164123", "0.5163555", "0.5161389", "0.5161117", "0.51589173", "0.5157159", "0.5156975", "0.5156045", "0.5151366", "0.5151261", "0.51502526", "0.514068", "0.51399016", "0.5138504", "0.5136102", "0.5131771", "0.5130327", "0.5128226", "0.51266056" ]
0.0
-1
! Desc : Logout, destroy sessions !
public function logOut(){ // Starting sessions session_start(); // Emptying sessions $_SESSION['userID'] = ''; $_SESSION['logged_in'] = false; // Destroying sessions session_destroy(); header("Location: ?controller=home"); exit(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function logOut()\n {\n self::startSession();\n session_destroy();\n }", "public function logOut(){\n $_SESSION=[];\n session_destroy();\n }", "public function logOut () : void {\n $this->destroySession();\n }", "public function logoutxxx()\n {\n $this->getSession()->destroy();\n }", "public function Logout() \n {\n session_unset();\n session_destroy();\n }", "public static function Logout()\n {\n Session::CloseSession();\n }", "public function LogOut()\n {\n session_destroy();\n }", "public function logout(){\n\t\t$_SESSION['ip'] = '';\n\t\t$_SESSION['username'] = '';\n\t\t$_SESSION['uid'] = '';\n\t\tsession_destroy();\n\t}", "public function logout() { \n \n session_destroy(); \n }", "static function logout()\n {\n session_destroy();\n }", "public function logOut() {\n\t$this->isauthenticated = false;\n\tunset($_SESSION['clpauthid'], $_SESSION['clpareaname'], $_SESSION['clpauthcontainer']);\n\tsession_regenerate_id();\n}", "function log_me_out() {\n\n// remove all session variables\n\n session_unset();\n\n// destroy the Session\n session_destroy();\n}", "public function logout(){\n session_unset();\n session_destroy();\n }", "function user_logout() {\n session_destroy();\n}", "private static function logout() {\r\n\t\t$base = $_SESSION['base'];\r\n\t\t$dbName = $_SESSION['dbName'];\r\n\t\t$configFile = $_SESSION['configFile'];\r\n\t\tsession_destroy();\r\n\t\tsession_regenerate_id(true);\r\n\r\n\t\t// start new session\r\n\t\tsession_start();\r\n\t\t$_SESSION['base'] = $base;\r\n\t\t$_SESSION['dbName'] = $dbName;\r\n\t\t$_SESSION['configFile'] = $configFile;\r\n\t\t$_SESSION['styles'] = array();\r\n\t\t$_SESSION['scripts'] = array();\r\n\t\t$_SESSION['libraries'] = array();\r\n\t\tself::redirect('home', 'success', 'You have been successfully logged out');\r\n\t}", "public function logout()\r\n {\r\n session_unset();\r\n session_destroy(); \r\n }", "public function Logout()\r\n {\r\n\r\n\t\t//destroys the session\r\n\t\t$this->id = NULL;\r\n\t\t$this->email = NULL;\r\n\t\t$this->name = NULL;\r\n\r\n session_unset();\r\n session_destroy();\r\n\r\n\t\t//head to index page\r\n header(\"Location: /index.php\");\r\n\r\n }", "function Signout() {\n session_destroy();\n}", "public function logoff(){\n\t ServiceSession::destroy();\n\t Redirect::to(\"/login\")->do();\n\t }", "public function destroySession() {}", "public function logout(){\n if(isset($_SESSION[\"identity\"])){\n \n unset($_SESSION[\"identity\"]);\n }\n\n if(isset($_SESSION[\"admin\"])){\n \n unset($_SESSION[\"admin\"]);\n }\n\n /* redireccionar, cuando me elimine la sesion del logueo */\n header(\"Location:\".base_url);\n }", "public function logout()\n {\n\t // unsets all cookies and session data\n process_logout(); \n }", "public function logout() {\r\n session_unset();\r\n session_destroy();\r\n header('location: ' . DB::MAIN_URL);\r\n }", "public function logout(){\r\n session_start();\r\n unset($_SESSION['id']);\r\n unset($_SESSION['username']);\r\n unset($_SESSION['email']);\r\n unset($_SESSION['coin']);\r\n unset($_SESSION['success']);\r\n $_SESSION = array();\r\n session_destroy();\r\n header('Location: /user/login');\r\n exit();\r\n }", "public function Logout()\r\n {\r\n session_unset();\r\n \r\n //Set l'ID de la session a null\r\n $_SESSION['uid'] = null;\r\n \r\n //Echo la vue de connexion\r\n echo view('login');\r\n }", "public static function destroySession();", "public function logout()\n {\n $this->deleteSession();\n }", "function logout(){\n session_start();\n session_destroy();\n header(\"Location: \" .LOGIN);\n }", "public function logout(){\n $session = new Zend_Session_Namespace('Auth');\n unset($session->User);\n Zend_Session::namespaceUnset('Auth');\n\n App_Cookie::unsetCookie (\"ulogin\");\n App_Cookie::unsetCookie (\"uloginhash\");\n }", "public function logout() {\n @session_start();\n session_destroy();\n }", "function log_User_Out(){\n\t\tif (isset($_SESSION['status'])){\n\t\t\tunset($_SESSION['status']);\n\t\t\tunset($_SESSION['username']);\n\t\t\tunset($_SESSION['role']);\n\t\t\tunset($_COOKIE['startdate']);\n\t\t\tunset($_COOKIE['enddate']);\n\n\t\t\tif (isset($_COOKIE[session_name()])) setcookie(session_name(), '', time() - 1000);\n\t\t\tsession_destroy();\n\t\t}\n\t}", "public function userLogout() {\n // Starting a session to unset and destroy it\n session_start();\n session_unset();\n session_destroy();\n\n // Sending the user back to the login page\n header(\"Location: login\");\n }", "static function logout() {\n unset($_SESSION['id']);\n unset($_SESSION['login']);\n unset($_SESSION['password']);\n }", "function log_out() {\n\t// session_destroy ();\n\t\n\tupdate_option('access_token', '');\n\tupdate_option('insta_username', '');\n\tupdate_option('insta_user_id', '');\n\tupdate_option('insta_profile_picture', '');\n\n}", "public function logout()\n {\n session_unset();\n // deletes session file\n session_destroy();\n }", "Public Function Logout()\n\t{\n\t\tunset($_SESSION['User']);\n\t}", "public static function logout();", "public function logout();", "public function logout();", "public function logout();", "public function logout();", "public function logout();", "public function logout();", "public function logout();", "public function logout();", "public function logout();", "public function logout();", "public function logout() {\n session_destroy();\n $this->redirect('?v=index&a=show');\n }", "public function logout(){\n session_destroy();\n $arr = array(\n 'sessionID' => ''\n );\n dibi::query('UPDATE `user` SET ', $arr, \n 'WHERE `email`=%s', $email);\n parent::redirection(\"index.php\");\n }", "public function logout() {\n unset($_SESSION['ccUser']);\n session_destroy();\n }", "public function logoff()\n\t{\n\t\t$this->session->sess_destroy();\n\t\tredirect(base_url());\n\t}", "private function logout() {\n }", "public static function logout()\n\t{\n\t\t$_SESSION['loggedin'] = false;\n\t\t$_SESSION['showchallenge'] = null;\n\t\t$_SESSION['adminlastchosen'] = null;\n\t\t$_SESSION['login'] = '';\n\t\t$_SESSION['user_id'] = '';\n\t\t$_SESSION['email'] = '';\n\t\tsetcookie('logged_in', '');\n\t\tsetcookie('username', '');\n\t}", "public function logout() {\n unset($_SESSION['user_id']);\n unset($_SESSION['user_email']);\n unset($_SESSION['user_name']);\n session_destroy();\n redirect('');\n }", "private function Logout(){\r\n$_SESSION = array();\r\n\r\n// If it's desired to kill the session, also delete the session cookie.\r\n// Note: This will destroy the session, and not just the session data!\r\nif (ini_get(\"session.use_cookies\")) {\r\n $params = session_get_cookie_params();\r\n setcookie(session_name(), '', time() - 42000,\r\n $params[\"path\"], $params[\"domain\"],\r\n $params[\"secure\"], $params[\"httponly\"]\r\n );\r\n}\r\n\r\n// Finally, destroy the session.\r\nsession_destroy();\r\n// And back to Login start page.\r\nheader(\"location:index.php\");\r\n }", "public function logout ()\n {\n unset ( $_SESSION['user_id'] );\n unset ( $_SESSION['email'] );\n unset ( $_SESSION['order_count'] );\n unset ( $_SESSION['like_count'] );\n //session_destroy () ;\n header( 'Location:' . \\f\\ifm::app()->siteUrl . 'login' );\n }", "function logout()\n{\n $_SESSION = SESSION_destroy();\n home();\n}", "private static function logout() {\n\t\t$key = Request::getCookie('session');\n\t\t$session = Session::getByKey($key);\n\t\tif ($session)\n\t\t\t$session->delete();\n\t\tOutput::deleteCookie('session');\n\t\tEnvironment::getCurrent()->notifySessionChanged(null);\n\t\tself::$loggedOut->call();\n\t}", "public static function destroy(){\r\n\t\t\t\tsession_destroy();\r\n\t\t\t\tsession_unset();\r\n\t\t\t\theader(\"location: login.php\");\r\n\t\t\t}", "public function logOut(){\n\t\t\tsetcookie(\"usertoken\", $_SESSION['usertoken'], 1, \" \", '', false, false);\t\n\t\t \tsetcookie(\"sesstoken\", $_SESSION['sesstoken'], 1, \" \", '', false, false); \n\t\t \t\n\t\t \tsession_destroy();\n\t\t \theader(\"Refresh:0; url=index.php\"); \n\n\t }", "public function logoff(){\n\t\tsession_destroy();\n\t\theader('location: ../view/login.php');\n\t\texit;\n\t}", "function log_out_user() {\r\n if(isset($_SESSION['admin_id'])) {\r\n unset($_SESSION['admin_id']);\r\n }\r\n if(isset($_SESSION['user_id'])){\r\n unset($_SESSION['user_id']);\r\n }\r\n unset($_SESSION['last_login']);\r\n unset($_SESSION['username']);\r\n //session_destroy(); // optional: destroys the whole session\r\n return true;\r\n}", "public function logout()\n\t{\n\t\tif (isset($_SESSION[$this->sess_auth])) {\t\n\t\t\tSessionManager::instance()->trashLoginCreadentials();\n\t\t}\n\t}", "function log_member_out()\r\n\t{\r\n\t\tsession_destroy();\r\n\t}", "public function connexionAdminAssoLogin(){\n session_destroy();\n }", "function logmemberout()\n\t\t\t{\n\t\t\tif(isset($_SESSION['status'])){\n\t\t\t\t\t\t\t\t\t\t\tunset($_SESSION['status']);\n\n\t\t\t \t\t\t }\n\t\t\tif(isset($_COOKIE[session_name()]))\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tsetcookie(session_name(),'',time() - 1000);\t\t\t\t\t\t\tsession_destroy();\t\t\t\t\t\t\t\t\t\t\t}\t\t\t\t\t\t\t\t\t\t\t\t\t}", "public function logout()\n\t{\n\t\t$unset_array = array('set_id', 'access_pass', 'username');\n\t\t$this->session->unset_userdata($unset_array);\n\t}", "function user_logout() {\n\tsession_unset();\n\tsession_destroy();\n}", "public function logout(){\n session_unset($_SESSION[\"user\"]);\n }", "public function logout() {\n\t\t//Bridge Logout\n\t\tif ($this->config->get('cmsbridge_active') == 1 && !$this->lite_mode){\n\t\t\t$this->bridge->logout();\n\t\t}\n\n\t\t//Loginmethod logout\n\t\t$arrAuthObjects = $this->get_login_objects();\n\t\tforeach($arrAuthObjects as $strMethods => $objMethod){\n\t\t\tif (method_exists($objMethod, 'logout')){\n\t\t\t\t$objMethod->logout();\n\t\t\t}\n\t\t}\n\n\t\t//Destroy this session\n\t\t$this->destroy();\n\t}", "public function log_member_out(){\n\t\tif(isset($_SESSION['status'])) {\n\t\t\t$_SESSION = array();\n\t\t\t$params = session_get_cookie_params();\n\t\t\t//Delete the actual cookie.\n\t\t\tsetcookie(session_name(), '', time() - 42000, $params[\"path\"], $params[\"domain\"], $params[\"secure\"], $params[\"httponly\"]);\n\t\t\t//Destroy session\n\t\t\tsession_destroy();\n\t\t}\n\t}", "public function Logout() \n {\n unset($_SESSION['user']);\n }", "public function logOut(){\n $this->authToken=\"\";\n $this->loggedUser=\"\";\n $this->clearAuthCookie();\n }", "public function logout(){\n session_destroy();\n unset($_SESSION);\n }", "function logout(){\n // destroy session\n session_destroy();\n\n // send to main page\n header('Location: http://itconnect.greenrivertech.net/adminLogin');\n exit;\n}", "public function logout(){\n session_destroy();\n unset($_SESSION['user_session']);\n }", "public static function logOut()\r\n {\r\n (new Session())->remove(static::$userIdField);\r\n }", "public static function logout(){\n \n //Tornando se sessão User nulla\n $_SESSION[User::SESSION] = null;\n \n }", "public function logout() {\t\n\t\t$this->Session->destroy();\n\t\t$this->delete_cookie('KEYADMUSER');\n\t\t$this->disable_cache();\t\t\n\t\t$this->Session->setFlash('<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>You have successfully signed off', 'default', array('class' => 'alert alert-success'));\n\t\t$this->redirect('/admin/login/');\n\n\t}", "public function Action_Logout()\n {\n Zero_App::$Users->IsOnline = 'no';\n Zero_App::$Users->Save();\n Zero_Session::Unset_Instance();\n session_unset();\n session_destroy();\n Zero_Response::Redirect(ZERO_HTTP);\n }", "public function Logout() {\n\t\tsession_unset();\n\t\tsession_destroy();\n\t\theader('location: ?a=login');\n\t}", "public function Logout() {\n\n\t\t$this->CI->session->unset_userdata(array('username', 'password'));\n\n\t}", "public function logOff ()\r\n {\r\n unset($_SESSION['username']);\r\n unset($_SESSION['parola']);\r\n $_SESSION = array();\r\n session_destroy();\r\n }", "function logout()\n\t{\n\n\t\t// log the user out\n\t\t$this->session->sess_destroy();\n\n\t\t// redirect them to the login page\n\t\tredirect('auth', 'refresh');\n\t}", "public function logout() {\r\n\t\tSession::delete($this->_sessionName);\r\n\t}", "public function Logout()\n\t{\n // autologin for the same user. For demonstration purposes,\n // we don't do that here so that the autologin function remains\n // easy to test.\n //$ulogin->SetAutologin($_SESSION['username'], false);\n\t\tunset($_SESSION['uid']);\n\t\tunset($_SESSION['username']);\n\t\tunset($_SESSION['loggedIn']);\n\t\t$this->load->view('layout/login.php');\n\t}", "function logout() {\n\t\t$this->session->sess_destroy();\n\t\tredirect('c_login/login_form','refresh');\n\t}", "public function logout(){\n\t\t\t// remove all session variables\n\t\t\tsession_unset();\n\t\t\t// destroy the session\n\t\t\tsession_destroy(); \n\t\t}", "abstract public function logout();", "static function logout() {\n self::forget(self::currentUser());\n unset($_SESSION['userId']);\n session_destroy();\n }", "public function userLogout() {\n session_destroy();\n header('Location: index.php');\n }", "public static function logout(){\n\t// clear $_SESSION array\n session_unset();\n\n // delete session data on the server\n session_destroy();\n\n // ensure client is sent a new session cookie\n session_regenerate_id();\n\n // start a new session - session_destroy() ended our previous session so\n // if we want to store any new data in $_SESSION we must start a new one\n session_start();\n\n header(\"Location: login.php\");\n die();\n\t}", "public function logOut() {\r\n //Logs when a user exit\r\n $ctrLog = new ControllerLog();\r\n $ctrLog->logOff();\r\n\r\n header('location:../index');\r\n session_destroy();\r\n }", "public function logout (){\n\t\t$this->load->library('facebook');\n // Logs off session from website\n $this->facebook->destroySession();\n\t\t$this->session->sess_destroy();\n\t\t}", "function logout() {\n $this -> session -> sess_destroy();\n redirect('home', 'location');\n }", "function logout() {\n User::destroyLoginSession();\n header( \"Location: \" . APP_URL );\n}", "function logOut(){ \n $_SESSION = array(); \n if (isset($_COOKIE[session_name()])) { \n setcookie(session_name(), '', time()-42000, '/'); \n } \n session_destroy(); \n}", "public function logout() \n {\n unset($_SESSION['is_logged_in']);\n unset($_SESSION['user_id']);\n unset($_SESSION['time_logged_in']);\n\n session_destroy();\n }", "function signout() {\n\n\tunset( $_SESSION['username'] );\n\tunset( $_SESSION['id'] );\n\n\tif ( isset( $_COOKIE['rememberUserCookie'] ) ) {\n\t\tunset($_COOKIE['rememberUserCookie']);\n\t\tsetcookie('rememberUserCookie', null, -1, '/' );\n\t}\n\n\tsession_destroy();\n\tsession_regenerate_id( true );\n\tredirectTo( 'index' );\n\n}", "public function logout(){\n\t\t$this->session->sess_destroy();\n\t\tredirect('superpanel/main/login');\n\t}" ]
[ "0.8461088", "0.8432945", "0.8294516", "0.8278152", "0.8255903", "0.8214023", "0.8193799", "0.8167511", "0.8162846", "0.81415933", "0.8119535", "0.810422", "0.8101961", "0.8059031", "0.8033537", "0.8021982", "0.80158484", "0.8007926", "0.800115", "0.7993659", "0.7991455", "0.79885626", "0.79816216", "0.79796153", "0.79703945", "0.7965124", "0.7955382", "0.79258406", "0.7919688", "0.7915958", "0.7900757", "0.78850853", "0.78805876", "0.78752214", "0.7875161", "0.7863952", "0.7857451", "0.78509736", "0.78509736", "0.78509736", "0.78509736", "0.78509736", "0.78509736", "0.78509736", "0.78509736", "0.78509736", "0.78509736", "0.78441525", "0.78410345", "0.7830143", "0.7827662", "0.78254783", "0.7823803", "0.78202605", "0.7819725", "0.78178644", "0.7813567", "0.7811525", "0.78098977", "0.7808184", "0.78007597", "0.779962", "0.7798421", "0.7793672", "0.77906865", "0.7780549", "0.7779771", "0.7778638", "0.77776873", "0.77748793", "0.7771179", "0.7768001", "0.7762685", "0.7760641", "0.77602553", "0.77592736", "0.77588964", "0.7752348", "0.77508193", "0.77478546", "0.7747332", "0.77457917", "0.7744853", "0.77430165", "0.77395356", "0.7736763", "0.7735719", "0.77312887", "0.7722848", "0.77184486", "0.77139294", "0.7711598", "0.7708491", "0.770649", "0.77020645", "0.7698208", "0.7695824", "0.76902044", "0.76873803", "0.76864934" ]
0.8087645
13
! Checks if password match !
public function matchPassword($userPassword, $saltAndHash) { $hashValues = preg_split('/\./', $saltAndHash); $salt = $hashValues[0]; $hash = $hashValues[1]; $salt2 = $hashValues[2]; if((hash("sha512", md5($salt.$userPassword.$salt2))) == $hash){ return true; } else{ return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pwdMatch($password, $passwordRepeat){\n $result = true;\n if ($password !== $passwordRepeat){\n $result = true;\n }\n else{\n $result = false;\n }\n return $result;\n}", "function testPasswordsAreEqual($password, $password_one) {\n if (empty($password_one)) {\n $passwordErr = 'Password required';\n } elseif (strlen($password) > 0 && strlen($password_one) > 0 && $password == $password_one) {\n //QUERY FOR DATABASE CONNECTION HERE\n if (!filter_var($password, FILTER_VALIDATE_REGEXP, array(\"options\" => array(\"regexp\" => \"((?=.*\\d)(?=.*[a-z])(?=.*[A-Z]).{4,10})\")))) {\n //da 4 a 10 caratteri, deve contenere maiuscole, minuscole e numeri\n $passwordErr = \"Invalid Password format\";\n } else\n $passwordErr = \"*\";\n }else {\n $passwordErr = 'Passwords do not match!';\n }\n return $passwordErr;\n }", "function checkIfPasswordsMatch($password1, $password2) {\r\n return $password1 == $password2;\r\n}", "function pwdMatch($password, $pwdRepeat) {\n $result=true;\n if($password !== $pwdRepeat){\n $result =false;\n } else {\n $result = true;\n }\n return $result;\n}", "public function checkPassword($value);", "public function comparePassword() {\r\n if ($this->data[$this->name]['Password'] !== $this->data[$this->name]['RetypePass']) {\r\n return FALSE;\r\n } else {\r\n return TRUE;\r\n }\r\n }", "function checkPassword(): bool\n {\n $user = FPersistantManager::getInstance()->search(\"utente\", \"UserName\", $this->getUsername());\n if($this->getPassword() == $user[0]->getPassword())\n return true;\n else\n return false;\n }", "public function isPassword($password);", "function passwordMatch($id, $password) {\n \n $userdata = $this->getUserDataByUserId($id);\n \n // use pass word verify to decrypt the pass stored in the database and compare it eith the one user provided\n if(password_verify($password,$userdata['pwd'])) {\n return true;\n } else {\n return false;\n }\n \n \n }", "function passwordMatch($wachtwoord, $wachtwoordbevestiging) {\n\tif ($wachtwoord !== $wachtwoordbevestiging) {\n\t\t$result = true;\n\t} else {\n\t\t$result = false;\n\t}\n\treturn $result;\n}", "function is_password_valid ($password, $user_data) {\n // the one in the user records.\n $is_valid = $password == $user_data['password'];\n return $is_valid;\n}", "public function password_verifies() {\n\t\treturn AuthComponent::password($this->data[$this->alias]['old_password']) === $this->data[$this->alias]['password'];\n\t}", "public function passwordsMatch($pw1, $pw2) {\n if ($pw1 === $pw2)\n return true; \n else \n return false; \n }", "function passwordValid($password) {\n\treturn true;\n}", "public function passwordEqual() {\n if($this->getPassword() == $this->getPasswordRepeat()) return TRUE;\n else return FALSE;\n }", "public function verifyPassword (string $hash, string $password): bool;", "function check_password($password)\n{\n return ($password == 'qwerty');\n}", "public function check_password($password)\n {\n }", "public function hasPassword() : bool;", "public function testCheckPassword()\n {\n $hasher = new PasswordHash(8, true);\n\n $testHash = '$P$BbD1flG/hKEkXd/LLBY.dp3xuD02MQ/';\n $testCorrectPassword = 'test123456!@#';\n $testIncorrectPassword = 'test123456!#$';\n\n $this->assertTrue($hasher->CheckPassword($testCorrectPassword, $testHash));\n $this->assertFalse($hasher->CheckPassword($testIncorrectPassword, $testHash));\n }", "function _isMatch()\n {\n if (isset($_POST['login'])) {\n if ($this->name_post == $this->name_db && password_verify($this->pass_post, $this->pass_db)) {\n return true;\n }\n $this->mismatch = true;\n }\n return false;\n }", "private function valid_password() {\n return (strlen($this->password) == 6);\n }", "public function checkPass()\n {\n $pass = sha1($_POST['pass']);\n $pass2 = sha1($_POST['confirmation_pass']);\n if (!empty($_POST['pass']) &&\n !empty($_POST['confirmation_pass'])) {\n if ($pass == $pass2) {\n return true;\n } else {\n return $message = 'Vos mots de passes ne correspondent pas';\n }\n } else {\n return $message = 'Tous les champs ne sont pas complétés';\n }\n }", "function valid_password($password1,$password2)\n{\n\t// if the comparison of the 2 strings (the passwords)\n\t// results in 0 difference\n\tif(strcmp($password1,$password2)==0)\n\t{\n\t\t// if the password has a length of at least 6 characters\n\t\tif(strlen($password1)>=6)\n\t\t{\n\t\t\t// then return true\n\t\t\treturn true;\n\t\t}\n\t\t// if length lower than 6\n\t\telse\n\t\t{\n\t\t\t// return false\n\t\t\treturn false;\n\t\t}\n\t}\n\t// if 2 passwords are different\n\telse\n\t{\n\t\t// return false\n\t\treturn false;\n\t}\n}", "public function verify($password): bool;", "function checkPassword($password) {\n\t\treturn ($this->_password === $password);\n\t}", "function validate($firstpw, $secondpw) {\n\tif(strcmp($firstpw, $secondpw) == 0) {\n\t\t// Booleans to check password complexity - if true, then firstpw is ok\n\t\t$uppercase = preg_match('@[A-Z]@', $firstpw);\n\t\t$lowercase = preg_match('@[a-z]@', $firstpw);\n\t\t$number = preg_match('@[0-9]@', $firstpw);\n\t\tif($uppercase && $lowercase && $number && strlen($firstpw) > 8) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}", "public function isValidPassword($uid, $password);", "function password_check($old_password)\n\t\t{\n\t\t\tif ($this->ion_auth->hash_password_db($this->data['user']->id, $old_password))\n\t\t\t{\n\t\t\t\treturn TRUE;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->form_validation->set_message('password_check', 'Sorry, the password did not match');\n\t\t\t\treturn FALSE;\n\t\t\t}\n\t\t}", "function validatePasswords($password1, $password2){\n if($password1 == $password2){\n return true;\n }\n else{\n return false;\n }\n }", "function match_current_passwd($puuid, $given) {\n $sql = \"SELECT passwordtype, password FROM passwords WHERE puuid=$1\";\n $res = pg_query_params($sql, array($puuid));\n\n while($tuple = pg_fetch_assoc($res)) { \n if(hpcman_hash($tuple['passwordtype'], $given) == $tuple['password'])\n return true;\n }\n \n return false;\n}", "public function passwordsMatch($pw1, $pw2) {\n\t\tif ($pw1 == $pw2) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}", "function confirmPassword($password, $confirmPassword){\n return $password == $confirmPassword;\n }", "public function verify($password, $securePass);", "public function checkPassword($password){\n\n/*\n* verify the password\n* if correct ,return true else return false\n* verify the password\n*/\n\n if (password_verify($password,$this->getHashedPassword())){\n return true;\n }else{\n return false;\n }\n\n }", "function isValidPassword2($password)\n{\n return checkLength($password) && specialChar($password) && containsUpperAndLower($password);\n}", "public function password_check($str){\n \n if($this->user_model->exist_row_check('username', $this->username_temp) > 0){\n $user_detail = $this->user_model->getUserDetailByUsername($this->username_temp);\n if($user_detail->password == crypt($str,$user_detail->password)){\n return TRUE;\n }\n else{\n $this->form_validation->set_message('password_check','Password yang dimasukkan tidak sesuai');\n return FALSE;\n }\n }else{\n $this->form_validation->set_message('password_check','Username yang dimasukkan tidak sesuai');\n return FALSE;\n }\n \n }", "function checkPassword($pwd, $pwd2, $X_langArray) {\n\tglobal $errorField;\n\n\t//le due password devono coincidere\n\tif ($pwd != $pwd2){\n\t\t$errorField .= \"&pwd2ErrMsg=\".urlencode($X_langArray['SETTING_PWD_REPET_ERROR']);\n\t}\n\telse{\n\t\t//password vuota\n\t\tif (!isset($pwd2) || $pwd2 == ''){\n\t\t\t$errorField .= \"&pwd2ErrMsg=\".urlencode($X_langArray['RECOVER_PWD_EMPTY_PWD_ERR']);\n\t\t}\n\t\telse{\n\t\t\t//la password deve contenere almeno una maiuscola, una minuscola ed un nuemro tra 7 e 21 caratteri)\n\t\t\tif (!preg_match('/(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])/', $pwd2) ) {\n\t\t\t\t$errorField .= \"&pwd2ErrMsg=\".urlencode($X_langArray['GEN_IS_NOT_PWD_REG']);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tif (strlen($pwd2) < 6 || strlen($pwd2) > 20 ) {\n\t\t\t\t\t$errorField .= \"&pwd2ErrMsg=\".urlencode($X_langArray['OVERLAY_LOG_SIGN_PWD_LENGTH_ERR']);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "function verify_password($username,$password) {\r\n\r\n\t/* MODIFY THIS FOR YOUR INSTITUTION! */\r\n\tif ($username == 'dssadmin' && password == 'dssadmin') return 1;\r\n\telse return 0;\r\n\r\n}", "function check_password($password)\n{\n if (strlen($password) < 8) {\n throw new Exception(\"password_short.\", 1);\n return false;\n }\n if (!preg_match(\"/[0-9]{1,}/\", $password) || !preg_match(\"/[A-Z]{1,}/\", $password)) {\n throw new Exception(\"password_bad\", 1);\n return false;\n }\n return true;\n}", "function checkPassword($clientPassword){\r\n $pattern = '/^(?=.*[[:digit:]])(?=.*[[:punct:]])(?=.*[A-Z])(?=.*[a-z])([^\\s]){8,}$/';\r\n return preg_match($pattern, $clientPassword);\r\n }", "public function check_password(){\n\t\t$query = $this->check_username();\n\t\tif($query > 0){\n\t\t\tif(isset($_POST[\"submit\"])){\n\t\t\t\t$user = $_POST[\"uname\"];\n\t\t\t\t$pass = sha1($_POST[\"pword\"]);\n\n\t\t\t\t$query1 = $this->db->query(\"SELECT * \n\t\t\t\t\t\t\t\t\t\t\tFROM administrator \n\t\t\t\t\t\t\t\t\t\t\tWHERE username LIKE '${user}' and password LIKE '${pass}'\");\n\t\t\t\tif($query1->num_rows() > 0){\n\t\t\t\t\treturn $query1->num_rows();\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\techo \"Invalid username/password combination.<br/>\";\n\t\t\t\t\techo \"<a href='login'>Back</a><br/>\";\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\techo \"Username does not exist<br/>\";\n\t\t\techo \"<a href='login'>Back</a><br/>\";\n\t\t}\n\t}", "function confirmPassword() {\n\t\t$fields = $this->_settings['fields'];\n\t\tif (\n\t\t\tSecurity::hash($this->model->data[$this->model->name][$fields['confirm_password']], null, true) \n\t\t\t== $this->model->data[$this->model->name][$fields['password']]\n\t\t) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}", "public function valida_password($password){\n\t\tif (preg_match(\"/^.*(?=.{8,})(?=.*\\d)(?=.*[a-z])(?=.*[A-Z]).*$/\", $password)) \n\t\t\techo \"Su password es seguro.\"; \n\t\telse echo \"Su password no es seguro.\";\n\n\t}", "function validPassword($password){\t\r\n \tglobal $API;\r\n return $API->userValidatePassword($this->username,$password); \r\n }", "function validate_pw($password, $hash){\n /* Regenerating the with an available hash as the options parameter should\n * produce the same hash if the same password is passed.\n */\n return crypt($password, $hash)==$hash;\n }", "public function hash_check($user,$pass){\r\n //check if password matches hash \r\n $hash=array();\r\n $hash= checkLoginInfoTest($user);\r\n foreach ($hash as $hashItem):\r\n $hashGiven=(string)$hashItem['password'];\r\n endforeach;\r\n if (isset($hashGiven)){\r\n if (password_verify($pass,(string)$hashGiven))\r\n { \r\n return true;\r\n } \r\n else\r\n {\r\n return false;\r\n }\r\n }\r\n \r\n \r\n}", "function isValidPass($p) {\r\n global $passes;\r\n $i = 0;\r\n foreach ($passes as $password) {\r\n if($passes[$i]==$p) {\r\n return true;\r\n }\r\n $i++;\r\n }\r\n }", "function isPassCorrect($psw, $psw_repeat){\r\n\t$regex = '/(?:[^`!@#$%^&*\\-_=+\\'\\/.,]*[`!@#$%^&*\\-_=+\\'\\/.,]){2}/';\r\n\tif (strlen($psw) >= 2 && strlen($psw_repeat) <= 255 && $psw == $psw_repeat) {\r\n\t\tif (preg_match($regex, $psw)) {\r\n\t\t\treturn 1;\r\n\t\t}\r\n\t}\r\n\treturn 0;\r\n}", "function verify_password($memberID, $current_password, $db) {\n \n $command = \"SELECT * FROM member_login WHERE memberID = '\".$db->real_escape_string($memberID).\"' \". \n \"AND password = password('\".$db->real_escape_string($current_password).\"');\";\n $result = $db->query($command);\n \n if ($data = $result->fetch_object()) {\n return true;\n\n }\n else {\n return false;\n }\n}", "function checkPassword($password,$salt,$hash){\n\t\n\t$haschedpw = hash('sha256',$salt.$password);\n\t\n\tif (trim($haschedpw) == trim($hash)){\n\t\treturn true;\n\t}\n\treturn false;\n}", "function checkPassword($password, $username = false) {\n $length = strlen($password);\n\n if ($length < 8) {\n return FALSE;\n } elseif ($length > 32) {\n return FALSE;\n } else {\n\n//check for a couple of bad passwords:\n if ($username && strtolower($password) == strtolower($username)) {\n return FALSE;\n } elseif (strtolower($password) == 'password') {\n return FALSE;\n } else {\n\n preg_match_all(\"/(.)\\1{2}/\", $password, $matches);\n $consecutives = count($matches[0]);\n\n preg_match_all(\"/\\d/i\", $password, $matches);\n $numbers = count($matches[0]);\n\n preg_match_all(\"/[A-Z]/\", $password, $matches);\n $uppers = count($matches[0]);\n\n preg_match_all(\"/[^A-z0-9]/\", $password, $matches);\n $others = count($matches[0]);\n\n//see if there are 3 consecutive chars (or more) and fail!\n if ($consecutives > 0) {\n return FALSE;\n } elseif ($others > 1 || ($uppers > 1 && $numbers > 1)) {\n//bulletproof\n return TRUE;\n } elseif (($uppers > 0 && $numbers > 0) || $length > 14) {\n//very strong\n return TRUE;\n } else if ($uppers > 0 || $numbers > 2 || $length > 9) {\n//strong\n return TRUE;\n } else if ($numbers > 1) {\n//fair\n return FALSE;\n } else {\n//weak\n return FALSE;\n }\n }\n }\n return $returns;\n}", "public function validatePassword($password)\n {\n return $this->hashPassword($password)===$this->password;\n }", "function check_passwords($username, $password1, $password2)\n{\n\treturn $password1 = $password2 = Raven::_pwd($username); // This is how Raven does passwords\n}", "function validatePassword() : bool\n {\n if($this->Password && preg_match('/^[[:alnum:]]{6,20}$/', $this->Password)) // solo numeri-lettere da 6 a 20\n {\n return true;\n }\n else\n return false;\n }", "function PasswordsNotMach(){\n echo \"<h3 class='text-danger'>Your passwords do not match</h3>\";\n }", "static function checkPassword($password, $answer){\n require INCLUDE_DIR.'password.inc.php';\n return password_verify($password, $answer);\n }", "function verifyPassword($password)\n {\n $this->getById();\n $date = $this->created_date;\n $date = strtotime($date);\n $year = date('Y', $date);\n $salt = 'ISM';\n $tempHash = $password . (string) $date . (string) $salt;\n for ($i = 0; $i < $year; $i++) $tempHash = md5($tempHash);\n return $tempHash === $this->password;\n }", "function password($pass)\n\t{\n\t\tif (strcmp($pass, AUCTION_PASSWORD))\n\t\t\texit(\"Wrong password\");\n\t}", "function isPassOk($pass){\n\treturn true;\n}", "function validarPasswordRepetido($password){\r\n\t\t\r\n\t\treturn $this->clave != md5($password);\r\n\t}", "public function validatePassword($password) {\r\n return $this->password===$password;\r\n\r\n }", "function validateUserPass($username, $password) {\n\n return ($username == 'username' && $password == 'password');\n\n }", "function CheckPasswordMatch($iPassword, $iPassConfirm)\n {\n return $iPassword == $iPassConfirm;\n }", "function validatePassword($pwd) {\r\n\t\treturn (strlen($pwd) >= 6 && preg_match_all(\"/[0-9]/\", $pwd) >= 2);\r\n\t}", "function checkPassword($clientPassword)\n{\n $pattern = '/^(?=.*[[:digit:]])(?=.*[[:punct:]])(?=.*[A-Z])(?=.*[a-z])([^\\s]){8,}$/';\n return preg_match($pattern, $clientPassword);\n}", "private function validate_password($password){\n\t\treturn TRUE;\n\t}", "function m_verifyEditPass()\n\t{\n\t\t$this->errMsg=MSG_HEAD.\"<br>\";\n\t\tif(empty($this->request['password']))\n\t\t{\n\t\t\t$this->err=1;\n\t\t\t$this->errMsg.=MSG_PASS_EMPTY.\"<br>\";\n\t\t}\n\t\tif(empty($this->request['verify_pw']))\n\t\t{\n\t\t\t$this->err=1;\n\t\t\t$this->errMsg.=MSG_VERIFYPASS_EMPTY.\"<br>\";\n\t\t}\n\t\tif($this->request['password']!=$this->request['verify_pw'])\n\t\t{\n\t\t\t$this->err=1;\n\t\t\t$this->errMsg.=MSG_PASS_NOTMATCHED.\"<br>\";\n\t\t}\n\t\treturn $this->err;\n\t}", "public static function checkLoginPassword($login, $password);", "function isEnteredCorrectPassword($email, $password, $db) {\r\n\t$customerResult = $db->findCustomer($email);\r\n\tif ($customerResult->getRowCount() < 1) {\r\n\t\tdie (\"Couldn't find customer when checking password.\");\r\n\t} else if ($customerResult->getRowCount() > 1) {\r\n\t\tdie(\"More than one customer when checking password\");\r\n\t} else {\r\n\t\t$customer = $customerResult->getFirstRow();\r\n\t\t$correctPassword=$customer['password'];\r\n\t\tif ($correctPassword === $password) {\r\n\t\t\t$factory = new CustomerFactory($db);\r\n\t\t\t$customerObject = $factory->getCustomer($email);\r\n\t\t\t$_SESSION['customer'] = $customerObject;\r\n\t\t\treturn true;\r\n\t\t} else {\r\n\t\t\tdie(\"Wrong password entered!\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}\r\n}", "public function check_password($password)\n {\n return FALSE;\n }", "private function checkPassword($posts){\n if($posts['plainPassword'] !== $posts['confirm']){\n $this->addFlash('danger', 'les mots de passes saisis ne correspondent pas');\n return false;\n }\n\n if(strlen($posts['plainPassword']) < 4){\n $this->addFlash('danger', 'Le mot de passe doit contenir au moins 4 caracteres');\n return false;\n }\n\n /* on verifie que le mot de passe est correct */\n// $uppercase = preg_match('@[A-Z]@', $posts['plainPassword']);\n// $lowercase = preg_match('@[a-z]@', $posts['plainPassword']);\n// $number = preg_match('@[0-9]@', $posts['plainPassword']);\n//\n// if(!$uppercase || !$lowercase || !$number || strlen($posts['plainPassword']) < 8) {\n// $this->addFlash('danger', 'Le mot de passe doit contenir: au moins une lettre majuscule, une lettre minuscule, un chiffre et doit faire au moins 8 caracteres');\n// return false;\n// }\n\n return true;\n }", "function isPassCorrect($request){\n $name = $request[\"name\"];\n $pass = $request[\"pass\"];\n global $dbName, $dbPass;\n $mysqli = mysqli_connect(\"localhost\", $dbName, $dbPass, \"[Redacted]\") \n or die(mysql_error());\n $query = mysqli_query($mysqli, \"SELECT hash FROM Users WHERE name='$name' \");\n \n if (mysqli_num_rows($query) > 0) {\n if(password_verify($pass,mysqli_fetch_assoc($query)[\"hash\"])){\n return [True, \"$name\"];\n }else {\n return [False, \"Doesn't match\"];\n }\n } else {\n return [False, \"No user\"];\n }\n}", "public function checkPasswordsMatch($str, $str2) {\n\n\t\t//if ($str == $this->input->post('MJ_USER_PASSWORD'))\n\t\tif ($str == $str2)\n\t\t\treturn true;\n\t\telse {\n\t\t\t\t$this->form_validation->set_message('checkPasswordsMatch', 'Passwords do not match!'); \n\t\t\t\treturn false;\n\t\t\t}\n\t}", "function compare_hashed_pass($clientPass, $dbPass){\n\t\n\t//Result is a boolean used to determin if the passwords match\n\t$result = 0;\n\n\n\t$config_options = getConfigOptions();\n\t$pepper = $config_options['pepper'];\n\n\t$hashedPass = password_hash($clientPass.$pepper, PASSWORD_DEFAULT, $config_options['peppercost'] );\n\n\techo \"<p>Clients pass: \" . $clientPass . \"</p>\";\n\techo \"<p>Clients hashed pass: \" . $hashedPass . \"</p>\";\n\techo \"<p>Servers pass: \" . $dbPass . \"</p>\";\n\n\n\t//Get pepper options\n\t// require_once 'api-config.php';\n\n\tif(password_verify($clientPass.$pepper, $dbPass)){\n\t\t//Passwords match\n\t\treturn $result = 1;\n\t} else{\n\t\t//Passwords don't match\n\t\treturn $result = 0;\n\t}\n\n\treturn $result;\n}", "function check_pass($pass,$account){\n\t\t$arr = arr_one($account);\n\t\tif($pass == $arr['pass']) return true;\n\t\telse return false;\n\t}", "function user_pass_ok($user_login, $user_pass)\n {\n }", "function check() {\r\n static $pass = NULL;\r\n if (is_null($pass)) {\r\n if (function_exists('crypt')) {\r\n $hash = '$2y$04$usesomesillystringfore7hnbRJHxXVLeakoG8K30oukPsA.ztMG';\r\n $test = crypt(\"password\", $hash);\r\n $pass = $test == $hash;\r\n } else {\r\n $pass = false;\r\n }\r\n }\r\n return $pass;\r\n }", "function pwordMatches(){\n\t\t//assume pword does not match that in system\n\t\t$match = false;\n\t\ttry{//try to est connection to db \n\t\t\t$user_db = new SQLite3('users.db');\n\t\t}catch(Exception $ex){ //if cannot catch exception \n\t\t\techo $ex->getMessage(); \n\t\t}\n\t\t//query for all usernames\n\t\t$statement = 'SELECT Username, Password FROM users;';\n\t\t$run = $user_db->query($statement); \n\n\t\t$pword = $_SESSION['password'];\n\t\t$pword = hash('md2', $pword); \n\t\tif($run){//query did not have error\n\t\t\twhile($row = $run->fetchArray()){\n\t\t\t\tif(trim($row['Username']) === trim($_POST['name'])){//if provided username is the same as that queried\t\n\t\t\t\t\tif($pword === trim($row['Password'])){//if provided pword matches that for the provided username\n\t\t\t\t\t\t//password matches\n\t\t\t\t\t\t$match = true; \n\t\t\t\t\t\t//break out of loop\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} \n\t\t\t}\n\t\t}\n\t\t$user_db->close(); \n\t\treturn $match; \t\n\t}", "public function matchPassword($password){\n if($this->password == hash('sha512', $password)){\n return true;\n }\n return false;\n }", "function password_check($password, $existing_hash) {\n\t$hash = crypt($password, $existing_hash);\n\tif ($hash === $existing_hash) {\n\t return true;\n\t} else {\n\t return false;\n\t}\n }", "public function passwordEntryIsValid() {\r\n \r\n //todo put logic here (same as email)\r\n // also check if it matches confirmpassword\r\n // set the var equal to function call of getpassword\r\n $password = $this->getPassword();\r\n // If the fields empty\r\n if ( empty($password) ) {\r\n // Will send it to errors as username and display the message to user\r\n $this->errors[\"password\"] = \"Password is missing.\";\r\n } \r\n // Calls the password function above and if its not equal to the orgincal password returns error\r\n else if ( $this->getConfirmpassword() !== $this->getPassword() ){\r\n // Message displayed to user\r\n $this->errors[\"password\"] = \"Password does not match confirmation password.\";\r\n }\r\n // Also goes test the password against the password is valid function in the validator class\r\n else if ( !Validator::passwordIsValid($this->getPassword()) ) {\r\n $this->errors[\"password\"] = \"Password is not valid.\"; \r\n }\r\n //Will return if its empty and whether any errors are contained\r\n return ( empty($this->errors[\"password\"]) ? true : false ) ;\r\n }", "function verifyLogin($user,$pass)\r\n\r\n{\r\n\r\n\t$salt = 's+(_a*';\r\n\r\n\t$pass = md5($pass.$salt);\r\n\r\n\r\n\r\n\t$sql = \"SELECT pass FROM users WHERE pass = '\" . $pass . \"' AND user = '\" . $user .\"'\";\r\n\r\n\t$res = sqlQuery($sql); if(sqlErrorReturn()) sqlDebug(__FILE__,__LINE__,sqlErrorReturn());\r\n\r\n\t$num = sqlNumRows($res);\r\n\r\n\r\n\r\n\tif ($num > 0)\r\n\r\n\t\treturn true;\r\n\r\n\treturn false;\t\r\n\r\n}", "function passwordExists() {\n //DOES NOT CHECK IF IT'S A VALID PASSWORD\n global $PHP_AUTH_PW;\n global $sessionId;\n global $serverScriptHelper;\n global $isMonterey;\n if ((!$isMonterey) && $serverScriptHelper->hasCCE()) {\n if ($sessionId) {\n return true;\n } else {\n return false;\n }\n } else {\n if ($PHP_AUTH_PW) {\n return true;\n } else {\n return false;\n }\n }\n}", "public function passwordCheck($password) {\n return $password == $this->password ? TRUE : FALSE;\n }", "function validatePassword($cur, $new1, $new2)\n {\n\t\t//Get user's current hashed password and compare to their entered one here\n\t\tif (getUserElement('password') != md5($cur)) return \"Your current password was incorrect.\\\\n\";\n\t\t//Check if the two new passwords match each other\n\t\tif ($new1 != $new2) return \"Your new password and the confirmation do not match.\\\\n\";\n\t\treturn \"\";\n }", "function password_security($tested_password){\r\n $isSecured = false;\r\n $contains_letter = preg_match('/[a-zA-Z]/', $tested_password);\r\n $contains_capital = preg_match('/[A-Z]/', $tested_password);\r\n $contains_digit = preg_match('/\\d/', $tested_password);\r\n $contains_special = preg_match('/[^a-zA-Z\\d]/', $tested_password);\r\n\r\n $contains_all = $contains_letter && $contains_capital && $contains_digit && $contains_special;\r\n\r\n if (strlen($tested_password) >= 8 && $contains_all == \"1\") {\r\n $isSecured = true;\r\n }\r\n return $isSecured;\r\n}", "public function validatePassword($password)\t{\n\t\treturn crypt($password,$this->password) === $this->password;\n\t}", "function password_check($password, $existing_hash) {\n\t # existing hash contains format and salt at start\n\t $hash = crypt($password, $existing_hash);\n\t if ($hash === $existing_hash) {\n\t return true;\n\t } \n\t else {\n\t return false;\n\t }\n\t}", "public function _pwdntmatch($input, $input2) {\n\t\tif($_POST[$input] != $_POST[$input2]) {\n\t\t\treturn true;\n\t\t}\n\t}", "function password_check($password, $existing_hash) {\n\t $hash = crypt($password, $existing_hash);\n\t if ($hash === $existing_hash) {\n\t return true;\n\t } else {\n\t return false;\n\t }\n\t}", "function password_check($password, $existing_hash) {\n\t $hash = crypt($password, $existing_hash);\n\t if ($hash === $existing_hash) {\n\t return true;\n\t } else {\n\t return false;\n\t }\n\t}", "function password_matches_username( $ls_username, $ls_password, $link ) {\n\n\t\t$sql = \"SELECT * from `users` WHERE `username` LIKE '$ls_username' AND `password` LIKE '$ls_password'\";\n\n\t\techo 'sql='.$sql;\n\n\t\t$result = mysqli_query( $link, $sql );\n\n\t\tif ( $result ) {\n\n\t\t\techo 'password_matches_username returned a result';\n\n\t\t\tif ( mysqli_num_rows( $result ) > 0 ) {\n\n\t\t\t\techo 'username '.$ls_username . ' and password ' . $ls_password . ' are correct!';\n\n\t\t\t\treturn true; //user should be allowed to log in.\n\n\t\t\t}\n\n\n\t\t}\n\n\t\treturn false;\n\n\t}", "public function passwordMatch($uPwd,$reUPwd){\n if(strcmp($uPwd,$reUPwd) !== 0){\n return false;\n }\n return true;\n }", "function password_check($password, $existing_hash) {\n\t// existing hash contains format and salt at start\n $hash = crypt($password, $existing_hash);\n if ($hash === $existing_hash) {\n return true;\n } else {\n return false;\n }\n}", "function verifyUser ($username, $hash) {\r\n //TO-DO\r\n\r\n //if credentials match return true\r\n\r\n //else return false\r\n\r\n //dummy CODE\r\n return true;\r\n}", "function leonardo_check_password($password,$hash) {\n\treturn leonardo_check_hash($password, $hash);\n}", "function validate_password($password)\r\n\t{\r\n\t\tif($this->dont_allow_3_in_a_row($password) === FALSE)\r\n\t\t{\r\n\t\t\treturn FALSE;\r\n\t\t}\r\n\t\tif(preg_match(REGEX_PASSWORD, $password) !== 1)\r\n\t\t{\r\n\t\t\treturn FALSE;\r\n\t\t}\r\n\t}", "public function checkCredentials(string $email, string $password):bool;", "public function checkUserPassword()\n\t{\n\t\tself::authenticate();\n\n\t\t$uname = FormUtil::getPassedValue('user', null);\n\t\t$pass = FormUtil::getPassedValue('up', null);\n\n\t\tif($uname == null) {\n\t\t\treturn self::retError('ERROR: No user name passed!');\n\t\t}\n\t\tif($pass == null) {\n\t\t\treturn self::retError('ERROR: No up passed!');\n\t\t}\n\n\t\t$users = self::getRawUsers('uname = \\'' . mysql_escape_string($uname) . '\\'');\n\n\t\tif(count($users) == 1) {\n\t\t\tforeach($users as $user) {\n\t\t\t\tif($user['uname'] == $uname) {\n\t\t\t\t\tif(FormUtil::getPassedValue('viaauthcode', null, 'POST') != null) {\n\t\t\t\t\t\t$authcode = unserialize(UserUtil::getVar('owncloud_authcode', $user['uid']));\n\t\t\t\t\t\tif($authcode['usebefore'] >= new DateTime('NOW') &&\n\t\t\t\t\t\t\t$authcode['authcode'] == $pass) {\n\t\t\t\t\t\t\t\t$return = true;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$return = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$authenticationMethod = array(\n\t\t\t\t\t\t\t'modname' => 'Users' ///TODO\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (ModUtil::getVar(Users_Constant::MODNAME, Users_Constant::MODVAR_LOGIN_METHOD, Users_Constant::DEFAULT_LOGIN_METHOD) == Users_Constant::LOGIN_METHOD_EMAIL) {\n\t\t\t\t\t\t\t$authenticationMethod['method'] = 'email';\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$authenticationMethod['method'] = 'uname';\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$authenticationInfo = array(\n\t\t\t\t\t\t\t'login_id' => $uname,\n\t\t\t\t\t\t\t'pass' => $pass\n\t\t\t\t\t\t);\n\t\t\t\t\t\t//try to login (also for the right output)\n\t\t\t\t\t\tif(UserUtil::loginUsing($authenticationMethod, $authenticationInfo, false, null, true) == true) {\n\t\t\t\t\t\t\t$return = true;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$return = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t$return = false;\n\t\t}\n\t\treturn self::ret($return);\n\t}", "public function test($password) {\n $error = array();\n if($password == trim($password) && strpos($password, ' ') !== false) {\n $error[] = \"Password can not contain spaces!\";\n }\n \n if(($this->password_lenghtMin!=null) && (strlen($password) < $this->password_lenghtMin)) {\n $error[] = \"Password too short! Minimum \".$this->password_lenghtMin.\" characters.\";\n }\n if(($this->password_lenghtMax!=null) && (strlen($password) > $this->password_lenghtMax)) {\n $error[] = \"Password too long! Maximum \".$this->password_lenghtMax.\" characters.\";\n }\n \n if(($this->password_number!=null) && (!preg_match(\"#[0-9]+#\", $password, $output))) {\n $error[] = \"Password must include at least \".$this->password_number.\" number(s)!\";\n } elseif($this->password_number>1) {\n preg_match_all(\"/\\W+/\", $password, $output);\n $output = $output[0];\n $c = 0;\n foreach($output as $out) {\n $c = $c + strlen($out);\n }\n if($c<$this->password_number) {\n $error[] = \"Password must include at least \".$this->password_number.\" number(s)!\";\n }\n }\n\n if(($this->password_letter!=null) && (!preg_match(\"#[a-z]+#\", $password, $output))) {\n $error[] = \"Password must include at least \".$this->password_letter.\" letter(s)! \";\n } elseif($this->password_letter>1) {\n preg_match_all(\"/\\W+/\", $password, $output);\n $output = $output[0];\n $c = 0;\n foreach($output as $out) {\n $c = $c + strlen($out);\n }\n if($c<$this->password_letter) {\n $error[] = \"Password must include at least \".$this->password_letter.\" letter(s)! \";\n }\n }\n\n if(($this->password_capital!=null) && (!preg_match(\"#[A-Z]+#\", $password, $output))) {\n $error[] = \"Password must include at least \".$this->password_capital.\" capital letter(s)! \";\n } elseif($this->password_capital>1) {\n preg_match_all(\"/\\W+/\", $password, $output);\n $output = $output[0];\n $c = 0;\n foreach($output as $out) {\n $c = $c + strlen($out);\n }\n if($c<$this->password_capital) {\n $error[] = \"Password must include at least \".$this->password_capital.\" capital letter(s)! \";\n }\n }\n \n \n if(($this->password_symbol!=null) && (!preg_match(\"/\\W+/\", $password))) {\n $error[] = \"Password must include at least \".$this->password_symbol.\" symbol(s)!\";\n } elseif($this->password_symbol>1) {\n preg_match_all(\"/\\W+/\", $password, $output);\n $output = $output[0];\n $c = 0;\n foreach($output as $out) {\n $c = $c + strlen($out);\n }\n if($c<$this->password_symbol) {\n $error[] = \"Password must include at least \".$this->password_symbol.\" symbol(s)!\";\n }\n }\n \n if(($this->password_strength!=null) && (($this->strength($password)!==false) && ($this->strength($password)['score']<$this->password_strength))) {\n $error[] = \"Password too weak! \".$this->strength($password)['score'].'/4 minimum '.$this->password_strength;\n }\n\n if(!empty($error)){\n return $error;\n } else {\n return true;\n }\n }" ]
[ "0.78580385", "0.7837851", "0.783264", "0.78004414", "0.7780186", "0.773594", "0.7728959", "0.7726949", "0.76972276", "0.76952744", "0.76879126", "0.76872337", "0.765373", "0.7651266", "0.7647589", "0.7579951", "0.75546163", "0.75169224", "0.7511214", "0.74990636", "0.7497002", "0.7449881", "0.7431459", "0.74087477", "0.7406748", "0.7381135", "0.7361118", "0.7339169", "0.7336795", "0.73093784", "0.73058563", "0.72891146", "0.72652966", "0.726177", "0.725031", "0.72492975", "0.7241925", "0.72372705", "0.72239137", "0.72230625", "0.7216373", "0.721526", "0.7215065", "0.72008777", "0.7196125", "0.7195368", "0.7191827", "0.7176114", "0.71722525", "0.71679217", "0.71665937", "0.7162263", "0.7162229", "0.71557224", "0.71538013", "0.7152779", "0.7150661", "0.7145798", "0.71437055", "0.71091706", "0.7107742", "0.7105421", "0.7104205", "0.7101222", "0.7099107", "0.7098831", "0.70947576", "0.70944864", "0.7074828", "0.7073916", "0.70723015", "0.7071539", "0.7064842", "0.7063186", "0.7061856", "0.70556706", "0.7054989", "0.7046851", "0.7043911", "0.7033567", "0.7022619", "0.70213604", "0.7009728", "0.7009405", "0.7006438", "0.69886976", "0.698827", "0.69880414", "0.69859946", "0.6981205", "0.69754833", "0.69754833", "0.6972059", "0.69702154", "0.6963889", "0.69587004", "0.69563556", "0.69561553", "0.695189", "0.6949685", "0.69418424" ]
0.0
-1
! Takes a password then generates a salt and creates a hash. Returns salt+hash !
public function generateHash($userPassword) { $salt = $this->generateSalt(); $salt2 = $this->generateSalt(); $result = $salt.".".hash("sha512", md5($salt.$userPassword.$salt2)).".".$salt2; return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getHashedPass($password, $salt)\n{\n $saltedPass = $password . $salt;\n return hash('sha256', $saltedPass);\n}", "function makeHash($password) {\r\n return crypt($password, makeSalt());\r\n}", "function getHash( $password, $salt = '' )\r\n{\r\n\treturn hash( 'sha256', $password . $salt );\r\n}", "function getPasswordHash($password,$salt){\n\t\treturn hash('sha256',$salt.$password);\n}", "function CreateHash($password){\n\t$salt = date('U'); //creates different password each time\n\t$pass = crypt($password, $salt);\n\treturn $pass;\n}", "public static function generateHash($salt, $password) {\n $hash = crypt($password, $salt);\n return substr($hash, 29);\n }", "function\nauth_hash($password, $salt = \"\")\n{\n // The password hash is crypt(\"password\", \"sha512-salt\")\n if ($salt == \"\")\n $salt = \"\\$6\\$\" . bin2hex(openssl_random_pseudo_bytes(8));\n\n return (crypt($password, $salt));\n}", "function get_password_hash($password) {\n return crypt($password, \"$2a$07$\" . salt() . \"$\");\n}", "private function hashPw($salt, $password) {\n return md5($salt.$password);\n }", "function _hashsaltpass($password)\n {\n $salted_hash = hash(\"sha512\", \"salted__#edsdfdwrsdse\". $password.\"salted__#ewr^&^$&e\");\n return $salted_hash;\n }", "public function generateHash (string $password): string;", "private function passwordHash($password, $salt){\n return md5($password.$salt);\n }", "function gen_mix_salt($pass) {\n $salt = generate_salt();\n return mix_salt($salt, $pass);\n}", "function hashPassword($password, $salt) {\n\t$result = password_hash($password . $salt, PASSWORD_DEFAULT);\n\treturn $result;\n}", "public static function generateSaltedHashFromPassword($password) {\r\n return hash(self::HASH_ALGORITHM, $password.self::SALT);\r\n }", "public static function make_hash($salt, $pass)\n {\n \t# Pass is plaintext atm...\n \treturn sha1($salt . $pass);\n }", "public function saltPassword($salt, $password) {\n\n\t\t$salt = hex2bin ( $salt );\n\t\t\n\t\t$hashedPassword = hash ( 'sha256', $password );\n\t\t$hashedPassword = hex2bin ( $hashedPassword );\n\t\t\n\t\t$saltedPassword = hash ( 'sha256', $salt . $hashedPassword );\n\t\t$saltedPassword = strtolower ( $saltedPassword );\n\t\t\n\t\treturn $saltedPassword;\n\t\t\n\t\t$password = utf8_encode ( $password );\n\t\tvar_dump ( \"password: \" . $password );\n\t\tvar_dump ( \"salt: \" . $salt );\n\t\t\n\t\t$hashedPassword = hash ( 'sha256', $password );\n\t\t$hashedPassword = $password;\n\t\tvar_dump ( \"hashedPassword: \" . $hashedPassword );\n\t\t\n\t\t$hash = hash ( 'sha256', $salt . $hashedPassword );\n\t\tvar_dump ( \"hash: \" . $hash );\n\t\treturn $hash;\n\t\n\t}", "private function create_hash($password, $salt) {\n $hash = '';\n for ($i = 0; $i < 20000; $i++) {\n $hash = hash('sha512', $hash . $salt . $password);\n }\n return $hash;\n }", "public function getPasswordHash($salt,$password)\r\n\t\t\t{\r\n\t\t\t\treturn hash('whirlpool',$salt.$password);\r\n\t\t\t}", "function generateHash($plainText, $salt = null) // used in confirm-password.php, class.newuser.php, class.user.php, user-login.php, user-update-account.php\r\n\r\n{\r\n\r\n\tif ($salt === null)\r\n\r\n\t{\r\n\r\n\t\t$salt = substr(md5(uniqid(rand(), true)), 0, 25);\r\n\r\n\t}\r\n\r\n\telse\r\n\r\n\t{\r\n\r\n\t\t$salt = substr($salt, 0, 25);\r\n\r\n\t}\r\n\r\n\t\r\n\r\n\treturn $salt . sha1($salt . $plainText);\r\n\r\n}", "private function encryptPassword($password, $salt) {\n\t\treturn hash('sha256', strrev($GLOBALS[\"random1\"] . $password . $salt . 'PIZZAPHP'));\n\t}", "function hashPassword($password) {\n $cost = 10;\n $salt = strtr(base64_encode(mcrypt_create_iv(16, MCRYPT_DEV_URANDOM)), '+', '.');\n $salt = sprintf(\"$2a$%02d$\", $cost) . $salt;\n return crypt($password, $salt);\n }", "public function getHash($plaintext, $salt = false);", "public static function calculateHash($password, $salt = NULL)\n\t{\n\t\tif ($password === \\Nette\\Utils\\Strings::upper($password)) { // perhaps caps lock is on\n\t\t\t$password = \\Nette\\Utils\\Strings::lower($password);\n\t\t}\n\t\treturn crypt($password, $salt ?: '$2a$07$' . \\Nette\\Utils\\Strings::random(22));\n\t}", "public static function makePassHash($password, $username, $salt='')\n\t\t{\n\n\t\t\tif($salt == '') {\n\t\t\t\t$salt = Util::makeSalt();\n\t\t\t}\n\t\t\t\n\t\t\t$hash = sha1($username.$password.$salt);\n\t\t\treturn $salt.\"|\".$hash;\n\t\t}", "function salt_and_encrypt($password) {\n\t$hash_format=\"$2y$10$\";\n\t$salt_length=22;\n\t$salt=generate_salt($salt_length);\n\t$format_and_salt=$hash_format.$salt;\n\t$hash=crypt($password,$format_and_salt);\t\n\treturn $hash;\n}", "function saltPassword($tempPassword)\n{\n\t$salt1 = \"qm\\$h*\";\n\t$salt2 = \"pg!@\";\n\t$token = hash('ripemd128', \"$salt1$tempPassword$salt2\");\n\treturn $token;\n}", "function pw_hash($password)\n{\n // A higher \"cost\" is more secure but consumes more processing power\n $cost = 10;\n\n // Create a random salt\n $salt = strtr(base64_encode(mcrypt_create_iv(16, MCRYPT_DEV_URANDOM)), '+', '.');\n\n // Prefix information about the hash so PHP knows how to verify it later.\n // \"$2a$\" Means we're using the Blowfish algorithm. The following two digits are the cost parameter.\n $salt = sprintf(\"$2a$%02d$\", $cost) . $salt;\n\n // Hash the password with the salt\n $hashed = crypt($password, $salt);\n\n return $hashed;\n}", "function gethashpass($password,$salt,$timestamp) {\n\t\t\t$ps = $password.$salt;\n\t\t\t$joinps = md5($ps);\n\t\t\t$timehash = md5($timestamp);\n\t\t\t$joinallstr = $joinps.$timehash;\n\t\t\t$hashpass = md5($joinallstr);\n\t\t\t$encodepass = substr(base64_encode($hashpass),0,32);\n\t\t\treturn $encodepass;\n\t\t}", "public function hash_password($password, $salt = FALSE)\n {\n \tif ($salt === FALSE)\n \t{\n \t\t// Create a salt seed, same length as the number of offsets in the pattern\n \t\t$salt = substr($this->hash(uniqid(NULL, TRUE)), 0, count($this->_config['salt_pattern']));\n \t}\n\n \t// Password hash that the salt will be inserted into\n \t$hash = $this->hash($salt.$password);\n\n \t// Change salt to an array\n \t$salt = str_split($salt, 1);\n\n \t// Returned password\n \t$password = '';\n\n \t// Used to calculate the length of splits\n \t$last_offset = 0;\n\n \tforeach ($this->_config['salt_pattern'] as $offset)\n \t{\n \t\t// Split a new part of the hash off\n \t\t$part = substr($hash, 0, $offset - $last_offset);\n\n \t\t// Cut the current part out of the hash\n \t\t$hash = substr($hash, $offset - $last_offset);\n\n \t\t// Add the part to the password, appending the salt character\n \t\t$password .= $part.array_shift($salt);\n\n \t\t// Set the last offset to the current offset\n \t\t$last_offset = $offset;\n \t}\n\n \t// Return the password, with the remaining hash appended\n \treturn $password.$hash;\n }", "function generateSaltPassword () {\n\treturn base64_encode(random_bytes(12));\n}", "public function hash_user_pass($password) {\n\n $salt = sha1(rand());\n $salt = substr($salt, 0, 10);\n\n//PASSWORD_DEFAULT is a default function in PHP it contains BCRYPT algo at backend PHP is using BCRYPT currently\n//as it is most secure password hashing algorithm using today the term DEFAULT means that if another hashing algorithm is introduced in\n//future it will automatically updated to the library ny PHP so the developer has no need to update in the code.\n $hashing = password_hash($password.$salt, PASSWORD_DEFAULT);\n $hash = array(\"salt\" => $salt, \"hashing\" => $hashing);\n\n return $hash;\n\n}", "function HashPassword($input)\n{\n//Credits: http://crackstation.net/hashing-security.html\n//This is secure hashing the consist of strong hash algorithm sha 256 and using highly random salt\n$salt = bin2hex(mcrypt_create_iv(32, MCRYPT_DEV_URANDOM)); \n$hash = hash(\"sha256\", $salt . $input); \n$final = $salt . $hash; \nreturn $final;\n}", "private function newHash()\n {\n $salt = hash('sha256', uniqid(mt_rand(), true) . 't33nh4sh' . strtolower($this->email));\n\n // Prefix the password with the salt\n $hash = $salt . $this->password;\n \n // Hash the salted password a bunch of times\n for ( $i = 0; $i < 100000; $i ++ ) {\n $hash = hash('sha256', $hash);\n }\n \n // Prefix the hash with the salt so we can find it back later\n $hash = $salt . $hash;\n \n return $hash;\n }", "public function hash_password($password, $salt = false) {\n\n\t\t// Create a salt seed, same length as the number of offsets in the pattern\n\t\tif ($salt === false) {\n\t\t\t$salt = substr(hash($this->config['hash_method'], uniqid(null, true)), 0, count($this->config['salt_pattern']));\n\t\t}\n\n\t\t// Password hash that the salt will be inserted into\n\t\t$hash = hash($this->config['hash_method'], $salt . $password);\n\n\t\t// Change salt to an array\n\t\t$salt = str_split($salt, 1);\n\n\t\t// Returned password\n\t\t$password = '';\n\n\t\t// Used to calculate the length of splits\n\t\t$last_offset = 0;\n\n\t\tforeach ($this->config['salt_pattern'] as $offset) {\n\n\t\t\t// Split a new part of the hash off\n\t\t\t$part = substr($hash, 0, $offset - $last_offset);\n\n\t\t\t// Cut the current part out of the hash\n\t\t\t$hash = substr($hash, $offset - $last_offset);\n\n\t\t\t// Add the part to the password, appending the salt character\n\t\t\t$password .= $part . array_shift($salt);\n\n\t\t\t// Set the last offset to the current offset\n\t\t\t$last_offset = $offset;\n\n\t\t}\n\n\t\t// Return the password, with the remaining hash appended\n\t\treturn $password . $hash;\n\t}", "public function hash_password($password, $salt = FALSE)\n\t{\n\t\tif ($salt == FALSE)\n\t\t{\n\t\t\t// Create a salt string, same length as the number of offsets in the pattern\n\t\t\t$salt = substr($this->hash(uniqid(NULL, TRUE)), 0, count($this->config['salt_pattern']));\n\t\t}\n\n\t\t// Password hash that the salt will be inserted into\n\t\t$hash = $this->hash($salt.$password);\n\n\t\t// Change salt to an array\n\t\t$salt = str_split($salt, 1);\n\n\t\t// Returned password\n\t\t$password = '';\n\n\t\t// Used to calculate the length of splits\n\t\t$last_offset = 0;\n\n\t\tforeach($this->config['salt_pattern'] as $offset)\n\t\t{\n\t\t\t// Split a new part of the hash off\n\t\t\t$part = substr($hash, 0, $offset - $last_offset);\n\n\t\t\t// Cut the current part out of the hash\n\t\t\t$hash = substr($hash, $offset - $last_offset);\n\n\t\t\t// Add the part to the password, appending the salt character\n\t\t\t$password .= $part.array_shift($salt);\n\n\t\t\t// Set the last offset to the current offset\n\t\t\t$last_offset = $offset;\n\t\t}\n\n\t\t// Return the password, with the remaining hash appended\n\t\treturn $password.$hash;\n\t}", "function hashPass($pass, $salt){\n while(strlen($pass) > strlen($salt)){\n $salt = $salt.$salt;\n }\n while(strlen($salt) > strlen($pass)){\n $salt = substr($salt, 0, -1);\n }\n\n $hashable = saltPass($pass, $salt);\n\n //Hash the hashable string a couple of times\n $hashedData = $hashable;\n for($i = 0; $i < 10000; $i++){\n $hashedData = hash('sha512', $hashedData);\n }\n\n return $hashedData;\n}", "function my_password_hash($password)\n{\n $salt = createSalt();\n $hash = md5($salt.$password);\n return array(\"hash\" => $hash, \"salt\" => $salt);\n}", "public static function createHashPassword($originalPassword, $passwordSalt)\r\n {\r\n return md5(substr($passwordSalt,3,23).md5($originalPassword).md5(USER_PASSWORD_SALT));\r\n }", "function createPasswordSalt() {\n\t\t$userSystem = new SpotUserSystem($this->_db, $this->_settings);\n\t\t$salt = $userSystem->generateUniqueId() . $userSystem->generateUniqueId();\n\t\t\n\t\t$this->setIfNot('pass_salt', $salt);\n\t}", "function deriveKeyFromUserPassword( string $password, string $salt ) : string\n{\n\t$outLength = SODIUM_CRYPTO_SIGN_SEEDBYTES;\n\t$seed = sodium_crypto_pwhash(\n\t\t$outLength,\n\t\t$password,\n\t\t$salt,\n\t\tSODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE,\n\t\tSODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE\n\t);\n\n\treturn $seed;\n}", "function hashit($password){\n\t$salt = config('password.salt');\n\t$salt = sha1( md5($password.$salt) );\n\treturn md5( $password.$salt );\n}", "public static function hashPassword($password, $salt) {\r\n\t\treturn md5($salt . $password . $salt . self::$_saltAddon);\r\n\t}", "function checkhashSSHA($salt, $password) {\n\n $hash = base64_encode(sha1($password . $salt, true) . $salt);\n\n return $hash;\n}", "public function hashPass($pass, $salt){\n return crypt($pass, '$6$rounds=5000$'.$salt.'$');\n }", "function make_password(&$password,&$salt)\n{\n\t$password = hash('sha512', $password);\n\n\tif (strlen($password) != 128) \n\t{\n\t\treturn FALSE;\n\t}\n\telse\n\t{\n\t\t// make a random salt\n\t\t$salt = hash('sha512', uniqid(mt_rand(1, mt_getrandmax()), true));\n\t\t// hash with random salt\n\t\t$password = hash('sha512', $password . $salt);\n\t\t\n\t\treturn TRUE;\n\t}\n}", "public function calculateHash($password)\n\t{\n\t\treturn md5($password . str_repeat('*enter any random salt here*', 10));\n\t}", "private function generateSalt() {\n $salt = base64_encode(pack(\"H*\", md5(microtime())));\n \n return substr($salt, 0, $this->saltLng);\n }", "public function hashPassword($password, $salt = '') {\n return md5($salt . $password);\n }", "public static function calculateHash($password, $salt = NULL)\r\n\t{\r\n\t\tif ($salt === NULL){\r\n $salt = '$2a$07$' . Nette\\Utils\\Strings::random(22);\r\n\t\t}\r\n\t\treturn crypt($password, $salt);\r\n\t}", "public function hashPassword($password, $salt = FALSE) {\n\n $this->generateSalt();\n\n if ($salt === FALSE) {\n // Create a salt seed, same length as the number of offsets in the pattern\n $salt = substr($this->hash(uniqid(NULL, TRUE)), 0, count($this->salt_pattern));\n }\n\n // Password hash that the salt will be inserted into\n $hash = $this->hash($salt . $password);\n\n // Change salt to an array\n $salt = str_split($salt, 1);\n\n\n // Returned password\n $password = '';\n\n // Used to calculate the length of splits\n $last_offset = 0;\n\n foreach ($this->salt_pattern as $i => $offset) {\n // Split a new part of the hash off\n $part = substr($hash, 0, $offset - $last_offset);\n\n // Cut the current part out of the hash\n $hash = substr($hash, $offset - $last_offset);\n\n // Add the part to the password, appending the salt character\n $password .= $part . array_shift($salt);\n\n // Set the last offset to the current offset\n $last_offset = $offset;\n }\n // Return the password, with the remaining hash appended\n return $password . $hash;\n }", "public function hashPassword($password, $salt)\n {\n return md5($salt . $password);\n }", "function cafet_generate_hashed_pwd(string $password): string\n {\n $salt = base64_encode(random_bytes(32));\n $algo = in_array(Config::hash_algo, hash_algos()) ? Config::hash_algo : 'sha256';\n \n return $algo . '.' . $salt . '.' . cafet_digest($algo, $salt, $password);\n }", "public function GetPasswordHash ();", "public function createHash($password){\r\n $options = [\r\n 'cost' => 10,\r\n ];\r\n $hash = password_hash($password, PASSWORD_DEFAULT, $options);\r\n return $hash;\r\n}", "function getPasswordHash($password){\n\t\t$salt = $this->getPasswordSalt();\n\t\treturn $salt . ( hash('sha256', $salt . $password ) );\n\t}", "function _hash_password($password)\n {\n //return altered pw\n\n }", "public function makePassword($pw)\n\t\t{\n\t\t\treturn $this->useHash ? sha1($pw . $this->salt) : $pw;\n\t\t}", "function hash_password($password){\n\t// Hashing options\n\t$options = [\n 'cost' => 12,\t// Cost determines the work required to brute-force\n //'salt' => mcrypt_create_iv(22, MCRYPT_DEV_URANDOM),\n\t];\n\n\treturn password_hash($password, PASSWORD_BCRYPT, $options);\n}", "public function salt_password($password, $salt)\n {\n return md5(md5($salt) . $password);\n }", "function hashSSHA($password) {\n $salt = sha1(rand());\n $salt = substr($salt, 0, 10);\n $encrypted = base64_encode(sha1($password . $salt, true) . $salt);\n $hash = array(\"salt\" => $salt, \"encrypted\" => $encrypted);\n return $hash;\n}", "protected function getSaltedHash($password, $salt = null) {\n StringValidator::validate($password, array(\n 'min_length' => self::MIN_LENGTH,\n 'max_length' => self::MAX_LENGTH\n ));\n \n if (is_null($salt)) {\n $salt = substr(Crypto::getRandom64HexString(), 0, self::SALT_LENGTH);\n } else {\n StringValidator::validate($salt, array(\n 'min_length' => self::SALT_LENGTH\n ));\n $salt = substr($salt, 0, self::SALT_LENGTH);\n }\n\n return $salt . hash(self::HASH_ALGORITHM, $salt . $password);\n }", "public static function hash($password, $salt = null) {\n return crypt($password, $salt ?: static::salt());\n }", "static function generateSalt($strength=10) {\n return self::saltStart($strength) . random_string(22, './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz');\n }", "function getPasswordSalt(){\n\t\treturn substr( str_pad( dechex( mt_rand() ), 8, '0', STR_PAD_LEFT ), -8 );\n\t}", "function getPasswordHash($password)\r\n {\r\n return ( hash( 'whirlpool', $password ) );\r\n }", "private function hashPassword($password, $salt)\n {\n $ret = $this->hasher->make($password, ['salt' => $salt]);\n\n return $ret;\n }", "public static function hash($pass, $salt) {\n return sha1($pass . $salt);\n }", "public static function make($string, $salt = ''){\n return hash('sha256', $string . $salt);\n }", "function hash_password($cleartext_password) {\n if (config\\HASHING_ALGORITHM == \"crypt\") {\n return crypt($cleartext_password, \"$1$\" . \\melt\\string\\random_hex_str(8) . \"$\");\n } else if (config\\HASHING_ALGORITHM == \"sha1\") {\n $salt = \\melt\\string\\random_hex_str(40);\n return $salt . sha1($salt . $cleartext_password, false);\n } else if (config\\HASHING_ALGORITHM == \"md5\") {\n $salt = \\melt\\string\\random_hex_str(32);\n return $salt . \\md5($salt . $cleartext_password, false);\n } else\n trigger_error(\"The configured hashing algorithm '\" . config\\HASHING_ALGORITHM . \"' is not supported.\", \\E_USER_ERROR);\n}", "function generate_hash($password, $cost = 12)\n{\n /* To generate the salt, first generate enough random bytes. Because\n * base64 returns one character for each 6 bits, the we should generate\n * at least 22*6/8=16.5 bytes, so we generate 17. Then we get the first\n * 22 base64 characters\n */\n\n $salt = substr(base64_encode(openssl_random_pseudo_bytes(17)), 0, 22);\n\n /* As blowfish takes a salt with the alphabet ./A-Za-z0-9 we have to\n * replace any '+' in the base64 string with '.'. We don't have to do\n * anything about the '=', as this only occurs when the b64 string is\n * padded, which is always after the first 22 characters.\n */\n\n $salt = str_replace(\"+\", \".\", $salt);\n\n /* Next, create a string that will be passed to crypt, containing all\n * of the settings, separated by dollar signs\n */\n\n $param = '$' . implode('$', array(\n \"2y\", // select the most secure version of blowfish (>=PHP 5.3.7)\n str_pad($cost, 2, \"0\", STR_PAD_LEFT), // add the cost in two digits\n $salt, // add the salt\n ));\n\n // now do the actual hashing\n\n return crypt($password, $param);\n}", "public function createSalt()\n{\n\t$pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';\n\n\treturn substr(str_shuffle(str_repeat($pool, 5)), 0, $this->saltLength);\n}", "private function genSalt() {\r\n $random = 0;\r\n $rand64 = \"\";\r\n $salt = \"\";\r\n $random = rand(); // Seeded via initialize()\r\n // Crypt(3) can only handle A-Z a-z ./\r\n $rand64 = \"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\";\r\n $salt = substr( $rand64, $random % 64, 1 ) . substr( $rand64, ($random / 64) % 64, 1 );\r\n $salt = substr( $salt, 0, 2 ); // Just in case\r\n return($salt);\r\n }", "function generatePassword($password)\n{\n $password = hash('sha256', hash('sha256', $password)); // . \"brightisagoodguy1234567890\" . strtolower($password));\n \n return $password;\n \n}", "public static function make_salt()\n {\n\n \t$chars = str_split('0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz');\n \n \t\t$newSalt = '';\n \t\tfor ($i = 0; $i < 16; $i++) \n \t\t{\n \t\t\t$newSalt .= $chars[rand(0, count($chars) - 1)];\n \t\t}\n\n \t\treturn $newSalt;\n }", "function GenerateHashPassword($pass){\n\treturn password_hash($pass, PASSWORD_DEFAULT);\n}", "public static function regenerateSalt()\n\t{\n\t\treturn PzPHP_Helper_String::createCode(mt_rand(40,45), PzPHP_Helper_String::ALPHANUMERIC_PLUS);\n\t}", "public function checkhashSSHA($salt, $password)\r\n {\r\n \r\n $hash = base64_encode(sha1($password . $salt, true) . $salt);\r\n \r\n return $hash;\r\n }", "protected function _create_salt()\n\t{\n\t\t$this->CI->load->helper('string');\n\t\treturn sha1(random_string('alnum', 32));\n\t}", "public function hash(string $password, string $salt = null) : string\n {\n $encodedSalt = $this->saltShaker->encode($salt);\n\n return crypt($password, $encodedSalt);\n }", "public static function hash( $password, $salt=NULL )\n\t{\n\t\t//create random salt\n\t\tif( $salt === NULL )\n\t\t\t$salt = mcrypt_create_iv(4, MCRYPT_DEV_URANDOM);\n\n\t\t//return hash string\n\t\treturn \"{SSHA512}\" . base64_encode( hash( \"sha512\", $password . $salt, TRUE ) . $salt );\n\t}", "private function hash_password($password, $salt)\r\n\t{\r\n\t\t//truncate the user's salt and the defined salt from the config file\r\n\t\t$salt_to_use = $salt . SALT;\r\n\t\t//Hash it with the sha512 algorithm.\r\n\t\t$hashed_pass = hash_hmac('sha512', $password, $salt_to_use);\r\n\r\n\t\treturn $hashed_pass;\r\n\t}", "public function getPasswordHashOfUser($username,$password){\r\n\t$options = array('cost'=>12, 'salt'=>md5(strtolower($username)));\r\n\treturn password_hash($password, PASSWORD_DEFAULT, $options);\r\n}", "function getCryptHash($str)\n{\n $salt = '';\n if (CRYPT_BLOWFISH) {\n if (version_compare(PHP_VERSION, '5.3.7') >= 0) { // http://www.php.net/security/crypt_blowfish.php\n $algo_selector = '$2y$';\n } else {\n $algo_selector = '$2a$';\n }\n $workload_factor = '12$'; // (around 300ms on Core i7 machine)\n $val_arr = array(\n '.',\n '/'\n );\n $range1 = range('0', '9');\n $range2 = range('a', 'z');\n $range3 = range('A', 'Z');\n $res_arr = array_merge($val_arr, $range1, $range2, $range3);\n $salt = $algo_selector . $workload_factor . getRandomStr($res_arr, 22); // './0-9A-Za-z'\n \n } else if (CRYPT_MD5) {\n $algo_selector = '$1$';\n $char1 = chr(33);\n $char2 = chr(127);\n $range = range($char1, $char2);\n $salt = $algo_selector . getRandomStr($range, 12); // actually chr(0) - chr(255), but used ASCII only\n \n } else if (CRYPT_SHA512) {\n $algo_selector = '$6$';\n $workload_factor = 'rounds=5000$';\n $char1 = chr(33);\n $char2 = chr(127);\n $range = range($char1, $char2);\n $salt = $algo_selector . $workload_factor . getRandomStr($range, 16); // actually chr(0) - chr(255), but used ASCII only\n \n } else if (CRYPT_SHA256) {\n $algo_selector = '$5$';\n $workload_factor = 'rounds=5000$';\n $char1 = chr(33);\n $char2 = chr(127);\n $range = range($char1, $char2);\n $salt = $algo_selector . $workload_factor . getRandomStr($range, 16); // actually chr(0) - chr(255), but used ASCII only\n \n } else if (CRYPT_EXT_DES) {\n $algo_selector = '_';\n $val_arr = array(\n '.',\n '/'\n );\n $range1 = range('0', '9');\n $range2 = range('a', 'z');\n $range3 = range('A', 'Z');\n $res_arr = array_merge($val_arr, $range1, $range2, $range3);\n $salt = $algo_selector . getRandomStr($res_arr, 8); // './0-9A-Za-z'.\n \n } else if (CRYPT_STD_DES) {\n $algo_selector = '';\n $val_arr = array(\n '.',\n '/'\n );\n $range1 = range('0', '9');\n $range2 = range('a', 'z');\n $range3 = range('A', 'Z');\n $res_arr = array_merge($val_arr, $range1, $range2, $range3);\n $salt = $algo_selector . getRandomStr($res_arr, 2); // './0-9A-Za-z'\n \n }\n return crypt($str, $salt);\n}", "private function HashPassword(string $password)\n\t{\n\t\t/* Create a random salt */\n\t\t$salt = strtr(base64_encode(mcrypt_create_iv(16, MCRYPT_DEV_URANDOM)), '+', '.');\n\t\t\n\t\t/*\t\"$2a$\" means the Blowfish algorithm,\n\t\t *\tthe following two digits are the cost parameter.\n\t\t */\n\t\t$salt = sprintf(\"$2a$%02d$\", 10) . $salt;\n\t\t\n\t\treturn crypt($password, $salt);\n\t}", "function getSalt(){\n $inside = time() . \"az51\" . time(); \n $salt = '$2a$07$' . $inside . '$';\n return $salt;\n }", "public function PasswordHash($password, $isSalt = false) {\n\n if (strlen($password) > 72) {\n\n $password = substr($password, 0, 72);\n }\n\n $hashedPassword = \\FluitoPHP\\Filters\\Filters::GetInstance()->\n Run('FluitoPHP.Authentication.HashPassword', $password, $isSalt);\n\n if ($hashedPassword === $password) {\n\n $hashedPassword = password_hash($password, PASSWORD_BCRYPT);\n }\n\n return $hashedPassword;\n }", "public function hash($pwd, $salt = \"\") {\n return $this->generateHash($pwd, $salt, $this->sha1, $this->rounds);\n }", "public function checkhashSSHA($salt, $password) {\n \n $hash = base64_encode(sha1($password . $salt, true) . $salt);\n \n return $hash;\n }", "public static function getGeneratedPasswordHash($password) {\n\t\tif (self::checkIsAvailableCryptBlowFish()) {\n\n\t\t\t$salt = '$2y$11$' . substr(md5(uniqid(mt_rand(), true)), 0, 22);\n\t\t\treturn crypt($password, $salt);\n\t\t}\n\n\t\treturn md5($password);\n\t}", "private function generateSalt()\n {\n return str_random(16);\n }", "public static function hash($password, $salt, $iterationCount = Pbkdf2::HASH_ITERATIONS) {\n\t\t$hash\t= $password;\n\t\tfor ($i = 0; $i < $iterationCount; ++$i) {\n\t\t\t$hash\t= strtolower(hash('sha256', self::POMPOUS_SECRET . $hash . $salt));\n\t\t}\n\n\t\treturn $hash;\n\t}", "function password_encrypt($password) {\n\t $hash_format = \"$2y$10$\"; // Use Blowfish with a \"cost\" of 10\n\t $salt_length = 22; \t\t\t\t\t// Blowfish salts should be 22-characters or more\n\t $salt = generate_salt($salt_length);\n\t $format_and_salt = $hash_format . $salt;\n\t $hash = crypt($password, $format_and_salt);\n\t return $hash;\n\t}", "public static function generateSalt() {\n $salt = '$2a$13$';\n $salt = $salt . md5(mt_rand());\n return $salt;\n }", "private function GenSalt()\n {\n $chars = array_merge(range('a','z'), range('A','Z'), range(0, 9));\n $max = count($chars) - 1;\n $str = \"\";\n $length = 22;\n \n while($length--) {\n shuffle($chars);\n $rand = mt_rand(0, $max);\n $str .= $chars[$rand];\n }\n return $str . '$';\n }", "function encodeSalt($passwordNatif, $salt) {\n\n //On concatene le mot de passe et le grain de sel\n $password = $passwordNatif . $salt;\n //On chiffre le mot de passe salé avec sha1\n $password = sha1($password);\n //On ajoute le grain de sel au mot de passe chiffré\n $password .= $salt;\n //On rechiffre le tout avec md5\n $password = md5($password);\n //On rajoute le grain de sel une dernière fois\n $password .= $salt;\n\n return $password;\n}", "function makeSalt() {\r\n static $seed = \"./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\r\n $algo = (PHP_VERSION_ID >= 50307) ? '$2y' : '$2a'; //DON'T CHANGE THIS!!\r\n $strength = '$12'; //too high will time out script.\r\n $salt = '$';\r\n for ($i = 0; $i < 22; $i++) {\r\n $salt .= substr($seed, mt_rand(0, 63), 1);\r\n }\r\n return $algo . $strength . $salt;\r\n}", "function PwdHash($pwd, $salt = null)\n{\n if ($salt === null) {\n $salt = substr(md5(uniqid(rand(), true)), 0, SALT_LENGTH);\n }\n else {\n $salt = substr($salt, 0, SALT_LENGTH);\n }\n return $salt . sha1($pwd . $salt);\n}", "function PwdHash($pwd, $salt = null)\n{\n if ($salt === null) {\n $salt = substr(md5(uniqid(rand(), true)), 0, SALT_LENGTH);\n }\n else {\n $salt = substr($salt, 0, SALT_LENGTH);\n }\n return $salt . sha1($pwd . $salt);\n}", "private function genSalt()\n {\n \treturn md5(time() + rand());\n }", "public function getHash($password, $salt = null)\n\t{\n\t\treturn $this->md5_hmac($password, $salt);\n\t}" ]
[ "0.81962234", "0.8118475", "0.80853033", "0.8036892", "0.80246073", "0.7980485", "0.7866376", "0.7863567", "0.7770568", "0.77702844", "0.77616733", "0.77567774", "0.7748468", "0.7735436", "0.76788276", "0.7665582", "0.76616496", "0.7659466", "0.76543933", "0.7629388", "0.76020736", "0.7591147", "0.7579395", "0.75602984", "0.7549234", "0.75445527", "0.75230926", "0.7507634", "0.74830127", "0.74808085", "0.74454224", "0.7414206", "0.7405942", "0.74017584", "0.73873323", "0.73856455", "0.73829454", "0.7379543", "0.7366614", "0.73597956", "0.7341992", "0.73407274", "0.73352754", "0.73238707", "0.7312581", "0.72957355", "0.72868854", "0.7272419", "0.7269384", "0.72691166", "0.7266794", "0.72532994", "0.7248546", "0.72465", "0.72463846", "0.7246073", "0.7237878", "0.7196707", "0.7192712", "0.7191751", "0.71876043", "0.7181218", "0.7170225", "0.71666473", "0.71538657", "0.71385777", "0.7136112", "0.71292573", "0.7122355", "0.71027136", "0.7101175", "0.7092374", "0.70881474", "0.70776963", "0.7055709", "0.70486945", "0.7038498", "0.7014067", "0.7000528", "0.6998772", "0.69965893", "0.6996569", "0.69963026", "0.6994057", "0.69938993", "0.6993828", "0.6975688", "0.69756347", "0.69742537", "0.6973703", "0.6973135", "0.69730055", "0.6964645", "0.69607383", "0.6955204", "0.6949988", "0.6937594", "0.69341296", "0.69341296", "0.69211334", "0.69082767" ]
0.0
-1
! Generate 10 character salt !
private function generateSalt() { $possibleValues = '0123456789abcdefghijklmnopqrstuvxyzABCDEFGHIJKLMNOPQRSTUVXYZ'; $salt = ''; for($i = 0; $i < 10; $i++) { $salt .= $possibleValues[mt_rand(0, strlen($possibleValues)-1)]; } return $salt; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function GenSalt()\n {\n $chars = array_merge(range('a','z'), range('A','Z'), range(0, 9));\n $max = count($chars) - 1;\n $str = \"\";\n $length = 22;\n \n while($length--) {\n shuffle($chars);\n $rand = mt_rand(0, $max);\n $str .= $chars[$rand];\n }\n return $str . '$';\n }", "function generateSalt() {\n $length = 10;\n $characters = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\";\n $charsLength = strlen($characters) - 1;\n $string = \"\";\n for($i=0; $i<$length; $i++) {\n $randNum = mt_rand(0, $charsLength);\n $string .= $characters[$randNum];\n }\n return $string;\n}", "private function generateSalt()\n {\n return str_random(16);\n }", "function generateSalt()\n\t{\n\t\t$lets = range('a', 'z');\n\t\t$ups = range('A', 'Z');\n\t\t$nums = range('0', '9');\n\t\t\n\t\t$special = array('*', '%', '#');\n\t\t\n\t\t$union = $lets + $nums + $ups + $special; //Generate an array with numbers, letters, and special characters\n\t\t\n\t\t$salt = '';\n\t\t\n\t\tfor($i = 0; $i < 5; $i++) //Create a salt of length 5, supplying random values\n\t\t{\n\t\t\t$r = rand(0, count($union)-1);\n\t\t\t$salt .= $union[$r];\n\t\t}\n\t\t\n\t\treturn $salt;\n\t}", "private function generateSalt(){\n return substr(md5(rand(0, 999)), 0, 5);\n }", "function createNewSalt(){\n\t$characters = 'abcdefghijklmnopqrstuvwxyz-:;><*#%&()ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';\n\n\t$salt = \"\";\n\n\tfor ($i = 0; $i<32; $i++){\n $salt = $salt.$characters[rand(0,strlen($characters)-1)];\n\t}\n\t\n\treturn $salt;\n}", "public static function make_salt()\n {\n\n \t$chars = str_split('0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz');\n \n \t\t$newSalt = '';\n \t\tfor ($i = 0; $i < 16; $i++) \n \t\t{\n \t\t\t$newSalt .= $chars[rand(0, count($chars) - 1)];\n \t\t}\n\n \t\treturn $newSalt;\n }", "private function genSalt() {\r\n $random = 0;\r\n $rand64 = \"\";\r\n $salt = \"\";\r\n $random = rand(); // Seeded via initialize()\r\n // Crypt(3) can only handle A-Z a-z ./\r\n $rand64 = \"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\";\r\n $salt = substr( $rand64, $random % 64, 1 ) . substr( $rand64, ($random / 64) % 64, 1 );\r\n $salt = substr( $salt, 0, 2 ); // Just in case\r\n return($salt);\r\n }", "function generateSaltPassword () {\n\treturn base64_encode(random_bytes(12));\n}", "function salt($len=16) {\n $pool = range('!', '~');\n $high = count($pool) - 1;\n $tmp = '';\n for ($c = 0; $c < $len; $c++) {\n $tmp .= $pool[rand(0, $high)];\n }\n return $tmp;\n}", "public function createSalt()\n{\n\t$pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';\n\n\treturn substr(str_shuffle(str_repeat($pool, 5)), 0, $this->saltLength);\n}", "function createSalt()\n{\n $text = uniqid(Rand(), TRUE);\n return substr($text, 0, 5);\n\n}", "function getPasswordSalt(){\n\t\treturn substr( str_pad( dechex( mt_rand() ), 8, '0', STR_PAD_LEFT ), -8 );\n\t}", "private function generateSalt() {\n $salt = base64_encode(pack(\"H*\", md5(microtime())));\n \n return substr($salt, 0, $this->saltLng);\n }", "function generate_salt($len = 5) {\n $valid_characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890@#$%^*()_-!';\n $valid_len = strlen($valid_characters) - 1;\n $salt = \"\";\n\n for ($i = 0; $i < $len; $i++) {\n $salt .= $valid_characters[rand(0, $valid_len)];\n }\n\n return $salt;\n}", "static function generateSalt($strength=10) {\n return self::saltStart($strength) . random_string(22, './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz');\n }", "public static function regenerateSalt()\n\t{\n\t\treturn PzPHP_Helper_String::createCode(mt_rand(40,45), PzPHP_Helper_String::ALPHANUMERIC_PLUS);\n\t}", "function generateSalt() {\n\t$numberOfDesiredBytes = 16;\n\t$salt = random_bytes($numberOfDesiredBytes);\n\treturn $salt;\n}", "private function generateSalt(): string\n {\n return base64_encode(random_bytes(16));\n }", "private function generateSalt(): string\n {\n return base64_encode(random_bytes(16));\n }", "function generate_salt($length = 16)\n {\n $possible_chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012345678';\n $rand_string = '';\n for($i = 0; $i < $length; ++$i)\n {\n $rand_string .= $possible_chars[random_int(0, strlen($possible_chars) - 1)];\n }\n return utf8_encode($rand_string);\n }", "function makeSalt() {\r\n static $seed = \"./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\r\n $algo = (PHP_VERSION_ID >= 50307) ? '$2y' : '$2a'; //DON'T CHANGE THIS!!\r\n $strength = '$12'; //too high will time out script.\r\n $salt = '$';\r\n for ($i = 0; $i < 22; $i++) {\r\n $salt .= substr($seed, mt_rand(0, 63), 1);\r\n }\r\n return $algo . $strength . $salt;\r\n}", "public static function generateSalt() {\n $salt = '$2a$13$';\n $salt = $salt . md5(mt_rand());\n return $salt;\n }", "function createSalt()\r\n\r\n{\r\n\r\n $string = md5(uniqid(rand(), true));\r\n\r\n return substr($string, 0, 5);\r\n\r\n}", "private function genSalt()\n {\n \treturn md5(time() + rand());\n }", "function createSalt(){\r\n \t\t\t$string = md5(uniqid(rand(), true));\r\n \t\treturn substr($string, 0, 3);\r\n\t\t}", "function createSalt()\n {\n $string = md5(uniqid(rand(), true));\n return substr($string, 0, 3);\n }", "public function genSalt($length = 5)\n {\n if ($length < 1) { return; }\n $slt = '';\n $min = sfConfig::get('app_min_salt_char');\n $max = sfConfig::get('app_max_salt_char');\n for ($i = 0; $i < $length; $i++)\n {\n $slt .= chr(rand($min, $max));\n }\n return $slt;\n }", "public function salt() {\r\n return substr(md5(uniqid(rand(), true)), 0, 10);\r\n }", "function makeSalt() {\n $string = md5(uniqid(rand(), true));\n return substr($string, 0, 3);\n}", "protected function _create_salt()\n\t{\n\t\t$this->CI->load->helper('string');\n\t\treturn sha1(random_string('alnum', 32));\n\t}", "function SecureSalt() \t{\n\treturn substr(sha1(uniqid(rand(),true)),0,40);\n}", "public static function unique_salt() {\r\n\t\treturn substr(sha1(mt_rand()),0,22);\r\n\t}", "public function createSalt () {\n srand(time());\t\t\t\t\n $pool = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n for($index = 0; $index < 2; $index++) {\n $sid .= substr($pool,(rand()%(strlen($pool))), 1);\n }\n return $sid; \n }", "function generateSalt() {\n return str_shuffle(sha1(uniqid(mt_rand(), true)).md5(uniqid(mt_rand(), true)));\n}", "private function generateSalt($max = 15) \r\n\t{\r\n\t\t$characterList = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%&*?\";\r\n $i = 0;\r\n $salt = \"\";\r\n while ($i < $max) {\r\n $salt .= $characterList{mt_rand(0, (strlen($characterList) - 1))};\r\n $i++;\r\n }\r\n return $salt;\r\n\t}", "function generateSalt($bytes = '16'){\n\treturn mcrypt_create_iv($bytes, MCRYPT_RAND);\n}", "function getRandomeSalt() {\r\n $salt = mcrypt_create_iv(23, MCRYPT_DEV_URANDOM);\r\n $salt = base64_encode($salt);\r\n $salt = str_replace('+', '.', $salt);\r\n return $salt;\r\n}", "function generateFixedSalt32Byte()\r\n{\r\n return \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\";\r\n}", "function generate_salt($length){\n //Unique random string from mt_random and md5 hashing\n //returns 32 characters\n $unique_random_string=md5(uniqid(mt_rand(),true));\n //Valid characters only [a-zA-Z0-9./]\n $base64_string=base64_encode($unique_random_string);\n //Replace '+' with '.'\n $modified_base64_string=str_replace('+','.',$base64_string);\n //first 22 characters\n $salt=substr($modified_base64_string,0,$length);\n return $salt;\n }", "protected function generateSalt()\n\t{\n\t\treturn uniqid('',true);\n\t}", "function get_salt($length) {\n \n $options = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789./';\n $salt = '';\n for ($i = 0; $i <= $length; $i ++) {\n $options = str_shuffle ( $options );\n $salt .= $options [rand ( 0, 63 )];\n }\n return $salt;\n }", "public function genSalt(){\n return mcrypt_create_iv(16, MCRYPT_DEV_URANDOM);\n }", "protected function salt() {\n\t\treturn substr(md5(uniqid(rand(), true)), 0, $this->config->item('salt_length'));\n\t}", "public static function generateSalt() {\r\n\t\treturn uniqid('', true);\r\n\t}", "public static function uniqueSalt() {\n return substr(sha1(mt_rand()), 0, 22);\n }", "function salt()\r\n{\r\n\t//return mcrypt_create_iv( 32 );\r\n\r\n\t$string = md5(uniqid(rand(), true));\r\n\treturn substr( $string, 0, 3 );\r\n}", "public function generateSalt() {\n // A salt is randomly generated here to protect again brute force attacks\n // and rainbow table attacks. The following statement generates a hex\n // representation of an 8 byte salt. Representing this in hex provides\n // no additional security, but makes it easier for humans to read.\n // For more information:\n // http://en.wikipedia.org/wiki/Salt_%28cryptography%29\n // http://en.wikipedia.org/wiki/Brute-force_attack\n // http://en.wikipedia.org/wiki/Rainbow_table\n $this->salt = dechex(mt_rand(0, 2147483647)) . dechex(mt_rand(0, 2147483647));\n return $this->salt;\n }", "private function getUniqueSalt() {\n /* To generate the salt, first generate enough random bytes. Because\n * base64 returns one character for each 6 bits, so we should generate\n * at least 22*6/8 = 16.5 bytes, so we generate 17 bytes. Then we get the first\n * 22 base64 characters\n */\n\n /* As blowfish takes a salt with the alphabet ./A-Za-z0-9 we have to\n * replace any '+', '=' in the base64 string with '..'.\n */\n $random = base64_encode(openssl_random_pseudo_bytes(17));\n //take only the first 22 caracters\n $random = substr($random, 0, 22);\n\n //replace +,= by .\n return strtr($random, '+=', '..');\n }", "function generateFixedSalt16Byte()\r\n{\r\n return \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\";\r\n}", "static public function generateVbPasswordSalt()\n {\n\t\t$hashSalt = '';\n\t\tfor ($i = 0; $i < 3; $i++)\n\t\t{\n\t\t\t$hashSalt .= chr(rand(0x41, 0x5A)); // A..Z\n\t\t}\n\t\t\n\t\treturn $hashSalt;\n }", "public static function generateSalt($length=20) {\n $haystack = '012345678'\n . 'abcdefghijklmnopqrstuvwxyz'\n . 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'\n . '~,./<>?!@#%^&*_+-=;: ';\n $iLen = strlen($haystack);\n $result = '';\n\n mt_srand((double) microtime() * 1000000);\n for ( $i=0; $i<$length; $i++ ) {\n $result .= substr($haystack, (mt_rand() % ($iLen)), 1);\n }\n return($result);\n }", "function getSalt(){\n $inside = time() . \"az51\" . time(); \n $salt = '$2a$07$' . $inside . '$';\n return $salt;\n }", "private function getSalt() \n {\n /**\n * the base64 function uses +'s and ending ='s; translate the first, and cut out the latter\n */\n return sprintf('$2a$%02d$%s', $this->rounds, substr(strtr(base64_encode($this->getBytes()), '+', '.'), 0, 22));\n }", "function gen_salt($salt_length=22)\n\t{\n\t\t$raw_salt_len = 16;\n \t\t$buffer = '';\n $buffer_valid = false;\n\n\t\tif (function_exists('mcrypt_create_iv') && !defined('PHALANGER')) {\n\t\t\t$buffer = mcrypt_create_iv($raw_salt_len, MCRYPT_DEV_URANDOM);\n\t\t\tif ($buffer) {\n\t\t\t\t$buffer_valid = true;\n\t\t\t}\n\t\t}\n\n\t\tif (!$buffer_valid && function_exists('openssl_random_pseudo_bytes')) {\n\t\t\t$buffer = openssl_random_pseudo_bytes($raw_salt_len);\n\t\t\tif ($buffer) {\n\t\t\t\t$buffer_valid = true;\n\t\t\t}\n\t\t}\n\n\t\tif (!$buffer_valid && @is_readable('/dev/urandom')) {\n\t\t\t$f = fopen('/dev/urandom', 'r');\n\t\t\t$read = strlen($buffer);\n\t\t\twhile ($read < $raw_salt_len) {\n\t\t\t\t$buffer .= fread($f, $raw_salt_len - $read);\n\t\t\t\t$read = strlen($buffer);\n\t\t\t}\n\t\t\tfclose($f);\n\t\t\tif ($read >= $raw_salt_len) {\n\t\t\t\t$buffer_valid = true;\n\t\t\t}\n\t\t}\n\n\t\tif (!$buffer_valid || strlen($buffer) < $raw_salt_len) {\n\t\t\t$bl = strlen($buffer);\n\t\t\tfor ($i = 0; $i < $raw_salt_len; $i++) {\n\t\t\t\tif ($i < $bl) {\n\t\t\t\t\t$buffer[$i] = $buffer[$i] ^ chr(mt_rand(0, 255));\n\t\t\t\t} else {\n\t\t\t\t\t$buffer .= chr(mt_rand(0, 255));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t$salt = $buffer;\n\n\t\t// encode string with the Base64 variant used by crypt\n\t\t$base64_digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n\t\t$bcrypt64_digits = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n\t\t$base64_string = base64_encode($salt);\n\t\t$salt = strtr(rtrim($base64_string, '='), $base64_digits, $bcrypt64_digits);\n\n\t\t$salt = substr($salt, 0, $salt_length);\n\n\t\treturn $salt;\n\t}", "function get_salt($length) {\r\n\r\n\t\t\t\t$options = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789./';\r\n\t\t\t\t$salt = '';\r\n\r\n\t\t\t\tfor ($i = 0; $i <= $length; $i++) {\r\n\t\t\t\t\t$options = str_shuffle($options);\r\n\t\t\t\t\t$salt .= $options[rand(0, 63)];\r\n\t\t\t\t}\r\n\t\t\t\treturn $salt;\r\n\t\t\t}", "function generate_salt($length) {\n // MD5 returns 32 characters\n $unique_random_string = md5(uniqid(mt_rand(), true));\n \n\t// Valid characters for a salt are [a-zA-Z0-9./]\n $base64_string = base64_encode($unique_random_string);\n \n\t// But not '+' which is valid in base64 encoding\n $modified_base64_string = str_replace('+', '.', $base64_string);\n \n\t// Truncate string to the correct length\n $salt = substr($modified_base64_string, 0, $length);\n \n\treturn $salt;\n}", "function generate_salt($length){\n\t\t$unique_random_string = md5(uniqid(mt_rand(), true));\n\n\t\t// Vaild charcter for a salt are (a-zA-z0-9./)\n\t\t$base64_string = base64_encode($unique_random_string);\n\n\t\t// But not '+' which is vaild in base64 encoding\n\t\t$modified_base64_string = str_replace('+', '.', $base64_string);\n\n\t\t// Truncate string to the correct length\n\t\t$salt = substr($modified_base64_string, 0, $length);\n\t\treturn $salt;\n\t}", "public static function generateRandomSalt() {\n\t\t// Salt seed\n\t\t$seed = uniqid(mt_rand(), true);\n \n\t\t// Generate salt\n\t\t$salt = base64_encode($seed);\n\t\t$salt = str_replace('+', '.', $salt);\n \n\t\treturn substr($salt, 0, self::$_saltLength);\n\t}", "protected function generateSalt() {\n return uniqid('', true);\n }", "public static function gen_salt($length = 32)\n {\n $alpha_digits = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';\n $alpha_digits_len = strlen($alpha_digits) - 1;\n\n $salt = '';\n for ($i = 0; $i < $length; $i++) {\n $salt .= $alpha_digits[mt_rand(0, $alpha_digits_len)];\n }\n\n return $salt;\n }", "function makeRandomPassword() { \n $salt = \"abchefghjkmnpqrstuvwxyz0123456789\"; \n srand((double)microtime()*1000000); \n $i = 0; \n while ($i <= 7) { \n $num = rand() % 33; \n $tmp = substr($salt, $num, 1); \n $pass = $pass . $tmp; \n $i++; \n } \n return $pass; \n}", "function generate_salt($length){\n\t//MD5 returns 32 characters\n\t$unique_random_string=md5(uniqid(mt_rand(),true));\n\t\n\t//valid characters for a salt are [a-zA-Z0-9./]\n\t//base64 code returns + instead of .\n\t$base64_string=base64_encode($unique_random_string);\n\t\n\t//But not '+' which is valid in base64 encoding\n\t$modified_base64_string=str_replace('+', '.' ,$base64_string);\n\t\n\t//Truncate string to the correct length\n\t$salt=substr($modified_base64_string,0,$length);\n\t\n\treturn $salt;\n}", "function gen_mix_salt($pass) {\n $salt = generate_salt();\n return mix_salt($salt, $pass);\n}", "function fetch_user_salt($length = 3)\n{\n\t$salt = '';\n\tfor ($i = 0; $i < $length; $i++)\n\t{\n\t\t$salt .= chr(rand(32, 126));\n\t}\n\treturn $salt;\n}", "public static function generateRandomSalt()\n {\n $seed = uniqid(mt_rand(), true);\n $salt = base64_encode($seed);\n $salt = str_replace('+', '.', $salt);\n return substr($salt, 0, self::$saltLength);\n }", "function makeRandomPassword() {\r\n\t$salt = \"abchefghjkmnpqrstuvwxyz0123456789\";\r\n\t$pass = \"\";\r\n\tsrand((double)microtime()*1000000);\r\n \t$i = 0;\r\n \twhile ($i <= 7) {\r\n\t\t$num = rand() % 33;\r\n\t\t$tmp = substr($salt, $num, 1);\r\n\t\t$pass = $pass . $tmp;\r\n\t\t$i++;\r\n \t}\r\n \treturn $pass;\r\n}", "function getNewSalt($length = 10, $keyspace = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'){\n $str = '';\n $max = mb_strlen($keyspace, '8bit') - 1;\n for ($i = 0; $i < $length; ++$i) {\n //$str .= $keyspace[random_int(0, $max)]; // Fuck this shit for now, I'm in a hurry, so rand() it is\n $str .= $keyspace[rand(0, $max)];\n }\n\n return md5($str);\n }", "public function GenerateKey()\n // Generates a 22 character salt.\n {\n $this->_SALT = \"$\";\n for($i = 0; $i < 22; $i ++)\n $this->_SALT = $this->_SALT . $this->_CHARSET[mt_rand(0, 63)];\n return $this->_SALT;\n }", "function generate_salt($length) {\n\t // MD5 returns 32 characters\n $unique_random_string = md5(uniqid(mt_rand(), true));\n\t \n\t\t// Valid characters for a salt are [a-zA-Z0-9./]\n\t$base64_string = base64_encode($unique_random_string);\n\t \n\t\t// But not '+' which is valid in base64 encoding\n\t$modified_base64_string = str_replace('+', '.', $base64_string);\n\t \n\t\t// Truncate string to the correct length\n\t$salt = substr($modified_base64_string, 0, $length);\n\t \n\treturn $salt;\n }", "public static function makeSalt()\n\t\t{\n\n\t\t\treturn uniqid(mt_rand(), true);\n\t\t}", "function generate_salt($length) {\n\t// MD5 returns 32 characters\n\t$unique_random_string = md5(uniqid(mt_rand(), true));\n\n\t// Valid characters for a salt are [a-zA-Z0-9./]\n\t$base64_string = base64_encode($unique_random_string);\n\n\t// But not '+' which is valid in base64 encoding\n\t$modified_base64_string = str_replace('+', '.', $base64_string);\n\n\t// Truncate string to the correct length\n\t$salt = substr($modified_base64_string, 0, $length);\n\n\treturn $salt;\n}", "public static function passTheSalt(): string\n {\n return (string) bin2hex(openssl_random_pseudo_bytes(16));\n }", "function generate_salt($length) {\n\t # MD5 returns 32 characters\n\t $unique_random_string = md5(uniqid(mt_rand(), true));\n\t \n\t # Valid characters for a salt are [a-zA-Z0-9./]\n\t $base64_string = base64_encode($unique_random_string);\n\t \n\t # Replace '+' with '.' from the base64 encoding\n\t $modified_base64_string = str_replace('+', '.', $base64_string);\n\t \n\t # Truncate string to the correct length\n\t $salt = substr($modified_base64_string, 0, $length);\n\t \n\t\treturn $salt;\n\t}", "function generate_salt($length) {\n\t // MD5 returns 32 characters\n\t $unique_random_string = md5(uniqid(mt_rand(), true));\n\t \n\t\t// Valid characters for a salt are [a-zA-Z0-9./]\n\t $base64_string = base64_encode($unique_random_string);\n\t \n\t\t// But not '+' which is valid in base64 encoding\n\t $modified_base64_string = str_replace('+', '.', $base64_string);\n\t \n\t\t// Truncate string to the correct length\n\t $salt = substr($modified_base64_string, 0, $length);\n\t \n\t\treturn $salt;\n\t}", "function generate_salt($length) {\n\t // MD5 returns 32 characters\n\t $unique_random_string = md5(uniqid(mt_rand(), true));\n\t \n\t\t// Valid characters for a salt are [a-zA-Z0-9./]\n\t $base64_string = base64_encode($unique_random_string);\n\t \n\t\t// But not '+' which is valid in base64 encoding\n\t $modified_base64_string = str_replace('+', '.', $base64_string);\n\t \n\t\t// Truncate string to the correct length\n\t $salt = substr($modified_base64_string, 0, $length);\n\t \n\t\treturn $salt;\n\t}", "function generatePassword() {\n // 57 prefixes\n $aPrefix = array('aero', 'anti', 'ante', 'ande', 'auto', \n 'ba', 'be', 'bi', 'bio', 'bo', 'bu', 'by', \n 'ca', 'ce', 'ci', 'cou', 'co', 'cu', 'cy', \n 'da', 'de', 'di', 'duo', 'dy', \n 'eco', 'ergo', 'exa', \n 'geo', 'gyno', \n 'he', 'hy', 'ki',\n 'intra', \n 'ma', 'mi', 'me', 'mo', 'my', \n 'na', 'ni', 'ne', 'no', 'ny', \n 'omni', \n 'pre', 'pro', 'per', \n 'sa', 'se', 'si', 'su', 'so', 'sy', \n 'ta', 'te', 'tri',\n 'uni');\n\n // 30 suffices\n $aSuffix = array('acy', 'al', 'ance', 'ate', 'able', 'an', \n 'dom', \n 'ence', 'er', 'en',\n 'fy', 'ful', \n 'ment', 'ness',\n 'ist', 'ity', 'ify', 'ize', 'ise', 'ible', 'ic', 'ical', 'ous', 'ish', 'ive', \n 'less', \n 'sion',\n 'tion', 'ty', \n 'or');\n\n // 8 vowel sounds \n $aVowels = array('a', 'o', 'e', 'i', 'y', 'u', 'ou', 'oo'); \n\n // 20 random consonants \n $aConsonants = array('w', 'r', 't', 'p', 's', 'd', 'f', 'g', 'h', 'j', \n 'k', 'l', 'z', 'x', 'c', 'v', 'b', 'n', 'm', 'qu');\n\n // Some consonants can be doubled\n $aDoubles = array('n', 'm', 't', 's');\n\n // \"Salt\"\n $aSalt = array('!', '#', '%', '?');\n\n $pwd = $aPrefix[array_rand($aPrefix)];\n\n // add random consonant(s)\n $c = $aConsonants[array_rand($aConsonants)];\n if ( in_array( $c, $aDoubles ) ) {\n // 33% chance of doubling it\n if (rand(0, 2) == 1) { \n $c .= $c;\n }\n }\n $pwd .= $c;\n\n // add random vowel\n $pwd .= $aVowels[array_rand($aVowels)];\n\n $pwdSuffix = $aSuffix[array_rand($aSuffix)];\n // If the suffix begins with a vovel, add one or more consonants\n if ( in_array( $pwdSuffix[0], $aVowels ) ) {\n $pwd .= $aConsonants[array_rand($aConsonants)];\n }\n $pwd .= $pwdSuffix;\n\n $pwd .= rand(2, 999);\n # $pwd .= $aSalt[array_rand($aSalt)];\n\n // 50% chance of capitalizing the first letter\n if (rand(0, 1) == 1) {\n $pwd = ucfirst($pwd);\n }\n return $pwd;\n }", "function salt_hmac($size1=4,$size2=6) {\n$hprand = rand(4,6); $i = 0; $hpass = \"\";\nwhile ($i < $hprand) {\n$hspsrand = rand(1,2);\nif($hspsrand!=1&&$hspsrand!=2) { $hspsrand=1; }\nif($hspsrand==1) { $hpass .= chr(rand(48,57)); }\nif($hspsrand==2) { $hpass .= chr(rand(65,70)); }\n++$i; } return $hpass; }", "function generateRandomPassword(){\n $n = 10;\n $result = bin2hex(random_bytes($n));\n return $result;\n }", "public function generateAuthKey()\n {\n $this->salt = OldDi::GetString(8);\n }", "function gen_salt($algo) {\n switch($algo) {\n case 'sha256':\n return base64_encode(mcrypt_create_iv (192, MCRYPT_DEV_RANDOM));\n // per man 3 crypt the salt is a maximum of 16 characters\n // and the salt character set is [a–zA–Z0–9./]\n // this is less than the rule of thumb for larger hash sizes\n // handle it as a separate case\n case 'crypt-sha256':\n $iv = mcrypt_create_iv (96, MCRYPT_DEV_RANDOM);\n return str_replace('+', '.', base64_encode($iv));\n }\n return false;\n}", "protected function _createSalt()\n {\n return (\\function_exists('random_bytes')) ? random_bytes(16) : mcrypt_create_iv(16, \\MCRYPT_DEV_URANDOM);\n }", "function generate_user_password()\n{\n $chars = \"0123456789abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ\";\n\n srand((double)microtime()*1000000);\n $code = \"\";\n \n for ($i = 0; $i < 6; $i++)\n {\n $num = rand() % 60;\n $tmp = substr($chars, $num, 1);\n $code = $code . $tmp;\n }\n return $code;\n}", "function generate_salt($length) {\r\n\t\t// Not 100% unique, not 100% random, but good enough for a salt\r\n\t\t// MD5 returns 32 characters (more than the 22 we will need for our Blowfish hashing in our password encryption\r\n\t\t$unique_random_string = md5(uniqid(mt_rand(), true));\r\n\t\t\r\n\t\t// Valid characters for a salt are [a-zA-Z0-9./]\r\n\t\t// Base64 will transform our string into these characters, but also '+'s\r\n\t\t$base64_string = base64_encode($unique_random_string);\r\n\t\t\r\n\t\t// But not '+' which is valid in base 64 encoding, so to change those:\r\n\t\t$modified_base64_string = str_replace('+', '.', $base64_string);\r\n\t\t\r\n\t\t// Truncate string to the correct length\r\n\t\t$salt = substr($modified_base64_string, 0, $length);\r\n\t\t\r\n\t\treturn $salt;\r\n\t}", "public function generateRandomSalt()\n {\n $salt = null;\n\n if (function_exists('openssl_random_pseudo_bytes')) {\n $salt = openssl_random_pseudo_bytes(16);\n }\n\n if (is_null($salt)) {\n $salt = sha1(microtime(), true);\n }\n\n $salt = base64_encode($salt);\n $salt = strtr($salt, '+', '.');\n\n return substr($salt, 0, 22);\n }", "protected static function _generateSaltMd5() {\n\t\treturn '$1$' . Random::generate(6, ['encode' => Random::ENCODE_BASE_64]);\n\t}", "public function getSalt()\n {\n return md5(random_bytes(50));\n }", "function generarPassword() {\n\t\t$str = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890\";\n\t\t$cad = \"\";\n\t\tfor ($i = 0; $i < 8; $i++) {\n\t\t\t$cad .= substr($str, rand(0, 62), 1);\n\t\t}\n\t\treturn $cad;\n\t}", "public function getSalt() {\n\t\t$salt = mcrypt_create_iv(22, MCRYPT_DEV_URANDOM);\t\t\t\t\t\t\t\t\t// creates an initialization vector from a 22 characters and /dev/random\n\t\t$salt = base64_encode($salt);\n\t\t$salt = str_replace('+', '.', $salt);\n\t\treturn $salt;\n\t}", "public static function generatePassword()\n\t{\n\t\t$consonants = array(\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\");\n\t\t$vocals = array(\"a\", \"e\", \"i\", \"o\", \"u\");\n\n\t\t$password = '';\n\n\t\tsrand((double)microtime() * 1000000);\n\t\tfor ($i = 1; $i <= 4; $i++) {\n\t\t\t$password .= $consonants[rand(0, 19)];\n\t\t\t$password .= $vocals[rand(0, 4)];\n\t\t}\n\t\t$password .= rand(0, 9);\n\n\t\treturn $password;\n\t}", "abstract protected function getGeneratedSalt() ;", "function salt(int $salt_length=22)\n\t{\n\n\t\t$raw_salt_len = 16;\n\n \t\t$buffer = '';\n $buffer_valid = false;\n\n if (function_exists('mcrypt_create_iv') && !defined('PHALANGER')) {\n $buffer = mcrypt_create_iv($raw_salt_len, MCRYPT_DEV_URANDOM);\n if ($buffer) {\n $buffer_valid = true;\n }\n }\n\n if (!$buffer_valid && function_exists('openssl_random_pseudo_bytes')) {\n $buffer = openssl_random_pseudo_bytes($raw_salt_len);\n if ($buffer) {\n $buffer_valid = true;\n }\n }\n\n if (!$buffer_valid && @is_readable('/dev/urandom')) {\n $f = fopen('/dev/urandom', 'r');\n $read = strlen($buffer);\n while ($read < $raw_salt_len) {\n $buffer .= fread($f, $raw_salt_len - $read);\n $read = strlen($buffer);\n }\n fclose($f);\n if ($read >= $raw_salt_len) {\n $buffer_valid = true;\n }\n }\n\n if (!$buffer_valid || strlen($buffer) < $raw_salt_len) {\n $bl = strlen($buffer);\n for ($i = 0; $i < $raw_salt_len; $i++) {\n if ($i < $bl) {\n $buffer[$i] = $buffer[$i] ^ chr(mt_rand(0, 255));\n } else {\n $buffer .= chr(mt_rand(0, 255));\n }\n }\n }\n\n $salt = $buffer;\n\n // encode string with the Base64 variant used by crypt\n $base64_digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n $bcrypt64_digits = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n $base64_string = base64_encode($salt);\n $salt = strtr(rtrim($base64_string, '='), $base64_digits, $bcrypt64_digits);\n\n\t $salt = substr($salt, 0, $salt_length);\n\n\n\t\treturn $salt;\n\n\t}", "public static function generatePassword() {\n\t\t$consonants = array (\n\t\t\t\t\"b\",\n\t\t\t\t\"c\",\n\t\t\t\t\"d\",\n\t\t\t\t\"f\",\n\t\t\t\t\"g\",\n\t\t\t\t\"h\",\n\t\t\t\t\"j\",\n\t\t\t\t\"k\",\n\t\t\t\t\"l\",\n\t\t\t\t\"m\",\n\t\t\t\t\"n\",\n\t\t\t\t\"p\",\n\t\t\t\t\"r\",\n\t\t\t\t\"s\",\n\t\t\t\t\"t\",\n\t\t\t\t\"v\",\n\t\t\t\t\"w\",\n\t\t\t\t\"x\",\n\t\t\t\t\"y\",\n\t\t\t\t\"z\" \n\t\t);\n\t\t$vocals = array (\n\t\t\t\t\"a\",\n\t\t\t\t\"e\",\n\t\t\t\t\"i\",\n\t\t\t\t\"o\",\n\t\t\t\t\"u\" \n\t\t);\n\t\t\n\t\t$password = '';\n\t\t\n\t\tsrand ( ( double ) microtime () * 1000000 );\n\t\tfor($i = 1; $i <= 4; $i ++) {\n\t\t\t$password .= $consonants [rand ( 0, 19 )];\n\t\t\t$password .= $vocals [rand ( 0, 4 )];\n\t\t}\n\t\t$password .= rand ( 0, 9 );\n\t\t\n\t\treturn $password;\n\t}", "function generateHash($plainText, $salt = null) // used in confirm-password.php, class.newuser.php, class.user.php, user-login.php, user-update-account.php\r\n\r\n{\r\n\r\n\tif ($salt === null)\r\n\r\n\t{\r\n\r\n\t\t$salt = substr(md5(uniqid(rand(), true)), 0, 25);\r\n\r\n\t}\r\n\r\n\telse\r\n\r\n\t{\r\n\r\n\t\t$salt = substr($salt, 0, 25);\r\n\r\n\t}\r\n\r\n\t\r\n\r\n\treturn $salt . sha1($salt . $plainText);\r\n\r\n}", "function salt_and_encrypt($password) {\n\t$hash_format=\"$2y$10$\";\n\t$salt_length=22;\n\t$salt=generate_salt($salt_length);\n\t$format_and_salt=$hash_format.$salt;\n\t$hash=crypt($password,$format_and_salt);\t\n\treturn $hash;\n}", "function randomPassword()\n{\n\n$digit = 6;\n$karakter = \"ABCDEFGHJKLMNPQRSTUVWXYZ23456789\";\n\nsrand((double)microtime()*1000000);\n$i = 0;\n$pass = \"\";\nwhile ($i <= $digit-1)\n{\n$num = rand() % 32;\n$tmp = substr($karakter,$num,1);\n$pass = $pass.$tmp;\n$i++;\n}\nreturn $pass;\n}", "function passgen() {\r\n\t$pw = '';\r\n\t$pw_lenght = 8;\r\n $zeichen = \"0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z\";\r\n $array_b = explode(\",\",$zeichen);\r\n for($i=0;$i<$pw_lenght;$i++) {\r\n \tsrand((double)microtime()*1000000);\r\n $z = rand(0,25);\r\n $pw .= \"\".$array_b[$z].\"\";\r\n }\r\n\treturn $pw;\r\n}", "public function genaratepassword() {\r\r\n $length = 10;\r\r\n $alphabets = range('A', 'Z');\r\r\n $numbers = range('0', '9');\r\r\n $additional_characters = array('1', '3');\r\r\n $final_array = array_merge($alphabets, $numbers, $additional_characters);\r\r\n $password = '';\r\r\n while ($length--) {\r\r\n $key = array_rand($final_array);\r\r\n $password .= $final_array[$key];\r\r\n }\r\r\n return $password;\r\r\n }", "function generate_random_password($len = 8)\n {\n }", "function createPasswordSalt() {\n\t\t$userSystem = new SpotUserSystem($this->_db, $this->_settings);\n\t\t$salt = $userSystem->generateUniqueId() . $userSystem->generateUniqueId();\n\t\t\n\t\t$this->setIfNot('pass_salt', $salt);\n\t}" ]
[ "0.8620291", "0.86027485", "0.8424969", "0.83353364", "0.8298978", "0.8280773", "0.8258466", "0.82321376", "0.82104486", "0.8195782", "0.81943995", "0.8189444", "0.8149346", "0.81050533", "0.8100473", "0.80642945", "0.80625105", "0.80612385", "0.8059442", "0.8059442", "0.8057777", "0.8038006", "0.80339867", "0.7967363", "0.7946547", "0.7943235", "0.790682", "0.78982365", "0.7894826", "0.78842527", "0.78543746", "0.7824564", "0.78221023", "0.7761074", "0.7756119", "0.7752431", "0.77100414", "0.77024204", "0.7689183", "0.76823646", "0.7679568", "0.7672929", "0.76526964", "0.7652183", "0.76498693", "0.7647882", "0.7639005", "0.76381665", "0.76254267", "0.76116127", "0.7606729", "0.75737673", "0.7544111", "0.7542884", "0.75409436", "0.75296736", "0.75187117", "0.7516357", "0.7511487", "0.7490889", "0.74829257", "0.7477822", "0.74382097", "0.74329424", "0.74251455", "0.74226344", "0.7420909", "0.7417758", "0.74157214", "0.74079037", "0.7407735", "0.7401955", "0.7388635", "0.7361932", "0.73334", "0.73334", "0.73018837", "0.7301802", "0.7295555", "0.7274822", "0.72319335", "0.72100073", "0.7201679", "0.7200758", "0.71927524", "0.7118097", "0.7115107", "0.7100684", "0.7078156", "0.703477", "0.7033969", "0.7021897", "0.7013698", "0.7005963", "0.7005938", "0.7003026", "0.69907135", "0.69865024", "0.6979973", "0.69772416" ]
0.863523
0
/ Validate a member login from data in a MySQL Database.
public function verifyLogin($username, $password) { if(empty($username) || empty($password)) { throw new Exception("One or more fields are empty"); } else { $dbModel = $GLOBALS['db']; $result = $dbModel->select('*','user'," WHERE username='".$username."'"); if($row = mysql_fetch_array($result)){ if ($password == $this->matchPassword($password, $row['password'])) { $admin = false; $adminresult = $dbModel->select('*','admin'," WHERE userid='".$row['id']."'"); if(mysql_num_rows($adminresult)){ $admin = true; } $this->setSessions($row['id'],$admin); return $row['id']; } else { throw new Exception("Wrong password or username, please try again"); } } } mysql_free_result($result); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function memberLoginHandler() {\n global $inputs;\n\n $username = $inputs['username'];\n $password = $inputs['password'];\n $sql = 'select * from `member` where name = ? and password = ?';\n $res = getOne($sql, [$username, $password]);\n\n if (!$res) {\n formatOutput(false, 'username or password error');\n } else {\n setMemberLogin($res['id']);\n formatOutput(true, 'login success', $res);\n }\n}", "function validateLogin($user,$pass,$database)\n{\n $sql_query = 'SELECT * FROM USER WHERE user_id = \"'.$user.'\" AND password = \"'.$pass.'\"';\n return mysql_query($sql_query,$database);\n}", "public function validateLogin(){\n // store fieldnames inside the $fieldnames variable\n $fieldnames = ['email', 'password'];\n\n // initialize $error variable and set it as FALSE\n $error = FALSE;\n\n // for each $fieldname, check if its set or empty, if the fieldname is not set or empty then set $error as TRUE\n foreach($fieldnames as $fieldname){\n if(!isset($_POST[$fieldname]) || empty($_POST[$fieldname])){\n $error = TRUE;\n }\n }\n\n // if $error is FALSE\n if(!$error){\n // create variables with $_POST data\n $email = $_POST[\"email\"];\n $wachtwoord = $_POST[\"password\"];\n\n // create new db connection \n $db = new Db('localhost', 'root', '', 'project1', 'utf8');\n\n // login the user\n $db->login($email, $wachtwoord);\n } else{\n // if $error is equal to TRUE then echo Verkeerd wachtwoord of username\n echo '<label>Verkeerd wachtwoord of username</label>';\n }\n }", "public function validateLogin() {\n if (isset($_POST['submit'])) {\n $errors = array();\n\n $required_fields = array('username', 'password');\n $errors = array_merge($errors, checkRequiredFields($required_fields));\n\n $username = trim($_POST['username']);\n $password = trim($_POST['password']);\n\n if (empty($errors)) {\n $conn = CTSQLite::connect();\n\n\n //check database if user and password exist\n $query = \"SELECT id, username ,role \";\n $query .= \"FROM ic_user \";\n $query .= \"WHERE username = '{$username}' \";\n $query .= \"password = '{$password}' \";\n $query .= \"LIMIT 1\";\n\n $result = $conn->query($query);\n confirm_query($result);\n\n if (sqlite_num_rows($result) == 1) {\n $user = $result->fetchArray();\n $role = $user['role'];\n CT::user()->setRole($role);\n }\n } else {\n if (count($errors) == 1) {\n // 1 error ocurred\n $message = \"There was 1 error in the form\";\n } else {\n //more than 1 error occured\n $message = \"There were\" . count($errors) . \"errors in the form\";\n }\n }\n } else {\n //form has not been submitted\n }\n }", "function validateLogin($data)\r\n\t{\r\n\t\t$user = $this->find(array('username' => $data['username'], 'password' => sha1($data['password'])), array('id', 'username'));\r\n\t\tif(empty($user) == false)\r\n\t\t\treturn $user['User'];\r\n\t\treturn false;\r\n\t}", "function validate_cred($email_local = null, $password_local = null){\n global $email;\n global $pwd;\n if ($email_local != null && $password_local != null){\n \n }\n else{\n $email_local = isset($_REQUEST[$email]) ? $_REQUEST[$email] : null;\n $password_local = isset($_REQUEST[$pwd]) ? $_REQUEST[$pwd] : null;\n \n }\n\n if ($email_local != null && $password_local != null){\n $conn = open_db_connection('localhost', ['new_user','Redbirdp1'], 'login');\n if ($conn ->connect_errno){\n echo('connection failed: ' . $conn->connect_error);\n }\n $statement = new Statement();\n // $statement->select([\"*\"])->from()->table(\"members\")->where(\"username\")->equals($email_local);\n $statement->select([\"*\"])->from()->table(\"members\");\n //echo $statement->get_statement();\n $result = query_db($conn, $statement);\n \n if ($result != null)\n {\n if ($result->num_rows > 0) {\n // output data of each row\n $flag = false;\n while($row = $result->fetch_row()) {\n //echo \"<br>\". $row;\n //echo \"<br>\" . $email_local . \" \" . $password_local;\n //echo \"<br>\" . $row[0];\n //echo \"<br>\" . $row[1];\n if ($row[0] == $email_local && $row[1] == $password_local){\n $flag = true;\n break;\n }\n }\n if ($flag){\n return true;\n }\n else{\n return false;\n }\n } else {\n echo \"0 results\";\n }\n return true;\n }\n echo '<br>Authentificaiton failed not a valid user';\n return true;\n }\n\n return false;\n\n}", "function verify_password($memberID, $current_password, $db) {\n \n $command = \"SELECT * FROM member_login WHERE memberID = '\".$db->real_escape_string($memberID).\"' \". \n \"AND password = password('\".$db->real_escape_string($current_password).\"');\";\n $result = $db->query($command);\n \n if ($data = $result->fetch_object()) {\n return true;\n\n }\n else {\n return false;\n }\n}", "function validateLogin($email, $password)\n\t{\n\n\t\t$connection = new Connection;\n\t\t$query = \"select email,password from user where email = '$email' and password = '$password'\";\n\t\t$result = $connection->runQuery($query, $connection->connection());\n\t\treturn $result;\n\t}", "public function validateLogin() {\n $email = valOr($_REQUEST,'email','');\n $password = valOr($_REQUEST,'pwd','');\n\n $stmt = $this->hcatServer->dbh->prepare(\"select * from hcat.user where email=:email\");\n $stmt->bindValue(':email', $email, PDO::PARAM_STR);\n $stmt->execute();\n $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);\n\n $_SESSION['email']='';\n $_SESSION['uid']=0;\n\n $message = '';\n if (sizeof($rows)==1) {\n $hash = $rows[0]['pwdhash'];\n if ( password_verify ( $password , $hash )) {\n $_SESSION['email']=$email;\n $_SESSION['uid']=$rows[0]['uid'];\n $this->hcatServer->setLogin();\n\n } else {\n $message = 'Bad password';\n }\n\n } else {\n $message = 'Bad email';\n }\n\n\n $_SESSION['message']=$message;\n return ($_SESSION['email']!='');\n }", "public function validate_login() {\n\t\t$userid=$_POST['user_id'];\n\t\t$password=$_POST['password'];\n\t\t$compid=$_POST['company_id'];\n\t\t\n\n\t\t$sql=\"SELECT u.id, u.user_name FROM users u, hmz_cust_info ci where ci.id=u.cust_id\n\t\t\tand u.user_id='$userid' and u.password='$password' and ci.cust_id='$compid';\";\n\t\t$result=$this->runQuery(\"getAll\",$sql);\n\t\tif(count($result)>0) {\n\t\t\t$_SESSION['user_id']=$result[0];\n\t\t\t$_SESSION['user_name']=$result[1];\n\t\t\theader('location: ?a=P&b=dashboard');\n\t\t}\n\t\telse\n\t\t\theader('location: ?a=login&b=f');\n\n\t}", "function validateLogin($data) {\r\n\t\t$sessionAdmin = $this->query('SELECT * FROM \r\n\t\t\t\t\t\t\t admins WHERE username=\"'. $data['username'] . '\" AND password=md5(\"'. $data['password'] .'\");' );\r\n\t\tif(empty($sessionAdmin) == false) //If the $sessionAdmin array isn't empty return the results\r\n\t\t return $sessionAdmin;\r\n\t\treturn false;\r\n\t}", "public function chkLogin()\r\n {\r\n global $cookie_prefix;\r\n\t\t\r\n if(\r\n isset($_COOKIE[$cookie_prefix . \"id\"])\r\n &&\r\n isset($_COOKIE[$cookie_prefix . \"pass\"])\r\n )\r\n\t{\r\n #<!-- Sanitize ID -->\r\n $id = $_COOKIE[$cookie_prefix . \"id\"];\r\n\t\t/*$id = mysql_real_escape_string($id);\r\n\t\t$id = strip_tags($id);*/\r\n\t\t$id = parent::protect($id);\r\n\t\t\t\r\n #<!-- Sanitize Pass -->\r\n\t\t$pass = $_COOKIE[$cookie_prefix . \"pass\"];\r\n\t\t/*$pass = mysql_real_escape_string($pass);\r\n\t\t$pass = strip_tags($pass);*/\r\n\t\t$pass = parent::protect($pass);\r\n\t\t\r\n $query = mysql_query(\"SELECT * FROM `hxm_members` WHERE `id` = '$id' AND `password` = '$pass'\");\r\n $result = mysql_num_rows($query);\r\n $data = mysql_fetch_array($query);\r\n\t\t\t\r\n if( $result != 1 )\r\n {\r\n header(\"Location: \" . AUTH);\r\n }\r\n\t\t\t\r\n if( $data[\"group\"] == \"0\" )\r\n {\r\n header(\"Location: \" . AUTH);\r\n }\r\n\t}\r\n\telse\r\n\t{\r\n header(\"Location: \" . AUTH);\r\n\t\t\t\t\r\n\t}\r\n }", "function validUser($username, $password) {\n $DB_LOGIN = new MySQLdatabase(MYSQL_HOST, MYSQL_USERNAME, MYSQL_PASSWORD, MYSQL_DATABASE, true);\n $username = str_replace(\"'\", \"\\'\", ($username));\n $password = str_replace(\"'\", \"\\'\", ($password));\n $functionQuery = (\"SELECT user_id AS userid FROM users WHERE user_name = '$username' AND user_password = MD5('$password') AND user_active = 1\");\n $result = $DB_LOGIN->query($functionQuery);\n $userId = 0;\n while ($row = mysql_fetch_array($result)) {\n $userId = $row[\"userid\"];\n }\n return $userId;\n}", "public function DB_checkLogin($data){\n\t\ttry {\n\t\t\t\n\t\t\tparent::__construct(DB_DRIVER.':dbname='.DB_NAME.';host='.DB_HOST, DB_USERNAME, DB_PASSWORD);\n\t\t\t$this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); \n\n\t\t\t$query = $this->prepare('SELECT email,password,first_name,last_name,date_of_birth,time_stamp FROM '.DB_TABLE.' WHERE email = :email');\n\t\t\t$query->execute(array(\n\t\t\t':email' => $data['email']\n\t\t\t));\n\n\t\t\tif($query->rowCount() === 1){\n\t\t\t\twhile ($row = $query->fetch(PDO::FETCH_OBJ)){\n\t\t\t\t\tif (password_verify($data['password'], $row->password)) {\t\t\n\t\t\t\t\t\tsetcookie('user', $row->first_name.'|'.$row->last_name.'|'.$row->date_of_birth.'|'.$row->time_stamp, time()+3600, \"/reg_form/\");\t\t\t\t\t\t\n\t\t\t\t\t\treturn true;\t\t\t\t\t\n\t\t\t\t\t} else {\n\t\t\t\t\t\theader('Refresh: 2; url='.BASEPATH.'user/');\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t} \n\t\t\t} else {\n\t\t\t\tdie('Incorrect details.');\n\t\t\t\treturn false;\n\t\t\t}\n\t\t} catch(PDOException $e){\n\t\t\techo 'ERROR: '.$e->getMessage();\n\t\t}\n\t}", "public function validate_member()\n\t{\n\t\t//select the member by email from the database\n\t\t$this->db->select('*');\n\t\t$this->db->where(array('member_email' => strtolower($this->input->post('member_email')), 'member_status' => 1, 'member_activated' => 1, 'member_password' => md5($this->input->post('member_password'))));\n\t\t$query = $this->db->get('member');\n\t\t\n\t\t//if member exists\n\t\tif ($query->num_rows() > 0)\n\t\t{\n\t\t\t$result = $query->result();\n\t\t\t//create member's login session\n\t\t\t$newdata = array(\n 'member_login_status' => TRUE,\n 'first_name' => $result[0]->member_first_name,\n 'email' => $result[0]->member_email,\n 'member_id' => $result[0]->member_id,\n 'member' => 1\n );\n\t\t\t$this->session->set_userdata($newdata);\n\t\t\t\n\t\t\t//update member's last login date time\n\t\t\t$this->update_member_login($result[0]->member_id);\n\t\t\treturn TRUE;\n\t\t}\n\t\t\n\t\t//if member doesn't exist\n\t\telse\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\t}", "function check_login() {\n $query = \"SELECT * FROM users WHERE username='$this->username'\";\n $result = mysqli_query($this->connect(), $query);\n $user = mysqli_fetch_assoc($result);\n if (password_verify($this->password, $user['password'])) {\n return true;\n }\n else {\n return false;\n }\n }", "function checkIfValidUser($name,$pw){\n\t if(($name != NULL) && ($pw != NULL)){\n $count = @mysql_query(\"SELECT COUNT(*) as count FROM UserUNandID WHERE ('$name' = UserName)\");\n\t\t $countdata = mysql_fetch_assoc($count);\n\t\t if($countdata['count'] <= 0){\n\t\t return false;\n\t\t }\n else\n\t\t { \n $userinfo = @mysql_query(\"SELECT * FROM UserUNandID WHERE ('$name' = UserName)\");\n\t\t\t $userdata = mysql_fetch_assoc($userinfo);\n\t\t\t $pwinfo = $userdata['Password'];\n\t\t\t if($pw == $pwinfo)\n\t\t\t return true;\n\t\t\t else return false;\n }\t\t\t \n\t\t}\t\t\n\t}", "function logincheck($u_mail,$u_pass)\n{\n\t$sql=\"select * from user_table where u_mail='$u_mail' and u_pass='$u_pass'\";\n\t$key=0; \n\tforeach($GLOBALS['db']->query($sql) as $row)\n\t\t$key++;\n\tif($key==1)\n\t\treturn $row['u_id'];\n\telse\n\t\techo \"<center>Username or Password is incorrect</center>\";\n}", "public function checkLogin() {\r\n\t\t$post = $this -> sanitize();\r\n\t\textract($post);\r\n\t\t// Hash the password that was entered into the form (if it was correct, it will match the hashed password in the database)\r\n\t\t$password = sha1($password);\r\n\t\t// Query\r\n\t\t$query = \"SELECT username, userID, profilePic, access, email FROM users WHERE username='$username' AND password='$password'\";\r\n\t\t$data = $this -> singleSelectQuery($query);\r\n\t\tif($data){\r\n\t\t\t//set up the session\r\n\t\t\t$_SESSION['userID'] = $data['userID'];\r\n\t\t\t$_SESSION['username'] = $data['username'];\r\n\t\t\t$_SESSION['profilePic'] = $data['profilePic'];\r\n\t\t\t$_SESSION['userType'] = $data['userType'];\r\n\t\t\t$_SESSION['access'] = $data['access'];\r\n\t\t\t//redirects to their profile\r\n\t\t\theader('location: index.php?page=profile&userID='.$_SESSION['userID']);\r\n\t\t} else {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t}", "public function validateLogin()\n {\n $this->userMapper->validateUserLogin($_POST); // should I use a global directly here?\n }", "function validate_login(array $inputs, array &$form): bool\n{\n if (App::$db->getRowWhere('users', $inputs)) {\n return true;\n };\n\n $form['error'] = 'ERROR WRONG LOGIN INFO';\n\n return false;\n}", "protected function _validateAccount() {\n\t\tif(!check($this->_username)) return;\n\t\tif(!check($this->_password)) return;\n\t\t$data = array(\n\t\t\t'username' => $this->_username,\n\t\t\t'password' => $this->_password\n\t\t);\n\t\tif($this->_md5Enabled) {\n\t\t\t$query = \"SELECT * FROM \"._TBL_MI_.\" WHERE \"._CLMN_USERNM_.\" = :username AND \"._CLMN_PASSWD_.\" = [dbo].[fn_md5](:password, :username)\";\n\t\t} else {\n\t\t\t$query = \"SELECT * FROM \"._TBL_MI_.\" WHERE \"._CLMN_USERNM_.\" = :username AND \"._CLMN_PASSWD_.\" = :password\";\n\t\t}\n\t\t\n\t\t$result = $this->db->queryFetchSingle($query, $data);\n\t\tif(!is_array($result)) return;\n\t\t\n\t\treturn true;\n\t}", "function validation($userName, $password){\r\n // $query .=\" WHERE userName = '\" . $userName .\"' AND password = '\" . $password . \"'\";\r\n\r\n if(empty($userName) && empty($password)){\r\n $emptyfield = \"Field cannot be empty</br>\";\r\n echo $emptyfield;\r\n echo \"Redirecting to login screen...\";\r\n header( \"Refresh:1; url=index.php\", true, 303);\r\n }\r\n\r\n // $query = \"SELECT * FROM user\";\r\n // $query .=\" WHERE userName = '\" . $userName .\"'\";\r\n\r\n // $result = $connection ->prepare($query);\r\n // $result->execute();\r\n // $result = $result->fetchAll();\r\n\r\n // if(count($result) > 0){\r\n // echo \"Username already exist\";\r\n // //sleep(3);\r\n // header( \"Refresh:1; url=index.php\", true, 303);\r\n // } else {\r\n // inDatabase();\r\n // }\r\n // die;\r\n}", "function is_member_login() {\n\t\t$cm_account = $this->get_account_cookie(\"member\");\n\t\tif ( !isset($cm_account['id']) || !isset($cm_account['username']) || !isset($cm_account['password']) || !isset($cm_account['onlinecode']) ) {\n\t\t\treturn false;\n\t\t}\n\t\t// check again in database\n\t\treturn $this->check_account();\n\t}", "function validate_login(array $filtered_input, array &$form): bool\n{\n if (App::$db->getRowWhere('users', [\n 'email' => $filtered_input['email'],\n 'password' => $filtered_input['password']\n ])) {\n return true;\n }\n\n $form['error'] = 'Unable to login: please check your password';\n\n return false;\n}", "public function login_validation() {\n\n\t\t$this -> load -> library('form_validation');\n\t\t$this -> form_validation -> set_rules('email', \"Email\", \"required|trim|xss_clean|callback_validate_credentials\");\n\t\t$this -> form_validation -> set_rules('password', \"Password\", \"required|md5|trim\");\n\n\t\tif ($this -> form_validation -> run()) {\n session_start();\n\t\t\t$user_id = $this -> model_users -> get_userID($this -> input -> post('email'));\n\n\t\t\t$data = array(\"id\" => $user_id, \"email\" => $this -> input -> post(\"email\"), \"user\" => \"TRUE\", \"is_logged_in\" => 1);\n\n\t\t\t$this -> session -> set_userdata($data);\n\t\t\tredirect('Site/members');\n\t\t} else {\n\t\t\n\t\t\techo \"error\";\n\n\t\t}\n\n\t}", "function validateUser($username,$password,$db){\n $query = $db->query(\"SELECT * FROM users WHERE `username`='$username'\");\n \n if($query->num_rows != 1){\n echo('invalid');\n }else{\n $array = $query->fetch_assoc();\n if($password == $array['password']){\n $auth = $array['authorization'];\n logUserIn($username,$auth);\n echo(\"valid\");\n //header(\"Location: /employee/\");\n }else{\n echo 'notFound';\n }\n }\n \n }", "function login_check($pdo)\n{\n if (isset($_SESSION['user_id'], $_SESSION['username'], $_SESSION['login_string'])) {\n $user_id = $_SESSION['user_id'];\n $login_string = $_SESSION['login_string'];\n $username = $_SESSION['username'];\n $user_browser = $_SERVER['HTTP_USER_AGENT']; // reperisce la stringa 'user-agent' dell'utente.\n if ($stmt = $pdo->prepare('SELECT password FROM members WHERE id = ? LIMIT 1')) {\n $stmt->execute([$user_id]); // esegue il bind del parametro '$user_id'.\n $row = $stmt->fetch(PDO::FETCH_ASSOC);\n $count = $stmt->rowCount();\n if ($count == 1) {\n $password = $row['password'];\n $login_check = hash('sha512', $password.$user_browser);\n if ($login_check == $login_string) {\n // Login eseguito!!!!\n return true;\n } else {\n error_log(\"Wrong login string for $username\");\n\n return false;\n }\n } else {\n error_log(\"Couldnt find $username\");\n\n return false;\n }\n } else {\n error_log(\"Couldnt select pass $username\");\n\n return false;\n }\n } else {\n error_log(\"Vars not set 4 $username\");\n\n return false;\n }\n}", "function log_member_in($user, $password)\r\n\t{\r\n\t\t//Security 101 - Never tell the user which part is incorrect!\r\n\t\t$failed_message = \"Wrong Username/Email or Password\";\r\n\t\t//We check if the value given from the user is an email\r\n\t\tif ($this->validate_email($user))\r\n\t\t{\r\n\t\t\t//And so it is! We get the member details with the email address.\r\n\t\t\t$user_array = $this->get_member_with_email($user);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t//Oh, it's not an email, maybe a username then?\r\n\t\t\t$user_array = $this->get_member_with_username($user);\r\n\t\t}\r\n\r\n\t\t//If the id is not set in the user array, or ID is less than one, we\r\n\t\t//can't log the login attempt for a specific user\r\n\t\tif (!isset($user_array['id']) && !validate_int($user_array['id']))\r\n\t\t{\r\n\t\t\t//We save the login attempt, without passing a user id, and passing\r\n\t\t\t//the 0 value as response (0 == false in SQL)\r\n\t\t\t$this->save_login_attempt(0);\r\n\t\t\treturn $failed_message; //Return the string created in the beginning\r\n\t\t}\r\n\t\t//Since we've reached this far, we know that a user exists with the \r\n\t\t//username OR email. We now hash the given password with the user's salt\r\n\t\t$hashed_password = $this->hash_password($password, $user_array['salt']);\r\n\t\t//We check if the saved password matches the given password\r\n\t\t//die($hashed_password . '<br>' . $user_array['password']);\r\n\t\tif ($this->compare_passwords($hashed_password, $user_array['password']) === TRUE)\r\n\t\t{\r\n\t\t\t//We check if the user is banned\r\n\t\t\tif ($this->check_if_ban_is_in_order($user_array['id']) === TRUE)\r\n\t\t\t{\r\n\t\t\t\t//The account is banned. We save the login attemp with a failed\r\n\t\t\t\t//respons, and returns an error message stating this.\r\n\t\t\t\t$this->save_login_attempt(0, $user_array['id']);\r\n\t\t\t\t//If the ban is more than 3 (which is where the user is banned)\r\n\t\t\t\t//We annoy the user a bit by redirecting them!\r\n\t\t\t\t//Here we check if it's only three! \r\n\t\t\t\t//(remember we just saved one more, so it's +1)\r\n\t\t\t\tif (!$this->check_if_ban_is_in_order($id, 5))\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"This account has been locked due to too many failed \"\r\n\t\t\t\t\t\t\t. \"logins. Please try again later!\";\r\n\t\t\t\t}\r\n\t\t\t\treturn \"This account has been locked due to too many failed \"\r\n\t\t\t\t\t\t. \"logins. You are now being redirected because you've tried \"\r\n\t\t\t\t\t\t. \"to log in much more than allowed! \"\r\n\t\t\t\t\t\t. \"<script>\"\r\n\t\t\t\t\t\t. \"setTimeout(function()\"\r\n\t\t\t\t\t\t. \"{window.location = 'http://www.heibosoft.com'}\"\r\n\t\t\t\t\t\t. \", 2000);\"\r\n\t\t\t\t\t\t. \"</script>\";\r\n\t\t\t}\r\n\t\t\t//Now, let's sign the user in!\r\n\t\t\t//We save a session cookie stating the user is signed in\r\n\t\t\t$_SESSION['logged_in'] = TRUE;\r\n\t\t\t//And a session cookie with the user id\r\n\t\t\t$_SESSION['user_id'] = $user_array['id'];\r\n\t\t\t//The user succesfully logged in, let's save the attempt anyway!\r\n\t\t\t$this->save_login_attempt(1, $user_array['id']);\r\n\t\t\treturn TRUE;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t$this->save_login_attempt(0, $user_array['id']);\r\n\t\t\tif ($this->check_if_ban_is_in_order($user_array['id']) === TRUE)\r\n\t\t\t{\r\n\t\t\t\tif (!$this->check_if_ban_is_in_order($id, 5))\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"This account has been locked due to too many failed \"\r\n\t\t\t\t\t\t\t. \"logins. Please try again later!\";\r\n\t\t\t\t}\r\n\t\t\t\treturn \"This account has been locked due to too many failed \"\r\n\t\t\t\t\t\t. \"logins. You are now being redirected because you've tried \"\r\n\t\t\t\t\t\t. \"to log in much more than allowed!\";\r\n\t\t\t}\r\n\t\t\treturn $failed_message;\r\n\t\t}\r\n\t\treturn FALSE;\r\n\t}", "public function isValidLogin($email, $password);", "public function validate_user( $username, $password ) {\n // based on the received username and password\n\n\n // The results of the query are stored in $login.\n // If a value exists, then the user account exists and is validated\n if ($username==\"adminHelena\" && $password==\"adminHelena99\") {\n // Call set_session to set the user's session vars via CodeIgniter\n $this->set_session();\n return true;\n }\n\n return false;\n}", "public function _check_login()\n {\n\n }", "public function hasUser($_login,$_password);", "function verify_login($email, $password)\n{\n\t// 1 => good to go\n\t// -1 => account not found or verification bad\n\t$pw_verify = db_query('SELECT AES_DECRYPT(password, \"%s\") AS secret FROM users WHERE email=\"%s\" AND verified=\"1\" LIMIT 1', $_POST['password'], $_POST['email']);\n\tif (count($pw_verify) == 0)\n\t\treturn -1;\n\telse if ($pw_verify[0]['secret'] !== BLOWFISH_SECRET)\n\t\treturn 0;\n\telse\n\t\treturn 1;\n}", "public function login ($USName, $PWord){\n\n\t\t$this->mysqlconnect();\n\n\n\n\n//if databse found continue to check if name in table\n\n\n\n\t$query = \"SELECT * FROM user_table WHERE username = '$USName' AND password ='$PWord'\";\n\n\n\t$result = $this->mysqli->query ( $query ) or die('SELECT query failed: ' . mysql_error());\n\t$answer= \"\";\n\n\n\n\n\tfor ( $row = $result->fetch_assoc(); $row != FALSE;\n\t\t\t$row = $result->fetch_assoc() )\n\t{\n\n\n\n\t\t$usernamez = stripslashes($row[\"username\"]);\n\t\t$passwordez = stripslashes($row[\"password\"]);\n\t\t\n\n\t\tif ($usernamez==$USName && $passwordez==$PWord){\n\n\t\t\t$answer= \"Login Succesful!\";\n\n}\nelse{\n\n$answer= \"Login Error!\";\n\n}\n\n\n\n\n\n\n\t}\n\treturn $answer;\n}", "function validateLogin($token = '', $secret = '')\n{\n\t// globals\n\tglobal $db;\n\n\t// valiate input\n\tif (empty($token)\n\t\t|| empty($secret)\n\t){\n\t\treturn false;\n\n\t} // end if (empty($token) || empty($secret))\n\n\t// check for entry\n\t$user = $db->fetch(\"select `id` from `employees` where `token`='\" . $db->escape($token) . \"' and `secret`='\" . $db->escape($secret) . \"'\", 'one');\n\n\t// if we found a user update cookies\n\tif (!empty($user))\n\t{\n\t\t// update login\n\t\tsetLoginCookies($user);\n\n\t\t// return user id\n\t\treturn intval($user);\n\n\t} // end if (!empty($user))\n\n\t// if we didn't destroy session\n\telse\n\t{\n\t\t// update login\n\t\tdestroyLoginCookies();\n\n\t\t// return user id\n\t\treturn false;\n\n\t} // end else\n\n}", "function checkLogin($errorString) {\n global $con;\n \n if(empty($_POST[\"login\"])) { // (1)\n return $errorString.\"Není vyplněno pole <b>Login</b>.<br>\";\n }\n\n if(strlen($_POST[\"login\"]) > 16) { // (2)\n return $errorString.\"Položka <b>Login</b> může být dlouhá maximálně <b>16 znaků</b>.<br>\";\n }\n\n if(!isLoginSafe($_POST[\"login\"]) ||\n $_POST[\"login\"] != $con->escape_string($_POST[\"login\"])) { // (3)\n \n return $errorString.\"Položka <b>Login</b> obsahuje zakázané symboly.\";\n }\n\n $statement = $con->prepare(\"SELECT * FROM `user` WHERE login=?\");\n $res = $statement ->bind_param(\"s\", $_POST[\"login\"]);\n if(!$res) { // SQL injection\n return $errorString.\"Položka <b>Login</b> obsahuje neplatnou hodnotu.<br>\";\n }\n $statement->execute();\n if($statement->fetch()) {\n return $errorString.\"Uživatel <b>\".$_POST[\"login\"].\"</b> je už registrován.<br>\"; // (4)\n }\n return $errorString;\n}", "public function checkUser()\n {\n // Prepare ids used to avoid SQL injections(bad code)\n // we store them in the var $sql\n // we select the id and password from the table users where the username equals what was put it\n $sql = $this->db->prepare('SELECT id, password FROM admin WHERE username = ?');\n // Then we bind the parameters, its a string so we use 's', then we execute the statment\n $sql->bind_param('s', $_POST['username']);\n $sql->execute();\n // Now we store the results\n $sql->store_result();\n\n //if the returned rows are greater then 0\n // we bind the results the variblesand then fetch them \n if ($sql->num_rows > 0) {\n $sql->bind_result($id, $password);\n $sql->fetch();\n // If the rows are more then 0 we know the account name exist, now lets check the password!\n // we werify our hashed password if user name and password are right we create a new session\n // Note: remember to use password_hash in your registration file to store the hashed passwords.\n if (password_verify($_POST['password'], $password)) {\n // new session created with a var for being loged in set to true\n //the name is equal to the name from the field\n // and the id is equal to the users id\n session_regenerate_id();\n $_SESSION['loggedin'] = TRUE;\n $_SESSION['person'] = $_POST['username'];\n $_SESSION['id'] = $id;\n } else {\n // Incorrect password\n echo 'Wrong username or password';\n }\n } else {\n // wrong credentials\n echo 'Wrong username or password';\n }\n//we close the prepared statment\n $sql->close();\n }", "function verifyLogin($user,$pass)\r\n\r\n{\r\n\r\n\t$salt = 's+(_a*';\r\n\r\n\t$pass = md5($pass.$salt);\r\n\r\n\r\n\r\n\t$sql = \"SELECT pass FROM users WHERE pass = '\" . $pass . \"' AND user = '\" . $user .\"'\";\r\n\r\n\t$res = sqlQuery($sql); if(sqlErrorReturn()) sqlDebug(__FILE__,__LINE__,sqlErrorReturn());\r\n\r\n\t$num = sqlNumRows($res);\r\n\r\n\r\n\r\n\tif ($num > 0)\r\n\r\n\t\treturn true;\r\n\r\n\treturn false;\t\r\n\r\n}", "function checkLoginInfo($inUsername, $inPassword)\n{\n\t// Do some error-checking\n\tif (strlen($inPassword) < 7)\n\t{\n\t\techo '<p>Error! Invalid password length.</p>';\n\t\treturn;\n\t}\n\telse if (strlen($inUsername) < 3 || strlen($inUsername) > 45)\n\t{\n\t\techo '<p>Error! Invalid username length. </p>';\n\t\treturn;\n\t}\n\t\n\t// Open a database connection\n\t$dbHost = '68.191.214.214';\n $dbUsername = 'galefisher';\n\t$dbPassword = 'galefisher'; \n\t$dbTable = 'galefisherautoparts';\n\t$dbPort = 3306;\n\t$con = mysqli_connect($dbHost, $dbUsername, $dbPassword, $dbTable, $dbPort);\n\tif (!$con)\n\t{\n\t\texit('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error());\n\t}\n\tmysqli_set_charset($con, 'utf-8');\n\t\n\t// Check entered values against stored values\n\t// First check if the username entered exists in the database\n\t$query = 'select username from customer where username = \"' . $inUsername . '\"';\n\tif(mysqli_num_rows(mysqli_query($con, $query)) == 0)\t// Entry is not found\n\t{\n\t\techo '<p>Error! Requested username not found. </p>';\n\t\treturn;\n\t}\n\t\n\t// Check password against stored password\n\t$query = 'select password from customer where username = \"' . $inUsername . '\"';\n\t$result = mysqli_query($con, $query);\n\t$row = mysqli_fetch_array($result);\n\tif ($row['password'] == $inPassword)\n\t{\n\t\techo '<p>Thank you for logging in, ' . $inUsername . '.</p>\n\t\t\t<a href=\"main.php\">Return Home</a>';\n\t\t$_SESSION['username'] = $inUsername;\n $_SESSION['type'] = \"customer\";\n\t}\n\telse\n\t{\n\t\techo '<p>Sorry, the password you entered was incorrect. Please try again.</p>';\n\t}\n}", "public function loginCheck()\n\t{\n\t}", "function _isMatch()\n {\n if (isset($_POST['login'])) {\n if ($this->name_post == $this->name_db && password_verify($this->pass_post, $this->pass_db)) {\n return true;\n }\n $this->mismatch = true;\n }\n return false;\n }", "function checkLogin($db, $email, $password){\n\n\t\t// Prepare a query.\n\t\t$salt_query = $db->prepare(\"SELECT salt FROM user WHERE Email = :email\");\n\t\t$params = array(\":email\" => htmlspecialchars($email));\n\t\t$salt_query->execute($params);\n\t\n\t\t// See if anything was returned. Display an error if anything is.\n\t\tif($salt = $salt_query->fetch()){\n\t\t\n\t\t\t// Generate a hash to compare to what's in the database.\n\t\t\t$hash = hash('sha256', $salt[0] . htmlspecialchars($_POST['password']));\n\t\t\t\n\t\t\t// Compare the generated hash to the one in the database.\n\t\t\t$login_query = $db->prepare(\"\n\t\t\t\tSELECT Username FROM user\n\t\t\t\tWHERE\n\t\t\t\t\tEmail = :email\n\t\t\t\tAND\n\t\t\t\t\thash = :hash\n\t\t\t\");\n\t\t\t\n\t\t\t$params = array(\":email\" => htmlspecialchars($email),\n\t\t\t\t\t\t\t\":hash\" => $hash);\n\t\t\t\n\t\t\t// Retrieve the username.\n\t\t\t$login_query->execute($params);\n\t\t\tif($username = $login_query->fetch()){\n\t\t\t\treturn $username;\n\t\t\t}\n\t\t\t// Incorrect password.\n\t\t\telse{\n\t\t\t\t$returnInfo[\":code\"] = 1;\n\t\t\t\t$returnInfo[\":data\"] = \"Password is incorrect.\";\n\t\t\t\tdie(json_encode($returnInfo));\n\t\t\t}\n\t\t}\n\t\t// User doesn't exist.\n\t\telse{\n\t\t\t$returnInfo[\":code\"] = 1;\n\t\t\t$returnInfo[\":data\"] = \"There is no user associated with that email.\";\n\t\t\tdie(json_encode($returnInfo));\n\t\t}\n\t}", "function validateAdminLogin($username, $password) {\n // Same with the password (this example uses PLAIN TEXT passwords, you should encrypt yours!)\n // The second parameter tells us which fields to return from the database\n // Here is the corresponding query:\n // \"SELECT id, username FROM users WHERE username = 'xxx' AND password = 'yyy'\"\n //$user = $this->find(array('email' => $data['username'], 'password' => $data['password']));\n\n $user = $this->find('first', array(\n 'conditions' => array(\n 'email' => $username,\n 'passwd' => md5($password)\n ),\n ));\n if (empty($user) == false) {\n\n $userGroup = $this->getUserIds($user['User']['id']);\n foreach ($userGroup as $group):\n if ($group['user_usergroup']['id'] == 1){\n return $user;\n }\n endforeach;\n\n return false;\n }\n\n return false;\n }", "function login() {\n\n // Validate user input\n $this->s_email = testInput($this->s_email);\n $this->s_password = testInput($this->s_password);\n\n // Fetch data from db with given email\n $result = $this->conn->query(\"SELECT * FROM $this->tableName WHERE s_email LIKE '$this->s_email'\");\n\n // Check that student exists in database\n if ($result->rowCount() === 1) {\n\n // Fetch user record from result\n $user = $result->fetch();\n\n // Check password match\n if (password_verify($this->s_password, $user[\"s_password\"])) {\n return true;\n }\n // Passwords do not match\n else {\n return false;\n }\n }\n // User with given email not in database\n else {\n return false;\n }\n }", "function validate_login($username, $password){\n if (empty($this->username) or empty($this->password)){\n // User has not set its credentials\n print 'Error user has not set user and password.';\n return False;\n }\n if (empty($username) or empty($password)){\n // Empty username or password\n print 'Cannot ser username or password as null.';\n return False;\n }\n if ($username == $this->username and $password == $this->password){\n print 'Username and password are correct.';\n return True;\n }\n }", "public static function validateUser($email, $password)\n {\n $conn = new MySqlConnect();\n $isValid = FALSE;\n $dbHash = null;\n $userId = null;\n $name = null;\n $userType = null;\n\n // hash the submitted password to to verify against the value in the db\n $hash = Users::encodePassword($password);\n\n //$email = $conn -> sqlCleanup($email);\n // query the db for the value comparison\n $result = $conn -> executeQueryResult(\"SELECT userId, password, fName, lName, userType FROM users WHERE emailAddress = '{$email}'\");\n\n // get a row count to verify only 1 row is returned\n $count = mysql_num_rows($result);\n if ($count == 1)\n {\n var_dump($result);\n // use mysql_fetch_array($result, MYSQL_ASSOC) to access the result object\n while ($row = mysql_fetch_array($result, MYSQL_ASSOC))\n {\n // access the password value in the db\n $userId = trim($row['userId']);\n $dbHash = trim($row['password']);\n $userType = trim($row['userType']);\n $name = \"{$row['fName']} {$row['lName']}\";\n }\n\n // compare the input password hash with the db hash, and set as valid if\n // they match\n if ($hash == $dbHash)\n {\n $isValid = TRUE;\n session_start();\n // register the userId, name, and userType in the $_SESSION\n $_SESSION['userId'] = $userId;\n $_SESSION['name'] = $name;\n $_SESSION['userType'] = $userType;\n $_SESSION['email'] = $email;\n $_SESSION['timeout'] = time();\n // clear any tempPassKey record that may or may not exist in the user\n // record that that has been validated\n Users::clearTempPassKey($userId);\n }\n }\n $conn -> freeConnection();\n return $isValid;\n }", "function checkLogin($username, $password)\n\t{\n\t\t\n\t\t//set an empty userId variable\n\t\t$userId = null;\n\t\t\n\t\t//make a call to grab the user id of the row that has a username AND password that match the specified ones\n\t\t$stmt = $this->db -> prepare(\"SELECT user_id FROM user WHERE username=? && password=?\");\n\t\t\n\t\t$stmt -> execute(array($username, $password));\n\t\t\n\t\t$userIdToCheck = $stmt->fetch(PDO::FETCH_ASSOC);\n\t\t\n\t\t//var_dump($userIdToCheck);\n\t\t\n\t\t\n\t\t//if the username and password do not match up, no rows will be found, and userIdToCheck will equal false\n\t\t//if username and password do not match up, put out error\n\t\tif($userIdToCheck == false)\n\t\t{\n\t\t\t$this->errors['password'] = \"Username and password do not match\";\n\t\t\t\n\t\t\t//var_dump($password, $userIdToCheck);\n\t\t\t//echo \"NOOOO!!!\";\n\t\t}\n\t\t//else, if the username and password do match up, set the user id to the $userId variable\n\t\t else\n\t\t{\n\t\t\t$userIdToCheck = $userIdToCheck['user_id'];\n\t\t} \n\t\t\n\t\t//return the user ID associated with the username and password\n\t\treturn $userIdToCheck;\n\t}", "function checkLogin() {\n /* Check if user has been remembered */\n if (isset($_COOKIE['cook_VenusetP_UserEmail']) && isset($_COOKIE['cook_Venueset_UserPassword'])) {\n $varUserEmail = $_COOKIE['cook_VenusetP_UserEmail'];\n $varUserPassword = $_COOKIE['cook_Venueset_UserPassword'];\n /* Confirm that username and password are valid */\n $arrUserFlds = array('pkUserID', 'UserEmail', 'UserPassword', 'UserFirstName');\n $varUserWhere = ' 1 AND UserEmail = \\'' . $varUserEmail . '\\' AND UserPassword = \\'' . md5(trim($varUserPassword)) . '\\'';\n //echo '<pre>';print_r($varUserWhere);exit;\n $arrUserList = $this->select(TABLE_USERS, $arrUserFlds, $varUserWhere);\n if (count($arrUserList) > 0) {\n /* $_SESSION['VenusetP_UserEmail'] = $arrUserList[0]['UserEmail'];\n $_SESSION['VenusetP_UserID'] = $arrUserList[0]['pkUserID'];\n $_SESSION['VenusetP_UserName'] = $arrUserList[0]['UserFirstName']; */\n }\n return true;\n } else {\n return false;\n }\n }", "function processLogin($username = '', $password = '')\n{\n\t// globals\n\tglobal $db;\n\n\t// if either input is false, stop\n\tif (empty($username)\n\t\t|| empty($password)\n\t){\n\t\treturn false;\n\n\t} // end if (empty($username) || empty($password))\n\n\t// get user\n\t$user = $db->fetch(\"select * from `employees` where `email`='\" . $db->escape($username) . \"' limit 1;\", 'row');\n\n\t// if we have a user continue\n\tif (!empty($user))\n\t{\n\t\t// build and compare passwords\n\t\t$nonce = strtolower($user['first_name'].$user['last_name']);\n\n\t\t// generate password hash\n\t\t$passwordHash = generatePasswordHash($password, $nonce);\n\n\t\t// compare\n\t\tif ($user['password'] === $passwordHash)\n\t\t{\n\t\t\t// user is valid\n\t\t\tsetLoginCookies($user['id']);\n\n\t\t\t// reload\n\t\t\theader(\"Location: /\");\n\n\t\t} // end if ($user['password'] === $passwordHash)\n\n\t} // end if (!empty($user))\n\n}", "function process_login ( $ls_user_name, $ls_user_password ) {\n\n\t\t// Connect to MySQL database.\n\n\t\techo \"I'm in model::process_login()\";\n\n\t\t$link = $this->connect_db();\n\n\t\tif ( $this->username_in_db( $ls_user_name, $link ) ) {\n\n\t\t\techo \"username $ls_user_name was in database, try checking password<br>\";\n\n\t\t\tif ( $this->password_matches_username( $ls_user_name, $ls_user_password, $link ) ) {\n\n\t\t\t\tmysqli_close( $link );\n\n\t\t\t\treturn true; // LOG USER IN!!!\n\n\t\t\t} else {\n\n\t\t\t\t$errors[ 'process_login' ] = 'error: invalid password';\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t$errors[ 'process_login' ] = 'error: invalid username';\n\n\t\t}\n\n\t\tmysqli_close( $link );\n\n\t\treturn false;\n\n\t}", "function checkMember($username, $password, $code=0, $adv=0)\r\n\t{\r\n\t\t$username = funcs::check_input($username);\r\n\t\t$password = funcs::check_input($password);\r\n\t\t$code= funcs::check_input($code);\r\n\t\t$adv= funcs::check_input($adv);\r\n\r\n\t\tif($code == '' or $code == '0')\r\n\t\t{\r\n\t\t\t$sql = \"SELECT COUNT(*) FROM \".TABLE_MEMBER.\"\r\n\t\t\t\t\t\t\t\t WHERE \".TABLE_MEMBER_USERNAME.\"='\".$username.\"'\r\n\t\t\t\t\t\t\t\t\t AND \".TABLE_MEMBER_PASSWORD.\"='\".$password.\"'\";\r\n\t\t\t$row = DBconnect::get_nbr($sql);\r\n\r\n\t\t\tif($row > 0)\r\n\t\t\t\treturn true;\r\n\t\t\telse\r\n\t\t\t\treturn false;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t$sql = \"SELECT COUNT(*) FROM \".TABLE_MEMBER.\"\r\n\t\t\t\t\t\t\t\t WHERE \".TABLE_MEMBER_USERNAME.\"='\".$username.\"'\r\n\t\t\t\t\t\t \t\t AND \".TABLE_MEMBER_PASSWORD.\"='\".$password.\"'\r\n\t\t\t\t\t\t\t\t\t AND \".TABLE_MEMBER_VALIDATION.\"='\".$code.\"'\";\r\n\t\t\t$row = DBconnect::get_nbr($sql);\r\n\r\n\t\t\tif($row > 0)\r\n\t\t\t\treturn true;\r\n\t\t\telse\r\n\t\t\t\treturn false;\r\n\t\t}\r\n\t}", "function revalidate_two()\n\t{\n\t\t//-----------------------------------------\n\t\t// Check in the DB for entered member name\n\t\t//-----------------------------------------\n\t\t\n\t\tif ( $_POST['username'] == \"\" )\n\t\t{\n\t\t\t$this->revalidate_one('err_no_username');\n\t\t\treturn;\n\t\t}\n\t\t\n\t\t$username = $this->ipsclass->input['username'];\n\t\t\n\t\tif ( $this->ipsclass->vars['ipbli_usertype'] == 'username' )\n\t\t{\n\t\t\t$this->ipsclass->DB->cache_add_query( 'login_getmember', array( 'username' => $username ) );\n\t\t\t$this->ipsclass->DB->cache_exec_query();\n\t\t\t\n\t\t\t$member = $this->ipsclass->DB->fetch_row();\n\t\t\t\t\t\t\t\t \n\t\t\t//-----------------------------------------\n\t\t\t// Got a username?\n\t\t\t//-----------------------------------------\n\t\t\t\n\t\t\tif ( ! $member['id'] )\n\t\t\t{\n\t\t\t\t$this->revalidate_one('err_no_username');\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\t$this->ipsclass->converge->converge_load_member( $member['email'] );\n\t\t\t\n\t\t\tif ( ! $this->ipsclass->converge->member['converge_id'] )\n\t\t\t{\n\t\t\t\t$this->revalidate_one('err_no_username');\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t\n\t\t//-----------------------------------------\n\t\t// EMAIL LOG IN\n\t\t//-----------------------------------------\n\t\t\n\t\telse\n\t\t{\n\t\t\t$email = $username;\n\t\t\t\n\t\t\t$this->ipsclass->converge->converge_load_member( $email );\n\t\t\t\n\t\t\tif ( $this->ipsclass->converge->member['converge_id'] )\n\t\t\t{\n\t\t\t\t$this->ipsclass->DB->build_query( array(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t 'select' => 'm.*',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t 'from' => array( 'members' => 'm' ),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t 'where' => \"email='\".strtolower($username).\"'\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t 'add_join' => array( 0 => array( 'select' => 'g.*',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t 'from' => array( 'groups' => 'g' ),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t 'where' => 'g.g_id=m.mgroup',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t 'type' => 'inner'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t ) );\n\n\t\t\t\t$this->ipsclass->DB->exec_query();\n\n\t\t\t\t$member = $this->ipsclass->DB->fetch_row();\n\t\t\t\t\n\t\t\t\tif ( ! $member['id'] )\n\t\t\t\t{\n\t\t\t\t\t$this->revalidate_one('err_no_username');\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->revalidate_one('err_no_username');\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\t\t\n\t\t\n\t\t//-----------------------------------------\n\t\t// Check in the DB for any validations\n\t\t//-----------------------------------------\n\t\t\n\t\t$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'validating', 'where' => \"member_id=\".intval($member['id']) ) );\n\t\t$this->ipsclass->DB->simple_exec();\n\t\t\n\t\tif ( ! $val = $this->ipsclass->DB->fetch_row() )\n\t\t{\n\t\t\t$this->revalidate_one('err_no_validations');\n\t\t\treturn;\n\t\t}\n\t\t\n\t\t//-----------------------------------------\n\t\t// Which type is it then?\n\t\t//-----------------------------------------\n\t\t\n\t\tif ( $val['lost_pass'] == 1 )\n\t\t{\n\t\t\t$this->email->get_template(\"lost_pass\");\n\t\t\t\t\n\t\t\t$this->email->build_message( array(\n\t\t\t\t\t\t\t\t\t\t\t\t'NAME' => $member['members_display_name'],\n\t\t\t\t\t\t\t\t\t\t\t\t'THE_LINK' => $this->base_url_nosess.\"?act=Reg&CODE=lostpassform&uid=\".$member['id'].\"&aid=\".$val['vid'],\n\t\t\t\t\t\t\t\t\t\t\t\t'MAN_LINK' => $this->base_url_nosess.\"?act=Reg&CODE=lostpassform\",\n\t\t\t\t\t\t\t\t\t\t\t\t'EMAIL' => $member['email'],\n\t\t\t\t\t\t\t\t\t\t\t\t'ID' => $member['id'],\n\t\t\t\t\t\t\t\t\t\t\t\t'CODE' => $val['vid'],\n\t\t\t\t\t\t\t\t\t\t\t\t'IP_ADDRESS' => $this->ipsclass->input['IP_ADDRESS'],\n\t\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t$this->email->subject = $this->ipsclass->lang['lp_subject'].' '.$this->ipsclass->vars['board_name'];\n\t\t\t$this->email->to = $member['email'];\n\t\t\t\n\t\t\t$this->email->send_mail();\n\t\t}\n\t\telse if ( $val['new_reg'] == 1 )\n\t\t{\n\t\t\t$this->email->get_template(\"reg_validate\");\n\t\t\t\t\t\n\t\t\t$this->email->build_message( array(\n\t\t\t\t\t\t\t\t\t\t\t\t'THE_LINK' => $this->base_url_nosess.\"?act=Reg&CODE=03&uid=\".$member['id'].\"&aid=\".$val['vid'],\n\t\t\t\t\t\t\t\t\t\t\t\t'NAME' => $member['members_display_name'],\n\t\t\t\t\t\t\t\t\t\t\t\t'MAN_LINK' => $this->base_url_nosess.\"?act=Reg&CODE=05\",\n\t\t\t\t\t\t\t\t\t\t\t\t'EMAIL' => $member['email'],\n\t\t\t\t\t\t\t\t\t\t\t\t'ID' => $member['id'],\n\t\t\t\t\t\t\t\t\t\t\t\t'CODE' => $val['vid'],\n\t\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t$this->email->subject = $this->ipsclass->lang['email_reg_subj'].\" \".$this->ipsclass->vars['board_name'];\n\t\t\t$this->email->to = $member['email'];\n\t\t\t\n\t\t\t$this->email->send_mail();\n\t\t}\n\t\telse if ( $val['email_chg'] == 1 )\n\t\t{\n\t\t\t$this->email->get_template(\"newemail\");\n\t\t\t\t\n\t\t\t$this->email->build_message( array(\n\t\t\t\t\t\t\t\t\t\t\t\t'NAME' => $member['members_display_name'],\n\t\t\t\t\t\t\t\t\t\t\t\t'THE_LINK' => $this->base_url_nosess.\"?act=Reg&CODE=03&type=newemail&uid=\".$member['id'].\"&aid=\".$val['vid'],\n\t\t\t\t\t\t\t\t\t\t\t\t'ID' => $member['id'],\n\t\t\t\t\t\t\t\t\t\t\t\t'MAN_LINK' => $this->base_url_nosess.\"?act=Reg&CODE=07\",\n\t\t\t\t\t\t\t\t\t\t\t\t'CODE' => $val['vid'],\n\t\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t$this->email->subject = $this->ipsclass->lang['ne_subject'].' '.$this->ipsclass->vars['board_name'];\n\t\t\t$this->email->to = $member['email'];\n\t\t\t\n\t\t\t$this->email->send_mail();\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->revalidate_one('err_no_validations');\n\t\t\treturn;\n\t\t}\n\t\t\n\t\t$this->output .= $this->ipsclass->compiled_templates['skin_register']->show_revalidated();\n\t\t\n\t\t$this->page_title = $this->ipsclass->lang['rv_title'];\n\t\t$this->nav = array( $this->ipsclass->lang['rv_title'] );\n\t}", "public function verify() {\r\n $stmp = $this->_db->prepare(\"SELECT `id`,`email` FROM `anope_db_NickCore` WHERE `display`= ? AND `pass` = ?;\");\r\n $stmp->execute(array($this->_username,$this->_password));\r\n \r\n if ($stmp->rowCount() == \"1\") {\r\n $row = $stmp->fetch(PDO::FETCH_ASSOC);\r\n $this->_id = $row['id'];\r\n $this->_email = $row['email'];\r\n return $this->_id;\r\n }\r\n else {\r\n return false;\r\n }\r\n }", "function valid_credentials($user, $pass){\n\n $user = mysqli_real_escape_string($user, $_POST['username']);\n $pass = sha1($pass);\n\n $total = mysql_query(\"SELECT COUNT('user_id') FROM 'users' WHERE 'user_name' = '{$user}' AND 'user_password' = '{$pass}'\");\n\n return (mysql_result($total, 0) == '1') ? true : false;\n\n}", "function check_login() {\n //j'appelle la fonction pour se connecter à la database\n include(\"M/db_connect.php\");\n \n //je récupere ce qui est du formulaire et normalisation du form\n $email = htmlspecialchars($_GET['email']);\n $password = htmlspecialchars($_GET['password']);\n \n // la requete pour la database \n $req = $db->prepare(\"SELECT * FROM account WHERE email LIKE :email AND psw LIKE :psw\");\n $req->execute(array(\"email\"=>$email, \"psw\"=>$password));\n\n return $req;\n }", "function checkLoginDetails($email, $password) {\r\n\t\t\t$sql = \"SELECT * FROM `users` WHERE UPPER(email)=UPPER('%s') AND password='%s'\";\r\n\t\t\t$result = $this->query($sql, $email, sha1($password));\r\n\t\t\tif (mysql_num_rows($result) == 0)\r\n\t\t\t\treturn false;\r\n\t\t\treturn true;\r\n\t\t}", "function user_is_valid($username, $hash_pw)\n {\n // Connect to MySQL\n $link = get_link(TRUE);\n\n $username = mysqli_real_escape_string($link, $username);\n $query = \"\n SELECT * FROM User\n WHERE name = '$username' AND hash_pw = '$hash_pw'\";\n $result = mysqli_query($link, $query);\n if ($row = mysqli_fetch_array($result))\n return TRUE;\n mysqli_free_result($result);\n mysqli_close($link);\n return FALSE;\n }", "function login_name(){\n\t\tif(isset($_POST[\"user_name\"])){\n\t\t\t$user_name=$_POST[\"user_name\"];\n\t\t\t$valid='TRUE';\n\t\t\t$data[\"check_name\"]=$this->db->query(\"SELECT * FROM user_account WHERE user_name='$user_name'\"); \n\t\t\tif($data[\"check_name\"]->num_rows() > 0){\n \t\t\techo \"true\";\n\t\t\t}\n\t\t\telse{\n\t\t\t\techo \"false\";\n\t\t\t}\n\t\t}\n\t}", "function login_check($pdo) {\n\n // First check for all variable sessions being set.\n if (isset($_SESSION['user_id'], $_SESSION['username'], $_SESSION['login_string'])) {\n $user_id = $_SESSION['user_id'];\n $username = $_SESSION['username'];\n $login_string = $_SESSION['login_string'];\n\n // Get string of browser.\n $user_browser = $_SERVER['HTTP_USER_AGENT'];\n\n $sqlLogin = \"SELECT user_id, login_id, password\n FROM user\n WHERE user_id = \" . $user_id . \";\";\n\n $loginList = $pdo->query($sqlLogin);\n\n // Check if result is returned.\n while ($loginRow = $loginList->fetch()) {\n $login_check = hash('sha512', $loginRow['password'] . $user_browser);\n\n // If match, then credentials are valid. User is logged in.\n if (hash_equals($login_check, $login_string)) {\n return true;\n } else {\n return false;\n }\n }\n } else {\n return false;\n }\n\n }", "function verifyLoginAdmin($userID, $password)\n {\n $LoginQuery = \"SELECT * from admins where id ='\".$userID.\"' and password='\".$password.\"'\";\n\n // result of the query set in variable login\n $loginAdmin = $this->dbConnection->selectQuery($LoginQuery);\n\n return $loginAdmin;\n }", "public function checkLogin(){\n $dbQuery = new DBQuery(\"\", \"\", \"\");\n $this->email = $dbQuery->clearSQLInjection($this->email);\n $this->senha = $dbQuery->clearSQLInjection($this->senha);\n \n // Verificar quantas linhas um Select por Email e Senha realiza \n $resultSet = $this->usuarioDAO->select(\" email='\".$this->email.\"' and senha='\".$this->senha.\"' \");\n $qtdLines = mysqli_num_rows($resultSet);\n \n // Pegar o idUsuario da 1ª linha retornada do banco\n $lines = mysqli_fetch_assoc($resultSet);\n $idUsuario = $lines[\"idUsuario\"];\n \n\n \n // retorna aonde a função foi chamada TRUE ou FALSE para se tem mais de 0 linhas\n if ( $qtdLines > 0 ){\n // Gravar o IdUsuario e o Email em uma Sessão\n session_start();\n $_SESSION[\"idUsuario\"] = $idUsuario;\n $_SESSION[\"email\"] = $this->email;\n return(true);\n }else{\n // Gravar o IdUsuario e o Email em uma Sessão\n session_start();\n unset($_SESSION[\"idUsuario\"]);\n unset($_SESSION[\"email\"]);\n return(false);\n }\n }", "function checkAuthentication($username, $password){\r\n\t$sql = sprintf(\"\r\n\t\tselect count(*) as DEM from adapter_users where USERNAME = '%s' and PASSWORD = '%s'\r\n\t\",mysql_real_escape_string($username),md5($password));\r\n\t$result = query($sql);\r\n\t$row = mysql_fetch_assoc($result);\r\n\t$dem = $row[\"DEM\"];\r\n\tif($dem){\r\n\t\treturn true;\r\n\t}\r\n\telse{\r\n\t\tWriteLog(\"Login :Fail\", $username);\r\n\t\tWriteLog(\"Login :Fail\", $password);\r\n\t\treturn false;\r\n\t}\r\n}", "function check_login() {\n\t\t$pdo = new PDO(DB_PATH);\n\n\t\tif (!isset($_SESSION[\"user_id\"]) || !isset($_SESSION[\"nonce\"])) {\n\t\t\treturn false;\n\t\t}\n\n\t\t$stmt = $pdo->prepare(\"SELECT ID, username, password, type FROM users WHERE ID = :userId\");\n\t\t$stmt->bindValue(\":userId\", $_SESSION[\"user_id\"], PDO::PARAM_INT);\n\n\n\t\tif (!$stmt->execute()) {\n\t\t\tthrow new PDOException($stmt->errorInfo()[2]);\n\t\t}\n\n\t\t$user_data = $stmt->fetch();\n\n\n\t\treturn $_SESSION[\"nonce\"] == md5(serialize($user_data)) && intval($_SESSION['user_id']) == intval($user_data['ID']);\n\t}", "function validata_user($un , $pwd){ \n\t\t$mysql = new Mysql();\n\t\t$ensure_credentials = $mysql->verify_Username_and_Pass($un , $pwd);\n\n\t\tif ($ensure_credentials) {\n\n\t\t\t$sql = \"select * from staff where username = '$un' and password = '$pwd'\";\n\t\t\t$query = mysql_query($sql);\n\t\t\t$row = mysql_fetch_row($query);\n\t\t\t$role = $row[5];\n\t\t\t$id = $row[0];\n\t\t\t//print_r($sql);\n\n\t\t\t$_SESSION['status'] = 'authorized';\n\t\t\t$_SESSION['username'] = $un;\n\t\t\t$_SESSION['role'] = $role;\n\t\t\t$_SESSION['id'] = $id;\n\n\t\t\t//link to different role index page.\n\t\t\tswitch ($role){\n\t\t\t case 'region manager':\n\t\t\t\t\theader('location: manager/manager.staff.php');\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'manager':\n\t\t\t\t\theader('location: manager/manager.staff.php');\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'staff':\n\t\t\t\t\t//clear the temp data.\n\t\t\t\t\t$deletesql = \"delete from checkBookTemp where 1\";\n\t\t\t\t\tmysql_query($deletesql);\n\t\t\t\t\t$deletesql = \"delete from bulkTemp where 1\";\n\t\t\t\t\tmysql_query($deletesql);\n\t\t\t\t\theader('location: staff/staff.index.php');\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\theader('location: customer/customer.index.php');\n\t\t\t}\n\t\t\t#header('location: index.php');\n\t\t\t#return \"HELLO\";\n\t\t} else \n\t\treturn \"Please enter a correct username and password\";\n\t}", "function doLogin($username,$password)\n{\n // check password\n return true;\n //return false if not valid\n}", "public function CheckLogin()\r\n {\r\n $visiteur = new Visiteur();\r\n \r\n //Appelle la fonction Attempt pour verifier le login et le password, si cela correspond $result prends la valeur ID correspondant a l'utilisateur\r\n $result = $visiteur->Attempt($_POST['login'],$_POST['password']);\r\n \r\n //SI l'ID a une valeur, stocke l'ID dans $_SESSION et ramene a la main mage\r\n if (isset($result)){\r\n $_SESSION['uid'] = $result->id;\r\n $this->MainPage();\r\n }\r\n //Sinon, ramene a la page de connexion\r\n else{\r\n $this->LoginPage();\r\n } \r\n }", "public function loginValidated()\n\t\t{\n\t\t\t$campos = array('*');\n\t\t\t\n\t\t\t$pw = $this->_objCrypt->encrypt($this->_password);\n\n\t\t\t# Campos que se incluyen en la validacion WHERE DE LA SQL\n\t\t\t$field['userName'] = $this->_userName;\n\t\t\t$register = Usuario::findCustom($campos, $field);\n\n\t\t\t# Validación nombre usuario en BD\n\t\t\tif (empty($register)) {\n\t\t\t\t$json_error = array('success' => 'error', 'error' => 'error1');\n\t\t\t\t$success = json_encode($json_error);\n\t\t\t\tsetcookie(\"success\", $success, time() + 60, \"/\"); \n\t\t\t\theader('location:../views/users/login.php');\n\t\t\t}else{\n\t\t\t\t# pw que se obtiene de BD\n\t\t\t\t$pw_DB = $register[0]->getPassword();\n\n\t\t\t\t# Validacion coincidencia de contraseñas\n\t\t\t\tif ($pw !== $pw_DB) {\n\t\t\t\t\t$json_error = array('success' => 'error', 'error' => 'error2');\n\t\t\t\t\t$success = json_encode($json_error);\n\t\t\t\t\tsetcookie(\"success\", $success, time() + 60, \"/\"); \n\t\t\t\t\theader('location:../views/users/login.php');\n\t\t\t\t}else{\n\t\t\t\t\t$data_session['id_user'] \t= $register[0]->getId();\t\t\t\t\t\n\t\t\t\t\t$data_session['nombre'] \t= $register[0]->getNombre();\t\t\t\n\t\t\t\t\t$data_session['apellido'] \t\t= $register[0]->getApellido();\t\t\t\n\t\t\t\t\t$data_session['tipoUsuario']\t= $register[0]->getTipoUsuario();\t\t\t\n\t\t\t\t\t$data_session['userName'] \t\t= $register[0]->getUserName();\t\t\t\n\t\t\t\t\t$data_session['email'] \t\t = $register[0]->getEmail();\t\t\t\n\t\t\t\t\t$data_session['telFijo'] \t\t= $register[0]->getTelFijo();\t\t\t\n\t\t\t\t\t$data_session['telMovil'] \t\t= $register[0]->getTelMovil();\t\t\t\n\t\t\t\t\t$data_session['estado'] \t\t= $register[0]->getEstado();\n\t\t\t\t\t$data_session['lan']\t\t\t= $_COOKIE['lan'];\n\t\t\t\t\t\n\t\t\t\t\t$obj_Session = new Simple_sessions();\n\t\t\t\t\t$obj_Session->add_sess($data_session);\n\n\t\t\t\t\theader('location:../views/users/crearUsuario.php');\n\t\t\t\t}\n\t\t\t}\n\t\t}", "public function validate_database_login_session() {\n $user_id = $this->auth->session_data[$this->auth->session_name['user_id']];\n $session_token = $this->auth->session_data[$this->auth->session_name['login_session_token']];\n\n $sql_where = array(\n $this->auth->tbl_col_user_account['id'] => $user_id,\n $this->auth->tbl_col_user_account['suspend'] => 0,\n $this->auth->tbl_col_user_session['token'] => $session_token\n );\n\n // If a session expire time is defined, check its valid.\n if ($this->auth->auth_security['login_session_expire'] > 0)\n {\n $sql_where[$this->auth->tbl_col_user_session['date'].' > '] = $this->database_date_time(-$this->auth->auth_security['login_session_expire']);\n }\n\n $query = $this->db->from($this->auth->tbl_user_account)\n ->join($this->auth->tbl_user_session, $this->auth->tbl_join_user_account.' = '.$this->auth->tbl_join_user_session)\n ->where($sql_where)\n ->get();\n\n ###+++++++++++++++++++++++++++++++++###\n\n // User login credentials are valid, continue as normal.\n if ($query->num_rows() == 1)\n {\n // Get database session token and hash it to try and match hashed cookie token if required for the 'logout_user_onclose' or 'login_via_password_token' features.\n $session_token = $query->row()->{$this->auth->database_config['user_sess']['columns']['token']};\n $hash_session_token = $this->hash_cookie_token($session_token);\n\n // Validate if user has closed their browser since login (Defined by config file).\n if ($this->auth->auth_security['logout_user_onclose'])\n {\n if (get_cookie($this->auth->cookie_name['login_session_token']) != $hash_session_token)\n {\n $this->set_error_message('login_session_expired', 'config');\n $this->logout(FALSE);\n return FALSE;\n }\n }\n // Check whether to unset the users 'Logged in via password' status if they closed their browser since login (Defined by config file).\n else if ($this->auth->auth_security['unset_password_status_onclose'])\n {\n if (get_cookie($this->auth->cookie_name['login_via_password_token']) != $hash_session_token)\n {\n $this->delete_logged_in_via_password_session();\n return FALSE;\n }\n }\n\n // Extend users login time if defined by config file.\n if ($this->auth->auth_security['extend_login_session'])\n {\n // Set extension time.\n $sql_update[$this->auth->tbl_col_user_session['date']] = $this->database_date_time();\n\n $sql_where = array(\n $this->auth->tbl_col_user_session['user_id'] => $user_id,\n $this->auth->tbl_col_user_session['token'] => $session_token\n );\n\n $this->db->update($this->auth->tbl_user_session, $sql_update, $sql_where);\n }\n\n // If loading the 'complete' library, it extends the 'lite' library with additional functions,\n // however, this would also runs the __construct twice, causing the user to wastefully be verified twice.\n // To counter this, the 'auth_verified' var is set to indicate the user has already been verified for this page load.\n return $this->auth_verified = TRUE;\n }\n // The users login session token has either expired, is invalid (Not found in database), or their account has been deactivated since login.\n // Attempt to log the user in via any defined 'Remember Me' cookies.\n // If the \"Remember me' cookies are valid, the user will have 'logged_in' credentials, but will have no 'logged_in_via_password' credentials.\n // If the user cannot be logged in via a 'Remember me' cookie, the user will be stripped of any login session credentials.\n // Note: If the user is also logged in on another computer using the same identity, those sessions are not deleted as they will be authenticated when they next login.\n else\n {\n $this->delete_logged_in_via_password_session();\n return FALSE;\n }\n }", "function verify_login() {\n //Validation Rules\n $this->form_validation->set_rules('username','Username','trim|required|min_length[3]|xss_clean');\n $this->form_validation->set_rules('password','Password','trim|required|min_length[3]|xss_clean');\n\n if (!$this->form_validation->run()) {\n return false ;\n } else {\n return true;\n }\n }", "public function checkLogin()\n\t{\n\t\t$sql = sprintf\n\t\t\t('\n\t\t\t\tSELECT id FROM adminner WHERE username = \"%s\" AND password = \"%s\"',\n\t\t\t\t$this->getUsername(),\n\t\t\t\t$this->getPassword()\n\t\t\t);\n\t\t\t\n\t\t\t$query = $this->db->query($sql);\n\n\t\treturn $query->num_rows();\n\t}", "function checkUserLoginInfo($db, $username, $password)\r\n{\r\n\t//Fetch the account ID for the user in the current session\r\n\t$userID = \"SELECT `acc_id` FROM `account` WHERE(`acc_name`='\" .$username. \"')\";\r\n\t$id = mysqli_query($db, $userID);\r\n\t$accID = mysqli_fetch_assoc($id);\r\n\t\r\n\t// Set session variables\r\n\t$_SESSION[\"accountID\"] = $accID[\"acc_id\"];\r\n\t$_SESSION[\"username\"] = \"\".$username.\"\";\r\n\t$_SESSION[\"password\"] = \"\".$password.\"\";\r\n\t\r\n\t//Check if the entered info is correct\r\n\t$inQuery = \"SELECT `acc_name`, `password` FROM `account` WHERE (`acc_name`='\" .$username. \"' AND `password`='\" .$password .\"')\";\r\n\t\r\n\t$runQuery = mysqli_query($db, $inQuery);\r\n\t\r\n\tif(mysqli_num_rows($runQuery) == false)\r\n\t{\r\n\t\t//Window.alert(\"<p style=\".\"position:relative;left:250px;top:250px;\".\"> Invalid username or password</p>\");\r\n\t\techo \"<p style=\".\"position:relative;left:250px;top:250px;\".\"> Invalid username or password</p>\";\r\n\t\t\r\n\t}\r\n\telse\r\n\t{\r\n\t\t//Goes to the next page.\r\n\t\theader(\"Location: mainPage.php\");\r\n\t\t\r\n\t}\r\n}", "function is_valid($username, $password) \n{\n global $conn;\n \n $sql = \"SELECT * FROM Users WHERE ((Username ='$username') and (Password = '$password'))\";\n $result = mysqli_query($conn, $sql);\n if (mysqli_num_rows($result) > 0) // check the number of selected rows\n return true;\n else\n return false;\n}", "function p_login() {\n $_POST = DB::instance(DB_NAME)->sanitize($_POST);\n\n # Hash submitted password so we can compare it against one in the db\n $_POST['password'] = sha1(PASSWORD_SALT.$_POST['password']);\n\n # Search the db for this email and password\n # Retrieve the token if it's available\n $q = \"SELECT token \n FROM users \n WHERE email = '\".$_POST['email'].\"' \n AND password = '\".$_POST['password'].\"'\";\n\n $token = DB::instance(DB_NAME)->select_field($q);\n\n # If we didn't find a matching token in the database, it means login failed\n if(!$token) {\n\n # Send them back to the login page\n Router::redirect(\"/users/login/error\");\n\n # But if we did, login succeeded! \n } else {\n /* \n Store this token in a cookie using setcookie()\n Important Note: *Nothing* else can echo to the page before setcookie is called\n Not even one single white space.\n param 1 = name of the cookie\n param 2 = the value of the cookie\n param 3 = when to expire\n param 4 = the path of the cookie (a single forward slash sets it for the entire domain)\n */\n setcookie(\"token\", $token, strtotime('+1 year'), '/');\n\n # update the last_login time for the user\n/* $_POST['last_login'] = Time::now();\n\n $user_id = DB::instance(DB_NAME)->update('users', $_POST); */\n\n # Send them to the main page - or whever you want them to go\n Router::redirect(\"/\");\n }\n }", "function checkLogin($myusername,$mypassword)\n\t{\n\t\tmysql_connect(DB_HOST, DB_USER, DB_PASSWORD)or die(\"Failed to connect to MySQL: \" . mysql_error());\n\t\tmysql_select_db(DB_NAME)or die(\"Failed to connect to MySQL: \" . mysql_error());\n\n\t\t// To protect MySQL injection (more detail about MySQL injection)\n\t\t$myusername = stripslashes($myusername);\n\t\t$mypassword = stripslashes($mypassword);\n\t\t$myusername = mysql_real_escape_string($myusername);\n\t\t$mypassword = mysql_real_escape_string($mypassword);\n\n\t\t//$sql=\"SELECT * FROM $table_name WHERE userName='$myusername' and password='$mypassword'\";\n\t\t$result = mysql_query(\"SELECT * FROM websiteusers WHERE userName='$myusername' AND pass='$mypassword'\") or die(mysql_error()); //db is hardcoded to reduce number of variables\n\n\t\t// Mysql_num_row is counting table row\n\t\t$count = mysql_num_rows($result);\n\n\t\t// If result matched $userName and $password, table row must be 1 row\n\n\t\tif($count == 1)\n\t\t{\n\t\t\t// Register $userName, $password and redirect to file \"login_success.php\"\n\t\t\t$_SESSION['myusername'] = $myusername;\n\t\t\treturn true;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t}", "function check_login($data){\n /* Codify the password */\n $sha1_password = sha1($data['password']);\n /* Check the login data at the DB table users */\n $this->db->from('users');\n $this->db->where('username', $data['username']);\n $this->db->where('password',$sha1_password);\n $result = $this->db->get();\n if($result->num_rows() > 0){\n /* If it works return the user's id */\n return true;\n } else {\n return false;\n } \n }", "function check_login_from_db($user, $pass)\n{\n\t$db = open_database_connection();\n\t$stmt = $db->prepare(\"SELECT userID, name, login, pass\n\t\t\t\t\t\tFROM user\n\t\t\t\t\t\tWHERE login = :user AND pass = :pass\");\n\t$stmt->execute(array(':user' => $user,':pass' => $pass));\n\t$users = $stmt->fetchAll(PDO::FETCH_ASSOC);\n close_database_connection($db);\n return empty($users);\n}", "function isvalidUser($uid, $sqlConnection)\r\n{ $result = array();\r\n\t$sqlSuccess = get_sql_results($result, $sqlConnection,\r\n\t\t\t\"select * from uc_users \".\r\n\t\t\t\"where id = '$uid'\");\r\n\treturn $sqlSuccess;\r\n}", "function adminLogin($username, $password){\r\n \r\n $query = 'SELECT pass FROM users WHERE username = '.$username; \r\n \r\n $results = mysqli_query( $dbc , $query );\r\n \r\n $row = mysqli_fetch_array( $results , MYSQLI_ASSOC );\r\n \r\n return password_verify($password, $row['pass']);\r\n }", "function checkLogin($db){\n $this->errorMsg=$this->errorInvalid; \n $need_to_clear = false;\n\n $tbl_password=\"\";\t \n $tbl_uid=-1;\t \n $valid_user=false;\n $auto_reset = \"N\";\n $internal_web='N';\n $external_web='N';\n $action=sanitize(@$_POST['action'],false);\n $got_error=false; // Must not continue if TRUE\n $userName = sanitize(trim($_POST['userName']),true);\n if (strlen($userName)>25) {\n return;\n }\n //$userName = mysql_real_escape_string($userName);\n $userPass = sanitize(trim(@$_POST['userPass']),false);\n \n //if (strlen($userPass)<32) {\n // $userPass = md5($userPass);\n //}\n\n $s=\"SELECT ID,userName,userPass,userGroup,customerid,isAdmin,active,internal_web,external_web, \n fail_login_count,auto_reset,last_fail_login_time,now() as cur_time,blocked FROM myuser \n WHERE userName='$userName' AND active ='Y'\";\n $db->query($s);\n\n if ($db->resultCount()>0) {\n $db->fetchRow();\n $tbl_uid = $db->record['ID']; \n $this->isAdmin=$db->record['isAdmin'];\n $this->usergroup=$db->record['userGroup'];\n\n $internal_web=trim($db->record['internal_web']);\n $external_web=trim($db->record['external_web']);\n $tbl_password=trim($db->record['userPass']);\n $this->customer_id=trim($db->record['customerid']);\n $auto_reset=trim($db->record['auto_reset']);\n\n if ( $this->usergroup==1 && $external_web==\"N\") { \n if (remote_access($this->host,$this->ip_addr)==true) { // From adminpro_config - Factory dependednt function\n $db->clear();\n $this->errorMsg=\"Not allowed to access \" . $this->host ;\n save_error($db, \"login\", \"access_intranet\", $userName. \" Not allowed to access to Internet, Host: \".$this->host .\" From \".$this->ip_addr ); \n $this->error_point=4;\n $this->prompt_error($db,true); \n return;\n }\n } \n \n } else {\n $got_error=true;\n $db->clear();\n if ( $this->usergroup == CUSTOMER_USER_GROUP_ADMIN && (strlen($this->customer_id)==0 ) ) { \n $got_error=true;\n $this->error_point=10;\n $this->errorMsg=\"Sorry, your Online ID has not been approved by Adventa-Health.\";\n save_error($db, \"login\", \"e_order_inactive\", \"User ID: \".$userName. \", IP=\".$this->ip_addr.\", Customer Account ID Not activated / disabled.\" ); \n } else {\n $this->errorMsg=\"Authentication Failed.\";\n }\n $this->error_point=5;\n $this->prompt_error($db,true);\n return;\n }\n $reset_to_active=false;\n $need_to_clear = true;\n \n //Reactive Account after certain period provided 'auto_reset=Y \n if ($db->record['fail_login_count'] >= 3 ) { //000\n \n if ($db->record['blocked']=='Y' ) { // Auto Reset to Active if auto-reset is enabled\n \n if ( $auto_reset=='Y') {\n $need_to_clear=false;\n if (strtotime($db->record['last_fail_login_time']) > strtotime('1980-01-01 00:00:00') && (strtotime($db->record['cur_time']) - strtotime($db->record['last_fail_login_time']))>1800) {\n // Auto Reset to Active \n $db->clear();\n $db->query(\"UPDATE myuser SET blocked='N',fail_login_count=0,last_fail_login_time='1900-01-01 00:00:00' WHERE userName='$userName'\");\n $reset_to_active=true; \n } else {\n $db->clear();\n $this->error_point=6;\n $got_error=true;\n $this->errorMsg=\"Your Login Account has been disabled due to too many failed login attempts.\";\n \n }\n } else {\n $db->clear();\n $need_to_clear=false;\n $got_error=true;\n $this->error_point=7;\n $this->errorMsg=\"Your Login Account Is Not Active or has been disabled.\";\n \n }\n \n } else { // Below : fail count >=3 , account is disabled here\n if ($this->block_access=='Y') {\n $db->clear();\n $got_error=true;\n $this->error_point=8;\n $need_to_clear=false;\n $db->query(\"UPDATE myuser SET blocked='Y', last_fail_login_time=now() WHERE username='$userName'\");\n $this->errorMsg = \"Too many failed attempts to login from \" . $this->ip_addr . \", Account Disabled\";\n save_error($db, \"login\", \"Login_Error\", \"User ID: \".$userName. \", \".$this->errorMsg ); \n } // lock Access\n }\n } elseif ($this->block_access=='Y' && $userPass<>$tbl_password ) {\n // Active but wrong password, increase fail_login counter - Might cause proble if someone uses this ID to disable the account\n $db->clear();\n $got_error=true;\n $this->error_point=9;\n $db->query(\"UPDATE myuser SET fail_login_count=(fail_login_count+1) WHERE userName='$userName'\");\n $need_to_clear=false; \n\n } //000\n \n \n if ($need_to_clear==true) {\n $db->clear();\n $need_to_clear=false; \n } \n if ($got_error==true) {\n $this->prompt_error($db,true); \n return;\n }\n // Both UserName and password are correct, Login Success \n if ($action==\"login\" && $userPass==$tbl_password && $tbl_uid>0) { \n\n @session_regenerate_id(true);\n $_SESSION['sessionID']= session_id();\n $_SESSION['userID'] = $tbl_uid;\n\n $auth_key = md5(time().$_SESSION['userID']);\n $_SESSION['otp'] = $auth_key;\n //setcookie(\"auth_key\", $auth_key, time() + 60 * 60 * 24 * 7, \"/\", \"tn.adventa.com\", false, true);\n $SQL = \"UPDATE myuser SET \". $this->tblLastLog.\"= now(),last_access=now(), \";\n $SQL.= $this->tblSessionID.\"='\".session_id().\"',otp='$auth_key',\";\n $SQL.= \"ip_addr='\".$this->ip_addr.\"',fail_login_count=0,last_fail_login_time='1900-01-01 00:00:00' \";\n $SQL.= \" WHERE ID =\".$tbl_uid;\n\n $db->query($SQL);\n \n if ($this->enblRemember){\n\t setcookie($this->cookieRemName,$userName,time()+(60*60*24*$this->cookieExpDays));\n }\n \n $this->checkSession($db);\n\n } else { // user name & Password are correct\n // Below : password not correct\n if ($this->block_access=='Y' && strlen($userName)>0) {\n $db->query(\"UPDATE myuser SET ip_addr='\".$this->ip_addr.\"',fail_login_count=(fail_login_count+1) WHERE userName='$userName'\"); \n } \n $this->error_point=11;\n $this->prompt_error($db,true);\n return;\n } // user name & Password are correct\n \n}", "function dbloginCheck($user_login, $pwd)\n{\n $sql=\"SELECT * FROM ra_company WHERE _email = :email AND _password=:passwword\";\n $q = $this->conn->prepare($sql);\n $q->execute(array(':email'=>$user_login, ':passwword'=>md5($pwd))) or die(print_r($q->errorInfo()));\n $totalrow=$q->rowCount();\n if($totalrow==1){\n $data = $q->fetch(PDO::FETCH_ASSOC);\n return $data;\n}\n else{\n return 0;\n }\n}", "public function check() {\n $check = $this->mysqli->query(\"SELECT * FROM user_info WHERE email='$this->email' && password ='$this->password' LIMIT 1\") or die($this->mysqli->error);\n $count = $check->num_rows;\n\n if ($count) {\n while($rows = $check->fetch_array(MYSQLI_ASSOC)){\n $this->loginID = $rows['loginID'];\n $_SESSION['loginID'] = $this->loginID;\n }\n $_SESSION['email'] = $this->email;\n $this->result .= \"Successfully Logged In\";\n } else {\n $this->result .= \"Sign In error!! Please try again\";\n }\n }", "public function p_login() {\n\n\t\t# Sanitize the user entered data to prevent any funny-business (re: SQL Injection Attacks)\n\t\t$_POST = DB::instance(DB_NAME)->sanitize($_POST);\n\n\t\t# Hash submitted password so we can compare it against one in the db\n\t\t$_POST['password'] = sha1(PASSWORD_SALT.$_POST['password']);\n\n\t\t# Search the db for this email and password\n\t\t# Retrieve the token if it's available\n\t\t$q = \"SELECT token \n\t\t\tFROM users \n\t\t\tWHERE email = '\".$_POST['email'].\"' \n\t\t\tAND password = '\".$_POST['password'].\"'\";\n\n\t\t$token = DB::instance(DB_NAME)->select_field($q);\n\n\t\t# If we didn't find a matching token in the database, it means login failed\n\t\tif(!$token) {\n\n\t\t\t# Send them back to the login page\n\t\t\tRouter::redirect(\"/users/login/error\");\n\n\t\t# But if we did, login succeeded! \n\t\t} else {\n\t\t\tsetcookie(\"token\", $token, strtotime('+1 year'), '/');\n\t\t\t# Send them to the main page - or whever you want them to go\n\t\t\tRouter::redirect(\"/\");\n\t\t}\n\t}", "function validate_login(array $safe_input, array &$field): bool\n{\n if (isset($safe_input['email'])) {\n if (!App\\App::$db->getRowsWhere('users', ['email' => $safe_input['email'], 'password' => $safe_input['password']])) {\n $field['error'] = 'Wrong login credentials';\n\n return false;\n }\n }\n\n return true;\n}", "function validateUsername(&$errors, $field_list, $field_name, $enteredUser)\n{\n\t$UsernamePat = '/^[a-zA-Z0-9]+$/'; //username regex\n\tif (!isset($field_list[$field_name])|| empty($field_list[$field_name])) //check if empty\n\t\t$errors[$field_name] = ' Required';\n\telse if (!preg_match($UsernamePat, $field_list[$field_name])) //check if entry is valid\n\t\t$errors[$field_name] = ' Invalid';\n\telse { //checks if username has been used\n\t\t$pdo = new PDO('mysql:host=mysql.ahtomsk.com;dbname=brisfi', 'brisfi_user', 'test1234');\n\t\t$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);\n\t\n\t\ttry\t{\n\t\t\t$query = $pdo->prepare(\"SELECT * \".\n\t\t\t\t\t\t\t\t\"FROM users \".\n\t\t\t\t\t\t\t\t\"WHERE username = '$enteredUser'\");\n\t\t\t$query->execute();\n\t\t}\n\t\tcatch (PDOException $e) \n\t\t{\n\t\t\techo $e->getMessage();\n\t\t}\n\n\t\t$rowCount = $query->rowCount();\n\n\t\tif($rowCount > 0){\n\t\t$errors[$field_name] = ' Username already in use';\n\t\t}\n\t}\n}", "function checkIfValidUserAndPasswordWithHttpBasicAuth()\n{\n $con = getMySqliConnection();\n\n $myusername = mysqli_real_escape_string($con,$_SERVER['PHP_AUTH_USER']);\n $mypassword = mysqli_real_escape_string($con,$_SERVER['PHP_AUTH_PW']);\n //encrypt password\n $mypassword = md5($mypassword);\n\n $sql = \"\";\n $sql .= \"SELECT * \";\n $sql .= \"FROM members \";\n $sql .= \"WHERE username = '$myusername' \";\n $sql .= \" AND PASSWORD = '$mypassword' \";\n $sql .= \" AND active = 1 \";\n\n $result = mysqli_query($con,$sql);\n\n if ($result != FALSE) {\n $count = mysqli_num_rows($result);\n }\n mysqli_close($con);\n // Mysql_num_row is counting table row\n\n\n // If result matched $myusername and $mypassword, table row must be 1 row\n\n if ($count == 1) {\n return true;\n }\n else\n {\n return false;\n }\n}", "function checklogin($userName,$password) {\n\n $db = DB::getInstance();\n\n $stmt = $db->prepare(\"SELECT * FROM User WHERE userName=?\");\n $stmt->bind_param('s', $userName);\n $stmt->execute();\n $result = $stmt->get_result();\n\n if(!$result || $result->num_rows !== 1) {\n return array('verified' => false, 'userId' => null, 'isAdmin' => null);\n }\n $row = $result->fetch_assoc();\n\n return array('verified' => password_verify($password, $row[\"password\"]), 'userId' => $row[\"id\"], 'isAdmin' => $row['admin'],'firstName' => $row['firstName']);\n}", "function validarLogin($nick, $clave){\r\n $this->db->select(\"*\");\r\n $this->db->where('nickname',$nick);\r\n $this->db->where('password',$clave);\r\n $resultado = $this->db->get('usuario');\r\n if($resultado->num_rows()>0){\r\n return true;\r\n }else{\r\n return false;\r\n }\r\n }", "public function login_action() \n\t{\n $rules = array(\n 'mail' => 'valid_email|required',\n 'pass' => 'required'\n );\n \n \n //validate the info\n $validated = FormValidation::is_valid($_POST, $rules);\n \n // Check if validation was successful\n if($validated !== TRUE): \n \n //exit with an error\n exit(Alert::error(false, true, $validated));\n\n endif;\n\n // they've passed the filter login try and log 'em in\n\t\tUserModel::login(); \n }", "function loginHandler($inputs = []) {\n $username = $inputs['username'];\n $password = $inputs['password'];\n $sql = 'SELECT * FROM `admin` WHERE `name` = ? AND password = ?';\n $res = getOne($sql, [$username, $password]);\n if (!$res) {\n formatOutput(false, 'username or password error');\n }\n else{\n $buildingRes = getOne(\"SELECT * FROM `admin_building` WHERE admin_id =?\", [$res['id']]);\n $bid = isset($buildingRes['building_id']) ? $buildingRes['building_id'] : '0';\n setLogin($res['id'],$bid);\n formatOutput(true, 'login success', $res);\n }\n}", "abstract protected function is_valid($username, $password);", "function validate_login($user_name = '', $password = '') {\n $credential = array('user_name' => $user_name, 'profile_password' => $password);\n \n // Checking login credential for admin\n $query = $this->db->get_where('user', $credential);\n if ($query->num_rows() > 0) {\n $row = $query->row();\n $this->session->set_userdata('user_login', 'true');\n $this->session->set_userdata('login_user_id', $row->user_id);\n $this->session->set_userdata('name', $row->user_name);\n $this->session->set_userdata('email', $row->user_email);\n return 'success';\n }\n \n return 'invalid';\n }", "function valid_credentials($email, $password){\n\n\t$pass = sha1($password);\n\n\t$link = mysqli_connect(\"localhost\", \"root\", \"\", \"formstack1\");\n \n $sql = \"SELECT * from `users` where `email_address` = \n '{$email}' AND `pass_word` = '{$pass}' \";\n \n $result = mysqli_query($link, $sql);\n \n\treturn (mysqli_result($result, 0) == '1') ? true : false;\n\n}", "public function Login_Validation($sorce){\r\n\r\n // Set validation flag as true\r\n $this->_flag = true;\r\n\r\n // Validate $username\r\n self::Username_Login_Validation($sorce);\r\n\r\n // Validate $username\r\n self::Password_Login_Validation($sorce);\r\n }", "function is_password_valid ($password, $user_data) {\n // the one in the user records.\n $is_valid = $password == $user_data['password'];\n return $is_valid;\n}", "function dbCheckLogin($login, $password)\n {\n $rs = null;\n /* Query the database for the login and password tuple. */\n $args = [\n 'login' => $login,\n 'password%sql' => array('MD5(%s)', $password)\n ];\n $result = dibi::query('SELECT * FROM `user` WHERE %and', $args);\n\n Debug::barDump($result, 'StudentBean login check after db query');\n\n /* In case that the LDAP server is down for some reason, we have the\n possibility to skip the LDAP check. */\n if (empty ($result) && (LDAPConnection::isActive($this->_smarty)))\n {\n /* As a last resort, try to contact the LDAP server and verify\n the user. */\n $result = dibi::query('SELECT * FROM `student` WHERE `login`=%s', $login);\n if (!empty ($result))\n {\n /* Login exists, check the password. */\n $valid = $this->ldapCheckLogin($login, $password);\n /* If the password check failed, clear the contents of $rs. */\n if (!$valid) $result = null;\n }\n }\n\n /* Empty $result now signals that the student could not be verified. */\n if (!empty ($result))\n {\n Debug::barDump($result, 'StudentBean result after ldap check');\n\n /* If the verification succeeded, we have to update the information\n about the student so that the student's home page gets displayed\n correctly. */\n $row = $result->fetch();\n $this->id = $row['id'];\n $this->dbQuerySingle();\n /* Set the returned record. */\n $rs = $this->rs;\n }\n\n return $rs;\n }", "function auth_check_login($email, $password) {\n\t//database query\n\t$query = \"SELECT * \"\n\t\t\t\t. \"FROM users \"\n\t\t\t\t. \"WHERE email = '\".addslashes($email).\"' or ID = '\".addslashes($email).\"'\";\n\t$result = run_sql($query);\n\t$db_field = mysql_fetch_assoc($result);\n\n\t//if query returns a result\n\tif(mysql_num_rows($result)){\n\t\t$result_password = mysql_result($result, 0, \"password\");\n\t\t$result_user = mysql_result($result, 0, \"email\");\n\t\t$result_firstname = mysql_result($result, 0, \"first_name\");\n\t\t$result_location = mysql_result($result, 0, \"location\");\n\t\t$result_lastname = mysql_result($result, 0, \"last_name\");\n\t\t$userid = mysql_result($result, 0, \"ID\");\n\t\n\t\t//if email and corresponding password are valid\n\t\tif(($email == $result_user || $email == $userid) && ($password == $result_password)){\n\t\t\t//sets session variables\n\t\t\t$_SESSION['id'] = $userid;\n\t\t\t$_SESSION['email'] = $email;\n\t\t\t$_SESSION['firstname'] = $result_firstname;\n\t\t\t$_SESSION['location'] = $result_location;\n\t\t\t$_SESSION['lastname'] = $result_lastname;\n\t\t\t$_SESSION['username'] = $result_firstname . \" \" . $result_lastname;\n\t\t\t$_SESSION['active'] = true;\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}", "public function checkData()\n\t{\n\t\t$result = parent::checkData();\n\t\t$query = (new \\App\\Db\\Query())->from($this->baseTable)->where(['server_id' => $this->get('server_id'), 'user_name' => $this->get('user_name')]);\n\t\tif ($this->getId()) {\n\t\t\t$query->andWhere(['<>', 'id', $this->getId()]);\n\t\t}\n\t\treturn !$result && $query->exists() ? 'LBL_DUPLICATE_LOGIN' : $result;\n\t}", "function login_as_member()\n {\n if (Session::userdata('group_id') != 1)\n {\n return Cp::unauthorizedAccess();\n }\n\n if (($id = Request::input('mid')) === FALSE)\n {\n return Cp::unauthorizedAccess();\n }\n\n if (Session::userdata('member_id') == $id)\n {\n return Cp::unauthorizedAccess();\n }\n\n // ------------------------------------\n // Fetch member data\n // ------------------------------------\n\n // @todo - Can Access CP? That is now a member_group_preferences value\n $query = DB::table('members')\n ->select('account.screen_name', 'member_groups.can_access_cp')\n ->join('member_groups', 'member_groups.group_id', '=', 'members.group_id')\n ->where('member_id', $id)\n ->first();\n\n if (!$query){\n return Cp::unauthorizedAccess();\n }\n\n Cp::$title = __('members.login_as_member');\n Cp::$crumb = Cp::anchor(BASE.'?C=Administration'.AMP.'area=members_and_groups', __('admin.members_and_groups')).\n Cp::breadcrumbItem(__('members.login_as_member'));\n\n\n // ------------------------------------\n // Create Our Little Redirect Form\n // ------------------------------------\n\n $r = Cp::formOpen(\n array('action' => 'C=Administration'.AMP.'M=members'.AMP.'P=do_login_as_member'),\n array('mid' => $id)\n );\n\n $r .= Cp::quickDiv('default', '', 'menu_contents');\n\n $r .= Cp::table('tableBorder', '0', '', '100%');\n\n $r .= '<tr>'.PHP_EOL.\n Cp::td('tableHeadingAlt', '', '2').__('members.login_as_member').\n '</td>'.PHP_EOL.\n '</tr>'.PHP_EOL;\n\n $r .= '<tr>'.PHP_EOL.\n Cp::td('').\n Cp::quickDiv('alert', __('members.cp.action_can_not_be_undone')).\n Cp::quickDiv('littlePadding', str_replace('%screen_name%', $query->screen_name, __('members.login_as_member_description'))).\n '</td>'.PHP_EOL.\n '</tr>'.PHP_EOL;\n\n $r .= '<tr>'.PHP_EOL.\n Cp::td('');\n\n $r .= Cp::quickDiv('',\n Cp::input_radio('return_destination', 'site', 1).'&nbsp;'.\n __('members.site_homepage')\n );\n\n if ($query->can_access_cp == 'y')\n {\n $r .= Cp::quickDiv('',\n Cp::input_radio('return_destination', 'cp').'&nbsp;'.\n __('members.control_panel')\n );\n }\n\n $r .= Cp::quickDiv('',\n Cp::input_radio('return_destination', 'other', '').'&nbsp;'.\n __('members.other').NBS.':'.NBS.Cp::input_text('other_url', Site::config('site_url'), '30', '80', 'input', '500px')\n );\n\n $r .= '</td>'.PHP_EOL.\n '</tr>'.PHP_EOL.\n '<tr>'.PHP_EOL.\n Cp::td('').\n Cp::quickDiv('littlePadding', Cp::input_submit(__('cp.submit'), 'submit')).\n '</td>'.PHP_EOL.\n '</tr>'.PHP_EOL.\n '</table>'.PHP_EOL.\n '</div>'.PHP_EOL;\n\n Cp::$body = $r;\n }", "public function checkUserPassword()\n\t{\n\t\tself::authenticate();\n\n\t\t$uname = FormUtil::getPassedValue('user', null);\n\t\t$pass = FormUtil::getPassedValue('up', null);\n\n\t\tif($uname == null) {\n\t\t\treturn self::retError('ERROR: No user name passed!');\n\t\t}\n\t\tif($pass == null) {\n\t\t\treturn self::retError('ERROR: No up passed!');\n\t\t}\n\n\t\t$users = self::getRawUsers('uname = \\'' . mysql_escape_string($uname) . '\\'');\n\n\t\tif(count($users) == 1) {\n\t\t\tforeach($users as $user) {\n\t\t\t\tif($user['uname'] == $uname) {\n\t\t\t\t\tif(FormUtil::getPassedValue('viaauthcode', null, 'POST') != null) {\n\t\t\t\t\t\t$authcode = unserialize(UserUtil::getVar('owncloud_authcode', $user['uid']));\n\t\t\t\t\t\tif($authcode['usebefore'] >= new DateTime('NOW') &&\n\t\t\t\t\t\t\t$authcode['authcode'] == $pass) {\n\t\t\t\t\t\t\t\t$return = true;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$return = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$authenticationMethod = array(\n\t\t\t\t\t\t\t'modname' => 'Users' ///TODO\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (ModUtil::getVar(Users_Constant::MODNAME, Users_Constant::MODVAR_LOGIN_METHOD, Users_Constant::DEFAULT_LOGIN_METHOD) == Users_Constant::LOGIN_METHOD_EMAIL) {\n\t\t\t\t\t\t\t$authenticationMethod['method'] = 'email';\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$authenticationMethod['method'] = 'uname';\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$authenticationInfo = array(\n\t\t\t\t\t\t\t'login_id' => $uname,\n\t\t\t\t\t\t\t'pass' => $pass\n\t\t\t\t\t\t);\n\t\t\t\t\t\t//try to login (also for the right output)\n\t\t\t\t\t\tif(UserUtil::loginUsing($authenticationMethod, $authenticationInfo, false, null, true) == true) {\n\t\t\t\t\t\t\t$return = true;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$return = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t$return = false;\n\t\t}\n\t\treturn self::ret($return);\n\t}" ]
[ "0.7231226", "0.7041633", "0.7014983", "0.68430173", "0.6828197", "0.6775398", "0.6757982", "0.67304873", "0.67249095", "0.6717574", "0.66858965", "0.6642699", "0.66053647", "0.65985817", "0.6589373", "0.6585631", "0.6584989", "0.6579783", "0.6573199", "0.65726525", "0.6514841", "0.6499111", "0.6482083", "0.6465609", "0.64522904", "0.6449524", "0.6445276", "0.6439333", "0.64332706", "0.64100385", "0.6409205", "0.64088756", "0.6395717", "0.6389633", "0.6386888", "0.6366495", "0.63639927", "0.6363451", "0.6359293", "0.6356766", "0.63553685", "0.6353472", "0.6342378", "0.63406307", "0.6333243", "0.6333104", "0.6327736", "0.6322397", "0.63028914", "0.62851566", "0.62687755", "0.625678", "0.62529093", "0.6249784", "0.6246475", "0.62451917", "0.62444115", "0.6243423", "0.6234362", "0.6222747", "0.62222004", "0.6209831", "0.62079716", "0.62068933", "0.6191638", "0.6184107", "0.61832476", "0.61827", "0.617649", "0.617586", "0.61695045", "0.616947", "0.61693674", "0.616906", "0.61664927", "0.6164718", "0.6161477", "0.61588436", "0.6155545", "0.61484814", "0.61344665", "0.61341465", "0.6131198", "0.61301994", "0.61246485", "0.612297", "0.61223894", "0.6119427", "0.61179316", "0.611186", "0.6106627", "0.6106291", "0.61050355", "0.61018443", "0.6098699", "0.609469", "0.6094136", "0.6094043", "0.60901546", "0.60854036" ]
0.61546534
79
! Start sessions if login succeed!
public function setSessions($id,$admin) { session_start(); $_SESSION['userID'] = $id; $_SESSION['logged_in'] = true; if($admin == true){ $_SESSION['admin'] = true; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function startSession();", "public function startSession() {}", "public function startSessions()\r\n {\r\n Zend_Session::start();\r\n }", "private function checkLogin()\n {\n if ($this->verifySession()) {\n $this->userId = $this->session['id'];\n }\n if ($this->userId === 0) {\n if ($this->verifyCookie()) {\n $this->userId = $this->cookie['userid'];\n $this->createSession();\n }\n }\n }", "private static function startSession() {\n if (session_status() == PHP_SESSION_NONE) {\n session_start();\n }\n }", "public function joinSession(){\n\t\tif (session_status() != PHP_SESSION_ACTIVE){\n\t\t\tsession_start();\n\t\t}\n\t}", "public function pcr_auth_session_start() {\r\n\r\n // # check session_status()\r\n if(session_status() === PHP_SESSION_NONE) {\r\n session_start();\r\n }\r\n\r\n $request_uri = $_SERVER['REQUEST_URI'];\r\n\r\n // # due to wp nonce in some request_uri's, lets partial match login and logout strings\r\n // # also look for onesignal references even though we match on entire troublsome URL's below.\r\n if(stripos('login', $request_uri) !== true && stripos('logout', $request_uri) !== true && stripos('onesignal', $request_uri) !== true) {\r\n\r\n // # build the array of known url's to skip\r\n $skip_urls = array('/',\r\n '/login/',\r\n '/wp-admin/admin-ajax.php',\r\n '/wp-cron.php?doing_wp_cron',\r\n '/login/?login=false',\r\n '/login/?login=failed',\r\n '/wp-login.php'\r\n );\r\n\r\n // # check if reuest uri is empty and does not match skip_urls array\r\n if(!empty($request_uri) && !in_array($request_uri, $skip_urls)) {\r\n\r\n // # all is good, set the session\r\n $_SESSION['request_uri'] = $request_uri;\r\n }\r\n }\r\n }", "protected function loginIfRequested() {}", "public function canStartSession();", "public static function start()\r\n {\r\n if (!self::isStarted())\r\n session_start();\r\n }", "private function attempt_session_login() {\n if (isset($_SESSION['user_id']) && isset($_SESSION['user_token'])) {\n return $this->attempt_token_login($_SESSION['user_id'], $_SESSION['user_token'], false);\n }\n return false;\n }", "public function __construct() {\n session_start();\n $this->check_stored_login();\n }", "public function beginLogin() {\n return false;\n }", "public function SessionStart ();", "public function start(){\n\t\t$this->current_time = $this->time->time;\n\t\t$this->data['user_id'] = ANONYMOUS;\n\t\t$boolValid = false;\n\n\t\t//Return, if we don't want a session\n\t\tif (defined('NO_SESSION')) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Remove old sessions and update user information if necessary.\n\t\tif($this->current_time - $this->session_length > $this->config->get('session_last_cleanup')){\n\t\t\t$this->cleanup($this->current_time);\n\t\t}\n\t\t//Cookie-Data\n\t\t$arrCookieData = array();\n\t\t$arrCookieData['sid']\t= get_cookie('sid');\n\t\t$arrCookieData['data']\t= get_cookie('data');\n\t\t$arrCookieData['data']\t= ( !empty($arrCookieData['data']) ) ? unserialize(base64_decode(stripslashes($arrCookieData['data']))) : '';\n\n\t\t//Let's get a Session\n\t\tif ($this->in->exists('s') && $this->in->get('s', '') != \"\"){\n\t\t\t//s-param\n\t\t\t$this->sid = $this->in->get('s', '');\n\t\t} else {\n\t\t\t$this->sid = $arrCookieData['sid'];\n\t\t}\n\n\t\t//Do we have an session? If yes, try to look if it's a valid session and get all information about it\n\t\tif ($this->sid != ''){\n\t\t\t$query = $this->db->query(\"SELECT *\n\t\t\t\t\t\t\t\tFROM __sessions s\n\t\t\t\t\t\t\t\tLEFT JOIN __users u\n\t\t\t\t\t\t\t\tON u.user_id = s.session_user_id\n\t\t\t\t\t\t\t\tWHERE s.session_id = '\".$this->db->escape($this->sid).\"'\n\t\t\t\t\t\t\t\tAND session_type = '\".$this->db->escape((defined('SESSION_TYPE')) ? SESSION_TYPE : '').\"'\");\n\t\t\t$arrResult = $this->db->fetch_record($query);\n\t\t\t$this->db->free_result($query);\n\n\t\t\t$this->data = $arrResult;\n\t\t\tif (!isset($this->data['user_id'])){\n\t\t\t\t$this->data['user_id'] = ANONYMOUS;\n\t\t\t}\n\n\t\t\t//If the Session is in our Table && is the session_length ok && the IP&Browser fits\n\t\t\t//prevent too short session_length\n\t\t\tif ($arrResult && (($arrResult['session_start'] + $this->session_length) > $this->current_time) ){\n\t\t\t\t//If the IP&Browser fits\n\t\t\t\tif (($arrResult['session_ip'] === $this->env->ip) && ($arrResult['session_browser'] === $this->env->useragent)){\n\t\t\t\t\t//We have a valid session\n\t\t\t\t\t$this->data['user_id'] = ($this->data['user_id'] == (int)$arrResult['session_user_id']) ? intval($arrResult['session_user_id']) : $this->data['user_id'];\n\t\t\t\t\t$this->id = $this->data['user_id'];\n\t\t\t\t\t// Only update session DB a minute or so after last update or if page changes\n\t\t\t\t\tif ( ($this->current_time - $arrResult['session_current'] > 60) || ($arrResult['session_page'] != $this->env->current_page) ){\n\t\t\t\t\t\t$this->db->query(\"UPDATE __sessions SET :params WHERE session_id = ?\", array(\n\t\t\t\t\t\t\t'session_current'\t=> $this->current_time,\n\t\t\t\t\t\t\t'session_page'\t\t=> strlen($this->env->current_page) ? $this->env->current_page : '',\n\t\t\t\t\t\t), $this->sid);\n\t\t\t\t\t}\n\t\t\t\t\t//The Session is valid, copy the user-data to the data-array and finish the init. You you can work with this data.\n\n\t\t\t\t\tregistry::add_const('SID', \"?s=\".((!empty($arrCookieData['sid'])) ? '' : $this->sid));\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t//START Autologin\n\t\t$boolSetAutoLogin = false;\n\n\t\t//Loginmethod Autologin\n\t\t$arrAuthObjects = $this->get_login_objects();\n\t\tforeach($arrAuthObjects as $strMethods => $objMethod){\n\t\t\tif (method_exists($objMethod, 'autologin')){\n\t\t\t\t$arrAutologin = $objMethod->autologin($arrCookieData);\n\t\t\t\tif ($arrAutologin){\n\t\t\t\t\t$this->data = $arrAutologin;\n\t\t\t\t\t$boolSetAutoLogin = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//EQdkp Autologin\n\t\tif (!$boolSetAutoLogin){\n\t\t\t$arrAutologin = $this->autologin($arrCookieData);\n\t\t\tif ($arrAutologin){\n\t\t\t\t$this->data = $arrAutologin;\n\t\t\t\t$boolSetAutoLogin = true;\n\t\t\t}\n\t\t}\n\n\t\t//Bridge Autologin\n\t\tif (!$boolSetAutoLogin && $this->config->get('cmsbridge_active') == 1 && $this->config->get('pk_maintenance_mode') != 1){\n\t\t\t$arrAutologin = $this->bridge->autologin($arrCookieData);\n\t\t\tif ($arrAutologin){\n\t\t\t\t$this->data = $arrAutologin;\n\t\t\t\t$boolSetAutoLogin = true;\n\t\t\t}\n\t\t}\n\t\t//END Autologin\n\n\t\t//Let's create a session\n\t\t$this->create($this->data['user_id'], (isset($this->data['user_login_key']) ? $this->data['user_login_key'] : ''), $boolSetAutoLogin);\n\t\t$this->id = $this->data['user_id'];\n\t\treturn true;\n\t}", "static function start()\n {\n if (session_status() == PHP_SESSION_NONE) {\n session_start();\n }\n }", "public function check_login()\n\t{\n\t\tif(isset($_SESSION[\"user_id\"]))\n\t\t{\n\t\t $this->_user_id = $_SESSION[\"user_id\"];\n\t\t\t$this->_client = $_SESSION[\"client\"];\n\t\t\t$this->_loged_in = true;\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->_loged_in = false;\n\t\t\t$this->_client = false;\n\t\t\tunset($this->_user_id);\n\t\t}\n\t}", "function start_session() {\n\tsession_start();\t\n\tif($status == PHP_SESSION_NONE){\n\t\t//There is no active session\n\t\tsession_start();\n\t}else\n\tif($status == PHP_SESSION_DISABLED){\n\t\t//Sessions are not available\n\t}else\n\tif($status == PHP_SESSION_ACTIVE){\n\t\t//Destroy current and start new one\n\t\tsession_destroy();\n\t\tsession_start();\n\t}\n\t\n}", "private function checkLogin() {\n\t\t$session = $this->Session->read ( 'sessionLogado' );\n\t\tif (empty ( $session )) {\n\t\t\t$this->Session->write ( 'sessionLogado', false );\n\t\t}\n\t\t\n\t\tif ($this->params ['plugin'] == 'users') {\n\t\t\tif ($this->params ['controller'] == 'users' && $this->params ['action'] == 'home' && ! $session == true) {\n\t\t\t\t$this->redirect ( array (\n\t\t\t\t\t\t'controller' => 'users',\n\t\t\t\t\t\t'plugin' => 'users',\n\t\t\t\t\t\t'action' => 'login' \n\t\t\t\t) );\n\t\t\t}\n\t\t\tif ($this->params ['controller'] == 'users' && $this->params ['action'] == 'signatures' && ! $session == true) {\n\t\t\t\t$this->redirect ( array (\n\t\t\t\t\t\t'controller' => 'users',\n\t\t\t\t\t\t'plugin' => 'users',\n\t\t\t\t\t\t'action' => 'login' \n\t\t\t\t) );\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}", "public function startSession() {\n\n session_start(); //Tell PHP to start the session\n\n /* Determine if user is logged in */\n $this->logged_in = $this->checkLogin();\n\n /**\n * Set guest value to users not logged in, and update\n * active guests table accordingly.\n */\n if (!$this->logged_in) {\n $this->username = $_SESSION['username'] = GUEST_NAME;\n $this->userlevel = GUEST_LEVEL;\n $this->connection->addActiveGuest($_SERVER['REMOTE_ADDR'], $this->time);\n }\n /* Update users active timestamp */ else {\n $this->connection->addActiveUser($this->username, $this->time);\n }\n\n /* Remove inactive visitors from database */\n $this->connection->removeInactiveUsers();\n $this->connection->removeInactiveGuests();\n\n /* Set referrer page */\n if (isset($_SESSION['url'])) {\n $this->referrer = $_SESSION['url'];\n } else {\n $this->referrer = \"/\";\n }\n\n /* Set current url */\n $this->url = $_SESSION['url'] = $_SERVER['PHP_SELF'];\n }", "public function start() {\r\n\t\tif (!self::hasSession()) {\r\n\t\t\tself::session();\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}", "private function auto_login()\n {\n if ($this->_cookies->has('authautologin')) {\n $cookieToken = $this->_cookies->get('authautologin')->getValue();\n\n // Load the token\n $token = Tokens::findFirst(array('token=:token:', 'bind' => array(':token' => $cookieToken)));\n\n // If the token exists\n if ($token) {\n // Load the user and his roles\n $user = $token->getUser();\n $roles = $this->get_roles($user);\n\n // If user has login role and tokens match, perform a login\n if (isset($roles['registered']) && $token->user_agent === sha1(\\Phalcon\\DI::getDefault()->getShared('request')->getUserAgent())) {\n // Save the token to create a new unique token\n $token->token = $this->create_token();\n $token->save();\n\n // Set the new token\n $this->_cookies->set('authautologin', $token->token, $token->expires);\n\n // Finish the login\n $this->complete_login($user);\n\n // Regenerate session_id\n session_regenerate_id();\n\n // Store user in session\n $this->_session->set($this->_config['session_key'], $user);\n // Store user's roles in session\n if ($this->_config['session_roles']) {\n $this->_session->set($this->_config['session_roles'], $roles);\n }\n\n // Automatic login was successful\n return $user;\n }\n\n // Token is invalid\n $token->delete();\n } else {\n $this->_cookies->set('authautologin', \"\", time() - 3600);\n $this->_cookies->delete('authautologin');\n }\n }\n\n return false;\n }", "function check_login(){\n\t\tif(!empty(yii::app()->request->cookies['uid']) && !empty(yii::app()->request->cookies['pass'])){\n\t\t\n\t\t\t//get the user's email\n\t\t\t$email=get_user_by_id(yii::app()->request->cookies['uid'])->email;\n\t\t\t\n\t\t\t//log the user in\n\t\t\tif($this->user_login($email,yii::app()->request->cookies['pass'],true)){\n\t\t\t\t//renew cookies for n days more\n\t\t\t\t$this->remember_login(yii::app()->request->cookies['pass'],true);\n\t\t\t}\n\t\t}\n\t}", "protected function _startSession()\n\t{\n\t\tif (is_null($this->_client))\n\t\t{\n\t\t\t$this->_client = new SoapClient($this->config['url']);\t\t\t\n\t\t}\n\t\tif (is_null($this->_session))\n\t\t{\n\t\t\t$this->_session = $this->_client->login($this->config['apiuser'], $this->config['apikey']);\t\t\t\n\t\t}\t\t\n\t\tpr($this->_client->__getFunctions());\n\t}", "public final function start() \n\t{\n\t\tif (isset($_SESSION)) return;\n\t\tsession_start();\n\t}", "public static function use_sessions()\n {\n \\Session::started() or \\Session::load();\n }", "public function startSession()\n\t{\n\t\t// Let's start the session\n\t\tif (session_id() == '')\n\t\t{\n\t\t\tsession_start();\n\t\t}\n\t}", "public static function sessionStart()\n\t{\n\t\t{\n\t\t\tsession_start();\n\t\t}\n\t}", "function autologin() {\n if (!isset($_COOKIE['auth'])) //Se non c'è il cookie\n return false;\n\n $ck = unserialize($_COOKIE['auth']);\n\n if (empty($ck)) //Se il cookie è vuoto\n return false;\n\n require_once dirname(__FILE__) . '/../classi/Sessione.php';\n require_once dirname(__FILE__) . '/config.php';\n $conn = connetti();\n\n $old_sess = new Sessione(); //Prendiamo la sessione\n try {\n $old_sess->getSessione($ck['s'], $ck['h'], $conn);\n } catch (Exception $e) { //Se non esiste la sessione\n return false;\n }\n //Invalidiamo la vecchia sessione se tutto ok\n $old_sess->setHash(sha1(microtime(true) . mt_rand(10000, 90000)));\n $old_sess->save($conn);\n /* Carichiamo le informazioni dell'utente */\n require_once dirname(__FILE__) . '/../classi/Utente.php';\n\n $usr = new Utente();\n try {\n /* Nota : poco sicuro fare il preleva ID usando il campo u nel cookie!\n //Basta avere una sessione valida, cambiare ad arte il valore 'u' nel cookie e si può impersonare chiunque!\n */\n $usr->prelevaDaID($old_sess->getUid(), $conn);\n } catch (Exception $e) {\n return false;\n }\n if(Sessione::populateCharacters($usr,$conn) == \"3\" ) return false; //si verifica se c'è stato errore nel fetching dei personaggi.\n Sessione::startSession(true,$conn); //avviamo sessione con impostazione \"Ricordami\" attiva.\n}", "public function login() {\n $this->db->sql = 'SELECT * FROM '.$this->db->dbTbl['users'].' WHERE username = :username LIMIT 1';\n\n $user = $this->db->fetch(array(\n ':username' => $this->getData('un')\n ));\n\n if($user['hash'] === $this->hashPw($user['salt'], $this->getData('pw'))) {\n $this->sessionId = md5($user['id']);\n $_SESSION['user'] = $user['username'];\n $_SESSION['valid'] = true;\n $this->output = array(\n 'success' => true,\n 'sKey' => $this->sessionId\n );\n } else {\n $this->logout();\n $this->output = array(\n 'success' => false,\n 'key' => 'WfzBq'\n );\n }\n\n $this->renderOutput();\n }", "function checkLogin() {\n\t\t$fingerprint = fingerprint();\n\t\tsession_start();\n\t\tif (!isset($_SESSION['log_user']) || $_SESSION['log_fingerprint'] != $fingerprint) logout();\n\t\tsession_regenerate_id();\n\t}", "function kcsite_session_start() {\n\tif (!session_id()){\n\t\tsession_start();\n\t}\n}", "private function check_session()\n\t{\n\t\tif(isset($_SESSION['admin_id']))\n\t\t{\n\t\t\t/* \n\t\t\tTODO: check double device login\n\t\t\t*/\n\t\t}\n\t\telse if(isset($_SESSION['login_id']))\n\t\t{\n\t\t\tredirect(base_url() . 'contestant');\n\t\t}\n\t\telse\n\t\t{\n\t\t\tredirect(base_url());\n\t\t}\n\t}", "public function login()\n\t{\n\t\t$mtg_login_failed = I18n::__('mtg_login_failed');\n\t\tR::selectDatabase('oxid');\n\t\t$sql = 'SELECT oxid, oxfname, oxlname FROM oxuser WHERE oxusername = ? AND oxactive = 1 AND oxpassword = MD5(CONCAT(?, UNHEX(oxpasssalt)))';\n\t\t$users = R::getAll($sql, array(\n\t\t\tFlight::request()->data->uname,\n\t\t\tFlight::request()->data->pw\n\t\t));\n\t\tR::selectDatabase('default');//before doing session stuff we have to return to db\n\t\tif ( ! empty($users) && count($users) == 1) {\n\t\t\t$_SESSION['oxuser'] = array(\n\t\t\t\t'id' => $users[0]['oxid'],\n\t\t\t\t'name' => $users[0]['oxfname'].' '.$users[0]['oxlname']\n\t\t\t);\n\t\t} else {\n\t\t\t$_SESSION['msg'] = $mtg_login_failed;\n\t\t}\n\t\t$this->redirect(Flight::request()->data->goto, true);\n\t}", "public function check_login(){\n\t\t\tif( isset( $_SESSION['user_id'] ) ) {\n\t\t\t\t$this->user_id = $_SESSION['user_id'];\n\t\t\t\t$this->logged_in = true;\n\t\t\t} else {\n\t\t\t\tunset( $this->user_id );\n\t\t\t\t$this->logged_in = false;\n\t\t\t}\n\t\t}", "public static function autoLogin()\n {\n return true;\n }", "function wpdev_session_start() {\n session_start();\n }", "public function maybeStartSession() {\n if (session_status() == PHP_SESSION_NONE) {\n session_start();\n }\n }", "function __construct() {\n if (session_status() == PHP_SESSION_NONE || session_id() == '') { session_start();\t}\n # check existing login\n $this->_checkLogin();\n }", "private static function init(){\n\t\t\tif (session_status() != PHP_SESSION_ACTIVE) {\n\t\t\t\tsession_start();\n\t\t\t}\n\t\t}", "public function loginAction()\n {\n $data = $this->getRequestData();\n if ($this->getDeviceSession(false)) {\n $this->setErrorResponse('Your device is already running a session. Please logout first.');\n }\n $session = Workapp_Session::login($data['username'], $data['password']);\n if (!$session) {\n $this->setErrorResponse('No user with such username and password');\n }\n $session->registerAction($_SERVER['REMOTE_ADDR']);\n $this->_helper->json(array('session_uid' => $session->getSessionUid()));\n }", "private function check_the_login(){\n \n if(isset($_SESSION['login_user'])){\n \n $this->login_user = $_SESSION['login_user'];\n $this->signed_in = true;\n \n }else{\n unset($this->login_user);\n $this->signed_in = false;\n }\n \n }", "private function checkFirstLogin() {\n\n $count = DB::table('users')->count();\n\n if ($count == 0) {\n\n $password = Hash::make('cciadminpassword');\n\n // insert in users table\n $id = DB::table('users')->insertGetId([\n 'username' => 'admin',\n 'name' => 'Administrator',\n 'password' => $password,\n 'created_at' => \\Carbon\\Carbon::now()\n ]);\n\n // insert in roles table\n DB::table('user_roles')->insert([\n 'user_id' => $id,\n 'role' => 'administrator',\n 'created_at' => \\Carbon\\Carbon::now()\n ]);\n\n // insert project status codes\n DB::table('project_status')->insert([\n [ 'status' => 'New' ],\n [ 'status' => 'Quoted' ],\n [ 'status' => 'Sold' ],\n [ 'status' => 'Engineered' ],\n [ 'status' => 'Lost']\n ]);\n\n return;\n }\n\n else { return; }\n }", "private function check()\n\t{\n\t\tif (!session_id())\n\t\t{\n\t\t\tsession_start();\n\t\t}\n\t}", "static function verifyLogin(){\r\n\r\n // check if there's a session\r\n if(session_id() == '' && !isset($_SESSION)){\r\n session_start();\r\n }\r\n\r\n // if session is started, check if a user is login or not\r\n if(isset($_SESSION[\"loggedin\"])){\r\n \r\n return true;\r\n }\r\n else{\r\n session_destroy();\r\n \r\n return false;\r\n }\r\n }", "public static function start(){\n\t\treturn session_start();\n\t}", "function startValidSession() {\r\n session_start();\r\n if ( !isset($_SESSION['logged_in']) || $_SESSION['logged_in']!=true ) {\r\n redirectTo('login.php');\r\n }\r\n}", "public static function sessionStart() {\n\t\t\t//return false;\n\n\t\t//if(isset($_SESSION[\"PHPSESSID\"])) unset($_SESSION[\"PHPSESSID\"]);\n\t\tif(empty(session_id()))\n\t\t\t@session_start();\n\t\t//$_SESSION[\"PHPSESSID\"] = true;\n\t\treturn true;\n\t}", "function __construct(){\n session_start();\n //call this function automatically\n $this->check_the_login();\n $this->check_the_router();\n }", "public function checkFirstLogin();", "private function doLogin()\n {\n if (!isset($this->token)) {\n $this->createToken();\n $this->redis->set('cookie_'.$this->token, '[]');\n }\n\n $loginResponse = $this->httpRequest(\n 'POST',\n 'https://sceneaccess.eu/login',\n [\n 'form_params' => [\n 'username' => $this->username,\n 'password' => $this->password,\n 'submit' => 'come on in',\n ],\n ],\n $this->token\n );\n\n $this->getTorrentsFromHTML($loginResponse);\n }", "function start_session() {\n if(!session_id()) {\n session_start();\n }\n}", "public static function start(): void\n {\n if (session_status() === PHP_SESSION_NONE) {\n ini_set('session.use_strict_mode', true);\n $options = [\n 'expires' => 0,\n 'path' => HTTPRequest::root(),\n 'secure' => HTTPRequest::isHTTPS(),\n 'httponly' => true,\n 'samesite' => Cookie::SAMESITE_STRICT\n ];\n if (($timeout = Formwork::instance()->option('admin.session_timeout')) > 0) {\n $options['expires'] = time() + $timeout * 60;\n }\n session_name(self::SESSION_NAME);\n session_start();\n if (!isset($_COOKIE[self::SESSION_NAME]) || $options['expires'] > 0) {\n // Send session cookie if not already sent or timeout is set\n Cookie::send(self::SESSION_NAME, session_id(), $options, true);\n } elseif ($_COOKIE[self::SESSION_NAME] !== session_id()) {\n // Remove cookie if session id is not valid\n unset($_COOKIE[self::SESSION_NAME]);\n Cookie::send(self::SESSION_NAME, '', ['expires' => time() - 3600] + $options, true);\n }\n }\n }", "private function check_login()\n {\n if (self::exists('user_id')) {\n $this->user_id = self::get('user_id');\n $this->logged_in = true;\n } else {\n unset($this->user_id);\n $this->logged_in = false;\n }\n }", "public function init() {\n// $session->open();\n// if (empty($_SESSION['userid'])) {\n// return $this->redirect('index.php?r=login');\n// }\n }", "public function checkUsersSession(){\n\t}", "function checkHasLogin(){\n global $Redis;\n $login_success_jump_url = $this->_get('login_success_jump_url','http://sh.'.$this->root_domain);\n\n if( isset($_COOKIE[$this->passport_name]) ){\n $passport_login_status = intval($Redis->get($_COOKIE[$this->passport_name]));\n }else{\n $passport_login_status = 0;\n }\n //这个要改,根据cookie里面的key值来做判断的,自动登录或者自动退出,-1代表退出状态\n if($passport_login_status === -1){\n\n }else if($passport_login_status === 0){\n\n }else if($passport_login_status > 0){\n $this->getView()->assign(\"title\", '登陆提示');\n $this->getView()->assign(\"desc\", '您已经登陆了!');\n $this->getView()->assign(\"url\",$login_success_jump_url);\n $this->getView()->assign(\"type\", 'warning');\n $this->display(VIEW_PATH.'/common/tips');\n exit;\n }\n }", "function login($user,$pass) {\n\t\t// Success: create session and set\n\t\t// Fail: fuck off and try again\n\t}", "private function startPhpSession()\n {\n if (session_status() === PHP_SESSION_NONE) {\n session_start();\n }\n }", "function login_process_with_previous_sessions() {\r\n\r\n\t\t$userId = $this->session->userdata('userId');\r\n\r\n\t\tif ( ! empty($userId)) {\r\n\r\n\t\t\tswitch ($this->get_login_mode($userId)) :\r\n\r\n\t\t\t\tcase 'auto-login' :\r\n\r\n\t\t\t\t\t$param = \"update_record\";\r\n\r\n\t\t\t\t\t$this->login_process($userId, $param, $this->accessName, $this->accessTo);\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'lockscreen' :\r\n\r\n\t\t\t\t\tredirect('lockscreen/user_id/' . $userId, 'location');\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tendswitch;\r\n\r\n\t\t}\r\n\r\n\t\t/* \r\n\t\t\tNote: There is no process if no previous sessions or sign-in mode\r\n\t\t*/\r\n\r\n\t}", "public function initSession() {\n\n\n\n if (session_id() == '') {\n\n // session isn't started\n\n session_start();\n }\n }", "function cklogin($username, $password)\n{\n\n // to read all users from json\n $users = getUsers();\n\n if (isset($username) && isset($password)) {\n // to check each user psw and uname\n foreach ($users as $user) {\n\n if ($user[\"user\"] == $username && $user[\"password\"] == $password) {\n\n $_SESSION['username'] = $username;\n\n $message = ' Welcome ' . $_SESSION[\"username\"] ;\n\n require_once 'view/loginsuccess.php';\n\n }\n }\n }\n\n if (isset($_SESSION['username']) == false) {\n\n require_once 'view/loginsuccess.php';\n } else {\n $news = getNews();\n require_once 'view/home.php';\n }\n return true;\n}", "public function start()\n\t{\n\t\t$path = ini_get('session.cookie_path');\n\t\tif (!strlen($path))\n\t\t\t$path = '/';\n\n\t\t$secure = false;\n\n\t\tif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https')\n\t\t\t$secure = true;\n\t\telse\n\t\t\t$secure = (empty($_SERVER[\"HTTPS\"]) || ($_SERVER[\"HTTPS\"] === 'off')) ? false : true;\n\t\t\t\n\t\tsession_set_cookie_params(ini_get('session.cookie_lifetime') , $path, ini_get('session.cookie_domain'), $secure);\n\t\t\n\t\tif ($result = session_start())\n\t\t{\n\t\t\t$this->flash = new Flash();\n\t\t\tif ($this->flash)\n\t\t\t{\n\t\t\t\tif (array_key_exists('flash_partial', $_POST) && strlen($_POST['flash_partial']))\n\t\t\t\t\t$this->flash['system'] = 'flash_partial:'.$_POST['flash_partial'];\n\t\t\t}\n\t\t}\n\t\t\t\n\t\treturn $result;\n\t}", "function trylogin()\n {\n\t\t$ret = false;\n\t\t\n $err = SHIN_Core::$_models['sys_user_model']->login();\n\n SHIN_Core::$_language->load('app', 'en');\n $err = SHIN_Core::$_language->line($err);\n\t\t\n if ($err != '') {\n SHIN_Core::$_libs['session']->set_userdata('loginErrorMessage', $err);\n } else {\n $this->sessionModel->start(SHIN_Core::$_models['sys_user_model']->idUser);\n\t\t\t$ret = true;\n\t\t\t\n\t\t\t// addons for new field added //////////////////////////\n\t\t\t// request by Stefano. Detail: http://binary-studio.office-on-the.net/issues/5287\n\t\t\t// \"host\" and \"lastlogin\" field \n\t\t\t$data = array('lastlogin' => date('Y-m-d H:i:s'), 'host' => SHIN_Core::$_input->ip_address());\n\t\t\tSHIN_Core::$_db[SHIN_Core::$_shdb->active_group]->where('idUser', SHIN_Core::$_models['sys_user_model']->idUser);\n\t\t\tSHIN_Core::$_db[SHIN_Core::$_shdb->active_group]->update('sys_user', $data); \t\t\n\t\t\t///////////////////////////////////////////////////////\n }\n\n\t\treturn $ret;\n }", "protected function autoUserLogin(): bool\n {\n if (!isset($this->session) || !isset($this->session->user_id)) {\n $user = new User();\n $userInfo = $user->getUserById(1);\n if (!$userInfo) {\n View::render(500);\n exit;\n }\n\n $this->session->user_id = $userInfo['user_id'];\n $this->session->name = $userInfo['user_name'];\n $this->session->email = $userInfo['email'];\n }\n return true;\n }", "public function beginLogin() {\n \n $this->info(\"beginning login...\");\n \n $status = $this->requestAuthentication($this->requestURL, $this->authURL);\n \n if(!$status) {\n $this->error(\"problem launching Yahoo authenication: \".$this->getError());\n }\n \n return true;\n }", "function try_login() {\n $error = '';\n $sid = '';\n $uid = null;\n \n if (!isset($_REQUEST[\"user\"]) && !isset($_REQUEST[\"password\"])) {\n return array(\n 'sid' => '',\n 'error' => NULL,\n );\n }\n \n $dbh = DB::connect();\n $uid = uid_from_username($_REQUEST[\"user\"]);\n \n if (user_suspended($uid)) {\n $error = \"Account suspended\";\n return array(\n 'SID' => '',\n 'error' => $error,\n );\n } elseif (passwd_is_empty($uid)) {\n $error = \"Password is either reset, or new account was created and email confirmation link was not clicked!\";\n return array(\n 'SID' => '',\n 'error' => $error,\n );\n } elseif (!valid_passwd($uid, $_REQUEST[\"password\"])) {\n $error = \"Bad username or password\";\n return array(\n 'SID' => '',\n 'error' => $error,\n );\n }\n\n $logged_in = 0;\n $num_tries = 0;\n\n while (!$logged_in && $num_tries < 5) {\n $session_limit = config_get_int('options', 'max_sessions_per_user');\n if ($session_limit) {\n $q = \"DELETE s.* \";\n $q.= \"FROM Sessions s \";\n $q.= \"LEFT JOIN (SELECT sid FROM Sessions \";\n $q.= \"WHERE uid = \" . $uid . \" \";\n $q.= \"ORDER BY ts DESC \";\n $q.= \"LIMIT \" . ($session_limit - 1) . \") q \";\n $q.= \"ON s.sid = q.sid \";\n $q.= \"WHERE s.uid = \" . $uid . \" \";\n $q.= \"AND q.sid IS NULL\";\n $dbh->query($q);\n }\n\n $sid = new_sid();\n $q = \"INSERT INTO Sessions (uid, sid, ts) \";\n $q.= \"VALUES (\" . $uid . \", '\" . $sid . \"', UNIX_TIMESTAMP())'\";\n $result = $dbh->exec($q);\n\n if (!$result) {\n $logged_in = 1;\n break;\n }\n\n $num_tries += 1;\n }\n\n if (!$logged_in) {\n $error = \"An error occurred trying to create a user session.\";\n return array(\n 'SID' => $sid,\n 'error' => $error,\n );\n }\n\n $q = \"UPDATE Users \";\n $q.= \"SET last_login_ts = UNIX_TIMESTAMP(), last_ip = \" . $dbh->quote($_SERVER['REMOTE_ADDR'] . \" \");\n $q.= \"WHERE uid = \" . $uid;\n $dbh->exec($q);\n\n if (isset($_POST['remember']) && $_POST['remember'] == \"yes\") {\n $timeout = config_get_int('options', 'cookie_timeout');\n $cookie_time = time() + $timeout;\n\n $q = \"UPDATE Sessions SET ts = $cookie_time \";\n $q.= \"WHERE sid = '$sid'\";\n $dbh->exec($q);\n } else {\n $cookie_time = 0;\n }\n\n setcookie('PSID', $sid, $cookie_time, \"/\", NULL, !empty($_SERVER['HTTPS']), true);\n\n $referrer = in_request('referrer');\n if (strpos($referrer, pw_location()) !== 0) {\n $referrer = \"/\";\n }\n header(\"Location: \" . get_uri($referrer));\n $error = \"\";\n}", "private function initSession() :void\n {\n if (session_status() === PHP_SESSION_NONE) {\n session_start();\n }\n }", "public function auto_login() {\n\t\tif ($token = cookie::get($this->config['cookie_name'])) {\n\n\t\t\t// Load the token and user\n\t\t\t$token = ORM::factory('user_token', $token);\n\n\t\t\tif ($token->loaded AND $token->user->loaded) {\n\t\t\t\tif ($token->user_agent === sha1(Kohana::$user_agent)) {\n\n\t\t\t\t\t// Save the token to create a new unique token\n\t\t\t\t\t$token->save();\n\n\t\t\t\t\t// Set the new token\n\t\t\t\t\tcookie::set($this->config['cookie_name'], $token->token, $token->expires - time());\n\n\t\t\t\t\t// Complete the login with the found data\n\t\t\t\t\t$this->complete_login($token->user);\n\n\t\t\t\t\t// Automatic login was successful\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\t// Token is invalid\n\t\t\t\t$token->delete();\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}", "private function sessionLogin() {\r\n $this->uid = $this->sess->getUid();\r\n $this->email = $this->sess->getEmail();\r\n $this->fname = $this->sess->getFname();\r\n $this->lname = $this->sess->getLname();\r\n $this->isadmin = $this->sess->isAdmin();\r\n }", "public function loginTrainer(){\r\n\t\t\t$objDBConn = DBManager::getInstance();\t\r\n\t\t\tif($objDBConn->dbConnect()){\r\n\t\t\t\t$result = mysql_query(\"SELECT * from trainer where username='\".$_REQUEST[\"username\"].\"' and password='\".$_REQUEST[\"pass\"].\"'\");\r\n\t\t\t\t$row = mysql_fetch_array($result);\r\n\t\t\t\tif($row == false){\r\n\t\t\t\t\t//echo \"No records\";\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}else{\r\n\t\t\t\t\t$_SESSION['trainer'] = $row;\r\n\t\t\t\t\t$objDBConn->dbClose();\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t}else{\r\n\t\t\t\t//echo 'Something went wrong ! ';\r\n\t\t\t\t$objDBConn->dbClose();\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}", "private function initSessionIfNecessary() {\n if (\\session_status() === \\PHP_SESSION_NONE) {\n // use cookies to store session IDs\n \\ini_set('session.use_cookies', 1);\n // use cookies only (do not send session IDs in URLs)\n \\ini_set('session.use_only_cookies', 1);\n // do not send session IDs in URLs\n \\ini_set('session.use_trans_sid', 0);\n\n // start the session (requests a cookie to be written on the client)\n//\t\t\t@Session::start();\n }\n }", "function startSession()\n {\n $this->session_data = $this->_openSession($this->service_link, $this->username, $this->password,\n $this->calling_program, $this->calling_program_version,\n $this->target_dbms, $this->target_dbms_version,\n $this->connection_technology, $this->connection_technology_version,\n $this->interactive);\n\n if (isset($this->session_data) && ($this->session_data != null)\n && ($this->session_data->target != $this->url)) {\n // Reopens the service on the new URL that was provided\n $url = $this->session_data->target;\n $this->startService();\n }\n }", "private function ensureStarted(): void\n {\n if (session_status() === PHP_SESSION_NONE) {\n session_start();\n }\n }", "public function login($login){\n\n if($this->getUser($login) != null){\n $_SESSION[\"user\"] = $this->getUser($login);\n return true;\n }\n else{\n return false;\n }\n\n }", "public function auto_login()\n\t{\n\t\tif ($token = cookie::get('autologin'))\n\t\t{\n\t\t\t// Load the token and user\n\t\t\t$token = new User_Token_Model($token);\n\t\t\t$user = new User_Model($token->user_id);\n\n\t\t\tif ($token->id != 0 AND $user->id != 0)\n\t\t\t{\n\t\t\t\tif ($token->user_agent === sha1(Kohana::$user_agent))\n\t\t\t\t{\n\t\t\t\t\t// Save the token to create a new unique token\n\t\t\t\t\t$token->save();\n\n\t\t\t\t\t// Set the new token\n\t\t\t\t\tcookie::set('autologin', $token->token, $token->expires - time());\n\n\t\t\t\t\t// Complete the login with the found data\n\t\t\t\t\t$this->complete_login($user);\n\n\t\t\t\t\t// Automatic login was successful\n\t\t\t\t\treturn TRUE;\n\t\t\t\t}\n\n\t\t\t\t// Token is invalid\n\t\t\t\t$token->delete();\n\t\t\t}\n\t\t}\n\n\t\treturn FALSE;\n\t}", "function login_auto(){\n $dat = $_SESSION[$this->key];\n try {\n if(empty($dat)) \n\tthrow new Exception('login_auto_failed'); \n if(time()-$dat['refresh']>$this->logout_auto*60)\n\tthrow new Exception('login_auto_timeout'); \n $_SESSION[$this->key]['refresh'] = time();\n if($this->login_load($_SESSION[$this->key])!=0)\n\tthrow new Exception('login_auto_unkown'); \n $this->login_finish();\n } catch (Exception $ex){\n $this->logout();\n return 1;\n } \n }", "public function checkLogin() {\r\n\t\t$post = $this -> sanitize();\r\n\t\textract($post);\r\n\t\t// Hash the password that was entered into the form (if it was correct, it will match the hashed password in the database)\r\n\t\t$password = sha1($password);\r\n\t\t// Query\r\n\t\t$query = \"SELECT username, userID, profilePic, access, email FROM users WHERE username='$username' AND password='$password'\";\r\n\t\t$data = $this -> singleSelectQuery($query);\r\n\t\tif($data){\r\n\t\t\t//set up the session\r\n\t\t\t$_SESSION['userID'] = $data['userID'];\r\n\t\t\t$_SESSION['username'] = $data['username'];\r\n\t\t\t$_SESSION['profilePic'] = $data['profilePic'];\r\n\t\t\t$_SESSION['userType'] = $data['userType'];\r\n\t\t\t$_SESSION['access'] = $data['access'];\r\n\t\t\t//redirects to their profile\r\n\t\t\theader('location: index.php?page=profile&userID='.$_SESSION['userID']);\r\n\t\t} else {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t}", "function check_login()\r\n {\r\n if ($this->user != null) {\r\n return true;\r\n }\r\n if (!isset($_COOKIE[$this->manifest['session_token']])) {\r\n return false;\r\n }\r\n $session = $this->load_controller('Session');\r\n $this->user = $session->recover_session_by_token($_COOKIE[$this->manifest['session_token']]);\r\n if ($this->user == false) {\r\n $session->remove_session_recover_cookie();\r\n return false;\r\n }\r\n return true;\r\n }", "public function login(){\n \t\t//TODO redirect if user already logged in\n \t\t//TODO Seut up a form\n \t\t//TODO Try to log in\n \t\t//TODO Redirect\n \t\t//TODO Error message\n \t\t//TODO Set subview and load layout\n\n \t}", "public function authLogin(): bool\n {\n if (!empty($_SESSION['sessionId'])) {\n return true;\n }\n\n return false;\n }", "public static function start() {\n\t if(self::isRequest()\n\t && (PHP_SESSION_ACTIVE == ($status = session_status())\n\t || (PHP_SESSION_NONE == $status && session_start()))) {\n\t return true;\n\t } else {\n\t if(!isset($_SESSION)) {\n\t // create a dummy session array\n\t $_SESSION = array();\n\t }\n\t return false;\n\t }\n\t}", "function start_session() {\n session_start();\n\n if (!isset($_SESSION['initiated'])) {\n session_regenerate_id();\n $_SESSION['initiated'] = 1;\n }\n\n if (!isset($_SESSION['count'])) $_SESSION['count'] = 0;\n else ++$_SESSION['count'];\n }", "public function loginCheck()\n\t{\n\t}", "public static function afnSessionStart()\n {\n //session_name($GLOBALS[\"settings\"][\"name\"] . sha1(dirname(__FILE__) . '2k-]+*,3OzI!K^THTI'));\n //session_cache_limiter('nocache');\n\n if (@session_start()) {\n self::safeStart();\n return true;\n } else {\n die(\"Error:\");\n }\n }", "public static function session_started(){\n\t\t\tif(isset($_SESSION) && session_id()){\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}", "public function start() {\n if (!$this->sessionStarted()) {\n if (\\session_start()) {\n\n $hash = md5($_SERVER['HTTP_USER_AGENT'] . \"---|---\" . $this->name);\n $_SESSION['_fingerprint'] = $hash;\n\n return mt_rand(0, 4) === 0 ? $this->refresh() : true; // 1/5, regenerate sid\n }\n }\n return false;\n }", "public function checkLoginStatus()\n\t{\n\t\tif (isset($_SESSION[$this->sess_auth]) || isset($_SESSION[$this->sess_cookie_auth])) {\n\t\t\treturn true;\n\t\t}\n\t}", "private function login() {\n //Look for this username in the database\n $params = array($this->auth_username);\n $sql = \"SELECT id, password, salt \n FROM user \n WHERE username = ? \n AND deleted = 0\";\n //If there is a User with this name\n if ($row = $this->db->fetch_array($sql, $params)) {\n //And if password matches\n if (password_verify($this->auth_password.$row[0] ['salt'], $row[0] ['password'])) {\n $params = array(\n session_id(), //Session ID\n $row[0] ['id'], //User ID\n self::ISLOGGEDIN, //Login Status\n time() //Timestamp for last action\n );\n $sql = \"INSERT INTO user_session (session_id, user_id, logged_in, last_action) \n VALUES (?,?,?,?)\";\n $this->db->query($sql, $params);\n header('Location: ' . $_SERVER['HTTP_REFERER']);\n //User now officially logged in\n }\n //If password doesn't match\n else {\n //Send user back to login with error\n $this->login_form(self::ERR_NOUSERFOUND);\n }\n }\n //If there isn't a User with this name\n else {\n //Send user back to login with error\n $this->login_form(self::ERR_NOUSERFOUND);\n }\n }", "protected function isLoginInProgress() {}", "protected function hasLoginBeenProcessed() {}", "private function check_login(){\n if (isset($_SESSION['email'])){\n $this->email=$_SESSION['email'];\n\t\t\t$this->role=$_SESSION['role'];\n\t\t\t$this->id=$_SESSION['id'];\n $this->signed_in=true;\n }\n else{\n unset($this->email);\n $this->signed_in=false;\n }\n }", "protected function firstLogin ( )\n\t{\n\t\t$uid = \\io\\creat\\chassis\\session::getInstance( )->getUid( );\n\t\t\n\t\t/**\n\t\t * Check if this user has signed first time.\n\t\t */\n\t\t$count = _db_1field( \"SELECT COUNT(*) FROM `\" . Config::T_LOGINS . \"`\n\t\t\t\t\t\t\t\tWHERE `\" . Config::F_UID . \"` = \\\"\" . _db_escape( $uid ) . \"\\\"\n\t\t\t\t\t\t\t\t\tAND `\" . Config::F_NS . \"` = \\\"\" . _db_escape( N7_SOLUTION_ID ) . \"\\\"\" );\n\t\t\n\t\tif ( $count <= 1 )\n\t\t{\n\t\t\t/**\n\t\t\t * Check for existence of Stuff app contexts. There should be none\n\t\t\t * at the time of first login.\n\t\t\t */\n\t\t\t$ctxs = _cdes::allCtxs( $uid, AbConfig::T_ABCTX);\n\t\t\tif ( !is_array( $ctxs ) || !count( $ctxs ) )\n\t\t\t{\n\t\t\t\t/*_db_query( \"INSERT INTO `\" . Config::T_LOGINS . \"`\n\t\t\t\t\t\t\t\tSET `\" . Config::F_UID . \"` = \\\"\" . _db_escape( $uid ) . \"\\\",\n\t\t\t\t\t\t\t\t\t`\" . Config::F_NS . \"` = \\\"\" . _db_escape( N7_SOLUTION_ID ) . \"\\\",\n\t\t\t\t\t\t\t\t\t`\" . Config::F_STAMP . \"` = NOW()\" );*/\n\t\t\t\t\n\t\t\t\t/**\n\t\t\t\t * Create base set of contexts.\n\t\t\t\t */\n\t\t\t\t$set = $this->messages['1st_login'];\n\t\t\t\t$cdes = new _cdes( $uid, AbConfig::T_ABCTX );\n\t\t\t\t$ctx_id = 0;\n\t\t\t\tforeach ( $set as $data )\n\t\t\t\t\t$ctx_id = $cdes->add( 0, $data[1], $data[0], $data[2] );\n\t\t\t}\n\t\t}\n\t}", "public function start_login($arr){\n\n\t\t//CHECK ARR IF SET\n\t\tif(!isset($arr['USER_EMAIL']) || !isset($arr['USER_PASS'])){\n\t\t\techo Janitor::build_json_alert('Array Was Not Passed', 'Login User Error', 100, 2);\n\t\t\texit;\n\t\t\t}\n\n\t\t$email = $arr['USER_EMAIL'];\n\t\t$password = $arr['USER_PASS'];\n\n\t\t//STARTS SESSION IF NON\n\t\tsession_id() == '' ? session_start(): NULL;\n\n\t\t$db = new SqlCore;\n\n\t\t//CHECK IF USER IS LOGGED IN\n\t\tif($this->check_login()){\n\t\t\techo Janitor::build_json_alert('User Is Already Logged Into System', 'User Logged In', 102, 2);\n\t\t\texit;\n\t\t\t}\n\n\t\t$sql = \"SELECT `USER_SALT` FROM `user_tbl` WHERE `USER_EMAIL` = ?\";\n\t\t$bind = array($email);\n\t\t$saltArr = $db->query_array($sql, $bind);\n\n\t\tif($saltArr==NULL){\n\t\t\techo Janitor::build_json_alert('Login Fail', 'Email Is Incorrect', 103, 2);\n\t\t\texit;\n\t\t\t}\n\n\t\t$sql2 = \"SELECT u.`USER_EMAIL`, u.`USER_ID`, u.`USER_FIRST_NAME`, u.`USER_LAST_NAME`, u.`USER_KEY`, u.`USER_PERM` FROM `user_tbl` AS u WHERE u.`USER_EMAIL`= ? AND u.`USER_PASS` = ?\";\n\t\t$bind2 = array($email, sha1($password.$saltArr[0]['USER_SALT']));\n\t\t$userArr = $db->query_array($sql2, $bind2);\n\n\t\tif($userArr==NULL){\n\t\t\techo Janitor::build_json_alert('Email Or Password Are Incorrect', 'Login Fail', 104, 2);\n\t\t\texit;\n\t\t\t}\n\n\t\t//SET LOGIN VARS\n\t\t$_SESSION['userLgInfo'] = array('USER_EMAIL' => $userArr[0]['USER_EMAIL'], 'USER_ID' => Janitor::encrypt_data($userArr[0]['USER_ID'], Config::$ENCRYPT_KEY), 'USER_FULL_NAME' => $userArr[0]['USER_FIRST_NAME'].' '.$userArr[0]['USER_LAST_NAME'], 'USER_FIRST_NAME' => $userArr[0]['USER_FIRST_NAME'], 'USER_LAST_NAME' => $userArr[0]['USER_LAST_NAME'], 'USER_PERM' => Janitor::encrypt_data($userArr[0]['USER_PERM'], Config::$ENCRYPT_KEY));\n\n\t\tsetcookie(\"user\", Janitor::encrypt_data($userArr[0]['USER_KEY'], Config::$ENCRYPT_KEY), time()+86400, '/');\n\n\t\t$this->USER_ID = $userArr[0]['USER_ID'];\n\t\t$this->LOGGED_IN = true;\n\n\t\techo Janitor::build_json_alert('Login Was Successful', 'Success', 105, 1);\n\t\texit;\n\t}", "public function start()\n {\n $path = ini_get('session.cookie_path');\n if (!strlen($path)) {\n $path = '/';\n }\n\n $secure = false;\n\n if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https') {\n $secure = true;\n } else {\n $secure = (empty($_SERVER[\"HTTPS\"]) || ($_SERVER[\"HTTPS\"] === 'off')) ? false : true;\n }\n\n session_set_cookie_params(ini_get('session.cookie_lifetime'), $path, ini_get('session.cookie_domain'), $secure);\n\n if (version_compare(PHP_VERSION, '7.0.0') >= 0) {\n $this->close_session_locks = true;\n }\n\n if ($this->close_session_locks) {\n $result = $this->session_read();\n } else {\n $result = $this->session_open();\n }\n if ($result) {\n $this->flash = new Phpr_Flash();\n if ($this->flash) {\n if (array_key_exists('flash_partial', $_POST) && strlen($_POST['flash_partial'])) {\n $this->flash['system'] = 'flash_partial:' . $_POST['flash_partial'];\n }\n }\n }\n\n return $result;\n }", "public function start_session() {\n\n\t\tif ( $this->is_plugin_settings( $this->_slug ) ) {\n\t\t\tsession_start();\n\t\t}\n\n\t}", "public function auto_login()\n\t{\n\t\tif ($token = Cookie::get($this->_config['autologin_cookie']))\n\t\t{\n\t\t\t// Load the token and user\n\t\t\t$token = Mango::factory($this->_config['token_model_name'], array(\n\t\t\t\t'token' => $token\n\t\t\t))->load();\n\t\t\t \n\t\t\tif ($token->loaded() AND $token->user->loaded())\n\t\t\t{\n\t\t\t\tif ($token->expires >= time() AND $token->user_agent === sha1(Request::$user_agent))\n\t\t\t\t{\n\t\t\t\t\t// Save the token to create a new unique token\n\t\t\t\t\t$token->save();\n\t\t\t\t\t\t\n\t\t\t\t\t// Set the new token\n\t\t\t\t\tCookie::set($this->_config['autologin_cookie'], $token->token, $token->expires - time());\n\t\t\t\t\t\t\n\t\t\t\t\t// Complete the login with the found data\n\t\t\t\t\t$this->_complete_login($token->user);\n\n\t\t\t\t\t// Automatic login was successful\n\t\t\t\t\treturn TRUE;\n\t\t\t\t}\n\n\t\t\t\t// Token is invalid\n\t\t\t\t$token->delete();\n\t\t\t}\n\t\t}\n\n\t\treturn FALSE;\n\t}", "protected function _jumpStartSession($username)\n {\n $aUserData = User::model()->findByAttributes(array('users_name' => $username))->attributes;\n\n $session = array(\n 'loginID' => intval($aUserData['uid']),\n 'user' => $aUserData['users_name'],\n 'full_name' => $aUserData['full_name'],\n 'htmleditormode' => $aUserData['htmleditormode'],\n 'templateeditormode' => $aUserData['templateeditormode'],\n 'questionselectormode' => $aUserData['questionselectormode'],\n 'dateformat' => $aUserData['dateformat'],\n 'adminlang' => 'en'\n );\n foreach ($session as $k => $v)\n Yii::app()->session[$k] = $v;\n Yii::app()->user->setId($aUserData['uid']);\n\n $this->controller->_GetSessionUserRights($aUserData['uid']);\n return true;\n }", "public static function sessionAndUserLoggedIn(){\n Verify::session();\n Verify::userLoggedIn();\n }", "function login_attempt() {\n $data = json_decode(file_get_contents(\"../dummyauth.json\"),true);\n if ($_POST['user'] === $data['login'] && password_verify($_POST[\"pass\"], $data['hash'])) {\n $_SESSION['authed'] = true;\n $_SESSION['actor'] = \"https://\". $_SERVER['HTTP_HOST'] . $data['actor'];\n $_SESSION['last_access'] = $_SERVER['REQUEST_TIME'];\n header('Location: index.php');\n exit();\n }\n}", "public static function checkLoginState($pdo_conn) {\n\t\tfunc::runSession();\n \n\t\tif(isset($_COOKIE['userid']) && isset($_COOKIE['username']) && isset($_COOKIE['token']) && isset($_COOKIE['serial'])) {\n\n\t\t\t$query = \"SELECT * FROM sessions WHERE sessions_userid = :userid AND sessions_token = :token AND sessions_serial = :serial\"; \n\t\t\t\n\t\t\t$userid = $_COOKIE['userid'];\n $username = $_COOKIE['username'];\n\t\t\t$token = $_COOKIE['token'];\n\t\t\t$serial = $_COOKIE['serial'];\n\n\t\t\t$stmt = $pdo_conn->prepare($query);\n\t\t\t$stmt->execute(array(':userid' => $userid, ':token' => $token, ':serial' => $serial));\n\t\t\t$row = $stmt->fetch(PDO::FETCH_ASSOC);\n\n\t\t\tif($stmt->rowCount() > 0) {\n\t\t\t\tif ($row['sessions_userid'] == $_COOKIE['userid'] && $row['sessions_token'] == $_COOKIE['token'] && $row['sessions_serial'] == $_COOKIE['serial'] ) {\n # check sessions...\n if ($row['sessions_userid'] == $_SESSION['userid'] && $row['sessions_token'] == $_SESSION['token'] && $row['sessions_serial'] == $_SESSION['serial']) {\n # code...\n return true;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n func::createSession($_COOKIE['userid'], $_COOKIE['username'], $_COOKIE['token'], $_COOKIE['serial']);\n return true;\n }\n }\n }\n\t\t}\n\t\telse {\n return false;\n }\n\t}" ]
[ "0.7561102", "0.75259376", "0.71529657", "0.71182793", "0.70637345", "0.7057598", "0.70119023", "0.7008619", "0.6976411", "0.69640106", "0.6935279", "0.69021565", "0.68785596", "0.6863336", "0.6852832", "0.6851214", "0.6850439", "0.68329704", "0.6830511", "0.6820222", "0.67697966", "0.6769133", "0.676812", "0.67679936", "0.675802", "0.67452985", "0.6731835", "0.67200434", "0.6719423", "0.6711578", "0.6711052", "0.67049426", "0.6694082", "0.66937447", "0.6682663", "0.6677163", "0.6663042", "0.6644568", "0.6643803", "0.66415393", "0.66324115", "0.6616711", "0.66061175", "0.6602584", "0.65887654", "0.65868735", "0.6583932", "0.65808994", "0.6571523", "0.6563432", "0.6558816", "0.6547468", "0.65459627", "0.6545749", "0.65372336", "0.6536434", "0.6534743", "0.6533353", "0.6527292", "0.652555", "0.6523604", "0.65154064", "0.6509895", "0.649574", "0.64921844", "0.6491732", "0.64909434", "0.6488129", "0.64874244", "0.64862955", "0.64824265", "0.6480457", "0.6463725", "0.64535165", "0.6450968", "0.64508414", "0.6450323", "0.644966", "0.64434457", "0.64413434", "0.64390355", "0.6436176", "0.64358234", "0.64255625", "0.6423892", "0.6411293", "0.6401018", "0.64007944", "0.63977826", "0.63977045", "0.6391534", "0.638849", "0.6387167", "0.63833725", "0.638165", "0.6380084", "0.6366844", "0.63616735", "0.63605464", "0.6355535", "0.63479125" ]
0.0
-1
! Checks if user is inlogged !
public function isLoggedIn(){ if(!isset($_SESSION)){ session_start(); } if(isset($_SESSION['logged_in']) && isset($_SESSION['userID']) && $_SESSION['logged_in'] == true){ return true; } else { return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function isUserLoggedIn() {}", "protected function isUserLoggedIn() {}", "public function is_logged_in() {\n\n\t}", "function wv_is_user_loggedin() {\n $output = 0;\n if (is_user_logged_in()) {\n $output = 1;\n } else {\n $output = 0;\n }\n return $output;\n }", "private function _logged_in()\n {\n /*if(someone is logged in)\n RETURN TRUE;*/\n }", "private function isLoggedIn()\n {\n return isset($_SESSION['user']); \n }", "function is_logged_in()\n\t{\n\t\treturn require_login();\n\t}", "public function isLoggedIn();", "public function isLoggedIn();", "function IsLoggedIn() {\t\tif( Member::currentUserID() ) {\r\n\t\t return true;\r\n\t\t}\r\n }", "private function checkUserLoggedIn(): bool\n {\n $user = JFactory::getUser();\n if ($user->id > 0) {\n return true;\n } else {\n return false;\n }\n }", "function logged_in() {\n\t\treturn isset($_SESSION['USERID']);\n \n\t}", "function is_logged_in()\n {\n //check session\n //return logged in user_id or false\n }", "function is_logged_in() \n {\n return (empty($this->userID) || $this->userID == \"\") ? false : true;\n }", "public function is_user_logged_in(){\n\t\treturn $this->session->userdata('current_user_id') != FALSE;\n\t}", "function isLoggedIn(){\r\n APP::import('Component','Auth');\r\n $auth = new AuthComponent;\r\n $auth ->Session = $this->Session;\r\n $user = $auth->user();\r\n return !empty($user);\r\n \r\n }", "public function is_loggedin(){\n if(isset($_SESSION['user_session'])){\n return true;\n }\n return false;\n }", "public function isLoggedIn()\n {\n return isset($_SESSION['user']);\n }", "function logged_in() {\r\n\t\treturn isset($_SESSION[\"admin_id\"]);\r\n\t}", "static public function isLoggedIn(){\n \treturn (self::getInstance()->getId()>1);\n }", "function isUserLoggedIn()\r\n\t{\r\n\t\t\tglobal $con;\r\n\t\t\t$return = false;\r\n\t\t\tif (isset($_SESSION['USER_ID']) && ($_SESSION['USER_ID'] > 0) && ($_SESSION['USER_ID'] != ''))\r\n\t\t\t{\r\n\t\t\t\t$id = $_SESSION['USER_ID'];\r\n\t\t\t\tif ($this->chkValidUser($id))\r\n\t\t\t\t{\r\n\t\t\t\t\t$return = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn $return;\r\n\t}", "public function isloggedin()\n {\n return Session::userIsLoggedIn();\n }", "abstract protected function isUserLoggedIn() ;", "public function is_logged_in()\n\t{\n\t\treturn ($this->session->userdata('iduser') != FALSE);\n\t}", "public function loggedIn(){\r\n if (isset($_SESSION['user_session']))\r\n return true;\r\n else\r\n return false;\r\n }", "function isLoggedIn() {\n\treturn isset($_SESSION['user_id']);\n}", "function loggedIn() {\n\t\treturn isset($_SESSION['username']);\n\t}", "protected function isLoggedIn()\n\t{\n\t\treturn is_user_logged_in();\n\t}", "public function isLoggedIn()\n {\n return true;\n }", "public static function isLoggedIn(){\n if(!self::exists('is_logged_in')&& self::get('is_logged_in')!==true){\n \n header('location:' . URL . 'user/login.php');\n exit;\n }\n }", "public function isUserLoggedIn() {\r\n\t\treturn ($this->coreAuthenticationFactory->isUserLoggedIn ());\r\n\t}", "function loggedin() {return $this->login_state!=0;}", "function isLoggedIn() {\n\treturn isset($_SESSION['user']);\n}", "public function isLoggedIn(){\n // Apakah user_session sudah ada di session\n if(isset($_SESSION['user_session']))\n {\n return true;\n }\n }", "function logged_in(){\n\t\tif((isset($_SESSION['user_id']) || isset($_SESSION['username'])) && (!empty($_SESSION['user_id']) || !empty($_SESSION['username']))){\n\t\t\treturn true;\n\t\t}else{\n\t\t\treturn false;\n\t\t}\n\t}", "public function logged_in()\n {\n if (isset($_SESSION['user_data'])) {\n return true;\n } else {\n return false;\n }\n }", "function isUserLogged() {\r\n return isset($_SESSION['user']);\r\n }", "private function if_user_logged_in()\n {\n\n session_start();\n\n if(!empty($_SESSION)){\n\n if(isset($_SESSION[\"user_id\"]) && isset($_SESSION[\"user_type\"])){\n \n return true;\n\n }else{\n\n return false;\n }\n\n }else{\n\n return false;\n }\n }", "public function isCurrentlyLoggedIn() {}", "public static function check()\n {\n if (!empty($_SESSION['LOGGED_IN_USER'])){\n return true;\n } else{\n return false;\n }\n }", "public function isLogged(){\n return isset($_SESSION[\"user\"]);\n }", "public function isLoggedIn()\n {\n if(Session::get('user_id') != '') {\n $this->user_id=Session::get('user_id');\n $this->role_id=Session::get('role_id');\n return true;\n }else {\n return false;\n }\n }", "public function isUserLoggedIn()\n {\n return $this->user_is_logged_in;\n }", "function is_logged_in()\r\n{\r\n return isset($_SESSION['user_id']) || isset($_SESSION['pseudo']); //booleen : true or false. if one of them good : true\r\n}", "public function checkLoggedIn()\n\t\t{\n\t\t\t\n\t\t\ttry {\n\t\t\t \n\t\t\t\t$query = $this->_db->prepare( \"SELECT username FROM login WHERE username=:username\" );\n \n \n\t\t\t\t$query->bindParam( \":username\", $_SESSION[ 'username' ], PDO::PARAM_STR );\n\n\t\t\t\t$query->execute();\n\t\t\t\n\t\t\t} catch ( PDOException $e ) {\n\n\t\t\t\techo $e->getMessage();\n\n\t\t\t}\n\n\t\t\t$row = $query->fetch();\n\t\t\t\n \n\t\t\t$loggedInUser = $row[ 'username' ];\n \n //if the user is not logged in\n\t\t\tif( !isset( $loggedInUser ) )\n\t\t\t{\n //head to the log in page\n\t\t\t\theader( 'Location: login.php' );\n\n\t\t\t}\n\t\t\t\n\t\t}", "static function checkForLogIn()\n {\n if (isset($_SESSION['username'])) {\n return true;\n }\n\n return false;\n }", "public function loggedIn()\n {\n if(isset($_SESSION['user']) && !empty($_SESSION['user'])) {\n return true;\n }\n\n return false;\n }", "function logged_in() {\n\t\n\treturn isset( $_SESSION['user_id'] );\n}", "public function is_loggedin()\n {\n if (isset($_SESSION['user_session'])) {\n return true;\n }\n }", "function isLoggedIn() {\n\t\tif (isset($_SESSION[\"UID\"]) && !empty($_SESSION[\"UID\"])) {\n\t\t\t// logged in\n\t\t\treturn TRUE ;\n\t\t} else {\n\t\t\t// not logged in\n\t\t\treturn FALSE ;\n\t\t}\n\t}", "private static function is_logged_in () {\n\t\t# Check for the existence of the cookie\n\t\tif (isset($_COOKIE[\"user_id\"])) {\n\t\t\treturn (true);\n\t\t} else {\n\t\t\treturn (false);\n\t\t}\n\t}", "public function check_login(){\n\t\t\tif( isset( $_SESSION['user_id'] ) ) {\n\t\t\t\t$this->user_id = $_SESSION['user_id'];\n\t\t\t\t$this->logged_in = true;\n\t\t\t} else {\n\t\t\t\tunset( $this->user_id );\n\t\t\t\t$this->logged_in = false;\n\t\t\t}\n\t\t}", "function logged_user_check() {\n if(is_user_logged())\n launch_error(\"You are already logged in.\");\n}", "function isLoggedIn()\n\t{\n\t\tif ( $this->_isAuthorized() ){\t\n\t\t\treturn true;\n\t\t} else return false;\n\t\n\t}", "function is_logged_in()\n{\n return isset($_SESSION['user']);\n}", "public static function isLoggedIn()\n {\n return (bool)Users::getCurrentUser();\n }", "function logged_in() {\n\treturn isset($_SESSION['admin_id']);\n}", "function logged_in() {\n\t\tif (isset($_SESSION['admin_id'])) {\n\t\t\tif($_SESSION['username'] === \"main_admin\"){ \n\t\t\t\treturn 1; \n\t\t\t}\n\t\t}\n\t\treturn 0; \n\t}", "public function isLoggedIn()\n {\n return ($this->userInfo->userid ? true : false);\n }", "function has_logged_in()\n\t{\n\t\tif( $this->session->userdata('usir_nim') )\n\t\t{\n\t\t\tredirect('reminders');\n\t\t}\n\t\t\n\t}", "public function userIsLoggedIn() {\n return auth()->check() ;\n }", "function is_logged_in()\n\t{\n\t\t$is_logged_in = $this->session->userdata('login');\n\t\t$level=$this->session->userdata('level');\n\t\t//jika session tidak ada atau levelnya bukan user maka akan menampilkan pesan error\n\t\tif(!isset($is_logged_in) || $is_logged_in != true )\n\t\t{\n\t\t\techo 'You don\\'t have permission to access this page. <a href=\"login\">Login</a>';\n\t\t\tdie();\n\t\t}\n\t}", "public function check_login()\n\t{\n\t\tif(isset($_SESSION[\"user_id\"]))\n\t\t{\n\t\t $this->_user_id = $_SESSION[\"user_id\"];\n\t\t\t$this->_client = $_SESSION[\"client\"];\n\t\t\t$this->_loged_in = true;\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->_loged_in = false;\n\t\t\t$this->_client = false;\n\t\t\tunset($this->_user_id);\n\t\t}\n\t}", "function logged_in() \n {\n return isset($_SESSION['current_username']);\n }", "public function loggedIn()\n {\n if($this->di->session->get('user'))\n {\n return true;\n }\n return false;\n }", "function getUserIsLoggedIn() {\r\n\r\n // For now, just return false\r\n return false;\r\n}", "function is_user_logged_in()\n{\n global $current_user;\n return ($current_user != NULL);\n}", "function loggedIn(){\r\n\tif(Session::exists('loggedIn') && Session::get('loggedIn')==1){\r\n\t\treturn TRUE;\r\n\t}\r\n\telse\r\n\t\treturn FALSE;\r\n}", "public function logged_in() {\n return !empty($this->session->userdata('user_id'));\n }", "public function is_logged_in()\n\t{\n\t\tif(isset($_SESSION['userSession']))\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t}", "static function isLoggedIn() {\n $user = self::currentUser();\n return isset($user) && $user != null;\n }", "public function isLoggedIn()\n {\n $database = new Database();\n $loggedIn = $database->getAdminByUsername($_SESSION['user']);\n $admin = new Admin($loggedIn['adminId'], $loggedIn['username'], $loggedIn['adminLevel'], $loggedIn['active']);\n if(isset($_SESSION['user']) === true && strpos($admin->getAdminLevel(), Resources) !== false && $admin->getActive() == 1) {\n $testLogin = true;\n } else {\n $this->_f3->reroute('/Login');\n }\n $this->_f3->set('login', $testLogin);\n $this->_f3->set('admin', $admin);\n }", "function is_logged_in()\n\t{\n\t\t$is_logged_in = $this->session->userdata('login');\n\t\t$level=$this->session->userdata('level');\n\t\t//jika session tidak ada atau levelnya bukan user maka akan menampilkan pesan error\n\t\tif(!isset($is_logged_in) || $is_logged_in != true || $level != 'hrd' )\n\t\t{\n\t\t\techo 'You don\\'t have permission to access this page. <a href=\"../backend\">Login</a>';\n\t\t\tdie();\n\t\t}\n\t}", "public function isLoggedIn()\n {\n return $this->session->has('user');\n }", "function is_logged() {\n\tif(\n\t\tisset($_SESSION['user']['iduser']) \n\t) return TRUE;\n\t\t\n\treturn FALSE;\n}", "function checkLogged()\n{\n\tif(isset($_SESSION['user_id']) && $_SESSION['user_id'] != \"\")\n\t\treturn true;\n\n\treturn false;\n}", "public static function is_user_logged_in() {\r\n if (isset($_SESSION['user_id'])) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }", "public function is_logged_in(){\r\n\t\t\treturn $this->logged_in;\r\n\t\t}", "public function isUserLoggedIn() \n {\n if (!isset($_SESSION['user_id']) || !isset($_SESSION['is_logged_in'])) {\n return false;\n } else {\n return true;\n }\n }", "function auth_isLoggedIn()\n{\n return ! auth_isAnonymous();\n}", "function is_user_logged_in()\n{\n global $current_user;\n\n // if $current_user is not NULL, then a user is logged in!\n return ($current_user != NULL);\n}", "function is_logged_in() {\n\tif (!empty($_SESSION['loggedin']) && !empty($_SESSION['user_id'])) {\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n}", "function isLoggedIn(){\n return $this->auth->isLoggedIn();\n }", "public function user_is_logged_in()\n \t{\n\n \t\tif(!$this->session->userdata('is_logged_in'))\n \t\t{\n \t\t\treturn FALSE;\n \t\t}\n \t\telse\n \t\t{\n \t\t\treturn TRUE;\n \t\t}\n\n \t}", "public function isLoggedIn()\n {\n // check session for user id\n if(isset($_SESSION['user']['id'])) {\n // return true;\n return $_SESSION['user']['id'];\n }\n else {\n return false;\n }\n }", "protected function _logged_in()\n\t{\n\t\t$authentic = Auth::instance();\n\t\t\n\t\tif ($authentic->logged_in())\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn false;\t\n\t\t}\n\t}", "public function isLoggedIn() {\n $auth_cookie = Cookie::get(\"auth_cookie\"); //get hash from browser\n //check if cookie is valid\n if ($auth_cookie != '' && $this->cookieIsValid($auth_cookie)) {\n return true;\n } else {\n return false;\n }\n }", "protected function is_logged_in( )\n\t{\n\t\t$this->user = $this->php_session->get('user');\n\t\tif( is_null($this->user))\n\t\t\treturn False;\n\t\tif( ! $this->is_timed_out() )\n\t\t\treturn False;\n\t\t$this->user['last_active'] = time();\n\t\t$this->php_session->set('user' , $this->user );\n\n\t\t//apply user permissions globally\n\t\t//@see user_helper\n\t\tapply_global_perms( $this->user );\n\n\n\t\t\n\t\treturn True;\n\t}", "public function isLoggedIn()\n {\n $database = new Database();\n $loggedIn = $database->getAdminByUsername($_SESSION['user']);\n $admin = new Admin($loggedIn['adminId'], $loggedIn['username'], $loggedIn['adminLevel'], $loggedIn['active']);\n if(isset($_SESSION['user']) === true && strpos($admin->getAdminLevel(), Partner) !== false && $admin->getActive() == 1) {\n $testLogin = true;\n } else {\n $this->_f3->reroute('/Login');\n }\n $this->_f3->set('login', $testLogin);\n $this->_f3->set('admin', $admin);\n }", "function isLogged();", "public function checkLoggedIn()\n {\n if(!isset($_SESSION['user_id']))\n {\n redirect('pages/view/home');\n exit;\n }\n else\n {\n return $user_id=$_SESSION['user_id'];\n }\n }", "public function is_logged_in(){\n\t\treturn $this->_state_is_logged_in;\n\t}", "function user_logged_in() {\n return (isset($_SESSION['logged_in']) && $_SESSION['logged_in']);\n}", "public static function isLoggedIn(){\r\n\t\treturn isset($_SESSION[\"id\"]);\r\n\t}", "function auth_check()\n\t{\n\t\t$ci =& get_instance();\n\t\treturn $ci->auth_model->is_logged_in();\n\t}", "function auth_check()\n\t{\n\t\t$ci =& get_instance();\n\t\treturn $ci->auth_model->is_logged_in();\n\t}", "public function isLoggedIn() {\n $cookie = $this->login();\n return $cookie != NULL;\n }", "protected function check_logged_in(){\n\n\t\t$this->load->model('patoauth/patoauth_model', 'patoauth');\n\n\t/*\n\t\tTRY TO AUTOLOGIN */\n\n\t\tif(! $this->patoauth->is_logged_in())\n\t\t\t$this->patoauth->autologin();\n\n\t/*\n\t\tIF STILLS NO LOGGED IN GET OUT OF HERE */\n\n\t\tif(! $this->patoauth->is_logged_in())\n\t\t\tredirect(site_url('auth/login'));\n\t}", "public function loggedIn()\n {\n $CI = &get_instance();\n if ($CI->session->has_userdata('user_id')) {\n return true;\n } else {\n return false;\n }\n }", "public function drupalIsLoggedIn()\n {\n // TODO: implement without the client/crawler\n }", "public static function check_log_in ()\n {\n session_start();\n\n if (!$_SESSION['user_data']) {\n header('Location: ./../index.php');\n exit;\n }\n }" ]
[ "0.86785835", "0.86785835", "0.8527274", "0.8484006", "0.84455794", "0.83750176", "0.832903", "0.83128744", "0.83128744", "0.8297051", "0.82759917", "0.82686114", "0.82685137", "0.82585824", "0.8247186", "0.8244983", "0.82405144", "0.8227985", "0.82104576", "0.81937027", "0.8185389", "0.817105", "0.8169394", "0.8168742", "0.8146909", "0.8146847", "0.81440985", "0.81264484", "0.812081", "0.81205606", "0.811895", "0.8115359", "0.81108564", "0.81096935", "0.8108708", "0.8108609", "0.8102164", "0.80965203", "0.80917853", "0.8072732", "0.8062921", "0.805322", "0.8048256", "0.8045609", "0.8040392", "0.8040361", "0.8034908", "0.8033398", "0.80325115", "0.80308825", "0.8030648", "0.80306065", "0.80281156", "0.80265415", "0.80230314", "0.8020985", "0.80173683", "0.80086565", "0.80067587", "0.8005786", "0.79965085", "0.79953974", "0.798414", "0.798295", "0.7981994", "0.79807675", "0.7978731", "0.79757684", "0.7973439", "0.79729027", "0.79725325", "0.7970758", "0.7970216", "0.79684246", "0.79586005", "0.7958059", "0.7953309", "0.79512334", "0.7938657", "0.7938478", "0.7927966", "0.79246014", "0.7924543", "0.79170746", "0.7914888", "0.79139155", "0.79037213", "0.79005", "0.7899151", "0.78946215", "0.78906006", "0.7889494", "0.78883755", "0.788756", "0.78725415", "0.78725415", "0.7867759", "0.78669703", "0.7858479", "0.78496724", "0.78485113" ]
0.0
-1
! Checks if user is admin !
public function isAdmin(){ if(!isset($_SESSION)){ session_start(); } if(isset($_SESSION['admin']) && $_SESSION['admin'] == true){ return true; } else { return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function isAdminUser() {}", "function is_user_admin()\n {\n }", "function is_admin()\n {\n //is a user logged in?\n\n //if so, check admin status\n\n //returns true/false\n\n }", "private function isAdmin() {\n\t\tif (Auth::user()->user == 1) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\n\t}", "protected function isCurrentUserAdmin() {}", "protected function isCurrentUserAdmin() {}", "public function isAdmin(){\n $user = Auth::guard('web') -> user();\n if ($user -> state != 1) {\n return 0;\n }\n else {\n return 1;\n }\n }", "public function isAdmin()\n {\n return ($this->username === \"admin\");\n }", "public function isAdmin();", "public function isAdmin() {}", "function isUserAdmin() {\r\n $user = $_SESSION['user'];\r\n return checkAdminStatus($user);\r\n }", "public function checkAdmin();", "function isAdmin(){\r\n\r\n\t\tif($this->user_type == 'Admin'){\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}", "public function checkIsAdmin()\n {\n return $this->user_admin;\n }", "function isAdmin() {\n return ($this->userType == 'admin');\n }", "public function isUserOnAdminArea()\n\t{\n\t\treturn is_admin();\n\t}", "public function checkAdmin()\n {\n // there ..... need\n // END Check\n $auth = false;\n if($auth) {\n return true;\n }\n else{\n return false;\n }\n }", "function isAdmin(){\n $user = $this->loadUser(Yii::app()->user->id);\n return intval($user->role) == 1;\n }", "function isAdmin(){\n $user = $this->loadUser(Yii::app()->user->id);\n return intval($user->role) == 1;\n }", "function isAdmin() {\n //FIXME: This needs to (eventually) evaluate that the user is both logged in *and* has admin credentials.\n //Change to false to see nav and detail buttons auto-magically disappear.\n return true;\n}", "public function isAdmin()\n {\n }", "public function isUserAdmin()\n\t{\n\t\treturn (Bn::getValue('user_type') == 'A');\n\t}", "function is_admin(){\r\n if (isset($_SESSION['admin']) && $_SESSION['admin']){\r\n return true;\r\n }\r\n return false;\r\n }", "public function isAdmin(){\n if($this->role==\"admin\"){\n return true;\n }\n return false;\n }", "function isAdmin(){\n\t\treturn ($this->userlevel == ADMIN_LEVEL || $this->username == ADMIN_NAME);\n\t}", "public function adminControl()\n {\n $row = $this->currentUserData();\n if(isset($_SESSION['sess_user_type']) &&\n $_SESSION['sess_user_type'] == 'admin' && $row['user_type'] == 'admin'){\n return true;\n }\n }", "function checkAdmin()\n\t {\n\t \tif(!$this->checkLogin())\n\t \t{\n\t \t\treturn FALSE;\n\t \t}\n\t \treturn TRUE;\n\t }", "protected function isAdmin()\n\t{\n\t\treturn is_admin();\n\t}", "public function is_admin() {\n if($this->is_logged_in() && $this->user_level == 'a') {\n return true;\n } else {\n // $session->message(\"Access denied.\");\n }\n }", "public function check_admin() {\n return current_user_can('administrator');\n }", "public static function isAdmin() {\r\n\r\n return Session::get('admin') == 1;\r\n\r\n }", "function checkAdminLogin() \n{\n\tif(checkNotLogin())\n\t{\n\t\treturn false;\n\t}\n\t\n\t$user = $_SESSION['current_user'];\n\t\n\tif($user->isAdmin())\n\t{\n\t\treturn true;\n\t}\n\telse \n\t{\n\t\treturn false;\n\t}\n}", "public function isAdmin()\n\t{\n\t\t$this->reply(true);\n\t}", "protected function userIsAdmin ()\n {\n $tokenHeader = apache_request_headers();\n $token = $tokenHeader['token'];\n $datosUsers = JWT::decode($token, $this->key, $this->algorithm);\n\n if($datosUsers->nombre==\"admin\")\n {\n return true;\n }\n else\n {\n return false;\n } \n }", "public static function am_i_admin() \n {\n return ($_SESSION['_user'] == AV_DEFAULT_ADMIN || $_SESSION['_is_admin']);\n }", "function isAdmin() {\n\tif (isset($_SESSION['user']) && $_SESSION['user']['user_type'] == 'admin' ) {\n\t\treturn true;\n\t}else{\n\t\treturn false;\n\t}\n}", "public function isAdmin() {\n return $this->admin; // cerca la colonna admin nella tabella users\n }", "public function isAdmin(){\n return $this->role=='admin';\n }", "function is_admin() {\n\tif(\n\t\tisset($_SESSION['admin']->iduser) \n\t\t&& !empty($_SESSION['admin']->iduser) \n\t\t&& $_SESSION['admin']->type = 'admin'\n\t\t&& $_SESSION['active']->type = 1\n\t\t&& $_SESSION['confirmed']->type = 1\n\t) return TRUE;\n\t\t\t\n\treturn FALSE;\n}", "public static function authAdmin() {\n if (Yii::$app->user->can(\"administrator\") || Yii::$app->user->can(\"adminsite\")) {\n return TRUE; //admin ใหญ่\n }\n }", "function is_admin()\n\t{\n\t\treturn strtolower($this->ci->session->userdata('DX_role_name')) == 'admin';\n\t}", "public function isAdmin()\n {\n return $this->hasCredential('admin');\n }", "public function isAdmin(): bool\n {\n return $this->is_admin === true;\n }", "private function isAdmin() : bool\n {\n return $this->user->hasRole('admin');\n }", "public function is_admin()\n\t{\n\t\t$user = $this->get_current_user();\n\t\tif($user !== NULL)\n\t\t{\n\t\t\tif($user['auth'] == 255)\n\t\t\t{\n\t\t\t\treturn TRUE;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn FALSE;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\t}", "function isAdmin() {\n $user = $this->loadUser(Yii::app()->user->id);\n return intval($user->role) == 1;\n }", "private function isAdmin() : bool\n {\n return $this->role('admin');\n }", "private function checkAdmin()\n {\n $admin = false;\n if (isset($_SESSION['admin'])) {\n F::set('admin', 1);\n $admin = true;\n }\n F::view()->assign(array('admin' => $admin));\n }", "public function isAdmin()\n {\n return (\\Auth::user()->role == 'admin');\n }", "public function check_admin()\n {\n return current_user_can('administrator');\n }", "public function isAdmin()\n {\n return $this->role == 1;\n }", "function isAdmin()\n\t{\n\t\treturn $this->role == 3;\n\t}", "function user_AuthIsAdmin() {\n\tglobal $AUTH;\n\t\n\treturn isset($AUTH['admin']) && ($AUTH['admin'] === 1);\n}", "public function is_admin() {\n return $this->session->get(\"niveau_acces\") >= 2;\n }", "static public function isAdmin(){\n if ( isset($_SESSION['admin']) && ($_SESSION['admin'] == 1)){\n return true;\n } else {\n return false;\n }\n }", "function is_admin()\n{\n global $app;\n if (is_authenticated()) {\n $user = $app->auth->getUserData();\n return ($user['role'] === '1');\n } else {\n return false;\n }\n}", "function isAdmin() {\n if (\\Illuminate\\Support\\Facades\\Auth::user()->rol_id == 1) {\n return true;\n } else {\n return false;\n }\n }", "public static function check_admin () {\n if (! Person::user_is_admin()) {\n View::make('main/error.html');\n }\n }", "public static function isAdmin(): bool {\n if ($user = self::user() && self::user()->isAdmin) {\n return true;\n }\n return false;\n }", "public function isAdmin()\n {\n return ($this->type === User::ADMIN_USER);\n }", "function IsAdmin()\n{\n\treturn false;\n}", "function is_admin()\r\n{\r\n if(is_auth() && $_SESSION['user']['statut'] == 1)\r\n {\r\n return true;\r\n }\r\n return false;\r\n}", "public function getIsAdmin();", "public function getIsAdmin();", "public static function isAdmin()\n {\n if (Yii::$app->user->isGuest) {\n return false;\n }\n $model = User::findOne(['username' => Yii::$app->user->identity->username]);\n if ($model == null) {\n return false;\n } elseif ($model->id_user_role == 1) {\n return true;\n }\n return false;\n }", "function user_is_admin() {\n\tif(user_is_connect() && $_SESSION['membre']['statut'] == 2) {\n\t\t// si l'utilisateur est connecté et que son statut est égal à 2 alors il est admin\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n}", "public static function isAdmin()\n\t{\n\t\treturn in_array( Auth::user()->username, Config::get( 'admin.usernames' ) );\n\t}", "public function IsAdmin ();", "public function isAdmin(){\n if($this->role->name = 'Administrator'){\n return true;\n }\n return false;\n }", "public function isAdmin()\n {\n return $this->role == 'admin';\n }", "public static function isAdmin(){\n if(self::exists('auth_type')&& self::get('auth_type')=='admin'){\n return true;\n }else\n return false;\n\n }", "public function isAdmin()\n {\n return ((string) strtoupper($this->data->user_role) === \"ADMIN\") ? true : false;\n }", "public static function isAdmin()\n {\n \t$user = Session::get('loginuser');\n \tif ($user == env('ADMINEMAIL')) {\n \t\treturn true;\n \t} else {\n \t\treturn false;\n \t}\n }", "public function isAdmin() {\n return $this->hasPermission('is_admin');\n }", "public static function isAdmin()\n {\n return auth()->check() && auth()->user()->panichd_admin;\n }", "function iAmAdmin(){\n $adminIDs = Array( 1, 2 );\n \n return in_array( $_SESSION['userid'], $adminIDs );\n }", "public function isAdmin(){\n $role = $this->role->type;\n\n return $role === 'admin';\n }", "public function isAdmin()\n {\n return $this->isSuperUser() || $this->isMemberOf('admin');\n }", "public function isAdmin()\n {\n return ($this->role == 1) ? true : false;\n }", "function _isUserAdmin(){\n\n $output = 0;\n $userId = $this->session->userdata('userId');\n $user = $this->User_model->getUserByUserId($userId);\n $userRoleId = $user->user_roles_id;\n $userRole = $this->Roles_model->getUserRoleById($userRoleId);\n if($userRole->role === 'admin'){\n $output = 1;\n }\n return $output;\n }", "static function getIsAdmin() {\n\t\t$user = ctrl_users::GetUserDetail();\n\t\tif($user['usergroupid'] == 1) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}", "public function isAdmin() {\n return ($this->userlevel == ADMIN_LEVEL ||\n $this->username == ADMIN_NAME);\n }", "function is_admin()\n {\n\tif(isset($_SESSION['ISADMIN']))\n\t {\n\t\treturn $this->check_session($_SESSION['ISADMIN']);\n\t }\n\t else\n\t {\n\t\t return false;\n\t }\n }", "public function isAdmin()\n {\n return $this->user_role === User::ROLE_ADMIN;\n }", "public function memberIsAdmin()\n {\n return $_SESSION['__COMMENTIA__']['member_role'] === 'admin';\n }", "private function check_if_user_is_admin()\n {\n $user = wp_get_current_user();\n $tasks_performer = new TasksPerformer;\n if (!$tasks_performer->is_mtii_admin()) {\n exit(\"Woof Woof Woof\");\n }\n }", "public function is_user_admin($user) {\n return $user['user_admin'] == 1;\n }", "function userAdmin(){\r\n if(userConnect() && $_SESSION['user']['privilege']==1) return TRUE; else return FALSE;\r\n }", "public static function isAdmin(): bool\n {\n $user = self::getUser();\n\n // $user->admin (check if user is admin in database - set to 1)\n if (!$user || !$user->admin) {\n return false;\n }\n\n return true;\n }", "protected function isAdmin()\n {\n if($_SESSION['statut'] !== 'admin')\n {\n header('Location: index.php?route=front.connectionRegister&access=adminDenied');\n exit;\n }\n }", "function adminCheck()\n {\n\n // define all the global variables\n global $user, $message, $settings, $translator;\n\n // check if the user is admin\n if ($user->isAdmin()) {\n return true;\n }\n\n // if not then print a custom error message\n $_SESSION['siteTemplateURL'] = $settings->getTemplatesURL();\n $message->customKill($translator->translateText(\"invalidPrivileges\"), $translator->translateText(\"invalidPrivilegesMSG\"), $settings->getTemplatesPath());\n return false;\n }", "protected static function isAdminUser() {\r\n throw new \\Excpetion('yet to implement');\r\n }", "function checkUserIsAdmin()\n {\n $user_db = new SafeMySQL();\n\n $user_id = htmlentities($_SESSION[SES_NAME]['user_id'], ENT_QUOTES, 'UTF-8');\n\n if($user_db->getRow(\"SELECT user_id FROM app_users WHERE user_status = 'Active' AND user_id = ?s\",$user_id)){\n return true;\n } else {\n return false;\n }\n\n }", "function isAdmin(){\n$user = $this->loadUser(Yii::app()->user->user_id);\nreturn intval($user->user_role_id) == 1;\n}", "public function adminUserConditionMatchesAdminUser() {}", "function is_admin() {\n\tglobal $connection;\n\n\tif(isLoggedIn()) {\n\t\t$query = \"SELECT user_role FROM users WHERE user_id =\" . $_SESSION['user_id']. \"\";\n\t\t$result = mysqli_query($connection, $query);\n\t\tconfirm($result);\n\n\t\t$row = mysqli_fetch_array($result);\n\n\t\treturn $row['user_role'] === 'admin' ? true : false;\n\t}\n}", "public function getIsAdministrator() {}", "function isAdmin(){\n\t\treturn (isset($this->params['admin']) && $this->params['admin']);\n\t}", "function is_admin_logged_in()\n{\n global $current_user;\n return ($current_user != NULL && $current_user['un'] == 'admin');\n}", "public function isAdmin()\n {\n return $this->getAttribute('type') === User::ADMIN_TYPE;\n }" ]
[ "0.8912773", "0.8882788", "0.8800633", "0.8598705", "0.85671127", "0.8563944", "0.8539474", "0.8499135", "0.8496032", "0.84778184", "0.8456616", "0.84487116", "0.8418807", "0.83447415", "0.83288795", "0.8324892", "0.8313899", "0.8303283", "0.8303283", "0.8298254", "0.82917976", "0.8290133", "0.82803005", "0.8272544", "0.82613575", "0.8255189", "0.82549983", "0.82527184", "0.82453275", "0.8224811", "0.82221955", "0.82202536", "0.8212521", "0.8212258", "0.8207546", "0.82053274", "0.82049084", "0.81833637", "0.81811434", "0.81733793", "0.8168641", "0.81631595", "0.8142376", "0.81413543", "0.81373674", "0.8132111", "0.8121039", "0.81192917", "0.81183994", "0.81148887", "0.8100692", "0.8099167", "0.80941486", "0.8091956", "0.80918807", "0.8087707", "0.8082751", "0.8080731", "0.8079887", "0.8058024", "0.8056749", "0.804978", "0.8042976", "0.8042976", "0.8042117", "0.80349225", "0.8030751", "0.80280983", "0.8027233", "0.8026576", "0.8019814", "0.8016869", "0.8006943", "0.79864836", "0.7970827", "0.7967289", "0.7967218", "0.79653466", "0.79599696", "0.79538846", "0.7950897", "0.7949056", "0.79453284", "0.79385054", "0.79343796", "0.7931215", "0.7929307", "0.7928663", "0.7923688", "0.7920279", "0.7915929", "0.7912715", "0.7912116", "0.7909199", "0.79055685", "0.79030997", "0.7897972", "0.78904396", "0.7888898", "0.7883532" ]
0.78878164
99
why not make this easier to use? some more parameters?
protected function parse_dim($dimensions) { $fix = false; $crop = false; $vh = false; switch (substr($dimensions, -1)) { case '#': $crop = true; $dimensions = substr($dimensions, 0, (strlen($dimensions)-1)); break; case '!': $fix = true; $dimensions = substr($dimensions, 0, (strlen($dimensions)-1)); break; case '<': $vh = "h"; $dimensions = substr($dimensions, 0, (strlen($dimensions)-1)); break; case '>': $vh = "v"; $dimensions = substr($dimensions, 0, (strlen($dimensions)-1)); break; case '(': $crop = true; $vh = "h"; $dimensions = substr($dimensions, 0, (strlen($dimensions)-1)); break; case ')': $crop = true; $vh = "v"; $dimensions = substr($dimensions, 0, (strlen($dimensions)-1)); break; } $dim = explode("x", $dimensions); $width = (isset($dim[0]) && $dim[0] != '') ? $dim[0] : 0; $height = (isset($dim[1]) && $dim[1] != '') ? $dim[1] : 0; return array($width, $height, $fix, $crop, $vh); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function helper()\n\t{\n\t\n\t}", "private function _i() {\n }", "public function temporality();", "abstract protected function external();", "abstract protected function get_args();", "abstract protected function _process();", "abstract protected function _process();", "function process() ;", "function specialop() {\n\n\n\t}", "abstract protected function _prepare();", "public function parameters();", "public function parameters();", "public function andar()\n {\n }", "abstract function fromexp();", "function getParameters();", "function getParameters();", "abstract public static function args();", "abstract public function getParameters();", "function custom_construction() {\r\n\t\r\n\t\r\n\t}", "function ifUsed($x,$y){\n \n}", "final function velcom(){\n }", "function getParameters()\r\n {\r\n }", "private function j() {\n }", "private function __construct()\t{}", "abstract protected function data();", "function get_result($item)\n {\n }", "abstract protected function arguments(): array;", "abstract public function processParameters ($params);", "private function method1()\n\t{\n\t}", "function __construct() ;", "abstract protected function _run();", "abstract protected function _run();", "private function method2()\n\t{\n\t}", "function new_parameters() {\r\n\r\n }", "protected function _refine() {\n\n\t}", "public function boleta()\n\t{\n\t\t//\n\t}", "private function _optimize() {}", "abstract protected function faireDuSport();", "function PrimaryReturn($otype){\r\n}", "function get_results($args)\n {\n }", "function get_results($args)\n {\n }", "public function nadar()\n {\n }", "function params(array $data);", "private function static_things()\n\t{\n\n\t\t# code...\n\t}", "protected function test9() {\n\n }", "abstract protected function process();", "abstract protected function process();", "abstract protected function process();", "abstract protected function process();", "public function AggiornaPrezzi(){\n\t}", "abstract protected function mini(): string;", "function getParams() {\n global $id;\n global $file;\n global $teg;\n global $mode;\n global $view_mode;\n global $edit_mode;\n global $tab;\n\n\n if (isset($id)) {\n $this->id=$id;\n }\n if (isset($mode)) {\n $this->mode=$mode;\n }\n if (isset($view_mode)) {\n $this->view_mode=$view_mode;\n }\n if (isset($edit_mode)) {\n $this->edit_mode=$edit_mode;\n }\n if (isset($tab)) {\n $this->tab=$tab;\n }\n\n}", "function getParams($passAry,$base){\r\n\t\t$getName=$passAry['param_1'];\r\n\t\t$workAry=$base->utlObj->retrieveValue($getName,&$base);\r\n\t\tif ($workAry != null){\r\n\t\t\tforeach ($workAry as $paramName=>$paramValue){\r\n\t\t\t\t$base->paramsAry[$paramName]=$paramValue;\r\n\t\t\t}\r\n\t\t}\r\n\t}", "static function h($stuff=''){\r\n self::ps();\r\n self::p($stuff);\r\n self::ps();\r\n }", "public function custom()\n\t{\n\t}", "public function func_search() {}", "function a() {\n\t\t$args = func_get_args();\n\t\treturn $args;\n\t}", "function State_4($parameters) \n\t{\n\t}", "function param($p, $def=\"\") {\n\t//global $_SERVER, $_SESSION, $_COOKIE, $_REQUEST, $_POST, $_GET;\n\tif (!empty($_SESSION)&&isset($_SESSION[$p])) return $_SESSION[$p];\n\telse if (isset($_COOKIE[$p])) return $_COOKIE[$p];\n\telse if (isset($_REQUEST[$p])) return $_REQUEST[$p];\n\telse if (isset($_POST[$p])) return $_POST[$p];\n\telse if (isset($_GET[$p])) return $_GET[$p];\n\telse return $def;\n}", "abstract public function run(&$params);", "abstract protected function _preProcess();", "function _prepare() {}", "function spl_sq(&$itme,$key,$val){\r\n }", "function getParams() {\n global $id;\n global $mode;\n global $view_mode;\n global $edit_mode;\n global $tab;\n if (isset($id)) {\n $this->id=$id;\n }\n if (isset($mode)) {\n $this->mode=$mode;\n }\n if (isset($view_mode)) {\n $this->view_mode=$view_mode;\n }\n if (isset($edit_mode)) {\n $this->edit_mode=$edit_mode;\n }\n if (isset($tab)) {\n $this->tab=$tab;\n }\n\n\n\n}", "function ola(){\n\n$argumentos = func_get_args();// recupera todos os argumentos da variavel que é um array \nreturn $argumentos;\n}", "function setup_get($matches = array())\n {\n }", "public function masodik()\n {\n }", "abstract protected function doPairs();", "function test22($arg1, $arg2, $arg3, $arg4, $arg5, $arg6) {\n}", "private function parse_params($params)\n {\n }", "function getParams()\n {\n }", "abstract protected function placeholders(): array;", "public function pasaje_abonado();", "function build_query($data)\n {\n }", "public function serch()\n {\n }", "public function operations();", "function generate() ;", "public function passes();", "function _vin_arguments($vin = 'array'){\n $vin_arguments = array();\n $vin_arguments['kL1TD5DE2BB119431'] = \"2011 Chevrolet Aveo\";\n $vin_arguments['5gAEV23778J206256'] = \"2008 Buick Enclave\";\n $vin_arguments['JTDBL40E99J044394'] = \"2009 Toyota Corolla LE\";\n $vin_arguments['5TDBT44A73S145029'] = \"2003 Toyota Sequoia\";\n $vin_arguments['1G1RA6E48FU138415'] = \"2015 Chevrolet Volt\";\n $vin_arguments['JTDKN3DU5F1971796'] = \"2015 Toyota Prius Three\";\n $vin_arguments['1FdWE35P55HA46480'] = \"EXCEPTION: 2005 Ford E-350 Super Duty Van\";\n $vin_arguments['5LAxD94p70LA2372'] = \"INVALID: 16 Characters\";\n $vin_arguments['5IAoO94Q70qq2372'] = \"INVALID: 16 Characters 6 of I-O-Q\";\n $vin_arguments['5IAoO94Q70qq23:2'] = \"INVALID: 16 Characters 6 of I-O-Q and colon\";\n $vin_arguments['5LAXd94p70LO23721'] = \"VALID: But Made Up\";\n\n switch ($vin) {\n case 'array':\n return $vin_arguments;\n break;\n case 'string':\n $correct_args = array_keys($vin_arguments);\n $correct_args_count = count($correct_args);\n $first_args = $correct_args;\n $last_arg = '\"' . array_pop($first_args) . '\"';\n $first_args_list = implode(\",\", $first_args);\n $first_args_list = '\"' . str_replace(\",\", '\", \"', $first_args_list) . '\"';\n $zero = 'Please ask for assistance, there are currently no php_coder examples in use';\n $non_zero = 'Please select';\n $grammar = $correct_args_count > 2?' among ':': ';\n $grammar = $correct_args_count == 2?' between ':$grammar;\n $list = '';\n $list = $correct_args_count == 1?$last_arg:$list;\n $list = $correct_args_count > 1?$first_args_list. ' and ' . $last_arg:$list;\n if ($correct_args_count == 0) {\n $string = $zero;\n }else{\n $string = $non_zero . $grammar . $list . '. (Or supply no example and select from prompted values.)';\n }\n return $string;\n break;\n\n default:\n return $vin_arguments;\n #\\_ OOAAOC notwithstanding default $which, this is its raison detre\n break;\n }\n return; //OOAAOC\n}", "function getParams() {\n global $id;\n global $mode;\n global $view_mode;\n global $edit_mode;\n global $data_source;\n global $tab;\n if (isset($id)) {\n $this->id=$id;\n }\n if (isset($mode)) {\n $this->mode=$mode;\n }\n if (isset($view_mode)) {\n $this->view_mode=$view_mode;\n }\n if (isset($edit_mode)) {\n $this->edit_mode=$edit_mode;\n }\n if (isset($data_source)) {\n $this->data_source=$data_source;\n }\n if (isset($tab)) {\n $this->tab=$tab;\n }\n}", "function getParams() {\n global $id;\n global $mode;\n global $view_mode;\n global $edit_mode;\n global $data_source;\n global $tab;\n if (isset($id)) {\n $this->id=$id;\n }\n if (isset($mode)) {\n $this->mode=$mode;\n }\n if (isset($view_mode)) {\n $this->view_mode=$view_mode;\n }\n if (isset($edit_mode)) {\n $this->edit_mode=$edit_mode;\n }\n if (isset($data_source)) {\n $this->data_source=$data_source;\n }\n if (isset($tab)) {\n $this->tab=$tab;\n }\n}", "function getParams() {\n global $id;\n global $mode;\n global $view_mode;\n global $edit_mode;\n global $data_source;\n global $tab;\n if (isset($id)) {\n $this->id=$id;\n }\n if (isset($mode)) {\n $this->mode=$mode;\n }\n if (isset($view_mode)) {\n $this->view_mode=$view_mode;\n }\n if (isset($edit_mode)) {\n $this->edit_mode=$edit_mode;\n }\n if (isset($data_source)) {\n $this->data_source=$data_source;\n }\n if (isset($tab)) {\n $this->tab=$tab;\n }\n}", "function getParams() {\n global $id;\n global $mode;\n global $view_mode;\n global $edit_mode;\n global $data_source;\n global $tab;\n if (isset($id)) {\n $this->id=$id;\n }\n if (isset($mode)) {\n $this->mode=$mode;\n }\n if (isset($view_mode)) {\n $this->view_mode=$view_mode;\n }\n if (isset($edit_mode)) {\n $this->edit_mode=$edit_mode;\n }\n if (isset($data_source)) {\n $this->data_source=$data_source;\n }\n if (isset($tab)) {\n $this->tab=$tab;\n }\n}", "function moment_of_resistance($E, &$designParameter, &$designParameterRes)\n{\n\n// You may assign relavent names to input parameters\n\n$b = $designParameter[0] ;\n$d = $designParameter[1] ;\n\n// Perform alculations to find results / values of output parameters\n$Area = $b * $d ;\n$Peri = 2 * ( $b + $d ) ;\n\n// Put output parameters in array in sequence / order.\n$designParameterRes[] = $Area ; \n$designParameterRes[] = $Peri ;\n// $designParameterRes[] = $otheParameters ; // other parameters ...\n \n}", "private function aFunc()\n {\n }", "function _construct() {\n \t\n\t\t\n\t}", "function system_mod_user($paramvect)\n{\n\n}", "function fix() ;", "final private function __construct(){\r\r\n\t}", "abstract protected function update ();", "abstract public function getPasiekimai();", "public function access();", "abstract function check();", "private function extract_params($params)\r\n {\r\n if(isset($params->id))\r\n {\r\n $this->id = $params->id;\r\n } \r\n $this->grade = $params->grade;\r\n $this->ucaspoints = $params->ucaspoints;\r\n $this->bcgttargetqualid = $params->bcgttargetqualid;\r\n $this->upperscore = $params->upperscore;\r\n $this->lowerscore = $params->lowerscore;\r\n $this->ranking = $params->ranking;\r\n }", "function handle(&$params) {\n }", "public function GetMatchedParams ();", "public function getParameters()\n\t{\n\n\t}", "public function getParameters()\n\t{\n\n\t}", "function isValid() ;", "public function acp();", "public function extra_voor_verp()\n\t{\n\t}" ]
[ "0.5729864", "0.5333882", "0.52060205", "0.51564467", "0.51421", "0.5127276", "0.5127276", "0.5118297", "0.5102545", "0.5042685", "0.501365", "0.501365", "0.50058377", "0.49930936", "0.49890062", "0.49890062", "0.49881274", "0.49831456", "0.49779263", "0.49712408", "0.49665377", "0.49533212", "0.49462134", "0.49401736", "0.49373916", "0.49153858", "0.49133435", "0.4912996", "0.49084052", "0.4905873", "0.488748", "0.488748", "0.48860916", "0.48832443", "0.48722625", "0.48671818", "0.48630196", "0.48448786", "0.4842162", "0.48388436", "0.48388436", "0.48380366", "0.4831572", "0.48300546", "0.48293507", "0.48268", "0.48268", "0.48268", "0.48268", "0.48257905", "0.48251182", "0.4825019", "0.4821088", "0.48186016", "0.4811698", "0.48074797", "0.48059335", "0.4800554", "0.47990862", "0.47968704", "0.47951835", "0.47919303", "0.47894436", "0.47871923", "0.47821045", "0.478172", "0.47537708", "0.47529438", "0.4751166", "0.47500223", "0.47471273", "0.474668", "0.4746678", "0.47436672", "0.4738332", "0.47366253", "0.47351298", "0.4726684", "0.47181976", "0.4717024", "0.4717024", "0.4717024", "0.4717024", "0.47167522", "0.47138608", "0.47100344", "0.47077388", "0.47049877", "0.47047177", "0.47044995", "0.46991113", "0.4698272", "0.4692659", "0.46902528", "0.46882084", "0.46859637", "0.46846274", "0.46846274", "0.46752173", "0.46719503", "0.46616992" ]
0.0
-1
Loads information about the image. Will throw an exception if the image does not exist or is not an image.
public function __construct($file) { try { // Get the real path to the file $file = realpath($file); // Get the image information $info = getimagesize($file); } catch (Exception $e) { // Ignore all errors while reading the image } if (empty($file) OR empty($info)) { // throw new Exception('Not an image or invalid image: :file', // array(':file' => Kohana::debug_path($file))); return ''; } // Store the image information $this->file = $file; $this->width = $info[0]; $this->height = $info[1]; $this->type = $info[2]; $this->mime = image_type_to_mime_type($this->type); // Set the image creation function name switch ($this->type) { case IMAGETYPE_JPEG: $create = 'imagecreatefromjpeg'; break; case IMAGETYPE_GIF: $create = 'imagecreatefromgif'; break; case IMAGETYPE_PNG: $create = 'imagecreatefrompng'; break; } if ( ! isset($create) OR ! function_exists($create)) { // throw new Exception('Installed GD does not support :type images', // array(':type' => image_type_to_extension($this->type, FALSE))); } // Save function for future use $this->_create_function = $create; // Save filename for lazy loading $this->_image = $this->file; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadImage()\n\t{\n\t\tswitch ($this->type) {\n\t\t\tcase 1:\n\t\t\t\t$this->ImageStream = @imagecreatefromgif($this->sFileLocation);\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\t$this->ImageStream = @imagecreatefromjpeg($this->sFileLocation);\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\t$this->ImageStream = @imagecreatefrompng($this->sFileLocation);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t$this->printError('invalid imagetype');\n\t\t}\n\n\t\tif (!$this->ImageStream) {\n\t\t\t$this->printError('image not loaded');\n\t\t}\n\t}", "public function Information()\n {\n $this->imgInfo = list($width, $height, $type, $attr) = getimagesize($this->pathToImage);\n !empty($this->imgInfo) or self::errorMessage(\"The file doesn't seem to be an image.\");\n $mime = $this->imgInfo['mime'];\n\n if($this->verbose) {\n $this->imgInfo['filesize'] = $filesize = filesize($this->pathToImage);\n self::verbose(\"Image file: {$this->pathToImage}\");\n self::verbose(\"Image information: \" . print_r($this->imgInfo, true));\n self::verbose(\"Image width x height (type): {$width} x {$height} ({$type}).\");\n self::verbose(\"Image file size: {$filesize} bytes.\");\n self::verbose(\"Image mime type: {$mime}.\");\n }\n }", "public function getImageDetails($image) {\r\n\r\n$temp = getimagesize($this->src);\r\nif(null == $temp)\r\nthrow new Exception('Error while extracting the source image information');\r\n\r\n$this->width = $temp[0];\r\n$this->height = $temp[1];\r\n$this->type = $temp[2];\r\n}", "protected function loadImageResource()\n {\n if(empty($this->resource))\n {\n if(($this->worker === NULL || $this->worker === $this::WORKER_IMAGICK) && self::imagickAvailable())\n {\n $this->resource = $this->createImagick($this->image);\n }\n elseif(($this->worker === NULL || $this->worker === $this::WORKER_GD) && self::gdAvailable())\n {\n $this->resource = $this->getGdResource($this->image);\n }\n else\n {\n throw new Exception('Required extensions missing, extension GD or Imagick is required');\n }\n }\n }", "public function load_image()\n\t{\n if (file_exists($this->local_file)) {\n $image_size = $this->image_size();\n if (preg_match('/jpeg/', $image_size['mime'])) {\n $file = imagecreatefromjpeg($this->local_file);\n } elseif (preg_match('/gif/', $image_size['mime'])) {\n $file = imagecreatefromgif($this->local_file);\n } elseif (preg_match('/png/', $image_size['mime'])) {\n $file = imagecreatefrompng($this->local_file);\n } else {\n \t$file = null;\n }\n return $file;\n }\n\t}", "protected function _load_image()\n {\n if ( ! is_resource($this->_image))\n {\n // Gets create function\n $create = $this->_create_function;\n\n // Open the temporary image\n $this->_image = $create($this->file);\n\n // Preserve transparency when saving\n imagesavealpha($this->_image, TRUE);\n }\n }", "public function load()\n\t{\n\t\tif (!$this->isValidImage()) {\n\t\t\treturn false;\n\t\t}\n\n\t\t$this->image = new SimpleImage();\n\n\t\t$this->image->fromFile($this->source_path);\n\n\t\treturn true;\n\t}", "protected function loadMetaInformation()\n {\n try {\n $logger = new Logger('exiftool');\n $reader = BookReader::create($logger);\n $metadataBag = $reader->files($this->file->getRealPath())->first();\n foreach ($metadataBag as $meta) {\n $tagName = $meta->getTag()->getName();\n if (0 === strcasecmp($tagName, 'MIMEType')) {\n $this->mime = $meta->getValue()->asString();\n }\n if (0 === strcasecmp($tagName, 'FileType')) {\n $this->ext = strtolower($meta->getValue()->asString());\n }\n if ($this->ext && $this->mime) {\n break;\n }\n }\n } catch (\\Exception $e) {\n $logger->addNotice($e->getMessage());\n }\n finally {\n $this->mime = empty($this->mime) ? $this->file->getMimeType() : $this->mime;\n $this->ext = empty($this->ext) ? $this->file->guessExtension(): $this->ext;\n }\n }", "public function getImage() {}", "private function loadFileInfo()\n\t{\n\t\t$this->loadBasicData();\n\t\tswitch ($this->data['mimetypeType']) \n\t\t{\n\n\t\t\tcase 'image':\n\t\t\t\tlist($this->data['width'], $this->data['height']) = getimagesize ( $this->filepath );\n\t\t\t\t$this->data['resolution'] = $this->data['width'].'x'.$this->data['height'];\n\n\t\t\t\tswitch ($this->data['mimetype']) \n\t\t\t\t{\n\t\t\t\t\tcase 'image/jpeg':\n\t\t\t\t\tcase 'image/pjpeg':\n\t\t\t\t\tcase 'image/tiff':\n\t\t\t\t\tcase 'image/x-tiff':\n\n\t\t\t\t\t\t$this->loadExfiData();\n\t\t\t\t\t\t$this->loadIPTCKeywords();\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'image/png':\n\t\t\t\t\tcase 'image/jp2':\n\t\t\t\t\tcase 'image/jpx':\n\t\t\t\t\tcase 'image/jpm':\n\t\t\t\t\tcase 'image/mj2':\n\t\t\t\t\t\t$this->loadIPTCKeywords();\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t# code...\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t\n\t\t\tdefault:\n\t\t\t\t# code...\n\t\t\t\tbreak;\n\t\t}\n\t}", "function loadImage($image_data) {\n\t\tif (empty($image_data['name']) && empty($image_data['tmp_name'])) {\n\t\t\treturn '';\n\t\t}\n\t\t\n\t\t$file_name = $this->image_path . DS . $image_data['name'];\n\t\t$file_name_arr = explode('.', $file_name);\n\t\t$file_name_ext = $file_name_arr[count($file_name_arr)-1];\n\t\tunset($file_name_arr[count($file_name_arr)-1]);\n\t\t$file_name_prefix = implode('.' , $file_name_arr);\n\t\t$counter = '';\n\t\t$file_name = $file_name_prefix . $counter . '.' . $file_name_ext;\n\t\t$i = 1;\n\t\twhile (file_exists($file_name)) {\n\t\t\t$counter = '_' . $i;\n\t\t\t$file_name = $file_name_prefix . $counter . '.' . $file_name_ext;\n\t\t\t$i++;\n\t\t}\n\n\t\t$tmp_name = $image_data['tmp_name'];\n\t\t$width = 88;\n\t\t$height = 88;\n\t\t\n\t\t// zmenim velikost obrazku\n\t\tApp::import('Model', 'Image');\n\t\t$this->Image = new Image;\n\t\t\n\t\t\n\t\tif (file_exists($tmp_name)) {\n\t\t\tif ($this->Image->resize($tmp_name, $file_name, $width, $height)) {\n\t\t\t\t$file_name = str_replace($this->image_path . DS, '', $file_name);\n\t\t\t\treturn $file_name;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "public function load()\n {\n $size = @getimagesize($this->file);\n if (!$size) {\n throw new \\Exception(sprintf('Could not read image size of the file #%s', $this->file));\n }\n $this->type = $size[2];\n if (!is_file($this->file) && !preg_match('|^https?:#|', $this->file)) {\n throw new \\Exception(sprintf('File #%s doesn&#8217;t exist?', $this->file));\n }\n $this->image = @imagecreatefromstring(file_get_contents($this->file));\n if (!is_resource($this->image)) {\n throw new \\Exception(sprintf('File #%s is not an image.', $this->file));\n }\n $this->updateSize($size[0], $size[1]);\n $this->mime_type = $size['mime'];\n\n return $this;\n }", "protected function readImage(): void\n {\n // set default path\n $path = $this->pathFile;\n\n // handle caching\n if (!empty($this->pathCache)) {\n // write / refresh cache file if necessary\n if (!$this->isCached()) {\n $this->writeCache();\n }\n\n // replace path if file is cached\n if ($this->isCached()) {\n $path = $this->pathCache;\n }\n }\n\n // get image information\n $read = @getimagesize($path);\n if (false === $read) {\n throw new \\RuntimeException(\n sprintf(\n \"Couldn't read image at %s\",\n $path\n )\n );\n }\n\n // detect image type\n switch ($read[2]) {\n case IMAGETYPE_GIF:\n $this->image = @imagecreatefromgif($path);\n\n break;\n\n case IMAGETYPE_JPEG:\n $this->image = @imagecreatefromjpeg($path);\n\n break;\n\n case IMAGETYPE_PNG:\n $this->image = @imagecreatefrompng($path);\n\n break;\n\n default:\n // image type not supported\n throw new \\UnexpectedValueException(\n sprintf(\n 'Image type %s not supported',\n image_type_to_mime_type($read[2])\n )\n );\n }\n\n if (false === $this->image) {\n throw new \\RuntimeException(\n sprintf(\n \"Couldn't read image at %s\",\n $path\n )\n );\n }\n\n // set image dimensions\n $this->width = $read[0];\n $this->height = $read[1];\n\n // set mime type\n $this->mimeType = $read['mime'];\n\n // set modified date\n $this->modified = @filemtime($path);\n }", "function load_image( $filename = '' )\n\t{\n\t\tif( !is_file( $filename ) )\n\t\t\tthrow new Exception( 'Image Class: could not find image \\''.$filename.'\\'.' );\n\t\t\t\t\t\t\t\t\n\t\t$ext = $this->get_ext( $filename );\n\t\t\n\t\tswitch( $ext )\n\t\t{\n\t\t\tcase 'jpeg':\n\t\t\tcase 'jpg':\n\t\t\t\t$this->im = imagecreatefromjpeg( $filename );\n\t\t\t\tbreak;\n\t\t\tcase 'gif':\n\t\t\t\t$this->im = imagecreatefromgif( $filename );\n\t\t\t\tbreak;\n\t\t\tcase 'png':\n\t\t\t\t$this->im = imagecreatefrompng( $filename );\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new Exception( 'Image Class: An unsupported file format was supplied \\''. $ext . '\\'.' );\n\t\t}\n\t\t\n\t\treturn TRUE;\n\t}", "public function _get_img_info()\n {\n if ( ! file_exists($this->source_file) || ! filesize($this->source_file)) {\n return false;\n }\n list($this->source_width, $this->source_height, $type, $this->source_atts) = getimagesize($this->source_file);\n return isset($this->_avail_types[$type]) ? ($this->source_type = $this->_avail_types[$type]) : false;\n }", "public function getImage();", "public function getImage();", "public function getImage();", "public function getImage();", "private function _getImageInfo($image)\n {\n return getimagesize($image); // This function doesn't only return the image size but some essential information as well.\n }", "function loadFile ($image) {\r\n if ( !$dims=@GetImageSize($image) ) {\r\n trigger_error('Could not find image '.$image);\r\n return false;\r\n }\r\n if ( in_array($dims['mime'],$this->types) ) {\r\n $loader=$this->imgLoaders[$dims['mime']];\r\n $this->source=$loader($image);\r\n $this->sourceWidth=$dims[0];\r\n $this->sourceHeight=$dims[1];\r\n $this->sourceMime=$dims['mime'];\r\n $this->initThumb();\r\n return true;\r\n } else {\r\n trigger_error('Image MIME type '.$dims['mime'].' not supported');\r\n return false;\r\n }\r\n }", "function metaInit () {\n $this->imageMeta = new ImageMeta($this->getImagePath());\n $this->imageMeta->getMeta();\n }", "protected function loadImages() {\r\n $this->images = new \\App\\Table\\ImagesTable(App::getInstance()->getDb());\r\n }", "protected function loadImage()\n {\n if (!is_resource($this->tmpImage)) {\n $create = $this->createFunctionName;\n $this->tmpImage = $create($this->filePath);\n imagesavealpha($this->tmpImage, true);\n }\n }", "private function lazyLoad(): void\n\t{\n\t\tif (empty($this->_resource)) {\n\t\t\tif ($this->_cache && !$this->isCacheExpired()) {\n\t\t\t\t$this->_cacheSkip = true;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t$resource = $this->getImageResource($this->_imagePath, $this->_extension);\n\t\t\t$this->_resource = $resource;\n\t\t}\n\t}", "protected function fetchIntroImage(){\n $this->imageIntro = $this->getImageTypeFromImages('intro');\n }", "function get()\r\n\t{\r\n\t\t// Get the properties from the URI\r\n\t\t$default = array('file','width','height','crop','quality','nocache');\r\n\t\t$uri_array = $this->uri->uri_to_assoc(3, $default);\r\n\r\n\t\tif( $uri_array['file'] == NULL)\r\n\t\t{\r\n\t\t\t// Don't continue\r\n\t\t\tlog_message(\"error\",\"BackendPro->Image->get : Badly formed image request string: \" . $this->uri->uri_string());\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Try to find the image\r\n\t\tforeach($this->config->item('image_folders') as $folder)\r\n\t\t{\r\n\t\t\tif ( file_exists($folder.$uri_array['file']))\r\n\t\t\t{\r\n\t\t\t\t$this->img_path = $folder.$uri_array['file'];\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Image couldn't be found\r\n\t\tif ($this->img_path == NULL)\r\n\t\t{\r\n\t\t\tlog_message(\"error\",\"BackendPro->Image->get : Image dosn't exisit: \" . $uri_array['file']);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Get the size and MIME type of the requested image\r\n\t\t$size = GetImageSize($this->img_path);\r\n\t\t$width = $size[0];\r\n\t\t$height = $size[1];\r\n\r\n\t\t// Make sure that the requested file is actually an image\r\n\t\tif (substr($size['mime'], 0, 6) != 'image/')\r\n\t\t{\r\n\t\t\tlog_message(\"error\",\"BackendPro->Image->get : Requested file is not an accepted type: \" . $this->img_path);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Before we start to check for caches and alike, lets just see if the image\r\n\t\t// was requested with no changes, if so just return the normal image\r\n\t\tif( $uri_array['width'] == NULL AND $uri_array['height'] == NULL AND $uri_array['watermark'] == NULL AND $uri_array['crop'] == NULL AND $uri_array['quality'] == NULL)\r\n\t\t{\r\n\t\t\t$data\t= file_get_contents($this->img_path);\r\n\t\t\theader(\"Content-type:\". $size['mime']);\r\n\t\t\theader('Content-Length: ' . strlen($data));\r\n\t\t\tprint $data;\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// We know we have to do something, so before we do lets see if there is\r\n\t\t// cache of the image already\r\n\t\tif( $uri_array['nocache'] == NULL)\r\n\t\t{\r\n\t\t\t// TODO: This should check to see if the image has changed since the last cache?\r\n\t\t\t$image_cache_string = $this->img_path . \" - \" . $uri_array['width'] . \"x\" . $uri_array['height'];\r\n\t\t\t$image_cache_string.= \"x\" . $uri_array['crop'] . \"x\" . $uri_array['quality'];\r\n\t\t\t$image_cache_string = md5($image_cache_string);\r\n\r\n\t\t\tif (file_exists($this->cache.$image_cache_string))\r\n\t\t\t{\r\n\t\t\t\t// Yes a cached image exists\r\n\t\t\t\t$data\t= file_get_contents($this->cache.$image_cache_string);\r\n\r\n\t\t\t\t// Before we output the image, does the local cache have the image?\r\n\t\t\t\t$this->_ConditionalGet($data);\r\n\r\n\t\t\t\theader(\"Content-type: \". $size['mime']);\r\n\t\t\t\theader('Content-Length: ' . strlen($data));\r\n\t\t\t\tprint $data;\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// CROP IMAGE\r\n\t\t$offsetX = 0;\r\n\t\t$offsetY = 0;\r\n\t\tif( $uri_array['crop'] != NULL)\r\n\t\t{\r\n\t\t\t$crop = explode(':',$uri_array['crop']);\r\n\t\t\tif(count($crop) == 2)\r\n\t\t\t{\r\n\t\t\t\t$actualRatio = $width / $height;\r\n\t\t\t\t$requestedRatio = $crop[0] / $crop[1];\r\n\r\n\t\t\t\tif ($actualRatio < $requestedRatio)\r\n\t\t\t\t{ \t// Image is too tall so we will crop the top and bottom\r\n\t\t\t\t\t$origHeight\t= $height;\r\n\t\t\t\t\t$height\t\t= $width / $requestedRatio;\r\n\t\t\t\t\t$offsetY\t= ($origHeight - $height) / 2;\r\n\t\t\t\t}\r\n\t\t\t\telse if ($actualRatio > $requestedRatio)\r\n\t\t\t\t{ \t// Image is too wide so we will crop off the left and right sides\r\n\t\t\t\t\t$origWidth\t= $width;\r\n\t\t\t\t\t$width\t\t= $height * $requestedRatio;\r\n\t\t\t\t\t$offsetX\t= ($origWidth - $width) / 2;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// RESIZE\r\n\t\t$ratio = $width / $height;\r\n\t\t$new_width = $width;\r\n\t\t$new_height = $height;\r\n\t\tif( $uri_array['width'] != NULL AND $uri_array['height'] != NULL)\r\n\t\t{\r\n\t\t\t// Resize image to fit into both dimensions\r\n\t\t\t$new_ratio = $uri_array['width'] / $uri_array['height'];\r\n\t\t\tif($ratio > $new_ratio)\r\n\t\t\t{\r\n\t\t\t\t// Height is larger\r\n\t\t\t\t$uri_array['height'] = NULL;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t// Width is larger\r\n\t\t\t\t$uri_array['width'] = NULL;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif ( $uri_array['width'] == NULL AND $uri_array['height'] != NULL)\r\n\t\t{\t// Keep height ratio\r\n\t\t\t$new_height = $uri_array['height'];\r\n\t\t\t$new_width = $new_height * $ratio;\r\n\t\t}\r\n\t\telse if ( $uri_array['width'] != NULL AND $uri_array['height'] == NULL)\r\n\t\t{\t// Keep width ratio\r\n\t\t\t$new_width = $uri_array['width'];\r\n\t\t\t$new_height = $new_width / $ratio;\r\n\t\t}\r\n\r\n\t\t// QUALITY\r\n\t\t$quality = ($uri_array['quality'] != NULL) ? $uri_array['quality'] : $this->config->item('image_default_quality');\r\n\r\n\t\t$dst_image = imagecreatetruecolor($new_width, $new_height);\r\n\t\t$src_image = imagecreatefromjpeg($this->img_path);\r\n\t\timagecopyresampled($dst_image,$src_image,0, 0, $offsetX, $offsetY, $new_width, $new_height, $width, $height );\r\n\r\n\t\t// SAVE CACHE\r\n\t\tif( $uri_array['nocache'] == NULL)\r\n\t\t{\r\n\t\t\t// Make sure Cache dir is writable\r\n\t\t\t// INFO: This may be the source of the images sometimes not showing, seems some of the cache files can't be found\r\n\t\t\t// INFO: Since we are running this on a linux server its fine but this could cause issues http://codeigniter.com/forums/viewthread/94359/\r\n\t\t\tif ( !is_really_writable($this->cache))\r\n\t\t\t//if( !is_writable($this->cache))\r\n\t\t\t{\r\n\t\t\t\tlog_message('error',\"BackendPro->Image->get : Cache folder isn't writable: \" . $this->cache);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t// Write image to cache\r\n\t\t\t\timagejpeg($dst_image,$this->cache.$image_cache_string,$quality);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\theader(\"Content-type:\". $size['mime']);\r\n\t\timagejpeg($dst_image,NULL,$quality);\r\n\t}", "public function testGetImage() {\n\n $image = $this->client->getObject(static::DCX_IMAGE_ID);\n\n $this->assertTrue($image instanceof Image);\n $this->assertSame(static::DCX_IMAGE_ID, $image->data()['id']);\n $this->assertSame('fotolia_160447209.jpg', $image->data()['filename']);\n $this->assertSame(TRUE, $image->data()['status']);\n }", "public function load($name = null)\n {\n $filename = null;\n if (null !== $name) {\n $filename = ((strpos($name, '[') !== false) && (strpos($name, ']') !== false)) ?\n substr($name, 0, strpos($name, '[')) : $name;\n $this->name = $name;\n }\n\n if ((null === $this->name) || ((null !== $filename) && !file_exists($filename))) {\n throw new Exception('Error: The image file has not been passed to the image adapter');\n }\n\n if (null !== $this->resource) {\n $this->resource->readImage($this->name);\n } else {\n $this->resource = new \\Imagick($this->name);\n }\n\n $this->width = $this->resource->getImageWidth();\n $this->height = $this->resource->getImageHeight();\n\n switch ($this->resource->getImageColorspace()) {\n case \\Imagick::COLORSPACE_GRAY:\n $this->colorspace = self::IMAGE_GRAY;\n break;\n case \\Imagick::COLORSPACE_RGB:\n case \\Imagick::COLORSPACE_SRGB:\n $this->colorspace = self::IMAGE_RGB;\n break;\n case \\Imagick::COLORSPACE_CMYK:\n $this->colorspace = self::IMAGE_CMYK;\n break;\n }\n\n $this->format = strtolower($this->resource->getImageFormat());\n if ($this->resource->getImageColors() < 256) {\n $this->indexed = true;\n }\n\n if ((strpos($this->format, 'jp') !== false) && function_exists('exif_read_data')) {\n $exif = @exif_read_data($this->name);\n if ($exif !== false) {\n $this->exif = $exif;\n }\n }\n\n return $this;\n }", "public function test_missing_image_file() {\n\t\t$out = wp_read_image_metadata( DIR_TESTDATA . '/images/404_image.png' );\n\t\t$this->assertFalse( $out );\n\t}", "public function getImage()\r\n {\r\n $imagePath = $this->root.'/'.$this->route;\r\n \r\n if (!self::isImage($this->route)) {\r\n throw new Exception('The route is not an image.');\r\n }\r\n if (!file_exists($this->root.'/'.$this->route)) {\r\n throw new Exception('The image '.$imagePath.' does not exists.');\r\n }\r\n \r\n return file_get_contents($imagePath);\r\n }", "function image_info($image)\n{\n // http://stackoverflow.com/a/2756441/1459873\n $is_path = preg_match('#^(\\w+/){1,2}\\w+\\.\\w+$#', $image);\n if ($is_path && false !== ($info = getimagesize($image))) {\n return array(\n 'width' => $info[0],\n 'height' => $info[1],\n 'mime' => $info['mime'],\n 'type' => 'file',\n );\n }\n $im = new \\Imagick();\n if ($im->readImageBlob($image)) {\n return array(\n 'width' => $im->getImageWidth(),\n 'height' => $im->getImageHeight(),\n 'mime' => $im->getImageMimeType(),\n 'type' => 'blob',\n );\n }\n return array('width' => 0, 'height' => 0, 'mime'=>'', 'type' => '');\n\n}", "function _load_image_file( $file ) {\n\t\t// Run a cheap check to verify that it is an image file.\n\t\tif ( false === ( $size = getimagesize( $file ) ) )\n\t\t\treturn false;\n\t\t\n\t\tif ( false === ( $file_data = file_get_contents( $file ) ) )\n\t\t\treturn false;\n\t\t\n\t\tif ( false === ( $im = imagecreatefromstring( $file_data ) ) )\n\t\t\treturn false;\n\t\t\n\t\tunset( $file_data );\n\t\t\n\t\t\n\t\treturn $im;\n\t}", "public function get($image)\n {\n return Image::findOrFail($image);\n }", "protected function _checkImage() {\n if ( !is_file ( $this->src ) ) {\n $this->src = $this->default_missing_image; \n }\n $image_path_parts = pathinfo ( $this->src );\n $this->_image_name = $image_path_parts['basename'];\n $this->_thumb_filename = $this->attributes['width'] . 'x' . $this->attributes['height'] . '_' . $this->_image_name;\n $this->_thumb_src = $this->thumbs_dir_path . $this->_thumb_filename;\n if ( is_readable ( $this->_thumb_src ) ) {\n $this->_calculated_width = $this->attributes['width'];\n $this->_calculated_height = $this->attributes['height'];\n $this->src = $this->_thumb_src;\n return 'no_thumb_required';\n }\n if ( !$this->_original_image_info = getimagesize ( $this->src ) ) {\n return 'abort';\n } \n if (!in_array ( $this->_original_image_info['mime'], $this->_valid_mime ) ) {\n return 'abort';\n }\n }", "function LoadImage($filename)\r\n {\r if (!($from_info = getimagesize($file)))\r\n return false;\r\n\r\n $from_type = $from_info[2];\r\n\r\n $new_img = Array(\r\n 'f' => $filename,\r\n 'w' => $from_info[0],\r\n 'h' => $from_info[1],\r\n );\r\n\r\n $id = false;\r\n if (($this->use_IM && false)\r\n || (($from_type == IMAGETYPE_GIF) && $this->GIF_IM && false))\r\n {\r $id = count($this->images)+1;\r\n $this->images[$id] = Array(0, $filename, 0, $new_img);\r\n }\r\n elseif ($img = $this->_gd_load($filename))\r\n {\r $id = count($this->images)+1;\r\n $this->images[$id] = Array(1, $filename, &$img, $new_img);\r\n }\r\n\r\n return $id;\r\n }", "function showImage()\n\t{\n\t\tif (!$this->ImageStream) {\n\t\t\t$this->printError('image not loaded');\n\t\t}\n\n\t\tswitch ($this->type) {\n\t\t\tcase 1:\n\t\t\t\timagegif($this->ImageStream);\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\timagejpeg($this->ImageStream);\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\timagepng($this->ImageStream);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t$this->printError('invalid imagetype');\n\t\t}\n\t}", "function loadImage($filename) {\n $image = false;\n $imageInfo = getimagesize($filename);\n $imageType = '';\n $imageType = $imageInfo[2];\n if( $imageType == IMAGETYPE_JPEG ) {\n $image = imagecreatefromjpeg($filename);\n } elseif( $imageType == IMAGETYPE_GIF ) {\n $image = imagecreatefromgif($filename);\n } elseif( $imageType == IMAGETYPE_PNG ) {\n $image = imagecreatefrompng($filename);\n }\n return $image ? array('image' => $image, 'imgType' => $imageType, 'imageInfo' => $imageInfo) : array();\n}", "public function getImageResource()\n {\n // Get existing resource\n if ($this->image) {\n return $this->image;\n }\n\n // Load container\n $assetContainer = $this->getAssetContainer();\n if (!$assetContainer) {\n return null;\n }\n\n // Avoid repeat load of broken images\n $hash = $assetContainer->getHash();\n $variant = $assetContainer->getVariant();\n if ($this->hasFailed($hash, $variant)) {\n return null;\n }\n\n // Validate stream is readable\n // Note: Mark failed regardless of whether a failed stream is exceptional or not\n $error = self::FAILED_MISSING;\n try {\n $stream = $assetContainer->getStream();\n if ($this->isStreamReadable($stream)) {\n $error = null;\n } else {\n return null;\n }\n } finally {\n if ($error) {\n $this->markFailed($hash, $variant, $error);\n }\n }\n\n // Handle resource\n $error = self::FAILED_UNKNOWN;\n try {\n // write the file to a local path so we can extract exif data if it exists.\n // Currently exif data can only be read from file paths and not streams\n $tempPath = $this->config()->get('local_temp_path') ?? TEMP_PATH;\n $path = tempnam($tempPath ?? '', 'interventionimage_');\n if ($extension = pathinfo($assetContainer->getFilename() ?? '', PATHINFO_EXTENSION)) {\n //tmpnam creates a file, we should clean it up if we are changing the path name\n unlink($path ?? '');\n $path .= \".\" . $extension;\n }\n $bytesWritten = file_put_contents($path ?? '', $stream);\n // if we fail to write, then load from stream\n if ($bytesWritten === false) {\n $resource = $this->getImageManager()->make($stream);\n } else {\n $this->setTempPath($path);\n $resource = $this->getImageManager()->make($path);\n }\n\n // Fix image orientation\n try {\n $resource->orientate();\n } catch (NotSupportedException $e) {\n // noop - we can't orientate, don't worry about it\n }\n\n $this->setImageResource($resource);\n $this->markSuccess($hash, $variant);\n $this->warmCache($hash, $variant);\n $error = null;\n return $resource;\n } catch (NotReadableException $ex) {\n // Handle unsupported image encoding on load (will be marked as failed)\n // Unsupported exceptions are handled without being raised as exceptions\n $error = self::FAILED_INVALID;\n } finally {\n if ($error) {\n $this->markFailed($hash, $variant, $error);\n }\n }\n return null;\n }", "function load($filename)\n {\n $image_info = getimagesize($filename);\n $this->image_type = $image_info[2];\n //crea la imagen JPEG.\n if( $this->image_type == IMAGETYPE_JPEG ) \n {\n $this->image = imagecreatefromjpeg($filename);\n } \n //crea la imagen GIF.\n elseif( $this->image_type == IMAGETYPE_GIF ) \n {\n $this->image = imagecreatefromgif($filename);\n } \n //Crea la imagen PNG\n elseif( $this->image_type == IMAGETYPE_PNG ) \n {\n $this->image = imagecreatefrompng($filename);\n }\n }", "protected function processImage() {}", "public function deserialize($param)\n {\n if ($param === null) {\n return;\n }\n if (array_key_exists(\"ImageId\",$param) and $param[\"ImageId\"] !== null) {\n $this->ImageId = $param[\"ImageId\"];\n }\n\n if (array_key_exists(\"ImageName\",$param) and $param[\"ImageName\"] !== null) {\n $this->ImageName = $param[\"ImageName\"];\n }\n\n if (array_key_exists(\"ImageOsName\",$param) and $param[\"ImageOsName\"] !== null) {\n $this->ImageOsName = $param[\"ImageOsName\"];\n }\n\n if (array_key_exists(\"ImageDescription\",$param) and $param[\"ImageDescription\"] !== null) {\n $this->ImageDescription = $param[\"ImageDescription\"];\n }\n\n if (array_key_exists(\"Region\",$param) and $param[\"Region\"] !== null) {\n $this->Region = $param[\"Region\"];\n }\n\n if (array_key_exists(\"RegionID\",$param) and $param[\"RegionID\"] !== null) {\n $this->RegionID = $param[\"RegionID\"];\n }\n\n if (array_key_exists(\"RegionName\",$param) and $param[\"RegionName\"] !== null) {\n $this->RegionName = $param[\"RegionName\"];\n }\n\n if (array_key_exists(\"InstanceName\",$param) and $param[\"InstanceName\"] !== null) {\n $this->InstanceName = $param[\"InstanceName\"];\n }\n\n if (array_key_exists(\"InstanceId\",$param) and $param[\"InstanceId\"] !== null) {\n $this->InstanceId = $param[\"InstanceId\"];\n }\n\n if (array_key_exists(\"ImageType\",$param) and $param[\"ImageType\"] !== null) {\n $this->ImageType = $param[\"ImageType\"];\n }\n }", "function culturefeed_entry_ui_collaboration_get_image_from_url($image) {\n\n // See if the image is stored on the local url.\n $base_path = $GLOBALS['base_url'] . '/' . variable_get('file_public_path', conf_path() . '/files') . '/';\n $parts = explode($base_path, $image);\n if (count($parts) == 2 && $parts[1]) {\n\n $files = entity_load('file', FALSE, array('uri' => 'public://' . $parts[1]));\n if (!empty($files)) {\n return reset($files);\n }\n\n }\n\n}", "private function loadImages(): void\n {\n if (count($this->images) == 1) {\n $this->addMeta('image', $this->images[0]);\n\n return;\n }\n\n foreach ($this->images as $number => $url) {\n $this->addMeta(\"image{$number}\", $url);\n }\n }", "public function getImage($name)\n\t{\n\t\t//Todo: Implement.\n\t}", "protected function fetchImage() {\n return null;\n }", "function wp_read_image_metadata($file)\n {\n }", "function getImagePathInfo() \n { \n return $this->_imagePathInfo; \n }", "public static function load($image)\n {\n if (!is_file($image) || !is_readable($image)) {\n throw new JIT\\JITImageNotFound(\n sprintf('Error loading image <code>%s</code>. Check it exists and is readable.', \\General::sanitize(str_replace(DOCROOT, '', $image)))\n );\n }\n\n $meta = self::getMetaInformation($image);\n\n switch ($meta->type) {\n // GIF\n case IMAGETYPE_GIF:\n $resource = imagecreatefromgif($image);\n break;\n\n // JPEG\n case IMAGETYPE_JPEG:\n // GD 2.0.22 supports basic CMYK to RGB conversion.\n // RE: https://github.com/symphonycms/jit_image_manipulation/issues/47\n $gdSupportsCMYK = version_compare(GD_VERSION, '2.0.22', '>=');\n\n // Can't handle CMYK JPEG files\n if ($meta->channels > 3 && $gdSupportsCMYK === false) {\n throw new JIT\\JITException('Cannot load CMYK JPG images');\n\n // Can handle CMYK, or image has less than 3 channels.\n } else {\n $resource = imagecreatefromjpeg($image);\n }\n break;\n\n // PNG\n case IMAGETYPE_PNG:\n $resource = imagecreatefrompng($image);\n break;\n\n default:\n throw new JIT\\JITException('Unsupported image type. Supported types: GIF, JPEG and PNG');\n break;\n }\n\n if (!is_resource($resource)) {\n throw new JIT\\JITGenerationError(\n sprintf('Error creating image <code>%s</code>. Check it exists and is readable.', General::sanitize(str_replace(DOCROOT, '', $image)))\n );\n }\n\n return new self($resource, $meta, $image);\n }", "public function getImage()\n {\n if (empty($this->data)) {\n // failure in processing the image. nothing much we can do\n return null;\n } else {\n $path = $this->data->basePath();\n\n // get path to image\n return $this->processImagePath($path);\n }\n }", "public function load($file){\n\n //kill any previous image that might still be in memory before we load a new one\n if(isset($this->image) && !empty($this->image)){\n imagedestroy($this->image);\n }\n\n //get the parameters of the image\n $image_params = getimagesize($file);\n\n //save the image params to class vars\n list($this->width, $this->height, $this->type, $this->attributes) = $image_params;\n $this->mime_type = $image_params['mime'];\n\n //check that an image type was found\n if(isset($this->type) && !empty($this->type)){\n //find the type of image so it can be loaded into memory\n switch ($this->type) {\n case IMAGETYPE_JPEG:\n $this->image = imagecreatefromjpeg($file);\n break;\n\n case IMAGETYPE_GIF:\n $this->image = imagecreatefromgif($file);\n break;\n\n case IMAGETYPE_PNG:\n $this->image = imagecreatefrompng($file);\n break;\n\n }\n\n if(isset($this->image) && !empty($this->image)){\n return true;\n }else{\n return true;\n }\n }else{\n return false;\n }\n }", "public function __construct($filename) {\n if (file_exists($filename)) {\n $this->setImage($filename);\n } else {\n throw new Exception('Image ' . $filename . ' can not be found, try another image.');\n }\n }", "protected function _checkImage() {\n if ( !is_file ( $this->src ) ) {\n $this->src = $this->default_missing_image; \n }\n $image_path_parts = pathinfo ( $this->src );\n $this->_image_name = $image_path_parts['basename'];\n $this->_thumb_filename = $this->attributes['width'] . 'x' . $this->attributes['height'] . '_' . $this->_image_name;\n $this->_thumb_src = $this->thumbs_dir_path . $this->_thumb_filename;\n if ( is_readable ( $this->_thumb_src ) ) {\n $this->_calculated_width = $this->attributes['width'];\n $this->_calculated_height = $this->attributes['height'];\n $this->src = $this->_thumb_src;\n return 'no_thumb_required';\n }\n if ( KISSIT_MAIN_PRODUCT_WATERMARK_SIZE == 0 ) {\n \tif ( !$this->_original_image_info = getimagesize ( $this->src ) ) {\n \t\treturn 'abort';\n \t} \n \tif (!in_array ( $this->_original_image_info['mime'], $this->_valid_mime ) ) {\n \t\treturn 'abort';\n \t}\n }\n }", "public function testGetImageInfoFromBlob()\n {\n $imgBlob = file_get_contents($this->_testImagePath);\n $imgInfo = Tinebase_ImageHelper::getImageInfoFromBlob($imgBlob);\n \n $this->assertEquals($this->_testImageData['width'], $imgInfo['width']);\n }", "public function testImageConfiguration()\n {\n $this->runConfigurationAssertions(new Image(), [\n 'imgable_type',\n 'url',\n 'imgable_id',\n ]);\n }", "public function getImage()\n {\n return $this->image;\n }", "public function imageInfo(Image $image, $width = false, $height = false, $mode = false, $format = false, $quality = false, $options = array()){\n\n if(!$image->service || !$image->id || !isset($this->connectors[$image->service]))\n return null;\n\n /* @var IConnector $connector */\n $connector = $this->connectors[$image->service];\n $info = $connector->imageInfo($image);\n\n if($info && $width) {\n $defaults = $this->config[\"defaults\"]['image'];\n $mode = $mode ? $mode : $defaults[\"mode\"];\n\n $info['cropped'] = $this->calculateCrop($info, $image, $width, $height, $mode, $format, $quality, $options);\n }\n\n return $info;\n }", "function initializeImageProperties()\n\t{\n\t\tlist($this->width, $this->height, $iType, $this->htmlattributes) = getimagesize($this->sFileLocation);\n\n\t\tif (($this->width < 1) || ($this->height < 1)) {\n\t\t\t$this->printError('invalid imagesize');\n\t\t}\n\n\t\t$this->setImageOrientation();\n\t\t$this->setImageType($iType);\n\t}", "function loadData ($image,$mime) {\r\n if ( in_array($mime,$this->types) ) {\r\n $this->source=imagecreatefromstring($image);\r\n $this->sourceWidth=imagesx($this->source);\r\n $this->sourceHeight=imagesy($this->source);\r\n $this->sourceMime=$mime;\r\n $this->initThumb();\r\n return true;\r\n } else {\r\n trigger_error('Image MIME type '.$mime.' not supported');\r\n return false;\r\n }\r\n }", "public function load($id)\n\t{\n\t\treturn Image::model()->findByPk($id);\n\t}", "public function getImageResource()\n {\n return $this->image;\n }", "public function getImage()\n {\n if($this->image == null){\n return \"https://place-hold.it/50x50\";\n }\n else return IMG_PATH.\"/\".$this->image;\n }", "public function getImage()\n {\n return $this->get('image');\n }", "function image_exist( $img ) \r\n\t\t{\r\n\t\t\tif( @file_get_contents( $img,0,NULL,0,1) ){ return 1; } else{ return 0; }\r\n\t\t\t\r\n\t\t}", "public function loadImage($imagePath, $width, $height) {\n $fileInfo = pathinfo($imagePath);\n $cacheFileName = $fileInfo['filename'] . '_' . $width . 'x' . $height . '.' . $fileInfo['extension'];\n $cacheFile = $cacheFileName;\n if(file_exists('image/cache/' . $cacheFile)) {\n return new Image($cacheFile, 'image/cache/');\n }\n else {\n return false;\n }\n }", "protected function getImageService() {}", "public function getImageDetails() {\n\t\t$details = getimagesize($this->file);\n\n\t\tif(!$details) throw new Exception('Falha na busca dos parametros da imagem!');\n\n\t\tlist($width, $height, $type, $attr, $mime) = $details;\n\t\t$aspect = ($width > $height)?'landscape':'portrait';\n\t\t$ration = $width / $height;\n\n\t\treturn array('width' => $width,'height' => $height,'aspect' => $aspect,'ratio' => $ratio,'mime' => $mime,'type' => $type);\n\t}", "public function load_image($https = false)\n {\n return $this->load(\"image\", $https);\n }", "public function getImage()\r\n {\r\n return $this->image;\r\n }", "public function getImage()\r\n {\r\n return $this->image;\r\n }", "public function test_it_loads_an_image_string_into_a_resource()\n {\n imagepng(imagecreatefromstring($this->imagePath), $this->compareTestSaveLocation);\n imagepng($this->image->getImageResource(), $this->testImageSaveLocation);\n\n $correctImage = file_get_contents($this->compareTestSaveLocation);\n $testImage = file_get_contents($this->testImageSaveLocation);\n\n $this->assertEquals($correctImage, $testImage);\n }", "public function action_image()\n\t{\n\t\t//Image::load(DOCROOT.'/files/04_2021/79199dcc06baf4cc230262fcbb4d1094.jpg')->preset('mypreset', DOCROOT.'/files/04_2021/ea7e8ed4bc9d6f7c03f5f374e30b183b.png');\n\t\t$image = Image::forge();\n\n\t\t// Or with optional config\n\t\t$image = Image::forge(array(\n\t\t\t\t'quality' => 80\n\t\t));\n\t\t$image->load(DOCROOT.'/files/04_2021/79199dcc06baf4cc230262fcbb4d1094.jpg')\n\t\t\t\t\t->crop_resize(200, 200)\n\t\t\t\t\t->rounded(100)\n\t\t\t\t\t->output();\n\t\t// Upload an image and pass it directly into the Image::load method.\n\t\tUpload::process(array(\n\t\t\t'path' => DOCROOT.DS.'files'\n\t\t));\n\n\t\tif (Upload::is_valid())\n\t\t{\n\t\t\t$data = Upload::get_files(0);\n\n\t\t\t// Using the file upload data, we can force the image's extension\n\t\t\t// via $force_extension\n\t\t\tImage::load($data['file'], false, $data['extension'])\n\t\t\t\t\t->crop_resize(200, 200)\n\t\t\t\t\t->save('image');\n\t\t} \n\t}", "function getImage()\r\n\t\t{\r\n\t\t\treturn $this->image;\r\n\t\t\t\r\n\t\t}", "public function getImage()\n {\n return $this->image;\n }", "public function getImage()\n {\n return $this->image;\n }", "public function getImage()\n {\n return $this->image;\n }", "public function getImage()\n {\n return $this->image;\n }", "public function getImage()\n {\n return $this->image;\n }", "public function getImage()\n {\n return $this->image;\n }", "public function getImage()\n {\n return $this->image;\n }", "public function getImage()\n {\n return $this->image;\n }", "public function getImage()\n {\n return $this->image;\n }", "public function getImage()\n {\n return $this->image;\n }", "public function getImage()\n {\n return $this->image;\n }", "public function getImage()\n {\n return $this->image;\n }", "public function getImage()\n {\n return $this->image;\n }", "public function getImage()\n {\n return $this->image;\n }", "public function getImage()\n {\n return $this->image;\n }", "public function getImage()\n {\n return $this->image;\n }", "public function getImage()\n {\n return $this->image;\n }", "public function getImage()\n {\n return $this->image;\n }", "public function getImage()\n {\n return $this->image;\n }", "public function getImage()\n {\n return $this->image;\n }", "public function getImage()\n {\n return $this->image;\n }", "public function getImage()\n {\n return $this->image;\n }", "public function getImage()\n {\n return $this->image;\n }", "public function getImage()\n {\n return $this->image;\n }", "public function getImage()\n {\n return $this->image;\n }", "public function getImage()\n {\n return $this->image;\n }", "public function getImage()\n {\n return $this->image;\n }", "function getImage();" ]
[ "0.6800805", "0.6526379", "0.64549524", "0.6412039", "0.6254222", "0.61136574", "0.6025113", "0.5963989", "0.5930068", "0.5860133", "0.5857649", "0.5854881", "0.5831103", "0.57905465", "0.5789969", "0.57879233", "0.57879233", "0.57879233", "0.57879233", "0.5785168", "0.57608795", "0.5747081", "0.5698655", "0.56720865", "0.5661665", "0.5659516", "0.5635422", "0.5630661", "0.562589", "0.5603239", "0.5596671", "0.5592095", "0.55711144", "0.5529461", "0.55066466", "0.55019885", "0.5496573", "0.54760975", "0.5475168", "0.54736406", "0.5430735", "0.5412097", "0.5400704", "0.5393608", "0.53864336", "0.53792", "0.537611", "0.5371275", "0.5355811", "0.5327813", "0.53201", "0.53128165", "0.5312758", "0.5301387", "0.53012186", "0.5300961", "0.52959085", "0.5287842", "0.5282474", "0.52795464", "0.5276333", "0.52759075", "0.5274709", "0.526324", "0.52576715", "0.524255", "0.5240338", "0.5226147", "0.5224062", "0.5224062", "0.52162594", "0.5208211", "0.5200186", "0.51970816", "0.51970816", "0.51970816", "0.51970816", "0.51970816", "0.51970816", "0.51970816", "0.51970816", "0.51970816", "0.51970816", "0.51970816", "0.51970816", "0.51970816", "0.51970816", "0.51970816", "0.51970816", "0.51970816", "0.51970816", "0.51970816", "0.51970816", "0.51970816", "0.51970816", "0.51970816", "0.51970816", "0.51970816", "0.51970816", "0.51970816", "0.5193574" ]
0.0
-1
Checks if GD is enabled and bundled. Bundled GD is required for some methods to work. Exceptions will be thrown from those methods when GD is not bundled.
public static function check() { if ( ! function_exists('gd_info')) { //throw new Exception('GD is either not installed or not enabled, check your configuration'); } if (defined('GD_BUNDLED')) { // Get the version via a constant, available in PHP 5. Image_GD::$_bundled = GD_BUNDLED; } else { // Get the version information $info = gd_info(); // Extract the bundled status Image_GD::$_bundled = (bool) preg_match('/\bbundled\b/i', $info['GD Version']); } if (defined('GD_VERSION')) { // Get the version via a constant, available in PHP 5.2.4+ $version = GD_VERSION; } else { // Get the version information $info = gd_info(); // Extract the version number preg_match('/\d+\.\d+(?:\.\d+)?/', $info['GD Version'], $matches); // Get the major version $version = $matches[0]; } if ( ! version_compare($version, '2.0.1', '>=')) { // throw new Exception('Image_GD requires GD version :required or greater, you have :version', // array('required' => '2.0.1', ':version' => $version)); } return Image_GD::$_checked = TRUE; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function checkGDLibrary(){\n\t//Check for GD support\n\t\treturn extension_loaded('gd');\n\t}", "protected function check() {\n\n // check for a valid GD lib installation \n if(!function_exists('gd_info')) raise('GD Lib is not installed');\n\n }", "function gdInstalled() {\r\n return function_exists( 'gd_info' );\r\n}", "function gd_loaded()\r\n{\r\n\tif ( ! extension_loaded('gd'))\r\n\t{\r\n\t\tif ( ! @dl('gd.so'))\r\n\t\t\treturn FALSE;\r\n\t}\r\n\treturn TRUE;\r\n}", "protected function checkGdLibJpgSupport() {}", "public static function GDSupported() {\n\t\treturn \\function_exists('gd_info');\n\t}", "public function isGDLibLoaded()\n {\n return extension_loaded('gd') && function_exists('gd_info');\n }", "public function checkOperationality()\n {\n if (!extension_loaded('gd')) {\n throw new SystemRequirementsNotMetException('Required Gd extension is not available.');\n }\n\n if (!function_exists('imagewebp')) {\n throw new SystemRequirementsNotMetException(\n 'Gd has been compiled without webp support.'\n );\n }\n }", "function autoDetect() {\n $GDfuncList = get_extension_funcs('gd');\n ob_start();\n @phpinfo(INFO_MODULES);\n $output = ob_get_contents();\n ob_end_clean();\n $matches[1] = '';\n if (preg_match(\"/GD Version[ \\t]*(<[^>]+>[ \\t]*)+([^<>]+)/s\", $output, $matches)) {\n $gdversion = $matches[2];\n }\n $res = false;\n if ($GDfuncList) {\n if (!in_array('imagegd2', $GDfuncList)) {\n zmgToolboxPlugin::registerError('GD 1.x', $gdversion . ' ' . T_('is available.'));\n $res = true;\n }\n }\n if (!$res) {\n zmgToolboxPlugin::registerError('GD 1.x', T_('could not be detected on your system.'));\n }\n }", "public static function gdAvailable()\n {\n return extension_loaded('gd');\n }", "function GDEnabled()\n\t{\n\t\tstatic $gd_enabled = null;\n\n\t\tif (is_null($gd_enabled)) {\n\t\t\t$gd_enabled =\tfunction_exists('imagecreate')\n\t\t\t\t\t\t\t&& (\tfunction_exists('imagegif')\n\t\t\t\t\t\t\t\t\t|| function_exists('imagepng')\n\t\t\t\t\t\t\t\t\t|| function_exists('imagejpeg'));\n\t\t}\n\n\t\treturn $gd_enabled;\n\t}", "function checkGDSupport() {\n if (extension_loaded(\"gd\")) {\n $arrGdInfo = gd_info();\n\n preg_match(\"/[\\d\\.]+/\", $arrGdInfo['GD Version'], $matches);\n if (!empty($matches[0])) {\n return $matches[0];\n }\n }\n return false;\n }", "public function has_gd_extension() {\n\n return extension_loaded( 'gd' ) && function_exists( 'gd_info' );\n\n }", "public static function checkGdLibrary($generateMessage = true)\n\t{\n\t \tif(!(extension_loaded('gd') && function_exists('gd_info')))\n\t \t{\n\t \t\tif($generateMessage)\n\t \t\t{\n\t \t\t\tJFactory::getApplication()->enqueueMessage(JText::_('COM_FORM2CONTENT_GDI_NOT_INSTALLED'), 'warning');\n\t \t\t}\n\t \t\t\n\t \t\treturn false;\n\t \t}\n\t \t\n\t \treturn true;\n\t}", "private function islibraryLoaded(): bool\n {\n if (!extension_loaded('gd') && !extension_loaded('gd2')) {\n return false;\n }\n\n return true;\n }", "function gd_support(){\n\t\treturn in_array($this->getGDType(), we_base_imageEdit::supported_image_types());\n\t}", "function gd_support(){\n \t\treturn in_array($this->getGDType(), we_image_edit::supported_image_types());\n \t}", "protected function checkGdLibPngSupport() {}", "public static function isAvailable()\n {\n return Image::isAvailable('gd');\n }", "protected function checkGdLibGifSupport() {}", "protected function checkGdLibFreeTypeSupport() {}", "function _testGD() {\r\n $gd = array();\r\n $GDfuncList = get_extension_funcs('gd');\r\n ob_start();\r\n @phpinfo(INFO_MODULES);\r\n $output=ob_get_contents();\r\n ob_end_clean();\r\n $matches[1]='';\r\n if (preg_match(\"/GD Version[ \\t]*(<[^>]+>[ \\t]*)+([^<>]+)/s\",$output,$matches)) {\r\n $gdversion = $matches[2];\r\n }\r\n if ($GDfuncList) {\r\n if (in_array('imagegd2', $GDfuncList)) {\r\n $gd['gd2'] = $gdversion;\r\n } else {\r\n $gd['gd1'] = $gdversion;\r\n }\r\n }\r\n return $gd;\r\n }", "private function isAvailableImageLibrary()\n {\n return ($this->isAvailableGD() || $this->isAvailableImageLibrary()) ? true : false;\n }", "function logonscreener_requirements() {\n if (version_compare(PHP_VERSION, '5.2.1') < 0) {\n logonscreener_log('Your PHP is too old. Go get the latest.');\n exit;\n }\n if (!function_exists('imagegd2') && (!function_exists('dl') || !@dl('php_gd2.dll'))) {\n logonscreener_log('GD is disabled.');\n }\n}", "public function isGd()\n {\n return $this->isResourceGd($this->resource);\n }", "function is_gd_image($image)\n {\n }", "public function checkOperationality()\n {\n if (!extension_loaded('Gmagick')) {\n throw new SystemRequirementsNotMetException('Required Gmagick extension is not available.');\n }\n\n if (!class_exists('Gmagick')) {\n throw new SystemRequirementsNotMetException(\n 'Gmagick is installed, but not correctly. The class Gmagick is not available'\n );\n }\n\n $im = new \\Gmagick($this->source);\n\n if (!in_array('WEBP', $im->queryformats())) {\n throw new SystemRequirementsNotMetException('Gmagick was compiled without WebP support.');\n }\n }", "public function checkConvertability()\n {\n $mimeType = $this->getMimeTypeOfSource();\n switch ($mimeType) {\n case 'image/png':\n if (!function_exists('imagecreatefrompng')) {\n throw new SystemRequirementsNotMetException(\n 'Gd has been compiled without PNG support and can therefore not convert this PNG image.'\n );\n }\n break;\n\n case 'image/jpeg':\n if (!function_exists('imagecreatefromjpeg')) {\n throw new SystemRequirementsNotMetException(\n 'Gd has been compiled without Jpeg support and can therefore not convert this jpeg image.'\n );\n }\n }\n }", "function gd_version_check($user_ver = 0)\n\t{\n\t\tif (! extension_loaded('gd'))\n\t\t{\n\t\t\treturn;\n\t\t}\n\t\n\t\tstatic $gd_ver = 0;\n\t\t// Just accept the specified setting if it's 1.\n\t\tif ($user_ver == 1) \n\t\t{\n\t\t\t$gd_ver = 1;\n\t\t \treturn 1; \n\t\t}\n\t\t// Use the static variable if function was called previously.\n\t\tif ($user_ver !=2 && $gd_ver > 0 ) \n\t\t{ \n\t\t\treturn $gd_ver;\n\t\t}\n\t\t// Use the gd_info() function if possible.\n\t\tif (function_exists('gd_info')) \n\t\t{\n\t\t\t$ver_info = gd_info();\n\t\t\tpreg_match('/\\d/', $ver_info['GD Version'], $match);\n\t\t\t$gd_ver = $match[0];\n\t\t\treturn $match[0];\n\t\t}\n\t\t// If phpinfo() is disabled use a specified / fail-safe choice...\n\t\tif (preg_match('/phpinfo/', ini_get('disable_functions'))) \n\t\t{\n\t\t\tif ($user_ver == 2) \n\t\t\t{\n\t\t\t\t$gd_ver = 2;\n\t\t\t\treturn 2;\n\t\t\t}\n\t\t\telse \n\t\t\t{\n\t\t\t\t$gd_ver = 1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\t\t// ...otherwise use phpinfo().\n\t\tob_start();\n\t\tphpinfo(INFO_MODULES);\n\t\t$info = ob_get_contents();\n\t\tob_end_clean();\n\t\t$info = stristr($info, 'gd version');\n\t\tpreg_match('/\\d/', $info, $match);\n\t\t$gd_ver = $match[0];\n\t\treturn $match[0];\n\t}", "protected function checkGdLibTrueColorSupport() {}", "protected function verifyFormatCompatiblity()\n {\n $gdInfo = gd_info();\n\n switch ($this->format) {\n case 'GIF':\n $isCompatible = $gdInfo['GIF Create Support'];\n break;\n case 'JPG':\n case 'JPEG':\n $isCompatible = (isset($gdInfo['JPG Support']) || isset($gdInfo['JPEG Support'])) ? true : false;\n $this->format = 'JPEG';\n break;\n case 'PNG':\n case 'XBM':\n case 'XPM':\n case 'WBMP':\n $isCompatible = $gdInfo[$this->format . ' Support'];\n break;\n default:\n $isCompatible = false;\n break;\n }\n\n if (!$isCompatible) {\n $isCompatible = $gdInfo['JPEG Support'];\n\n if (!$isCompatible) {\n throw $this->triggerError(sprintf('Your GD installation does not support \"%s\" image types!', $this->format));\n }\n }\n }", "function gdVersion($user_ver = 0)\n{\n if (! extension_loaded('gd')) { return; }\n static $gd_ver = 0;\n // Just accept the specified setting if it's 1.\n if ($user_ver == 1) { $gd_ver = 1; return 1; }\n // Use the static variable if function was called previously.\n if ($user_ver !=2 && $gd_ver > 0 ) { return $gd_ver; }\n // Use the gd_info() function if possible.\n if (function_exists('gd_info')) {\n $ver_info = gd_info();\n preg_match('/\\d/', $ver_info['GD Version'], $match);\n $gd_ver = $match[0];\n return $match[0];\n }\n // If phpinfo() is disabled use a specified / fail-safe choice...\n if (preg_match('/phpinfo/', ini_get('disable_functions'))) {\n if ($user_ver == 2) {\n $gd_ver = 2;\n return 2;\n } else {\n $gd_ver = 1;\n return 1;\n }\n }\n // ...otherwise use phpinfo().\n ob_start();\n phpinfo(8);\n $info = ob_get_contents();\n ob_end_clean();\n $info = stristr($info, 'gd version');\n preg_match('/\\d/', $info, $match);\n $gd_ver = $match[0];\n return $match[0];\n}", "public static function check_required_ext() {\r\n $shmop = extension_loaded('shmop');\r\n $sysvsem = extension_loaded('sysvsem');\r\n if ($shmop && $sysvsem) {\r\n return true;\r\n }\r\n $missing = array();\r\n if (!$shmop) {\r\n array_push($missing, 'shmop');\r\n }\r\n if (!$sysvsem) {\r\n array_push($missing, 'sysvsem');\r\n }\r\n if (count($missing) == 1) {\r\n throw new Exception('The PHP extension ' . $missing[0] . ' required by class ' . __CLASS__ . ' is not loaded or built into PHP.');\r\n }\r\n throw new Exception('The PHP extensions ' . implode(' and ', $missing) . ' required by class ' . __CLASS__ . ' are not loaded or built into PHP.');\r\n }", "public function checkOperationality()\n {\n $this->checkOperationalityExecTrait();\n\n if (!$this->isInstalled()) {\n throw new SystemRequirementsNotMetException('gmagick is not installed');\n }\n if (!$this->isWebPDelegateInstalled()) {\n throw new SystemRequirementsNotMetException('webp delegate missing');\n }\n }", "public static function imagickAvailable()\n {\n return extension_loaded('imagick');\n }", "private function checkImagickLibrary(){\n\t\t//Check for Imagick support\n\t\treturn class_exists('Imagick');\n\t}", "protected function checkRequiredPhpModules()\n {\n // Make sure BCMATH is installed to support MySQL geospatial operations\n $isBcmathInstalled = extension_loaded('bcmath');\n\n\n if (!$isBcmathInstalled)\n {\n $options = array(\n 'title_key' => 'COM_CAJOBBOARD_PIM_BCMATH_MISSING_TITLE',\n 'description_key' => 'COM_CAJOBBOARD_PIM_BCMATH_MISSING_DESC'\n );\n\n $this->setPostInstallationMessage($options);\n }\n }", "public function notice_missing_extensions() {\n\n ?>\n <div class=\"error\">\n <p><strong><?php _e( 'The GD or Imagick libraries are not installed on your server. Envira Gallery requires at least one (preferably Imagick) in order to crop images and may not work properly without it. Please contact your webhost and ask them to compile GD or Imagick for your PHP install.', 'envira-gallery' ); ?></strong></p>\n </div>\n <?php\n\n }", "public function isExtensionLoaded($ext='gd') { \n return extension_loaded($ext); \n }", "function myimg_is_installed()\r\n{\r\n global $db, $mybb, $cache;\r\n \r\n\t$info = myimg_info();\r\n $installed = $cache->read(\"poeja_plugins\");\r\n if ($installed[$info['name']]) {\r\n return true;\r\n }\r\n\t\r\n if (isset($mybb->settings['myimg_id'])\r\n && isset($mybb->settings['myimg_api'])\r\n && isset($mybb->settings['myimg_authdomain'])\r\n && isset($mybb->settings['myimg_databaseurl'])\r\n && isset($mybb->settings['myimg_storagebucket'])\r\n && isset($mybb->settings['myimg_messagingsenderid'])\r\n && isset($mybb->settings['myimg_groups'])\r\n && $db->table_exists('myimg')\r\n ) {\r\n return true;\r\n }\r\n \r\n return false;\r\n}", "public function testNotOperational2()\r\n {\r\n global $pretend;\r\n\r\n $gd = $this->createGd('test.png');\r\n self::resetPretending();\r\n\r\n $pretend['extensionsNotExisting'] = ['gd'];\r\n $this->expectException(SystemRequirementsNotMetException::class);\r\n $gd->checkOperationality();\r\n $pretend['extensionsNotExisting'] = [];\r\n }", "function tidypics_get_image_libraries() {\n\t$options = array();\n\tif (extension_loaded('gd')) {\n\t\t$options['GD'] = 'GD';\n\t}\n\n\tif (extension_loaded('imagick')) {\n\t\t$options['ImageMagickPHP'] = 'imagick PHP extension';\n\t}\n\n\t$disablefunc = explode(',', ini_get('disable_functions'));\n\tif (is_callable('exec') && !in_array('exec', $disablefunc)) {\n\t\t$options['ImageMagick'] = 'ImageMagick executable';\n\t}\n\n\treturn $options;\n}", "public function testCheckConvertability1()\r\n {\r\n global $pretend;\r\n\r\n $gd = $this->createGd('test.png');\r\n self::resetPretending();\r\n\r\n $pretend['functionsNotExisting'] = ['imagecreatefrompng'];\r\n $this->expectException(SystemRequirementsNotMetException::class);\r\n $gd->checkConvertability();\r\n $pretend['functionsNotExisting'] = [];\r\n }", "function checkImg(){\n global $postpath;\n return getimagesize($postpath) !== false;\n }", "private static function checkRequiredPhpExtensions(): void\n {\n /**\n * Warning about mbstring.\n */\n if (! function_exists('mb_detect_encoding')) {\n Core::warnMissingExtension('mbstring');\n }\n\n /**\n * We really need this one!\n */\n if (! function_exists('preg_replace')) {\n Core::warnMissingExtension('pcre', true);\n }\n\n /**\n * JSON is required in several places.\n */\n if (! function_exists('json_encode')) {\n Core::warnMissingExtension('json', true);\n }\n\n /**\n * ctype is required for Twig.\n */\n if (! function_exists('ctype_alpha')) {\n Core::warnMissingExtension('ctype', true);\n }\n\n /**\n * hash is required for cookie authentication.\n */\n if (function_exists('hash_hmac')) {\n return;\n }\n\n Core::warnMissingExtension('hash', true);\n }", "protected function isImageMagickEnabledAndConfigured() {}", "public function checkOperationality()\n {\n if (!extension_loaded('imagick')) {\n throw new SystemRequirementsNotMetException('Required iMagick extension is not available.');\n }\n\n if (!class_exists('\\\\Imagick')) {\n throw new SystemRequirementsNotMetException(\n 'iMagick is installed, but not correctly. The class Imagick is not available'\n );\n }\n\n $im = new \\Imagick();\n if (!in_array('WEBP', $im->queryFormats('WEBP'))) {\n throw new SystemRequirementsNotMetException('iMagick was compiled without WebP support.');\n }\n }", "public function checkOperationality()\n {\n $this->checkOperationalityExecTrait();\n\n if (!$this->isInstalled()) {\n throw new SystemRequirementsNotMetException(\n 'imagemagick is not installed (cannot execute: \"' . $this->getPath() . '\")'\n );\n }\n if (!$this->isWebPDelegateInstalled()) {\n throw new SystemRequirementsNotMetException('webp delegate missing');\n }\n }", "function rtasset_check_plugin_dependecy() {\n\n\tglobal $rtasset_plugin_check;\n\t$rtasset_plugin_check = array(\n\t\t'rtbiz' => array(\n\t\t\t'project_type' => 'all',\n\t\t\t'name' => esc_html__( 'WordPress for Business.', RT_ASSET_TEXT_DOMAIN ),\n\t\t\t'active' => class_exists( 'Rt_Biz' ),\n\t\t\t'filename' => 'index.php',\n\t\t),\n\t);\n\n\t$flag = true;\n\n\tif ( ! class_exists( 'Rt_Biz' ) || ! did_action( 'rt_biz_init' ) ) {\n\t\t$flag = false;\n\t}\n\n\tif ( ! $flag ) {\n\t\tadd_action( 'admin_enqueue_scripts', 'rtasset_plugin_check_enque_js' );\n\t\tadd_action( 'wp_ajax_rtasset_activate_plugin', 'rtasset_activate_plugin_ajax' );\n\t\tadd_action( 'admin_notices', 'rtasset_admin_notice_dependency_not_installed' );\n\t}\n\n\treturn $flag;\n}", "protected function checkIfNoConflictingExtensionIsInstalled() {}", "public function testNotOperational1()\r\n {\r\n global $pretend;\r\n\r\n $gd = $this->createGd('test.png');\r\n self::resetPretending();\r\n\r\n $pretend['functionsNotExisting'] = ['imagewebp'];\r\n $this->expectException(SystemRequirementsNotMetException::class);\r\n $gd->checkOperationality();\r\n }", "public function getSupportedFormat()\n {\n $gdInfo = gd_info();\n $support = array();\n\n foreach ($gdInfo as $key => $info) {\n if (is_bool($info) && $info === true) {\n $tmp = explode(' ', $key);\n $format = $tmp[0];\n if (($format != 'FreeType' || $format != 'T1Lib') && !in_array($format, $support)) {\n $support[] = $format;\n }\n }\n }\n\n return $support;\n }", "public function has_imagick_extension() {\n\n return extension_loaded( 'imagick' );\n\n }", "protected function disableImageMagickAndGdlibIfImageProcessingIsDisabled() {}", "public function checkOperationality()\n {\n if (!extension_loaded('vips')) {\n throw new SystemRequirementsNotMetException('Required Vips extension is not available.');\n }\n\n if (!function_exists('vips_image_new_from_file')) {\n throw new SystemRequirementsNotMetException(\n 'Vips extension seems to be installed, however something is not right: ' .\n 'the function \"vips_image_new_from_file\" is not available.'\n );\n }\n\n // TODO: Should we also test if webp is available? (It seems not to be neccessary - it seems\n // that webp be well intergrated part of vips)\n }", "public function testCheckConvertability2()\r\n {\r\n global $pretend;\r\n\r\n $gd = $this->createGd('test.png');\r\n self::resetPretending();\r\n\r\n $pretend['functionsExisting'] = ['imagecreatefrompng'];\r\n $gd->checkConvertability();\r\n $pretend['functionsExisting'] = [];\r\n }", "public function __construct(){\n\t\tif(!function_exists(\"imagecreatetruecolor\")){\n\t\t\tif(!function_exists(\"imagecreate\")){\n\t\t\t\t$this->error[] = \"You do not have the GD library loaded in PHP!\";\n\t\t\t}\n\t\t}\n\t}", "static function graphic_library() {\n\n\t\t$ngg_options = get_option('ngg_options');\n\n\t\tif ( $ngg_options['graphicLibrary'] == 'im')\n\t\t\treturn NGGALLERY_ABSPATH . '/lib/imagemagick.inc.php';\n\t\telse\n\t\t\treturn NGGALLERY_ABSPATH . '/lib/gd.thumbnail.inc.php';\n\n\t}", "public function checkConvertability()\n {\n $im = new \\Gmagick();\n $mimeType = $this->getMimeTypeOfSource();\n switch ($mimeType) {\n case 'image/png':\n if (!in_array('PNG', $im->queryFormats())) {\n throw new SystemRequirementsNotMetException(\n 'Gmagick has been compiled without PNG support and can therefore not convert this PNG image.'\n );\n }\n break;\n case 'image/jpeg':\n if (!in_array('JPEG', $im->queryFormats())) {\n throw new SystemRequirementsNotMetException(\n 'Gmagick has been compiled without Jpeg support and can therefore not convert this Jpeg image.'\n );\n }\n break;\n }\n }", "function is_compatible() {\n\n\t\tif (!$this->__exec) {\n\t\t\ttrigger_error(\n\t\t\t\t'The Asido_Driver_Imagick_Shell driver is '\n\t\t\t\t\t. ' unable to be initialized, because '\n\t\t\t\t\t. ' the Image Magick (imagick) executables '\n\t\t\t\t\t. ' were not found. Please locate '\n\t\t\t\t\t. ' where those files are and set the '\n\t\t\t\t\t. ' path to them by defining the '\n\t\t\t\t\t. ' ASIDO_IMAGICK_SHELL_PATH constant.',\n\t\t\t\tE_USER_ERROR\n\t\t\t\t);\n\t\t\treturn false;\n\t\t\t}\n\t\t\n\t\t// give access to all the memory\n\t\t//\n\t\t@ini_set(\"memory_limit\", -1);\n\t\t\n\t\t// no time limit\n\t\t//\n\t\t@set_time_limit(-1);\n\t\t\n\t\treturn true;\n\t\t}", "protected function checkDtcGridBundle()\n {\n if (!class_exists('Dtc\\GridBundle\\DtcGridBundle')) {\n throw new UnsupportedException('DtcGridBundle (mmucklo/grid-bundle) needs to be installed.');\n }\n }", "protected function checkIfDbalExtensionIsInstalled() {}", "private function checkRequirements()\n {\n if (!function_exists('mime_content_type') && !function_exists('finfo_file') && version_compare(PHP_VERSION, '5.3.0') < 0){\n add_action('admin_notices', array($this, 'displayFunctionMissingNotice'));\n return TRUE;\n }\n return TRUE;\n }", "public static function test_image($source) {\n\t\tif (strlen($source) < 10) {\n\t\t\tdebug_event('Art', 'Invalid image passed', 1);\n\t\t\treturn false;\n\t\t}\n\n\t\t// Check to make sure PHP:GD exists. If so, we can sanity check\n\t\t// the image.\n\t\tif (function_exists('ImageCreateFromString')) {\n\t\t\t $image = ImageCreateFromString($source);\n\t\t\t if (!$image || imagesx($image) < 5 || imagesy($image) < 5) {\n\t\t\t\tdebug_event('Art', 'Image failed PHP-GD test',1);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}", "public function testCheckConvertability3()\r\n {\r\n global $pretend;\r\n\r\n $gd = $this->createGd('test.jpg');\r\n self::resetPretending();\r\n\r\n $pretend['functionsNotExisting'] = ['imagecreatefromjpeg'];\r\n $this->expectException(SystemRequirementsNotMetException::class);\r\n $gd->checkConvertability();\r\n $pretend['functionsNotExisting'] = [];\r\n }", "function plugin_is_active() {\n\t\treturn function_exists( 'jigoshop_init' ) || class_exists( 'JigoshopInit' );\n\t}", "function getGDType(){\n \t\treturn isset($GLOBALS[\"GDIMAGE_TYPE\"][strtolower($this->Extension)]) ? $GLOBALS[\"GDIMAGE_TYPE\"][strtolower($this->Extension)] : \"jpg\";\n\t}", "private function checkIfBcmodIsAvailable(): bool\n {\n return function_exists('bcmod');\n }", "private static function BigMath_Detect() {\r\n $extensions = array(\r\n \tarray('modules' => array('gmp', 'php_gmp'),\r\n 'extension' => 'gmp',\r\n 'class' => 'BigMath_GmpMathWrapper'),\r\n \tarray('modules' => array('bcmath', 'php_bcmath'),\r\n 'extension' => 'bcmath',\r\n 'class' => 'BigMath_BcMathWrapper')\r\n );\r\n\r\n $loaded = false;\r\n foreach ($extensions as $ext) {\r\n // See if the extension specified is already loaded.\r\n if ($ext['extension'] && extension_loaded($ext['extension'])) {\r\n $loaded = true;\r\n }\r\n\r\n // Try to load dynamic modules.\r\n if (!$loaded && function_exists('dl')) {\r\n foreach ($ext['modules'] as $module) {\r\n if (@dl($module . \".\" . PHP_SHLIB_SUFFIX)) {\r\n $loaded = true;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n if ($loaded) {\r\n return $ext;\r\n }\r\n }\r\n\r\n return false;\r\n }", "function isSupportedType($type, $src_file) {\n if ($type !== \"jpg\" && $type !== \"jpeg\" && $type !== \"png\") {\n return zmgToolboxPlugin::registerError($src_file, 'GD 1.x: Source file is not an image or image type is not supported.');\n }\n return true;\n }", "public static function theme_has_support()\n {\n }", "function Check($flag = false)\r\n {\r\n static $flags = false;\r\n if (!QF_IMAGER_USE_GD)\r\n return false;\r\n\r\n if (!$flags)\r\n $flags = Array(\r\n 'GIFw' => (imagetypes() & IMG_GIF) && QF_IMAGER_GIF_WRITE,\r\n 'GIF' => (bool) (imagetypes() & IMG_GIF), // gd information\r\n 'JPG' => (bool) (imagetypes() & IMG_JPG),\r\n 'PNG' => (bool) (imagetypes() & IMG_PNG),\r\n );\r\n\r\n if (isset($flags[$flag]))\r\n return $flags[$flag];\r\n else\r\n return $flags;\r\n }", "protected function checkPhpExtensions()\n\t{\n\t\tif (!extension_loaded('pcntl'))\n\t\t{\n\t\t\techo \"Extension pcntl not loaded\";\n\t\t\texit(1);\n\t\t}\n\n\t\t// This is used to kill processes\n\t\tif (!extension_loaded('posix'))\n\t\t{\n\t\t\techo \"Extension posix not loaded\";\n\t\t\texit(1);\n\t\t}\n\t}", "public static function isGfActive()\n {\n return class_exists('RGForms');\n }", "function birdseye_component_checkversion()\n{\n if (!function_exists('get_product_release'))\n return false;\n if (get_product_release() < 207)\n return false;\n\n return true;\n}", "function fiorello_mikado_is_wp_gutenberg_installed() {\n\t\treturn class_exists( 'WP_Block_Type' );\n\t}", "static public function isSupported();", "function fiorello_mikado_is_gutenberg_installed() {\n\t\treturn function_exists( 'is_gutenberg_page' ) && is_gutenberg_page();\n\t}", "public function __construct()\n {\n if (!extension_loaded('gd')) {\n throw new Omeka_File_Derivative_Exception('This derivative strategy requires the extension GD.');\n }\n }", "function check_requirements() {\n\tglobal $install_errors;\n\t\n\t// Try to fix the sessions in crap setups (OVH)\n\t@ini_set('session.gc_divisor', 100);\n\t@ini_set('session.gc_probability', true);\n\t@ini_set('session.use_trans_sid', false);\n\t@ini_set('session.use_only_cookies', true);\n\t@ini_set('session.hash_bits_per_character', 4);\n\t\n\t$mod_rw_error = 'Apache <a href=\"http://httpd.apache.org/docs/2.1/rewrite/rewrite_intro.html\" target=\"_blank\">mod_rewrite</a> is not enabled.';\n\t\n\tif(version_compare(PHP_VERSION, '5.2.0', '<'))\n\t\t$install_errors[] = 'Your server is currently running PHP version '.PHP_VERSION.' and Chevereto needs atleast PHP 5.2.0';\n\t\n\tif(!extension_loaded('curl') && !function_exists('curl_init'))\n\t\t$install_errors[] = '<a href=\"http://curl.haxx.se/\" target=\"_blank\">cURL</a> is not enabled on your current server setup.';\n\t\n\tif(!function_exists('curl_exec'))\n\t\t$install_errors[] = '<b>curl_exec()</b> function is disabled, you have to enable this function on your php.ini';\n\t\n\tif(function_exists('apache_get_modules')) {\n\t\tif(!in_array('mod_rewrite', apache_get_modules()))\n\t\t\t$install_errors[] = $mod_rw_error;\n\t} else {\n\t\t// As today (Jun 11, 2012) i haven't found a better way to test mod_rewrite in CGI setups. The phpinfo() method is not fail safe either.\n\t}\n\t\n\tif (!extension_loaded('gd') and !function_exists('gd_info')) {\n\t\t$install_errors[] = '<a href=\"http://www.libgd.org\" target=\"_blank\">GD Library</a> is not enabled.';\n\t} else {\n\t\t$imagetype_fail = 'image support is not enabled in your current PHP setup (GD Library).';\n\t\tif(!imagetypes() & IMG_PNG) $install_errors[] = 'PNG '.$imagetype_fail;\n\t\tif(!imagetypes() & IMG_GIF) $install_errors[] = 'GIF '.$imagetype_fail;\n\t\tif(!imagetypes() & IMG_JPG) $install_errors[] = 'JPG '.$imagetype_fail;\n\t\tif(!imagetypes() & IMG_WBMP) $install_errors[] = 'BMP '.$imagetype_fail;\n\t}\n\t\n\t/*\n\t$test_session_file = session_save_path().'/'.time();\n\tif(!@fopen($test_session_file, 'w+')) {\n\t\t$install_errors[] = 'PHP can\\'t write/read in the session path <code>'.session_save_path().'</code>. Your server setup doesn\\'t have the right PHP/Apache permissions over this folder.';\n\t\t$install_errors[] = 'Please repair the permissions on this folder or specify a new one on <code>php.ini</code>';\n\t} else {\n\t\t@unlink($test_session_file);\n\t}\n\t*/\n\t\n\t$bcmath_functions = array('bcadd', 'bcmul', 'bcpow', 'bcmod', 'bcdiv');\n\tforeach($bcmath_functions as $bcmath_function) {\n\t\tif(!function_exists($bcmath_function)) {\n\t\t\t$install_errors[] = '<a href=\"http://php.net/manual/function.'.$bcmath_function.'.php\" target=\"_blank\">'.$bcmath_function.'</a> function is not defined. You need to re-install the BC Math functions.';\n\t\t}\n\t}\n\t\n\tif(!extension_loaded('pdo')) {\n\t\t$install_errors[] = 'PHP Data Objects (<a href=\"http://www.php.net/manual/book.pdo.php\">PDO</a>) is not loaded.';\n\t}\n\t\n\tif(!extension_loaded('pdo_mysql')) {\n\t\t$install_errors[] = 'MySQL Functions (<a href=\"http://www.php.net/manual/ref.pdo-mysql.php\" target=\"_blank\">PDO_MYSQL</a>) is not loaded.';\n\t}\n\n\tif(count($install_errors)==0) return true;\n}", "function wds_acf_blocks_dependency_check() {\n\t$asset_file = plugin_dir_path( dirname( __FILE__ ) ) . 'build/index.asset.php';\n\n\tif ( file_exists( $asset_file ) ) {\n\t\treturn;\n\t}\n\t?>\n\t<div class=\"notice notice-error\">\n\t\t<p>\n\t\t\t<?php\n\t\t\tesc_html_e(\n\t\t\t\t'Whoops! You need to run `npm install` in the terminal for the WDS ACF Blocks plugin to work first.',\n\t\t\t\t'wds-acf-blocks'\n\t\t\t);\n\t\t\t?>\n\t\t</p>\n\t</div>\n\t<?php\n}", "public function isValidImage()\n\t{\n\t\t$src = $this->source_path;\n\t\t$extension = \\strtolower(\\substr($src, (\\strrpos($src, '.') + 1)));\n\n\t\tif (!\\in_array($extension, $this->image_extensions)) {\n\t\t\treturn false;\n\t\t}\n\n\t\t$r = @\\imagecreatefromstring(\\file_get_contents($src));\n\n\t\treturn \\is_resource($r) && \\get_resource_type($r) === 'gd';\n\t}", "public function check_dependencies() {\n\n $dependencies = [];\n\n /**\n * Sample plugin dependency\n *\n * Depends on ACF plugin active\n */\n// if ( ! class_exists( 'acf' ) ) {\n// $dependencies[] = [\n// 'type' => 'error',\n// 'message' => $this->name . ' ' . __( 'requires ACF PRO plugin activated', 'goapostas' )\n// ];\n// }\n\n /**\n * Depends on ACF plugin active\n */\n if ( false === version_compare( PHP_VERSION, '7.0.0', '>=' ) ) {\n $dependencies[] = [\n 'type' => 'error',\n 'message' => $this->name . ' ' . __( 'requires PHP 7.0.0 or higher. Your PHP version is ' . PHP_VERSION, 'goapostas' )\n ];\n }\n\n if ( ! empty( $dependencies ) ) {\n $this->show_admin_notices( $dependencies );\n\n return false;\n }\n\n return true;\n }", "function woocomm_add_fee_check_woocomm_is_loaded()\n\t{\n\t\tif( class_exists( 'WooCommerce' ) )\n\t\t{\n\t\t\treturn;\n\t\t}\n\t\twc_add_fees_load_plugin_version();\n\t}", "function is_image(mixed $var): bool\n{\n return $var && ($var instanceof GdImage);\n}", "private function isValidImage() {\r\n\t\t\treturn in_array($this->extension, $this->extAllowed) ? true : false;\r\n\t\t}", "public static function isSupported()\n {\n return function_exists('finfo_open');\n }", "function test_responsive_gallery_wp_default_scripts() {\n\t\tBU\\Themes\\Responsive_Framework\\Galleries\\wp_default_scripts();\n\n\t\t$this->assertTrue( wp_script_is( 'responsive-framework-gallery', 'registered' ) );\n\t\t$this->assertTrue( wp_style_is( 'lightgallery', 'registered' ) );\n\n\t\t$this->assertFalse( wp_script_is( 'responsive-framework-gallery' ) );\n\t\t$this->assertFalse( wp_style_is( 'lightgallery' ) );\n\t}", "public static function is_enabled() {\n\t\treturn ! empty( get_option( static::ENABLE_FONTS_OPTIMIZATION, 0 ) );\n\t}", "function jetpack_is_product() {\n\treturn ( function_exists( 'is_product' ) ) ? is_product() : false;\n}", "public static function hasGoogleSupport()\n {\n return static::enabled(static::google());\n }", "protected function checkRequiremets () {\n\t\t// Check if `finfo_file()` function exists. File info extension is \n\t\t// presented from PHP 5.3+ by default, so this error probably never happened.\n\t\tif (!function_exists('finfo_file')) \n\t\t\treturn $this->handleUploadError(\n\t\t\t\tstatic::UPLOAD_ERR_NO_FILEINFO\n\t\t\t);\n\t\t\n\t\t// Check if mimetypes and extensions validator class\n\t\t$extToolsMimesExtsClass = static::MVCCORE_EXT_TOOLS_MIMES_EXTS_CLASS;\n\t\tif (!class_exists($extToolsMimesExtsClass)) \n\t\t\treturn $this->handleUploadError(\n\t\t\t\tstatic::UPLOAD_ERR_NO_MIMES_EXT\n\t\t\t);\n\n\t\t// Complete uploaded files temporary directory:\n\t\t$this->GetUploadsTmpDir();\n\t\t\n\t\treturn TRUE;\n\t}", "function is_image( string $path ):bool\r\n {\r\n $a = getimagesize($path);\r\n $image_type = $a[2];\r\n\r\n if( in_array( $image_type , array( IMAGETYPE_GIF , IMAGETYPE_JPEG ,IMAGETYPE_PNG , IMAGETYPE_BMP) ) )\r\n {\r\n return true;\r\n }\r\n return false;\r\n }", "function captcha_show_gd_img( $content=\"\" )\n\t{\n\t\t//-----------------------------------------\n\t\t// Is GD Available?\n\t\t//-----------------------------------------\n\t\t\n\t\tif ( ! extension_loaded('gd') )\n\t\t{\n\t\t\tif ( $this->show_error_gd_img )\n\t\t\t{\n\t\t\t\t@header( \"Content-Type: image/gif\" );\n\t\t\t\tprint base64_decode( \"R0lGODlhyAA8AJEAAN/f3z8/P8zMzP///yH5BAAAAAAALAAAAADIADwAAAL/nI+py+0Po5y02ouz3rz7D4biSJbmiabqyrbuC8fyTNf2jef6zvf+DwwKh8Si8YhMlgACwEHQXESfzgOzykQAqgMmFMr9Rq+GbHlqAFsFWnFVrfwIAvQAu15P0A14Nn8/ADhXd4dnl2YYCAioGHBgyDbnNzBIV0gYxzEYWdg1iLAnScmFuQdAt2UKZTcl+mip+HoYG+tKOfv3N5l5garnmPt6CwyaFzrranu7i0crObvoaKvMyMhrIQhFuyzcyGwXcOpoLYg7DGsZXk5r6DSN51RNfF0RPU5sy7gpnH5bjLhrk7Y9/RQNisfq2CRJauTR6xUuFyBx/yrWypMMmTlq/9IwQnKWcKG5cvMeShBIMOFIaV9w2eti6SBABAyjvBRFMaZCMaxsqtxl8iShjpj+VfqGCJg4XzOfJCK5DVWliFNXlSIENKjWrVy7ev0KNqzYsWTFwhlFU8waLk+efGF7hi0aSgu3iGmV1cxdoGTinimbiGOeP8SWhps6z3AkeMMWW20mMykqQyuJDbYWdufKBJWc2uWmAJZdO0yOKfTCCqHGiO4E/oKGriTYaBw5g/MDqynNlW9Uhmx66tM2i05dNcM8O6Rg2MHLYKraLTpDcLebTke4APkcduAoku0DWpe24MI96ewZPdiy6Rlx/0Y+XJevlNu/z6vtlHFxZbpv9f9edYkfxgVmjnqSxXYOYPfFVMgXIHGC0ltWDNXYJ6Lsw82AFVpWEk4pEabgbsfBM5FphyDWRh1OLCUgbC06NtNU6UV1T1Jl3YhjjjruyGOPPv4IZJBC6tDXGUDB4UUaK06RhRl/0aWWF3CR4YWESraR1ZCh6dMOiMNIFE2GI/bRJYiIEeULiloyUNSFLzWC3VXcqEJXTBe1qApDpbXUEYxr2tYeQCyyGMuIcxbokHfPvPjHf25mqeWHoLEX0iH0UScmUzSWNxmj20yH6Z+/yNTeM0N1cumkg9E4GHnluLcfeKLm95yLoO5ZKJrhgeaQm4xlFGshcK3pYZ9LradQrmY5nmhVdMm+qqpKYkIqpDyltWkpjJJaaKmd6kXjHUXvDPborOaei2666q7LbrvuvgtvvPLOS2+9YBUAADs=\" );\n\t\t\t\texit();\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\texit();\n\t\t\t}\n\t\t}\n\t\t\t\t\n\t\t//-----------------------------------------\n\t\t// INIT\n\t\t//-----------------------------------------\n\t\t\n\t\t$content = ' '. preg_replace( \"/(\\w)/\", \"\\\\1 \", $content ) .' ';\n\t\t$allow_fonts = isset( $this->ipsclass->vars['captcha_allow_fonts'] ) ? $this->ipsclass->vars['captcha_allow_fonts'] : 1;\n\t\t$use_fonts = 0;\n\t\t$tmp_x = 135;\n\t\t$tmp_y = 20;\n\t\t$image_x = 200;\n\t\t$image_y = 60;\n\t\t$circles = 3;\n\t\t$continue_loop = TRUE;\n\t\t$_started = FALSE;\n\t\t\n\t\t//-----------------------------------------\n\t\t// Get backgrounds and fonts...\n\t\t//-----------------------------------------\n\t\t\n\t\t$backgrounds = $this->_captcha_show_gd_img_get_backgrounds();\n\t\t$fonts = $this->_captcha_show_gd_img_get_fonts();\n\t\n\t\t//-----------------------------------------\n\t\t// Seed rand functions for PHP versions that don't\n\t\t//-----------------------------------------\n\t\t\n\t\tmt_srand( (double) microtime() * 1000000 );\n\t\t\n\t\t//-----------------------------------------\n\t\t// Got a background?\n\t\t//-----------------------------------------\n\t\t\n\t\tif ( $this->ipsclass->vars['gd_version'] > 1 )\n\t\t{\n\t\t\twhile ( $continue_loop )\n\t\t\t{\n\t\t\t\tif ( is_array( $backgrounds ) AND count( $backgrounds ) )\n\t\t\t\t{\n\t\t\t\t\t$i = mt_rand(0, count( $backgrounds ) - 1 );\n\t\t\t\t\n\t\t\t\t\t$background = $backgrounds[ $i ];\n\t\t\t\t\t$_file_extension = preg_replace( \"#^.*\\.(\\w{2,4})$#is\", \"\\\\1\", strtolower( $background ) );\n\t\t\t\t\n\t\t\t\t\tswitch( $_file_extension )\n\t\t\t\t\t{\n\t\t\t\t\t\tcase 'jpg':\n\t\t\t\t\t\tcase 'jpe':\n\t\t\t\t\t\tcase 'jpeg':\n\t\t\t\t\t\t\tif ( ! function_exists('imagecreatefromjpeg') OR ! $im = @imagecreatefromjpeg($background) )\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tunset( $backgrounds[ $i ] );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$continue_loop = FALSE;\n\t\t\t\t\t\t\t\t$_started = TRUE;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'gif':\n\t\t\t\t\t\t\tif ( ! function_exists('imagecreatefromgif') OR ! $im = @imagecreatefromgif($background) )\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tunset( $backgrounds[ $i ] );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$continue_loop = FALSE;\n\t\t\t\t\t\t\t\t$_started = TRUE;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'png':\n\t\t\t\t\t\t\tif ( ! function_exists('imagecreatefrompng') OR ! $im = @imagecreatefrompng($background) )\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tunset( $backgrounds[ $i ] );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$continue_loop = FALSE;\n\t\t\t\t\t\t\t\t$_started = TRUE;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$continue_loop = FALSE;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t//-----------------------------------------\n\t\t// Still not got one? DO OLD FASHIONED\n\t\t//-----------------------------------------\n\t\t\n\t\tif ( $_started !== TRUE )\n\t\t{\n\t\t\tif ( $this->ipsclass->vars['gd_version'] == 1 )\n\t\t\t{\n\t\t\t\t$im = imagecreate($image_x, $image_y);\n\t\t\t\t$tmp = imagecreate($tmp_x, $tmp_y);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$im = imagecreatetruecolor($image_x, $image_y);\n\t\t\t\t$tmp = imagecreatetruecolor($tmp_x, $tmp_y);\n\t\t\t}\n\t\t\t\n\t\t\t$white = ImageColorAllocate($tmp, 255, 255, 255);\n\t\t\t$black = ImageColorAllocate($tmp, 0, 0, 0);\n\t\t\t$grey = ImageColorAllocate($tmp, 200, 200, 200 );\n\n\t\t\timagefill($tmp, 0, 0, $white);\n\n\t\t\tfor ( $i = 1; $i <= $circles; $i++ )\n\t\t\t{\n\t\t\t\t$values = array(\n\t\t\t\t\t\t\t\t0 => rand(0, $tmp_x - 10),\n\t\t\t\t\t\t\t\t1 => rand(0, $tmp_y - 3),\n\t\t\t\t\t\t\t\t2 => rand(0, $tmp_x - 10),\n\t\t\t\t\t\t\t\t3 => rand(0, $tmp_y - 3),\n\t\t\t\t\t\t\t\t4 => rand(0, $tmp_x - 10),\n\t\t\t\t\t\t\t\t5 => rand(0, $tmp_y - 3),\n\t\t\t\t\t\t\t\t6 => rand(0, $tmp_x - 10),\n\t\t\t\t\t\t\t\t7 => rand(0, $tmp_y - 3),\n\t\t\t\t\t\t\t\t8 => rand(0, $tmp_x - 10),\n\t\t\t\t\t\t\t\t9 => rand(0, $tmp_y - 3),\n\t\t\t\t\t\t\t\t10 => rand(0, $tmp_x - 10),\n\t\t\t\t\t\t\t\t11 => rand(0, $tmp_y - 3),\n\t\t\t\t\t\t );\n\n\t\t\t\t$randomcolor = imagecolorallocate( $tmp, rand(100,255), rand(100,255),rand(100,255) );\n\t\t\t\timagefilledpolygon($tmp, $values, 6, $randomcolor );\n\t\t\t}\n\n\t\t\t$num = strlen($content);\n\t\t\t$x_param = 0;\n\t\t\t$y_param = 0;\n\n\t\t\tfor( $i = 0; $i < $num; $i++ )\n\t\t\t{\n\t\t\t\t$x_param += rand(-1,12);\n\t\t\t\t$y_param = rand(-3,8);\n\t\t\t\t\n\t\t\t\tif( $x_param + 18 > $image_x )\n\t\t\t\t{\n\t\t\t\t\t$x_param -= ceil( $x_param + 18 - $image_x );\n\t\t\t\t}\n\n\t\t\t\t$randomcolor = imagecolorallocate( $tmp, rand(0,150), rand(0,150),rand(0,150) );\n\n\t\t\t\timagestring($tmp, 5, $x_param+1, $y_param+1, $content{$i}, $grey);\n\t\t\t\timagestring($tmp, 5, $x_param, $y_param, $content{$i}, $randomcolor);\n\t\t\t}\n\n\t\t\t//-----------------------------------------\n\t\t\t// Distort by resizing\n\t\t\t//-----------------------------------------\n\n\t\t\timagecopyresized($im, $tmp, 0, 0, 0, 0, $image_x, $image_y, $tmp_x, $tmp_y);\n\n\t\t\timagedestroy($tmp);\n\t\t\t\n\t\t\t//-----------------------------------------\n\t\t\t// Background dots and lines\n\t\t\t//-----------------------------------------\n\n\t\t\t$random_pixels = $image_x * $image_y / 10;\n\n\t\t\tfor ($i = 0; $i < $random_pixels; $i++)\n\t\t\t{\n\t\t\t\t$randomcolor = imagecolorallocate( $im, rand(0,150), rand(0,150),rand(0,150) );\n\t\t\t\tImageSetPixel($im, rand(0, $image_x), rand(0, $image_y), $randomcolor);\n\t\t\t}\n\n\t\t\t$no_x_lines = ($image_x - 1) / 5;\n\n\t\t\tfor ( $i = 0; $i <= $no_x_lines; $i++ )\n\t\t\t{\n\t\t\t\tImageLine( $im, $i * $no_x_lines, 0, $i * $no_x_lines, $image_y, $grey );\n\t\t\t\tImageLine( $im, $i * $no_x_lines, 0, ($i * $no_x_lines)+$no_x_lines, $image_y, $grey );\n\t\t\t}\n\n\t\t\t$no_y_lines = ($image_y - 1) / 5;\n\n\t\t\tfor ( $i = 0; $i <= $no_y_lines; $i++ )\n\t\t\t{\n\t\t\t\tImageLine( $im, 0, $i * $no_y_lines, $image_x, $i * $no_y_lines, $grey );\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t//-----------------------------------------\n\t\t\t// Can we use fonts?\n\t\t\t//-----------------------------------------\n\t\t\t\n\t\t\tif ( $allow_fonts AND function_exists('imagettftext') AND is_array( $fonts ) AND count( $fonts ) )\n\t\t\t{\n\t\t\t\tif ( function_exists('imageantialias') )\n\t\t\t\t{\n\t\t\t\t\timageantialias( $im, TRUE );\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t$num = strlen($content);\n\t\t\t\t$x_param = -18;\n\t\t\t\t$y_param = 0;\n\t\t\t\t$_font = $fonts[ mt_rand( 0, count( $fonts ) - 1 ) ];\n\t\t\t\t\n\t\t\t\tfor( $i = 0; $i < $num; $i++ )\n\t\t\t\t{\n\t\t\t\t\t$y_param = rand( 35, 48 );\n\t\t\t\t\t\n\t\t\t\t\t# Main color\n\t\t\t\t\t$col_r = rand(50,200);\n\t\t\t\t\t$col_g = rand(0,150);\n\t\t\t\t\t$col_b = rand(50,200);\n\t\t\t\t\t# High light\n\t\t\t\t\t$col_r_l = ( $col_r + 50 > 255 ) ? 255 : $col_r + 50;\n\t\t\t\t\t$col_g_l = ( $col_g + 50 > 255 ) ? 255 : $col_g + 50;\n\t\t\t\t\t$col_b_l = ( $col_b + 50 > 255 ) ? 255 : $col_b + 50;\n\t\t\t\t\t# Low light\n\t\t\t\t\t$col_r_d = ( $col_r - 50 < 0 ) ? 0 : $col_r - 50;\n\t\t\t\t\t$col_g_d = ( $col_g - 50 < 0 ) ? 0 : $col_g - 50;\n\t\t\t\t\t$col_b_d = ( $col_b - 50 < 0 ) ? 0 : $col_b - 50;\n\t\t\t\t\t\n\t\t\t\t\t$color_main = imagecolorallocate( $im, $col_r, $col_g, $col_b );\n\t\t\t\t\t$color_light = imagecolorallocate( $im, $col_r_l, $col_g_l, $col_b_l );\n\t\t\t\t\t$color_dark = imagecolorallocate( $im, $col_r_d, $col_g_d, $col_b_d );\n\t\t\t\t\t$_slant = mt_rand( -20, 40 );\n\t\t\t\t\t\n\t\t\t\t\tif ( $i == 1 OR $i == 3 OR $i == 5 )\n\t\t\t\t\t{\n\t\t\t\t\t\tfor( $ii = 0 ; $ii < 2 ; $ii++ )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$a = $x_param + 50;\n\t\t\t\t\t\t\t$b = mt_rand(0,100);\n\t\t\t\t\t\t\t$c = $a + 20;\n\t\t\t\t\t\t\t$d = $b + 20;\n\t\t\t\t\t\t\t$e = ( $i == 3 ) ? mt_rand( 280, 320 ) : mt_rand( -280, -320 );\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\timagearc( $im, $a , $b , $c, $d, 0, $e, $color_light );\n\t\t\t\t\t\t\timagearc( $im, $a+1, $b+1, $c, $d, 0, $e, $color_main );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif ( ! $_result = @imagettftext( $im, 24, $_slant, $x_param - 1, $y_param - 1, $color_light, $_font, $content{$i} ) )\n\t\t\t\t\t{\n\t\t\t\t\t\t$use_fonts = FALSE;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t@imagettftext( $im, 24, $_slant, $x_param + 1, $y_param + 1, $color_dark, $_font, $content{$i} );\n\t\t\t\t\t\t@imagettftext( $im, 24, $_slant, $x_param, $y_param, $color_main, $_font, $content{$i} );\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t$x_param += rand( 15, 18 );\n\t\t\t\t\t\n\t\t\t\t\tif( $x_param + 18 > $image_x )\n\t\t\t\t\t{\n\t\t\t\t\t\t$x_param -= ceil( $x_param + 18 - $image_x );\n\t\t\t\t\t}\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t$use_fonts = TRUE;\n\t\t\t}\n\t\t\t\n\t\t\tif ( ! $use_fonts )\n\t\t\t{\n\t\t\t\t//-----------------------------------------\n\t\t\t\t// Continue with nice background image\n\t\t\t\t//-----------------------------------------\n\t\t\t\n\t\t\t\t$tmp = imagecreatetruecolor($tmp_x , $tmp_y );\n\t\t\t\t$tmp2 = imagecreatetruecolor($image_x, $image_y);\n\t\t\n\t\t\t\t$white = imagecolorallocate( $tmp, 255, 255, 255 );\n\t\t\t\t$black = imagecolorallocate( $tmp, 0, 0, 0 );\n\t\t\t\t$grey = imagecolorallocate( $tmp, 100, 100, 100 );\n\t\t\t\t$transparent = imagecolorallocate( $tmp2, 255, 255, 255 );\n\t\t\t\t$_white = imagecolorallocate( $tmp2, 255, 255, 255 );\n\t\t\t\n\t\t\t\timagefill($tmp , 0, 0, $white );\n\t\t\t\timagefill($tmp2, 0, 0, $_white);\n\t\t\t\n\t\t\t\t$num = strlen($content);\n\t\t\t\t$x_param = 0;\n\t\t\t\t$y_param = 0;\n\n\t\t\t\tfor( $i = 0; $i < $num; $i++ )\n\t\t\t\t{\n\t\t\t\t\tif ( $i > 0 )\n\t\t\t\t\t{\n\t\t\t\t\t\t$x_param += rand( 6, 12 );\n\t\t\t\t\t\t\n\t\t\t\t\t\tif( $x_param + 18 > $image_x )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$x_param -= ceil( $x_param + 18 - $image_x );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\t$y_param = rand( 0, 5 );\n\t\t\t\t\n\t\t\t\t\t$randomcolor = imagecolorallocate( $tmp, rand(50,200), rand(50,200),rand(50,200) );\n\n\t\t\t\t\timagestring( $tmp, 5, $x_param + 1, $y_param + 1, $content{$i}, $grey );\n\t\t\t\t\timagestring( $tmp, 5, $x_param , $y_param , $content{$i}, $randomcolor );\n\t\t\t\t}\n\t\t\t\n\t\t\t\timagecopyresized($tmp2, $tmp, 0, 0, 0, 0, $image_x, $image_y, $tmp_x, $tmp_y );\n\t\t\t\n\t\t\t\t$tmp2 = $this->captcha_show_gd_img_wave( $tmp2, 8, true );\n\t\t\t\n\t\t\t\timagecolortransparent( $tmp2, $transparent );\n\t\t\t\timagecopymerge( $im, $tmp2, 0, 0, 0, 0, $image_x, $image_y, 100 );\n\t\t\n\t\t\t\timagedestroy($tmp);\n\t\t\t\timagedestroy($tmp2);\n\t\t\t}\n\t\t}\n\t\t\n\t\t//-----------------------------------------\n\t\t// Blur?\n\t\t//-----------------------------------------\n\t\t\n\t\tif ( function_exists( 'imagefilter' ) )\n\t\t{\n\t\t\t@imagefilter( $im, IMG_FILTER_GAUSSIAN_BLUR );\n\t\t}\n\t\t\n\t\t//-----------------------------------------\n\t\t// Render a border\n\t\t//-----------------------------------------\n\t\t\n\t\t$black = imagecolorallocate( $im, 0, 0, 0 );\n\t\t\n\t\timageline( $im, 0, 0, $image_x, 0, $black );\n\t\timageline( $im, 0, 0, 0, $image_y, $black );\n\t\timageline( $im, $image_x - 1, 0, $image_x - 1, $image_y, $black );\n\t\timageline( $im, 0, $image_y - 1, $image_x, $image_y - 1, $black );\n\t\t\n\t\t//-----------------------------------------\n\t\t// Show it!\n\t\t//-----------------------------------------\n\t\t\n\t\t@header( \"Content-Type: image/jpeg\" );\n\t\t\n\t\timagejpeg( $im );\n\t\timagedestroy( $im );\n\t\t\n\t\texit();\n\t}", "public function effectively_installed()\n {\n return isset($this->config['oxcom_phpbbch_format_only']);\n }", "function available() {\n\t\treturn function_exists('curl_init');\n\t}", "public function isAssetsEnabled(): bool\n {\n return config('theme-system.assets', true) ?? true;\n }", "function require_if_theme_supports($feature, $file)\n {\n }", "public function checkFeatureImplemented();", "private function _environmentCheck()\n {\n if ( php_sapi_name() != \"cli\" )\n {\n die(\"ArrowWorker hint : only run in command line mode\".PHP_EOL);\n }\n\n if ( !function_exists('pcntl_signal_dispatch') )\n {\n declare(ticks = 10);\n }\n\n if ( !function_exists('pcntl_signal') )\n {\n die('ArrowWorker hint : php environment do not support pcntl_signal'.PHP_EOL);\n }\n\n if ( function_exists('gc_enable') )\n {\n gc_enable();\n }\n\n }" ]
[ "0.7879122", "0.7671165", "0.73218316", "0.72018665", "0.71957904", "0.71631336", "0.71623176", "0.7110737", "0.7083069", "0.7068809", "0.6922137", "0.69061035", "0.6852401", "0.6835664", "0.6720914", "0.6707009", "0.66613716", "0.6656281", "0.656959", "0.6543717", "0.6363496", "0.6343485", "0.62690276", "0.6139636", "0.61291265", "0.611211", "0.6095011", "0.601914", "0.599678", "0.5889802", "0.58773977", "0.57989645", "0.57827365", "0.5761372", "0.57444525", "0.5732576", "0.5653754", "0.56434584", "0.56000215", "0.55414057", "0.54751086", "0.5468713", "0.54441786", "0.542605", "0.5416466", "0.5398116", "0.53846365", "0.53759545", "0.5358231", "0.5349618", "0.53478044", "0.53134847", "0.53030694", "0.52761424", "0.52645755", "0.5238281", "0.52313346", "0.52185327", "0.5194702", "0.5188884", "0.5142269", "0.5139462", "0.51272464", "0.51205325", "0.5098925", "0.50975513", "0.5090394", "0.5068766", "0.5068118", "0.5058038", "0.5053495", "0.5039294", "0.5022833", "0.5021777", "0.50182253", "0.50069886", "0.5001174", "0.50007945", "0.49822375", "0.49803683", "0.49692824", "0.4946921", "0.49465328", "0.4944814", "0.4940842", "0.49324554", "0.4930928", "0.49295714", "0.49282405", "0.49196315", "0.4919497", "0.49001622", "0.4894891", "0.48844644", "0.48834354", "0.48762202", "0.48704708", "0.48677278", "0.48602682", "0.48564705" ]
0.7528866
2
Destroys the loaded image to free up resources.
public function __destruct() { if (is_resource($this->_image)) { // Free all resources imagedestroy($this->_image); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function __destruct()\n {\n imagedestroy($this->image);\n }", "public function __destruct()\n {\n if ($this->image) {\n imagedestroy($this->image);\n }\n }", "public function destroy()\n {\n $this->_info = new stdClass();\n if( is_resource($this->_resource) )\n {\n imagedestroy($this->_resource);\n }\n }", "public function __destruct()\n {\n if (is_resource($this->image)) {\n // free up memory\n imagedestroy($this->image);\n }\n }", "public function destroyImage()\n {\n imagedestroy($this->image);\n imagedestroy($this->image_thumb);\n }", "public function __destruct()\n {\n if (is_resource($this->oldImage)) {\n imagedestroy($this->oldImage);\n }\n\n if (is_resource($this->workingImage)) {\n imagedestroy($this->workingImage);\n }\n }", "public function __destruct(){\n\n if(isset($this->image) && !empty($this->image)){\n imagedestroy($this->image);\n }\n }", "public function __destruct()\n {\n if (is_resource($this->tmpImage)) {\n // Free all resources\n imagedestroy($this->tmpImage);\n }\n }", "public function __destruct()\n {\n if(isset($this->image)) imageDestroy($this->image);\n if(isset($this->temp)) imageDestroy($this->temp);\n }", "public function __destruct()\n {\n //skip the `getImageResource` method because we don't want to load the resource just to destroy it\n if ($this->image) {\n $this->image->destroy();\n }\n // remove our temp file if it exists\n if (file_exists($this->getTempPath() ?? '')) {\n unlink($this->getTempPath() ?? '');\n }\n }", "public function destroyResourceImage(): void\n\t{\n\t\tif (isset($this->image)) {\n\t\t\t@imagedestroy($this->image->getImageResource());\n\t\t}\n\t}", "public function finish()\n {\n if($this->img)\n {\n imagedestroy($this->img);\n $this->img = null;\n }\n }", "function __destruct()\n\t{\n\t\timagedestroy($this->im);\n\t}", "public function __destruct()\n {\n imagedestroy($this->layout);\n foreach((array)$this->images as $image) {\n imagedestroy($image);\n }\n }", "Function unload(){\n\t\t$this->removeBackup();\n\t\tif($this->info && isset($this->info['im'])){\n\t\t\t@imagedestroy($this->info['im']);\n\t\t}\n\t\t$this->info = false;\n\t}", "private function intern_end()\n\t{\n\t\tif (is_resource($this->newImage)) imagedestroy($this->newImage );\n\t\tif (is_resource($this->newImage)) imagedestroy($this->srcImage );\n\t\t$this->newImage = null;\n\t\t$this->srcImage = null;\n\t}", "public function __destruct() {\r\n\t\t//header(\"Content-type: image/png\");\r\n\r\n\t\t/* show our work ... */\r\n\t\t//imagepng( $this->cutted_image );\r\n\r\n\t\t/* we have to cleaned up the mass before left ... */\r\n\t\timagedestroy( $this->original_image );\r\n\t\timagedestroy( $this->cutted_image );\r\n\r\n\t\t/* so ... how do you think about this ...? */\r\n\t}", "public function deleteImage(){\n if(file_exists($this->getImage())){\n unlink($this->getImage());\n }\n $this->setImage(null);\n }", "function close() \n { \n if(is_resource($this->_image)) \n { \n @imagedestroy($this->_image); \n } \n $this->_isImageResource=is_resource($this->_image); \n }", "protected function tearDown() {\n imagedestroy($this->image);\n }", "public function destroy(Image $image)\n {\n //\n }", "public function destroy(Image $image)\n {\n //\n }", "public function destroy(Image $image)\n {\n //\n }", "public function removeImage() {\n //check if we have an old image\n if ($this->image) {\n //store the old name to delete the image on the upadate\n $this->temp = $this->image;\n //delete the current image\n $this->setImage(NULL);\n }\n }", "public static function deleteImage(){}", "public function __destruct() {\n\t\t\tparent::__destruct();\n\t\t\tunset($this->data);\n\t\t\tunset($this->file);\n\t\t\tunset($this->image);\n\t\t\tunset($this->uri);\n\t\t}", "public function deleteImage(){\n \tStorage::delete($this->image);\n }", "public function __destruct()\n {\n if (file_exists($this->tempFilesFromFilename)) {\n unlink($this->tempFilesFromFilename);\n }\n }", "public function destroy($delete = false)\n {\n if (null !== $this->resource) {\n $this->resource->clear();\n $this->resource->destroy();\n }\n\n $this->resource = null;\n clearstatcache();\n\n // If the $delete flag is passed, delete the image file.\n if (($delete) && file_exists($this->name)) {\n unlink($this->name);\n }\n }", "public function destroy(Image $image)\n {\n $image->delete();\n }", "public function __destruct()\n {\n if (file_exists($this->filename)) {\n unlink($this->filename);\n }\n\n foreach ($this->tempFiles as $file) {\n $this->filesystem->remove($file);\n }\n }", "public function __destruct() {\n if (file_exists($this->tempFile)) {\n unlink($this->tempFile);\n }\n }", "function __destruct() {\r\n\t\tunlink($this->uploadfile);\r\n\t}", "public function clear()\n {\n try {\n $this->imagick->clear();\n $this->imagick->destroy();\n } catch (Exception $e) {\n\n }\n }", "public function teardown()\n {\n if ($this->csvFile) {\n unlink($this->csvFile);\n $this->csvFile = null;\n }\n\n if ($this->photoZip) {\n unlink($this->photoZip);\n $this->photoZip = null;\n }\n }", "public function __destruct()\n {\n @unlink($this->path);\n }", "public function __destruct() {\n\t\tif (file_exists($this->fileName) && (!$this->cache)) {\n\t\t\tunlink($this->fileName);\n\t\t}\n\t}", "public function __destruct() {\n if ($this->fileHandle) {\n fclose($this->fileHandle);\n }\n\n $this->generator = null;\n }", "public function destroyResource() {\n if (isset($this->_resource)) {\n imagedestroy($this->_resource);\n } else {\n trigger_error(\"CAMEMISResizeImage::destroyResource() attempting to access a non-existent resource (check if the image was loaded by CAMEMISResizeImage::__construct())\", E_USER_WARNING);\n }\n\n return $this;\n }", "public function cleanup() {\r\n\t\t$this->resource->cleanup();\r\n\t}", "public function __destruct() {\n\t\tif(isset($this->tmpPath) && file_exists($this->tmpPath)) {\n\t\t\tunlink($this->tmpPath);\n\t\t}\n\t}", "public static function destroy();", "public function __destruct()\n\t{\n\t\t$this->delete_local_file();\n\t}", "public function __destruct()\n {\n unset($this->file_info);\n }", "function destructor()\n\t{\n\t\tunset($Resources,$FileName,$FileType,$FileSize,$NumRes,$FileVersion,$Description,$DataOffset);\n\t}", "private function flushImageCache()\n {\n $this->imagesCache = null;\n $this->variantImages = null;\n }", "public function __destruct()\n {\n if ($this->uri) {\n librdf_free_uri($this->uri);\n }\n }", "public function destroy();", "public function destroy();", "public function destroy();", "public function destroy();", "public function destroy();", "public function destroy();", "public function destroy();", "function removeImage() {\n\t\t\n $image = $this->getImageByImageId();\n \n $file_image = $this->dir_path.$image['path_image'];\n\n $this->deleteImage(array('image_id' => $image['image_id'] ));\n\n if(file_exists($file_image)) {\n @unlink($file_image);\n }\n\t\t\n\t}", "public static function destroy() {}", "public function destroy() {\n\t\tif($this->delete()) {\n\t\t\t// then remove the file\n\t\t // Note that even though the database entry is gone, this object \n\t\t\t// is still around (which lets us use $this->image_path()).\n\t\t\t$target_path = SITE_ROOT.DS.'public'.DS.$this->image_path();\n\t\t\treturn unlink($target_path) ? true : false;\n\t\t} else {\n\t\t\t// database delete failed\n\t\t\treturn false;\n\t\t}\n\t}", "protected function cleanup() {\n\t\tif(isset($this->data['attachment'])) {\n\t\t\tunlink($this->data['attachment']);\n\t\t}\n\t\tparent::cleanup();\n\t}", "public function removeImage()\n {\n // Suppression de l'image principale\n $fichier = $this->getAbsolutePath();\n\n if (file_exists($fichier))\n {\n unlink($fichier);\n }\n\n // Suppression des thumbnails\n foreach($this->thumbnails as $key => $thumbnail)\n {\n $thumb = $this->getUploadRootDir() . '/' . $key . '-' . $this->name;\n if (file_exists($thumb))\n {\n unlink($thumb);\n }\n }\n }", "public function __destruct()\r\n\t{\r\n\t\t@unlink($this->targetFile);\r\n\t\tif (strcmp($this->referenceFile, $this->outputReferenceFile) !== 0)\r\n\t\t\t@unlink($this->referenceFile);\r\n\t}", "public function __destruct(){\n\t\tif( !empty( $this->upload ) )\t\t\t\t\t\t\t\t\t\t// upload is set\n\t\t\tif( !empty( $this->upload->tmp_name ) )\t\t\t\t\t\t\t// file has been uploaded\n\t\t\t\tif( file_exists( $this->upload->tmp_name ) )\t\t\t\t// uploaded file is still existing\n\t\t\t\t\t@unlink( $this->upload->tmp_name );\t\t\t\t\t\t// remove originally uploaded file\n\t}", "private function flushMemory($img, $newImage): void\n {\n imagedestroy($newImage);\n imagedestroy($img);\n }", "protected function forceDestory()\n {\n if ($this->isGdResource($this->getHandler())) {\n $this->destroy();\n }\n }", "private function flushImageCache(): void\n {\n $this->imagesCache = null;\n $this->variantImages = null;\n }", "public function deleteImage(){\n\n\n Storage::delete($this->image);\n }", "function _ddb_cover_upload_cleanup() {\n $data = _ddb_cover_upload_session('ddb_cover_upload_submitted');\n\n // Mark image as upload to prevent more uploads of the same data.\n _ddb_cover_upload_session('ddb_cover_upload_submitted', '');\n\n // Remove local copy of the image.\n file_unmanaged_delete($data['image_uri']);\n}", "public function destroy(ImgUplode $imgUplode)\n {\n //\n }", "public function __destruct()\n {\n if($this->_gc_temp_files === true && empty($this->_tmp_files) === false)\n {\n foreach ($this->_tmp_files as $path)\n {\n if(is_file($path) === true)\n {\n @unlink($path);\n }\n }\n }\n }", "protected function typo3CleanUp($imageResource) {\n \t$GLOBALS['TYPO3_DB']->exec_DELETEquery(\n\t\t\t'cache_imagesizes',\n\t\t\t'filename=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($imageResource[3], 'cache_imagesizes')\n \t);\n \t\n \tunset($GLOBALS['TSFE']->tmpl->fileCache[$imageResource['fileCacheHash']]);\n }", "public function tearDown()\n {\n $output = $this->path . self::OUTPUT_IMAGE_GIF;\n if (file_exists($output)) {\n unlink($output);\n }\n }", "public function destroy()\n {\n /**\n * We don't clean up swap because of performance considerations\n * Cleaning is performed by Memory Manager destructor\n */\n\n $this->_memManager->unlink($this, $this->_id);\n }", "public function close()\n {\n ps_close_image($this->document->resource, $this->id);\n call_user_func($this->dtor);\n\n $this->document = $this->dtor = null;\n }", "private function finalize()\n {\n $this->temp_files_path[] = L_FRAME_LIST_FILE;\n $this->delete_files();\n }", "public function remove_image() {\n\t\t$this->join_name = \"images\";\n\t\t$this->use_layout=false;\n\t\t$this->page = new $this->model_class(Request::get('id'));\n\t\t$image = new WildfireFile($this->param(\"image\"));\n\t\t$this->page->images->unlink($image);\n\t}", "public function __destruct()\n {\n unlink($this->tmpListFile);\n }", "abstract protected function _destroy();", "public function __destruct()\n {\n DirectoryRemover::remove($this->path);\n }", "public function __destruct()\n {\n //$this->deletePath($this->path);\n }", "function destroy() ;", "public function deleteldImage() {\n\n if (!empty($this->oldImg) && $this->oldImg != $this->avatar) {\n $file = Yii::app()->basePath . DIRECTORY_SEPARATOR . \"..\" . DIRECTORY_SEPARATOR;\n $file.= \"uploads\" . DIRECTORY_SEPARATOR . \"user_profile\" . DIRECTORY_SEPARATOR . $this->user->primaryKey . DIRECTORY_SEPARATOR . $this->oldImg;\n\n DTUploadedFile::deleteExistingFile($file);\n }\n }", "public function __destruct() {\r\n if (isset($this->handle)) {\r\n $this->transaction_finish();\r\n }\r\n if ($this->option_remove) {\r\n @unlink($this->file);\r\n }\r\n }", "function __destroy() {\n }", "public function __destroy()\n {\n $this->close();\n }", "public function __destruct()\n {\n unset($this->binaryReaderEntity);\n }", "public function destroy()\n\t{\n\t\t//\n\t}", "public function destroy() {}", "public function destroy() {}", "public function destroy() {}", "public function destroy() {}", "public function destroy() {}", "public function destroy() {}", "public function cleanup()\n\t{\n\t\t$this->getObject()->cleanup();\n\t}", "public function __destruct() {\n\t\tif ( $this->aFiles !== null )\n\t\t\tunset( $this->aFiles );\n\t}", "public function destroy($id)\n {\n Img::destroy($id);\n }", "public function __destruct(){\n \n fclose( $this->getFilePointer() );\n \n }", "public function __destruct() {\n\t\t$filesystem = $this->filesystem;\n\t\t$this->tmpFiles->each(function($filePath) use($filesystem){\n\t\t\t$filesystem->delete($filePath);\n\t\t});\n\t}", "public static function destroy()\n {\n self::$instance = NULL;\n }", "public function __destruct() {\n fclose($this->file);\n }", "public function __destruct()\n {\n if ($this->resource != null) fclose($this->resource);\n }", "public function cleanImagesAction()\n {\n parent::cleanImagesAction();\n $this->clearRespizrImageCache();\n }" ]
[ "0.8348592", "0.8333889", "0.83176297", "0.82952803", "0.8217895", "0.8199644", "0.8177189", "0.8166292", "0.81604576", "0.8083442", "0.807078", "0.79993165", "0.7846122", "0.7843388", "0.77906746", "0.7614439", "0.75315934", "0.749144", "0.7468518", "0.7460305", "0.7009431", "0.7009431", "0.7009431", "0.70008826", "0.699158", "0.6935666", "0.68887925", "0.6850498", "0.6850162", "0.6845751", "0.6792395", "0.67898375", "0.67593396", "0.67562366", "0.6743543", "0.6732122", "0.6723958", "0.66806966", "0.6674992", "0.66626257", "0.66602725", "0.6638181", "0.6637271", "0.6635281", "0.66352713", "0.6600221", "0.6571339", "0.65585357", "0.65585357", "0.65585357", "0.65585357", "0.65585357", "0.65585357", "0.65585357", "0.65582293", "0.6552321", "0.6534802", "0.6534281", "0.6532289", "0.65195197", "0.6518098", "0.6515943", "0.6506908", "0.64889055", "0.6484113", "0.646999", "0.6456034", "0.6453144", "0.6433553", "0.6429474", "0.64178234", "0.6391671", "0.63849926", "0.6376959", "0.63656396", "0.6356009", "0.6349977", "0.6336017", "0.6328582", "0.6310317", "0.6298032", "0.6297431", "0.62868875", "0.6272786", "0.6263801", "0.62451327", "0.62451327", "0.62451327", "0.62451327", "0.62451327", "0.624367", "0.6233894", "0.623108", "0.6223633", "0.6221033", "0.62148017", "0.6206735", "0.6193229", "0.61921936", "0.61773026" ]
0.82734156
4
Resize the image to the given size. Either the width or the height can be omitted and the image will be resized proportionally. // Resize to 200 pixels on the shortest side $image>resize(200, 200); // Resize to 200x200 pixels, keeping aspect ratio $image>resize(200, 200, Image::INVERSE); // Resize to 500 pixel width, keeping aspect ratio $image>resize(500, NULL); // Resize to 500 pixel height, keeping aspect ratio $image>resize(NULL, 500); // Resize to 200x500 pixels, ignoring aspect ratio $image>resize(200, 500, Image::NONE);
public function resize($width = NULL, $height = NULL, $master = NULL) { if ($master === NULL) { // Choose the master dimension automatically $master = Image::AUTO; } // Image::WIDTH and Image::HEIGHT depricated. You can use it in old projects, // but in new you must pass empty value for non-master dimension elseif ($master == Image::WIDTH AND ! empty($width)) { $master = Image::AUTO; // Set empty height for backvard compatibility $height = NULL; } elseif ($master == Image::HEIGHT AND ! empty($height)) { $master = Image::AUTO; // Set empty width for backvard compatibility $width = NULL; } if (empty($width)) { if ($master === Image::NONE) { // Use the current width $width = $this->width; } else { // If width not set, master will be height $master = Image::HEIGHT; } } if (empty($height)) { if ($master === Image::NONE) { // Use the current height $height = $this->height; } else { // If height not set, master will be width $master = Image::WIDTH; } } switch ($master) { case Image::AUTO: // Choose direction with the greatest reduction ratio $master = ($this->width / $width) > ($this->height / $height) ? Image::WIDTH : Image::HEIGHT; break; case Image::INVERSE: // Choose direction with the minimum reduction ratio $master = ($this->width / $width) > ($this->height / $height) ? Image::HEIGHT : Image::WIDTH; break; } switch ($master) { case Image::WIDTH: // Recalculate the height based on the width proportions $height = $this->height * $width / $this->width; break; case Image::HEIGHT: // Recalculate the width based on the height proportions $width = $this->width * $height / $this->height; break; } // Convert the width and height to integers $width = round($width); $height = round($height); $this->_do_resize($width, $height); return $this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function resize($width, $height = null);", "public function resizeTo($width, $height, $resizeOption = 'default') {\n switch (strtolower($resizeOption)) {\n case 'exact':\n $this->resizeWidth = $width;\n $this->resizeHeight = $height;\n break;\n case 'maxwidth':\n $this->resizeWidth = $width;\n $this->resizeHeight = $this->resizeHeightByWidth($width);\n break;\n case 'maxheight':\n $this->resizeWidth = $this->resizeWidthByHeight($height);\n $this->resizeHeight = $height;\n break;\n case 'proportionally':\n $ratio_orig = $this->origWidth / $this->origHeight;\n $this->resizeWidth = $width;\n $this->resizeHeight = $height;\n if ($width / $height > $ratio_orig)\n $this->resizeWidth = $height * $ratio_orig;\n else\n $this->resizeHeight = $width / $ratio_orig;\n break;\n default:\n if ($this->origWidth > $width || $this->origHeight > $height) {\n if ($this->origWidth > $this->origHeight) {\n $this->resizeHeight = $this->resizeHeightByWidth($width);\n $this->resizeWidth = $width;\n } else if ($this->origWidth < $this->origHeight) {\n $this->resizeWidth = $this->resizeWidthByHeight($height);\n $this->resizeHeight = $height;\n } else {\n $this->resizeWidth = $width;\n $this->resizeHeight = $height;\n }\n } else {\n $this->resizeWidth = $width;\n $this->resizeHeight = $height;\n }\n break;\n }\n\n $this->newImage = imagecreatetruecolor($this->resizeWidth, $this->resizeHeight);\n if ($this->ext == \"image/gif\" || $this->ext == \"image/png\") {\n imagealphablending($this->newImage, false);\n imagesavealpha($this->newImage, true);\n $transparent = imagecolorallocatealpha($this->newImage, 255, 255, 255, 127);\n imagefilledrectangle($this->newImage, 0, 0, $this->resizeWidth, $this->resizeHeight, $transparent);\n }\n imagecopyresampled($this->newImage, $this->image, 0, 0, 0, 0, $this->resizeWidth, $this->resizeHeight, $this->origWidth, $this->origHeight);\n }", "public function resize(IImageInformation $src, $width, $height);", "public function resize_fit(IImageInformation $src, $width, $height);", "public function ratioResize($file, $width=null, $height=null, $rename='') {\n\n $file = $this->uploadPath . $file;\n $imginfo = $this->getInfo($file);\n\n if ($rename == '')\n $newName = substr($imginfo['name'], 0, strrpos($imginfo['name'], '.')) . $this->thumbSuffix . '.' . $this->generatedType;\n else\n $newName = $rename . '.' . $this->generatedType;\n\n if ($width === null && $height === null) {\n return false;\n } elseif ($width !== null && $height === null) {\n $resizeWidth = $width;\n $resizeHeight = ($width / $imginfo['width']) * $imginfo['height'];\n } elseif ($width === null && $height !== null) {\n $resizeWidth = ($height / $imginfo['height']) * $imginfo['width'];\n $resizeHeight = $height;\n } else {\n\t\t\t\n\t\t\tif($imginfo['width'] < $width and $imginfo['height'] < $height) {\n\t\t\t\t$width = $imginfo['width'];\n\t\t\t\t$height = $imginfo['height'];\n\t\t\t}\n\t\t\t\n if ($imginfo['width'] > $imginfo['height']) {\n $resizeWidth = $width;\n $resizeHeight = ($width / $imginfo['width']) * $imginfo['height'];\n } else {\n $resizeWidth = ($height / $imginfo['height']) * $imginfo['width'];\n $resizeHeight = $height;\n }\n }\n\n //create image object based on the image file type, gif, jpeg or png\n $this->createImageObject($img, $imginfo['type'], $file);\n if (!$img)\n return false;\n\n if (function_exists('imagecreatetruecolor')) {\n $newImg = imagecreatetruecolor($resizeWidth, $resizeHeight);\n imagecopyresampled($newImg, $img, 0, 0, 0, 0, $resizeWidth, $resizeHeight, $imginfo['width'], $imginfo['height']);\n } else {\n $newImg = imagecreate($resizeWidth, $resizeHeight);\n imagecopyresampled($newImg, $img, ($width - $resizeWidth) / 2, ($height - $resizeHeight) / 2, 0, 0, $resizeWidth, $resizeHeight, $imginfo['width'], $imginfo['height']);\n }\n\n imagedestroy($img);\n\n if ($this->saveFile) {\n //delete if exist\n if (file_exists($this->processPath . $newName))\n unlink($this->processPath . $newName);\n $this->generateImage($newImg, $this->processPath . $newName);\n imagedestroy($newImg);\n return $this->processPath . $newName;\n }\n else {\n $this->generateImage($newImg);\n imagedestroy($newImg);\n }\n\n return true;\n }", "function imgResize($filename, $newWidth, $newHeight, $dir_out){\n\t\n\t// изменение размера изображения\n\n\t// 1 создадим новое изображение из файла\n\t$scr = imagecreatefromjpeg($filename); // или $imagePath\n\t\n\t// 2 создадим новое полноцветное изображение нужного размера\n\t$newImg = imagecreatetruecolor($newWidth, $newHeight);\n\n\t// 3 определим размер исходного изображения для 4 пункта\n\t$size = getimagesize($filename);\n\n\t// 4 копирует прямоугольную часть одного изображения на другое изображение, интерполируя значения пикселов таким образом, чтобы уменьшение размера изображения не уменьшало его чёткости\n\timagecopyresampled($newImg, $scr, 0, 0, 0, 0, $newWidth, $newHeight, $size[0], $size[1]);\n\n\t// 5 запишем изображение в файл по нужному пути\n\timagejpeg($newImg, $dir_out);\n\n\timagedestroy($scr);\n\timagedestroy($newImg);\t\t\n\t\n}", "function resize_image($src, $width, $height){\n // initializing\n $save_path = Wordless::theme_temp_path();\n $img_filename = Wordless::join_paths($save_path, md5($width . 'x' . $height . '_' . basename($src)) . '.jpg');\n\n // if file doesn't exists, create it\n if (!file_exists($img_filename)) {\n $to_scale = 0;\n $to_crop = 0;\n\n // Get orig dimensions\n list ($width_orig, $height_orig, $type_orig) = getimagesize($src);\n\n // get original image ... to improve!\n switch($type_orig){\n case IMAGETYPE_JPEG: $image = imagecreatefromjpeg($src);\n break;\n case IMAGETYPE_PNG: $image = imagecreatefrompng($src);\n break;\n case IMAGETYPE_GIF: $image = imagecreatefromgif($src);\n break;\n default:\n return;\n }\n\n // which is the new smallest?\n if ($width < $height)\n $min_dim = $width;\n else\n $min_dim = $height;\n\n // which is the orig smallest?\n if ($width_orig < $height_orig)\n $min_orig = $width_orig;\n else\n $min_orig = $height_orig;\n\n // image of the right size\n if ($height_orig == $height && $width_orig == $width) ; // nothing to do\n // if something smaller => scale\n else if ($width_orig < $width) {\n $to_scale = 1;\n $ratio = $width / $width_orig;\n }\n else if ($height_orig < $height) {\n $to_scale = 1;\n $ratio = $height / $height_orig;\n }\n // if both bigger => scale\n else if ($height_orig > $height && $width_orig > $width) {\n $to_scale = 1;\n $ratio_dest = $width / $height;\n $ratio_orig = $width_orig / $height_orig;\n if ($ratio_dest > $ratio_orig)\n $ratio = $width / $width_orig;\n else\n $ratio = $height / $height_orig;\n }\n // one equal one bigger\n else if ( ($width == $width_orig && $height_orig > $height) || ($height == $height_orig && $width_orig > $width) )\n $to_crop = 1;\n // some problem...\n else\n echo \"ALARM\";\n\n // we need to zoom to get the right size\n if ($to_scale == 1) {\n $new_width = $width_orig * $ratio;\n $new_height = $height_orig * $ratio;\n $image_scaled = imagecreatetruecolor($new_width, $new_height);\n // scaling!\n imagecopyresampled($image_scaled, $image, 0, 0, 0, 0, $new_width, $new_height, $width_orig, $height_orig);\n $image = $image_scaled;\n\n if($new_width > $width || $new_height > $height)\n $to_crop = 1;\n }\n else {\n $new_width = $width_orig;\n $new_height = $height_orig;\n }\n\n // we need to crop the image\n if ($to_crop == 1) {\n $image_cropped = imagecreatetruecolor($width, $height);\n\n // find margins for images\n $margin_x = ($new_width - $width) / 2;\n $margin_y = ($new_height - $height) / 2;\n\n // cropping!\n imagecopy($image_cropped, $image, 0, 0, $margin_x, $margin_y, $width, $height);\n $image = $image_cropped;\n }\n\n // Save image\n imagejpeg($image, $img_filename, 95);\n }\n\n // Return image URL\n return Wordless::join_paths(Wordless::theme_temp_path(), basename($img_filename));\n }", "public function resize($width, $height, $crop_top = 0, $crop_bottom = 0, $crop_left = 0, $crop_right = 0) {}", "public function shrink($width = 0, $height = 0, $enlarge=false) {\n\n //if ($scale > 1) {\n // $scale = 1;\n //}\n\n //$this->resizeWithScale($this->info['width'] * $scale, $this->info['height'] * $scale, $scale);\n //$this->resizeWithScaleExact($width, $height, 1);\n\n //$this->resizeWithScale($width, $height, $scale);\n\n\t\t//$scale=$width/$height;\n //$this->resizeWithScale($this->info['width'] * $scale, $this->info['height'] * $scale, $scale);\n\n\t\t$s_ratio = $this->info['width']/$this->info['height'];\n\t\t$d_ratio = $width/$height;\n\n if ( $s_ratio > $d_ratio )\n {\n $cwidth = $this->info['width'];\n $cheight = round($this->info['width']*(1/$d_ratio));\n }\n elseif( $s_ratio < $d_ratio )\n {\n $cwidth = round($this->info['height']*$d_ratio);\n $cheight = $this->info['height'];\n }\n else\n {\n $cwidth = $this->info['width'];\n $cheight = $this->info['height'];\n }\n\n\t\tif ( ($this->info['width']<=$width) && ($this->info['height']<=$height) && !$enlarge )\n\t\t{\n\t\t\t$this->resizeWithScaleExact($cwidth, $cheight, 1);\n\t\t}\n\t\telse\n\t\t{\n\t $this->resizeWithScaleExact($width, $height, 1);\n\t\t}\n }", "function resize_square($size){\n\n //container for new image\n $new_image = imagecreatetruecolor($size, $size);\n\n\n if($this->width > $this->height){\n $this->resize_by_height($size);\n\n imagecolortransparent($new_image, imagecolorallocate($new_image, 0, 0, 0));\n imagealphablending($new_image, false);\n imagesavealpha($new_image, true);\n imagecopy($new_image, $this->image, 0, 0, ($this->get_width() - $size) / 2, 0, $size, $size);\n }else{\n $this->resize_by_width($size);\n\n imagecolortransparent($new_image, imagecolorallocate($new_image, 0, 0, 0));\n imagealphablending($new_image, false);\n imagesavealpha($new_image, true);\n imagecopy($new_image, $this->image, 0, 0, 0, ($this->get_height() - $size) / 2, $size, $size);\n }\n\n $this->image = $new_image;\n\n //reset sizes\n $this->width = $size;\n $this->height = $size;\n\n return true;\n }", "public function resize($width, $height)\n\t{\n\t\t$wScale = $this->width / $width;\n\t\t$hScale = $this->height / $height;\n\t\t$maxScale = max($wScale, $hScale);\n\t\t// Decrease image dimensions\n\t\tif($maxScale > 1)\n\t\t{\n\t\t\t$width = $this->width / $maxScale;\n\t\t\t$height = $this->height / $maxScale;\n\t\t}\n\t\t// Increase image dimensions\n\t\telse\n\t\t{\n\t\t\t$minScale = min($wScale, $hScale);\n\t\t\t$width = $this->width / $minScale;\n\t\t\t$height = $this->height / $minScale;\n\t\t}\n\t\t$image = imagecreatetruecolor($this->width, $this->height);\n\t\timagecopyresampled($image, $this->image, 0, 0, 0, 0, $width, $height, $this->width, $this->height);\n\n\t\t$this->image = $image;\n\t\t$this->width = $width;\n\t\t$this->height = $height;\n\t}", "function resize($width,$height)\n {\n $new_image = imagecreatetruecolor($width, $height);\n imagecopyresampled($new_image, $this->image, 0, 0, 0, 0, $width, $height, $this->getWidth(), $this->getHeight());\n $this->image = $new_image; \n }", "private function resizeImage($filename, $width, $height)\n {\n $config['image_library'] = 'gd2';\n $config['create_thumb'] = TRUE;\n $config['maintain_ratio'] = TRUE;\n $config['width'] = $width;\n $config['height'] = $height;\n $config['source_image'] = $filename;\n $this->load->library('image_lib', $config);\n $this->image_lib->resize();\n }", "public function ImageResize($file_resize_width, $file_resize_height){\r\n $this->proc_filewidth=$file_resize_width;\r\n $this->proc_fileheight=$file_resize_height;\r\n }", "function resizeImage($image,$width,$height,$scale) {\n\t\t\t\tlist($imagewidth, $imageheight, $imageType) = getimagesize($image);\n\t\t\t\t$imageType = image_type_to_mime_type($imageType);\n\t\t\t\t$newImageWidth = ceil($width * $scale);\n\t\t\t\t$newImageHeight = ceil($height * $scale);\n\t\t\t\t$newImage = imagecreatetruecolor($newImageWidth,$newImageHeight);\n\t\t\t\tswitch($imageType) {\n\t\t\t\t\tcase \"image/gif\":\n\t\t\t\t\t\t$source=imagecreatefromgif($image);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"image/pjpeg\":\n\t\t\t\t\tcase \"image/jpeg\":\n\t\t\t\t\tcase \"image/jpg\":\n\t\t\t\t\t\t$source=imagecreatefromjpeg($image);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"image/png\":\n\t\t\t\t\tcase \"image/x-png\":\n\t\t\t\t\t\t$source=imagecreatefrompng($image);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\timagecopyresampled($newImage,$source,0,0,0,0,$newImageWidth,$newImageHeight,$width,$height);\n\t\t\t\n\t\t\t\tswitch($imageType) {\n\t\t\t\t\tcase \"image/gif\":\n\t\t\t\t\t\timagegif($newImage,$image);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"image/pjpeg\":\n\t\t\t\t\tcase \"image/jpeg\":\n\t\t\t\t\tcase \"image/jpg\":\n\t\t\t\t\t\timagejpeg($newImage,$image,90);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"image/png\":\n\t\t\t\t\tcase \"image/x-png\":\n\t\t\t\t\t\timagepng($newImage,$image);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\n\t\t\t\tchmod($image, 0777);\n\t\t\t\treturn $image;\n\t\t\t}", "protected function resize()\n {\n $width = $this->width;\n $height = $this->height;\n $orig_width = imagesx($this->image);\n $orig_height = imagesy($this->image);\n \n // Determine new image dimensions\n if($this->mode === \"crop\"){ // Crop image\n \n $max_width = $crop_width = $width;\n $max_height = $crop_height = $height;\n \n $x_ratio = @($max_width / $orig_width);\n $y_ratio = @($max_height / $orig_height);\n \n if($orig_width > $orig_height){ // Original is wide\n $height = $max_height;\n $width = ceil($y_ratio * $orig_width);\n \n } elseif($orig_height > $orig_width){ // Original is tall\n $width = $max_width;\n $height = ceil($x_ratio * $orig_height);\n \n } else { // Original is square\n $this->mode = \"fit\";\n \n return $this->resize();\n }\n \n // Adjust if the crop width is less than the requested width to avoid black lines\n if($width < $crop_width){\n $width = $max_width;\n $height = ceil($x_ratio * $orig_height);\n }\n \n } elseif($this->mode === \"fit\"){ // Fits the image according to aspect ratio to within max height and width\n $max_width = $width;\n $max_height = $height;\n \n $x_ratio = @($max_width / $orig_width);\n $y_ratio = @($max_height / $orig_height);\n \n if( ($orig_width <= $max_width) && ($orig_height <= $max_height) ){ // Image is smaller than max height and width so don't resize\n $tn_width = $orig_width;\n $tn_height = $orig_height;\n \n } elseif(($x_ratio * $orig_height) < $max_height){ // Wider rather than taller\n $tn_height = ceil($x_ratio * $orig_height);\n $tn_width = $max_width;\n \n } else { // Taller rather than wider\n $tn_width = ceil($y_ratio * $orig_width);\n $tn_height = $max_height;\n }\n \n $width = $tn_width;\n $height = $tn_height;\n \n } elseif($this->mode === \"fit-x\"){ // Sets the width to the max width and the height according to aspect ratio (will stretch if too small)\n $height = @round($orig_height * $width / $orig_width);\n \n if($orig_height <= $height){ // Don't stretch if smaller\n $width = $orig_width;\n $height = $orig_height;\n }\n \n } elseif($this->mode === \"fit-y\"){ // Sets the height to the max height and the width according to aspect ratio (will stretch if too small)\n $width = @round($orig_width * $height / $orig_height);\n \n if($orig_width <= $width){ // Don't stretch if smaller\n $width = $orig_width;\n $height = $orig_height;\n }\n } else {\n throw new \\Exception('Invalid mode: ' . $this->mode);\n }\n \n\n // Resize\n $this->temp = imagecreatetruecolor($width, $height);\n \n // Preserve transparency if a png\n if($this->image_info['mime'] == 'image/png'){\n imagealphablending($this->temp, false);\n imagesavealpha($this->temp, true);\n }\n \n imagecopyresampled($this->temp, $this->image, 0, 0, 0, 0, $width, $height, $orig_width, $orig_height);\n $this->sync();\n \n \n // Cropping?\n if($this->mode === \"crop\"){ \n $orig_width = imagesx($this->image);\n $orig_height = imagesy($this->image);\n \n $x_mid = $orig_width/2; // horizontal middle\n $y_mid = $orig_height/2; // vertical middle\n \n $this->temp = imagecreatetruecolor($crop_width, $crop_height);\n \n // Preserve transparency if a png\n if($this->image_info['mime'] == 'image/png'){\n imagealphablending($this->temp, false);\n imagesavealpha($this->temp, true);\n }\n\n imagecopyresampled($this->temp, $this->image, 0, 0, ($x_mid-($crop_width/2)), ($y_mid-($crop_height/2)), $crop_width, $crop_height, $crop_width, $crop_height);\n $this->sync();\n }\n }", "function resize($width, $height){\n\n $new_image = imagecreatetruecolor($width, $height);\n\n imagecolortransparent($new_image, imagecolorallocate($new_image, 0, 0, 0));\n imagealphablending($new_image, false);\n imagesavealpha($new_image, true);\n\n imagecopyresampled($new_image, $this->image, 0, 0, 0, 0, $width, $height, $this->get_width(), $this->get_height());\n $this->image = $new_image;\n\n //reset sizes\n $this->width = $width;\n $this->height = $height;\n\n return true;\n }", "function resizeImage($input,$output,$wid,$hei,$auto=false,$quality=80) {\n\n\t// File and new size\n\t//the original image has 800x600\n\t$filename = $input;\n\t//the resize will be a percent of the original size\n\t$percent = 0.5;\n\n\t// Get new sizes\n\tlist($width, $height) = getimagesize($filename);\n\t$newwidth = $wid;//$width * $percent;\n\t$newheight = $hei;//$height * $percent;\n\tif($auto) {\n\t\tif($width>$height) {\n\t\t\t$newheight=$wid*0.75;\n\t\t} else if($height>$width) {\n\t\t\t$newwidth=$hei*0.75;\n\t\t}\n\t}\n\n\t// Load\n\t$thumb = imagecreatetruecolor($newwidth, $newheight);\n\t$source = imagecreatefromjpeg($filename);\n\n\t// Resize\n\timagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);\n\n\t// Output and free memory\n\t//the resized image will be 400x300\n\timagejpeg($thumb,$output,$quality);\n\timagedestroy($thumb);\n}", "public function resize($width=null, $height=null, $master=null);", "function funcs_imageResize(&$width, &$height, $target, $bywidth = null) {\n\tif ($width<=$target && $height<=$target){\n\t\treturn;\n\t}\n\t//takes the larger size of the width and height and applies the \n\t//formula accordingly...this is so this script will work \n\t//dynamically with any size image \n\tif (is_null($bywidth)){\n\t\tif ($width > $height) { \n\t\t\t$percentage = ($target / $width); \n\t\t} else { \n\t\t\t$percentage = ($target / $height); \n\t\t}\n\t}else{\n\t\tif ($bywidth){\n\t\t\t$percentage = ($target / $width);\n\t\t\t//if height would increase as a result\n\t\t\tif ($height < round($height * $percentage)){\n\t\t\t\treturn;\n\t\t\t} \n\t\t}else{\n\t\t\t$percentage = ($target / $height); \n\t\t\t//if width would increase as a result\n\t\t\tif ($width < round($width * $percentage)){\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t} \n\t//gets the new value and applies the percentage, then rounds the value \n\t$width = round($width * $percentage); \n\t$height = round($height * $percentage); \n}", "function imageResize($width, $height, $target) {\t\n\tif ($width > $height) { \n\t\t$percentage = ($target / $width); \n\t} else { \n\t\t$percentage = ($target / $height); \n\t} \n\n\t//gets the new value and applies the percentage, then rounds the value \n\t$width = round($width * $percentage); \n\t$height = round($height * $percentage); \n\n\t//returns the new sizes in html image tag format...this is so you \n\t//can plug this function inside an image tag and just get the \n\treturn \"width=\\\"$width\\\" height=\\\"$height\\\"\"; \n\t}", "function resizeImage($src_file, $dest_file, $new_size=100, $resize_aspect=\"sq\", $quality=\"80\")\n\t{\n\t\t$imginfo = getimagesize($src_file);\n\t\t\n\t\tif ($imginfo == null) {\n\t\treturn false;\n\t\t}\t \n\t\t\n\t\t// GD2 can only handle JPG, PNG & GIF images\n\t\tif (!$imginfo[2] > 0 && $imginfo[2] <= 3 ) {\n\t\t return false;\n\t\t}\n\t\t\n\t\t// height/width\n\t\t$srcWidth = $imginfo[0];\n\t\t$srcHeight = $imginfo[1];\n\t\t//$resize_aspect = \"sq\";\n\t\tif ($resize_aspect == 'ht') {\n\t\t $ratio = $srcHeight / $new_size;\n\t\t} elseif ($resize_aspect == 'wd') {\n\t\t $ratio = $srcWidth / $new_size;\n\t\t} elseif ($resize_aspect == 'sq') {\n\t\t $ratio = min($srcWidth, $srcHeight) / $new_size;\n\t\t} else {\n\t\t $ratio = max($srcWidth, $srcHeight) / $new_size;\n\t\t}\n\t\t\n\t\t/**\n\t\t* Initialize variables\n\t\t*/\n\t\t$clipX = 0;\n\t\t$clipY = 0;\n\t\t\n\t\t$ratio = max($ratio, 1.0);\n\t\tif ($resize_aspect == 'sq'){\n\t\t$destWidth = (int)(min($srcWidth,$srcHeight) / $ratio);\n\t\t$destHeight = (int)(min($srcWidth,$srcHeight) / $ratio);\n\t\tif($srcHeight > $srcWidth){\n\t\t$clipX = 0;\n\t\t$clipY = ((int)($srcHeight - $srcWidth)/2);\n\t\t$srcHeight = $srcWidth;\n\t\t}elseif($srcWidth > $srcHeight){\n\t\t$clipX = ((int)($srcWidth - $srcHeight)/2);\n\t\t$clipY = 0;\n\t\t$srcWidth = $srcHeight;\n\t\t}\n\t\t}else{\n\t\t$destWidth = (int)($srcWidth / $ratio);\n\t\t$destHeight = (int)($srcHeight / $ratio);\n\t\t}\n\t\t\n\t\tif (!function_exists('imagecreatefromjpeg')) {\n\t\t echo 'PHP running on your server does not support the GD image library, check with your webhost if ImageMagick is installed';\n\t\t exit;\n\t\t}\n\t\tif (!function_exists('imagecreatetruecolor')) {\n\t\t echo 'PHP running on your server does not support GD version 2.x, please switch to GD version 1.x on the admin page';\n\t\t exit;\n\t\t}\n\t\t\n\t\tif ($imginfo[2] == 1 )\n\t\t $src_img = imagecreatefromgif($src_file);\n\t\telseif ($imginfo[2] == 2)\n\t\t $src_img = imagecreatefromjpeg($src_file);\n\t\telse\n\t\t $src_img = imagecreatefrompng($src_file);\n\t\tif (!$src_img){\n\t\t return false;\n\t\t}\n\t\tif ($imginfo[2] == 1 ) {\n\t\t$dst_img = imagecreate($destWidth, $destHeight);\n\t\t} else {\n\t\t$dst_img = imagecreatetruecolor($destWidth, $destHeight);\n\t\t}\n\t\t\n\t\timagecopyresampled($dst_img, $src_img, 0, 0, $clipX, $clipY, (int)$destWidth, (int)$destHeight, $srcWidth, $srcHeight);\n\t\timagejpeg($dst_img, $dest_file, $quality);\n\t\timagedestroy($src_img);\n\t\timagedestroy($dst_img);\n\t\t\n\t\t// We check that the image is valid\n\t\t$imginfo = getimagesize($dest_file);\n\t\tif ($imginfo == null) {\n\t\t\t@unlink($dest_file);\n\t\t\treturn false;\n\t\t} else {\n\t\t\treturn true;\n\t\t}\n\t}", "public function imageResize($file, $path, $filename, $width, $height)\n\t{\n\n\t\t$img = Image::make($file);\n\t\t$img->resize($width, $height, function ($constraint) {\n $constraint->aspectRatio();\n });\n\n\t\t// if ($request->has('optimize')) {\n\t\t\t// ImageOptimizer::optimize($path);\n\t\t// }\n $img->resizeCanvas($width, $height, 'center', false, array(255, 255, 255, 0));\n\t\t$img->save($path);\n\t\t//dd($path);\n\t\tImageOptimizer::optimize($path);\n\t}", "function imageResize($width, $height, $target){\n //formula accordingly...this is so this script will work\n //dynamically with any size image\n\n if ($width > $height) {\n $percentage = ($target / $width);\n } else {\n $percentage = ($target / $height);\n }\n\n //gets the new value and applies the percentage, then rounds the value\n $width = round($width * $percentage);\n $height = round($height * $percentage);\n\n //returns the new sizes in html image tag format...this is so you\n //\tcan plug this function inside an image tag and just get the\n\n return \"width=\".$width.\" height=\".$height.\"\";\n\n }", "function imageResize($imageResourceId=null,$width=null,$height=null, $targetWidth=null, $targetHeight=null) {\n\n// $targetWidth =300;\n// $targetHeight =260;\n// dd($imageResourceId,$width,$height, $targetWidth, $targetHeight);\n\n $targetLayer=imagecreatetruecolor($targetWidth,$targetHeight);\n imagecopyresampled($targetLayer,$imageResourceId,0,0,0,0,$targetWidth,$targetHeight, $width,$height );\n// imagecopyresized($targetLayer,$imageResourceId,0,0,0,0, $width,$height,$targetWidth,$targetHeight);\n\n return $targetLayer;\n }", "function image_resize($filename){\n\t\t$width = 1000;\n\t\t$height = 500;\n\t\t$save_file_location = $filename;\n\t\t// File type\n\t\t//header('Content-Type: image/jpg');\n\t\t$source_properties = getimagesize($filename);\n\t\t$image_type = $source_properties[2];\n\n\t\t// Get new dimensions\n\t\tlist($width_orig, $height_orig) = getimagesize($filename);\n\n\t\t$ratio_orig = $width_orig/$height_orig;\n\t\tif ($width/$height > $ratio_orig) {\n\t\t\t$width = $height*$ratio_orig;\n\t\t} else {\n\t\t\t$height = $width/$ratio_orig;\n\t\t}\n\t\t// Resampling the image \n\t\t$image_p = imagecreatetruecolor($width, $height);\n\t\tif( $image_type == IMAGETYPE_JPEG ) {\n\t\t\t$image = imagecreatefromjpeg($filename);\n\t\t}else if($image_type == IMAGETYPE_GIF){\n\t\t\t$image = imagecreatefromgif($filename);\n\t\t}else if($image_type == IMAGETYPE_PNG){\n\t\t\t$image = imagecreatefrompng($filename);\n\t\t}\n\t\t$finalIMG = imagecopyresampled($image_p, $image, 0, 0, 0, 0,\n\t\t$width, $height, $width_orig, $height_orig);\n\t\t// Display of output image\n\n\t\tif( $image_type == IMAGETYPE_JPEG ) {\n\t\t\timagejpeg($image_p, $save_file_location);\n\t\t}else if($image_type == IMAGETYPE_GIF){\n\t\t\timagegif($image_p, $save_file_location);\n\t\t}else if($image_type == IMAGETYPE_PNG){\n\t\t\t$imagepng = imagepng($image_p, $save_file_location);\n\t\t}\n\t}", "public function resize(int $size, $value = 0): void {}", "function resize( $w = 0, $h = 0 )\n\t{\n\t\tif( $w == 0 || $h == 0 )\n\t\t\treturn FALSE;\n\t\t\n\t\t//get the size of the current image\n\t\t$oldsize = $this->size();\n\t\t\n\t\t//create a target canvas\n\t\t$new_im = imagecreatetruecolor ( $w, $h );\n\t\n\t\t//copy and resize image to new canvas\n\t\timagecopyresampled( $new_im, $this->im, 0, 0, 0, 0, $w, $h, $oldsize->w, $oldsize->h );\n\t\t\n\t\t//delete the old image handle\n\t\timagedestroy( $this->im );\n\t\t\n\t\t//set the new image as the current handle\n\t\t$this->im = $new_im;\n\t}", "public function sizeImg($width, $height, $crop = true);", "public function image_resize($width = 0, $height = 0, $image_url, $filename, $upload_url)\n {\n $source_path = realpath($image_url);\n list($source_width, $source_height, $source_type) = getimagesize($source_path);\n switch ($source_type)\n {\n case IMAGETYPE_GIF:\n $source_gdim = imagecreatefromgif($source_path);\n break;\n case IMAGETYPE_JPEG:\n $source_gdim = imagecreatefromjpeg($source_path);\n break;\n case IMAGETYPE_PNG:\n $source_gdim = imagecreatefrompng($source_path);\n break;\n }\n\n $source_aspect_ratio = $source_width / $source_height;\n $desired_aspect_ratio = $width / $height;\n\n if ($source_aspect_ratio > $desired_aspect_ratio)\n {\n /*\n * Triggered when source image is wider\n */\n $temp_height = $height;\n $temp_width = (int)($height * $source_aspect_ratio);\n }\n else\n {\n /*\n * Triggered otherwise (i.e. source image is similar or taller)\n */\n $temp_width = $width;\n $temp_height = (int)($width / $source_aspect_ratio);\n }\n\n /*\n * Resize the image into a temporary GD image\n */\n\n $temp_gdim = imagecreatetruecolor($temp_width, $temp_height);\n imagecopyresampled($temp_gdim, $source_gdim, 0, 0, 0, 0, $temp_width, $temp_height, $source_width, $source_height);\n\n /*\n * Copy cropped region from temporary image into the desired GD image\n */\n\n $x0 = ($temp_width - $width) / 2;\n $y0 = ($temp_height - $height) / 2;\n $desired_gdim = imagecreatetruecolor($width, $height);\n imagecopy($desired_gdim, $temp_gdim, 0, 0, $x0, $y0, $width, $height);\n\n /*\n * Render the image\n * Alternatively, you can save the image in file-system or database\n */\n\n $image_url = $upload_url . $filename;\n\n imagepng($desired_gdim, $image_url);\n\n return $image_url;\n\n /*\n * Add clean-up code here\n */\n }", "function resizeImage($image,$width,$height) {\n\t$newImageWidth = $width;\n\t$newImageHeight = $height;\n\t$newImage = imagecreatetruecolor($newImageWidth,$newImageHeight);\n\t$source = imagecreatefromjpeg($image);\n\timagecopyresampled($newImage,$source,0,0,0,0,$newImageWidth,$newImageHeight,$width,$height);\n\timagejpeg($newImage,$image,90);\n\tchmod($image, 0777);\n\treturn $image;\n}", "function resizeImage($image,$width,$height,$scale) {\n\tlist($imagewidth, $imageheight, $imageType) = getimagesize($image);\n\t$imageType = image_type_to_mime_type($imageType);\n\t$newImageWidth = ceil($width * $scale);\n\t$newImageHeight = ceil($height * $scale);\n\t$newImage = imagecreatetruecolor($newImageWidth,$newImageHeight);\n\tswitch($imageType) {\n\t\tcase \"image/gif\":\n\t\t\t$source=imagecreatefromgif($image); \n\t\t\tbreak;\n\t case \"image/pjpeg\":\n\t\tcase \"image/jpeg\":\n\t\tcase \"image/jpg\":\n\t\t\t$source=imagecreatefromjpeg($image); \n\t\t\tbreak;\n\t case \"image/png\":\n\t\tcase \"image/x-png\":\n\t\t\t$source=imagecreatefrompng($image); \n\t\t\tbreak;\n \t}\n\timagecopyresampled($newImage,$source,0,0,0,0,$newImageWidth,$newImageHeight,$width,$height);\n\t\n\tswitch($imageType) {\n\t\tcase \"image/gif\":\n\t \t\timagegif($newImage,$image); \n\t\t\tbreak;\n \tcase \"image/pjpeg\":\n\t\tcase \"image/jpeg\":\n\t\tcase \"image/jpg\":\n\t \t\timagejpeg($newImage,$image,90); \n\t\t\tbreak;\n\t\tcase \"image/png\":\n\t\tcase \"image/x-png\":\n\t\t\timagepng($newImage,$image); \n\t\t\tbreak;\n }\n\t\n\tchmod($image, 0777);\n\treturn $image;\n}", "public function resize($width, $height, $type='regular')\n\t{\n\t\t$type = in_array($type, array('crop', 'regular') )?$type:'regular';\n\t\t\n\t\t// if both sizes are auto or the type is crop and either size is auto then do nothing\n\t\tif( (preg_match('/^(auto|nochange)$/', $width) && preg_match('/^(auto|nochange)$/', $height) ) || ( $type == 'crop' && ($width == 'auto' || $height == 'auto') ) )\n\t\t\treturn false;\n\t\t\n\t\t// if both sizes are not within constrained type limits then do nothing\n\t\t// they should be either 'auto', 'nochange', a % value, or an integer representing the pixel dimensions\n\t\tif(!preg_match('/^(auto|nochange|(\\d+)%?)$/', $width) && preg_match('/^(auto|nochange|(\\d+)%?)$/', $height) )\n\t\t\treturn false;\n\t\t\n\t\t// some types of resize also require a cropping action too so switch between them here\n\t\tswitch($type)\n\t\t{\n\t\t\tcase 'regular':\n\t\t\t{\n\t\t\t\t// determine the new width\n\t\t\t\tif($width == 'auto')\n\t\t\t\t{\n\t\t\t\t\tif(is_numeric($height))\n\t\t\t\t\t\t$width = (int)(intval($height) / $this->height * $this->width);\n\t\t\t\t\telse\n\t\t\t\t\t\t$width = $this->set_dimension($this->width, $height);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\t$width = $this->set_dimension($this->width, $width);\n\t\t\t\t\n\t\t\t\t// determine the new height\n\t\t\t\tif($height == 'auto')\n\t\t\t\t{\n\t\t\t\t\tif(is_numeric($width))\n\t\t\t\t\t\t$height = (int)(intval($width) / $this->width * $this->height);\n\t\t\t\t\telse\n\t\t\t\t\t\t$height = $this->set_dimension($this->height, $width);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\t$height = $this->set_dimension($this->height, $height);\n\n\t\t\t\t$image_p = imagecreatetruecolor($width, $height);\n\t\t\t\treturn (imagecopyresampled($image_p, $this->image, 0, 0, 0, 0, $width, $height, $this->width, $this->height) && $this->image = $image_p);\n\t\t\t\t\n\t\t\t\tbreak;\n\t\t\t}//end case\n\t\t\tcase 'crop':\n\t\t\t{\n\t\t\t\t$width = $this->set_dimension($this->width, $width);\n\t\t\t\t$height = $this->set_dimension($this->height, $height);\n\n\t\t\t\tif(($width / $height) < ($this->width / $this->height))\n\t\t\t\t{\n\t\t\t\t\t// landscape\n\t\t\t\t\t$ratio = $width / $height;\n\t\t\t\t\t$image_p = imagecreatetruecolor($width, $height);\n\t\t\t\t\t\n\t\t\t\t\timagecopyresampled(\n\t\t\t\t\t\t$image_p, // dst_im\n\t\t\t\t\t\t$this->image, // src_im\n\t\t\t\t\t\t0, // dst_x\n\t\t\t\t\t\t0, // dst_y\n\t\t\t\t\t\t($this->width / 2) - ($this->height * $ratio) / 2, // src_x\n\t\t\t\t\t\t0, // src_y\n\t\t\t\t\t\t$width, // dst_w\n\t\t\t\t\t\t$height, // dst_h\n\t\t\t\t\t\t$this->height * $ratio, // src_w\n\t\t\t\t\t\t$this->height // src_h\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t// portrait\n\t\t\t\t\t$ratio = $height / $width;\n\t\t\t\t\t$image_p = imagecreatetruecolor($width, $height);\n\t\t\t\t\t\n\t\t\t\t\timagecopyresampled(\n\t\t\t\t\t\t$image_p, // dst_im\n\t\t\t\t\t\t$this->image, // src_im\n\t\t\t\t\t\t0, // dst_x\n\t\t\t\t\t\t0, // dst_y\n\t\t\t\t\t\t0, // src_x\n\t\t\t\t\t\t0, // src_y\n\t\t\t\t\t\t$width, // dst_w\n\t\t\t\t\t\t$height, // dst_h\n\t\t\t\t\t\t$this->width, // src_w\n\t\t\t\t\t\t$this->width * $ratio // src_h\n\t\t\t\t\t);\n\t\t\t\t}//end if\n\t\t\t\treturn ($this->image = $image_p);\n\t\t\t\t\n\t\t\t\tbreak;\n\t\t\t}//end case\n\t\t}//end switch\n\t}", "public static function setSize($path,$target_width=150,$target_height=100) {\n\t\t$img = imagecreatefromjpeg($path);\n\t\tif (!$img) {\n\t\t\techo \"ERROR:could not create image handle \".$path;\n\t\t\texit(0);\n\t\t}\n\t\t$width = imageSX($img);\n\t\t$height = imageSY($img);\n\t\t$size = getimagesize($path);\n\t\tif (!$width || !$height) {\n\t\t\techo \"ERROR:Invalid width or height\";\n\t\t\texit(0);\n\t\t}\n\t\tif ($width > $target_width) {\n\t\t\t$width_ratio = $target_width/$width;\n\t\t}\n\t\telse {\n\t\t\t$width_ratio = 1;\t\n\t\t}\n\t\tif ($height > $target_height) {\n\t\t\t$height_ratio = $target_height/$height;\n\t\t}\n\t\telse {\n\t\t\t$height_ratio = 1;\t\n\t\t}\n\t\tif ($width_ratio==1 && $height_ratio==1) return $img;\n\t\t$ratio = min($width_ratio,$height_ratio);\n\t\t$new_height = $ratio * $height;\n\t\t$new_width = $ratio * $width;\n\t\t//file_put_contents(\"1.log\",\"$new_height = $ratio m $height; $new_width = $ratio m $width;\\n\",FILE_APPEND);\n\t\t$new_img = ImageCreateTrueColor($new_width, $new_height);\n\t\tif (!@imagecopyresampled($new_img, $img, 0, 0, 0, 0, $new_width, $new_height, $width, $height)) {\n\t\t\techo \"ERROR:Could not resize image\";\n\t\t\texit(0);\n\t\t}\t\t\n\t\treturn $new_img;\n\t}", "function resize_fit_or_smaller($width, $height) {\n\n\t\t$w = $this->getWidth();\n\t\t$h = $this->getHeight();\n\n\t\t$ratio = $width / $w;\n\t\tif (($h*$ratio)>$height)\n\t\t\t$ratio = $height / $h;\n\t\t\n\t\t$h *= $ratio;\n\t\t$w *= $ratio;\n\n\t\t$this->resize($w, $h);\n\t}", "function crop($iNewWidth, $iNewHeight, $iResize = 0)\n\t{\n\t\tif (!$this->ImageStream) {\n\t\t\t$this->printError('image not loaded');\n\t\t}\n\n\t\t/* resize imageobject in memory if resize percentage is set */\n\t\tif ($iResize > 0) {\n\t\t\t$this->resizetopercentage($iResize);\n\t\t}\n\n\t\t/* constrain width and height values */\n\t\tif (($iNewWidth > $this->width) || ($iNewWidth < 0)) {\n\t\t\t$this->printError('width out of range');\n\t\t}\n\t\tif (($iNewHeight > $this->height) || ($iNewHeight < 0)) {\n\t\t\t$this->printError('height out of range');\n\t\t}\n\n\t\t/* create blank image with new sizes */\n\t\t$CroppedImageStream = ImageCreateTrueColor($iNewWidth, $iNewHeight);\n\n\t\t/* calculate size-ratio */\n\t\t$iWidthRatio = $this->width / $iNewWidth;\n\t\t$iHeightRatio = $this->height / $iNewHeight;\n\t\t$iHalfNewHeight = $iNewHeight / 2;\n\t\t$iHalfNewWidth = $iNewWidth / 2;\n\n\t\t/* if the image orientation is landscape */\n\t\tif ($this->orientation == 'landscape') {\n\t\t\t/* calculate resize width parameters */\n\t\t\t$iResizeWidth = $this->width / $iHeightRatio;\n\t\t\t$iHalfWidth = $iResizeWidth / 2;\n\t\t\t$iDiffWidth = $iHalfWidth - $iHalfNewWidth;\n\n\t\t\tif (function_exists(\"imagecopyresampled\")) {\n\t\t\t\timagecopyresampled($CroppedImageStream, $this->ImageStream, - $iDiffWidth, 0, 0, 0, $iResizeWidth, $iNewHeight, $this->width, $this->height);\n\t\t\t} else {\n\t\t\t\timagecopyresized($CroppedImageStream, $this->ImageStream, - $iDiffWidth, 0, 0, 0, $iResizeWidth, $iNewHeight, $this->width, $this->height);\n\t\t\t}\n\t\t}\n\t\t/* if the image orientation is portrait or square */\n\t\telseif (($this->orientation == 'portrait') || ($this->orientation == 'square')) {\n\t\t\t/* calculate resize height parameters */\n\t\t\t$iResizeHeight = $this->height / $iWidthRatio;\n\t\t\t$iHalfHeight = $iResizeHeight / 2;\n\t\t\t$iDiffHeight = $iHalfHeight - $iHalfNewHeight;\n\n\t\t\tif (function_exists(\"imagecopyresampled\")) {\n\t\t\t\timagecopyresampled($CroppedImageStream, $this->ImageStream, 0, - $iDiffHeight, 0, 0, $iNewWidth, $iResizeHeight, $this->width, $this->height);\n\t\t\t} else {\n\t\t\t\timagecopyresized($CroppedImageStream, $this->ImageStream, 0, - $iDiffHeight, 0, 0, $iNewWidth, $iResizeHeight, $this->width, $this->height);\n\t\t\t}\n\t\t} else {\n\t\t\tif (function_exists(\"imagecopyresampled\")) {\n\t\t\t\timagecopyresampled($CroppedImageStream, $this->ImageStream, 0, 0, 0, 0, $iNewWidth, $iNewHeight, $this->width, $this->height);\n\t\t\t} else {\n\t\t\t\timagecopyresized($CroppedImageStream, $this->ImageStream, 0, 0, 0, 0, $iNewWidth, $iNewHeight, $this->width, $this->height);\n\t\t\t}\n\t\t}\n\n\t\t$this->ImageStream = $CroppedImageStream;\n\t\t$this->width = $iNewWidth;\n\t\t$this->height = $iNewHeight;\n\t\t$this->setImageOrientation();\n\t}", "function smart_resize_image($file, $width = 0, $height = 0, $proportional = false, $output = \"file\", $delete_original = true, $use_linux_commands = false){\n\t\tif(($height <= 0) && ($width <= 0)){\n\t\t\treturn(false);\n\t\t}\n\t\t$info = getimagesize($file); // Paramètres par défaut de l'image\n\t\t$image = \"\";\n\t\t$final_width = 0;\n\t\t$final_height = 0;\n\t\tlist($width_old,$height_old) = $info;\n\t\t$trop_petite = false;\n\t\tif(($height > 0) && ($height > $height_old)){\n\t\t\t$trop_petite = true;\n\t\t}\n\t\tif(($width > 0) && ( $width > $width_old)){\n\t\t\t$trop_petite = true;\n\t\t}else{\n\t\t\t$trop_petite = false;\n\t\t}\n\t\tif($trop_petite){\n\t\t\treturn(false);\n\t\t}\n\t\tif($proportional){ // Calculer la proportionnalité\n\t\t\tif($width == 0){\n\t\t\t\t$factor = $height / $height_old;\n\t\t\t}elseif($height == 0){\n\t\t\t\t$factor = $width / $width_old;\n\t\t\t}else{\n\t\t\t\t$factor = min($width / $width_old,$height / $height_old);\n\t\t\t}\n\t\t\t$final_width = round($width_old * $factor);\n\t\t\t$final_height = round($height_old * $factor);\n\t\t}else{\n\t\t\t$final_width = ($width <= 0) ? $width_old : $width;\n\t\t\t$final_height = ($height <= 0) ? $height_old : $height;\n\t\t}\n\t\tswitch($info[2]){ // Charger l'image en mémoire en fonction du format\n\t\t\tcase IMAGETYPE_GIF:\n\t\t\t\t$image = imagecreatefromgif($file); break;\n\t\t\tcase IMAGETYPE_JPEG:\n\t\t\t\t$image = imagecreatefromjpeg($file); break;\n\t\t\tcase IMAGETYPE_PNG:\n\t\t\t\t$image = imagecreatefrompng($file); break;\n\t\t\tdefault:\n\t\t\t\treturn(false);\n\t\t}\n\t\t$image_resized = imagecreatetruecolor($final_width, $final_height); // Transparence pour les gif et les png\n\t\tif(($info[2] == IMAGETYPE_GIF) || ($info[2] == IMAGETYPE_PNG)){\n\t\t\t$transparency = imagecolortransparent($image);\n\t\t\tif($transparency >= 0){\n\t\t\t\t$transparent_color = imagecolorsforindex($image,$trnprt_indx);\n\t\t\t\t$transparency = imagecolorallocate($image_resized,$trnprt_color[\"red\"],$trnprt_color[\"green\"],$trnprt_color[\"blue\"]);\n\t\t\t\timagefill($image_resized,0,0,$transparency);\n\t\t\t\timagecolortransparent($image_resized,$transparency);\n\t\t\t}elseif($info[2] == IMAGETYPE_PNG){\n\t\t\t\timagealphablending($image_resized,false);\n\t\t\t\t$color = imagecolorallocatealpha($image_resized,0,0,0,127);\n\t\t\t\timagefill($image_resized,0,0,$color);\n\t\t\t\timagesavealpha($image_resized,true);\n\t\t\t}\n\t\t}\n\t\timagecopyresampled($image_resized,$image,0,0,0,0,$final_width,$final_height,$width_old,$height_old);\n\t\tif($delete_original){ // Suppression de l'image d'origine éventuelle\n\t\t\tif($use_linux_commands){\n\t\t\t\texec(\"rm \".$file);\n\t\t\t}else{\n\t\t\t\t@unlink($file);\n\t\t\t}\n\t\t}\n\t\tswitch(strtolower($output)){\n\t\t\tcase \"browser\": // Envoyer l'image par http avec son type MIME\n\t\t\t\t$mime = image_type_to_mime_type($info[2]); header(\"Content-type: $mime\"); $output = NULL; break;\n\t\t\tcase \"file\": // Ecraser l'image donnée (cas défaut)\n\t\t\t\t$output = $file; break;\n\t\t\tcase \"return\": // Retourner les infos de l'image redimensionnée en conservant celles de l'image d'origine\n\t\t\t\treturn($image_resized); break;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t\tswitch($info[2]){ // Retourner l'image redimensionnée en fonction de son format\n\t\t\tcase IMAGETYPE_GIF:\n\t\t\t\timagegif($image_resized,$output); break;\n\t\t\tcase IMAGETYPE_JPEG:\n\t\t\t\timagejpeg($image_resized,$output); break;\n\t\t\tcase IMAGETYPE_PNG:\n\t\t\t\timagepng($image_resized,$output); break;\n\t\t\tdefault:\n\t\t\t\treturn(false);\n\t\t}\n\t\treturn(true);\n\t}", "function imageResize($file, $dest, $height, $width, $thumb = FALSE) {\n\tglobal $ighMaxHeight, $ighMaxWidth, $ighThumbHeight, $ighThumbWidth;\n\n\tif (strstr(@mime_content_type($file), \"png\"))\n\t\t$oldImage = imagecreatefrompng($file);\n\telseif (strstr(@mime_content_type($file), \"jpeg\"))\n\t\t$oldImage = imagecreatefromjpeg($file);\n\telseif (strstr(@mime_content_type($file), \"gif\"))\n\t\t$oldImage = imagecreatefromgif($file);\n\telse\n\t\tdie (\"oh shit\");\n\n\t$base_img = $oldImage;\n $img_width = imagesx($base_img);\n $img_height = imagesy($base_img);\n\n $thumb_height = $height;\n $thumb_width = $width;\n\n // Work out which way it needs to be resized\n $img_width_per = $thumb_width / $img_width;\n $img_height_per = $thumb_height / $img_height;\n \n if ($img_width_per <= $img_height_per) {\n $thumb_height = intval($img_height * $img_width_per); \n }\n else {\n $thumb_width = intval($img_width * $img_height_per);\n }\n\n\tif ($thumb) {\n\t\t$thumb_width = $width;\t\t// 120\n\t\t$thumb_height = $height*3/4;\t// 120 * 3 / 4 = 90\n\t}\n\n // Create the new thumbnail image\n $thumb_img = ImageCreateTrueColor($thumb_width, $thumb_height); \n\n\tif ($thumb) {\t// Do the Square from the Centre thing.\n\t\tImageCopyResampled($thumb_img, $base_img, 0, 0, \n\t\t\t\t($img_width/2)-($thumb_width/2), ($img_height/2)-($thumb_height/2), \n\t\t\t\t$thumb_width, $thumb_height, $thumb_width, $thumb_height);\t\t\t\n\t} else {\t// standard image to image resize.\n\t\tImageCopyResampled($thumb_img, $base_img, 0, 0, 0, 0, \n\t\t\t\t$thumb_width, $thumb_height, $img_width, $img_height);\n\t}\n\n\t// using jpegs!\n\timagejpeg($thumb_img, $dest);\n\timagedestroy($base_img);\n\timagedestroy($thumb_img);\n}", "function resize($image_name, $size, $folder_name) {\n $file_extension = getFileExtension($image_name);\n switch ($file_extension) {\n case 'jpg':\n case 'jpeg':\n $image_src = imagecreatefromjpeg($folder_name . '/' . $image_name);\n break;\n case 'png':\n $image_src = imagecreatefrompng($folder_name . '/' . $image_name);\n break;\n case 'gif':\n $image_src = imagecreatefromgif($folder_name . '/' . $image_name);\n break;\n }\n $true_width = imagesx($image_src);\n $true_height = imagesy($image_src);\n\n $width = $size;\n $height = ($width / $true_width) * $true_height;\n\n $image_des = imagecreatetruecolor($width, $height);\n\n imagecopyresampled($image_des, $image_src, 0, 0, 0, 0, $width, $height, $true_width, $true_height);\n\n switch ($file_extension) {\n case 'jpg':\n case 'jpeg':\n imagejpeg($image_des, $folder_name . '/' . $image_name, 100);\n break;\n case 'png':\n imagepng($image_des, $folder_name . '/' . $image_name, 8);\n break;\n case 'gif':\n imagegif($image_des, $folder_name . '/' . $image_name, 100);\n break;\n }\n return $image_des;\n}", "public function resize($newWidth, $newHeight, $option='auto')\n\t{\n\t\t// Reset\n\t\tif ($this->imageResized) {\n\t\t\timagedestroy($this->imageResized);\n\t\t}\n\t\t$this->saveState = false;\n\n\t\t// Get optimal width and height based on $option\n\t\t$optionArray = $this->getDimensions((int)$newWidth, (int)$newHeight, $option);\n\t\t$this->optimalWidth = round($optionArray['optimalWidth']);\n\t\t$this->optimalHeight = round($optionArray['optimalHeight']);\n\n\t\t// Resample - create image canvas of x, y size\n\t\t$this->imageResized = imagecreatetruecolor($this->optimalWidth, $this->optimalHeight);\n\t\tif (imagetypes() & IMG_PNG) {\n\t\t\timagesavealpha($this->imageResized, true);\n\t\t\timagealphablending($this->imageResized, false);\n\t\t}\n\t\timagecopyresampled($this->imageResized, $this->image, 0, 0, 0, 0, $this->optimalWidth, $this->optimalHeight, $this->width, $this->height);\n\n\t\t// If option is 'crop', then crop too\n\t\tif ($option == 'crop') {\n\t\t\t$this->cropImage($this->optimalWidth, $this->optimalHeight, $newWidth, $newHeight);\n\t\t}\n\n\t\treturn $this;\n\t}", "public function resize(array $dimensions) {\n// is there an image resource to work with?\n if (isset($this->_resource)) {\n// does the dimensions array have the appropriate values to work with?\n if (isset($dimensions[\"width\"]) || isset($dimensions[\"height\"])) {\n// has the width value been omitted, while the height value given?\n if (!isset($dimensions[\"width\"]) && isset($dimensions[\"height\"])) {\n// is the height an integer?\n// -> if so, assign the height variable and assign the width variable scaled similarly to the height\n if (is_int($dimensions[\"height\"])) {\n $width = (int) floor($this->_width * ($dimensions[\"height\"] / $this->_height));\n $height = $dimensions[\"height\"];\n }\n }\n// or has the height value been omitted, and the width value given?\n else if (isset($dimensions[\"width\"]) && !isset($dimensions[\"height\"])) {\n// is the width an integer?\n// -> if so, assign the width variable and assign the height variable scaled similarly to the width\n if (is_int($dimensions[\"width\"])) {\n $width = $dimensions[\"width\"];\n $height = (int) floor($this->_height * ($dimensions[\"width\"] / $this->_width));\n }\n }\n// or both values were provided\n else {\n// are both width and height values integers?\n// -> if so, assign the width and height variables\n if (is_int($dimensions[\"width\"]) && is_int($dimensions[\"height\"])) {\n $width = $dimensions[\"width\"];\n $height = $dimensions[\"height\"];\n }\n }\n\n// have the width and height variables been assigned?\n// -> if so, proceed with cropping\n if (isset($width, $height)) {\n// generating the placeholder resource\n $resized_image = $this->newImageResource($width, $height);\n\n// copying the original image's resource into the placeholder and resizing it accordingly\n imagecopyresampled($resized_image, $this->_resource, 0, 0, 0, 0, $width, $height, $this->_width, $this->_height);\n\n// assigning the new image attributes\n $this->_resource = $resized_image;\n $this->_width = $width;\n $this->_height = $height;\n }\n } else {\n trigger_error(\"CAMEMISResizeImage::resize() was not provided the apporpriate arguments (given array must contain \\\"width\\\" and \\\"height\\\" elements)\", E_USER_WARNING);\n }\n } else {\n trigger_error(\"CAMEMISResizeImage::resize() attempting to access a non-existent resource (check if the image was loaded by Image2::__construct())\", E_USER_WARNING);\n }\n\n return $this;\n }", "public function runStretchResize(Image $image, int $width, int $height) : Image\n\t{\n\t\treturn $image->resize($width, $height);\n\t}", "private function resize() {\n\t\tswitch($this->type) {\n\t\t\tcase 'image/jpeg':\n\t\t\t\t$originalImage = imagecreatefromjpeg($this->tempName);\n\t\t\tbreak;\n\t\t\tcase 'image/png':\n\t\t\t\t$originalImage = imagecreatefrompng($this->tempName);\n\t\t\tbreak;\n\t\t\tcase 'image/gif':\n\t\t\t\t$originalImage = imagecreatefromgif($this->tempName);\n\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tdie('FILE CANNOT BE RESIZED');\n\t\t\tbreak;\n\t\t}\n\n\t\t// Determine new height\n\t\t$this->newHeight = ($this->height / $this->width) * $this->newWidth;\n\n\t\t// Create new image\n\t\t$this->newImage = imagecreatetruecolor($this->newWidth, $this->newHeight);\n\n\t\t// Resample original image into new image\n\t\timagecopyresampled($this->newImage, $originalImage, 0, 0, 0, 0, $this->newWidth, $this->newHeight, $this->width, $this->height);\n\n\t\t// Switch based on image being resized\n\t\tswitch($this->type) {\n\t\t\tcase 'image/jpeg':\n\t\t\t\t// Source, Dest, Quality 0 to 100\n\t\t\t\timagejpeg($this->newImage, $this->destinationFolder.'/'.$this->newName, 80);\n\t\t\tbreak;\n\t\t\tcase 'image/png':\n\t\t\t\t// Source, Dest, Quality 0 (no compression) to 9\n\t\t\t\timagepng($this->newImage, $this->destinationFolder.'/'.$this->newName, 0);\n\t\t\tbreak;\n\t\t\tcase 'image/gif':\n\t\t\t\timagegif($this->newImage, $this->destinationFolder.'/'.$this->newName);\n\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tdie('YOUR FILE CANNOT BE RESIZED');\n\t\t\tbreak;\n\t\t}\n\n\t\t// DESTROY NEW IMAGE TO SAVE SERVER SPACE\n\t\timagedestroy($this->newImage);\n\t\timagedestroy($originalImage);\n\n\t\t// SUCCESSFULLY UPLOADED\n\t\t$this->result = true;\n\t\t$this->message = 'Image uploaded and resized successfully';\n\t}", "function resize($iNewWidth, $iNewHeight)\n\t{\n\t\tif (!$this->ImageStream) {\n\t\t\t$this->printError('image not loaded');\n\t\t}\n\n\t\tif (function_exists(\"imagecopyresampled\")) {\n\t\t\t$ResizedImageStream = imagecreatetruecolor($iNewWidth, $iNewHeight);\n\t\t\timagecopyresampled($ResizedImageStream, $this->ImageStream, 0, 0, 0, 0, $iNewWidth, $iNewHeight, $this->width, $this->height);\n\t\t} else {\n\t\t\t$ResizedImageStream = imagecreate($iNewWidth, $iNewHeight);\n\t\t\timagecopyresized($ResizedImageStream, $this->ImageStream, 0, 0, 0, 0, $iNewWidth, $iNewHeight, $this->width, $this->height);\n\t\t}\n\n\t\t$this->ImageStream = $ResizedImageStream;\n\t\t$this->width = $iNewWidth;\n\t\t$this->height = $iNewHeight;\n\t\t$this->setImageOrientation();\n\t}", "function resizeImage($width, $height, $quality = 8, $ratio = false) {\n\t\tif (!is_numeric($quality)) {\n\t\t\treturn false;\n\t\t} else {\n\t\t\tif ($quality > 10) {\n\t\t\t\t$quality = 10;\n\t\t\t} else if ($quality < 0) {\n\t\t\t\t$quality = 0;\n\t\t\t}\n\n\t\t\t$quality = $quality * 10;\n\t\t\t$dataPath = TMP_DIR.\"/\".weFile::getUniqueId();\n\t\t\t$_resized_image = we_image_edit::edit_image($this->getElement(\"data\"), $this->getGDType(), $dataPath, $quality, $width, $height, $ratio);\n\n\t\t\t$this->setElement(\"data\", $dataPath);\n\n\t\t\t$this->setElement(\"width\", $_resized_image[1], \"attrib\");\n\t\t\t$this->setElement(\"origwidth\", $_resized_image[1], \"attrib\");\n\n\t\t\t$this->setElement(\"height\", $_resized_image[2],\"attrib\");\n\t\t\t$this->setElement(\"origheight\", $_resized_image[2], \"attrib\");\n\n\t\t\t$this->DocChanged = true;\n\t\t}\n\t}", "function resize_fit_or_bigger($width, $height) {\n\n\t\t$w = $this->getWidth();\n\t\t$h = $this->getHeight();\n\n\t\t$ratio = $width / $w;\n\t\tif (($h*$ratio)<$height)\n\t\t\t$ratio = $height / $h;\n\t\t\n\t\t$h *= $ratio;\n\t\t$w *= $ratio;\n\n\t\t$this->resize($w, $h);\n\t}", "public function resizeImage($file, $width, $height)\n {\n Image::make($file)->orientate()\n ->resize($width, $height, function ($constraint) {\n $constraint->aspectRatio();\n $constraint->upsize();\n })\n ->save($file);\n }", "public function runMaxResize(Image $image, $width, $height) : Image\n\t{\n\t return $image->resize($width, $height, function ($constraint) {\n\t $constraint->aspectRatio();\n\t $constraint->upsize();\n\t });\n\t}", "public function autoScale($img, $size) {\n\t// NOT YET IMPLEMENTED.\n}", "protected function _resizeImage($imagePath, $height = 150, $width = 150)\n {\n Image::make(storage_path('app/public/' . $imagePath))->resize($width, $height)->save(storage_path('app/public/' . $imagePath));\n }", "public function thumbnail($image_path, $size_name, $maxWidth = 370, $maxHeight = 370)\n\t{\n\t\t$img = $this->intervention->make($image_path);\n\t\t$img->interlace();\n\t\t\n\t\tif($img->height()>$maxHeight){\n\n\t\t\t// method 1\n\t\t\t// add callback functionality to retain maximal original image size\n\t\t\t$img->fit($maxWidth, $maxHeight, function ($constraint) {\n\t\t\t $constraint->upsize();\n\t\t\t});\n\t\t\n\t\t}else{\n\t\t\t// method 2\n\t\t // resize image to 370x370 and keep the aspect ratio\n\t\t\t$img->resize($maxWidth, $maxHeight, function ($constraint) {\n\t\t\t\t$constraint->aspectRatio();\n\t\t\t});\n\t\t\t\n\t\t\t// Fill up the blank spaces with transparent color\n\t\t\t$img->resizeCanvas($maxWidth, $maxHeight, 'center', false, array(255, 255, 255, 0));\n\t\t}\n\t\t\n\t\t$new_image_path = str_replace(\"-source\", \"-$size_name\", $image_path);\n\t\t$img->save($new_image_path, 80);\n\t\t\n\t\treturn $new_image_path;\n\t}", "public function resize($file, $size, $height, $name, $path)\n {\n\n if (!is_dir($path . '/'))\n if (!mkdir($path, 0777)) ;\n\n $array = explode('.', $name);\n $ext = strtolower(end($array));\n\n switch (strtolower($ext)) {\n\n case \"gif\":\n $out = imagecreatefromgif($file);\n break;\n\n case \"jpg\":\n $out = imagecreatefromjpeg($file);\n break;\n\n case \"jpeg\":\n $out = imagecreatefromjpeg($file);\n break;\n\n case \"png\":\n $out = imagecreatefrompng($file);\n break;\n }\n\n $src_w = imagesx($out);\n $src_h = imagesy($out);\n\n if ($src_w > $size || $src_h > $height) {\n\n if ($src_w > $size) {\n\n $dst_w = $size;\n $dst_h = floor($src_h / ($src_w / $size));\n\n\n $img_out = imagecreatetruecolor($dst_w, $dst_h);\n imagecopyresampled($img_out, $out, 0, 0, 0, 0, $dst_w, $dst_h, $src_w, $src_h);\n\n switch (strtolower($ext)) {\n case \"gif\":\n imagegif($img_out, $path . $name);\n break;\n case \"jpg\":\n imagejpeg($img_out, $path . $name, 100);\n break;\n case \"jpeg\":\n imagejpeg($img_out, $path . $name, 100);\n break;\n case \"png\":\n imagepng($img_out, $path . $name);\n break;\n }\n\n } else if ($src_h > $height) {\n\n $dst_h = $height;\n $dst_w = floor($src_w / ($src_h / $height));\n\n if ($dst_w > $size) {\n\n $dst_w = $size;\n $dst_h = floor($src_h / ($src_w / $size));\n\n }\n\n\n $img_out = imagecreatetruecolor($dst_w, $dst_h);\n imagecopyresampled($img_out, $out, 0, 0, 0, 0, $dst_w, $dst_h, $src_w, $src_h);\n\n switch (strtolower($ext)) {\n case \"gif\":\n imagegif($img_out, $path . $name);\n break;\n case \"jpg\":\n imagejpeg($img_out, $path . $name, 100);\n break;\n case \"jpeg\":\n imagejpeg($img_out, $path . $name, 100);\n break;\n case \"png\":\n imagepng($img_out, $path . $name);\n break;\n }\n\n }\n\n $array = explode('.', $name);\n $ext = strtolower(end($array));\n\n switch (strtolower($ext)) {\n\n case \"gif\":\n $out = imagecreatefromgif($path . $name);\n break;\n\n case \"jpg\":\n $out = imagecreatefromjpeg($path . $name);\n break;\n\n case \"jpeg\":\n $out = imagecreatefromjpeg($path . $name);\n break;\n\n case \"png\":\n $out = imagecreatefrompng($path . $name);\n break;\n }\n\n $src_w = imagesx($out);\n $src_h = imagesy($out);\n\n if ($src_h > $height) {\n\n $dst_h = $height;\n $dst_w = floor($src_w / ($src_h / $height));\n\n if ($dst_w > $size) {\n\n $dst_w = $size;\n $dst_h = floor($src_h / ($src_w / $size));\n\n }\n\n $img_out = imagecreatetruecolor($dst_w, $dst_h);\n imagecopyresampled($img_out, $out, 0, 0, 0, 0, $dst_w, $dst_h, $src_w, $src_h);\n\n switch (strtolower($ext)) {\n case \"gif\":\n imagegif($img_out, $path . $name);\n break;\n case \"jpg\":\n imagejpeg($img_out, $path . $name, 100);\n break;\n case \"jpeg\":\n imagejpeg($img_out, $path . $name, 100);\n break;\n case \"png\":\n imagepng($img_out, $path . $name);\n break;\n }\n\n }\n\n } else {\n\n copy($file, $path . $name);\n\n }\n\n\n }", "public function resize ($image, $width, $height, $options = array (), $quality = 100) {\n\t\t$options['width'] = $width;\n\t\t$options['height'] = $height;\n\n\t\treturn $this->Html->image ($this->resizedUrl ($image, $width, $height, $quality), $options);\n\t}", "function resizeImage($filename, $max_width, $max_height)\n{\n list($orig_width, $orig_height) = getimagesize($filename);\n\n $width = $orig_width;\n $height = $orig_height;\n\n # taller\n if ($max_height != 0 && $max_width != 0)\n {\n\t if ($height > $max_height) {\n\t\t $width = ($max_height / $height) * $width;\n\t\t $height = $max_height;\n\t }\n\n\t # wider\n\t if ($width > $max_width) {\n\t\t $height = ($max_width / $width) * $height;\n\t\t $width = $max_width;\n\t }\n }\n\n $image_p = imagecreatetruecolor($width, $height);\n\n $image = imagecreatefromjpeg($filename);\n\n imagecopyresampled($image_p, $image, 0, 0, 0, 0,\n $width, $height, $orig_width, $orig_height);\n\n return $image_p;\n}", "public static function resize($image = NULL, $width = NULL, $height = NULL)\n\t{\n\n\t\tif (!($image instanceof Default_Model_MediaImage)) {\n\t\t\tthrow new Default_Model_MediaImage_Exception('Image needs to be an instance of Default_Model_MediaImage.');\n\t\t}\n\n\t\tif ($width &&\n\t\t\t!is_int($width)) {\n\n\t\t\tthrow new Default_Model_MediaImage_Exception('Width needs to be an integer, if specified.');\n\t\t}\n\n\t\tif ($height &&\n\t\t\t!is_int($height)) {\n\n\t\t\tthrow new Default_Model_MediaImage_Exception('Height needs to be an integer, if specified.');\n\t\t}\n\n\t\treturn self::_resize($image, $width, $height);\n\t}", "function resize( $width, $height ) {\n $new_image = imagecreatetruecolor( $width, $height );\n if ( $this->mimetype == 'image/gif' || $this->mimetype == 'image/png' ) {\n $current_transparent = imagecolortransparent( $this->image );\n if ( $current_transparent != -1 ) {\n $transparent_color = imagecolorsforindex( $this->image, $current_transparent );\n $current_transparent = imagecolorallocate( $new_image, $transparent_color['red'], $transparent_color['green'], $transparent_color['blue'] );\n imagefill( $new_image, 0, 0, $current_transparent );\n imagecolortransparent( $new_image, $current_transparent );\n } elseif ( $this->mimetype == 'image/png' ) {\n imagealphablending( $new_image, false );\n $color = imagecolorallocatealpha( $new_image, 0, 0, 0, 127 );\n imagefill( $new_image, 0, 0, $color );\n imagesavealpha( $new_image, true );\n }\n }\n imagecopyresampled( $new_image, $this->image, 0, 0, 0, 0, $width, $height, $this->width, $this->height );\n $this->image = $new_image;\n return $this;\n }", "function image_resize_dimensions ( $args ) {\r\n\t\t/*\r\n\t\t * Changelog\r\n\t\t *\r\n\t\t * v8.1, November 11, 2009\r\n\t\t * - Now uses trigger_error instead of outputting errors to screen\r\n\t\t *\r\n\t\t * v8, December 02, 2007\r\n\t\t * - Cleaned by using math instead of logic\r\n\t\t * - Restructured the code\r\n\t\t * - Re-organised variable names\r\n\t\t *\r\n\t\t * v7, 20/07/2007\r\n\t\t * - Cleaned\r\n\t\t *\r\n\t\t * v6,\r\n\t\t * - Added cropping\r\n\t\t *\r\n\t\t * v5, 12/08/2006\r\n\t\t * - Changed to use args\r\n\t\t */\r\n\t\t\r\n\t\t/*\r\n\t\tThe 'exact' resize mode, will resize things to the exact limit.\r\n\t\tIf a width or height is 0, the appropriate value will be calculated by ratio\r\n\t\tResults with a 800x600 limit:\r\n\t\t\t*x*\t\t\t->\t800x600\r\n\t\tResults with a 0x600 limit:\r\n\t\t\t1280x1024\t->\t750x600\r\n\t\t\t1900x1200\t->\t950x600\r\n\t\t\t96x48\t\t->\t1200x600\r\n\t\t\t1000x500\t->\t1200x600\r\n\t\tResults with a 800x0 limit:\r\n\t\t\t1280x1024\t->\t800x640\r\n\t\t\t1900x1200\t->\t800x505\r\n\t\t\t96x48\t\t->\t800x400\r\n\t\t\t1000x500\t->\t800x400\r\n\t\t*/\r\n\t\t\r\n\t\t/*\r\n\t\tThe 'area' resize mode, will resize things to fit within the area.\r\n\t\tIf a width or height is 0, the appropriate value will be calculated by ratio\r\n\t\tResults with a 800x600 limit:\r\n\t\t\t1280x1024\t->\t750x600\r\n\t\t\t1900x1200\t->\t950x600\t-> 800x505\r\n\t\t\t96x48\t\t->\t96x48\t\tno change\r\n\t\t\t1000x500\t->\t800x400 = '800x'.(800/100)*500\r\n\t\tResults with a 0x600 limit:\r\n\t\t\t1280x1024\t->\t750x600\r\n\t\t\t1900x1200\t->\t950x600\r\n\t\t\t96x48\t\t->\t96x48\t\tno change\r\n\t\t\t1000x500\t->\t1000x500\tno change\r\n\t\tResults with a 800x0 limit:\r\n\t\t\t1280x1024\t->\t800x640\r\n\t\t\t1900x1200\t->\t950x600\t->\t800x505\r\n\t\t\t96x48\t\t->\t96x48\t\tno change\r\n\t\t\t1000x500\t->\t800x400\t= '800x'.(800/1000)*500\r\n\t\t*/\r\n\t\t\r\n\t\t// ---------\r\n\t\t$image = $x_original = $y_original = $x_old = $y_old = $resize_mode = $width_original = $width_old = $width_desired = $width_new = $height_original = $height_old = $height_desired = $height_new = null;\r\n\t\textract($args);\r\n\t\t\r\n\t\t// ---------\r\n\t\tif ( is_null($width_original) && !is_null($width_old) ) {\r\n\t\t\t$width_original = $width_old;\r\n\t\t\t$width_old = null;\r\n\t\t}\r\n\t\tif ( is_null($height_original) && !is_null($height_old) ) {\r\n\t\t\t$height_original = $height_old;\r\n\t\t\t$height_old = null;\r\n\t\t}\r\n\t\t\r\n\t\t//\r\n\t\tif ( is_null($width_original) && is_null($height_original) && !is_null($image) ) { // Get from image\r\n\t\t\t$image = image_read($image);\r\n\t\t\t$width_original = imagesx($image);\r\n\t\t\t$height_original = imagesy($image);\r\n\t\t}\r\n\t\t\r\n\t\t//\r\n\t\tif ( empty($width_original) || empty($height_original) ) { //\r\n\t\t\ttrigger_error('no original dimensions specified', E_USER_WARNING);\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\t// ---------\r\n\t\tif ( is_null($width_desired) && !is_null($width_new) ) {\r\n\t\t\t$width_desired = $width_new;\r\n\t\t\t$width_new = null;\r\n\t\t}\r\n\t\tif ( is_null($height_desired) && !is_null($height_new) ) {\r\n\t\t\t$height_desired = $height_new;\r\n\t\t\t$height_new = null;\r\n\t\t}\r\n\t\t\r\n\t\t//\r\n\t\tif ( is_null($width_desired) || is_null($height_desired) ) { // Don't do any resizing\r\n\t\t\ttrigger_error('no desired dimensions specified', E_USER_NOTICE);\r\n\t\t\t// return array( 'width' => $width_original, 'height' => $height_original );\r\n\t\t}\r\n\t\t\r\n\t\t// ---------\r\n\t\tif ( is_null($resize_mode) ) {\r\n\t\t\t$resize_mode = 'area';\r\n\t\t} elseif ( $resize_mode === 'none' ) { // Don't do any resizing\r\n\t\t\ttrigger_error('$resize_mode === \\'none\\'', E_USER_NOTICE);\r\n\t\t\t// return array( 'width' => $width_original, 'height' => $height_original );\r\n\t\t} elseif ( !in_array($resize_mode, array('area', 'crop', 'exact', true)) ) { //\r\n\t\t\ttrigger_error('Passed $resize_mode is not valid: ' . var_export(compact('resize_mode'), true), E_USER_WARNING);\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\t// ---------\r\n\t\tif ( is_null($x_original) && !is_null($x_old) ) {\r\n\t\t\t$x_original = $x_old;\r\n\t\t\tunset($x_old);\r\n\t\t}\r\n\t\tif ( is_null($y_original) && !is_null($y_old) ) {\r\n\t\t\t$y_original = $y_old;\r\n\t\t\tunset($y_old);\r\n\t\t}\r\n\t\tif ( is_null($x_original) )\r\n\t\t\t$x_original = 0;\r\n\t\tif ( is_null($y_original) )\r\n\t\t\t$y_original = 0;\r\n\t\t\t\r\n\t\t// ---------\r\n\t\t// Let's force integer values\r\n\t\t$width_original = intval($width_original);\r\n\t\t$height_original = intval($height_original);\r\n\t\t$width_desired = intval($width_desired);\r\n\t\t$height_desired = intval($height_desired);\r\n\t\t\r\n\t\t// ---------\r\n\t\t// Set proportions\r\n\t\tif ( $height_original !== 0 )\r\n\t\t\t$proportion_wh = $width_original / $height_original;\r\n\t\tif ( $width_original !== 0 )\r\n\t\t\t$proportion_hw = $height_original / $width_original;\r\n\t\t\r\n\t\tif ( $height_desired !== 0 )\r\n\t\t\t$proportion_wh_desired = $width_desired / $height_desired;\r\n\t\tif ( $width_desired !== 0 )\r\n\t\t\t$proportion_hw_desired = $height_desired / $width_desired;\r\n\t\t\t\r\n\t\t// ---------\r\n\t\t// Set cutoms\r\n\t\t$x_new = $x_original;\r\n\t\t$y_new = $y_original;\r\n\t\t$canvas_width = $canvas_height = null;\r\n\t\t\r\n\t\t// ---------\r\n\t\t$width_new = $width_original;\r\n\t\t$height_new = $height_original;\r\n\t\t\r\n\t\t// ---------\r\n\t\t// Do resize\r\n\t\tif ( $height_desired === 0 && $width_desired === 0 ) {\r\n\t\t\t// Nothing to do\r\n\t\t} elseif ( $height_desired === 0 && $width_desired !== 0 ) {\r\n\t\t\t// We don't care about the height\r\n\t\t\t$width_new = $width_desired;\r\n\t\t\tif ( $resize_mode !== 'exact' ) {\r\n\t\t\t\t// h = w*(h/w)\r\n\t\t\t\t$height_new = $width_desired * $proportion_hw;\r\n\t\t\t}\r\n\t\t} elseif ( $height_desired !== 0 && $width_desired === 0 ) {\r\n\t\t\t// We don't care about the width\r\n\t\t\tif ( $resize_mode !== 'exact' ) {\r\n\t\t\t\t // w = h*(w/h)\r\n\t\t\t\t$width_new = $height_desired * $proportion_wh;\r\n\t\t\t}\r\n\t\t\t$height_new = $height_desired;\r\n\t\t} else {\r\n\t\t\t// We care about both\r\n\r\n\t\t\tif ( $resize_mode === 'exact' || /* no upscaling */ ($width_original <= $width_desired && $height_original <= $height_desired) ) { // Nothing to do\r\n\t\t\t} elseif ( $resize_mode === 'area' ) { // Proportion to fit inside\r\n\t\t\t\t\r\n\r\n\t\t\t\t// Pick which option\r\n\t\t\t\tif ( $proportion_wh <= $proportion_wh_desired ) { // Option 1: wh\r\n\t\t\t\t\t// Height would of overflowed\r\n\t\t\t\t\t$width_new = $height_desired * $proportion_wh; // w = h*(w/h)\r\n\t\t\t\t\t$height_new = $height_desired;\r\n\t\t\t\t} else // if ( $proportion_hw <= $proportion_hw_desired )\r\n{ // Option 2: hw\r\n\t\t\t\t\t// Width would of overflowed\r\n\t\t\t\t\t$width_new = $width_desired;\r\n\t\t\t\t\t$height_new = $width_desired * $proportion_hw; // h = w*(h/w)\r\n\t\t\t\t}\r\n\t\t\t\r\n\t\t\t} elseif ( $resize_mode === 'crop' ) { // Proportion to occupy\r\n\t\t\t\t\r\n\r\n\t\t\t\t// Pick which option\r\n\t\t\t\tif ( $proportion_wh <= $proportion_wh_desired ) { // Option 2: hw\r\n\t\t\t\t\t// Height will overflow\r\n\t\t\t\t\t$width_new = $width_desired;\r\n\t\t\t\t\t$height_new = $width_desired * $proportion_hw; // h = w*(h/w)\r\n\t\t\t\t\t// Set custom\r\n\t\t\t\t\t$y_new = -($height_new - $height_desired) / 2;\r\n\t\t\t\t} else // if ( $proportion_hw <= $proportion_hw_desired )\r\n{ // Option 1: hw\r\n\t\t\t\t\t// Width will overflow\r\n\t\t\t\t\t$width_new = $height_desired * $proportion_wh; // w = h*(w/h)\r\n\t\t\t\t\t$height_new = $height_desired;\r\n\t\t\t\t\t// Set custom\r\n\t\t\t\t\t$x_new = -($width_new - $width_desired) / 2;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t// Set canvas\r\n\t\t\t\t$canvas_width = $width_desired;\r\n\t\t\t\t$canvas_height = $height_desired;\r\n\t\t\t\r\n\t\t\t}\r\n\t\t\r\n\t\t}\r\n\t\t\r\n\t\t// ---------\r\n\t\t// Set custom if they have not been set already\r\n\t\tif ( $canvas_width === null )\r\n\t\t\t$canvas_width = $width_new;\r\n\t\tif ( $canvas_height === null )\r\n\t\t\t$canvas_height = $height_new;\r\n\t\t\t\r\n\t\t// ---------\r\n\t\t// Compat\r\n\t\t$width_old = $width_original;\r\n\t\t$height_old = $height_original;\r\n\t\t$x_old = $x_original;\r\n\t\t$y_old = $y_original;\r\n\t\t\r\n\t\t// ---------\r\n\t\t// Return\r\n\t\t$return = compact('width_original', 'height_original', 'width_old', 'height_old', 'width_desired', 'height_desired', 'width_new', 'height_new', 'canvas_width', 'canvas_height', 'x_original', 'y_original', 'x_old', 'y_old', 'x_new', 'y_new');\r\n\t\t// echo '<--'; var_dump($return); echo '-->';\r\n\t\treturn $return;\r\n\t}", "function normal_resize_image($source, $destination, $image_type, $max_size, $image_width, $image_height, $quality){\n\n\tif($image_width <= 0 || $image_height <= 0){return false;} //return false if nothing to resize\n\n\t//do not resize if image is smaller than max size\n\tif($image_width <= $max_size && $image_height <= $max_size){\n\t\tif(save_image($source, $destination, $image_type, $quality)){\n\t\t\treturn true;\n\t\t}\n\t}\n\n\t//Construct a proportional size of new image\n\t$image_scale\t= min($max_size/$image_width, $max_size/$image_height);\n\t$new_width\t\t= ceil($image_scale * $image_width);\n\t$new_height\t\t= ceil($image_scale * $image_height);\n\n\t$new_canvas\t\t= imagecreatetruecolor( $new_width, $new_height ); //Create a new true color image\n\n\t//Copy and resize part of an image with resampling\n\tif(imagecopyresampled($new_canvas, $source, 0, 0, 0, 0, $new_width, $new_height, $image_width, $image_height)){\n\t\tsave_image($new_canvas, $destination, $image_type, $quality); //save resized image\n\t}\n\n\treturn true;\n}", "static function resize($sourcePath, $newWidth = 100, $newHeight = 100)\n {\n switch (exif_imagetype($sourcePath)) {\n case IMAGETYPE_JPEG :\n $sourceImage = imagecreatefromjpeg($sourcePath);\n break;\n case IMAGETYPE_PNG :\n $sourceImage = imagecreatefrompng($sourcePath);\n break;\n case IMAGETYPE_GIF :\n $sourceImage = imagecreatefromgif($sourcePath);\n break;\n default:\n return;\n }\n\n // Create the new image (still blank/empty)\n $newImage = imagecreatetruecolor($newWidth, $newHeight);\n imagesetinterpolation($newImage, IMG_SINC);\n\n // Determine the source image Dimensions\n $sourceImageWidth = imagesx($sourceImage);\n $sourceImageHeight = imagesy($sourceImage);\n $sourceImageAspectRatio = $sourceImageWidth / $sourceImageHeight;\n $newImageAspectRatio = $newWidth / $newHeight;\n\n // Determine parameters and copy part of the source image into the new image\n if ($newImageAspectRatio >= $sourceImageAspectRatio) { // width is the limiting factor for the source image\n $src_x = 0;\n $src_w = $sourceImageWidth;\n $src_h = $src_w / $newImageAspectRatio;\n $src_y = ($sourceImageHeight - $src_h) / 2;\n } else { // height of source image is limiting factor\n $src_y = 0;\n $src_h = $sourceImageHeight;\n $src_w = $src_h * $newImageAspectRatio;\n $src_x = ($sourceImageWidth - $src_w) / 2;\n }\n\n imagecopyresampled($newImage, $sourceImage, 0, 0, $src_x, $src_y, $newWidth, $newHeight, $src_w, $src_h);\n\n // Save new image to destination path\n switch (exif_imagetype($sourcePath)) {\n case IMAGETYPE_JPEG :\n imagejpeg($newImage, $sourcePath, 100);\n break;\n case IMAGETYPE_PNG :\n imagepng($newImage, $sourcePath);\n break;\n case IMAGETYPE_GIF :\n imagegif($newImage, $sourcePath);\n break;\n }\n\n // Remove image resources to reallocate space\n imagedestroy($sourceImage);\n imagedestroy($newImage);\n }", "public function resize($width, $height = NULL, $resizeMode = NULL)\n {\n if(!$height)\n {\n $height = $width;\n }\n\n $this->effect[] = new Resize($width, $height, $resizeMode);\n }", "private static function resize_image($source, $width, $height){\n\t\t$source_width = imagesx($source);\n\t\t$source_height = imagesy($source);\n\t\t$source_aspect = round($source_width / $source_height, 1);\n\t\t$target_aspect = round($width / $height, 1);\n\t\n\t\t$resized = imagecreatetruecolor($width, $height);\n\t\n\t\tif ($source_aspect < $target_aspect){\n\t\t\t// higher\n\t\t\t$new_size = array($width, ($width / $source_width) * $source_height);\n\t\t\t$source_pos = array(0, (($new_size[1] - $height) * ($source_height / $new_size[1])) / 2);\n\t\t}else if ($source_aspect > $target_aspect){\n\t\t\t// wider\n\t\t\t$new_size = array(($height / $source_height) * $source_width, $height);\n\t\t\t$source_pos = array((($new_size[0] - $width) * ($source_width / $new_size[0])) / 2, 0);\n\t\t}else{\n\t\t\t// same shape\n\t\t\t$new_size = array($width, $height);\n\t\t\t$source_pos = array(0, 0);\n\t\t}\n\t\n\t\tif ($new_size[0] < 1) $new_size[0] = 1;\n\t\tif ($new_size[1] < 1) $new_size[1] = 1;\n\t\n\t\timagecopyresampled($resized, $source, 0, 0, $source_pos[0], $source_pos[1], $new_size[0], $new_size[1], $source_width, $source_height);\n\t\n\t\treturn $resized;\n\t}", "private function resize($width,$height) {\n $newImage = imagecreatetruecolor($width, $height);\n imagealphablending($newImage, false);\n imagesavealpha($newImage, true);\n imagecopyresampled($newImage, $this->image, 0, 0, 0, 0, $width, $height, $this->getWidth(), $this->getHeight());\n $this->image = $newImage;\n }", "protected function _do_resize($width, $height)\n {\n $pre_width = $this->width;\n $pre_height = $this->height;\n\n // Loads image if not yet loaded\n $this->_load_image();\n\n // Test if we can do a resize without resampling to speed up the final resize\n if ($width > ($this->width / 2) AND $height > ($this->height / 2))\n {\n // The maximum reduction is 10% greater than the final size\n $reduction_width = round($width * 1.1);\n $reduction_height = round($height * 1.1);\n\n while ($pre_width / 2 > $reduction_width AND $pre_height / 2 > $reduction_height)\n {\n // Reduce the size using an O(2n) algorithm, until it reaches the maximum reduction\n $pre_width /= 2;\n $pre_height /= 2;\n }\n\n // Create the temporary image to copy to\n $image = $this->_create($pre_width, $pre_height);\n\n if (imagecopyresized($image, $this->_image, 0, 0, 0, 0, $pre_width, $pre_height, $this->width, $this->height))\n {\n // Swap the new image for the old one\n imagedestroy($this->_image);\n $this->_image = $image;\n }\n }\n\n // Create the temporary image to copy to\n $image = $this->_create($width, $height);\n\n // Execute the resize\n if (imagecopyresampled($image, $this->_image, 0, 0, 0, 0, $width, $height, $pre_width, $pre_height))\n {\n // Swap the new image for the old one\n imagedestroy($this->_image);\n $this->_image = $image;\n\n // Reset the width and height\n $this->width = imagesx($image);\n $this->height = imagesy($image);\n }\n }", "protected function update_size($width = \\null, $height = \\null)\n {\n }", "function resizeImage($fileName,$maxWidth,$maxHight,$originalFileSufix=\"\")\n{\n $limitedext = array(\".gif\",\".jpg\",\".png\",\".jpeg\");\n\n //check the file's extension\n $ext = strrchr($fileName,'.');\n $ext = strtolower($ext);\n\n //uh-oh! the file extension is not allowed!\n if (!in_array($ext,$limitedext)) {\n exit();\n }\n\n if($ext== \".jpeg\" || $ext == \".jpg\"){\n $new_img = imagecreatefromjpeg($fileName);\n }elseif($ext == \".png\" ){\n $new_img = imagecreatefrompng($fileName);\n }elseif($ext == \".gif\"){\n $new_img = imagecreatefromgif($fileName);\n }\n\n //list the width and height and keep the height ratio.\n list($width, $height) = getimagesize($fileName);\n\n //calculate the image ratio\n $imgratio=$width/$height;\n $newwidth = $width;\n $newheight = $height;\n\n //Image format -\n if ($imgratio>1){\n if ($width>$maxWidth) {\n $newwidth = $maxWidth;\n $newheight = $maxWidth/$imgratio;\n }\n //image format |\n }else{\n if ($height>$maxHight) {\n $newheight = $maxHight;\n $newwidth = $maxHight*$imgratio;\n }\n }\n\n //function for resize image.\n $resized_img = imagecreatetruecolor($newwidth,$newheight);\n\n //the resizing is going on here!\n imagecopyresized($resized_img, $new_img, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);\n\n //finally, save the image\n if ($originalFileSufix!=\"\") {\n $path_parts=pathinfo($fileName);\n rename($fileName,$path_parts[\"dirname\"].DIRECTORY_SEPARATOR.$path_parts[\"filename\"].\"_\".$originalFileSufix.\".\".$path_parts[\"extension\"]);\n }\n ImageJpeg ($resized_img,$fileName,80);\n\n ImageDestroy ($resized_img);\n ImageDestroy ($new_img);\n}", "public function uploadAndResize($request, $width=null, $height=null)\n {\n if( is_null($width) && is_null($height) )\n {\n $width = 1600; \n $height = 1000;\n }\n\n if($request->file('file'))\n {\n $this->validate($request, ['file' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048']);\n $image = $request->file('file');\n $input['imagename'] = time().'.'.$image->getClientOriginalExtension();\n $destinationPath = public_path('/images');\n\n //redimensionner Image\n $image_resize = Resize::make($image->getRealPath()); \n $resultat = $image_resize->resize($width, $height);\n $path = $destinationPath . '/' . $input['imagename'];\n $image_resize->save($path);\n return $input['imagename'];\n }\n }", "public function resize($dimensions = false, $method = 'fit') {\n\t\tif($dimensions === false || empty($dimensions)) {\n\t\t\treturn false;\n\t\t}\n\n\t\t$user_cover_method = false;\n\n\t\t// If we only have one dimension, it's the width. Copy it down.\n\t\tif(is_array($dimensions) && (count($dimensions) === 1 || empty($dimensions[1]))) {\n\t\t\t$dimensions = $dimensions[0];\n\t\t}\n\n\t\t// The developer only sent the width, so do the math.\n\t\tif(!is_array($dimensions)) {\n\t\t\t$dimensions = (int) $dimensions;\n\t\t\t$new_width = $dimensions;\n\t\t\t$new_height = ceil($this->height*$new_width/$this->width);\n\n\t\t// The developer sent width and height or just height.\n\t\t} else {\n\t\t\t// The developer sent only the new height, so do the math.\n\t\t\tif(empty($dimensions[0])) {\n\t\t\t\t$dimensions = (int) $dimensions[1];\n\t\t\t\t$new_height = $dimensions;\n\t\t\t\t$new_width = $this->width*$new_height/$this->height;\n\n\t\t\t// The developer sent width and height, so we either need to make it fit or stretch it.\n\t\t\t} else {\n\t\t\t\tswitch($method) {\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t// The width and height if we scaled the new dimensions up to current width and height.\n\t\t\t\t\t\t$pretend_height = $this->width*$dimensions[1]/$dimensions[0];\n\t\t\t\t\t\t$pretend_width = $this->height*$dimensions[0]/$dimensions[1];\n\n\t\t\t\t\t\tif($pretend_height > $this->height) {\n\t\t\t\t\t\t\t$new_width = $dimensions[0];\n\t\t\t\t\t\t\t$new_height = $this->height*$new_width/$this->width;\n\t\t\t\t\t\t} else if($pretend_width > $this->width) {\n\t\t\t\t\t\t\t$new_height = $dimensions[1];\n\t\t\t\t\t\t\t$new_width = $this->width*$new_height/$this->height;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$new_width = $dimensions[0];\n\t\t\t\t\t\t\t$new_height = $this->height*$new_width/$this->width;\n\t\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'cover':\n\t\t\t\t\t\t// The width and height if we scaled the new dimensions up to current width and height.\n\t\t\t\t\t\t$pretend_height = $this->width*$dimensions[1]/$dimensions[0];\n\t\t\t\t\t\t$pretend_width = $this->height*$dimensions[0]/$dimensions[1];\n\n\t\t\t\t\t\t// We have two dimensions and the user chose to cover.\n\t\t\t\t\t\t$user_cover_method = true;\n\n\t\t\t\t\t\tif($pretend_width > $this->width) {\n\t\t\t\t\t\t\t$new_width = $dimensions[0];\n\t\t\t\t\t\t\t$new_height = $this->height*$new_width/$this->width;\n\t\t\t\t\t\t} else if($pretend_height > $this->height) {\n\t\t\t\t\t\t\t$new_height = $dimensions[1];\n\t\t\t\t\t\t\t$new_width = $this->width*$new_height/$this->height;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$new_width = $dimensions[0];\n\t\t\t\t\t\t\t$new_height = $this->height*$new_width/$this->width;\n\t\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'stretch':\n\t\t\t\t\t\t// Stretching only happens if both dimensions are set and stretch is set.\n\t\t\t\t\t\t$new_width = $dimensions[0];\n\t\t\t\t\t\t$new_height = $dimensions[1];\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Photoshop rounds up, so we'll go with that.\n\t\t$new_width = ceil($new_width);\n\t\t$new_height = ceil($new_height);\n\n\t\t// If we definitely have a cover method, we will use the dimensions as the new image dimensions.\n\t\tif($user_cover_method) {\n\t\t\t$working_image = imagecreatetruecolor((int) $dimensions[0], (int) $dimensions[1]);\n\t\t\t// The image will be centered.\n\t\t\t$offset_x = ceil(abs(($new_width-$dimensions[0])/2));\n\t\t\t$offset_y = ceil(abs(($new_height-$dimensions[1])/2));\n\n\t\t// If we do not have a cover method, we will use the new width and height.\n\t\t} else {\n\t\t\t$working_image = imagecreatetruecolor($new_width, $new_height);\n\t\t\t// The image will go on the top left.\n\t\t\t$offset_x = 0;\n\t\t\t$offset_y = 0;\n\t\t}\n\n\t\tif(imagecopyresampled($working_image, $this->image, 0, 0, $offset_x, $offset_y, $new_width, $new_height, $this->width, $this->height)) {\n\t\t\t$this->image = $working_image;\n\t\t\t$this->width = $new_width;\n\t\t\t$this->height = $new_height;\n\t\t\t$this->aspect = $this->width/$this->height;\n\t\t\tif($this->aspect > 1) {\n\t\t\t\t$this->orientation = 'landscape';\n\t\t\t} else if($this->aspect < 1) {\n\t\t\t\t$this->orientation = 'portrait';\n\t\t\t} else {\n\t\t\t\t$this->orientation = 'square';\n\t\t\t}\n\t\t\treturn true;\n\t\t} else {\n\t\t\ttrigger_error('Resize failed.', E_USER_WARNING);\n\t\t\treturn false;\n\t\t}\n\t}", "public function image_fixed_resize($width, $height, $crop = true){\n $ratio = $this->width / $this->height;\n $original_ratio = $width / $height;\n\n $crop_width = $this->width;\n $crop_height = $this->height;\n\n if($ratio > $original_ratio)\n {\n $crop_width = round($original_ratio * $crop_height);\n }\n else\n {\n $crop_height = round($crop_width / $original_ratio);\n }\n if($crop)\n $this->crop($crop_width, $crop_height);\n $this->resize($width, $height);\n }", "function funcs_resizeImageFile($file,$newWidth,$newHeight,$oldWidth,$oldHeight,$destination = null,$quality = 75){\n\t//create a new pallete for both source and destination\n\t$dest = imagecreatetruecolor($newWidth, $newHeight);\n\tif (preg_match('/\\.gif$/',$file)){\n\t\t$source = imagecreatefromgif($file);\n\t}else{\n\t\t//assume jpeg since we only allow jpeg and gif\n\t\t$source = imagecreatefromjpeg($file);\n\t}\n\t//copy the source pallete onto destination pallete\n\timagecopyresampled($dest,$source,0,0,0,0, $newWidth, $newHeight, $oldWidth,$oldHeight);\n\t//save file\n\tif (preg_match('/\\.gif$/',$file)){\n\t\timagegif($dest,((is_null($destination))?$file:$destination));\n\t}else{\n\t\timagejpeg($dest,((is_null($destination))?$file:$destination),$quality);\n\t}\n}", "public function smartResizeImage($file, $width = 0, $height = 0, $proportional = false, $output = 'file') {\n //echo $file;\n if ($height <= 0 && $width <= 0) {\n return false;\n }\n $info = getimagesize($file);\n $image = '';\n $final_width = 0;\n $final_height = 0;\n list($width_old, $height_old) = $info;\n if (\n $proportional) {\n if ($width == 0)\n $factor = $height / $height_old;\n elseif ($height == 0)\n $factor = $width / $width_old;\n else\n $factor = min($width / $width_old, $height / $height_old);\n $final_width = round($width_old * $factor);\n $final_height = round($height_old * $factor);\n } else {\n $final_width = ( $width <= 0 ) ? $width_old : $width;\n $final_height = ( $height <= 0 ) ? $height_old : $height;\n }\n switch (\n $info[2]) {\n case IMAGETYPE_GIF:\n $image = imagecreatefromgif($file);\n break;\n case IMAGETYPE_JPEG:\n $image = imagecreatefromjpeg($file);\n break;\n case IMAGETYPE_PNG:\n $image = imagecreatefrompng($file);\n break;\n default:\n return false;\n }\n $image_resized = imagecreatetruecolor($final_width, $final_height);\n if (($info[2] == IMAGETYPE_GIF) || ($info[2] == IMAGETYPE_PNG)) {\n $trnprt_indx = imagecolortransparent($image);\n // If we have a specific transparent color\n if ($trnprt_indx >= 0) {\n // Get the original image's transparent color's RGB values\n $trnprt_color = imagecolorsforindex($image, $trnprt_indx);\n // Allocate the same color in the new image resource\n $trnprt_indx = imagecolorallocate($image_resized, $trnprt_color['red'], $trnprt_color['green'], $trnprt_color['blue']);\n // Completely fill the background of the new image with allocated color.\n imagefill($image_resized, 0, 0, $trnprt_indx);\n // Set the background color for new image to transparent\n imagecolortransparent($image_resized, $trnprt_indx);\n }\n // Always make a transparent background color for PNGs that don't have one allocated already\n elseif ($info[2] == IMAGETYPE_PNG) {\n // Turn off transparency blending (temporarily)\n imagealphablending($image_resized, false);\n // Create a new transparent color for image\n $color = imagecolorallocatealpha($image_resized, 0, 0, 0, 127);\n // Completely fill the background of the new image with allocated color.\n imagefill($image_resized, 0, 0, $color);\n // Restore transparency blending\n imagesavealpha($image_resized, true);\n }\n }\n //echo $image_resized.' AND '.$image;\n imagecopyresampled($image_resized, $image, 0, 0, 0, 0, $final_width, $final_height, $width_old, $height_old);\n /* if ( $delete_original ) {\n if ( $use_linux_commands )\n exec('rm '.$file);\n else\n @unlink($file);\n } */\n switch (strtolower($output)) {\n case 'browser':\n $mime = image_type_to_mime_type($info[2]);\n header(\"Content-type: $mime\");\n $output = NULL;\n break;\n case 'file':\n $output = $file;\n break;\n case 'return':\n return $image_resized;\n break;\n default:\n break;\n }\n switch (\n $info[2]) {\n case IMAGETYPE_GIF:\n imagegif($image_resized, $output);\n break;\n case IMAGETYPE_JPEG:\n imagejpeg($image_resized, $output);\n break;\n case IMAGETYPE_PNG:\n imagepng($image_resized, $output);\n break;\n default:\n return false;\n }\n return\n true;\n }", "public function resize($width = null, $height = null)\n {\n $width = isset($width) ? $width : $this->r_width;\n $height = isset($height) ? $height : $this->r_height;\n\n $src = Timber\\ImageHelper::resize($this->src, $width, $height);\n return $this->copySelf($src);\n }", "function scaleByLength($size)\r\n {\r\n if ($this->img_x >= $this->img_y) {\r\n $new_x = $size;\r\n $new_y = round(($new_x / $this->img_x) * $this->img_y, 0);\r\n } else {\r\n $new_y = $size;\r\n $new_x = round(($new_y / $this->img_y) * $this->img_x, 0);\r\n }\r\n return $this->_resize($new_x, $new_y);\r\n }", "function normal_resize_image($source, $destination, $image_type, $max_size, $image_width, $image_height, $quality){\n\n if($image_width <= 0 || $image_height <= 0){return false;} //return false if nothing to resize\n\n //do not resize if image is smaller than max size\n if($image_width <= $max_size && $image_height <= $max_size){\n if(save_image($source, $destination, $image_type, $quality)){\n return true;\n }\n }\n\n //Construct a proportional size of new image\n $image_scale\t= min($max_size/$image_width, $max_size/$image_height);\n $new_width\t\t= ceil($image_scale * $image_width);\n $new_height\t\t= ceil($image_scale * $image_height);\n\n $new_canvas\t\t= imagecreatetruecolor( $new_width, $new_height ); //Create a new true color image\n\n //Copy and resize part of an image with resampling\n if(imagecopyresampled($new_canvas, $source, 0, 0, 0, 0, $new_width, $new_height, $image_width, $image_height)){\n save_image($new_canvas, $destination, $image_type, $quality); //save resized image\n }\n\n return true;\n}", "public function resize($newWidth, $newHeight)\n {\n $imageIn = $this->getWorkingImageResource();\n $imageOut = imagecreatetruecolor($newWidth, $newHeight);\n imagecopyresampled(\n $imageOut, // resource dst_im\n $imageIn, // resource src_im\n 0, // int dst_x\n 0, // int dst_y\n 0, // int src_x\n 0, // int src_y\n $newWidth, // int dst_w\n $newHeight, // int dst_h\n $this->getWorkingImageWidth(), // int src_w\n $this->getWorkingImageHeight() // int src_h\n );\n\n $this->setWorkingImageResource($imageOut);\n }", "function imgResize($file_ori,$UploadPath,$Resize=1,$imgx=130,$imgy=150,$clean=0,$postFix=\"\") {\n\t\t$dest_filename='';\n\t\t$handle = new upload($file_ori);\n\t\t$img_proper=getimagesize($file_ori['tmp_name']);\n\t\tif ($handle->uploaded) {\n\t\t\tif($img_proper[0]>$imgx && $img_proper[1]>$imgy && $Resize==1)\t{\n\t\t\t\t$handle->image_x = $imgx;\n\t\t\t\t$handle->image_y = $imgy;\n\t\t\t\t$handle->image_resize = true;\n\t\t\t\t$handle->image_ratio_y = true;\n\t\t\t\t$handle->image_ratio_x = true;\n\t\t\t\t$handle->dir_auto_create = true;\n\t\t\t\t$handle->dir_auto_chmod = true;\n\t\t\t\t$handle->dir_chmod = 0777;\n\t\t\t} else if($img_proper[0]>$imgx && $img_proper[1]<$imgy && $Resize==1)\t{\n\t\t\t\t$handle->image_x = $imgx;\n\t\t\t\t$handle->image_resize = true;\n\t\t\t\t$handle->image_ratio_y = true;\n\t\t\t\t$handle->dir_auto_create = true;\n\t\t\t\t$handle->dir_auto_chmod = true;\n\t\t\t\t$handle->dir_chmod = 0777;\n\t\t\t} else if($img_proper[0]<$imgx && $img_proper[1]>$imgy && $Resize==1)\t{\n\t\t\t\t$handle->image_y = $imgy;\n\t\t\t\t$handle->image_resize = true;\n\t\t\t\t$handle->image_ratio_x = true;\n\t\t\t\t$handle->dir_auto_create = true;\n\t\t\t\t$handle->dir_auto_chmod = true;\n\t\t\t\t$handle->dir_chmod = 0777;\n\t\t\t}\n\t\t\t$handle->file_name_body_add = $postFix;\n\t\t\t$handle->process($UploadPath);\n\t\t\tif ($handle->processed) {\n\t\t\t\t$dest_filename=$handle->file_dst_name;\n\t\t\t\tif($clean==1)\n\t\t\t\t\t$handle->clean();\n\t\t\t} else\n\t\t\t\t$dest_filename='';\n\t\t}\n\t\treturn $dest_filename;\n\t}", "public function shrink(string $source, string $destination, ?int $width = null, ?int $height = null, int $quality = self::DEFAULT_JPEG_QUALITY): bool\n {\n $shrunk = $this->resize($source, $width, $height);\n\n if ($shrunk === null) {\n return false;\n }\n\n $success = imagejpeg($shrunk, $destination, $quality);\n\n imagedestroy($shrunk); // don't hog the RAM, we're not Slack or Chrome.\n\n return $success;\n }", "function resize_image($filename)\n {\n $img_source = 'assets/images/products/'. $filename;\n $img_target = 'assets/images/thumb/';\n\n // image lib settings\n $config = array(\n 'image_library' => 'gd2',\n 'source_image' => $img_source,\n 'new_image' => $img_target,\n 'maintain_ratio' => FALSE,\n 'width' => 128,\n 'height' => 128\n );\n // load image library\n $this->load->library('image_lib', $config);\n\n // resize image\n if(!$this->image_lib->resize())\n echo $this->image_lib->display_errors();\n $this->image_lib->clear();\n }", "function resizeImage($old_image_path, $new_image_path, $max_width, $max_height) {\r\n \r\n // Get image type\r\n $image_info = getimagesize($old_image_path);\r\n $image_type = $image_info[2];\r\n \r\n // Set up the function names\r\n switch ($image_type) {\r\n case IMAGETYPE_JPEG:\r\n $image_from_file = 'imagecreatefromjpeg';\r\n $image_to_file = 'imagejpeg';\r\n break;\r\n case IMAGETYPE_GIF:\r\n $image_from_file = 'imagecreatefromgif';\r\n $image_to_file = 'imagegif';\r\n break;\r\n case IMAGETYPE_PNG:\r\n $image_from_file = 'imagecreatefrompng';\r\n $image_to_file = 'imagepng';\r\n break;\r\n default:\r\n return;\r\n } // ends the swith\r\n \r\n // Get the old image and its height and width\r\n $old_image = $image_from_file($old_image_path);\r\n $old_width = imagesx($old_image);\r\n $old_height = imagesy($old_image);\r\n \r\n // Calculate height and width ratios\r\n $width_ratio = $old_width / $max_width;\r\n $height_ratio = $old_height / $max_height;\r\n \r\n // If image is larger than specified ratio, create the new image\r\n if ($width_ratio > 1 || $height_ratio > 1) {\r\n \r\n // Calculate height and width for the new image\r\n $ratio = max($width_ratio, $height_ratio);\r\n $new_height = round($old_height / $ratio);\r\n $new_width = round($old_width / $ratio);\r\n \r\n // Create the new image\r\n $new_image = imagecreatetruecolor($new_width, $new_height);\r\n \r\n // Set transparency according to image type\r\n if ($image_type == IMAGETYPE_GIF) {\r\n $alpha = imagecolorallocatealpha($new_image, 0, 0, 0, 127);\r\n imagecolortransparent($new_image, $alpha);\r\n }\r\n \r\n if ($image_type == IMAGETYPE_PNG || $image_type == IMAGETYPE_GIF) {\r\n imagealphablending($new_image, false);\r\n imagesavealpha($new_image, true);\r\n }\r\n \r\n // Copy old image to new image - this resizes the image\r\n $new_x = 0;\r\n $new_y = 0;\r\n $old_x = 0;\r\n $old_y = 0;\r\n imagecopyresampled($new_image, $old_image, $new_x, $new_y, $old_x, $old_y, $new_width, $new_height, $old_width, $old_height);\r\n \r\n // Write the new image to a new file\r\n $image_to_file($new_image, $new_image_path);\r\n // Free any memory associated with the new image\r\n imagedestroy($new_image);\r\n } else {\r\n // Write the old image to a new file\r\n $image_to_file($old_image, $new_image_path);\r\n }\r\n // Free any memory associated with the old image\r\n imagedestroy($old_image);\r\n }", "function resizeImage ( $sourcePathFilename, $extension, $destinationPath, $maxWidth, $maxHeight ) {\n $result = '';\n debug_log ( __FILE__, __LINE__, $sourcePathFilename );\n debug_log ( __FILE__, __LINE__, $extension );\n\n if ( $sourcePathFilename != '' && $extension != '' ) {\n if ( in_array ( $extension, array ( 'jpg', 'jpeg', 'png', 'gif' ) ) ) {\n switch ( $extension ) {\n case 'jpg':\n $imageOldData = imagecreatefromjpeg ( $sourcePathFilename );\n break;\n\n case 'jpeg':\n $imageOldData = imagecreatefromjpeg ( $sourcePathFilename );\n break;\n\n case 'png':\n $imageOldData = imagecreatefrompng ( $sourcePathFilename );\n break;\n\n case 'gif':\n $imageOldData = imagecreatefromgif ( $sourcePathFilename );\n break;\n\n default:\n $imageOldData = imagecreatefromjpeg ( $sourcePathFilename );\n }\n\n $imageOldWidth = imagesx ( $imageOldData );\n $imageOldHeight = imagesy ( $imageOldData );\n\n $imageScale = min ( $maxWidth / $imageOldWidth, $maxHeight / $imageOldHeight );\n\n $imageNewWidth = ceil ( $imageScale * $imageOldWidth );\n $imageNewHeight = ceil ( $imageScale * $imageOldHeight );\n\n $imageNewData = imagecreatetruecolor ( $imageNewWidth, $imageNewHeight );\n\n $colorWhite = imagecolorallocate ( $imageNewData, 255, 255, 255 );\n imagefill ( $imageNewData, 0, 0, $colorWhite );\n\n imagecopyresampled ( $imageNewData, $imageOldData, 0, 0, 0, 0, $imageNewWidth, $imageNewHeight, $imageOldWidth, $imageOldHeight );\n\n ob_start ();\n imagejpeg ( $imageNewData, NULL, 100 );\n $imageNewDataString = ob_get_clean ();\n\n $imageNewFilename = hash ( 'sha256', $imageNewDataString ) . uniqid () . '.jpg';\n\n $imageNewPathFilename = $destinationPath . $imageNewFilename;\n\n if ( file_put_contents ( $imageNewPathFilename, $imageNewDataString ) !== false )\n {\n $result = $imageNewFilename;\n }\n\n imagedestroy ( $imageNewData );\n imagedestroy ( $imageOldData );\n }\n }\n\n return $result;\n}", "public function resize($img_filename, $size)\n {\n $height = $this->config->get($size . '/height');\n $width = $this->config->get($size . '/width');\n $crop = $this->config->get($size . '/crop');\n $filters = $this->config->get($size . '/filters');\n $src_image_name = $this->config->get('archive') . $img_filename;\n $dst_image_name = $this->config->get('imageCache') . $size . $img_filename;\n if ($this->isResizeNeeded($src_image_name, $dst_image_name)) {\n if (is_int($height) && is_int($width) && $crop) {\n $this->resizer->crop($src_image_name, $dst_image_name, $width, $height, $filters);\n } elseif ($height !== null && $width !== null) {\n $this->resizer->scale($src_image_name, $dst_image_name, $width, $height, $filters);\n } else {\n die('Error resizing image');\n }\n }\n return $dst_image_name;\n }", "function smart_resize_image($file, $string = null, $width = 0, $height = 0, $proportional = false, $output = 'file', $delete_original = true, $use_linux_commands = false, $quality = 100, $grayscale = false\n) {\n\n if ($height <= 0 && $width <= 0)\n return false;\n if ($file === null && $string === null)\n return false;\n\n # Setting defaults and meta\n $info = $file !== null ? getimagesize($file) : getimagesizefromstring($string);\n $image = '';\n $final_width = 0;\n $final_height = 0;\n list($width_old, $height_old) = $info;\n $cropHeight = $cropWidth = 0;\n\n # Calculating proportionality\n if ($proportional) {\n if ($width == 0)\n $factor = $height / $height_old;\n elseif ($height == 0)\n $factor = $width / $width_old;\n else\n $factor = min($width / $width_old, $height / $height_old);\n\n $final_width = round($width_old * $factor);\n $final_height = round($height_old * $factor);\n }\n else {\n $final_width = ( $width <= 0 ) ? $width_old : $width;\n $final_height = ( $height <= 0 ) ? $height_old : $height;\n $widthX = $width_old / $width;\n $heightX = $height_old / $height;\n\n $x = min($widthX, $heightX);\n $cropWidth = ($width_old - $width * $x) / 2;\n $cropHeight = ($height_old - $height * $x) / 2;\n }\n\n # Loading image to memory according to type\n switch ($info[2]) {\n case IMAGETYPE_JPEG: $file !== null ? $image = imagecreatefromjpeg($file) : $image = imagecreatefromstring($string);\n break;\n case IMAGETYPE_GIF: $file !== null ? $image = imagecreatefromgif($file) : $image = imagecreatefromstring($string);\n break;\n case IMAGETYPE_PNG: $file !== null ? $image = imagecreatefrompng($file) : $image = imagecreatefromstring($string);\n break;\n default: return false;\n }\n\n # Making the image grayscale, if needed\n if ($grayscale) {\n imagefilter($image, IMG_FILTER_GRAYSCALE);\n }\n\n # This is the resizing/resampling/transparency-preserving magic\n $image_resized = imagecreatetruecolor($final_width, $final_height);\n if (($info[2] == IMAGETYPE_GIF) || ($info[2] == IMAGETYPE_PNG)) {\n $transparency = imagecolortransparent($image);\n $palletsize = imagecolorstotal($image);\n\n if ($transparency >= 0 && $transparency < $palletsize) {\n $transparent_color = imagecolorsforindex($image, $transparency);\n $transparency = imagecolorallocate($image_resized, $transparent_color['red'], $transparent_color['green'], $transparent_color['blue']);\n imagefill($image_resized, 0, 0, $transparency);\n imagecolortransparent($image_resized, $transparency);\n } elseif ($info[2] == IMAGETYPE_PNG) {\n imagealphablending($image_resized, false);\n $color = imagecolorallocatealpha($image_resized, 0, 0, 0, 127);\n imagefill($image_resized, 0, 0, $color);\n imagesavealpha($image_resized, true);\n }\n }\n imagecopyresampled($image_resized, $image, 0, 0, $cropWidth, $cropHeight, $final_width, $final_height, $width_old - 2 * $cropWidth, $height_old - 2 * $cropHeight);\n\n\n # Taking care of original, if needed\n if ($delete_original) {\n if ($use_linux_commands)\n exec('rm ' . $file);\n else\n @unlink($file);\n }\n\n # Preparing a method of providing result\n switch (strtolower($output)) {\n case 'browser':\n $mime = image_type_to_mime_type($info[2]);\n header(\"Content-type: $mime\");\n $output = NULL;\n break;\n case 'file':\n $output = $file;\n break;\n case 'return':\n return $image_resized;\n break;\n default:\n break;\n }\n\n # Writing image according to type to the output destination and image quality\n switch ($info[2]) {\n case IMAGETYPE_GIF: imagegif($image_resized, $output);\n break;\n case IMAGETYPE_JPEG: imagejpeg($image_resized, $output, $quality);\n break;\n case IMAGETYPE_PNG:\n $quality = 9 - (int) ((0.9 * $quality) / 10.0);\n imagepng($image_resized, $output, $quality);\n break;\n default: return false;\n }\n\n return true;\n}", "public function resizeImage($product, $imageId, $width, $height = null)\n {\n $resizedImage = $this->_productImageHelper\n ->init($product, $imageId)\n ->constrainOnly(TRUE)\n ->keepAspectRatio(TRUE)\n ->keepTransparency(TRUE)\n ->keepFrame(FALSE)\n ->resize($width, $height);\n return $resizedImage;\n }", "private function resizeWithScaleExact($width, $height, $scale) {\n\t\t//$new_height = (int)($this->info['height'] * $scale);\n\t\t$new_width = $width * $scale;\n\t\t$new_height = $height * $scale;\n\t\t$xpos = 0;//(int)(($width - $new_width) / 2);\n\t\t$ypos = 0;//(int)(($height - $new_height) / 2);\n\n if (isset($this->info['mime']) && $this->info['mime'] == 'image/gif' && $this->isAnimated) {\n $this->imagick = new Imagick($this->file);\n $this->imagick = $this->imagick->coalesceImages();\n foreach ($this->imagick as $frame) {\n $frame->thumbnailImage($new_width, $new_height);\n $frame->setImagePage($new_width, $new_height, 0, 0);\n }\n } else {\n $image_old = $this->image;\n $this->image = imagecreatetruecolor($width, $height);\n $bcg = $this->backgroundColor;\n\n if (isset($this->info['mime']) && $this->info['mime'] == 'image/png') {\n imagealphablending($this->image, false);\n imagesavealpha($this->image, true);\n $background = imagecolorallocatealpha($this->image, $bcg[0], $bcg[1], $bcg[2], 127);\n imagecolortransparent($this->image, $background);\n } else {\n $background = imagecolorallocate($this->image, $bcg[0], $bcg[1], $bcg[2]);\n }\n\n imagefilledrectangle($this->image, 0, 0, $width, $height, $background);\n imagecopyresampled($this->image, $image_old, $xpos, $ypos, 0, 0, $new_width, $new_height, $this->info['width'], $this->info['height']);\n imagedestroy($image_old);\n }\n\n\t\t$this->info['width'] = $width;\n\t\t$this->info['height'] = $height;\n }", "public static function maxBox($image = NULL, $width = NULL, $height = NULL, $enlarge = FALSE)\n\t{\n\n\t\tif (!($image instanceof Default_Model_MediaImage)) {\n\t\t\tthrow new Default_Model_MediaImage_Exception('Image needs to be an instance of Default_Model_MediaImage.');\n\t\t}\n\n\t\tif ($width &&\n\t\t\t!is_int($width)) {\n\n\t\t\tthrow new Default_Model_MediaImage_Exception('Width needs to be an integer, if specified.');\n\t\t}\n\n\t\tif ($height &&\n\t\t\t!is_int($height)) {\n\n\t\t\tthrow new Default_Model_MediaImage_Exception('Height needs to be an integer, if specified.');\n\t\t}\n\n\t\t$enlarge = (bool) $enlarge;\n\n\t\t/**\n\t\t * retrieve old width and height of image\n\t\t */\n\t\t$oldWidth = $image['width'];\n\t\t$oldHeight = $image['height'];\n\n\t\t/**\n\t\t * check for null division\n\t\t */\n\t\tif ($oldWidth == NULL ||\n\t\t\t$oldHeight == NULL) {\n\n\t\t\tthrow new Default_Model_MediaImage_Exception('There is no Default_Model_MediaImage specified.');\n\t\t}\n\n\t\t/**\n\t\t * calculate the new width and height maintaining aspect rotatio\n\t\t */\n\t\t/**\n\t\t * calculate with missing height or width\n\t\t */\n\t\tif ($width == 0 ||\n\t\t\t$height == 0) {\n\n\t\t\tif ($width == 0) {\n\n\t\t\t\t/**\n\t\t\t\t * calculate on missing width\n\t\t\t\t */\n\t\t\t\t/**\n\t\t\t\t * is image height < new height\n\t\t\t\t */\n\t\t\t\tif ($oldHeight < $height) {\n\n\t\t\t\t\t/**\n\t\t\t\t\t * should we enlarge the image?\n\t\t\t\t\t */\n\t\t\t\t\tif ($enlarge) {\n\t\t\t\t\t\t$newWidth = intval($oldWidth * ($height / $oldHeight));\n\t\t\t\t\t\t$newHeight = intval($height);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$newWidth = intval($oldWidth);\n\t\t\t\t\t\t$newHeight = intval($oldHeight);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t$newWidth = intval($oldWidth * ($height / $oldHeight));\n\t\t\t\t\t$newHeight = intval($height);\n\t\t\t\t}\n\t\t\t} else\n\t\t\tif ($height == 0) {\n\n\t\t\t\t/**\n\t\t\t\t * calculate on missing height\n\t\t\t\t */\n\t\t\t\t/**\n\t\t\t\t * is image width < new width\n\t\t\t\t */\n\t\t\t\tif ($oldWidth < $width) {\n\n\t\t\t\t\t/**\n\t\t\t\t\t * should we enlarge the image?\n\t\t\t\t\t */\n\t\t\t\t\tif ($enlarge) {\n\t\t\t\t\t\t$newWidth = intval($width);\n\t\t\t\t\t\t$newHeight = intval($oldHeight * ($width / $oldWidth));\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$newWidth = intval($oldWidth);\n\t\t\t\t\t\t$newHeight = intval($oldHeight);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t$newWidth = intval($width);\n\t\t\t\t\t$newHeight = intval($oldHeight * ($width / $oldWidth));\n\t\t\t\t}\n\t\t\t}\n\t\t} else\n\n\t\t/**\n\t\t * quotient calculation result: height > width\n\t\t */\n\t\tif ($oldWidth / $oldHeight < $width / $height) {\n\n\t\t\t/**\n\t\t\t * is image height < new height\n\t\t\t */\n\t\t\tif ($oldHeight < $height) {\n\n\t\t\t\t/**\n\t\t\t\t * should we enlarge the image?\n\t\t\t\t */\n\t\t\t\tif ($enlarge) {\n\n\t\t\t\t\t/**\n\t\t\t\t\t * enlarge\n\t\t\t\t\t */\n\t\t\t\t\t$newWidth = intval($oldWidth * ($height / $oldHeight));\n\t\t\t\t\t$newHeight = intval($height);\n\t\t\t\t} else {\n\n\t\t\t\t\t/**\n\t\t\t\t\t * keep it small as it is\n\t\t\t\t\t */\n\t\t\t\t\t$newWidth = intval($oldWidth);\n\t\t\t\t\t$newHeight = intval($oldHeight);\n\t\t\t\t}\n\t\t\t} else {\n\n\t\t\t\t/**\n\t\t\t\t * resize image with aspect rotatio\n\t\t\t\t */\n\t\t\t\t$newWidth = intval($oldWidth * ($height / $oldHeight));\n\t\t\t\t$newHeight = intval($height);\n\t\t\t}\n\t\t} else\n\n\t\t/**\n\t\t * quotient calculation result: width > height\n\t\t */\n\t\tif ($oldWidth / $oldHeight > $width / $height) {\n\n\t\t\t/**\n\t\t\t * is image width < new width\n\t\t\t */\n\t\t\tif ($oldWidth < $width) {\n\n\t\t\t\t/**\n\t\t\t\t * should we enlarge the image?\n\t\t\t\t */\n\t\t\t\tif ($enlarge) {\n\n\t\t\t\t\t/**\n\t\t\t\t\t * enlarge\n\t\t\t\t\t */\n\t\t\t\t\t$newWidth = intval($width);\n\t\t\t\t\t$newHeight = intval($oldHeight * ($width / $oldWidth));\n\t\t\t\t} else {\n\n\t\t\t\t\t/**\n\t\t\t\t\t * keep it as small as it is\n\t\t\t\t\t */\n\t\t\t\t\t$newWidth = intval($oldWidth);\n\t\t\t\t\t$newHeight = intval($oldHeight);\n\t\t\t\t}\n\t\t\t} else {\n\n\t\t\t\t/**\n\t\t\t\t * resize image with aspect rotatio\n\t\t\t\t */\n\t\t\t\t$newWidth = intval($width);\n\t\t\t\t$newHeight = intval($oldHeight * ($width / $oldWidth));\n\t\t\t}\n\t\t} else\n\n\t\t/**\n\t\t * quotient calculation result: width and height in aspect rotatio\n\t\t */\n\t\tif ($oldWidth / $oldHeight == $width / $height) {\n\n\t\t\t/**\n\t\t\t * is image smaller then the new one?\n\t\t\t */\n\t\t\tif ($oldWidth < $width ||\n\t\t\t\t$oldHeight < $height) {\n\n\t\t\t\t/**\n\t\t\t\t * should we enlarge the image\n\t\t\t\t */\n\t\t\t\tif ($enlarge) {\n\n\t\t\t\t\t/**\n\t\t\t\t\t * enlarge\n\t\t\t\t\t */\n\t\t\t\t\t$newWidth = intval($width);\n\t\t\t\t\t$newHeight = intval($height);\n\t\t\t\t} else {\n\n\t\t\t\t\t/**\n\t\t\t\t\t * keep it as small as it is\n\t\t\t\t\t */\n\t\t\t\t\t$newWidth = intval($oldWidth);\n\t\t\t\t\t$newHeight = intval($oldHeight);\n\t\t\t\t}\n\t\t\t} else {\n\n\t\t\t\t/**\n\t\t\t\t * resize image\n\t\t\t\t */\n\t\t\t\t$newWidth = intval($width);\n\t\t\t\t$newHeight = intval($height);\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new Default_Model_MediaImage_Exception('Unexpected failure. Something went wrong in calculation.');\n\t\t}\n\n\t\t/**\n\t\t * make sure, there is at least 1 pixel\n\t\t */\n\t\tif ($newWidth == 0) {\n\t\t\t$newWidth = 1;\n\t\t}\n\t\tif ($newHeight == 0) {\n\t\t\t$newHeight = 1;\n\t\t}\n\n\t\treturn self::_resize($image, $newWidth, $newHeight);\n\t}", "public function resize($w=null, $h=null)\n\t{\n\t\t$this->method = 'fit';\n $this->namePrefix = 'resize';\n\t\t$this->width = $w;\n\t\t$this->height = $h;\n\t\t$this->closure = function ($constraint) {\n $constraint->aspectRatio();\n\t\t\tif(! $this->upscale) $constraint->upsize();\n\t\t};\n\t\treturn $this;\n\t}", "function resizeImage($image,$width,$height,$scale,$stype) {\n\t$newImageWidth = ceil($width * $scale);\n\t$newImageHeight = ceil($height * $scale);\n\t$newImage = imagecreatetruecolor($newImageWidth,$newImageHeight);\n\tswitch($stype) {\n case 'gif':\n $source = imagecreatefromgif($image);\n break;\n case 'jpg':\n $source = imagecreatefromjpeg($image);\n break;\n case 'jpeg':\n $source = imagecreatefromjpeg($image);\n break;\n case 'png':\n $source = imagecreatefrompng($image);\n break;\n }\n\timagecopyresampled($newImage, $source,0,0,0,0, $newImageWidth, $newImageHeight, $width, $height);\n\timagejpeg($newImage,$image,90);\n\tchmod($image, 0777);\n\treturn $image;\n}", "public function resizeImage($image, $width = MEDIUM_IMAGE_MAX_WIDTH, $height = MEDIUM_IMAGE_MAX_HEIGHT, $subpath = IMG_SUBPATH_MEDIUM, $quality = JPEG_QUALITY) \n {\n // check if file is image\n if (!$this->isFileImage($image) ) {\n $this->throwException(FILE_IS_NOT_IMAGE, \"File is not an image\");\n }\n list($imgWidth, $imgHeight) = getimagesize($image);\n \n if ($imgWidth > $imgHeight) {\n $newWidth = $imgWidth / ($imgWidth / $width);\n $newHeight = $imgHeight / ($imgWidth / $width);\n } else {\n $newWidth = $imgWidth / ($imgHeight / $height);\n $newHeight = $imgHeight / ($imgHeight / $height);\n }\n\n $path = pathinfo($image);\n //print_r($path); // debug\n $src_img = imagecreatefromjpeg($image);\n $dest_img = imagecreatetruecolor($newWidth, $newHeight);\n imagecopyresampled($dest_img, $src_img, 0, 0, 0, 0, $newWidth, $newHeight, $imgWidth, $imgHeight);\n \n if (ADD_WATERMARK_TO_PHOTO) {\n //TODO: Add optional watermark to photo\n }\n \n imagejpeg($dest_img, IMAGE_STORAGE_PATH . $subpath . $path['filename'] . \".\" . $path['extension'], $quality);\n \n \n return IMAGE_STORAGE_PATH . $subpath . $path['filename'] . \".\" . $path['extension'];\n }", "public function resize()\n\t{\n\t\t$protocol = ($this->image_library === 'gd2') ? 'image_process_gd' : 'image_process_'.$this->image_library;\n\t\treturn $this->$protocol('resize');\n\t}", "public function url_resize($url, $width = null, $height = null, $options = []) {\r\n\t\treturn $this->url($url, $width, $height, array_merge(['resize'], $options));\r\n\t}", "function _resizeImageGD1($src_file, $dest_file, $new_size, $imgobj) {\r\n if ($imgobj->_size == null) {\r\n return false;\r\n }\r\n // GD1 can only handle JPG & PNG images\r\n if ($imgobj->_type !== \"jpg\" && $imgobj->_type !== \"jpeg\" && $imgobj->_type !== \"png\") {\r\n return false;\r\n }\r\n // height/width\r\n $ratio = max($imgobj->_size[0], $imgobj->_size[1]) / $new_size;\r\n $ratio = max($ratio, 1.0);\r\n $destWidth = (int)($imgobj->_size[0] / $ratio);\r\n $destHeight = (int)($imgobj->_size[1] / $ratio);\r\n if ($imgobj->_type == \"jpg\" || $imgobj->_type == \"jpeg\") {\r\n $src_img = imagecreatefromjpeg($src_file);\r\n } else {\r\n $src_img = imagecreatefrompng($src_file);\r\n }\r\n if (!$src_img) {\r\n return false;\r\n }\r\n $dst_img = imagecreate($destWidth, $destHeight);\r\n imagecopyresized($dst_img, $src_img, 0, 0, 0, 0, $destWidth, (int)$destHeight, $imgobj->_size[0], $imgobj->_size[1]);\r\n if ($imgobj->_type == \"jpg\" || $imgobj->_type == \"jpeg\") {\r\n imagejpeg($dst_img, $dest_file, $this->_JPEG_quality);\r\n } else {\r\n imagepng($dst_img, $dest_file);\r\n }\r\n imagedestroy($src_img);\r\n imagedestroy($dst_img);\r\n return true; \r\n }", "public function resizeInPlace(ImageInterface $image, Box $size, $mode = ImageInterface::THUMBNAIL_INSET, $filter = ImageInterface::FILTER_UNDEFINED)\n {\n if ($mode !== ImageInterface::THUMBNAIL_INSET && $mode !== ImageInterface::THUMBNAIL_OUTBOUND) {\n throw new InvalidArgumentException('Invalid mode specified');\n }\n\n $imageSize = $image->getSize();\n $ratios = [\n $size->getWidth() / $imageSize->getWidth(),\n $size->getHeight() / $imageSize->getHeight(),\n ];\n\n $image->strip();\n // if target width is larger than image width\n // AND target height is longer than image height\n if ($size->contains($imageSize)) {\n return;\n }\n\n if ($mode === ImageInterface::THUMBNAIL_INSET) {\n $ratio = min($ratios);\n } else {\n $ratio = max($ratios);\n }\n\n if ($mode === ImageInterface::THUMBNAIL_OUTBOUND) {\n if (!$imageSize->contains($size)) {\n $size = new Box(\n min($imageSize->getWidth(), $size->getWidth()),\n min($imageSize->getHeight(), $size->getHeight())\n );\n } else {\n $imageSize = $image->getSize()->scale($ratio);\n $image->resize($imageSize, $filter);\n }\n $image->crop(new Point(\n max(0, round(($imageSize->getWidth() - $size->getWidth()) / 2)),\n max(0, round(($imageSize->getHeight() - $size->getHeight()) / 2))\n ), $size);\n } else {\n if (!$imageSize->contains($size)) {\n $imageSize = $imageSize->scale($ratio);\n $image->resize($imageSize, $filter);\n } else {\n $imageSize = $image->getSize()->scale($ratio);\n $image->resize($imageSize, $filter);\n }\n }\n }", "public function normal_resize_image($source, $destination, $image_type, $max_size, $image_width, $image_height, $quality){\n\n if($image_width <= 0 || $image_height <= 0){return false;} //return false if nothing to resize\n\n //do not resize if image is smaller than max size\n if($image_width <= $max_size && $image_height <= $max_size){\n if($this->save_image($source, $destination, $image_type, $quality)){\n return true;\n }\n }\n\n //Construct a proportional size of new image\n $image_scale\t= min($max_size/$image_width, $max_size/$image_height);\n $new_width\t\t= ceil($image_scale * $image_width);\n $new_height\t\t= ceil($image_scale * $image_height);\n\n $new_canvas\t\t= imagecreatetruecolor( $new_width, $new_height ); //Create a new true color image\n\n //Copy and resize part of an image with resampling\n if(imagecopyresampled($new_canvas, $source, 0, 0, 0, 0, $new_width, $new_height, $image_width, $image_height)){\n $this->save_image($new_canvas, $destination, $image_type, $quality); //save resized image\n }\n\n return true;\n }", "function add_image_size($name, $width = 0, $height = 0, $crop = \\false)\n {\n }", "function resize( $jpg ) {\n\t$im = @imagecreatefromjpeg( $jpg );\n\t$filename = $jpg;\n\t$percent = 0.5;\n\tlist( $width, $height ) = getimagesize( $filename );\n\tif ( $uploader_name == \"c_master_imgs\" ):\n\t\t$new_width = $width;\n\t$new_height = $height;\n\telse :\n\t\tif ( $width > 699 ): $new_width = 699;\n\t$percent = 699 / $width;\n\t$new_height = $height * $percent;\n\telse :\n\t\t$new_width = $width;\n\t$new_height = $height;\n\tendif;\n\tendif; // end if measter images do not resize\n\t//if ( $new_height>600){ $new_height = 600; }\n\t$im = imagecreatetruecolor( $new_width, $new_height );\n\t$image = imagecreatefromjpeg( $filename );\n\timagecopyresampled( $im, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height );\n\t@imagejpeg( $im, $jpg, 80 );\n\t@imagedestroy( $im );\n}", "function imageresize($img,$target=\"\",$width=0,$height=0,$percent=0)\n{\n if (strpos($img,\".jpg\") !== false or strpos($img,\".jpeg\") !== false){\n\t $image = ImageCreateFromJpeg($img);\n\t $extension = \".jpg\";\n } elseif (strpos($img,\".png\") !== false) {\n\t $image = ImageCreateFromPng($img);\n\t $extension = \".png\";\n } elseif (strpos($img,\".gif\") !== false) {\n\t $image = ImageCreateFromGif($img);\n\t $extension = \".gif\";\n }elseif(getfiletype($img)=='bmp'){\n\t\t$image = ImageCreateFromwbmp($img);\n\t\t$extension = '.bmp';\n }\n\n $size = getimagesize ($img);\n\n // calculate missing values\n if ($width and !$height) {\n\t $height = ($size[1] / $size[0]) * $width;\n } elseif (!$width and $height) {\n\t $width = ($size[0] / $size[1]) * $height;\n } elseif ($percent) {\n\t $width = $size[0] / 100 * $percent;\n\t $height = $size[1] / 100 * $percent;\n } elseif (!$width and !$height and !$percent) {\n\t $width = 100; // here you can enter a standard value for actions where no arguments are given\n\t $height = ($size[1] / $size[0]) * $width;\n }\n\n $thumb = imagecreatetruecolor ($width, $height);\n\n if (function_exists(\"imageCopyResampled\"))\n {\n\t if (!@ImageCopyResampled($thumb, $image, 0, 0, 0, 0, $width, $height, $size[0], $size[1])) {\n\t\t ImageCopyResized($thumb, $image, 0, 0, 0, 0, $width, $height, $size[0], $size[1]);\n\t }\n\t} else {\n\t ImageCopyResized($thumb, $image, 0, 0, 0, 0, $width, $height, $size[0], $size[1]);\n\t}\n\n //ImageCopyResampleBicubic ($thumb, $image, 0, 0, 0, 0, $width, $height, $size[0], $size[1]);\n\n if (!$target) {\n\t $target = \"temp\".$extension;\n }\n\n $return = true;\n\n switch ($extension) {\n\t case \".jpeg\":\n\t case \".jpg\": {\n\t\t imagejpeg($thumb, $target, 100);\n\t break;\n\t }\n\t case \".gif\": {\n\t\t imagegif($thumb, $target);\n\t break;\n\t }\n\t case \".png\": {\n\t\t imagepng($thumb, $target);\n\t break;\n\t }\n\t case \".bmp\": {\n\t\t imagewbmp($thumb,$target);\n\t }\n\t default: {\n\t\t $return = false;\n\t }\n }\n\n // report the success (or fail) of the action\n return $return;\n}", "function resizeImage($old_image_path, $new_image_path, $max_width, $max_height)\n{\n\n // Get image type\n $image_info = getimagesize($old_image_path);\n $image_type = $image_info[2];\n\n // Set up the function names\n switch ($image_type) {\n case IMAGETYPE_JPEG:\n $image_from_file = 'imagecreatefromjpeg';\n $image_to_file = 'imagejpeg';\n break;\n case IMAGETYPE_GIF:\n $image_from_file = 'imagecreatefromgif';\n $image_to_file = 'imagegif';\n break;\n case IMAGETYPE_PNG:\n $image_from_file = 'imagecreatefrompng';\n $image_to_file = 'imagepng';\n break;\n default:\n return;\n } // ends the swith\n\n // Get the old image and its height and width\n $old_image = $image_from_file($old_image_path);\n $old_width = imagesx($old_image);\n $old_height = imagesy($old_image);\n\n // Calculate height and width ratios\n $width_ratio = $old_width / $max_width;\n $height_ratio = $old_height / $max_height;\n\n // If image is larger than specified ratio, create the new image\n if ($width_ratio > 1 || $height_ratio > 1) {\n\n // Calculate height and width for the new image\n $ratio = max($width_ratio, $height_ratio);\n $new_height = round($old_height / $ratio);\n $new_width = round($old_width / $ratio);\n\n // Create the new image\n $new_image = imagecreatetruecolor($new_width, $new_height);\n\n // Set transparency according to image type\n if ($image_type == IMAGETYPE_GIF) {\n $alpha = imagecolorallocatealpha($new_image, 0, 0, 0, 127);\n imagecolortransparent($new_image, $alpha);\n }\n\n if ($image_type == IMAGETYPE_PNG || $image_type == IMAGETYPE_GIF) {\n imagealphablending($new_image, false);\n imagesavealpha($new_image, true);\n }\n\n // Copy old image to new image - this resizes the image\n $new_x = 0;\n $new_y = 0;\n $old_x = 0;\n $old_y = 0;\n imagecopyresampled($new_image, $old_image, $new_x, $new_y, $old_x, $old_y, $new_width, $new_height, $old_width, $old_height);\n\n // Write the new image to a new file\n $image_to_file($new_image, $new_image_path);\n // Free any memory associated with the new image\n imagedestroy($new_image);\n } else {\n // Write the old image to a new file\n $image_to_file($old_image, $new_image_path);\n }\n // Free any memory associated with the old image\n imagedestroy($old_image);\n}", "function sharpen_resized_jpeg_images($resized_file) {\r\n $image = wp_load_image($resized_file); \r\n if(!is_resource($image))\r\n return new WP_Error('error_loading_image', $image, $file); \r\n $size = @getimagesize($resized_file);\r\n if(!$size)\r\n return new WP_Error('invalid_image', __('Could not read image size'), $file); \r\n list($orig_w, $orig_h, $orig_type) = $size; \r\n switch($orig_type) {\r\n case IMAGETYPE_JPEG:\r\n $matrix = array(\r\n array(-1, -1, -1),\r\n array(-1, 16, -1),\r\n array(-1, -1, -1),\r\n ); \r\n $divisor = array_sum(array_map('array_sum', $matrix));\r\n $offset = 0; \r\n imageconvolution($image, $matrix, $divisor, $offset);\r\n imagejpeg($image, $resized_file,apply_filters('jpeg_quality', 90, 'edit_image'));\r\n break;\r\n case IMAGETYPE_PNG:\r\n return $resized_file;\r\n case IMAGETYPE_GIF:\r\n return $resized_file;\r\n } \r\n return $resized_file;\r\n}", "function resizeThumbnailImage($thumb_image_name, $image, $width, $height, $start_width, $start_height, $scale){\n\t\tlist($imagewidth, $imageheight, $imageType) = getimagesize($image);\n\t\t$imageType = image_type_to_mime_type($imageType);\n\t\t\n\t\t$newImageWidth = ceil($width * $scale);\n\t\t$newImageHeight = ceil($height * $scale);\n\t\t$newImage = imagecreatetruecolor($newImageWidth,$newImageHeight);\n\t\tswitch($imageType) {\n\t\t\tcase \"image/gif\":\n\t\t\t\t$source=imagecreatefromgif($image); \n\t\t\t\tbreak;\n\t\t\tcase \"image/pjpeg\":\n\t\t\tcase \"image/jpeg\":\n\t\t\tcase \"image/jpg\":\n\t\t\t\t$source=imagecreatefromjpeg($image); \n\t\t\t\tbreak;\n\t\t\tcase \"image/png\":\n\t\t\tcase \"image/x-png\":\n\t\t\t\t$source=imagecreatefrompng($image); \n\t\t\t\tbreak;\n\t\t}\n\t\timagecopyresampled($newImage,$source,0,0,$start_width,$start_height,$newImageWidth,$newImageHeight,$width,$height);\n\t\tswitch($imageType) {\n\t\t\tcase \"image/gif\":\n\t\t\t\timagegif($newImage,$thumb_image_name); \n\t\t\t\tbreak;\n\t\t\tcase \"image/pjpeg\":\n\t\t\tcase \"image/jpeg\":\n\t\t\tcase \"image/jpg\":\n\t\t\t\timagejpeg($newImage,$thumb_image_name,90); \n\t\t\t\tbreak;\n\t\t\tcase \"image/png\":\n\t\t\tcase \"image/x-png\":\n\t\t\t\timagepng($newImage,$thumb_image_name); \n\t\t\t\tbreak;\n\t\t}\n\t\tchmod($thumb_image_name, 0777);\n\t\treturn $thumb_image_name;\n\t}", "function resize_image($path, $filename, $maxwidth, $maxheight, $quality=75, $type = \"small_\", $new_path = \"\")\n{\n $filename = DIRECTORY_SEPARATOR.basename($filename);\n $sExtension = substr($filename, (strrpos($filename, \".\") + 1));\n $sExtension = strtolower($sExtension);\n\n // check ton tai thu muc khong\n if (!file_exists($path.$type))\n {\n @mkdir($path.$type, 0777, true);\n chmod($path.$type, 0777);\n }\n // Get new dimensions\n $size = getimagesize($path . $filename);\n $width = $size[0];\n $height = $size[1];\n if($width != 0 && $height !=0)\n {\n if($maxwidth / $width > $maxheight / $height) $percent = $maxheight / $height;\n else $percent = $maxwidth / $width;\n }\n\n $new_width\t= $width * $percent;\n $new_height\t= $height * $percent;\n\n // Resample\n $image_p = imagecreatetruecolor($new_width, $new_height);\n //check extension file for create\n switch($size['mime'])\n {\n case 'image/gif':\n $image = imagecreatefromgif($path . $filename);\n break;\n case 'image/jpeg' :\n case 'image/pjpeg' :\n $image = imagecreatefromjpeg($path . $filename);\n break;\n case 'image/png':\n $image = imagecreatefrompng($path . $filename);\n break;\n }\n //Copy and resize part of an image with resampling\n imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);\n\n // Output\n // check new_path, nếu new_path tồn tại sẽ save ra đó, thay path = new_path\n if($new_path != \"\")\n {\n $path = $new_path;\n if (!file_exists($path.$type))\n {\n @mkdir($path.$type, 0777, true);\n chmod($path.$type, 0777);\n }\n }\n\n switch($sExtension)\n {\n case \"gif\":\n imagegif($image_p, $path . $type . $filename);\n break;\n case $sExtension == \"jpg\" || $sExtension == \"jpe\" || $sExtension == \"jpeg\":\n imagejpeg($image_p, $path . $type . $filename, $quality);\n break;\n case \"png\":\n imagepng($image_p, $path . $type . $filename);\n break;\n }\n imagedestroy($image_p);\n}", "public static function handle ( $image, $size, $mode = null, $newfilename = null, $opt = null ) {\r\n\r\n\t\t\tif ( !is_file($image) ) return false;\r\n\r\n\t\t\t$object = new self($image);\r\n\t\t\t$object->resize($size, $mode, $opt);\r\n\t\t\t$object->save((!empty($newfilename)) ? $newfilename : $image);\r\n\r\n\t\t}" ]
[ "0.7357126", "0.72096777", "0.7058268", "0.69174933", "0.68890214", "0.67627215", "0.66837996", "0.66826135", "0.66611576", "0.65837675", "0.65561384", "0.65299714", "0.6529286", "0.65278107", "0.6523671", "0.6502308", "0.6456611", "0.64532137", "0.6434276", "0.64276624", "0.6419494", "0.6418044", "0.6404621", "0.6375764", "0.6371517", "0.6349603", "0.6322972", "0.6301082", "0.63007617", "0.6293518", "0.62643576", "0.62540907", "0.6254064", "0.6216631", "0.6215619", "0.6201733", "0.6196991", "0.6196581", "0.6191023", "0.6187956", "0.6166634", "0.61573714", "0.6135475", "0.6134797", "0.6130798", "0.61306345", "0.6128892", "0.6127265", "0.6116703", "0.61142373", "0.6111995", "0.61045206", "0.6104111", "0.6103814", "0.61019915", "0.6097302", "0.6083934", "0.6076911", "0.607676", "0.606444", "0.605579", "0.6052499", "0.6042867", "0.6038133", "0.6036583", "0.60335493", "0.60306615", "0.60271513", "0.602205", "0.60202634", "0.6007556", "0.599775", "0.5996385", "0.5996378", "0.59910893", "0.5986451", "0.59841096", "0.59787184", "0.5977346", "0.59771353", "0.5973921", "0.5973781", "0.5965612", "0.596295", "0.5945232", "0.5942249", "0.5938624", "0.5930809", "0.59301156", "0.59282976", "0.5923112", "0.5922242", "0.59218997", "0.591829", "0.5908571", "0.59084487", "0.5888458", "0.5884698", "0.58839846", "0.58739144" ]
0.6749627
6
Crop an image to the given size. Either the width or the height can be omitted and the current width or height will be used. If no offset is specified, the center of the axis will be used. If an offset of TRUE is specified, the bottom of the axis will be used. // Crop the image to 200x200 pixels, from the center $image>crop(200, 200);
public function crop($width, $height, $offset_x = NULL, $offset_y = NULL) { if ($width > $this->width) { // Use the current width $width = $this->width; } if ($height > $this->height) { // Use the current height $height = $this->height; } if ($offset_x === NULL) { // Center the X offset $offset_x = round(($this->width - $width) / 2); } elseif ($offset_x === TRUE) { // Bottom the X offset $offset_x = $this->width - $width; } elseif ($offset_x < 0) { // Set the X offset from the right $offset_x = $this->width - $width + $offset_x; } if ($offset_y === NULL) { // Center the Y offset $offset_y = round(($this->height - $height) / 2); } elseif ($offset_y === TRUE) { // Bottom the Y offset $offset_y = $this->height - $height; } elseif ($offset_y < 0) { // Set the Y offset from the bottom $offset_y = $this->height - $height + $offset_y; } // Determine the maximum possible width and height $max_width = $this->width - $offset_x; $max_height = $this->height - $offset_y; if ($width > $max_width) { // Use the maximum available width $width = $max_width; } if ($height > $max_height) { // Use the maximum available height $height = $max_height; } $this->_do_crop($width, $height, $offset_x, $offset_y); return $this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function crop($width, $height, $offset_x=null, $offset_y=null);", "protected function _do_crop($width, $height, $offset_x, $offset_y)\n {\n $image = $this->_create($width, $height);\n\n // Loads image if not yet loaded\n $this->_load_image();\n\n // Execute the crop\n if (imagecopyresampled($image, $this->_image, 0, 0, $offset_x, $offset_y, $width, $height, $width, $height))\n {\n // Swap the new image for the old one\n imagedestroy($this->_image);\n $this->_image = $image;\n\n // Reset the width and height\n $this->width = imagesx($image);\n $this->height = imagesy($image);\n }\n }", "public function crop(IImageInformation $src, $x, $y, $width, $height);", "public function sizeImg($width, $height, $crop = true);", "function _crop_image_resource($img, $x, $y, $w, $h)\n {\n }", "public static function crop($image, $width, $height, array $start = [0, 0])\n {\n if (!isset($start[0], $start[1])) {\n throw new InvalidParamException('$start must be an array of two elements.');\n }\n\n return static::ensureImageInterfaceInstance($image)\n ->copy()\n ->crop(new Point($start[0], $start[1]), new Box($width, $height));\n }", "public function crop()\n\t{\n\t\t$protocol = ($this->image_library === 'gd2') ? 'image_process_gd' : 'image_process_'.$this->image_library;\n\t\treturn $this->$protocol('crop');\n\t}", "function image_crop()\n\t{\n\t\t$protocol = 'image_process_'.$this->resize_protocol;\n\t\t\n\t\tif (substr($protocol, -3) == 'gd2')\n\t\t{\n\t\t\t$protocol = 'image_process_gd';\n\t\t}\n\t\t\n\t\treturn $this->$protocol('crop');\n\t}", "public function test_crop() {\n\t\t$file = DIR_TESTDATA . '/images/gradient-square.jpg';\n\n\t\t$imagick_image_editor = new WP_Image_Editor_Imagick( $file );\n\t\t$imagick_image_editor->load();\n\n\t\t$imagick_image_editor->crop( 0, 0, 50, 50 );\n\n\t\t$this->assertSame(\n\t\t\tarray(\n\t\t\t\t'width' => 50,\n\t\t\t\t'height' => 50,\n\t\t\t),\n\t\t\t$imagick_image_editor->get_size()\n\t\t);\n\t}", "public function test_crop() {\n\n\t\t$file = DIR_TESTDATA . '/images/gradient-square.jpg';\n\n\t\t$imagick_image_editor = new WP_Image_Editor_Imagick( $file );\n\t\t$imagick_image_editor->load();\n\n\t\t$imagick_image_editor->crop( 0, 0, 50, 50 );\n\n\t\t$this->assertEquals( array( 'width' => 50, 'height' => 50 ), $imagick_image_editor->get_size() );\n\n\t}", "public function resize($width, $height, $crop_top = 0, $crop_bottom = 0, $crop_left = 0, $crop_right = 0) {}", "public function crop($value = null)\n {\n $this->crop = $value;\n }", "public function crop($value) {\n return $this->setProperty('crop', $value);\n }", "public function imageAdapterGdCropJpgWithOffset(UnitTester $I)\n {\n $I->wantToTest('Image\\Adapter\\Gd - crop()');\n\n $this->checkJpegSupport($I);\n\n $image = new Gd(dataDir('assets/images/example-jpg.jpg'));\n\n $outputDir = 'tests/image/gd';\n $width = 200;\n $height = 200;\n $offsetX = 200;\n $offsetY = 200;\n $cropImage = 'cropwithoffset.jpg';\n $output = outputDir($outputDir . '/' . $cropImage);\n $hash = 'fffff00000000000';\n\n // Resize to 200 pixels on the shortest side\n $image->crop($width, $height, $offsetX, $offsetY)\n ->save($output)\n ;\n\n $I->amInPath(outputDir($outputDir));\n\n $I->seeFileFound($cropImage);\n\n $actual = $image->getWidth();\n $I->assertSame($width, $actual);\n\n $actual = $image->getHeight();\n $I->assertSame($height, $actual);\n\n $actual = $this->checkImageHash($output, $hash);\n $I->assertTrue($actual);\n\n $I->safeDeleteFile($cropImage);\n }", "function crop( $x = 0, $y = 0, $w = 0, $h = 0 )\n\t{\n\t\tif( $w == 0 || $h == 0 )\n\t\t\treturn FALSE;\n\t\t\n\t\t//create a target canvas\n\t\t$new_im = imagecreatetruecolor ( $w, $h );\n\t\n\t\t//copy and resize image to new canvas\n\t\timagecopyresampled( $new_im, $this->im, 0, 0, $x, $y, $w, $h, $w, $h );\n\t\t\n\t\t//delete the old image handle\n\t\timagedestroy( $this->im );\n\t\t\n\t\t//set the new image as the current handle\n\t\t$this->im = $new_im;\n\t}", "public function crop($target_width, $target_height, $crop_X, $crop_Y, $crop_width, $crop_height, $save_to_file, $output_mimetype=NULL) {\n\t\t// create a blank image of the target dimensions\n\t\t$cropped_image = imagecreatetruecolor($target_width, $target_height);\n\t\t// resample the image to the cropped constraints\n\t\timagecopyresampled(\n\t\t\t\t$cropped_image,\n\t\t\t\t$this->source_image,\n\t\t\t\t0,\n\t\t\t\t0,\n\t\t\t\t$crop_X,\n\t\t\t\t$crop_Y,\n\t\t\t\t$target_width,\n\t\t\t\t$target_height,\n\t\t\t\t$crop_width,\n\t\t\t\t$crop_height\n\t\t);\n\t\t// save the cropped image and create a new Image \n\t\t$output_image_mimetype = $output_mimetype ? $output_mimetype : $this->source_image_mimetype;\n\t\tImageLib::save($cropped_image, $save_to_file, $output_image_mimetype);\n\t\treturn new static($save_to_file);\n\t}", "public function crop($value)\n {\n $this->args = array_merge($this->args, ['crop' => $value]);\n\n return $this;\n }", "public function crop()\n {\n }", "function myImageCrop($imgSrc,$newfilename,$thumbWidth=100,$output=false,$thumbHeight=0){\n \t\n\t\tif($thumbHeight == 0) $thumbHeight = $thumbWidth;\n\t\t\n\t\t//getting the image dimensions\n\t\tlist($width, $height) = getimagesize($this->path.$imgSrc); \n\t\t\n\t\t\n\t\t$extension = strtolower($this->getExtension($imgSrc,false)); // false - tells to get \"jpg\" NOT \".jpg\" GOT IT :P\n\t\t\n\t\t//saving the image into memory (for manipulation with GD Library)\n\t\tswitch($extension) {\n\t\t\tcase 'gif':\n\t\t\t$myImage = imagecreatefromgif($this->path.$imgSrc);\n\t\t\tbreak;\n\t\t\tcase 'jpg':\n\t\t\t$myImage = imagecreatefromjpeg($this->path.$imgSrc);\n\t\t\tbreak;\n\t\t\tcase 'png':\n\t\t\t$myImage = imagecreatefrompng($this->path.$imgSrc);\n\t\t\tbreak;\n\t\t}\n\t\t\n\n\n\t\t ///-------------------------------------------------------- \n\t\t //setting the crop size \n\t\t //-------------------------------------------------------- \n\t\t if($width > $height){ \n\t\t\t $biggestSide = $width; \n\t\t\t $cropPercent = .6; \n\t\t\t $cropWidth = $biggestSide*$cropPercent; \n\t\t\t $cropHeight = $biggestSide*$cropPercent; \n\t\t\t $c1 = array(\"x\"=>($width-$cropWidth)/2, \"y\"=>($height-$cropHeight)/2); \n\t\t }else{ \n\t\t\t $biggestSide = $height; \n\t\t\t $cropPercent = .6; \n\t\t\t $cropWidth = $biggestSide*$cropPercent; \n\t\t\t $cropHeight = $biggestSide*$cropPercent; \n\t\t\t $c1 = array(\"x\"=>($width-$cropWidth)/2, \"y\"=>($height-$cropHeight)/7); \n\t\t } \n\t\t \n\t\t //--------------------------------------------------------\n\t\t// Creating the thumbnail\n\t\t//--------------------------------------------------------\n\t\t$thumb = imagecreatetruecolor($thumbWidth, $thumbHeight); \n\t\timagecopyresampled($thumb, $myImage, 0, 0, $c1['x'], $c1['y'], $thumbWidth, $thumbHeight, $cropWidth, $cropHeight); \n\n\t\tif($output == false){\n\t\t\tif($extension==\"jpg\" ){\n\t\t\t\timagejpeg($thumb,$this->path.$newfilename,100);\n\t\t\t}elseif($extension==\"gif\" ){\n\t\t\t\timagegif($thumb,$this->path.$newfilename,100);\n\t\t\t}elseif($extension==\"png\" ){\n\t\t\t\timagepng($thumb,$this->path.$newfilename,9);\n\t\t\t}\n\t\t}else{\n\t\t\t//final output \n\t\t\t//imagejpeg($thumb);\n\t\t\tif($extension==\"jpg\" ){\n\t\t\t\theader('Content-type: image/jpeg');\n\t\t\t\timagejpeg($thumb);\n\t\t\t}elseif($extension==\"gif\" ){\n\t\t\t\theader('Content-type: image/gif');\n\t\t\t\timagegif($thumb);\n\t\t\t}elseif($extension==\"png\" ){\n\t\t\t\theader('Content-type: image/png');\n\t\t\t\timagepng($thumb);\n\t\t\t}\n\t\t} \n\t\timagedestroy($thumb); \n\t}", "function imgcrop(){\n\t\t$id = $this->session->userdata(SESSION_CONST_PRE.'userId');\n\t\t$dir_path = './assets/uploads/students/';\n\t\n\t\t$file_path = $dir_path . \"/Profile.small.jpg\";\n\t\t$src = $dir_path .'Profile.jpg';\n\t\tif(file_exists($file_path)){\n\t\t\t$src = $dir_path .'Profile.small.jpg';\n\t\t}\n\t\n\t\t$imgW = $_POST['w'];\n\t\t$imgH = $_POST['h'];\n\t\t$imgY1 = $_POST['y'];\n\t\t$imgX1 = $_POST['x'];\n\t\t$cropW = $_POST['w'];\n\t\t$cropH = $_POST['h'];\n\t\n\t\t$jpeg_quality = 100;\n\t\n\t\t//$img_r = imagecreatefromjpeg($src);\n\t\t$what = getimagesize($src);\n\t\t//list($imgInitW, $imgInitH, $type, $what) = getimagesize($src);\n\t\t$imgW = $imgInitW = $what[0];\n\t\t$imgH = $imgInitH = $what[1];\n\t\tswitch(strtolower($what['mime']))\n\t\t{\n\t\t\tcase 'image/png':\n\t\t\t\t$img_r = imagecreatefrompng($src);\n\t\t\t\t$source_image = imagecreatefrompng($src);\n\t\t\t\t$type = '.png';\n\t\t\t\tbreak;\n\t\t\tcase 'image/jpeg':\n\t\t\t\t$img_r = imagecreatefromjpeg($src);\n\t\t\t\t$source_image = imagecreatefromjpeg($src);\n\t\t\t\t$type = '.jpeg';\n\t\t\t\tbreak;\n\t\t\tcase 'image/jpg':\n\t\t\t\t$img_r = imagecreatefromjpeg($src);\n\t\t\t\t$source_image = imagecreatefromjpeg($src);\n\t\t\t\t$type = '.jpg';\n\t\t\t\tbreak;\n\t\t\tcase 'image/gif':\n\t\t\t\t$img_r = imagecreatefromgif($src);\n\t\t\t\t$source_image = imagecreatefromgif($src);\n\t\t\t\t$type = '.gif';\n\t\t\t\tbreak;\n\t\t\tdefault: die('image type not supported');\n\t\t}\n\t\n\t\t$resizedImage = imagecreatetruecolor($imgW, $imgH);\n\t\timagecopyresampled($resizedImage, $source_image, 0, 0, 0, 0, $imgW,\n\t\t$imgH, $imgInitW, $imgInitH);\n\t\n\t\n\t\t$dest_image = imagecreatetruecolor($cropW, $cropH);\n\t\timagecopyresampled($dest_image, $source_image, 0, 0, $imgX1, $imgY1, $cropW,\n\t\t$cropH, $cropW, $cropH);\n\t\n\t\n\t\timagejpeg($dest_image, $dir_path.'Profile.small.jpg', $jpeg_quality);\n\t\n\t}", "protected function cropMagic(): void\n {\n $this->image->crop($this->cropWidth, $this->cropHeight, $this->cropLeft, $this->cropTop);\n }", "function imagecropauto($image, $mode = -1, $threshold = 0.5, $color = -1)\n{\n}", "public function crop()\n {\n $this->_pid = $this->_request->getInput('pid');\n $imgUrl = $this->_request->getInput('imgUrl');\n $imgInfo = new SplFileInfo($imgUrl);\n $cropParams = $this->_request->getAllPostInput();\n $cropParams['img_final_dir'] = '/images/properties/';\n $cropParams['image_out'] = $this->_pid . '-' . uniqid() . '.' . $imgInfo->getExtension();\n\n $this->_imageOut = $cropParams['img_final_dir'] . $cropParams['image_out'];\n\n if($this->_cropper->crop($cropParams))\n {\n return true;\n }\n return false;\n }", "function flexibleCropper($source_location, $desc_location=null,$crop_size_w=null,$crop_size_h=null)\n\t{\n\t list($src_w, $src_h) = getimagesize($source_location);\n\n\t $image_source = imagecreatefromjpeg($source_location);\n\t $image_desc = imagecreatetruecolor($crop_size_w,$crop_size_h);\n\n\t/*\n\t if ($crop_size_w>$crop_size_h) {$my_crop_size_w=null;}\n\t elseif ($crop_size_h>$crop_size_w)\n\t {$my_crop_size_h=null;\n\n\t if (is_null($my_crop_size_h) and !is_null($my_crop_size_w))\n\t { $my_crop_size_h=$src_h*$my_crop_size_w/$src_w; }\n\t elseif (!is_null($my_crop_size_h))\n\t { $my_crop_size_w=$src_w*$my_crop_size_h/$src_h; }\n\t*/\n\n\t if ($src_w<$src_h) {$my_crop_size_h=$src_h*$crop_size_w/$src_w;} else {$my_crop_size_h=$crop_size_h;}\n\t if ($src_h<$src_w) {$my_crop_size_w=$src_w*$crop_size_h/$src_h;} else {$my_crop_size_w=$crop_size_w;}\n\t// echo \"($my_crop_size_w-$my_crop_size_h)\";\n\t if ($my_crop_size_w>$crop_size_w) {$additional_x=round(($crop_size_w-$my_crop_size_w)/2);} else {$additional_x=0;}\n\t if ($my_crop_size_h>$crop_size_h) {$additional_y=round(($crop_size_h-$my_crop_size_h)/2);} else {$additional_y=0;}\n\n\t $off_x=round($src_w/2)-round($my_crop_size_w/2);\n\t $off_y=round($src_h/2)-round($my_crop_size_h/2)+$additional_y;\n\t $off_w=(round($src_w/2)+round($my_crop_size_w/2))-$off_x;\n\t $off_h=(round($src_h/2)+round($my_crop_size_h/2))-$off_y;\n\n\t imagecopyresampled($image_desc, $image_source,$additional_x, $additional_y, $off_x, $off_y, $my_crop_size_w, $my_crop_size_h, $off_w, $off_h);\n\n\t if (!is_null($desc_location))\n\t imagejpeg($image_desc, $desc_location,100);\n\t else\n\t imagejpeg($image_desc);\n\t}", "public static function crop($img_name, $x, $y, $type = 'fit')\n {\n $full_path = storage_path('app/public/'.$img_name);\n $full_thumb_path = storage_path('app/public/thumbs/'.$img_name);\n $thumb = Image::make($full_path);\n\n if ($type == 'fit')\n self::fit($thumb, $x, $y, $full_thumb_path);\n else\n self::resize($thumb, $x, $y, $full_thumb_path);\n }", "public function crop($thumb_size = 250, $crop_percent = .5, $image_type = 'image/jpeg')\n {\n $width = $this->getWidth();\n $height = $this->getHeight();\n //set the biggest dimension\n if($width > $height)\n {\n $biggest = $width;\n }else{\n $biggest = $height;\n }\n //init the crop dimension based on crop_percent\n $cropSize = $biggest * $crop_percent;\n //get the crop cordinates\n $x = ($width - $cropSize) / 2;\n $y = ($height - $cropSize) / 2;\n\n //create the final thumnail\n $this->thumbImage = imagecreatetruecolor($thumb_size, $thumb_size);\n //fill background with white\n $bgc = imagecolorallocate($this->thumbImage, 255, 255, 255);\n imagefilledrectangle($this->thumbImage, 0, 0, $thumb_size, $thumb_size, $bgc);\n \n imagecopyresampled($this->thumbImage, $this->image, 0, 0, $x, $y, $thumb_size, $thumb_size, $cropSize, $cropSize );\n }", "function cropImage($param=array())\r\n {\r\n $ret = array(\r\n 'msg' => false,\r\n 'sts' => false,\r\n );\r\n\r\n $final_size = $param['final_size'];\r\n #$filename = $final_size.'-'.$param['img_newname'];\r\n $filename = $param['img_newname'];\r\n $target_dir = $param['dest_path'];\r\n $target_name = $target_dir.$filename;\r\n $source_name = $param['img_real'];\r\n \r\n //get size from real image \r\n $size = getimagesize($source_name);\r\n $targ_w = $param['w'];\r\n $targ_h = $param['h'];\r\n\r\n //get size from ratio\r\n $final_size = explode(\"x\", $final_size);\r\n $final_w = $final_size[0];\r\n $final_h = $final_size[1];\r\n \r\n if($final_w==='auto' && $final_h==='auto'){ //detect if width and height ratio is \"auto\" then readjust width and height size\r\n $final_w = $targ_w;\r\n $final_h = $targ_h;\r\n }elseif($final_w==='auto'){ //detect if width ratio is \"auto\" then readjust width size\r\n $final_w = intval(($final_size[1] * $targ_w) / $targ_h);\r\n }elseif($final_h==='auto'){ //detect if height ratio is \"auto\" then readjust height size\r\n $final_h = intval(($final_size[0] * $targ_h) / $targ_w);\r\n }\r\n //end\r\n \r\n \r\n $jpeg_quality = 90;\r\n $img_r = imagecreatefromjpeg($source_name);\r\n $dst_r = ImageCreateTrueColor( $final_w, $final_h );\r\n \r\n imagecopyresized(\r\n $dst_r, $img_r, \r\n 0,0, \r\n $param['x'],$param['y'], \r\n $final_w,$final_h,\r\n $param['w'],$param['h']\r\n );\r\n \r\n imagejpeg($dst_r,$target_name,$jpeg_quality);\r\n #$this->send_to_server( array($target_name) );\r\n $url_target_name = str_replace('/data/shopkl/_assets/', 'http://klimg.com/kapanlagi.com/klshop/', $target_name);\r\n \r\n\t\t\t\r\n //find image parent url and dir path from config\r\n //reset($this->imgsize['article']['size']);\r\n //$first_key = key($this->imgsize['article']['size']);\r\n //end find\r\n $ret['sts'] = true;\r\n $ret['filename'] = $filename;\r\n $ret['msg'] = '<div class=\"alert alert-success\">Image is cropped and saved in <a href=\"'. $url_target_name .'?'.date('his').'\" target=\"_blank\">'.$target_name.' !</a></div>';\r\n \r\n return $ret;\r\n }", "public function runCropResize(Image $image, int $width, int $height) : Image\n\t{\n\t\tlist($resize_width, $resize_height) = $this->resolveCropResizeDimensions($image, $width, $height);\n\t\t$zoom = $this->getCrop()[2];\n\t\t$image->resize($resize_width * $zoom, $resize_height * $zoom, function ($constraint) {\n\t\t\t$constraint->aspectRatio();\n\t\t});\n\t\t\t\n\t\tlist($offset_x, $offset_y) = $this->resolveCropOffset($image, $width, $height);\n\t\t\t\n\t\treturn $image->crop($width, $height, $offset_x, $offset_y);\n\t}", "public function cropThumb($px, $offset = null)\n {\n $xOffset = 0;\n $yOffset = 0;\n\n if (null !== $offset) {\n if ($this->width > $this->height) {\n $xOffset = $offset;\n $yOffset = 0;\n } else if ($this->width < $this->height) {\n $xOffset = 0;\n $yOffset = $offset;\n }\n }\n\n $scale = ($this->width > $this->height) ? ($px / $this->height) : ($px / $this->width);\n\n $wid = round($this->width * $scale);\n $hgt = round($this->height * $scale);\n\n // Create a new image output resource.\n if (null !== $offset) {\n $this->resizeImage($wid, $hgt, $this->imageFilter, $this->imageBlur);\n $this->cropImage($px, $px, $xOffset, $yOffset);\n } else {\n $this->cropThumbnailImage($px, $px);\n }\n\n $this->width = $px;\n $this->height = $px;\n return $this;\n }", "function cropImage($CurWidth,$CurHeight,$iSize,$DestFolder,$SrcImage,$Quality,$ImageType)\r\n{\t \r\n\t//Check Image size is not 0\r\n\tif($CurWidth <= 0 || $CurHeight <= 0) \r\n\t{\r\n\t\treturn false;\r\n\t}\r\n\t\r\n\t//abeautifulsite.net has excellent article about \"Cropping an Image to Make Square\"\r\n\t//http://www.abeautifulsite.net/blog/2009/08/cropping-an-image-to-make-square-thumbnails-in-php/\r\n\tif($CurWidth>$CurHeight)\r\n\t{\r\n\t\t$y_offset = 0;\r\n\t\t$x_offset = ($CurWidth - $CurHeight) / 2;\r\n\t\t$square_size \t= $CurWidth - ($x_offset * 2);\r\n\t}else{\r\n\t\t$x_offset = 0;\r\n\t\t$y_offset = ($CurHeight - $CurWidth) / 2;\r\n\t\t$square_size = $CurHeight - ($y_offset * 2);\r\n\t}\r\n\t\r\n\t$NewCanves \t= imagecreatetruecolor($iSize, $iSize);\t\r\n\tif(imagecopyresampled($NewCanves, $SrcImage,0, 0, $x_offset, $y_offset, $iSize, $iSize, $square_size, $square_size))\r\n\t{\r\n\t\tswitch(strtolower($ImageType))\r\n\t\t{\r\n\t\t\tcase 'image/png':\r\n\t\t\t\timagepng($NewCanves,$DestFolder);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 'image/gif':\r\n\t\t\t\timagegif($NewCanves,$DestFolder);\r\n\t\t\t\tbreak;\t\t\t\r\n\t\t\tcase 'image/jpeg':\r\n\t\t\tcase 'image/pjpeg':\r\n\t\t\t\timagejpeg($NewCanves,$DestFolder,$Quality);\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\treturn false;\r\n\t\t}\r\n\t//Destroy image, frees memory\t\r\n\tif(is_resource($NewCanves)) {imagedestroy($NewCanves);} \r\n\treturn true;\r\n\r\n\t}\r\n\t \r\n}", "function cropImage($CurWidth, $CurHeight, $iSize, $DestFolder, $SrcImage, $Quality, $ImageType) { \n\t//Check Image size is not 0\n\tif($CurWidth <= 0 || $CurHeight <= 0) \n\t{\n\t\treturn false;\n\t}\n\t\n\t//abeautifulsite.net has excellent article about \"Cropping an Image to Make Square bit.ly/1gTwXW9\n\tif($CurWidth>$CurHeight)\n\t{\n\t\t$y_offset = 0;\n\t\t$x_offset = ($CurWidth - $CurHeight) / 2;\n\t\t$square_size \t= $CurWidth - ($x_offset * 2);\n\t}else{\n\t\t$x_offset = 0;\n\t\t$y_offset = ($CurHeight - $CurWidth) / 2;\n\t\t$square_size = $CurHeight - ($y_offset * 2);\n\t}\n\t\n\t$NewCanvas \t= imagecreatetruecolor($iSize, $iSize);\t\n\t\n\tif(strtolower($ImageType) == 'image/png') {\n\t\t// Saves Alpha\n\t\timagealphablending($NewCanvas, false);\n\t\timagesavealpha($NewCanvas,true);\n\t\t$transparent = imagecolorallocatealpha($NewCanvas, 255, 255, 255, 127);\n\t\timagefilledrectangle($NewCanvas, 0, 0, $square_size, $square_size, $transparent);\n\t}\n\t\n\tif(imagecopyresampled($NewCanvas, $SrcImage, 0, 0, $x_offset, $y_offset, $iSize, $iSize, $square_size, $square_size))\n\t{\n\t\tswitch(strtolower($ImageType))\n\t\t{\n\t\t\tcase 'image/png':\n\t\t\t\timagepng($NewCanvas,$DestFolder);\n\t\t\t\tbreak;\n\t\t\tcase 'image/gif':\n\t\t\t\timagegif($NewCanvas,$DestFolder);\n\t\t\t\tbreak;\t\t\t\n\t\t\tcase 'image/jpeg':\n\t\t\tcase 'image/pjpeg':\n\t\t\t\timagejpeg($NewCanvas,$DestFolder,$Quality);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treturn false;\n\t\t}\n\t\t\n\t\t//Destroy image, frees memory\t\n\t\tif(is_resource($NewCanvas)) {imagedestroy($NewCanvas);} \n\t\treturn true;\n\t} \n}", "function crop($x, $y, $width, $height){\n\n $new_image = imagecreatetruecolor($width, $height);\n imagecopy($new_image, $this->image, 0, 0, $x, $y, $width, $height);\n $this->image = $new_image;\n\n //reset sizes\n $this->width = $width;\n $this->height = $height;\n\n return true;\n }", "public static function crop($image = NULL, $coordinateX = NULL, $coordinateY = NULL, $width = NULL, $height = NULL)\n\t{\n\n\t\tif (!($image instanceof Default_Model_MediaImage)) {\n\t\t\tthrow new Default_Model_MediaImage_Exception('Image needs to be an instance of Default_Model_MediaImage.');\n\t\t}\n\n\t\tif ($coordinateX &&\n\t\t\t!is_int($coordinateX)) {\n\n\t\t\tthrow new Default_Model_MediaImage_Exception('Coordinate X needs to be an integer, if specified.');\n\t\t}\n\n\t\tif ($coordinateY &&\n\t\t\t!is_int($coordinateY)) {\n\n\t\t\tthrow new Default_Model_MediaImage_Exception('Coordinate Y needs to be an integer, if specified.');\n\t\t}\n\n\t\tif ($width &&\n\t\t\t!is_int($width)) {\n\n\t\t\tthrow new Default_Model_MediaImage_Exception('Width needs to be an integer, if specified.');\n\t\t}\n\n\t\tif ($height &&\n\t\t\t!is_int($height)) {\n\n\t\t\tthrow new Default_Model_MediaImage_Exception('Height needs to be an integer, if specified.');\n\t\t}\n\n\t\t$cropedImage = Default_Service_MediaImage::fromMediaImage($image);\n\t\t$cropedImage->width = 0;\n\t\t$cropedImage->height = 0;\n\t\t$cropedImage->file_size = 0;\n\t\t$cropedImage->role_id = $image->role_id;\n\t\tif (isset($image['entity_id'])) {\n\t\t\t$cropedImage->entity_id = $image->entity_id;\n\t\t} else\n\t\tif (Zend_Auth::getInstance()->hasIdentity()) {\n\t\t\t$cropedImage->entity_id = Zend_Auth::getInstance()->getIdentity()->id;\n\t\t}\n\t\t$cropedImage->short = Default_Service_Media::getShort($image->short, $cropedImage->width, $cropedImage->height, $cropedImage->file_size);\n\t\t$cropedImage->save();\n\n\n\t\t/**\n\t\t * imageinstance file does not exist yet and needs to be created\n\t\t */\n\t\tif (!file_exists($cropedImage->getStoredFilePath())) {\n\n\t\t\t/**\n\t\t\t * use Imagick for croping the image ?\n\t\t\t */\n\t\t\tif (Zend_Registry::get('Imagick')) {\n\n\t\t\t\t/**\n\t\t\t\t * Imagick\n\t\t\t\t */\n\t\t\t\t$imagickError = NULL;\n\t\t\t\ttry {\n\t\t\t\t\t$imagickObj = new Imagick($image->getStoredFilePath());\n\t\t\t\t\t$imagickCropResult = $imagickObj->cropImage($width, $height, $coordinateX, $coordinateY);\n\t\t\t\t\tif ($imagickCropResult) {\n\t\t\t\t\t\t$imagickObj->writeimage($cropedImage->getStoredFilePath());\n\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * retrieve image infos\n\t\t\t\t\t\t */\n\t\t\t\t\t\t$cropedImage->file_size = $imagickObj->getImageLength();\n\t\t\t\t\t\t$imagickDimensions = $imagickObj->getImageGeometry();\n\t\t\t\t\t\t$cropedImage->width = $imagickDimensions['width'];\n\t\t\t\t\t\t$cropedImage->height = $imagickDimensions['height'];\n\t\t\t\t\t\t$cropedImage->short = Default_Service_Media::getShort($image->short, $cropedImage->width, $cropedImage->height, $cropedImage->file_size);\n\t\t\t\t\t\t$cropedImage->save();\n\t\t\t\t\t}\n\t\t\t\t} catch (ImagickException $imagickError) {\n\n\t\t\t\t}\n\n\t\t\t\tif ($imagickError ||\n\t\t\t\t\t!$imagickCropResult) {\n\n\t\t\t\t\t$cropedImage->hardDelete();\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\t$imageFile = L8M_Image::fromFile($image->getStoredFilePath());\n\n\t\t\t\tif ($imageFile instanceof L8M_Image_Abstract) {\n\n\t\t\t\t\t$imageFile\n\t\t\t\t\t\t->crop($coordinateX, $coordinateY, $width, $height)\n\t\t\t\t\t\t->save($cropedImage->getStoredFilePath(), TRUE)\n\t\t\t\t\t;\n\n\t\t\t\t\t/**\n\t\t\t\t\t * retrieve image infos\n\t\t\t\t\t */\n\t\t\t\t\t$cropedImage->file_size = $imageFile->getFilesize();\n\t\t\t\t\t$cropedImage->width = $imageFile->getWidth();\n\t\t\t\t\t$cropedImage->height = $imageFile->getHeight();\n\t\t\t\t\t$cropedImage->short = Default_Service_Media::getShort($image->short, $cropedImage->width, $cropedImage->height, $cropedImage->file_size);\n\n\t\t\t\t\t/**\n\t\t\t\t\t * save\n\t\t\t\t\t */\n\t\t\t\t\tif (!$imageFile->isErrorOccured()) {\n\t\t\t\t\t\t$cropedImage->save();\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$cropedImage->hardDelete();\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\n\t\treturn $cropedImage;\n\t}", "function cropImage($CurWidth, $CurHeight, $iSize, $DestFolder, $SrcImage, $Quality, $ImageType)\n{\t \n\t//Check Image size is not 0\n\tif($CurWidth <= 0 || $CurHeight <= 0) \n\t{\n\t\treturn false;\n\t}\n\t//abeautifulsite.net has excellent article about \"Cropping an Image to Make Square\"\n\t//http://www.abeautifulsite.net/blog/2009/08/cropping-an-image-to-make-square-thumbnails-in-php/\n\tif($CurWidth>$CurHeight)\n\t{\n\t\t$y_offset = 0;\n\t\t$x_offset = ($CurWidth - $CurHeight) / 2;\n\t\t$square_size \t= $CurWidth - ($x_offset * 2);\n\t}\n\telse\n\t{\n\t\t$x_offset = 0;\n\t\t$y_offset = ($CurHeight - $CurWidth) / 2;\n\t\t$square_size = $CurHeight - ($y_offset * 2);\n\t}\n\t\n\t$NewCanves \t= imagecreatetruecolor($iSize, $iSize);\t\n\tif(imagecopyresampled($NewCanves, $SrcImage, 0, 0, $x_offset, $y_offset, $iSize, $iSize, $square_size, $square_size))\n\t{\n\t\tswitch(strtolower($ImageType))\n\t\t{\n\t\t\tcase 'image/png':\n\t\t\t\timagepng($NewCanves, $DestFolder);\n\t\t\t\tbreak;\n\t\t\tcase 'image/gif':\n\t\t\t\timagegif($NewCanves, $DestFolder);\n\t\t\t\tbreak;\t\t\t\n\t\t\tcase 'image/jpeg':\n\t\t\tcase 'image/pjpeg':\n\t\t\t\timagejpeg($NewCanves, $DestFolder, $Quality);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treturn false;\n\t\t}\n\t\tif(is_resource($NewCanves))\n\t\t{ \n\t\t\timagedestroy($NewCanves); \n\t } \n\t\treturn true;\n\t}\n}", "public function image_fixed_resize($width, $height, $crop = true){\n $ratio = $this->width / $this->height;\n $original_ratio = $width / $height;\n\n $crop_width = $this->width;\n $crop_height = $this->height;\n\n if($ratio > $original_ratio)\n {\n $crop_width = round($original_ratio * $crop_height);\n }\n else\n {\n $crop_height = round($crop_width / $original_ratio);\n }\n if($crop)\n $this->crop($crop_width, $crop_height);\n $this->resize($width, $height);\n }", "function crop($rect=array(),&$autosave=null) \n { \n //invalid rectangle defintion \n if(empty($rect)) \n { \n return $this; \n } \n \n if(count($rect)==2) \n { \n $_rect=$rect; \n $rect=array(0,0,$_rect[0],$_rect[1]); \n unset($_rect); \n } \n \n if(count($rect)==3) \n { \n $_rect=array($rect[0],$rect[1],$rect[2]); \n $rect=array(0,0,$_rect[1],$_rect[2]); \n \n switch(trim(strtolower($_rect[0]))) \n { \n case 'lt': \n $rect[0]=0; \n $rect[1]=0; \n break; \n case 'rt': \n $rect[0]=$this->_width-$rect[2]; \n $rect[1]=0; \n break; \n case 'lb': \n $rect[0]=0; \n $rect[1]=$this->_height-$rect[3]; \n break; \n case 'rb': \n $rect[0]=$this->_width-$rect[2]; \n $rect[1]=$this->_height-$rect[3]; \n break; \n case 'center': \n $rect[0]=($this->_width-$rect[2])*0.5; \n $rect[1]=($this->_height-$rect[3])*0.5; \n break; \n } \n unset($_rect); \n } \n \n if(count($rect)!=4 || $rect[0]<0 || $rect[1]<0 || $rect[2]<=0 || $rect[3]<0) \n { \n return $this; \n } \n \n //overflow \n if($rect[0]+$rect[2]>$this->_width || $rect[1]+$rect[3]>$this->_height) \n { \n return $this; \n } \n \n $_tmpImage=imagecreatetruecolor($rect[2],$rect[3]); \n imagecopy($_tmpImage,$this->_image,0,0,$rect[0],$rect[1],$rect[2],$rect[3]); \n imagedestroy($this->_image); \n $this->_image=&$_tmpImage; \n \n $this->_width=$rect[2]; \n $this->_height=$rect[3]; \n \n if(isset($autosave)) \n { \n $_file=sprintf('%s%s_%sx%s.%s', \n $this->_imagePathInfo['dirname'].DS, \n $this->_imagePathInfo['filename'], \n $this->_width,$this->_height, \n $this->_imagePathInfo['extension'] \n ); \n \n if($this->saveAs($_file,$this->default_qulity,$this->default_smooth,$this->auto_dispose)) \n { \n $autosave=$_file; \n } \n } \n \n return $this; \n }", "function FE_CropImage($img, $w=0, $h=0, $a=''){\t\t\r\n\t\t$q=80; /* calitate 0-100 */\t\t\r\n\t\t$src =__URL__.'app/tt/tt.php?src='.$img.($w>0 ? \"&w=$w\" : \"\").($h>0 ? \"&h=$h\" : \"\").\"&q=$q\".(!empty($a) ? \"&a=$a\" : \"\");\r\n\t\treturn $src;\r\n\t\t\r\n }", "public function crop($startX,$startY,$width,$height){\n\t\t$this->cropimage($width,$height,$startX,$startY);\n\t\treturn $this;\t\n\t}", "function crop_algorithm($location, $save_to, $set_width, $set_height){\n\t// Algoritam developed by Mirza Ohranovic | [email protected]\n\t// Coded by Mirza Ohranovic\n\t// October 2014.\n\n\t$image = new Imagick;\n\t$image->readImage($location);\n\n\t// Get size\n\tlist($width, $height) = getimagesize($location);\n\n\t\t$hratio \t= $set_height / $height;\n\t\t$wratio\t\t= $set_width / $width;\n\n\t\tif($wratio < 1 && $hratio < 1){\n\t\t\t$odabran = min($hratio, $wratio);\n\n\t\t\tif($odabran == $hratio){\n\t\t\t\t$nova = $width * $wratio;\n\t\t\t\t$image->scaleImage($nova, 0);\n\t\t\t}elseif($odabran == $wratio){\n\t\t\t\t$nova = $height * $hratio;\n\t\t\t\t$image->scaleImage(0, $nova);\n\t\t\t}\n\t\t}elseif($wratio < 1 && $hratio >= 1){\n\t\t\t$nova = $height * $hratio;\n\t\t\t$image->scaleImage(0, $nova);\n\t\t}elseif($wratio >= 1 && $hratio < 1){\n\t\t\t$nova = $width * $wratio;\n\t\t\t$image->scaleImage($nova, 0);\n\t\t}else{\n\t\t\t$image->scaleImage($set_width, 0);\n\t\t}\n\n\t\t$v = $image->getImageGeometry();\n\t\t\t$w = $v['width'];\n\t\t\t$h = $v['height'];\n\n\t\t$x = floor(($w - $set_width) / 2);\n\t\t$y = floor(($h - $set_height) / 2);\n\n\t\tif($x <= 1) $x = 0;\n\t\tif($y <= 1) $y = 0;\n\n\t\t$image->cropImage($set_width, $set_height, $x, $y);\n\t\t$image->writeImage($save_to);\n\t\t$image->clear();\n\t\t$image->destroy();\n\t}", "public static function crop(){\n\n}", "function crop($iNewWidth, $iNewHeight, $iResize = 0)\n\t{\n\t\tif (!$this->ImageStream) {\n\t\t\t$this->printError('image not loaded');\n\t\t}\n\n\t\t/* resize imageobject in memory if resize percentage is set */\n\t\tif ($iResize > 0) {\n\t\t\t$this->resizetopercentage($iResize);\n\t\t}\n\n\t\t/* constrain width and height values */\n\t\tif (($iNewWidth > $this->width) || ($iNewWidth < 0)) {\n\t\t\t$this->printError('width out of range');\n\t\t}\n\t\tif (($iNewHeight > $this->height) || ($iNewHeight < 0)) {\n\t\t\t$this->printError('height out of range');\n\t\t}\n\n\t\t/* create blank image with new sizes */\n\t\t$CroppedImageStream = ImageCreateTrueColor($iNewWidth, $iNewHeight);\n\n\t\t/* calculate size-ratio */\n\t\t$iWidthRatio = $this->width / $iNewWidth;\n\t\t$iHeightRatio = $this->height / $iNewHeight;\n\t\t$iHalfNewHeight = $iNewHeight / 2;\n\t\t$iHalfNewWidth = $iNewWidth / 2;\n\n\t\t/* if the image orientation is landscape */\n\t\tif ($this->orientation == 'landscape') {\n\t\t\t/* calculate resize width parameters */\n\t\t\t$iResizeWidth = $this->width / $iHeightRatio;\n\t\t\t$iHalfWidth = $iResizeWidth / 2;\n\t\t\t$iDiffWidth = $iHalfWidth - $iHalfNewWidth;\n\n\t\t\tif (function_exists(\"imagecopyresampled\")) {\n\t\t\t\timagecopyresampled($CroppedImageStream, $this->ImageStream, - $iDiffWidth, 0, 0, 0, $iResizeWidth, $iNewHeight, $this->width, $this->height);\n\t\t\t} else {\n\t\t\t\timagecopyresized($CroppedImageStream, $this->ImageStream, - $iDiffWidth, 0, 0, 0, $iResizeWidth, $iNewHeight, $this->width, $this->height);\n\t\t\t}\n\t\t}\n\t\t/* if the image orientation is portrait or square */\n\t\telseif (($this->orientation == 'portrait') || ($this->orientation == 'square')) {\n\t\t\t/* calculate resize height parameters */\n\t\t\t$iResizeHeight = $this->height / $iWidthRatio;\n\t\t\t$iHalfHeight = $iResizeHeight / 2;\n\t\t\t$iDiffHeight = $iHalfHeight - $iHalfNewHeight;\n\n\t\t\tif (function_exists(\"imagecopyresampled\")) {\n\t\t\t\timagecopyresampled($CroppedImageStream, $this->ImageStream, 0, - $iDiffHeight, 0, 0, $iNewWidth, $iResizeHeight, $this->width, $this->height);\n\t\t\t} else {\n\t\t\t\timagecopyresized($CroppedImageStream, $this->ImageStream, 0, - $iDiffHeight, 0, 0, $iNewWidth, $iResizeHeight, $this->width, $this->height);\n\t\t\t}\n\t\t} else {\n\t\t\tif (function_exists(\"imagecopyresampled\")) {\n\t\t\t\timagecopyresampled($CroppedImageStream, $this->ImageStream, 0, 0, 0, 0, $iNewWidth, $iNewHeight, $this->width, $this->height);\n\t\t\t} else {\n\t\t\t\timagecopyresized($CroppedImageStream, $this->ImageStream, 0, 0, 0, 0, $iNewWidth, $iNewHeight, $this->width, $this->height);\n\t\t\t}\n\t\t}\n\n\t\t$this->ImageStream = $CroppedImageStream;\n\t\t$this->width = $iNewWidth;\n\t\t$this->height = $iNewHeight;\n\t\t$this->setImageOrientation();\n\t}", "public function crop_preset($show_image = false)\n {\n $crop = $_POST[\"crop\"];\n $crop[\"file\"] = $this->source;\n if (!is_file($crop[\"file\"])) {\n # Particularly on the double-form submissions, this can happen.\n # By resetting the session cropper to null.\n return false;\n }\n\n # Whatever was the crop size selected, what is the size to load?\n $new = array(\n # also known as the aspect ratio\n \"width\" => $this->width,\n \"height\" => $this->height,\n );\n\n # Good for as selected by the user\n $thumb = imagecreatetruecolor($new[\"width\"], $new[\"height\"]);\n $source = imagecreatefromjpeg($crop[\"file\"]);\n $x = $crop[\"x1\"];\n $y = $crop[\"y1\"];\n $w = $new[\"width\"]; # 550;\n $h = $new[\"height\"]; #600;\n imagecopyresampled($thumb, $source, 0, 0, $x, $y, $w, $h, $crop[\"width\"], $crop[\"height\"]);\n\n if ($show_image === true) {\n header(\"Content-type: image/jpeg\");\n $success = imagejpeg($thumb, null, $this->quality);\n } else {\n $success = imagejpeg($thumb, $this->destination, $this->quality);\n }\n imagedestroy($thumb);\n\n $_SESSION[\"cropper\"] = array();\n\n return $success;\n }", "public function crop_image($w, $h)\n\t{\n // This function resizes this image to fit in the box $w x $h, cropping to fill the entire image\n $image_size = $this->image_size();\n if ($image_size[0] == $w && $image_size[1] == $h) {\n // No need to crop\n return;\n }\n $ratio = $image_size[0] / $image_size[1];\n $goal_ratio = $w / $h;\n\n // Calculate the new image size\n if ($ratio < $goal_ratio) {\n // Tall image, crop top and bottom\n $l = 0;\n $r = $image_size[0];\n $height = $image_size[0] / $goal_ratio;\n $t = ($image_size[1] / 2) - ($height / 2);\n $b = ($image_size[1] / 2) + ($height / 2);\n } else {\n // Wide image, crop top and bottom\n $t = 0;\n $b = $image_size[1];\n $width = $image_size[1] * $goal_ratio;\n $l = ($image_size[0] / 2) - ($width / 2);\n $r = ($image_size[0] / 2) + ($width / 2);\n }\n\n // Create a new image for the resized image\n $oldimage = $this->load_image();\n $newimage = imagecreatetruecolor($w, $h);\n imagecopyresampled($newimage, $oldimage, 0, 0, $l, $t, $w, $h, $r - $l, $b - $t);\n $filename = tempnam(sys_get_temp_dir(), 'img');\n if (preg_match('/jpeg/', $image_size['mime'])) {\n imagejpeg($newimage, $filename, 100);\n } elseif (preg_match('/gif/', $image_size['mime'])) {\n imagegif($newimage, $filename);\n } elseif (preg_match('/png/', $image_size['mime'])) {\n imagepng($newimage, $filename);\n }\n $this->delete_local_file();\n $this->local_file = $filename;\n\t}", "abstract function crop($properties);", "protected function cropImage($imagePath, $x, $y, $cropW, $cropH, $outW, $outH) {\n\t\tif (!file_exists($imagePath)) return false;\n\n\t\t$updateTime = filemtime($imagePath);\n\t\t$imgHash = md5($imagePath . $x . $y . $cropW . $cropH . $outW . $outH . $updateTime);\n\t\t$cropOutputDir = $this->getOutputDir();\n\t\t$outputDir = $this->publicDir . $cropOutputDir;\n\n\t\tif (!file_exists($outputDir)) {\n\t\t\tmkdir($outputDir);\n\t\t}\n\n\t\t$fileName = $imgHash . '.jpg';\n\n\t\t$path = $outputDir . '/' . $fileName;\n\n\t\tif (!file_exists($path)) {\n\n $src_type = exif_imagetype( $imagePath );\n\n switch ( $src_type ){\n case IMAGETYPE_JPEG:\n $src = imagecreatefromjpeg($imagePath);\n break;\n\n case IMAGETYPE_PNG:\n $src = imagecreatefrompng($imagePath);\n break;\n }\n\n\t\t\tif ( !isset( $src ) || !$src)\n return false;\n\n $w = $cropW;\n\t\t\t$h = $cropH;\n\n\t\t\t$out = imagecreatetruecolor($outW, $outH);\n\n\t\t\timagecopyresampled($out, $src, 0, 0, $x, $y, $outW, $outH, $w, $h);\n\n\t\t\timagejpeg($out, $path, $this->getJpgQuality());\n\t\t\timagedestroy($out);\n\t\t\timagedestroy($src);\n\t\t}\n\t\tif (!file_exists($path)) {\n\t\t\treturn false;\n\t\t}\n\t\treturn $cropOutputDir . '/' . $fileName;\n\t}", "function getImageCropWindow() {\n printf(\n '<html><head><title>%s</title></head><body>'.\n '<object type=\"application/x-shockwave-flash\" width=\"640\" height=\"540\"\n data=\"flash/imagecrop.swf?lzproxied=false&imageid=%s\">\n <param name=\"movie\" value=\"flash/imagecrop.swf?lzproxied=false&imageid=%s\">\n <param name=\"quality\" value=\"high\">\n <param name=\"scale\" value=\"noscale\">\n <param name=\"salign\" value=\"LT\">\n <param name=\"menu\" value=\"false\"></object></body></html>',\n papaya_strings::escapeHTMLChars($this->_gt('Crop image')),\n papaya_strings::escapeHTMLChars($this->params['file_id']),\n papaya_strings::escapeHTMLChars($this->params['file_id'])\n );\n exit;\n }", "function resizeCropImage($src, $dst, $dstx, $dsty){\n\t\t//$dst = destination image location\n\t\t//$dstx = user defined width of image\n\t\t//$dsty = user defined height of image\n\t\t$allowedExtensions = 'jpg jpeg gif png';\n\t\t$name = explode(\".\", strtolower($src));\n\t\t$currentExtensions = $name[count($name)-1];\n\t\t$extensions = explode(\" \", $allowedExtensions);\n\n\t\tfor($i=0; count($extensions)>$i; $i=$i+1) {\n\t\t\tif($extensions[$i]==$currentExtensions)\n\t\t\t{ \n\t\t\t\t$extensionOK=1; \n\t\t\t\t$fileExtension=$extensions[$i]; \n\t\t\t\tbreak; \n\t\t\t}\n\t\t}\n\n\t\tif($extensionOK){\n\t\t\t$size = getImageSize($src);\n\t\t\t$width = $size[0];\n\t\t\t$height = $size[1];\n\t\t\tif($width >= $dstx AND $height >= $dsty){\n\t\t\t\t$proportion_X = $width / $dstx;\n\t\t\t\t$proportion_Y = $height / $dsty;\n\t\t\t\tif($proportion_X > $proportion_Y ){\n\t\t\t\t\t$proportion = $proportion_Y;\n\t\t\t\t}else{\n\t\t\t\t\t$proportion = $proportion_X ;\n\t\t\t\t}\n\t\t\t\t$target['width'] = $dstx * $proportion;\n\t\t\t\t$target['height'] = $dsty * $proportion;\n\t\t\t\t$original['diagonal_center'] = round(sqrt(($width*$width)+($height*$height))/2);\n\t\t\t\t$target['diagonal_center'] = round(sqrt(($target['width']*$target['width']) + ($target['height']*$target['height']))/2);\n\t\t\t\t$crop = round($original['diagonal_center'] - $target['diagonal_center']);\n\t\t\t\tif($proportion_X < $proportion_Y ){\n\t\t\t\t\t$target['x'] = 0;\n\t\t\t\t\t$target['y'] = round((($height/2)*$crop)/$target['diagonal_center']);\n\t\t\t\t}else{\n\t\t\t\t\t$target['x'] = round((($width/2)*$crop)/$target['diagonal_center']);\n\t\t\t\t\t$target['y'] = 0;\n\t\t\t\t}\n\t\t\t\tif($fileExtension == \"jpg\" OR $fileExtension=='jpeg'){ \n\t\t\t\t\t$from = ImageCreateFromJpeg($src); \n\t\t\t\t} elseif ($fileExtension == \"gif\"){ \n\t\t\t\t\t$from = ImageCreateFromGIF($src); \n\t\t\t\t} elseif ($fileExtension == 'png'){\n\t\t\t\t\t$from = imageCreateFromPNG($src);\n\t\t\t\t}\n\t\t\t\t$new = ImageCreateTrueColor ($dstx,$dsty);\n\t\t\t\timagecopyresampled ($new, $from, 0, 0, $target['x'], \n\t\t\t\t$target['y'], $dstx, $dsty, $target['width'], $target['height']);\n\t\t\t\tif($fileExtension == \"jpg\" OR $fileExtension == 'jpeg'){ \n\t\t\t\t\timagejpeg($new, $dst, 70); \n\t\t\t\t} elseif ($fileExtension == \"gif\"){ \n\t\t\t\t\timagegif($new, $dst); \n\t\t\t\t}elseif ($fileExtension == 'png'){\n\t\t\t\t\timagepng($new, $dst);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tcopy($src, $dst);\n\t\t\t}\n\t\t}\n\t}", "public function executeCrop(sfWebRequest $request)\n {\n $this->hasPermissionsForSelect();\n \n $selection = aMediaTools::getSelection();\n $id = $request->getParameter('id');\n $index = array_search($id, $selection);\n if ($index === false)\n {\n $this->forward404();\n }\n $cropLeft = floor($request->getParameter('cropLeft'));\n $cropTop = floor($request->getParameter('cropTop'));\n $cropWidth = floor($request->getParameter('cropWidth'));\n $cropHeight = floor($request->getParameter('cropHeight'));\n $width = floor($request->getParameter('width'));\n $height = floor($request->getParameter('height'));\n $imageInfo = aMediaTools::getAttribute('imageInfo');\n $imageInfo[$id]['cropLeft'] = $cropLeft;\n $imageInfo[$id]['cropTop'] = $cropTop;\n $imageInfo[$id]['cropWidth'] = $cropWidth;\n $imageInfo[$id]['cropHeight'] = $cropHeight;\n $imageInfo[$id]['width'] = $width;\n $imageInfo[$id]['height'] = $height;\n aMediaTools::setAttribute('imageInfo', $imageInfo);\n return $this->renderTemplate();\n }", "public function crop($width = null, $height = null, $gravity = null, $x = null, $y = null)\n {\n return $this->resize(Crop::crop($width, $height, $gravity, $x, $y));\n }", "function crop_image_square($source, $destination, $image_type, $square_size, $image_width, $image_height, $quality){\n if($image_width <= 0 || $image_height <= 0){return false;} //return false if nothing to resize\n\n if($image_width > $image_height)\n {\n $y_offset = 0;\n $x_offset = ($image_width - $image_height) / 2;\n $s_size \t= $image_width - ($x_offset * 2);\n }else{\n $x_offset = 0;\n $y_offset = ($image_height - $image_width) / 2;\n $s_size = $image_height - ($y_offset * 2);\n }\n $new_canvas\t= imagecreatetruecolor( $square_size, $square_size); //Create a new true color image\n\n //Copy and resize part of an image with resampling\n if(imagecopyresampled($new_canvas, $source, 0, 0, $x_offset, $y_offset, $square_size, $square_size, $s_size, $s_size)){\n save_image($new_canvas, $destination, $image_type, $quality);\n }\n\n return true;\n}", "public function crop(array $dimensions, array $coordinates) {\n// is there an image resource to work with?\n if (isset($this->_resource)) {\n// do the dimensions have and coordinates have the appropriate values to work with (checking the keys)? \n if (array_keys($dimensions) == array(\"width\", \"height\") && array_keys($coordinates) == array(\"x1\", \"x2\", \"y1\", \"y2\")) {\n $is_all_int = true;\n foreach (array_merge($dimensions, $coordinates) as $value) {\n if (is_int($value) == false) {\n $is_all_int = false;\n }\n }\n if ($is_all_int == true) {\n $width = $dimensions[\"width\"];\n $height = $dimensions[\"height\"];\n $x1 = $coordinates[\"x1\"];\n $x2 = $coordinates[\"x2\"];\n $y1 = $coordinates[\"y1\"];\n $y2 = $coordinates[\"y2\"];\n\n// generating the placeholder resource\n $cropped_image = $this->newImageResource($width, $height);\n\n// copying the original image's resource into the placeholder and cropping it accordingly\n imagecopyresampled($cropped_image, $this->_resource, 0, 0, $x1, $y1, $width, $height, ($x2 - $x1), ($y2 - $y1));\n\n// assigning the new image attributes\n $this->_resource = $cropped_image;\n $this->_width = $width;\n $this->_height = $height;\n } else {\n trigger_error(\"CAMEMISResizeImage::crop() was provided values that were not integers (check the dimensions or coordinates for strings or floats)\", E_USER_WARNING);\n }\n } else {\n trigger_error(\"CAMEMISResizeImage::crop() was not provided the appropriate arguments (first given parameter must be an array and must contain \\\"width\\\" and \\\"height\\\" elements, and the second given parameter must be an array and contain \\\"x1\\\", \\\"x2\\\", \\\"y2\\\", and \\\"y2\\\" elements)\", E_USER_WARNING);\n }\n } else {\n trigger_error(\"CAMEMISResizeImage::crop() attempting to access a non-existent resource (check if the image was loaded by CAMEMISResizeImage::__construct())\", E_USER_WARNING);\n }\n\n return $this;\n }", "public function user_crop()\r\n\t{\r\n\t\t// Get uploaded photo\r\n\t\t$uploaded_photo = $this->input->post('uploaded_photo');\r\n\r\n\t\t// Get image width, height\r\n\t\tlist($width, $height) = @getimagesize('./assets/uploads/' . $uploaded_photo);\r\n\r\n\t\t// Calculate ratio\r\n\t\t$ratio = $width / 536;\r\n\r\n\t\t// Get chosen crop coordinates\r\n\t\t$coords_x1 = round($ratio * $this->input->post('coords-x1'));\r\n\t\t$coords_y1 = round($ratio * $this->input->post('coords-y1'));\r\n\t\t$coords_x2 = round($ratio * $this->input->post('coords-x2'));\r\n\t\t$coords_y2 = round($ratio * $this->input->post('coords-y2'));\r\n\t\t$coords_w = round($ratio * $this->input->post('coords-w'));\r\n\t\t$coords_h = round($ratio * $this->input->post('coords-h'));\r\n\r\n\t\t// Profile thumbnail crop config\r\n\t\t$config['source_image'] = './assets/uploads/' . $uploaded_photo;\r\n\t\t$config['new_image'] = './assets/uploads/tall-' . strtolower($uploaded_photo);\r\n\t\t$config['width'] = $coords_w;\r\n\t\t$config['height'] = $coords_h;\r\n\t\t$config['maintain_ratio'] = FALSE;\r\n\t\t$config['x_axis'] = $coords_x1;\r\n\t\t$config['y_axis'] = $coords_y1;\r\n\r\n\t\t// Initialize the image library with config\r\n\t\t$this->image_lib->initialize($config);\r\n\r\n\t\t// Crop the image\r\n\t\tif (!$this->image_lib->crop())\r\n\t\t{\r\n\t\t\t$errors[] = $this->image_lib->display_errors('', '');\r\n\t\t}\r\n\r\n\t\t// Clear the config to start next thumbnail\r\n\t\t$config = array();\r\n\t\t$this->image_lib->clear();\r\n\r\n\t\t// Profile thumbnail resize config\r\n\t\t$config['source_image'] = './assets/uploads/tall-' . strtolower($uploaded_photo);\r\n\t\t$config['width'] = 385;\r\n\t\t$config['height'] = 465;\r\n\t\t$config['maintain_ratio'] = FALSE;\r\n\r\n\t\t// Initialize the image library with config\r\n\t\t$this->image_lib->initialize($config);\r\n\r\n\t\t// Resize the image\r\n\t\tif (!$this->image_lib->resize())\r\n\t\t{\r\n\t\t\t$errors[] = $this->image_lib->display_errors('', '');\r\n\t\t}\r\n\t}", "abstract public function calculateCropBoxSize();", "private function intern_resize_crop($newWidth, $newHeight)\n\t{\n\t\t/*\n\t\t * Crop-to-fit PHP-GD\n\t\t * http://salman-w.blogspot.com/2009/04/crop-to-fit-image-using-aspphp.html\n\t\t *\n\t\t * Resize and center crop an arbitrary size image to fixed width and height\n\t\t * e.g. convert a large portrait/landscape image to a small square thumbnail\n\t\t *\n\t\t * Modified by Fry\n\t\t */\n\t\t$desired_aspect_ratio = $newWidth / $newHeight;\n\n\t\tif ($this->srcAspectRatio > $desired_aspect_ratio) {\n\t\t\t/*\n\t\t\t * Triggered when source image is wider\n\t\t\t */\n\t\t\t$temp_height = $newHeight;\n\t\t\t$temp_width = ( int ) ($newHeight * $this->srcAspectRatio);\n\t\t} else {\n\t\t\t/*\n\t\t\t * Triggered otherwise (i.e. source image is similar or taller)\n\t\t\t */\n\t\t\t$temp_width = $newWidth;\n\t\t\t$temp_height = ( int ) ($newWidth / $this->srcAspectRatio);\n\t\t}\n\n\t\t/*\n\t\t * Resize the image into a temporary GD image\n\t\t */\n\n\t\t$tempImage = imagecreatetruecolor($temp_width, $temp_height);\n\t\timagecopyresampled(\n\t\t\t$tempImage,\t\t\t\t\t$this->srcImage,\n\t\t\t0, 0,\t\t\t0, 0,\n\t\t\t$temp_width, $temp_height,\t$this->srcWidth, $this->srcHeight\n\t\t);\n\n\t\t/*\n\t\t * Copy cropped region from temporary image into the desired GD image\n\t\t */\n\n\t\t$x0 = ($temp_width - $newWidth) / 2;\n\t\t$y0 = ($temp_height - $newHeight) / 2;\n\t\t$this->newImage = imagecreatetruecolor($newWidth, $newHeight);\n\t\timagecopy(\n\t\t\t$this->newImage,\t$tempImage,\n\t\t\t0, 0,\t$x0, $y0,\n\t\t\t$newWidth, $newHeight\n\t\t);\n\t\timagedestroy($tempImage);\n\t}", "function my_awesome_image_resize_dimensions( $payload, $orig_w, $orig_h, $dest_w, $dest_h, $crop ){\n\t// want to override the defaults for this image or not.\n\tif( false )\n\t\treturn $payload;\n\n\tif ( $crop ) {\n\t\t// crop the largest possible portion of the original image that we can size to $dest_w x $dest_h\n\t\t$aspect_ratio = $orig_w / $orig_h;\n\t\t$new_w = min($dest_w, $orig_w);\n\t\t$new_h = min($dest_h, $orig_h);\n\n\t\tif ( !$new_w ) {\n\t\t\t$new_w = intval($new_h * $aspect_ratio);\n\t\t}\n\n\t\tif ( !$new_h ) {\n\t\t\t$new_h = intval($new_w / $aspect_ratio);\n\t\t}\n\n\t\t$size_ratio = max($new_w / $orig_w, $new_h / $orig_h);\n\n\t\t$crop_w = round($new_w / $size_ratio);\n\t\t$crop_h = round($new_h / $size_ratio);\n\n\t\t$s_x = 0; // [[ formerly ]] ==> floor( ($orig_w - $crop_w) / 2 );\n\t\t$s_y = 0; // [[ formerly ]] ==> floor( ($orig_h - $crop_h) / 2 );\n\t} else {\n\t\t// don't crop, just resize using $dest_w x $dest_h as a maximum bounding box\n\t\t$crop_w = $orig_w;\n\t\t$crop_h = $orig_h;\n\n\t\t$s_x = 0;\n\t\t$s_y = 0;\n\n\t\tlist( $new_w, $new_h ) = wp_constrain_dimensions( $orig_w, $orig_h, $dest_w, $dest_h );\n\t}\n\n\t// if the resulting image would be the same size or larger we don't want to resize it\n\tif ( $new_w >= $orig_w && $new_h >= $orig_h )\n\t\treturn false;\n\n\t// the return array matches the parameters to imagecopyresampled()\n\t// int dst_x, int dst_y, int src_x, int src_y, int dst_w, int dst_h, int src_w, int src_h\n\treturn array( 0, 0, (int) $s_x, (int) $s_y, (int) $new_w, (int) $new_h, (int) $crop_w, (int) $crop_h );\n\n}", "function crop_image_square($source, $destination, $image_type, $square_size, $image_width, $image_height, $quality){\n\tif($image_width <= 0 || $image_height <= 0){return false;} //return false if nothing to resize\n\n\tif( $image_width > $image_height )\n\t{\n\t\t$y_offset = 0;\n\t\t$x_offset = ($image_width - $image_height) / 2;\n\t\t$s_size \t= $image_width - ($x_offset * 2);\n\t}else{\n\t\t$x_offset = 0;\n\t\t$y_offset = ($image_height - $image_width) / 2;\n\t\t$s_size = $image_height - ($y_offset * 2);\n\t}\n\t$new_canvas\t= imagecreatetruecolor( $square_size, $square_size); //Create a new true color image\n\n\t//Copy and resize part of an image with resampling\n\tif(imagecopyresampled($new_canvas, $source, 0, 0, $x_offset, $y_offset, $square_size, $square_size, $s_size, $s_size)){\n\t\tsave_image($new_canvas, $destination, $image_type, $quality);\n\t}\n\n\treturn true;\n}", "public function setCrop($x, $y)\n\t{\n\t\tif ($x === null || $y === null)\n\t\t{\n\t\t\t$this->cropX = $x;\n\t\t\t$this->cropY = $y;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->cropX = intval($x);\n\t\t\t$this->cropY = intval($y);\n\t\t}\n\t}", "public function fit($desiredWidth, $desiredHeight,$crop=true)\n {\n $cropX = 0;\n $cropY = 0;\n \n $imageWidth = $this->getWorkingImageWidth();\n $imageHeight = $this->getWorkingImageHeight();\n $currentRatio = $imageHeight / $imageWidth;\n $desiredRatio = $desiredHeight / $desiredWidth;\n\n // simple scale\n if($currentRatio == $desiredRatio)\n {\n $this->resize($desiredWidth, $desiredHeight);\n return true;\n }\n\n // width priority - maybe crop the height if needed\n if($currentRatio > $desiredRatio)\n {\n $destWidth = $desiredWidth;\n $destHeight = ceil($imageHeight * ($desiredWidth / $imageWidth));\n \n // set cropY so that the crop area occurs in the vertical centre\n $cropY = ceil(($destHeight - $desiredHeight) / 2);\n }\n\n // height priority - maybe crop the width if needed\n elseif($currentRatio < $desiredRatio)\n {\n $destHeight = $desiredHeight;\n $destWidth = floor($imageWidth * ($desiredHeight / $imageHeight));\n\n // set cropX so that the crop area occurs in the horizontal centre\n $cropX = ceil(($destWidth - $desiredWidth) / 2);\n }\n\n $this->resize($destWidth, $destHeight);\n if($crop)\n {\n $this->crop($desiredWidth, $desiredHeight, $cropX, $cropY);\n }\n }", "public function cropAvatarAction()\n {\n // TODO: swap web dir to product path\n //$imgRealPath = '/Users/leonqiu/www/choumei.me/Symfony/web/' . $_POST['imageSource'];\n $imgRealPath = dirname(__FILE__) . '/../../../../web/' . $_POST['imageSource'];\n list($width, $height) = getimagesize($imgRealPath);\n \n $viewPortW = $_POST[\"viewPortW\"];\n\t $viewPortH = $_POST[\"viewPortH\"];\n $pWidth = $_POST[\"imageW\"];\n $pHeight = $_POST[\"imageH\"];\n $tmp = explode(\".\",$_POST[\"imageSource\"]);\n $ext = end(&$tmp);\n $function = $this->returnCorrectFunction($ext);\n //$image = $function($_POST[\"imageSource\"]);\n $image = $function($imgRealPath);\n $width = imagesx($image);\n $height = imagesy($image);\n \n // Resample\n $image_p = imagecreatetruecolor($pWidth, $pHeight);\n $this->setTransparency($image,$image_p,$ext);\n\t\timagecopyresampled($image_p, $image, 0, 0, 0, 0, $pWidth, $pHeight, $width, $height);\n\t\timagedestroy($image);\n\t\t$widthR = imagesx($image_p);\n\t\t$hegihtR = imagesy($image_p);\n\t\t\n\t\t$selectorX = $_POST[\"selectorX\"];\n\t\t$selectorY = $_POST[\"selectorY\"];\n\t\t\n\t\tif($_POST[\"imageRotate\"]){\n\t\t $angle = 360 - $_POST[\"imageRotate\"];\n\t\t $image_p = imagerotate($image_p,$angle,0);\n\t\t \n\t\t $pWidth = imagesx($image_p);\n\t\t $pHeight = imagesy($image_p);\n\t\t \n\t\t //print $pWidth.\"---\".$pHeight;\n\t\t\n\t\t $diffW = abs($pWidth - $widthR) / 2;\n\t\t $diffH = abs($pHeight - $hegihtR) / 2;\n\t\t \n\t\t $_POST[\"imageX\"] = ($pWidth > $widthR ? $_POST[\"imageX\"] - $diffW : $_POST[\"imageX\"] + $diffW);\n\t\t $_POST[\"imageY\"] = ($pHeight > $hegihtR ? $_POST[\"imageY\"] - $diffH : $_POST[\"imageY\"] + $diffH);\n\t\t\n\t\t \n\t\t}\n\t\t\n\t\t$dst_x = $src_x = $dst_y = $dst_x = 0;\n\t\t\n\t\tif($_POST[\"imageX\"] > 0){\n\t\t $dst_x = abs($_POST[\"imageX\"]);\n\t\t}else{\n\t\t $src_x = abs($_POST[\"imageX\"]);\n\t\t}\n\t\tif($_POST[\"imageY\"] > 0){\n\t\t $dst_y = abs($_POST[\"imageY\"]);\n\t\t}else{\n\t\t $src_y = abs($_POST[\"imageY\"]);\n\t\t}\n\t\t\n\t\t\n\t\t$viewport = imagecreatetruecolor($_POST[\"viewPortW\"],$_POST[\"viewPortH\"]);\n\t\t$this->setTransparency($image_p,$viewport,$ext);\n\t\t\n\t\timagecopy($viewport, $image_p, $dst_x, $dst_y, $src_x, $src_y, $pWidth, $pHeight);\n\t\timagedestroy($image_p);\n\t\t\n\t\t\n\t\t$selector = imagecreatetruecolor($_POST[\"selectorW\"],$_POST[\"selectorH\"]);\n\t\t$this->setTransparency($viewport,$selector,$ext);\n\t\timagecopy($selector, $viewport, 0, 0, $selectorX, $selectorY,$_POST[\"viewPortW\"],$_POST[\"viewPortH\"]);\n\t\t\n\t\t//$file = \"tmp/test\".time().\".\".$ext;\n\t\t// TODO: generate file name\n\t\t$fileName = uniqid() . \".\" . $ext;\n\t\t$user = $this->get('security.context')->getToken()->getUser();\n\t\t$avatarFile = dirname(__FILE__).'/../../../../web/uploads/avatar/'.$user->getId(). '/' .$fileName;\n\t\t$avatarUrl = '/uploads/avatar/'. $user->getId() . '/' . $fileName;\n\t\t$this->parseImage($ext,$selector,$avatarFile);\n\t\timagedestroy($viewport);\n\t\t//Return value\n\t\t//update avatar\n $em = $this->getDoctrine()->getEntityManager();\n $user->setAvatar($avatarUrl);\n $em->persist($user);\n $em->flush();\n\t\techo $avatarUrl;\n\t\texit;\n }", "public static function crop()\n {\n return new CropMode(CropMode::CROP);\n }", "public function cropImage($width, $height , $target) {\r\n // load an image\r\n $i = new Imagick($this->src);\r\n // get the current image dimensions\r\n $geo = $i -> getImageGeometry();\r\n\r\n // crop the image\r\n if (($geo['width'] / $width) < ($geo['height'] / $height)) {\r\n $i -> cropImage($geo['width'], floor($height * $geo['width'] / $width), 0, (($geo['height'] - ($height * $geo['width'] / $width)) / 2));\r\n } else {\r\n $i -> cropImage(ceil($width * $geo['height'] / $height), $geo['height'], (($geo['width'] - ($width * $geo['height'] / $height)) / 2), 0);\r\n }\r\n\r\n // save or show or whatever the image\r\n $i -> setImageFormat(\"jpeg\");\r\n $i -> writeImage($target);\r\n\r\n\r\n $wrapper2 = new ImagickWrapper($target);\r\n $wrapper2 -> generateThumbnail($target,$width.\"x\".$height);\r\n }", "public function cropImage($width, $height, $x, $y) {\n return $this->im->cropImage($width, $height, $x, $y);\n }", "public function crop($width, $height)\n\t{\n\t\t// Resize to minimum size\n\t\t$wScale = $this->width / $width; // 4\n\t\t$hScale = $this->height / $height; // 3\n\t\t$minScale = min($wScale, $hScale);\n\t\t// Decrease image dimensions\n\t\tif($minScale > 1)\n\t\t{\n\t\t\t$widthResize = $this->width / $minScale;\n\t\t\t$heightResize = $this->height / $minScale;\n\t\t}\n\t\t// Increase image dimensions\n\t\telse\n\t\t{\n\t\t\t$widthResize = $this->width / $minScale;\n\t\t\t$heightResize = $this->height / $minScale;\n\t\t}\n\t\t$image = imagecreatetruecolor($width, $height);\n\t\t$x = ($widthResize - $width) / 2;\n\t\t$y = ($heightResize - $height) / 2;\n\t\timagecopyresampled($image, $this->image, 0, 0, $x, $y, $width, $height, $widthResize, $heightResize);\n\n\t\t$this->image = $image;\n\t\t$this->width = $width;\n\t\t$this->height = $height;\n\t}", "public function cropAction()\n {\n $candidate = $this->getRequest()->server->get('HTTP_REFERER');\n\n // make sure we get back to product page (fallback to admin home)\n if (strpos($candidate, '/product/product/') !== false) {\n $return_path = $candidate;\n $this->getRequest()->getSession()->set('crop_return_path', $return_path);\n } else {\n $return_path = $this->getRequest()->getSession()->get('crop_return_path');\n if (empty($return_path)) {\n $return_path = '/admin/dashboard';\n }\n }\n\n $path = $this->getRequest()->get('path');\n\n $source_path = $this->container->getParameter('kernel.root_dir') . \"/../web\" . $this->getRequest()->get('src');\n list( $source_width, $source_height, $source_type ) = getimagesize($source_path);\n\n if ($this->getRequest()->isMethod('post')) {\n\n $vector = $this->getRequest()->get('v');\n\n switch ( $source_type )\n {\n case IMAGETYPE_GIF:\n $source_gdim = imagecreatefromgif($source_path);\n break;\n\n case IMAGETYPE_JPEG:\n $source_gdim = imagecreatefromjpeg($source_path);\n break;\n\n case IMAGETYPE_PNG:\n $source_gdim = imagecreatefrompng($source_path);\n break;\n }\n\n $width = $vector[2] - $vector[0];\n $height = $vector[3] - $vector[1];\n\n // if crop makes sense\n if ($width < $source_width) {\n $dest = imagecreatetruecolor($width, $height);\n imagecopy($dest, $source_gdim, 0, 0, $vector[0], $vector[1], $width, $height);\n\n switch ( $source_type )\n {\n case IMAGETYPE_GIF:\n imagegif($dest, $source_path);\n break;\n\n case IMAGETYPE_JPEG:\n imagejpeg($dest, $source_path);\n break;\n\n case IMAGETYPE_PNG:\n imagepng($dest, $source_path);\n break;\n }\n\n // use new width for rendering\n list( $source_width, $source_height, $source_type ) = getimagesize($source_path);\n\n $this->addFlash('sonata_flash_success', 'Image cropped');\n } else {\n $this->addFlash('sonata_flash_error', 'Image not cropped: wrong dimensions');\n }\n }\n\n return $this->render('TeoProductBundle:Admin:crop_image.html.twig', array(\n 'path' => $path,\n 'action' => 'crop',\n 'teo_product_aspect_ratio' => $this->container->getParameter('teo_product_aspect_ratio'),\n 'actual_width' => $source_width,\n 'return_path' => $return_path,\n 'random' => md5(mt_rand()) . md5(mt_rand())\n ));\n }", "public function crop($startX,$startY,$width,$height){\n\t\t// do some calculations\n\t\t$cropWidth\t= ($this->_width < $width) ? $this->_width : $width;\n\t\t$cropHeight = ($this->_height < $height) ? $this->_height : $height;\n\t\t\n\t\t$this->_width = $cropWidth;\n\t\t$this->_height = $cropHeight;\n\t\treturn $this;\n\t}", "public function cropImage($width, $height, $x, $y)\n {\n if ($this->resource->getNumberImages() > 0) {\n $frames = $this->resource->coalesceImages();\n foreach ($frames as $frame) {\n $frame->setImageBackgroundColor('none');\n $frame->cropImage($width, $height, $x, $y);\n $frame->thumbnailImage($width, $height);\n $frame->setImagePage($width, $height, 0, 0);\n }\n $this->resource = $frames->deconstructImages();\n $this->resource->resizeImage($width, $height, $this->imageFilter, $this->imageBlur);\n } else {\n $this->resource->cropImage($width, $height, $x, $y);\n }\n\n return $this;\n }", "function image_crop(){\n\n\t\t\t$imgUrl = $_POST['imgUrl'];\n\t\t\t/*explored image URL and get image name*/\n\t\t\t$expImgUrl=explode(\"/\", $imgUrl);\n\t\t\t$LengthOfArray = sizeof($expImgUrl);\n\t\t\t$imageName = $LengthOfArray-1;\n\t\t\t$imgName = $expImgUrl[$imageName];\n\t\t\t$imgInitW = $_POST['imgInitW'];\n\t\t\t$imgInitH = $_POST['imgInitH'];\n\t\t\t$imgW = $_POST['imgW'];\n\t\t\t$imgH = $_POST['imgH'];\n\t\t\t$imgY1 = $_POST['imgY1'];\n\t\t\t$imgX1 = $_POST['imgX1'];\n\t\t\t$cropW = $_POST['cropW'];\n\t\t\t$cropH = $_POST['cropH'];\n\n\t\t\t$jpeg_quality = 100;\n\t\t\t$rand = rand();\n\t\t\t$output_filename = \"../webroot/img/uploads/croppedImg_\".$rand;\n\t\t\t$oname = \"img/uploads/croppedImg_\".$rand;\n\t\t\t$Pname = \"img/uploads/\";\n\t\t\t$path = BASE_PATH;\n\n\t\t\t$what = getimagesize($Pname.\"/\".$imgName);\n\t\t\t\n\t\t\tswitch(strtolower($what['mime']))\n\t\t\t{\n\t\t\t\tcase 'image/png':\n\t\t\t\t\t$img_r = imagecreatefrompng($Pname.\"/\".$imgName);\n\t\t\t\t\t$source_image = imagecreatefrompng($Pname.\"/\".$imgName);\n\t\t\t\t\t$type = '.png';\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'image/jpeg':\n\t\t\t\t\t$img_r = imagecreatefromjpeg($Pname.\"/\".$imgName);\n\t\t\t\t\t$source_image = imagecreatefromjpeg($Pname.\"/\".$imgName);\n\t\t\t\t\t$type = '.jpeg';\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'image/gif':\n\t\t\t\t\t$img_r = imagecreatefromgif($Pname.\"/\".$imgName);\n\t\t\t\t\t$source_image = imagecreatefromgif($Pname.\"/\".$imgName);\n\t\t\t\t\t$type = '.gif';\n\t\t\t\t\tbreak;\n\t\t\t\tdefault: die('image type not supported');\n\t\t\t}\n\t\t\t\t\n\t\t\t$resizedImage = imagecreatetruecolor($imgW, $imgH);\n\t\t\timagecopyresampled($resizedImage, $source_image, 0, 0, 0, 0, $imgW, \n\t\t\t\t\t\t$imgH, $imgInitW, $imgInitH);\t\n\t\t\t\n\t\t\t\n\t\t\t$dest_image = imagecreatetruecolor($cropW, $cropH);\n\t\t\timagecopyresampled($dest_image, $resizedImage, 0, 0, $imgX1, $imgY1, $cropW, \n\t\t\t\t\t\t$cropH, $cropW, $cropH);\t\n\n\n\t\t\timagejpeg($dest_image, $output_filename.$type, $jpeg_quality);\n\t\t\t\n\t\t\t$response = array(\n\t\t\t\t\t\"status\" => 'success',\n\t\t\t\t\t\"url\" => $oname.$type, \n\t\t\t\t\t\"base\" => $path \n\t\t\t\t );\n\t\t\t print json_encode($response);\n\t\t\t exit;\n\t}", "function resize_image($file, $w, $h, $crop=FALSE) {\n list($width, $height) = getimagesize($file);\n $r = $w / $h;\n $rate = $width / $height;\n // if we want it cropped\n if ($crop) {\n if ($rate < $r) {\n $src_w = $width;\n $src_h = ceil($width / $r);\n $src_x = 0;\n $src_y = ceil(($height - $src_h) / 2);\n $dst_w = $w;\n $dst_h = $h;\n $dst_x = 0;\n $dst_y = 0;\n }\n else {\n $src_w = ceil($r * $height);\n $src_h = $height;\n $src_x = ceil(($width - $src_w) / 2);\n $src_y = 0;\n $dst_w = $w;\n $dst_h = $h;\n $dst_x = 0;\n $dst_y = 0;\n }\n $newwidth = $w;\n $newheight = $h;\n }\n // if we don't want it cropped\n else {\n if ($rate < $r) {\n $src_w = $width;\n $src_h = $height;\n $src_x = 0;\n $src_y = 0;\n $dst_w = $h * $rate;\n $dst_h = $h;\n $dst_x = 0;\n $dst_y = 0;\n }\n else {\n $src_w = $width;\n $src_h = $height;\n $src_x = 0;\n $src_y = 0;\n $dst_w = $w;\n $dst_h = $w / $rate;\n $dst_x = 0;\n $dst_y = 0;\n }\n $newwidth = $dst_w;\n $newheight = $dst_h;\n }\n \n $type = strtolower(substr(strrchr($file,\".\"),1));\n if($type == 'jpeg') $type = 'jpg';\n switch($type){\n case 'bmp': $src_image = @imagecreatefromwbmp($file); break;\n case 'gif': $src_image = @imagecreatefromgif($file); break;\n case 'jpg': $src_image = @imagecreatefromjpeg($file); break;\n case 'png': $src_image = @imagecreatefrompng($file); break;\n default : return \"Unsupported picture type!\";\n } \n \n if ($src_image) {\n $dst_image = imagecreatetruecolor($newwidth, $newheight);\n imagecopyresampled($dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);\n return $dst_image;\n } else {\n return null;\n }\n }", "private function _setCrop()\n {\n if (isset($this->crop) && $this->crop && $this->bbox_rubberband && $this->_isResize()) {\n\n $bbox_rubberband = explode(',', $this->bbox_rubberband);\n\n //lower-left coordinate\n $ll_point = new \\stdClass();\n $ll_point->x = $bbox_rubberband[0];\n $ll_point->y = $bbox_rubberband[3];\n $ll_coord = $this->pix2Geo($ll_point);\n\n //upper-right coordinate\n $ur_point = new \\stdClass();\n $ur_point->x = $bbox_rubberband[2];\n $ur_point->y = $bbox_rubberband[1];\n $ur_coord = $this->pix2Geo($ur_point);\n\n //set the size as selected\n $width = abs($bbox_rubberband[2]-$bbox_rubberband[0]);\n $height = abs($bbox_rubberband[3]-$bbox_rubberband[1]);\n\n $this->map_obj->setSize($width, $height);\n if ($this->_isResize() && $this->_download_factor > 1) {\n $this->map_obj->setSize($this->_download_factor*$width, $this->_download_factor*$height);\n }\n\n //set the extent to match that of the crop\n $this->map_obj->setExtent($ll_coord->x, $ll_coord->y, $ur_coord->x, $ur_coord->y);\n }\n }", "public function resizeImage($width, $height, $crop = true)\n\t{\n\t\t$iWidth = $this->getWidth();\n\t\t$iHeight = $this->getHeight();\n\n\t\tif (!$width) {\n\t\t\t$width = $iWidth;\n\t\t} else {\n\t\t\t$width = $width > $iWidth ? $iWidth : $width;\n\t\t}\n\n\t\tif (!$height) {\n\t\t\t$height = $iHeight;\n\t\t} else {\n\t\t\t$height = $height > $iHeight ? $iHeight : $height;\n\t\t}\n\n\t\tif ($crop) {\n\t\t\t$this->image->thumbnail($width, $height, 'center');\n\t\t} else {\n\t\t\t$this->image->resize($width, $height);\n\t\t}\n\n\t\treturn $this;\n\t}", "public function crop($coords, $targetSize = null, $rescale = TRUE)\n {\n //set the resulting image's dims if passed\n if ($targetSize){\n $this->thumbnailHeight = $targetSize['h'];\n $this->thumbnailWidth = $targetSize['w'];\n $this->thumbnailAspect = $this->thumbnailWidth/$this->thumbnailHeight;\n }\n\n //generate the resulting images path + filename\n if (!$this->thumbnailName)\n {\n throw new Exception(__CLASS__ . ' : at least'\n . ' `thumbnailName` is' . ' required.');\n }\n \n $thumbName = $this->thumbnailName;\n \n if (!$coords) //no coords passed, generate x0,y0,w,h\n {\n $coords = $this->generateCropCoords($this->thumbnailWidth, \n $this->thumbnailHeight);\n }\n\n if ( round( $coords['w']/$coords['h'], 1) !=\n round($this->thumbnailAspect, 1))\n {\n $coords = $this->refitCropCoords ($coords, \n $this->thumbnailAspect);\n }\n\n //scale the coord props to the real images props\n if ($rescale)\n {\n $coords = $this->rescaleCoordsToImage( $coords, \n Image::UPDATE_WIDTH);\n }\n\n if (!$this->coordsValid($coords))\n {\n $coords = $this->generateCropCoords($this->thumbnailWidth,\n $this->thumbnailHeight);\n }\n\n //create the result image's context\n $thumbnailInstance = imagecreatetruecolor(\n $this->thumbnailWidth, $this->thumbnailHeight);\n\n\n //Transparency\n if ($this->imageFileType == 'png' \n || $this->imageFileType == 'gif')\n {\n imagealphablending($thumbnailInstance, false);\n imagesavealpha($thumbnailInstance,true);\n $transparent = imagecolorallocatealpha($thumbnailInstance,\n 255, 255, 255, 127);\n imagefilledrectangle($thumbnailInstance, 0, 0,\n $this->thumbnailWidth, $this->thumbnailHeight,\n $transparent);\n }\n\n if (!imagecopyresampled(\n $thumbnailInstance, $this->imageInstance, //dst, src\n 0, 0, //dst,\n $coords['x'], $coords['y'],//src,\n $this->thumbnailWidth, $this->thumbnailHeight, //dst,\n $coords['w'], $coords['h']//src,\n ))\n {\n return false;\n }\n\n // save png or jpeg pictures only\n if ($this->imageFileType == 'jpg' || $this->imageFileType == 'jpeg') \n {\n imagejpeg($thumbnailInstance, $thumbName, $this->jpeg_quality);\n }\n elseif ($this->imageFileType == 'png') \n {\n imagepng($thumbnailInstance, $thumbName, $this->png_quality);\n }\n elseif ($this->imageFileType == 'gif') \n {\n imagegif($thumbnailInstance, $thumbName);\n }\n\n return $thumbName;\n }", "function build_cropCanvas($cropConf=array())\r\n {\r\n $conf['imgSrc'] = (isset($cropConf['imgSrc'])) ? $cropConf['imgSrc'] : false;\r\n $conf['uniqueID'] = (isset($cropConf['uniqueID'])) ? $cropConf['uniqueID'] : false;\r\n $conf['cropSize'] = (isset($cropConf['cropSize'])) ? $cropConf['cropSize'] : false;\r\n $conf['imgUrl'] = (isset($cropConf['imgUrl'])) ? $cropConf['imgUrl'] : false;\r\n $conf['submitUrl'] = (isset($cropConf['submitUrl'])) ? $cropConf['submitUrl'] : false;\r\n $conf['include_freeResize'] = (isset($cropConf['include_freeResize'])) ? $cropConf['include_freeResize'] : false;\r\n $conf['ajaxSubmit'] = (isset($cropConf['ajaxSubmit'])) ? $cropConf['ajaxSubmit'] : false;\r\n \r\n foreach($conf as $key=>$c)\r\n if($c==false && $key!='ajaxSubmit') return 'Insufficient Parameter options';\r\n \r\n #echo $conf['imgSrc'];\r\n $size = getimagesize($conf['imgSrc']);\r\n $img_name = explode(\"/\", $conf['imgSrc']);\r\n $img_name = end($img_name);\r\n \r\n //img size option\r\n $option = $img_dest = $savePath = '';\r\n foreach($conf['cropSize']['size'] as $key=>$i)\r\n {\r\n #$option .= '<option value=\"'.$i.'\">'.$i.'</option>';\r\n $img_dest .= 'img_dest[\"'.$i.'\"] = \"'.$conf['cropSize']['path'][$key].'\"; '; \r\n if(!$savePath) $savePath = $conf['cropSize']['path'][$key] . (($conf['uniqueID']) ? $conf['uniqueID'].'/' : '');\r\n }\r\n #$option .= '<option value=\"200x100\">200x100</option>';\r\n if($conf['include_freeResize']) $option .= '<option value=\"free\">Free Size</option>';\r\n //end \r\n #echo '<pre>'; print_r($img_dest); echo '</pre>';\r\n \r\n $content = '\r\n <div style=\"min-width:700px; padding:10px 0 10px 30px;\">\r\n <form id=\"frCrop\" action=\"'.$conf['submitUrl'].'\" method=\"POST\">\r\n <div class=\"row-fluid\">\r\n <div class=\"span4\">\r\n <h3>Cropping Setting</h3> \r\n <label>Cropped Image size : </label>\r\n <select name=\"cSize\" id=\"cSize\">'.$option.'</select>\r\n <input type=\"hidden\" name=\"img_newName\" value=\"'.$img_name.'\" />\r\n <input type=\"hidden\" name=\"uniqueID\" value=\"'.$conf['uniqueID'].'\" />\r\n \r\n <input type=\"hidden\" id=\"x\" name=\"x\" />\r\n \t\t<input type=\"hidden\" id=\"y\" name=\"y\" />\r\n \t\t<input type=\"hidden\" id=\"w\" name=\"w\" />\r\n \t\t<input type=\"hidden\" id=\"h\" name=\"h\" />\r\n <input type=\"hidden\" id=\"img_real\" name=\"img_real\" value=\"'.$conf['imgUrl'].'\" />\r\n <label>Cropped Image destination : </label> \r\n <input type=\"hidden\" name=\"dest_path\" id=\"dest_path\" value=\"'.$savePath.'\" />\r\n \r\n <div class=\"alert\">select image size then drag mouse inside image area to crop !</div>\r\n <input type=\"button\" value=\"Crop\" name\"crop\" id\"Savecrop\" class=\"btn btn-primary\" onclick=\"act_cropSave()\" />\r\n <span id=\"sp-loadCrop\" class=\"hide\"><img src=\"/media/img/loading.gif\" alt=\"loading\" /> loading..</span>\r\n </div>\r\n <div style=\"float:left; width:600px; margin-left:20px;\">\r\n <img src=\"'.$conf['imgUrl'].'\" id=\"cropbox\" width=\"600\" />\r\n </div>\r\n </div>\r\n </form>\r\n <br class=\"clear\" />\r\n </div>\r\n <script>\r\n function initCrop(){ \r\n var img_dest = new Array(); \r\n '.$img_dest.'\r\n var snil = $(\"#cSize\").val();\r\n nil = snil.split(\"x\");\r\n \r\n var jcrop_api = $.Jcrop(\\'#cropbox\\', { \r\n trueSize: ['.$size[0].','.$size[1].'],\r\n aspectRatio: nil[0] / nil[1],\r\n onSelect: updateCoords\r\n });\r\n \r\n $(\"#cSize\").bind(\"change\", function(){\r\n var snil = $(this).val();\r\n nil = snil.split(\"x\");\r\n alert(nil);\r\n jcrop_api.setOptions({\r\n aspectRatio: nil[0] / nil[1]\r\n });\r\n $(\"#dest_path\").val( img_dest[snil] );\r\n });\r\n \r\n ' . (($conf['ajaxSubmit']) ? ('\r\n $(\"#frCrop\").ajaxForm({\r\n dataType: \"json\", \r\n beforeSubmit: function(){\r\n $(\"#sp-loadCrop\").show();\r\n }, \r\n success: function(data){\r\n //alert(data);\r\n $(\".alert\").replaceWith(data.msg);\r\n $(\"#sp-loadCrop\").hide();\r\n } \r\n });\r\n ') : '') . '\r\n \r\n function updateCoords(c)\r\n \t\t\t{\r\n \t\t\t\t$(\"#x\").val(c.x);\r\n \t\t\t\t$(\"#y\").val(c.y);\r\n \t\t\t\t$(\"#w\").val(c.w);\r\n \t\t\t\t$(\"#h\").val(c.h);\r\n \t\t\t};\r\n \r\n \t\t\tfunction checkCoords()\r\n \t\t\t{\r\n \t\t\t\tif (parseInt($(\"#w\").val())) return true;\r\n \t\t\t\talert(\"Please select a crop region then press submit.\");\r\n \t\t\t\treturn false;\r\n \t\t\t};\r\n }\r\n </script>\r\n ';\r\n \r\n return $content;\r\n }", "protected function imageResizeCrop($source, $destination, $resize = [], $crop = [])\n {\n $params = [];\n // Clean the canvas.\n $params[] = '+repage';\n $params[] = '-flatten';\n if ($resize) {\n $params[] = '-thumbnail ' . escapeshellarg(sprintf('%sx%s!', $resize['width'], $resize['height']));\n }\n if ($crop) {\n $params[] = '-crop ' . escapeshellarg(sprintf('%dx%d+%d+%d', $crop['width'], $crop['height'], $crop['x'], $crop['y']));\n }\n $params[] = '-quality ' . $this->tileQuality;\n\n $result = $this->convert($source, $destination, $params);\n return $result;\n }", "public function crop($source = array(), $new_name, $config = array())\n\t{\n\t\t$source_width = $source['image_width'];\n\t\t$source_height = $source['image_height'];\n\t\t$width = $config['width'];\n\t\t$height = $config['height'];\n\n\t\t$mark = '';\n\t\tif(array_key_exists('mark', $config))\n\t\t\t$mark = $config['mark'];\n\n\t\t$create_new = FALSE;\n\t\tif(array_key_exists('create_new', $config))\n\t\t\t$create_new = $config['create_new'];\n\n\t\tif($create_new && $mark == '')\n\t\t\t$mark = 'cropped-';\n\n\t\t$orientation = 'box';\n\t\tif($height > $width)\n\t\t{\n\t\t\t$orientation = 'portrait';\n\t\t}\n\t\telseif($height < $width)\n\t\t{\n\t\t\t$orientation = 'landscape';\n\t\t}\n\t\t\n\t\t$source_orientation = 'box';\n\t\tif($source_height > $source_width)\n\t\t{\n\t\t\t$source_orientation = 'portrait';\n\t\t}\n\t\telseif($source_height < $source_width)\n\t\t{\n\t\t\t$source_orientation = 'landscape';\n\t\t}\n\t\t\n\t\t$size = $this->_calculate_size(array(\n\t\t\t'orientation' => $source_orientation, 'width' => $source_width, 'height' => $source_height\n\t\t), array(\n\t\t\t'orientation' => $orientation, 'width' => $width, 'height' => $height\n\t\t));\n\t\t\n\t\t$thumb['image_library'] = 'gd2';\n\t\t$thumb['source_image'] = $source['full_path'];\n\t\t$thumb['width'] = $size['width'];\n\t\t$thumb['height'] = $size['height'];\n\t\t$thumb['maintain_ratio'] = TRUE;\n\t\t$thumb['quality'] = 100;\n\t\tif($create_new)\n\t\t{\n\t\t\t$thumb['new_image'] = './' . $this->upload_dir . $mark . $new_name;\n\t\t}\n\t\t$this->CI->image_lib->initialize($thumb);\n\t\tif($this->CI->image_lib->resize())\n\t\t{\n\t\t\t$this->CI->image_lib->clear();\n\t\t\tif($create_new)\n\t\t\t{\n\t\t\t\t$thumb['source_image'] = $source['file_path'] . $mark . $new_name;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$thumb['source_image'] = $source['file_path'] . $new_name;\n\t\t\t}\n\t\t\t$thumb['width'] = $width;\n\t\t\t$thumb['height'] = $height;\n\t\t\t$thumb['maintain_ratio'] = FALSE;\n\t\t\t$thumb['quality'] = 100;\n\t\t\t$thumb['new_image'] = '';\n\t\t\tif($create_new)\n\t\t\t{\n\t\t\t\tlist($thumb_width, $thumb_height) = getimagesize($source['file_path'] . $mark . $new_name);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tlist($thumb_width, $thumb_height) = getimagesize($source['file_path'] . $new_name);\n\t\t\t}\n\t\t\tif($thumb_height == $height)\n\t\t\t{\n\t\t\t\t$thumb['x_axis'] = ($thumb_width - $width) / 2;\n\t\t\t\t$thumb['y_axis'] = 0;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$thumb['y_axis'] = ($thumb_height - $height) / 2;\n\t\t\t\t$thumb['x_axis'] = 0;\n\t\t\t}\n\t\t\t$this->CI->image_lib->initialize($thumb);\n\t\t\tif($this->CI->image_lib->crop())\n\t\t\t{\n\t\t\t\treturn array(\n\t\t\t\t\t'status' => TRUE\n\t\t\t\t);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\texit($this->image_lib->display_errors());\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\texit($this->image_lib->display_errors());\n\t\t}\n\t}", "function resize_crop_image($max_width, $max_height, $source_file, $dst_dir, $quality=80){\r\n $imgsize = getimagesize($source_file);\r\n $width = $imgsize[0];\r\n $height = $imgsize[1];\r\n $mime = $imgsize['mime'];\r\n\r\n switch($mime){\r\n case 'image/gif':\r\n $image_create = \"imagecreatefromgif\";\r\n $image = \"imagegif\";\r\n break;\r\n\r\n case 'image/png':\r\n $image_create = \"imagecreatefrompng\";\r\n $image = \"imagepng\";\r\n //$quality = 7;\r\n break;\r\n\r\n case 'image/jpeg':\r\n $image_create = \"imagecreatefromjpeg\";\r\n $image = \"imagejpeg\";\r\n break;\r\n\r\n default:\r\n return false;\r\n break;\r\n }\r\n\r\n $dst_img = imagecreatetruecolor($max_width, $max_height);\r\n $src_img = $image_create($source_file);\r\n\r\n $width_new = $height * $max_width / $max_height;\r\n $height_new = $width * $max_height / $max_width;\r\n //if the new width is greater than the actual width of the image, then the height is too large and the rest cut off, or vice versa\r\n if($width_new > $width){\r\n //cut point by height\r\n $h_point = (($height - $height_new) / 2);\r\n //copy image\r\n imagecopyresampled($dst_img, $src_img, 0, 0, 0, $h_point, $max_width, $max_height, $width, $height_new);\r\n }else{\r\n //cut point by width\r\n $w_point = (($width - $width_new) / 2);\r\n imagecopyresampled($dst_img, $src_img, 0, 0, $w_point, 0, $max_width, $max_height, $width_new, $height);\r\n }\r\n\r\n //$image($dst_img, $dst_dir, $quality);\r\n imagejpeg($dst_img, $dst_dir, $quality);\r\n\r\n if($dst_img)imagedestroy($dst_img);\r\n if($src_img)imagedestroy($src_img);\r\n}", "function imagecropper($source_path, $max_width, $max_height, $bili) {\n $source_info = getimagesize($source_path); //获取原始图片信息\n $source_width = $source_info[0]; //获取原始图片的宽度\n $source_height = $source_info[1]; //获取原始图片的高度\n $source_mime = $source_info['mime']; //获取原始图片的文件类型\n\n //先计算出要裁剪后的图片尺寸是多大\n if($source_width<=$max_width) { //1、如果原始图片的宽,小于最大允许的宽\n $newwidth = $source_width;\n $newheight = $source_width*$bili;\n }elseif($source_height<=$max_height) {//2、如果原始图片的高,小于最大允许的高\n $newheight = $source_height;\n $newwidth = $newheight/$bili;\n }else {\n $b1 = $max_width/$source_width;\n $b2 = $max_height/$source_height;\n $b3 = $b1<$b2 ? $b1 : $b2;\n $newwidth = ceil($source_width*$b3);\n $newheight = ceil($source_height*$b3);\n }\n\n $target_width = $newwidth>$newheight ? $newwidth : $newheight;\n $target_height = $newwidth<$newheight ? $newwidth : $newheight;\n\n if($target_width*$bili>$target_height) {\n $target_width = $target_height/$bili;\n }\n if($target_height*$bili>$target_width) {\n $target_height = $target_width/$bili;\n }\n\n $source_ratio = $source_height / $source_width;\n $target_ratio = $target_height / $target_width;\n\n if ($source_ratio > $target_ratio) {\n $cropped_width = $source_width;\n $cropped_height = $source_width * $target_ratio;\n $source_x = 0;\n $source_y = ($source_height - $cropped_height) / 2;\n }elseif ($source_ratio < $target_ratio) {\n $cropped_width = $source_height / $target_ratio;\n $cropped_height = $source_height;\n $source_x = ($source_width - $cropped_width) / 2;\n $source_y = 0;\n }else {\n $cropped_width = $source_width;\n $cropped_height = $source_height;\n $source_x = 0;\n $source_y = 0;\n }\n\n switch ($source_mime) {\n case 'image/gif':\n $source_image = imagecreatefromgif($source_path);\n break;\n case 'image/jpeg':\n $source_image = imagecreatefromjpeg($source_path);\n break;\n case 'image/png':\n $source_image = imagecreatefrompng($source_path);\n break;\n default:\n return false;\n break;\n }\n\n $target_image = imagecreatetruecolor($target_width, $target_height);\n $cropped_image = imagecreatetruecolor($cropped_width, $cropped_height);\n\n // 裁剪\n imagecopy($cropped_image, $source_image, 0, 0, $source_x, $source_y, $cropped_width, $cropped_height);\n // 缩放\n imagecopyresampled($target_image, $cropped_image, 0, 0, 0, 0, $target_width, $target_height, $cropped_width, $cropped_height);\n\n imagejpeg($target_image,$source_path);\n imagedestroy($source_image);\n imagedestroy($target_image);\n imagedestroy($cropped_image);\n}", "public function get_center_crop_offset( $size ) {\n\t\t\t// Return the whole image.\n\t\t\t$offset = 0;\n\t\t\t$width = $size['width'];\n\t\t\t$height = $size['height'];\n\t\t\tif ( 100 !== $height && preg_match( '/^(\\d+)px$/i', $height, $matches ) ) {\n\t\t\t\t$height = $matches[1];\n\t\t\t\tif ( ! empty( $this->args['attachment_id'] ) ) {\n\t\t\t\t\t$attachment_meta = wp_get_attachment_metadata( $this->args['attachment_id'], true );\n\t\t\t\t\tif ( ! empty( $attachment_meta['height'] ) && ! empty( $attachment_meta['width'] ) ) {\n\t\t\t\t\t\t$new_size = wp_constrain_dimensions( $attachment_meta['width'], $attachment_meta['height'], $width, 9999 );\n\t\t\t\t\t\tif ( $new_size[1] > $height ) {\n\t\t\t\t\t\t\t$offset = floor( ( $new_size[1] - $height ) / 2.00 );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn $offset;\n\t\t}", "function custom_image_resize_dimensions($payload, $orig_w, $orig_h, $dest_w, $dest_h, $crop)\n {\n // want to override the defaults for this image or not.\n if (false)\n return $payload;\n\n if ($crop) {\n // crop the largest possible portion of the original image that we can size to $dest_w x $dest_h\n $aspect_ratio = $orig_w / $orig_h;\n $new_w = min($dest_w, $orig_w);\n $new_h = min($dest_h, $orig_h);\n\n if (!$new_w) {\n $new_w = intval($new_h * $aspect_ratio);\n }\n\n if (!$new_h) {\n $new_h = intval($new_w / $aspect_ratio);\n }\n\n $size_ratio = max($new_w / $orig_w, $new_h / $orig_h);\n\n $crop_w = round($new_w / $size_ratio);\n $crop_h = round($new_h / $size_ratio);\n\n $s_x = floor(($orig_w - $crop_w) / 2);\n $s_y = 0; // [[ formerly ]] ==> floor( ($orig_h - $crop_h) / 2 );\n } else {\n // don't crop, just resize using $dest_w x $dest_h as a maximum bounding box\n $crop_w = $orig_w;\n $crop_h = $orig_h;\n\n $s_x = 0;\n $s_y = 0;\n\n list($new_w, $new_h) = wp_constrain_dimensions($orig_w, $orig_h, $dest_w, $dest_h);\n }\n\n // if the resulting image would be the same size or larger we don't want to resize it\n if ($new_w >= $orig_w && $new_h >= $orig_h)\n return false;\n\n // the return array matches the parameters to imagecopyresampled()\n // int dst_x, int dst_y, int src_x, int src_y, int dst_w, int dst_h, int src_w, int src_h\n return array(0, 0, (int)$s_x, (int)$s_y, (int)$new_w, (int)$new_h, (int)$crop_w, (int)$crop_h);\n\n }", "function admin_cropImage()\r\n {\r\n // setting the layout for admin\r\n $this->layout = 'admin';\r\n \r\n // Setting the page title\r\n $this->set(\"title_for_layout\",\"Image Crop\");\r\n \r\n }", "function cropimage($source_url, $new_width=250, $quality=75){\n return false;\n \n if (!file_exists($source_url)){\n echo alertbuilder(\"File does not exist: $source_url\",'warning');\n return false;\n }\n \n //separate the file name and the extention\n $source_url_parts = pathinfo($source_url);\n $filename = $source_url_parts['filename'];\n $extension = strtolower($source_url_parts['extension']);\n \n //detect the width and the height of original image\n $info = getimagesize($source_url);\n \n if($info === false){\n echo alertbuilder('This file is not a valid image', 'warning');\n return false;\n }\n \n $type = $info[2];\n $width = $info[0];\n $height = $info[1];\n \n // resize only when the original image is larger than new width.\n // this helps you to avoid from unwanted resizing.\n if ($width > $new_width) {\n // cool to resize\n } else {\n echo alertbuilder('The image is already smaller than width', 'warning');\n return false;\n }\n \n //get the reduced width\n $reduced_width = ($width - $new_width);\n \n //now convert the reduced width to a percentage, round to 2 decimals\n $reduced_radio = round(($reduced_width / $width) * 100, 2);\n \n // reduce the same percentage from the height, round to 2 decimals\n $reduced_height = round(($height / 100) * $reduced_radio, 2);\n \n //reduce the calculated height from the original height\n $new_height = $height - $reduced_height;\n \n $img = null;\n $imgResized = null;\n \n switch($type) {\n case IMAGETYPE_JPEG:\n $img = imagecreatefromjpeg($source_url);\n $imgResized = imagescale($img, $new_width, $new_height, $quality);\n imagejpeg($imgResized, $source_url); \n break;\n \n case IMAGETYPE_GIF:\n $img = imagecreatefromgif($source_url);\n $imgResized = imagescale($img, $new_width, $new_height, $quality);\n imagegif($imgResized, $source_url); \n break;\n \n case IMAGETYPE_PNG:\n $img = imagecreatefrompng($source_url);\n $imgResized = imagescale($img, $new_width, $new_height, $quality);\n imagepng($imgResized, $source_url); \n break;\n \n default:\n echo alertbuilder('This file is not in JPG, GIF, or PNG format!');\n return false;\n }\n\n //Finally frees any memory associated with image\n imagedestroy($img);\n imagedestroy($imgResized);\n \n return true;\n}", "function image_resize_dimensions($orig_w, $orig_h, $dest_w, $dest_h, $crop = \\false)\n {\n }", "protected function crop_image($source_url='', $crop_width = 225, $crop_height = 225, $destination_url = '')\n {\n ini_set('memory_limit', '-1');\n $image = Image::make($source_url);\n $image_width = $image->width();\n $image_height = $image->height();\n\n if($image_width < $crop_width && $crop_width < $crop_height){\n $image = $image->fit($crop_width, $image_height);\n }if($image_height < $crop_height && $crop_width > $crop_height){\n $image = $image->fit($crop_width, $crop_height);\n }\n\n \t\t$primary_cropped_image = $image;\n\n $croped_image = $primary_cropped_image->fit($crop_width, $crop_height);\n\n\t\tif($destination_url == ''){\n\t\t\t$source_url_details = pathinfo($source_url); \n\t\t\t$destination_url = @$source_url_details['dirname'].'/'.@$source_url_details['filename'].'_'.$crop_width.'x'.$crop_height.'.'.@$source_url_details['extension']; \n\t\t}\n\n\t\t$croped_image->save($destination_url); \n\t\treturn $destination_url; \n }", "function cropImage($nw, $nh, $source,$newfileName,$case='top') {\n\t\t$thumb_croped = false;\n\t\t\n\t\t$size = getimagesize($this->path.$source);\n\t\t$w = $size[0];\n\t\t$h = $size[1];\n\t\t\n\t\t$extension = strtolower($this->getExtension($source,false)); // false - tells to get \"jpg\" NOT \".jpg\" GOT IT :P\n\t\t\n\t\tswitch($extension) {\n\t\t\tcase 'gif':\n\t\t\t$simg = imagecreatefromgif($this->path.$source);\n\t\t\tbreak;\n\t\t\tcase 'jpg':\n\t\t\t$simg = imagecreatefromjpeg($this->path.$source);\n\t\t\tbreak;\n\t\t\tcase 'png':\n\t\t\t$simg = imagecreatefrompng($this->path.$source);\n\t\t\tbreak;\n\t\t}\n\t\t\n\n\t\t$dimg = imagecreatetruecolor($nw, $nh);\n\t\t$wm = $w/$nw;\n\t\t$hm = $h/$nh;\n\t\t$h_height = $nh/2;\n\t\t$w_height = $nw/2;\n\t\tif($w> $h) {\n\t\t\t$adjusted_width = $w / $hm;\n\t\t\t$half_width = $adjusted_width / 2;\n\t\t\t$int_width = $half_width - $w_height;\n\t\t\timagecopyresampled($dimg,$simg,-$int_width,0,0,0,$adjusted_width,$nh,$w,$h);\n\t\t} elseif(($w <$h) || ($w == $h)) {\n\t\t\t$adjusted_height = $h / $wm;\n\t\t\t$half_height = $adjusted_height / 2;\n\t\t\t$int_height = $half_height - $h_height;\n\t\t\timagecopyresampled($dimg,$simg,0,-$int_height,0,0,$nw,$adjusted_height,$w,$h);\n\t\t} else {\n\t\t\timagecopyresampled($dimg,$simg,0,0,0,0,$nw,$nh,$w,$h);\n\t\t}\n\t\t\n\t\tif($extension==\"jpg\" ){\n\t\t\timagejpeg($dimg,$this->path.$newfileName,100);\n\t\t\t$thumb_croped = true;\n\t\t}elseif($extension==\"gif\" ){\n\t\t\timagegif($dimg,$this->path.$newfileName,100);\n\t\t\t$thumb_croped = true;\n\t\t}elseif($extension==\"png\" ){\n\t\t\timagepng($dimg,$this->path.$newfileName,100);\n\t\t\t$thumb_croped = true;\n\t\t}\n\t\t\n\t\treturn $thumb_croped;\n\t\t\n\t\t//imagejpeg($dimg,$dest,100);\n\t}", "public function actionSaveCroppedImage() {\n\n if ($_REQUEST['output_filename'] == '') {\n $output_filename = \"media/croppic/croppedimg/croppedImg_\" . time();\n } else {\n $output_filename = $_REQUEST['output_filename'] . time();\n }\n $output_filename2 = Yii::app()->request->baseUrl . '/' . $output_filename;\n\n $imgUrl = Yii::app()->basePath.'/..'.str_replace(Yii::app()->request->baseUrl,'',$_POST['imgUrl']);\n $imgInitW = $_POST['imgInitW'];\n $imgInitH = $_POST['imgInitH'];\n $imgW = $_POST['imgW'];\n $imgH = $_POST['imgH'];\n $imgY1 = $_POST['imgY1'];\n $imgX1 = $_POST['imgX1'];\n $cropW = $_POST['cropW'];\n $cropH = $_POST['cropH'];\n\n $jpeg_quality = 100;\n\n $what = getimagesize($imgUrl);\n \n switch (strtolower($what['mime'])) {\n case 'image/png':\n $img_r = imagecreatefrompng($imgUrl);\n $source_image = imagecreatefrompng($imgUrl);\n $type = '.png';\n break;\n case 'image/jpeg':\n $img_r = imagecreatefromjpeg($imgUrl);\n $source_image = imagecreatefromjpeg($imgUrl);\n $type = '.jpeg';\n break;\n case 'image/gif':\n $img_r = imagecreatefromgif($imgUrl);\n $source_image = imagecreatefromgif($imgUrl);\n $type = '.gif';\n break;\n default: die('image type not supported');\n }\n\n $resizedImage = imagecreatetruecolor($imgW, $imgH);\n imagecopyresampled($resizedImage, $source_image, 0, 0, 0, 0, $imgW, $imgH, $imgInitW, $imgInitH);\n\n\n $dest_image = imagecreatetruecolor($cropW, $cropH);\n imagecopyresampled($dest_image, $resizedImage, 0, 0, $imgX1, $imgY1, $cropW, $cropH, $cropW, $cropH);\n\n\n imagejpeg($dest_image, $output_filename . $type, $jpeg_quality);\n\n $response = array(\n \"status\" => 'success',\n \"url\" => $output_filename2 . $type\n );\n print json_encode($response);\n }", "abstract public function calculateCropBoxCoordinates();", "public function resize_crop($newWidth, $newHeight)\n\t{\n\t\t$this->intern_resize_crop($newWidth, $newHeight);\n\t}", "protected function _image_resize($src, $dst, $width, $height, $crop=0) {\n\n\t\tif( ! list($w, $h) = getimagesize($src)) {\n\t\t\treturn \"Unsupported picture type!\";\n\t\t}\n\n\t\t$type = strtolower(pathinfo($src, PATHINFO_EXTENSION));\n\t\t\n\t\tif($type == 'jpeg') {\n\t\t\t$type = 'jpg';\n\t\t}\n\t\tswitch($type){\n\t\t\tcase 'bmp': $img = imagecreatefromwbmp($src); break;\n\t\t\tcase 'gif': $img = imagecreatefromgif($src); break;\n\t\t\tcase 'jpg': $img = imagecreatefromjpeg($src); break;\n\t\t\tcase 'png': $img = imagecreatefrompng($src); break;\n\t\t\tdefault : \n\t\t\t\treturn \"Unsupported picture type!\";\n\t\t}\n\n\t\t// resize\n\t\tif($crop){\n\t\t\tif($w < $width or $h < $height) {\n\t\t\t\treturn \"Picture is too small!\";\n\t\t\t}\n\t\t $ratio = max($width/$w, $height/$h);\n\t\t $h = $height / $ratio;\n\t\t $x = ($w - $width / $ratio) / 2;\n\t\t $w = $width / $ratio;\n\t\t }\n\t\t else{\n\t\t if($w < $width and $h < $height) {\n\t\t\t\treturn \"Picture is too small!\";\n\t\t\t}\n\t\t\t\n\t\t\tif( $h > $w ) {\n\t\t\t\t$width = ($height * $w) / $h;\n\t\t\t} else {\n\t\t\t\t$ratio = min($width/$w, $height/$h);\n\t\t\t\t$width = $w * $ratio;\n\t\t\t\t$height = $h * $ratio;\n\t\t\t}\n\t\t\t\n\t\t\t$x = 0;\n\t\t}\n \t\n\t\t$new = imagecreatetruecolor($width, $height);\n \t\n\t\t// preserve transparency\n\t\tif($type == \"gif\" or $type == \"png\") {\n\t\t\timagecolortransparent($new, imagecolorallocatealpha($new, 0, 0, 0, 127));\n\t\t\timagealphablending($new, false);\n\t\t\timagesavealpha($new, true);\n\t\t}\n \t\n\t\timagecopyresampled($new, $img, 0, 0, $x, 0, $width, $height, $w, $h);\n \t\n\t\tswitch($type){\n\t\t\tcase 'bmp': imagewbmp($new, $dst); break;\n\t\t\tcase 'gif': imagegif($new, $dst); break;\n\t\t\tcase 'jpg': imagejpeg($new, $dst, 92); break;\n\t\t\tcase 'png': imagepng($new, $dst, 2); break;\n\t\t}\n\t\treturn true;\n\t}", "private function cropImageSaveNew( $filepath, $filepathNew ) {\n\n\t\t$imgInfo = getimagesize( $filepath );\n\t\t$imgType = $imgInfo[2];\n\n\t\t$src_img = $this->getGdSrcImage( $filepath,$imgType );\n\n\t\t$width = imageSX( $src_img );\n\t\t$height = imageSY( $src_img );\n\n\t\t// crop the image from the top\n\t\t$startx = 0;\n\t\t$starty = 0;\n\n\t\t// find precrop width and height:\n\t\t$percent = $this->maxWidth / $width;\n\t\t$newWidth = $this->maxWidth;\n\t\t$newHeight = ceil( $percent * $height );\n\n\t\tif ( $this->type == 'exact' ) { \t// crop the image from the middle\n\t\t\t$startx = 0;\n\t\t\t$starty = ($newHeight -$this->maxHeight) / 2 / $percent;\n\t\t}\n\n\t\tif ( $newHeight < $this->maxHeight ) {\t// by width\n\t\t\t$percent = $this->maxHeight / $height;\n\t\t\t$newHeight = $this->maxHeight;\n\t\t\t$newWidth = ceil( $percent * $width );\n\n\t\t\tif ( $this->type == 'exact' ) { \t// crop the image from the middle\n\t\t\t\t$startx = ($newWidth - $this->maxWidth) / 2 / $percent;\t// the startx is related to big image\n\t\t\t\t$starty = 0;\n\t\t\t}\n\t\t}\n\n\t\t// resize the picture:\n\t\t$tmp_img = ImageCreateTrueColor( $newWidth,$newHeight );\n\n\t\t$this->handleTransparency( $tmp_img,$imgType,$newWidth,$newHeight );\n\n\t\timagecopyresampled( $tmp_img,$src_img,0,0,$startx,$starty,$newWidth,$newHeight,$width,$height );\n\n\t\t$this->handleImageEffects( $tmp_img );\n\n\t\t// crop the picture:\n\t\t$dst_img = ImageCreateTrueColor( $this->maxWidth,$this->maxHeight );\n\n\t\t$this->handleTransparency( $dst_img,$imgType,$this->maxWidth,$this->maxHeight );\n\n\t\timagecopy( $dst_img, $tmp_img, 0, 0, 0, 0, $newWidth, $newHeight );\n\n\t\t// save the picture\n\t\t$is_saved = $this->saveGdImage( $dst_img,$filepathNew,$imgType );\n\n\t\timagedestroy( $dst_img );\n\t\timagedestroy( $src_img );\n\t\timagedestroy( $tmp_img );\n\n\t\treturn($is_saved);\n\t}", "function _crop(){\n echo_array($_POST);\n\n if (!empty($_POST['x'])) { $x=$_POST['x'];}else{$x=100;}\n if (!empty($_POST['y'])) { $y=$_POST['y'];}else{$y=100;}\n if (!empty($_POST['w'])) { $w=$_POST['w'];}else{$w=100;}\n if (!empty($_POST['h'])) { $h=$_POST['h'];}else{$h=100;}\n $data['raw_name']=$_POST['raw_name'];\n $data['file_ext']=$_POST['file_ext'];\n $targ_w =$w; $targ_h = $h;\n $jpeg_quality = 90;\n $src = './uploads/'.trim($_POST['image']);\n $img_r = imagecreatefromjpeg($src);\n $dst_r = ImageCreateTrueColor( $targ_w, $targ_h );\n imagecopyresampled($dst_r,$img_r,0,0,$x,$y,\n $targ_w,$targ_h,$w,$h);\n $dst=imagefilter($dst_r, IMG_FILTER_GRAYSCALE);\n imagefilter($dst_r,IMG_FILTER_COLORIZE,80,60,40); //sepia\n imagejpeg($dst_r, './uploads/'.'crop_'.trim($_POST['image']), 80);\n //echo_array($data);\n $this->load->library('tcontrol');\n $this->load->library('tpanel');\n $class=\"tpanel\";\n $s=$this->tpanel->get('date',$data);\n $s.=$this->tpanel->get('navigation_menu',$data);\n $s.=$this->tpanel->get('ajax_menu',$data);\n $s.=$this->tpanel->get('spacer',$data);\n\n $s.=$this->load->view('image_lab_view',$data,TRUE);\n $data['title']='The Tlist Class';\n $data['content']=$s;\n $data['panel']='';\n\n $this->template($data) ;\n //$this->load->view('image_crop_view', $data);\n\n ;}", "public function run() {\n\n // make enough memory available to scale bigger images\n ini_set('memory_limit', $this->thumb->options['memory']);\n \n // create the gd lib image object\n switch($this->thumb->image->mime()) {\n case 'image/jpeg':\n $image = @imagecreatefromjpeg($this->thumb->image->root()); \n break;\n case 'image/png':\n $image = @imagecreatefrompng($this->thumb->image->root()); \n break;\n case 'image/gif':\n $image = @imagecreatefromgif($this->thumb->image->root()); \n break;\n default:\n raise('The image mime type is invalid');\n break;\n } \n\n // check for a valid created image object\n if(!$image) raise('The image could not be created');\n\n // cropping stuff needs a couple more steps \n if($this->thumb->options['crop'] == true) {\n\n // Starting point of crop\n $startX = floor($this->thumb->tmp->width() / 2) - floor($this->thumb->result->width() / 2);\n $startY = floor($this->thumb->tmp->height() / 2) - floor($this->thumb->result->height() / 2);\n \n // Adjust crop size if the image is too small\n if($startX < 0) $startX = 0;\n if($startY < 0) $startY = 0;\n \n // create a temporary resized version of the image first\n $thumb = imagecreatetruecolor($this->thumb->tmp->width(), $this->thumb->tmp->height()); \n $thumb = $this->keepColor($thumb);\n imagecopyresampled($thumb, $image, 0, 0, 0, 0, $this->thumb->tmp->width(), $this->thumb->tmp->height(), $this->thumb->source->width(), $this->thumb->source->height()); \n \n // crop that image afterwards \n $cropped = imagecreatetruecolor($this->thumb->result->width(), $this->thumb->result->height()); \n $cropped = $this->keepColor($cropped);\n imagecopyresampled($cropped, $thumb, 0, 0, $startX, $startY, $this->thumb->tmp->width(), $this->thumb->tmp->height(), $this->thumb->tmp->width(), $this->thumb->tmp->height()); \n imagedestroy($thumb);\n \n // reasign the variable\n $thumb = $cropped;\n\n } else {\n $thumb = imagecreatetruecolor($this->thumb->result->width(), $this->thumb->result->height()); \n $thumb = $this->keepColor($thumb);\n imagecopyresampled($thumb, $image, 0, 0, 0, 0, $this->thumb->result->width(), $this->thumb->result->height(), $this->thumb->source->width(), $this->thumb->source->height()); \n } \n \n // convert the thumbnail to grayscale \n if($this->thumb->options['grayscale']) {\n imagefilter($thumb, IMG_FILTER_GRAYSCALE);\n }\n\n // convert the image to a different format\n if($this->thumb->options['to']) {\n\n switch($this->thumb->options['to']) {\n case 'jpg': \n imagejpeg($thumb, $this->thumb->root(), $this->thumb->options['quality']); \n break;\n case 'png': \n imagepng($thumb, $this->thumb->root(), 0); \n break; \n case 'gif': \n imagegif($thumb, $this->thumb->root()); \n break; \n }\n\n // keep the original file's format\n } else {\n\n switch($this->thumb->image->mime()) {\n case 'image/jpeg': \n imagejpeg($thumb, $this->thumb->root(), $this->thumb->options['quality']); \n break;\n case 'image/png': \n imagepng($thumb, $this->thumb->root(), 0); \n break; \n case 'image/gif': \n imagegif($thumb, $this->thumb->root()); \n break;\n }\n\n }\n\n imagedestroy($thumb);\n \n }", "public function crop($w, $h, $x = 0, $y = 0)\n {\n $this->width = $w;\n $this->height = $h;\n return $this->cropImage($this->width, $this->height, $x, $y);\n }", "public function cropImage($request)\n {\n $returnType = '\\SplFileObject';\n $isBinary = true;\n $hasReturnType = true;\n $request = $this->getHttpRequest($request, 'GET');\n $options = $this->createHttpClientOptions();\n \n try {\n $response = $this->client->send($request, $options);\n return $this->processResponse($request, $response, $hasReturnType, $returnType, $isBinary);\n } catch (RequestException $e) {\n $this->processException($e);\n }\n }", "public function crop($w, $h, $x = 0, $y = 0)\n {\n if(!is_numeric($x) || !is_numeric($y) || !is_numeric($w) || !is_numeric($h))\n {\n throw new Exception('One of the parameters was not numeric');\n }\n\n $imageIn = $this->getWorkingImageResource();\n $imageOut = imagecreatetruecolor($w, $h);\n\n imagecopyresampled($imageOut, $imageIn, 0, 0, $x, $y, $w, $h, $w, $h);\n\n $this->setWorkingImageResource($imageOut);\n }", "public function getCroppedImage($image, $w, $h, $x=false, $y=false) {\n\t\t$source = $image->getSource();\n\t\tif ($source->type != 'Local') {\n\t\t\t// ignore crop for remote sources at the moment\n\t\t\treturn $image->url;\n\t\t}\n\n\t\t$sourcePath = $source->settings['path'];\n\t\t$folderPath = $image->getFolder()->path;\n\n\t\t$imagePath = $sourcePath . $folderPath . $image->filename;\n\n\t\tif (!file_exists($imagePath)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tlist($imgW, $imgH) = getimagesize($imagePath);\n\n\t\tif ($w == $imgW && $h == $imgH) {\n\t\t\treturn $image->url;\n\t\t}\n\n\t\t$x = false;\n\t\t$y = false;\n\n\t\tif (isset($image->focalPoint)) {\n\t\t\tif (isset($image->focalPoint['x'])) {\n\t\t\t\t$x = $image->focalPoint['x'];\n\t\t\t}\n\t\t\tif (isset($image->focalPoint['y'])) {\n\t\t\t\t$y = $image->focalPoint['y'];\n\t\t\t}\t\t\t\n\t\t}\n\n\t\tif ($x === false) {\n\t\t\t$x = round($imgW / 2);\n\t\t}\n\t\tif ($y === false) {\n\t\t\t$y = round($imgH / 2);\n\t\t}\t\t\n\n\t\t$wOut = $w;\n\t\t$hOut = $h;\n\n\t\t$imgRatio = $imgW / $imgH;\n\t\t$cropRatio = $w / $h;\n\n\t\tif ($w > $h && $imgRatio < $cropRatio) { // crop as portrait\n\t\t\t$cropScale = $imgW / $w;\n\n\t\t\t$w *= $cropScale;\n\t\t\t$h *= $cropScale;\n\n\t\t\t$cropX = 0;\n\t\t\t$cropY = $y - $h/2;\n\n\t\t\t// focus point bounds checking\n\t\t\tif ($cropY < 0) {\n\t\t\t\t$cropY = 0;\n\t\t\t}\n\t\t\tif ($cropY + $h > $imgH) {\n\t\t\t\t$cropY = $imgH - $h;\n\t\t\t}\n\t\t}\n\t\telse { // crop as landscape\n\t\t\t$cropScale = $imgH / $h;\n\n\t\t\t$w *= $cropScale;\n\t\t\t$h *= $cropScale;\n\n\t\t\t$cropY = 0;\n\t\t\t$cropX = $x - $w/2;\n\n\t\t\t// focus point bounds checking\n\t\t\tif ($cropX < 0) {\n\t\t\t\t$cropX = 0;\n\t\t\t}\n\t\t\tif ($cropX + $w > $imgW) {\n\t\t\t\t$cropX = $imgW - $w;\n\t\t\t}\n\t\t}\n\t\treturn $this->cropImage($imagePath, $cropX, $cropY, $w, $h, $wOut, $hOut);\t\n\t}", "function logonscreener_image_scale_and_crop($image, $source_width, $source_height) {\n global $screen_width, $screen_height;\n\n // Phase 1: Scale.\n $scale = max($screen_width / $source_width, $screen_height / $source_height);\n $scaled_width = (int) round($source_width * $scale);\n $scaled_height = (int) round($source_height * $scale);\n\n if ($scale != 1) {\n logonscreener_log(\"Scale = $scale. Scaled width = $scaled_width. Scaled height = $scaled_height.\");\n\n $res2 = imagecreatetruecolor($scaled_width, $scaled_height);\n imagefill($res2, 0, 0, imagecolorallocate($res2, 255, 255, 255));\n if (!imagecopyresampled($res2, $image, 0, 0, 0, 0, $scaled_width, $scaled_height, $source_width, $source_height)) {\n logonscreener_log('Scale did not worked out. HZ.');\n return FALSE;\n }\n\n // Destroy the original image and update image object.\n imagedestroy($image);\n $image = $res2;\n }\n\n // Phase 2: Crop.\n if ($scaled_width != $screen_width || $scaled_height != $screen_height) {\n $screen_width = (int) $screen_width;\n $screen_height = (int) $screen_height;\n\n $x = ($scaled_width - $screen_width) / 2;\n $y = ($scaled_height - $screen_height) / 2;\n logonscreener_log(\"Crop source X = $x. Crop source Y = $y.\");\n\n $res = imagecreatetruecolor($screen_width, $screen_height);\n imagefill($res, 0, 0, imagecolorallocate($res, 255, 255, 255));\n if (!imagecopyresampled($res, $image, 0, 0, $x, $y, $screen_width, $screen_height, $screen_width, $screen_height)) {\n logonscreener_log('Crop did not worked out. HZ.');\n return FALSE;\n }\n\n // Destroy the original image and update image object.\n imagedestroy($image);\n $image = $res;\n }\n\n return $image;\n}", "public function crop_image_square($source, $destination, $image_type, $square_size, $image_width, $image_height, $quality){\n if($image_width <= 0 || $image_height <= 0){return false;} //return false if nothing to resize\n\n if( $image_width > $image_height )\n {\n $y_offset = 0;\n $x_offset = ($image_width - $image_height) / 2;\n $s_size \t= $image_width - ($x_offset * 2);\n }else{\n $x_offset = 0;\n $y_offset = ($image_height - $image_width) / 2;\n $s_size = $image_height - ($y_offset * 2);\n }\n $new_canvas\t= imagecreatetruecolor( $square_size, $square_size); //Create a new true color image\n\n //Copy and resize part of an image with resampling\n if(imagecopyresampled($new_canvas, $source, 0, 0, $x_offset, $y_offset, $square_size, $square_size, $s_size, $s_size)){\n $this->save_image($new_canvas, $destination, $image_type, $quality);\n }\n\n return true;\n }", "protected function resize()\n {\n $width = $this->width;\n $height = $this->height;\n $orig_width = imagesx($this->image);\n $orig_height = imagesy($this->image);\n \n // Determine new image dimensions\n if($this->mode === \"crop\"){ // Crop image\n \n $max_width = $crop_width = $width;\n $max_height = $crop_height = $height;\n \n $x_ratio = @($max_width / $orig_width);\n $y_ratio = @($max_height / $orig_height);\n \n if($orig_width > $orig_height){ // Original is wide\n $height = $max_height;\n $width = ceil($y_ratio * $orig_width);\n \n } elseif($orig_height > $orig_width){ // Original is tall\n $width = $max_width;\n $height = ceil($x_ratio * $orig_height);\n \n } else { // Original is square\n $this->mode = \"fit\";\n \n return $this->resize();\n }\n \n // Adjust if the crop width is less than the requested width to avoid black lines\n if($width < $crop_width){\n $width = $max_width;\n $height = ceil($x_ratio * $orig_height);\n }\n \n } elseif($this->mode === \"fit\"){ // Fits the image according to aspect ratio to within max height and width\n $max_width = $width;\n $max_height = $height;\n \n $x_ratio = @($max_width / $orig_width);\n $y_ratio = @($max_height / $orig_height);\n \n if( ($orig_width <= $max_width) && ($orig_height <= $max_height) ){ // Image is smaller than max height and width so don't resize\n $tn_width = $orig_width;\n $tn_height = $orig_height;\n \n } elseif(($x_ratio * $orig_height) < $max_height){ // Wider rather than taller\n $tn_height = ceil($x_ratio * $orig_height);\n $tn_width = $max_width;\n \n } else { // Taller rather than wider\n $tn_width = ceil($y_ratio * $orig_width);\n $tn_height = $max_height;\n }\n \n $width = $tn_width;\n $height = $tn_height;\n \n } elseif($this->mode === \"fit-x\"){ // Sets the width to the max width and the height according to aspect ratio (will stretch if too small)\n $height = @round($orig_height * $width / $orig_width);\n \n if($orig_height <= $height){ // Don't stretch if smaller\n $width = $orig_width;\n $height = $orig_height;\n }\n \n } elseif($this->mode === \"fit-y\"){ // Sets the height to the max height and the width according to aspect ratio (will stretch if too small)\n $width = @round($orig_width * $height / $orig_height);\n \n if($orig_width <= $width){ // Don't stretch if smaller\n $width = $orig_width;\n $height = $orig_height;\n }\n } else {\n throw new \\Exception('Invalid mode: ' . $this->mode);\n }\n \n\n // Resize\n $this->temp = imagecreatetruecolor($width, $height);\n \n // Preserve transparency if a png\n if($this->image_info['mime'] == 'image/png'){\n imagealphablending($this->temp, false);\n imagesavealpha($this->temp, true);\n }\n \n imagecopyresampled($this->temp, $this->image, 0, 0, 0, 0, $width, $height, $orig_width, $orig_height);\n $this->sync();\n \n \n // Cropping?\n if($this->mode === \"crop\"){ \n $orig_width = imagesx($this->image);\n $orig_height = imagesy($this->image);\n \n $x_mid = $orig_width/2; // horizontal middle\n $y_mid = $orig_height/2; // vertical middle\n \n $this->temp = imagecreatetruecolor($crop_width, $crop_height);\n \n // Preserve transparency if a png\n if($this->image_info['mime'] == 'image/png'){\n imagealphablending($this->temp, false);\n imagesavealpha($this->temp, true);\n }\n\n imagecopyresampled($this->temp, $this->image, 0, 0, ($x_mid-($crop_width/2)), ($y_mid-($crop_height/2)), $crop_width, $crop_height, $crop_width, $crop_height);\n $this->sync();\n }\n }", "public function center_crop( $args ) {\n\t\t\t$size = $this->get_dimensions( $args );\n\n\t\t\tif ( empty( $size ) ) {\n\t\t\t\treturn array();\n\t\t\t}\n\n\t\t\t$horizontal_offset = $this->get_center_crop_offset( $size );\n\n\t\t\treturn $this->set_conditional_args(\n\t\t\t\tarray(\n\t\t\t\t\t'w' => $size['width'],\n\t\t\t\t\t'crop' => '0,' . $horizontal_offset . 'px,100,' . $size['height'],\n\t\t\t\t)\n\t\t\t);\n\t\t}", "function scaleByLength($size)\r\n {\r\n if ($this->img_x >= $this->img_y) {\r\n $new_x = $size;\r\n $new_y = round(($new_x / $this->img_x) * $this->img_y, 0);\r\n } else {\r\n $new_y = $size;\r\n $new_x = round(($new_y / $this->img_y) * $this->img_x, 0);\r\n }\r\n return $this->_resize($new_x, $new_y);\r\n }", "public function initCropBox() {\n $this->setImage($this->configuration['image']);\n $this->setCropBoxProperties();\n $this->setOriginalSize();\n $this->setAspectRatio();\n $this->setDelta();\n\n return $this;\n }" ]
[ "0.78189194", "0.66439575", "0.64920396", "0.6277231", "0.62416786", "0.6236862", "0.6133884", "0.6116691", "0.6055783", "0.6050034", "0.6044341", "0.60259306", "0.6005839", "0.59723556", "0.59148073", "0.588516", "0.58260214", "0.5798846", "0.5798543", "0.57856876", "0.57582694", "0.5735208", "0.56388056", "0.56174946", "0.56042504", "0.5598642", "0.5595397", "0.5576943", "0.5542257", "0.553137", "0.5528511", "0.55168796", "0.5513232", "0.5493846", "0.5478481", "0.5476399", "0.54695433", "0.5439656", "0.54227555", "0.54219687", "0.5398814", "0.5383827", "0.5371942", "0.53405535", "0.5336491", "0.5326112", "0.5316722", "0.5312607", "0.5293789", "0.52825564", "0.5275884", "0.5270858", "0.52679574", "0.5245596", "0.5234665", "0.52344316", "0.5226347", "0.52007943", "0.51770097", "0.51715654", "0.5166072", "0.516542", "0.51580507", "0.51431566", "0.5127532", "0.5125247", "0.5122124", "0.5120881", "0.51154596", "0.5091048", "0.508731", "0.5086974", "0.50824183", "0.50748074", "0.50670916", "0.5040979", "0.5039901", "0.50227946", "0.5015042", "0.5013719", "0.5010428", "0.50091445", "0.49944475", "0.49713236", "0.49672", "0.49634722", "0.49586126", "0.49387175", "0.4938614", "0.4934818", "0.49310288", "0.4927702", "0.49247074", "0.49201617", "0.49201268", "0.49192134", "0.49028623", "0.48907968", "0.48825237", "0.48759577" ]
0.6647961
1
Rotate the image by a given amount. // Rotate 45 degrees clockwise $image>rotate(45); // Rotate 90% counterclockwise $image>rotate(90);
public function rotate($degrees) { // Make the degrees an integer $degrees = (int) $degrees; if ($degrees > 180) { do { // Keep subtracting full circles until the degrees have normalized $degrees -= 360; } while($degrees > 180); } if ($degrees < -180) { do { // Keep adding full circles until the degrees have normalized $degrees += 360; } while($degrees < -180); } $this->_do_rotate($degrees); return $this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function RotatedImage($file,$x,$y,$w,$h,$angle)\n{\n $this->Rotate($angle,$x,$y);\n $this->Image($file,$x,$y,$w,$h);\n $this->Rotate(0);\n}", "function rotate($img_name,$rotated_image,$direction){\n\t\t$image = $img_name;\n\t\t$extParts=explode(\".\",$image);\n\t\t$ext=end($extParts);\n\t\t$filename=$rotated_image;\n\t\t//How many degrees you wish to rotate\n\t\t$degrees = 0;\n\t\tif($direction=='R'){\n\t\t\t$degrees = 90;\n\t\t}\n\t\tif($direction=='L'){\n\t\t\t$degrees = -90;\n\t\t}\n\t\t\n\t\tif($ext==\"jpg\" || $ext== \"jpeg\" || $ext==\"JPG\" || $ext== \"JPEG\"){\n\t\t\t$source = imagecreatefromjpeg($image) ;\n\t\t\t$rotate = imagerotate($source, $degrees, 0) ;\n\t\t\timagejpeg($rotate,$filename) ;\n\t\t}\n\t\t\n\t\t\n\t\tif($ext==\"GIF\" || $ext== \"gif\"){\n\t\t\t$source = imagecreatefromgif($image) ;\n\t\t\t$rotate = imagerotate($source, $degrees, 0) ;\n\t\t\timagegif($rotate,$filename) ;\n\t\t\t\n\t\t}\n\t\t\n\t\tif($ext==\"png\" || $ext== \"PNG\"){\n\t\t\t$source = imagecreatefrompng($image) ;\n\t\t\t$rotate = imagerotate($source, $degrees, 0) ;\n\t\t\timagepng($rotate,$filename) ;\n\t\t\t\n\t\t}\n\t\treturn $rotate;\t\n\t\t\n\t}", "function _rotate_image_resource($img, $angle)\n {\n }", "function RotatedImage($file,$x,$y,$w,$h,$angle)\n\t{\n\t $this->Rotate($angle,$x,$y);\n\t $this->Image($file,$x,$y,$w,$h);\n\t $this->Rotate(0);\n\t}", "function RotatedImage($file,$x,$y,$w,$h,$angle) {\n\t\t$this->Rotate($angle,$x,$y);\n\t\t$this->Image($file,$x,$y,$w,$h);\n\t\t$this->Rotate(0);\n\t}", "function RotatedImage($file,$x,$y,$w,$h,$angle) {\n\t\t$this->Rotate($angle,$x,$y);\n\t\t$this->Image($file,$x,$y,$w,$h);\n\t\t$this->Rotate(0);\n\t}", "function RotatedImage($file,$x,$y,$w,$h,$angle)\n {\n $this->Rotate($angle,$x,$y);\n $this->Image($file,$x,$y,$w,$h);\n $this->Rotate(0);\n }", "function autoRotateImage($image) {\n $orientation = $image->getImageOrientation();\n\n switch($orientation) {\n case imagick::ORIENTATION_BOTTOMRIGHT:\n $image->rotateimage(\"#000\", 180); // rotate 180 degrees\n break;\n\n case imagick::ORIENTATION_RIGHTTOP:\n $image->rotateimage(\"#000\", 90); // rotate 90 degrees CW\n break;\n\n case imagick::ORIENTATION_LEFTBOTTOM:\n $image->rotateimage(\"#000\", -90); // rotate 90 degrees CCW\n break;\n }\n\n // Now that it's auto-rotated, make sure the EXIF data is correct in case the EXIF gets saved with the image!\n $image->setImageOrientation(imagick::ORIENTATION_TOPLEFT);\n}", "abstract public function rotate($amount);", "public function rotate()\n {\n // not possible in php?\n }", "public function rotateBy($rotation) {}", "function image_rotate()\n\t{\n\t\t// Allowed rotation values\n\t\t\n\t\t$degs = array(90, 180, 270, 'vrt', 'hor');\t\n\t\n\t\t\tif ($this->rotation == '' OR ! in_array($this->rotation, $degs))\n\t\t\t{\n\t\t\t$this->set_error('imglib_rotation_angle_required');\n\t\t\treturn FALSE;\t\t\t\n\t\t\t}\n\t\n\t\t/** -------------------------------------\n\t\t/** Reassign the width and height\n\t\t/** -------------------------------------*/\n\t\n\t\tif ($this->rotation == 90 OR $this->rotation == 270)\n\t\t{\n\t\t\t$this->dst_width\t= $this->src_height;\n\t\t\t$this->dst_height\t= $this->src_width;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->dst_width\t= $this->src_width;\n\t\t\t$this->dst_height\t= $this->src_height;\n\t\t}\n\t\n\t\t/** -------------------------------------\n\t\t/** Choose resizing function\n\t\t/** -------------------------------------*/\n\t\t\n\t\tif ($this->resize_protocol == 'imagemagick' OR $this->resize_protocol == 'netpbm')\n\t\t{\n\t\t\t$protocol = 'image_process_'.$this->resize_protocol;\n\t\t\n\t\t\treturn $this->$protocol('rotate');\n\t\t}\n\t\t\n \t\tif ($this->rotation == 'hor' OR $this->rotation == 'vrt')\n \t\t{\n\t\t\treturn $this->image_mirror_gd();\n \t\t}\n\t\telse\n\t\t{\t\t\n\t\t\treturn $this->image_rotate_gd();\n\t\t}\n\t}", "function rotateImage($param=array())\r\n {\r\n $img = isset($param['src']) ? $param['src'] : false;\r\n $newname= isset($param['newname']) ? $param['newname'] : $img;\r\n $degrees= isset($param['deg']) ? $param['deg'] : false;\r\n $out = false;\r\n \r\n if($img)\r\n {\r\n \r\n switch(exif_imagetype($img)){\r\n \tcase 1:\r\n \t\t//gif\r\n \t\t$destimg = imagecreatefromgif($img);\r\n \t\t$transColor = imagecolorallocatealpha($destimg, 255, 255, 255, 127);\r\n \t\t$rotatedImage = imagerotate($destimg, $degrees, $transColor);\r\n \t\timagesavealpha($rotatedImage, true);\r\n \t\timagegif($rotatedImage, $newname);\r\n \tbreak;\r\n \tcase 2:\r\n \t\t//jpg\r\n \t\t$destimg = imagecreatefromjpeg($img);\r\n \t\t$transColor = imagecolorallocatealpha($destimg, 255, 255, 255, 127);\r\n \t\t$rotatedImage = imagerotate($destimg, $degrees, $transColor);\r\n \t\timagesavealpha($rotatedImage, true);\r\n \t\timagejpeg($rotatedImage, $newname);\r\n \tbreak;\r\n \tcase 3:\r\n \t\t//png\r\n \t\t$destimg = imagecreatefrompng($img);\r\n \t\t$transColor = imagecolorallocatealpha($destimg, 255, 255, 255, 127);\r\n \t\t$rotatedImage = imagerotate($destimg, $degrees, $transColor);\r\n \t\timagesavealpha($rotatedImage, true);\r\n \t\timagepng($rotatedImage, $newname);\r\n \tbreak;\r\n }\r\n \r\n $out = $img;\r\n }\r\n \r\n return $out;\r\n }", "public function actionRotate($imageid,$direction)\n\t{\n\t\t\n\t\t// the image object is created from the database to avoid user input\n\t\t$image = Image::model()->findByPk($imageid);\n\t\t// where to return after the operation\n\t\t$rotatedurl = Yii::app()->user->returnUrl;\n\t\t\n\t\t// temporary filename for the created rotated image\n\t\t$tempfilename = Image::FULLIMAGETEMPPATH . uniqid() . '.jpg';\n\t\t// the image variable $rotated is created based on the original JPG in the file system\n\t\t\n\t\t// if the file does not exist, the user is redirected away\n\t\tif (!file_exists($image->getImageFile('full',false,Image::FULLIMAGEPATH)))\n\t\t{\n\t\t\t$rotatedurl['rotated']='fail_file_not_found';\n\t\t\t$this->redirect($rotatedurl);\n\t\t}\n\t\t\t\t\n\t\t// the original full image is evaluated to determine if it's a JPG\n\t\t// should the file not be jpg, execution is terminated and user is presented\n\t\t// with an error\n\t\t$originalFullImage = $image->getImageFile('full',false,Image::FULLIMAGEPATH);\n\t\t// getimagesize returns information of image size, but also of type among other things\n\t\t$information = getimagesize($originalFullImage);\n\t\tif ($information['mime'] != 'image/jpeg')\n\t\t{\n\t\t\t$rotatedurl['rotated']='fail_not_jpg';\n\t\t\t$this->redirect($rotatedurl);\n\t\t}\n\n\t\t// an uncompressed image is created from the original full size image\n\t\t$rotate = imagecreatefromjpeg($originalFullImage);\n\t\t// the original full image is unset to save memory\n\t\tunset($originalFullImage);\n\t\t\n\t\t// defining the direction of the rotation\n\t\tswitch($direction) \n\t\t{\n\t\t\tcase 'clockwise':\n\t\t\t\t$angle = -90; \t\n\t\t\t\tbreak;\n\t\t\tcase 'counterclockwise':\n\t\t\t\t$angle = 90; \t\n\t\t\t\tbreak;\n\t\t}\n\t\t\n\t\t// creates the rotated image\n\t\t$rotated = imagerotate($rotate,$angle,0);\n\t\tunset($rotate);\n\t\t// saves the rotated image as a jpeg to the temporary file directory\n\t\timagejpeg($rotated,$tempfilename,100);\n\t\tunset($rotated);\n\t\t\n\t\t// the existance of the rotated image is evaluated before anything is deleted\n\t\tif(file_exists($tempfilename))\n\t\t{\n\t\t\t// deletes all the physical image files for the image object\n\t\t\t$image->deleteImage(array('small', 'light', 'medium', 'large','full'));\n\t\t\t\n\t\t\t// moving the generated image to it's desired location\n\t\t\trename($tempfilename,$image->getImageFile('full',false,Image::FULLIMAGEPATH));\n\t\t\t\n\t\t\t// generating thumbnails for the rotated image\n\t\t\t$image->generateThumbnails();\n\t\t}\n\n\t\t$rotatedurl['rotated']='true';\n\t\t$this->redirect($rotatedurl);\n\t\t\t\t\n\t}", "function acadp_exif_rotate( $file ){\n\n\tif( ! function_exists( 'exif_read_data' ) ) {\n\t\treturn $file;\n\t}\n\n\t$exif = @exif_read_data( $file['tmp_name'] );\n\t$exif_orient = isset( $exif['Orientation'] ) ? $exif['Orientation'] : 0;\n\t$rotate_image = 0;\n\n\tif( 6 == $exif_orient ) {\n\t\t$rotate_image = 90;\n\t} else if ( 3 == $exif_orient ) {\n\t\t$rotate_image = 180;\n\t} else if ( 8 == $exif_orient ) {\n\t\t$rotate_image = 270;\n\t}\n\n\tif( $rotate_image ) {\n\n\t\tif( class_exists( 'Imagick' ) ) {\n\n\t\t\t$imagick = new Imagick();\n\t\t\t$imagick_pixel = new ImagickPixel();\n\t\t\t$imagick->readImage( $file['tmp_name'] );\n\t\t\t$imagick->rotateImage( $imagick_pixel, $rotate_image );\n\t\t\t$imagick->setImageOrientation( 1 );\n\t\t\t$imagick->writeImage( $file['tmp_name'] );\n\t\t\t$imagick->clear();\n\t\t\t$imagick->destroy();\n\n\t\t} else {\n\n\t\t\t$rotate_image = -$rotate_image;\n\n\t\t\tswitch( $file['type'] ) {\n\t\t\t\tcase 'image/jpeg' :\n\t\t\t\t\tif( function_exists( 'imagecreatefromjpeg' ) ) {\n\t\t\t\t\t\t$source = imagecreatefromjpeg( $file['tmp_name'] );\n\t\t\t\t\t\t$rotate = imagerotate( $source, $rotate_image, 0 );\n\t\t\t\t\t\timagejpeg( $rotate, $file['tmp_name'] );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'image/png' :\n\t\t\t\t\tif( function_exists( 'imagecreatefrompng' ) ) {\n\t\t\t\t\t\t$source = imagecreatefrompng( $file['tmp_name'] );\n\t\t\t\t\t\t$rotate = imagerotate( $source, $rotate_image, 0 );\n\t\t\t\t\t\timagepng( $rotate, $file['tmp_name'] );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'image/gif' :\n\t\t\t\t\tif( function_exists( 'imagecreatefromgif' ) ) {\n\t\t\t\t\t\t$source = imagecreatefromgif( $file['tmp_name'] );\n\t\t\t\t\t\t$rotate = imagerotate( $source, $rotate_image, 0 );\n\t\t\t\t\t\timagegif( $rotate, $file['tmp_name'] );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\treturn $file;\n\n}", "function RotatedImage($file, $x, $y, $w, $h, $angle) {\n\t\t$this->Rotate($angle, $x, $y);\n\t\t$this->Image($file, $x, $y, $w, $h);\n\t\t$this->Rotate(0);\n\t}", "public function Rotate($angle){\n\t\t\t$rgba = \\backbone\\Color::HexToRGBA(\"#FFFFFF\", 0);\n\t\t\t$color = $this->AllocateColor($rgba[0]['r'], $rgba[0]['g'], $rgba[0]['b'], $rgba[0]['alpha']);\n\n\t\t\t$img = new \\backbone\\Image();\n\t\t\t$img->handle = imagerotate($this->handle, $angle, $color);\n\t\t\treturn $img;\n\t\t}", "function RotatedImage($file,$x,$y,$w,$h,$bln_rotate)\n\t{\n\t $img_size= getimagesize($file);\n\t \n\t $aspect_y=$h/$img_size[1];\n\t $aspect_x=$w/$img_size[0];\n\t \n\t if ($bln_rotate==1){\n\t\t //Check to see if the image fits better at 90 degrees\n\t\t $aspect_y2=$w/$img_size[1];\n\t\t $aspect_x2=$h/$img_size[0];\n\t\t \n\t\t if($aspect_x<$aspect_y)\n\t\t {\n\t\t \t$aspect1=$aspect_x;\n\t\t }\n\t\t else {\n\t\t \t$aspect1=$aspect_y;\n\t\t }\n\t\t \n\t\t if($aspect_x2<$aspect_y2)\n\t\t {\n\t\t \t$aspect2=$aspect_x2;\n\t\t }\n\t\t else {\n\t\t \t$aspect2=$aspect_y2;\n\t\t }\n\t\t \n\t\t if ($aspect1<$aspect2)\n\t\t {\n\t\t \t$angle=90;\n\t\t \t$y=$y+$h;\n\t\t \t$t=$h;\n\t\t \t$h=$w;\n\t\t \t$w=$t;\n\t\t \t$aspect_y=$aspect_y2;\n\t\t \t$aspect_x=$aspect_x2;\n\t\t }\n\t }\n\t \n\t \n\t \n\t \n\t \tif ($aspect_x>$aspect_y){\n\t \t\t$flt_adjust=$aspect_y;\n\t \t\t$w=$flt_adjust*$img_size[0];\n\t \t\t\n\t \t}\n\t \telse{\n\t \t\t$flt_adjust=$aspect_x;\n\t \t\t$h=$flt_adjust*$img_size[1];\n\t \t}\n\t \n\t \t\n\t \t\n\t $this->Rotate($angle,$x,$y);\n\t $this->Image($file,$x,$y,$w,$h,'JPG');\n\t $this->Rotate(0);\n\t}", "function RotatedImage($file, $x, $y, $w, $h, $angle) {\n $this->Rotate($angle, $x, $y);\n $this->Image($file, $x, $y, $w, $h);\n $this->Rotate(0);\n }", "protected function _rotateImage(&$photo, $path)\n {\n \t$exif = @exif_read_data($path);\n \t\n \tif (!empty($exif['Orientation']))\n \t\tswitch ($exif['Orientation'])\n \t\t{\n \t\t\tcase 8:\n \t\t\t\t$photo->rotateImageNDegrees(90)->save($path);\n \t\t\t\tbreak;\n \t\t\tcase 3:\n \t\t\t\t$photo->rotateImageNDegrees(180)->save($path);\n \t\t\t\tbreak;\n \t\t\tcase 6:\n \t\t\t\t$photo->rotateImageNDegrees(-90)->save($path);\n \t\t\t\tbreak;\n \t}\n }", "function rotate($src_file, $dest_file, $degrees, $img_meta) {\n if (!zmgGd1xTool::isSupportedType($img_meta['extension'], $src_file)) {\n return false;\n }\n \n if ($img_meta['extension'] == \"jpg\" || $img_meta['extension'] == \"jpeg\") {\n $src_img = imagecreatefromjpeg($src_file);\n } else {\n $src_img = imagecreatefrompng($src_file);\n }\n if (!$src_img) {\n return zmgToolboxPlugin::registerError($src_file, 'GD 1.x: Could not rotate image.');\n }\n\n // The rotation routine...\n $dst_img = imagerotate($src_img, $degrees, 0);\n if ($imgobj->_type == \"jpg\" || $imgobj->_type == \"jpeg\") {\n imagejpeg($dst_img, $dest_file, $img_meta['jpeg_qty']);\n } else {\n imagepng($dst_img, $dest_file);\n }\n\n imagedestroy($src_img);\n imagedestroy($dst_img);\n return true;\n }", "function _rotateImageGD1($file, $desfile, $degrees, $imgobj) {\r\n // GD can only handle JPG & PNG images\r\n if ($imgobj->_type !== \"jpg\" && $imgobj->_type !== \"jpeg\" && $imgobj->_type !== \"png\") {\r\n return false;\r\n }\r\n if ($imgobj->_type == \"jpg\" || $imgobj->_type == \"jpeg\") {\r\n $src_img = imagecreatefromjpeg($file);\r\n } else {\r\n $src_img = imagecreatefrompng($file);\r\n }\r\n if (!$src_img) {\r\n return false;\r\n }\r\n // The rotation routine...\r\n $dst_img = imagerotate($src_img, $degrees, 0);\r\n if ($imgobj->_type == \"jpg\" || $imgobj->_type == \"jpeg\") {\r\n imagejpeg($dst_img, $desfile, $this->_JPEG_quality);\r\n } else {\r\n imagepng($dst_img, $desfile);\r\n }\r\n imagedestroy($src_img);\r\n imagedestroy($dst_img);\r\n return true; \r\n }", "public static function rotate($baseURL, $name, $image)\r\n {\r\n $exif = exif_read_data($image);\r\n\r\n if (array_key_exists('Orientation', $exif))\r\n {\r\n $jpg = imagecreatefromjpeg($image);\r\n $orientation = $exif['Orientation'];\r\n switch ($orientation)\r\n {\r\n case 3:\r\n $jpg = imagerotate($jpg, 180, 0);\r\n break;\r\n case 6:\r\n $jpg = imagerotate($jpg, -90, 0);\r\n break;\r\n case 8:\r\n $jpg = imagerotate($jpg, 90, 0);\r\n break;\r\n default: \t\r\n }\r\n imagejpeg($jpg, $baseURL.'computed/'.$name, 90);\r\n }\r\n\t\t else\r\n\t\t {\r\n\t\t\t copy($image, $baseURL.'computed/'.$name);\r\n\t\t }\r\n }", "function __rotate(&$tmp, $angle, &$color) {\n\n\t\t// skip full loops\n\t\t//\n\t\tif (($angle % 360) == 0) {\n\t\t\treturn true;\n\t\t\t}\n\n\t\t// rectangular rotates are OK\n\t\t//\n\t\tif (($angle % 90) == 0) {\n\n\t\t\t// call `convert -rotate`\n\t\t\t//\n\t\t\t$cmd = $this->__command(\n\t\t\t\t'convert',\n\t\t\t\t\" -rotate {$angle} \"\n\t \t\t\t. escapeshellarg(realpath($tmp->target))\n\t \t\t\t. \" TIF:\"\n\t \t\t\t// ^ \n\t \t\t\t// GIF saving hack\n\t \t\t\t. escapeshellarg(realpath($tmp->target))\n\t \t);\n\t exec($cmd, $result, $errors);\n\t\t\tif ($errors) {\n\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t$w1 = $tmp->image_width;\n\t\t\t$h1 = $tmp->image_height;\n\t\t\t$tmp->image_width = ($angle % 180) ? $h1 : $w1;\n\t\t\t$tmp->image_height = ($angle % 180) ? $w1 : $h1;\n\t\t\treturn true;\n\t\t\t}\n\n\t\treturn false;\n\t\t}", "function rotateImage0($img, $imgPath, $suffix, $degrees, $quality, $save)\n{\n // Open the original image.\n $original = imagecreatefromjpeg(\"$imgPath/$img\") or die(\"Error Opening original\");\n list($width, $height, $type, $attr) = getimagesize(\"$imgPath/$img\");\n \n // Resample the image.\n $tempImg = imagecreatetruecolor($width, $height) or die(\"Cant create temp image\");\n imagecopyresized($tempImg, $original, 0, 0, 0, 0, $width, $height, $width, $height) or die(\"Cant resize copy\");\n \n // Rotate the image.\n $rotate = imagerotate($original, $degrees, 0);\n \n // Save.\n if($save)\n {\n // Create the new file name.\n $newNameE = explode(\".\", $img);\n $newName = ''. $newNameE[0] .''. $suffix .'.'. $newNameE[1] .'';\n \n // Save the image.\n imagejpeg($rotate, \"$imgPath/$newName\", $quality) or die(\"Cant save image\");\n }\n \n // Clean up.\n imagedestroy($original);\n imagedestroy($tempImg);\n return true;\n}", "private function rotate_imagick($imagePath, $orientation)\n {\n $imagick = new Imagick($imagePath);\n $imagick->setImageOrientation(imagick::ORIENTATION_TOPLEFT);\n $deg = 0;\n\n switch ($orientation) {\n case 2:\n $deg = 180;\n $imagick->flipImage();\n break;\n\n case 3:\n $deg = -180;\n break;\n\n case 4:\n $deg = -180;\n $imagick->flopImage();\n break;\n\n case 5:\n $deg = -90;\n $imagick->flopImage();\n break;\n\n case 6:\n $deg = 90;\n break;\n\n case 7:\n $deg = -90;\n $imagick->flipImage();\n break;\n\n case 8:\n $deg = -90;\n break;\n }\n $imagick->rotateImage(new ImagickPixel('#00000000'), $deg);\n $imagick->writeImage($imagePath);\n $imagick->clear();\n $imagick->destroy();\n }", "public function test_rotate() {\n\t\t$file = DIR_TESTDATA . '/images/one-blue-pixel-100x100.png';\n\n\t\t$imagick_image_editor = new WP_Image_Editor_Imagick( $file );\n\t\t$imagick_image_editor->load();\n\n\t\t$property = new ReflectionProperty( $imagick_image_editor, 'image' );\n\t\t$property->setAccessible( true );\n\n\t\t$color_top_left = $property->getValue( $imagick_image_editor )->getImagePixelColor( 0, 0 )->getColor();\n\n\t\t$imagick_image_editor->rotate( 180 );\n\n\t\t$this->assertSame( $color_top_left, $property->getValue( $imagick_image_editor )->getImagePixelColor( 99, 99 )->getColor() );\n\t}", "public function rotate($sourceImg, $angleDegrees) {\n\n $angle = (int)$angleDegrees;\n if(! $angle || ! abs($angle) % 360) {\n return $sourceImg;\n }\n $width = imagesx($sourceImg);\n $height = imagesy($sourceImg);\n \n /**\n * First create a new image that is large enough to hold the original image at any rotation angle.\n */\n $max = hypot($width, $height);\n $img = $this->_createImage($max, $max);\n if(false === $img) {\n return false;\n }\n /**\n * DEBUG\n */\n // $debugIndex = $this->_debugWriteToFile($img);\n \n /**\n * Copy the original image centered on the new image.\n */\n if(false === $this->_copyCentered($img, $sourceImg)) {\n return false;\n }\n \n /**\n * DEBUG\n */\n // $debugIndex = $this->_debugWriteToFile($img, $debugIndex);\n \n /**\n * Rotate the new image.\n * \n * NOTICE: negative angles to apply clock-wise rotation.\n */\n $rotatedImg = imagerotate($img, $angle, imagecolorallocatealpha($sourceImg, 0, 0, 0, 127));\n if(false === $rotatedImg) {\n return false;\n }\n \n /**\n * DEBUG\n * $debugIndex = $this->_debugWriteToFile($rotatedImg, $debugIndex);\n */\n \n /**\n * Create an image having having dimensions to fully contain the rotated image at the specified angle.\n */\n $rad = deg2rad($angle);\n $x = $height * abs(sin($rad)) + $width * abs(cos($rad));\n $y = $height * abs(cos($rad)) + $width * abs(sin($rad));\n $finalImg = $this->_createImage($x, $y);\n if(false === $finalImg) {\n return false;\n }\n $res = imagecopy(\n $finalImg, \n $rotatedImg, \n 0, \n 0, \n (imagesx($rotatedImg) - $x) / 2,\n (imagesy($rotatedImg) - $y) / 2,\n $x,\n $y);\n if(false === $res) {\n return false;\n }\n /**\n * DEBUG\n * $this->_debugWriteToFile($finalImg, $debugIndex);\n */\n return $finalImg;\n }", "private function rotate_gd($image, $orientation)\n {\n switch ($orientation) {\n case 2:\n $image = imagerotate($image, 180, 0);\n imageflip($image, IMG_FLIP_VERTICAL);\n break;\n\n case 3:\n $image = imagerotate($image, 180, 0);\n break;\n\n case 4:\n $image = imagerotate($image, 180, 0);\n imageflip($image, IMG_FLIP_HORIZONTAL);\n break;\n\n case 5:\n $image = imagerotate($image, -90, 0);\n imageflip($image, IMG_FLIP_HORIZONTAL);\n break;\n\n case 6:\n $image = imagerotate($image, -90, 0);\n break;\n\n case 7:\n $image = imagerotate($image, -90, 0);\n imageflip($image, IMG_FLIP_VERTICAL);\n break;\n\n case 8:\n $image = imagerotate($image, 90, 0);\n break;\n }\n\n return $image;\n }", "public static function change_image_type(){\n/**\n*\n*This function change the image type like convert png to jpg or bmp or gif\n*\n*/\npublic static function rotate()\n}", "public function test_rotate() {\n\n\t\t$file = DIR_TESTDATA . '/images/gradient-square.jpg';\n\n\t\t$imagick_image_editor = new WP_Image_Editor_Imagick( $file );\n\t\t$imagick_image_editor->load();\n\n\t\t$property = new ReflectionProperty( $imagick_image_editor, 'image' );\n\t\t$property->setAccessible( true );\n\n\t\t$color_top_left = $property->getValue( $imagick_image_editor )->getImagePixelColor( 1, 1 )->getColor();\n\n\t\t$imagick_image_editor->rotate( 180 );\n\n\t\t$this->assertEquals( $color_top_left, $property->getValue( $imagick_image_editor )->getImagePixelColor( 99, 99 )->getColor() );\n\t}", "function rotate($src_file, $dest_file, $degrees, $img_meta) {\n $fileOut = $src_file . \".1\";\n @copy($src_file, $fileOut);\n \n $path = zmgNetpbmTool::getPath();\n if ($img_meta['extension'] == \"png\") {\n $cmd = $path . \"pngtopnm \" . $src_file . \" | \" . $path . \"pnmrotate \"\n . $degrees . \" | \" . $path . \"pnmtopng > \" . $fileOut;\n } else if ($img_meta['extension'] == \"jpg\" || $img_meta['extension'] == \"jpeg\") {\n $cmd = $path . \"jpegtopnm \" . $src_file . \" | \" . $path . \"pnmrotate \"\n . $degrees . \" | \" . $path . \"ppmtojpeg -quality=\" . $img_meta['jpeg_qty']\n . \" > \" . $fileOut;\n } else if ($img_meta['extension'] == \"gif\") {\n $cmd = $path . \"giftopnm \" . $src_file . \" | \" . $path . \"pnmrotate \"\n . $degrees . \" | \" . $path . \"ppmquant 256 | \" . $path . \"ppmtogif > \"\n . $fileOut;\n } else {\n return zmgToolboxPlugin::registerError($src_file, 'NetPBM: Source file is not an image or image type is not supported.');\n }\n\n $output = $retval = null;\n exec($cmd, $output, $retval);\n if ($retval) {\n return zmgToolboxPlugin::registerError($src_file, 'NetPBM: Could not rotate image: ' . $output);\n }\n $erg = @rename($fileOut, $dest_file);\n\n return true;\n }", "function AutoRotateImage($src_image, $ref = false) \n {\n # from a non-ingested image to properly rotate a preview image\n global $imagemagick_path, $camera_autorotation_ext, $camera_autorotation_gm;\n \n if (!isset($imagemagick_path)) \n {\n return false;\n # for the moment, this only works for imagemagick\n # note that it would be theoretically possible to implement this\n # with a combination of exiftool and GD image rotation functions.\n }\n\n # Locate imagemagick.\n $convert_fullpath = get_utility_path(\"im-convert\");\n if ($convert_fullpath == false) \n {\n return false;\n }\n \n $exploded_src = explode('.', $src_image);\n $ext = $exploded_src[count($exploded_src) - 1];\n $triml = strlen($src_image) - (strlen($ext) + 1);\n $noext = substr($src_image, 0, $triml);\n \n if (count($camera_autorotation_ext) > 0 && (!in_array(strtolower($ext), $camera_autorotation_ext))) \n {\n # if the autorotation extensions are set, make sure it is allowed for this extension\n return false;\n }\n\n $exiftool_fullpath = get_utility_path(\"exiftool\");\n $new_image = $noext . '-autorotated.' . $ext;\n \n if ($camera_autorotation_gm) \n {\n $orientation = get_image_orientation($src_image);\n if ($orientation != 0) \n {\n $command = $convert_fullpath . ' ' . escapeshellarg($src_image) . ' -rotate +' . $orientation . ' ' . escapeshellarg($new_image);\n run_command($command);\n }\n $command = $exiftool_fullpath . ' Orientation=1 ' . escapeshellarg($new_image);\n } \n else\n {\n if ($ref != false) \n {\n # use the original file to get the orientation info\n $extension = sql_value(\"select file_extension value from resource where ref=$ref\", '');\n $file = get_resource_path($ref, true, \"\", false, $extension, -1, 1, false, \"\", -1);\n # get the orientation\n $orientation = get_image_orientation($file);\n if ($orientation != 0) \n {\n $command = $convert_fullpath . ' -rotate +' . $orientation . ' ' . escapeshellarg($src_image) . ' ' . escapeshellarg($new_image);\n run_command($command);\n # change the orientation metadata\n $command = $exiftool_fullpath . ' Orientation=1 ' . escapeshellarg($new_image);\n }\n } \n else\n {\n $command = $convert_fullpath . ' ' . escapeshellarg($src_image) . ' -auto-orient ' . escapeshellarg($new_image);\n run_command($command);\n }\n }\n\n if (!file_exists($new_image)) \n {\n return false;\n }\n\n if (!$ref) \n {\n # preserve custom metadata fields with exiftool \n # save the new orientation\n # $new_orientation=run_command($exiftool_fullpath.' -s -s -s -orientation -n '.$new_image);\n $old_orientation = run_command($exiftool_fullpath . ' -s -s -s -orientation -n ' . escapeshellarg($src_image));\n \n $exiftool_copy_command = $exiftool_fullpath . \" -TagsFromFile \" . escapeshellarg($src_image) . \" -all:all \" . escapeshellarg($new_image);\n run_command($exiftool_copy_command);\n \n # If orientation was empty there's no telling if rotation happened, so don't assume.\n # Also, don't go through this step if the old orientation was set to normal\n if ($old_orientation != '' && $old_orientation != 1) \n {\n $fix_orientation = $exiftool_fullpath . ' Orientation=1 -n ' . escapeshellarg($new_image);\n run_command($fix_orientation);\n }\n }\n \n unlink($src_image);\n rename($new_image, $src_image);\n return true; \n }", "function rotateImage($width, $height, $rotation, $quality = 8) {\n\t\tif (!is_numeric($quality)) {\n\t\t\treturn false;\n\t\t} else {\n\t\t\tif ($quality > 10) {\n\t\t\t\t$quality = 10;\n\t\t\t} else if ($quality < 0) {\n\t\t\t\t$quality = 0;\n\t\t\t}\n\n\t\t\t$quality = $quality * 10;\n\n\t\t\t$dataPath = TMP_DIR.\"/\".weFile::getUniqueId();\n\t\t\t$_resized_image = we_image_edit::edit_image($this->getElement(\"data\"), $this->getGDType(), $dataPath, $quality, $width, $height, false, true, 0, 0, -1, -1, $rotation);\n\n\t\t\t$this->setElement(\"data\", $dataPath);\n\n\t\t\t$this->setElement(\"width\", $_resized_image[1]);\n\t\t\t$this->setElement(\"origwidth\", $_resized_image[1], \"attrib\");\n\n\t\t\t$this->setElement(\"height\", $_resized_image[2]);\n\t\t\t$this->setElement(\"origheight\", $_resized_image[2], \"attrib\");\n\n\t\t\t$this->DocChanged = true;\n\t\t}\n\t}", "function rotateImage($width, $height, $rotation, $quality = 8){\n\t\tif(!is_numeric($quality)){\n\t\t\treturn false;\n\t\t}\n\t\t$quality = max(min($quality, 10), 0) * 10;\n\n\t\t$dataPath = TEMP_PATH . we_base_file::getUniqueId();\n\t\t$_resized_image = we_base_imageEdit::edit_image($this->getElement('data'), $this->getGDType(), $dataPath, $quality, $width, $height, false, true, 0, 0, -1, -1, $rotation);\n\n\t\tif(!$_resized_image[0]){\n\t\t\treturn false;\n\t\t}\n\t\t$this->setElement('data', $dataPath);\n\n\t\t$this->setElement('width', $_resized_image[1], 'attrib');\n\t\t$this->setElement('origwidth', $_resized_image[1], 'attrib');\n\n\t\t$this->setElement('height', $_resized_image[2], 'attrib');\n\t\t$this->setElement('origheight', $_resized_image[2], 'attrib');\n\n\t\t$this->DocChanged = true;\n\t\treturn true;\n\t}", "public function rotate($degrees);", "public function rotate($x, $y, $angle) {}", "public function rotate($x, $y, $angle) {}", "public function rotate($x, $y, $angle) {}", "public function rotate()\n\t{\n\t\t// Allowed rotation values\n\t\t$degs = array(90, 180, 270, 'vrt', 'hor');\n\n\t\tif ($this->rotation_angle === '' OR ! in_array($this->rotation_angle, $degs))\n\t\t{\n\t\t\t$this->set_error('imglib_rotation_angle_required');\n\t\t\treturn FALSE;\n\t\t}\n\n\t\t// Reassign the width and height\n\t\tif ($this->rotation_angle === 90 OR $this->rotation_angle === 270)\n\t\t{\n\t\t\t$this->width\t= $this->orig_height;\n\t\t\t$this->height\t= $this->orig_width;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->width\t= $this->orig_width;\n\t\t\t$this->height\t= $this->orig_height;\n\t\t}\n\n\t\t// Choose resizing function\n\t\tif ($this->image_library === 'imagemagick' OR $this->image_library === 'netpbm')\n\t\t{\n\t\t\t$protocol = 'image_process_'.$this->image_library;\n\t\t\treturn $this->$protocol('rotate');\n\t\t}\n\n\t\treturn ($this->rotation_angle === 'hor' OR $this->rotation_angle === 'vrt')\n\t\t\t? $this->image_mirror_gd()\n\t\t\t: $this->image_rotate_gd();\n\t}", "function rotateImage($file, $desfile, $degrees, $imgobj) {\r\n $degrees = intval($degrees);\r\n switch ($this->_conversiontype){\r\n //Imagemagick\r\n case 1:\r\n if($this->_rotateImageIM($file, $desfile, $degrees))\r\n return true;\r\n else\r\n return false;\r\n break;\r\n //NetPBM\r\n case 2:\r\n if($this->_rotateImageNETPBM($file, $desfile, $degrees, $imgobj))\r\n return true;\r\n else\r\n return false;\r\n break;\r\n //GD1\r\n case 3:\r\n if($this->_rotateImageGD1($file, $desfile, $degrees, $imgobj))\r\n return true;\r\n else\r\n return false;\r\n break;\r\n //GD2\r\n case 4:\r\n if($this->_rotateImageGD2($file, $desfile, $degrees, $imgobj))\r\n return true;\r\n else\r\n return false;\r\n break;\r\n }\r\n return true;\r\n }", "private function _imgRotate(){\r\n\r\n $result = new stdClass();\r\n $response = 400;\r\n\r\n\r\n if($this->hasLogin()){\r\n\r\n /*\r\n \t*\r\n \t*\r\n \t*\tCheck the method used is POST\r\n \t*\r\n \t*\r\n \t*/\r\n \tif($_SERVER['REQUEST_METHOD'] == 'POST'){\r\n\r\n $url = strtok($_POST['url'], '?');\r\n\r\n $sourcePath = ROOT.'/site/files/_tmp/'.basename($url);\r\n $webPath = WEBROOT.'/site/files/_tmp/'.basename($url);\r\n $degrees = $_POST['direction']=='CCW'?90:-90;\r\n $info = getimagesize($sourcePath);\r\n\r\n switch($info['mime']){\r\n case 'image/png':\r\n $img = imagecreatefrompng($sourcePath);\r\n $rotate = imagerotate($img, $degrees, 0);\r\n imagesavealpha($rotate, true);\r\n imagepng($rotate, $sourcePath);\r\n break;\r\n case 'image/jpeg':\r\n $img = imagecreatefromjpeg($sourcePath);\r\n $rotate = imagerotate($img, $degrees, 0);\r\n imagejpeg($rotate, $sourcePath);\r\n break;\r\n case 'image/gif':\r\n $img = imagecreatefromgif($sourcePath);\r\n $rotate = imagerotate($img, $degrees, 0);\r\n imagegif($rotate, $sourcePath);\r\n break;\r\n default:\r\n $result->error = \"Only PNG, JPEG or GIF images are allowed!\";\r\n $response = 400;\r\n exit;\r\n }\r\n\r\n if(isset($img))imagedestroy($img);\r\n if(isset($rotate))imagedestroy($rotate);\r\n\r\n $info = getimagesize($sourcePath);\r\n $result->url = $webPath;\r\n $result->size = [$info[0],$info[1]];\r\n $response = 200;\r\n } else {\r\n $response = 400;\r\n }\r\n }\r\n\r\n http_response_code($response);\r\n echo json_encode($result);\r\n exit;\r\n\r\n }", "function _rotateImageNETPBM($file, $desfile, $degrees, $imgobj) {\r\n $fileOut = \"$file.1\";\r\n $zoom->platform->copy($file, $fileOut); \r\n if (eregi(\"\\.png\", $imgobj->_filename)) {\r\n $cmd = $this->_NETPBM_path . \"pngtopnm $file | \" . $this->_NETPBM_path . \"pnmrotate $degrees | \" . $this->_NETPBM_path . \"pnmtopng > $fileOut\" ; \r\n } elseif (eregi(\"\\.(jpg|jpeg)\", $imgobj->_filename)) {\r\n $cmd = $this->_NETPBM_path . \"jpegtopnm $file | \" . $this->_NETPBM_path . \"pnmrotate $degrees | \" . $this->_NETPBM_path . \"ppmtojpeg -quality=\" . $this->_JPEG_quality . \" > $fileOut\" ;\r\n } elseif (eregi(\"\\.gif\", $imgobj->_filename)) {\r\n $cmd = $this->_NETPBM_path . \"giftopnm $file | \" . $this->_NETPBM_path . \"pnmrotate $degrees | \" . $this->_NETPBM_path . \"ppmquant 256 | \" . $this->_NETPBM_path . \"ppmtogif > $fileOut\" ; \r\n } else {\r\n return false;\r\n }\r\n $output = $retval = null;\r\n exec($cmd, $output, $retval);\r\n if ($retval) {\r\n return false;\r\n } else {\r\n $erg = $zoom->platform->rename($fileOut, $desfile); \r\n return true;\r\n }\r\n }", "function _rotateImageIM($file, $desfile, $degrees) {\r\n $cmd = $this->_IM_path.\"convert -rotate $degrees \\\"$file\\\" \\\"$desfile\\\"\";\r\n $output = $retval = null;\r\n exec($cmd, $output, $retval);\r\n if($retval) {\r\n return false;\r\n } else {\r\n return true;\r\n }\r\n }", "function _rotateImageGD2($file, $desfile, $degrees, $imgobj) {\r\n // GD can only handle JPG & PNG images\r\n if ($imgobj->_type !== \"jpg\" && $imgobj->_type !== \"jpeg\" && $imgobj->_type !== \"png\" && $imgobj->_type !== \"gif\") {\r\n return false;\r\n }\r\n if ($imgobj->_type == \"gif\" && !function_exists(\"imagecreatefromgif\")) {\r\n \treturn false;\r\n }\r\n if ($imgobj->_type == \"jpg\" || $imgobj->_type == \"jpeg\") {\r\n $src_img = @imagecreatefromjpeg($file);\r\n } else if ($imgobj->_type == \"png\") {\r\n $src_img = @imagecreatefrompng($file);\r\n \t$dst_img = imagecreatetruecolor($imgobj->_size[0],$imgobj->_size[1]);\r\n\t\t\t$img_white = imagecolorallocate($dst_img, 255, 255, 255); // set background to white\r\n\t\t\t$img_return = imagefill($dst_img, 0, 0, $img_white);\r\n\t\t\timagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $imgobj->_size[0], $imgobj->_size[1], $imgobj->_size[0], $imgobj->_size[1]);\r\n\t\t\t$src_img = $dst_img;\r\n } else {\r\n \t$src_img = @imagecreatefromgif($file);\r\n \t$dst_img = imagecreatetruecolor($imgobj->_size[0],$imgobj->_size[1]);\r\n\t\t\t$img_white = imagecolorallocate($dst_img, 255, 255, 255); // set background to white\r\n\t\t\t$img_return = imagefill($dst_img, 0, 0, $img_white);\r\n\t\t\timagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $imgobj->_size[0], $imgobj->_size[1], $imgobj->_size[0], $imgobj->_size[1]);\r\n\t\t\t$src_img = $dst_img;\r\n }\r\n if (!$src_img) {\r\n return false;\r\n }\r\n // The rotation routine...\r\n $dst_img = imagerotate($src_img, $degrees, 0);\r\n if ($imgobj->_type == \"jpg\" || $imgobj->_type == \"jpeg\") {\r\n imagejpeg($dst_img, $desfile, $this->_JPEG_quality);\r\n } else if ($imgobj->_type == \"png\") {\r\n imagepng($dst_img, $desfile);\r\n } else {\r\n \timagegif($dst_img, $desfile);\r\n }\r\n imagedestroy($src_img);\r\n imagedestroy($dst_img);\r\n return true;\r\n }", "public function rotateLeft();", "function setRotation( $r ) {\n\n // only 0,90,180,270\n if ( $r > 270 ) return;\n if ( $r % 90 != 0 ) return;\n\n $this->rotate = $r;\n $this->vertical = ( $r == 90 or $r == 270 );\n}", "public function rotate($angle = 0, $bg_color = array(255, 255, 255)) {\n\t\tif(!$this->image) {\n\t\t\ttrigger_error('The image does not exist or is not readable.', E_USER_WARNING);\n\t\t\treturn false;\n\t\t}\n\n\t\t$angle = (float) $angle;\n\t\t$bg_color = $this->normalizeColor($bg_color);\n\n\t\tif($bg_color === false) {\n\t\t\ttrigger_error('Rotate failed because background color could not be generated. Try sending an array(RRR, GGG, BBB).', E_USER_WARNING);\n\t\t\treturn false;\n\t\t}\n\n\t\t$working_image = imagerotate($this->image, $angle, imagecolorallocate($this->image, $bg_color[0], $bg_color[1], $bg_color[2]));\n\n\t\tif($working_image) {\n\t\t\t$this->image = $working_image;\n\t\t\t$this->width = imagesx($this->image);\n\t\t\t$this->height = imagesy($this->image);\n\t\t\t$this->aspect = $this->width/$this->height;\n\t\t\tif($this->aspect > 1) {\n\t\t\t\t$this->orientation = 'landscape';\n\t\t\t} else if($this->aspect < 1) {\n\t\t\t\t$this->orientation = 'portrait';\n\t\t\t} else {\n\t\t\t\t$this->orientation = 'square';\n\t\t\t}\n\t\t\treturn true;\n\t\t} else {\n\t\t\ttrigger_error('Rotate failed.', E_USER_WARNING);\n\t\t\treturn false;\n\t\t}\n\t}", "public function rotate(int $degrees): Image\n\t{\n\t\t$this->processor->rotate($degrees);\n\n\t\treturn $this;\n\t}", "function __rotate(&$tmp, $angle, $color) {\r\r\n\t\tasido::trigger_abstract_error(\r\r\n\t\t\t__CLASS__,\r\r\n\t\t\t__FUNCTION__\r\r\n\t\t\t);\r\r\n\t\t}", "public function rotateRight();", "public function rotate(int $rotations);", "public function rotate($angle) {\n\t\t$this->angle = $angle;\n\t\tparent::rotate($angle);\n\t}", "public static function rotate($image = NULL, $degrees = NULL, $backgroundColorRed = 0, $backgroundColorGreen = 0, $backgroundColorBlue = 0, $backgroundColorAlpha = 0)\n\t{\n\n\t\tif (!($image instanceof Default_Model_MediaImage)) {\n\t\t\tthrow new Default_Model_MediaImage_Exception('Image needs to be an instance of Default_Model_MediaImage.');\n\t\t}\n\n\t\tif ($degrees &&\n\t\t\t!is_int($degrees)) {\n\n\t\t\tthrow new Default_Model_MediaImage_Exception('Degrees needs to be an integer, if specified.');\n\t\t}\n\n\t\tif (!is_int($backgroundColorRed) &&\n\t\t\t($backgroundColorRed < 0 || $backgroundColorRed > 255)) {\n\n\t\t\tthrow new Default_Model_MediaImage_Exception('BackgroundColor Red needs to be specified between 0 and 255.');\n\t\t}\n\n\t\tif (!is_int($backgroundColorGreen) &&\n\t\t\t($backgroundColorGreen < 0 || $backgroundColorGreen > 255)) {\n\n\t\t\tthrow new Default_Model_MediaImage_Exception('BackgroundColor Green needs to be specified between 0 and 255.');\n\t\t}\n\n\t\tif (!is_int($backgroundColorBlue) &&\n\t\t\t($backgroundColorBlue < 0 || $backgroundColorBlue > 255)) {\n\n\t\t\tthrow new Default_Model_MediaImage_Exception('BackgroundColor Blue needs to be specified between 0 and 255.');\n\t\t}\n\n\t\tif (!is_int($backgroundColorAlpha) &&\n\t\t\t($backgroundColorAlpha < 0 || $backgroundColorAlpha > 255)) {\n\n\t\t\tthrow new Default_Model_MediaImage_Exception('BackgroundColor Alpha needs to be specified between 0 and 255.');\n\t\t}\n\n\t\t$rotatedImage = Default_Service_MediaImage::fromMediaImage($image);\n\t\t$rotatedImage->width = 0;\n\t\t$rotatedImage->height = 0;\n\t\t$rotatedImage->file_size = 0;\n\t\t$rotatedImage->role_id = $image->role_id;\n\t\tif (isset($image['entity_id'])) {\n\t\t\t$rotatedImage->entity_id = $image->entity_id;\n\t\t} else\n\t\tif (Zend_Auth::getInstance()->hasIdentity()) {\n\t\t\t$rotatedImage->entity_id = Zend_Auth::getInstance()->getIdentity()->id;\n\t\t}\n\t\t$rotatedImage->short = Default_Service_Media::getShort($image->short, $rotatedImage->width, $rotatedImage->height, $rotatedImage->file_size);\n\t\t$rotatedImage->save();\n\n\n\t\t/**\n\t\t * imageinstance file does not exist yet and needs to be created\n\t\t */\n\t\tif (!file_exists($rotatedImage->getStoredFilePath())) {\n\n\t\t\t/**\n\t\t\t * use Imagick for rotating the image ?\n\t\t\t */\n\t\t\tif (Zend_Registry::get('Imagick')) {\n\n\t\t\t\t/**\n\t\t\t\t * Imagick\n\t\t\t\t */\n\t\t\t\t$imagickError = NULL;\n\t\t\t\ttry {\n\t\t\t\t\t$colorStringFormat = '%1$02s%2$02s%3$02s%4$02s';\n\t\t\t\t\t$colorString = sprintf($colorStringFormat, dechex($backgroundColorRed), dechex($backgroundColorGreen), dechex($backgroundColorBlue), dechex($backgroundColorAlpha));\n\t\t\t\t\t$imagickBackgoundColor = new ImagickPixel('#' . $colorString);\n\n\t\t\t\t\t$imagickObj = new Imagick($image->getStoredFilePath());\n\t\t\t\t\t$imagickRotateResult = $imagickObj->rotateImage($imagickBackgoundColor, $degrees);\n\t\t\t\t\tif ($imagickRotateResult) {\n\t\t\t\t\t\t$imagickObj->writeimage($rotatedImage->getStoredFilePath());\n\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * retrieve image infos\n\t\t\t\t\t\t */\n\t\t\t\t\t\t$rotatedImage->file_size = $imagickObj->getImageLength();\n\t\t\t\t\t\t$imagickDimensions = $imagickObj->getImageGeometry();\n\t\t\t\t\t\t$rotatedImage->width = $imagickDimensions['width'];\n\t\t\t\t\t\t$rotatedImage->height = $imagickDimensions['height'];\n\t\t\t\t\t\t$rotatedImage->short = Default_Service_Media::getShort($image->short, $rotatedImage->width, $rotatedImage->height, $rotatedImage->file_size);\n\t\t\t\t\t\t$rotatedImage->save();\n\t\t\t\t\t}\n\t\t\t\t} catch (ImagickException $imagickError) {\n\n\t\t\t\t}\n\n\t\t\t\tif ($imagickError ||\n\t\t\t\t\t!$imagickRotateResult) {\n\n\t\t\t\t\t$rotatedImage->hardDelete();\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\t$imageFile = L8M_Image::fromFile($image->getStoredFilePath());\n\n\t\t\t\tif ($imageFile instanceof L8M_Image_Abstract) {\n\n\t\t\t\t\t$imageFile\n\t\t\t\t\t\t->rotate($degrees, $backgroundColorRed, $backgroundColorGreen, $backgroundColorBlue, $backgroundColorAlpha)\n\t\t\t\t\t\t->save($rotatedImage->getStoredFilePath(), TRUE)\n\t\t\t\t\t;\n\n\t\t\t\t\t/**\n\t\t\t\t\t * retrieve image infos\n\t\t\t\t\t */\n\t\t\t\t\t$rotatedImage->file_size = $imageFile->getFilesize();\n\t\t\t\t\t$rotatedImage->width = $imageFile->getWidth();\n\t\t\t\t\t$rotatedImage->height = $imageFile->getHeight();\n\t\t\t\t\t$rotatedImage->short = Default_Service_Media::getShort($image->short, $rotatedImage->width, $rotatedImage->height, $rotatedImage->file_size);\n\n\t\t\t\t\t/**\n\t\t\t\t\t * save\n\t\t\t\t\t */\n\t\t\t\t\tif (!$imageFile->isErrorOccured()) {\n\t\t\t\t\t\t$rotatedImage->save();\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$rotatedImage->hardDelete();\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\n\t\treturn $rotatedImage;\n\t}", "public function image_rotate_gd()\n\t{\n\t\t// Create the image handle\n\t\tif ( ! ($src_img = $this->image_create_gd()))\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\n\t\t// Set the background color\n\t\t// This won't work with transparent PNG files so we are\n\t\t// going to have to figure out how to determine the color\n\t\t// of the alpha channel in a future release.\n\n\t\t$white = imagecolorallocate($src_img, 255, 255, 255);\n\n\t\t// Rotate it!\n\t\t$dst_img = imagerotate($src_img, $this->rotation_angle, $white);\n\n\t\t// Show the image\n\t\tif ($this->dynamic_output === TRUE)\n\t\t{\n\t\t\t$this->image_display_gd($dst_img);\n\t\t}\n\t\telseif ( ! $this->image_save_gd($dst_img)) // ... or save it\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\n\t\t// Kill the file handles\n\t\timagedestroy($dst_img);\n\t\timagedestroy($src_img);\n\n\t\tchmod($this->full_dst_path, $this->file_permissions);\n\n\t\treturn TRUE;\n\t}", "public function rotateClockwise($angle = 0, $bg_color = array(255, 255, 255)) {\n\t\tif(!$this->image) {\n\t\t\ttrigger_error('The image does not exist or is not readable.', E_USER_WARNING);\n\t\t\treturn false;\n\t\t}\n\t\t$angle = 0 - (float) $angle;\n\t\treturn $this->rotate($angle, $bg_color);\n\t}", "public function getRotation() {}", "public function getRotation() {}", "public function setRotation($rotation) {}", "public function setRotation($rotation) {}", "public function rotation($value) {\n return $this->setProperty('rotation', $value);\n }", "function rotate(&$tmp, $angle, $color=null) {\r\r\n\t\t\r\r\n\t\t// color ?\r\r\n\t\t//\r\r\n\t\tif (!is_a($color, 'Asido_Color')) {\r\r\n\t\t\t$color = new Asido_Color;\r\r\n\t\t\t$color->set(255, 255, 255);\r\r\n\t\t\t}\r\r\n\t\t\r\r\n\t\treturn $this->__rotate($tmp, $angle, $color);\r\r\n\t\t}", "protected function _rotate($img, $rotateDegrees, $dstWidth = null, $dstHeight = null) {\n $degrees = is_numeric($rotateDegrees) ? intval($rotateDegrees) : null;\n if(! is_int($degrees)) {\n $var = Types::getVartype($rotateDegrees);\n throw new Exception\\InvalidArgumentException(\"Invalid overlay rotate degrees value '{$var}'\", MediaConst::E_TYPE_MISMATCH);\n }\n if(abs($degrees) > 360) {\n // $var = Types::getVartype($rotateDegrees);\n // throw new Exception\\InvalidArgumentException(\"Invalid overlay value '{$var}'\", MediaConst::E_INVALID_ROTATE_PARAM);\n }\n $obj = new Rotate();\n $finalImg = $obj->rotate($img, $degrees, $dstWidth, $dstHeight);\n if(false === $finalImg) {\n // T_PHP_FUNCTION_FAILED = image function '%s' failed\n $msg = $phpErrorHandler->getErrorMsg(sprintf(MediaConst::T_PHP_FUNCTION_FAILED, \"imagecopy\"), \"cannot copy overlay image\");\n imagedestroy($img);\n // a PHP image function has failed\n throw new Exception\\RuntimeException($msg, MediaConst::E_PHP_FUNCTION_FAILED);\n }\n return $finalImg;\n }", "protected function adjustImageOrientation()\n { \n $exif = @exif_read_data($this->file);\n \n if($exif && isset($exif['Orientation'])) {\n $orientation = $exif['Orientation'];\n \n if($orientation != 1){\n $img = imagecreatefromjpeg($this->file);\n \n $mirror = false;\n $deg = 0;\n \n switch ($orientation) {\n \n case 2:\n $mirror = true;\n break;\n \n case 3:\n $deg = 180;\n break;\n \n case 4:\n $deg = 180;\n $mirror = true; \n break;\n \n case 5:\n $deg = 270;\n $mirror = true; \n break;\n \n case 6:\n $deg = 270;\n break;\n \n case 7:\n $deg = 90;\n $mirror = true; \n break;\n \n case 8:\n $deg = 90;\n break;\n }\n \n if($deg) $img = imagerotate($img, $deg, 0); \n if($mirror) $img = $this->mirrorImage($img);\n \n $this->image = str_replace('.jpg', \"-O$orientation.jpg\", $this->file); \n imagejpeg($img, $this->file, $this->quality);\n }\n }\n }", "function rotate ($arr)\n{//rotate function is called in the right sidebar - an example of rotation (on day of month)\n\tif(is_array($arr))\n\t{//Generate item in array using date and modulus of count of the array\n\t\treturn $arr[((int)date(\"j\")) % count($arr)];\n\t}else{\n\t\treturn $arr;\n\t}\n}", "function rotate ($arr)\n{//rotate function is called in the right sidebar - an example of rotation (on day of month)\n\tif(is_array($arr))\n\t{//Generate item in array using date and modulus of count of the array\n\t\treturn $arr[((int)date(\"j\")) % count($arr)];\n\t}else{\n\t\treturn $arr;\n\t}\n}", "private function imagerotate($srcImg, $angle, $bgColor, $ignoreTransparent=0) {\n\t\tfunction rotateX($x, $y, $theta) {\n\t\t\treturn $x * cos($theta) - $y * sin($theta);\n\t\t}\n\t\tfunction rotateY($x, $y, $theta) {\n\t\t\treturn $x * sin($theta) + $y * cos($theta);\n\t\t}\n\n\t\t$srcW = imagesx($srcImg);\n\t\t$srcH = imagesy($srcImg);\n\n\t\t// Normalize angle\n\t\t$angle %= 360;\n\n\t\tif ($angle == 0) {\n\t\t\tif ($ignoreTransparent == 0) {\n\t\t\t\timagesavealpha($srcImg, true);\n\t\t\t}\n\t\t\treturn $srcImg;\n\t\t}\n\n\t\t// Convert the angle to radians\n\t\t$theta = deg2rad($angle);\n\n\t\t$minX = $maxX = $minY = $maxY = 0;\n\t\t\n\t\t// Standard case of rotate\n\t\tif ((abs($angle) == 90) || (abs($angle) == 270)) {\n\t\t\t$width = $srcH;\n\t\t\t$height = $srcW;\n\t\t\tif (($angle == 90) || ($angle == -270)) {\n\t\t\t\t$minX = 0;\n\t\t\t\t$maxX = $width;\n\t\t\t\t$minY = -$height+1;\n\t\t\t\t$maxY = 1;\n\t\t\t} else if (($angle == -90) || ($angle == 270)) {\n\t\t\t\t$minX = -$width+1;\n\t\t\t\t$maxX = 1;\n\t\t\t\t$minY = 0;\n\t\t\t\t$maxY = $height;\n\t\t\t}\n\t\t} else if (abs($angle) === 180) {\n\t\t\t$width = $srcW;\n\t\t\t$height = $srcH;\n\t\t\t$minX = -$width+1;\n\t\t\t$maxX = 1;\n\t\t\t$minY = -$height+1;\n\t\t\t$maxY = 1;\n\t\t} else {\n\t\t\t// Calculate the width of the destination image\n\t\t\t$temp = array(\n\t\t\t\trotateX(0, 0, 0-$theta),\n\t\t\t\trotateX($srcW, 0, 0-$theta),\n\t\t\t\trotateX(0, $srcH, 0-$theta),\n\t\t\t\trotateX($srcW, $srcH, 0-$theta),\n\t\t\t);\n\t\t\t$minX = floor(min($temp));\n\t\t\t$maxX = ceil(max($temp));\n\t\t\t$width = $maxX - $minX;\n\n\t\t\t// Calculate the height of the destination image\n\t\t\t$temp = array(\n\t\t\t\trotateY(0, 0, 0-$theta),\n\t\t\t\trotateY($srcW, 0, 0-$theta),\n\t\t\t\trotateY(0, $srcH, 0-$theta),\n\t\t\t\trotateY($srcW, $srcH, 0-$theta),\n\t\t\t);\n\t\t\t$minY = floor(min($temp));\n\t\t\t$maxY = ceil(max($temp));\n\t\t\t$height = $maxY - $minY;\n\t\t}\n\n\t\t$destImg = imagecreatetruecolor($width, $height);\n\t\tif ($ignoreTransparent == 0) {\n\t\t\timagefill($destImg, 0, 0, imagecolorallocatealpha($destImg, 255,255, 255, 127));\n\t\t\timagesavealpha($destImg, true);\n\t\t}\n\n\t\t// Sets all pixels in the new image\n\t\tfor ($x = $minX; $x < $maxX; $x++) {\n\t\t\tfor ($y = $minY; $y < $maxY; $y++) {\n\t\t\t\t// Fetch corresponding pixel from the source image\n\t\t\t\t$srcX = round(rotateX($x, $y, $theta));\n\t\t\t\t$srcY = round(rotateY($x, $y, $theta));\n\t\t\t\tif ($srcX >= 0 && $srcX < $srcW && $srcY >= 0 && $srcY < $srcH) {\n\t\t\t\t\t$color = imagecolorat($srcImg, $srcX, $srcY);\n\t\t\t\t} else {\n\t\t\t\t\t$color = $bgColor;\n\t\t\t\t}\n\t\t\t\timagesetpixel($destImg, $x-$minX, $y-$minY, $color);\n\t\t\t}\n\t\t}\n\n\t\treturn $destImg;\n\t}", "public function test_remove_orientation_data_on_rotate() {\n\t\t$file = DIR_TESTDATA . '/images/test-image-upside-down.jpg';\n\t\t$data = wp_read_image_metadata( $file );\n\n\t\t// The orientation value 3 is equivalent to rotated upside down (180 degrees).\n\t\t$this->assertSame( 3, intval( $data['orientation'] ), 'Orientation value read from does not match image file Exif data: ' . $file );\n\n\t\t$temp_file = wp_tempnam( $file );\n\t\t$image = wp_get_image_editor( $file );\n\n\t\t// Test a value that would not lead back to 1, as WP is resetting the value to 1 manually.\n\t\t$image->rotate( 90 );\n\t\t$ret = $image->save( $temp_file, 'image/jpeg' );\n\n\t\t$data = wp_read_image_metadata( $ret['path'] );\n\n\t\t// Make sure the image is no longer in The Upside Down Exif orientation.\n\t\t$this->assertSame( 1, intval( $data['orientation'] ), 'Orientation Exif data was not updated after rotating image: ' . $file );\n\n\t\t// Remove both the generated file ending in .tmp and tmp.jpg due to wp_tempnam().\n\t\tunlink( $temp_file );\n\t\tunlink( $ret['path'] );\n\t}", "public function __invoke($sourceImg = null, $angle = null) {\n if(null !== $sourceImg) {\n return $this->rotate($sourceImg, $angle);\n }\n return $this;\n }", "function RotatedText($x,$y,$txt,$angle)\n{\n $this->Rotate($angle,$x,$y);\n $this->Text($x,$y,$txt);\n $this->Rotate(0);\n}", "function RotatedText($x,$y,$txt,$angle)\n{\n $this->Rotate($angle,$x,$y);\n $this->Text($x,$y,$txt);\n $this->Rotate(0);\n}", "function RotatedText($x, $y, $txt, $angle)\n{\n $this->Rotate($angle,$x,$y);\n $this->Text($x,$y,$txt);\n $this->Rotate(0);\n}", "public function rotateCounterclockwise($angle = 0, $bg_color = array(255, 255, 255)) {\n\t\tif(!$this->image) {\n\t\t\ttrigger_error('The image does not exist or is not readable.', E_USER_WARNING);\n\t\t\treturn false;\n\t\t}\n\t\treturn $this->rotate($angle, $bg_color);\n\t}", "function matrixRotation($matrix, $r) {\n for($i = 0; $i < (min(count($matrix), count($matrix[0])) / 2); $i++)\n {\n $layerLength = getLayerLength($matrix, $i);\n $matrix = rotateLayer($matrix, $i, $r % $layerLength);\n }\n\n return $matrix;\n}", "public function rotate($value='random', $bgColor='ffffff')\n\t{\n\t\t$this->checkImage();\n\t\tif ($value == 'random') {\n\t\t\t$value = mt_rand(-6, 6);\n\t\t} else {\n\t\t\t$value = max(-360, min($value, 360));\n\t\t}\n\t\tif ($value < 0) {\n\t\t\t$value = 360 + $value;\n\t\t}\n\n\t\tif ($bgColor == 'alpha' && function_exists('imagerotate')) {\n\t\t\t// Experimental. GD2 imagerotate seems to be quite buggy with alpha transparency.\n\t\t\timagealphablending($this->imageResized, false);\n\t\t\t$color = imagecolorallocatealpha($this->imageResized, 255, 255, 255, 127);\n\t\t\timagecolortransparent($this->imageResized, $color);\n\t\t\t$this->imageResized = imagerotate($this->imageResized, $value, $color);\n\t\t\timagesavealpha($this->imageResized, true);\n\t\t} else {\n\t\t\t$bgColor = str_replace('#', '', strtoupper(trim($bgColor)));\n\t\t\t$color = hexdec($bgColor);\n\t\t\tif (function_exists('imagerotate')) {\n\t\t\t\t$this->imageResized = imagerotate($this->imageResized, $value, $color);\n\t\t\t} else {\n\t\t\t\t$this->imageResized = $this->imagerotate($this->imageResized, $value, $color);\n\t\t\t}\n\t\t}\n\n\t\treturn $this;\n\t}", "public function rotate($angle)\n {\n $this->setForceAlpha(true);\n $this\n ->addConvertOption('background', 'none')\n ->addConvertOption('alpha', 'set')\n ->addConvertOption('rotate', $angle);\n\n //an image size has changed after the rotate action, it's required to save it and reinit resource\n $this->saveIfRequired('after_rotate');\n $this->resource = null;\n $this->initResource();\n\n return $this;\n }", "function image_fix_orientation($path){\n\t\t$exif = exif_read_data($path);\n\n\t\t//fix the Orientation if EXIF data exist\n\t\tif(!empty($exif['Orientation'])) {\n\t\t switch($exif['Orientation']) {\n\t\t case 8:\n\t\t $createdImage = imagerotate($image,90,0);\n\t\t break;\n\t\t case 3:\n\t\t $createdImage = imagerotate($image,180,0);\n\t\t break;\n\t\t case 6:\n\t\t $createdImage = imagerotate($image,-90,0);\n\t\t break;\n\t\t }\n\t\t}\n\t}", "public function autoRotate() {\n $this->thumb->rotateJpg();\n return $this;\n }", "function RotatedText($x, $y, $txt, $angle){\r $this->Rotate($angle,$x,$y);\r $this->Text($x,$y,$txt);\r $this->Rotate(0);\r }", "function RotatedText($x, $y, $txt, $angle)\r\r\n{\r\r\n\t$this->Rotate($angle,$x,$y);\r\r\n\t$this->Text($x,$y,$txt);\r\r\n\t$this->Rotate(0);\r\r\n}", "function fixImageOrientation($filename) \n{\n\t$exif = @exif_read_data($filename);\n\t \n\tif($exif) \n\t{ \n\t\t//fix the Orientation if EXIF data exists\n\t\tif(!empty($exif['Orientation'])) \n\t\t{\n\t\t\tswitch($exif['Orientation']) \n\t\t\t{\n\t\t\t\tcase 3:\n\t\t\t\t$createdImage = imagerotate($filename,180,0);\n\t\t\t\tbreak;\n\t\t\t\tcase 6:\n\t\t\t\t$createdImage = imagerotate($filename,-90,0);\n\t\t\t\tbreak;\n\t\t\t\tcase 8:\n\t\t\t\t$createdImage = imagerotate($filename,90,0);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t} \n}", "function rotation($angle)\n\t{\n\t\t$this->rotation = $angle;\n\t\treturn $this;\n\t}", "function fix_orientation($fileandpath) { if(!file_exists($fileandpath))\n return false;\n try {\n @$exif = read_exif_data($fileandpath, 'IFD0');\n }\n catch (Exception $exp) {\n $exif = false;\n }\n // Get all the exif data from the file\n // If we dont get any exif data at all, then we may as well stop now\n if(!$exif || !is_array($exif))\n return false;\n\n // I hate case juggling, so we're using loweercase throughout just in case\n $exif = array_change_key_case($exif, CASE_LOWER);\n\n // If theres no orientation key, then we can give up, the camera hasn't told us the\n // orientation of itself when taking the image, and i'm not writing a script to guess at it!\n if(!array_key_exists('orientation', $exif))\n return false;\n\n // Gets the GD image resource for loaded image\n $img_res = $this->get_image_resource($fileandpath);\n\n // If it failed to load a resource, give up\n if(is_null($img_res))\n return false;\n\n // The meat of the script really, the orientation is supplied as an integer,\n // so we just rotate/flip it back to the correct orientation based on what we\n // are told it currently is\n\n switch($exif['orientation']) {\n\n // Standard/Normal Orientation (no need to do anything, we'll return true as in theory, it was successful)\n case 1: return true; break;\n\n // Correct orientation, but flipped on the horizontal axis (might do it at some point in the future)\n case 2:\n $final_img = $this->imageflip($img_res, IMG_FLIP_HORIZONTAL);\n break;\n\n // Upside-Down\n case 3:\n $final_img = $this->imageflip($img_res, IMG_FLIP_VERTICAL);\n break;\n\n // Upside-Down & Flipped along horizontal axis\n case 4:\n $final_img = $this->imageflip($img_res, IMG_FLIP_BOTH);\n break;\n\n // Turned 90 deg to the left and flipped\n case 5:\n $final_img = imagerotate($img_res, -90, 0);\n $final_img = $this->imageflip($img_res, IMG_FLIP_HORIZONTAL);\n break;\n\n // Turned 90 deg to the left\n case 6:\n $final_img = imagerotate($img_res, -90, 0);\n break;\n\n // Turned 90 deg to the right and flipped\n case 7:\n $final_img = imagerotate($img_res, 90, 0);\n $final_img = $this->imageflip($img_res,IMG_FLIP_HORIZONTAL);\n break;\n\n // Turned 90 deg to the right\n case 8:\n $final_img = imagerotate($img_res, 90, 0);\n break;\n\n }\n if(!isset($final_img))\n return false;\n if (!is_writable($fileandpath)) {\n chmod($fileandpath, 0777);\n }\n unlink($fileandpath);\n\n // Save it and the return the result (true or false)\n $done = $this->save_image_resource($final_img,$fileandpath);\n\n return $done;\n }", "function processImage($image, $filename, $filetype, $keywords, $name, $descr, $rotate, $degrees = 0, $ignoresizes = 0) {\r\n global $mosConfig_absolute_path, $zoom;\r\n // reset script execution time limit (as set in MAX_EXECUTION_TIME ini directive)...\r\n // requires SAFE MODE to be OFF!\r\n if (ini_get('safe_mode') != 1 ) {\r\n set_time_limit(0);\r\n }\r\n $imagepath = $zoom->_CONFIG['imagepath'];\r\n $catdir = $zoom->_gallery->getDir();\r\n $filename = urldecode($filename);\r\n\t\t// replace every space-character with a single \"_\"\r\n\t\t$filename = ereg_replace(\" \", \"_\", $filename);\r\n\t\t$filename = stripslashes($filename);\r\n $filename = ereg_replace(\"'\", \"_\", $filename);\r\n // Get rid of extra underscores\r\n $filename = ereg_replace(\"_+\", \"_\", $filename);\r\n $filename = ereg_replace(\"(^_|_$)\", \"\", $filename);\r\n $zoom->checkDuplicate($filename, 'filename');\r\n $filename = $zoom->_tempname;\r\n // replace space-characters in combination with a comma with 'air'...or nothing!\r\n $keywords = $zoom->cleanString($keywords);\r\n //$keywords = $zoom->htmlnumericentities($keywords);\r\n\t\t$name = $zoom->cleanString($name);\r\n //$name = $zoom->htmlnumericentities($name);\r\n //$descr = $zoom->cleanString($descr);\r\n //$descr = $zoom->htmlnumericentities($descr);\r\n if (empty($name)) {\r\n $name = $zoom->_CONFIG['tempName'];\r\n }\r\n $imgobj = new image(0); //create a new image object with a foo imgid\r\n $imgobj->setImgInfo($filename, $name, $keywords, $descr, $zoom->_gallery->_id, $zoom->currUID, 1, 1);\r\n $imgobj->getMimeType($filetype, $image);\r\n unset($filename, $name, $keywords, $descr); //clear memory, just in case...\r\n if (!$zoom->acceptableSize($image)) {\r\n \t// the file is simply too big, register this...\r\n $this->_err_num++;\r\n $this->_err_names[$this->_err_num] = $imgobj->_filename;\r\n $this->_err_types[$this->_err_num] = sprintf(_ZOOM_ALERT_TOOBIG, $zoom->_CONFIG['maxsizekb'].'kB');\r\n return false;\r\n }\r\n /* IMPORTANT CHEATSHEET:\r\n\t * If we don't get useful data from that or its a type we don't\r\n\t * recognize, take a swing at it using the file name.\r\n\t if ($mimeType == 'application/octet-stream' ||\r\n\t\t $mimeType == 'application/unknown' ||\r\n\t\t GalleryCoreApi::convertMimeToExtension($mimeType) == null) {\r\n\t\t$extension = GalleryUtilities::getFileExtension($file['name']);\r\n\t\t$mimeType = GalleryCoreApi::convertExtensionToMime($extension);\r\n\t }\r\n\t */\r\n if ($zoom->acceptableFormat($imgobj->getMimeType(), true)) {\r\n // File is an image/ movie/ document...\r\n $file = \"$mosConfig_absolute_path/$imagepath$catdir/\".$imgobj->_filename;\r\n $desfile = \"$mosConfig_absolute_path/$imagepath$catdir/thumbs/\".$imgobj->_filename;\r\n if (is_uploaded_file($image)) {\r\n if (!move_uploaded_file(\"$image\", $file)) {\r\n // some error occured while moving file, register this...\r\n $this->_err_num++;\r\n $this->_err_names[$this->_err_num] = $imgobj->_filename;\r\n $this->_err_types[$this->_err_num] = _ZOOM_ALERT_MOVEFAILURE;\r\n return false;\r\n }\r\n } elseif (!$zoom->platform->copy(\"$image\", $file) && !$zoom->platform->file_exists($file)) {\r\n // some error occured while moving file, register this...\r\n $this->_err_num++;\r\n $this->_err_names[$this->_err_num] = $imgobj->_filename;\r\n $this->_err_types[$this->_err_num] = _ZOOM_ALERT_MOVEFAILURE;\r\n return false;\r\n }\r\n @$zoom->platform->chmod($file, '0777');\r\n $viewsize = $mosConfig_absolute_path.\"/\".$imagepath.$catdir.\"/viewsize/\".$imgobj->_filename;\r\n if ($zoom->acceptableFormat($imgobj->getMimeType(), true)) {\r\n\t if ($zoom->isImage($imgobj->getMimeType(), true)) {\r\n\t\t\t\t\t$imgobj->_size = $zoom->platform->getimagesize($file);\r\n\t // get image EXIF & IPTC data from file to save it in viewsize image and get a thumbnail...\r\n\t if ($zoom->_CONFIG['readEXIF'] && ($imgobj->_type === \"jpg\" || $imgobj->_type === \"jpeg\") && !(bool)ini_get('safe_mode')) {\r\n\t // Retreive the EXIF, XMP and Photoshop IRB information from\r\n\t // the existing file, so that it can be updated later on...\r\n\t $jpeg_header_data = get_jpeg_header_data($file);\r\n\t $EXIF_data = get_EXIF_JPEG($file);\r\n\t $XMP_data = read_XMP_array_from_text( get_XMP_text( $jpeg_header_data ) );\r\n\t $IRB_data = get_Photoshop_IRB( $jpeg_header_data );\r\n\t $new_ps_file_info = get_photoshop_file_info($EXIF_data, $XMP_data, $IRB_data);\r\n\t // Check if there is a default for the date defined\r\n\t if ((!array_key_exists('date', $new_ps_file_info)) || ((array_key_exists('date', $new_ps_file_info)) && ($new_ps_file_info['date'] == ''))) {\r\n\t // No default for the date defined\r\n\t // figure out a default from the file\r\n\t // Check if there is a EXIF Tag 36867 \"Date and Time of Original\"\r\n\t if (($EXIF_data != FALSE) && (array_key_exists(0, $EXIF_data)) && (array_key_exists(34665, $EXIF_data[0])) && (array_key_exists(0, $EXIF_data[0][34665])) && (array_key_exists(36867, $EXIF_data[0][34665][0]))) {\r\n\t // Tag \"Date and Time of Original\" found - use it for the default date\r\n\t $new_ps_file_info['date'] = $EXIF_data[0][34665][0][36867]['Data'][0];\r\n\t $new_ps_file_info['date'] = preg_replace( \"/(\\d\\d\\d\\d):(\\d\\d):(\\d\\d)( \\d\\d:\\d\\d:\\d\\d)/\", \"$1-$2-$3\", $new_ps_file_info['date'] );\r\n\t } elseif (($EXIF_data != FALSE) && (array_key_exists(0, $EXIF_data)) && (array_key_exists(34665, $EXIF_data[0])) && (array_key_exists(0, $EXIF_data[0][34665])) && (array_key_exists(36868, $EXIF_data[0][34665][0]))) {\r\n\t // Check if there is a EXIF Tag 36868 \"Date and Time when Digitized\"\r\n\t // Tag \"Date and Time when Digitized\" found - use it for the default date\r\n\t $new_ps_file_info['date'] = $EXIF_data[0][34665][0][36868]['Data'][0];\r\n\t $new_ps_file_info['date'] = preg_replace( \"/(\\d\\d\\d\\d):(\\d\\d):(\\d\\d)( \\d\\d:\\d\\d:\\d\\d)/\", \"$1-$2-$3\", $new_ps_file_info['date'] );\r\n\t } else if ( ( $EXIF_data != FALSE ) && (array_key_exists(0, $EXIF_data)) && (array_key_exists(306, $EXIF_data[0]))) {\r\n\t // Check if there is a EXIF Tag 306 \"Date and Time\"\r\n\t // Tag \"Date and Time\" found - use it for the default date\r\n\t $new_ps_file_info['date'] = $EXIF_data[0][306]['Data'][0];\r\n\t $new_ps_file_info['date'] = preg_replace( \"/(\\d\\d\\d\\d):(\\d\\d):(\\d\\d)( \\d\\d:\\d\\d:\\d\\d)/\", \"$1-$2-$3\", $new_ps_file_info['date'] );\r\n\t } else {\r\n\t // Couldn't find an EXIF date in the image\r\n\t // Set default date as creation date of file\r\n\t $new_ps_file_info['date'] = date (\"Y-m-d\", filectime( $file ));\r\n\t }\r\n\t }\r\n\t }\r\n\t // First, rotate the image (if that's mentioned in the 'job description')...\r\n\t\t if ($rotate) {\r\n\t\t\t\t\t\t$tmpdir = $mosConfig_absolute_path.\"/\".$zoom->createTempDir();\r\n\t\t\t\t\t\t$new_source = $tmpdir.\"/\".$imgobj->_filename;\r\n\t\t\t\t\t\tif (!$this->rotateImage($file, $new_source, $degrees, $imgobj)) {\r\n\t $this->_err_num++;\r\n\t $this->_err_names[$this->_err_num] = $imgobj->_filename;\r\n\t $this->_err_types[$this->_err_num] = \"Error rotating image\";\r\n\t return false;\r\n\t } else {\r\n\t\t\t\t\t\t\t@$zoom->platform->unlink($file);\r\n\t\t\t\t\t\t\tif ($zoom->platform->copy($new_source, $file)) {\r\n\t\t\t\t\t\t\t\t$imgobj->_size = $zoom->platform->getimagesize($file);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t }\r\n\t // resize to thumbnail...\r\n\t // 1-31-2006: fix #0000151\r\n\t if (!$zoom->platform->file_exists($desfile)) {\r\n\t \tif (!$this->resizeImage($file, $desfile, $zoom->_CONFIG['size'], $imgobj)) {\r\n\t\t $this->_err_num++;\r\n\t\t $this->_err_names[$this->_err_num] = $imgobj->_filename;\r\n\t\t $this->_err_types[$this->_err_num] = _ZOOM_ALERT_IMGERROR;\r\n\t\t return false;\r\n\t\t }\r\n\t }\r\n\t \r\n\t // if the image size is greater than the given maximum: resize it!\r\n\t if (!$zoom->platform->file_exists($viewsize)) {\r\n\t\t //If the image is larger than the max size\r\n\t\t\t\t\t\tif (($imgobj->_size[0] > $zoom->_CONFIG['maxsize'] || $imgobj->_size[1] > $zoom->_CONFIG['maxsize']) && !$ignoresizes) {\r\n\t\t //Resizes the file. If successful, continue\r\n\t\t\t\t\t\t\tif ($this->resizeImage($file, $viewsize, $zoom->_CONFIG['maxsize'], $imgobj)) {\r\n\t\t\t\t\t\t\t\t//Watermark?\r\n\t\t\t\t\t\t\t\tif ((bool)$zoom->_CONFIG['wm_apply']) {\r\n\t\t\t\t\t\t\t\t\t//Watermark. Return errors if not successuful\r\n\t\t\t\t\t\t\t\t\tif (!$this->watermarkImage($viewsize, $viewsize, $imgobj)) {\r\n\t\t\t\t\t\t\t\t\t\t$this->_err_num++;\r\n\t\t\t\t\t\t\t\t\t\t$this->_err_names[$this->_err_num] = $imgobj->_filename;\r\n\t\t\t\t\t\t\t\t\t\t$this->_err_types[$this->_err_num] = _ZOOM_ALERT_WATERMARKERROR;\r\n\t\t\t\t\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t } else {\r\n\t\t $this->_err_num++;\r\n\t\t $this->_err_names[$this->_err_num] = $imgobj->_filename;\r\n\t\t $this->_err_types[$this->_err_num] = _ZOOM_ALERT_IMGERROR;\r\n\t\t return false;\r\n\t\t }\r\n\t\t } else {\r\n\t\t //Watermark?\r\n\t\t\t\t\t\t\tif ((bool)$zoom->_CONFIG['wm_apply']) {\r\n\t\t\t\t\t\t\t\t//Watermark. Return errors if not successuful\r\n\t\t\t\t\t\t\t\tif (!$this->watermarkImage($file, $file, $imgobj)) {\r\n\t\t\t\t\t\t\t\t\t$this->_err_num++;\r\n\t\t\t\t\t\t\t\t\t$this->_err_names[$this->_err_num] = $imgobj->_filename;\r\n\t\t\t\t\t\t\t\t\t$this->_err_types[$this->_err_num] = _ZOOM_ALERT_WATERMARKERROR;\r\n\t\t\t\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t }\r\n\t }\r\n\t } elseif ($zoom->isDocument($imgobj->getMimeType(), true)) {\r\n\t if ($zoom->isIndexable($imgobj->getMimeType(), true) && $this->_use_PDF) {\r\n\t if (!$this->indexDocument($file, $imgobj->_filename)) {\r\n\t $this->_err_num++;\r\n\t $this->_err_names[$this->_err_num] = $imgobj->_filename;\r\n\t $this->_err_types[$this->_err_num] = _ZOOM_ALERT_INDEXERROR;\r\n\t return false;\r\n\t }\r\n\t } else {\r\n\t \tif($zoom->platform->copy($file, $viewsize)) {\r\n\t \t\tif ((bool)$zoom->_CONFIG['wm_apply']) {\r\n\t\t\t\t\t\t\t\t// put a watermark on the source image...\r\n\t\t\t\t\t\t\t\tif (!$this->watermarkImage($viewsize, $viewsize, $imgobj)) {\r\n\t\t\t\t\t\t\t\t\t$this->_err_num++;\r\n\t\t\t\t\t\t\t\t\t\t$this->_err_names[$this->_err_num] = $imgobj->_filename;\r\n\t\t\t\t\t\t\t\t\t\t$this->_err_types[$this->_err_num] = _ZOOM_ALERT_WATERMARKERROR;\r\n\t\t\t\t\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t \t} else {\r\n\t\t\t\t\t\t\t// some error occured while moving file, register this...\r\n\t\t\t\t\t\t\t$this->_err_num++;\r\n\t\t\t\t\t\t\t$this->_err_names[$this->_err_num] = $imgobj->_filename;\r\n\t\t\t\t\t\t\t$this->_err_types[$this->_err_num] = _ZOOM_ALERT_MOVEFAILURE;\r\n\t\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t\t}\r\n\t \t}\r\n\t } elseif ($zoom->isMovie($imgobj->getMimeType(), true)) {\r\n\t //if movie is 'thumbnailable' -> make a thumbnail then!\r\n\t if ($zoom->isThumbnailable($imgobj->_type) && $this->_use_FFMPEG) {\r\n\t if (!$this->createMovieThumb($file, $zoom->_CONFIG['size'], $imgobj->_filename)) {\r\n\t $this->_err_num++;\r\n\t $this->_err_names[$this->_err_num] = $imgobj->_filename;\r\n\t $this->_err_types[$this->_err_num] = _ZOOM_ALERT_IMGERROR;\r\n\t return false;\r\n\t }\r\n\t }\r\n\t } elseif ($zoom->isAudio($imgobj->getMimeType(), true)) {\r\n\t // TODO: indexing audio files (mp3-files, etc.) properties, e.g. id3vX tags...\r\n\t }\r\n\t if (!$imgobj->save()) {\r\n\t $this->_err_num++;\r\n\t $this->_err_names[$this->_err_num] = $imgobj->_filename;\r\n\t $this->_err_types[$this->_err_num] = \"Database failure\";\r\n\t }\r\n\t }\r\n } else {\r\n //Not the right format, register this...\r\n $this->_err_num++;\r\n $this->_err_names[$this->_err_num] = $imgobj->_filename;\r\n $this->_err_types[$this->_err_num] = _ZOOM_ALERT_WRONGFORMAT_MULT;\r\n return false;\r\n }\r\n return true;\r\n }", "public function getRotateControl()\n {\n return $this->rotateControl;\n }", "public function applyFilter(Image $image)\n {\n // transparent background if possible\n\n $mirror = strpos($this->rotation, '!') === false ? false : true;\n $rotation = $mirror ? substr($this->rotation, 1) : $this->rotation;\n if ($mirror) {\n $image->flip('h');\n }\n\n return $image->rotate(-$rotation);\n }", "public function rotate_bitmap($bitmap,$width,$height,$degree) \r\n { \r\n $c=cos(deg2rad($degree)); \r\n $s=sin(deg2rad($degree)); \r\n\r\n $newHeight=round($width*$s+$height*$c); \r\n $newWidth=round($width*$c + $height*$s); \r\n $x0 = $width/2 - $c*$newWidth/2 - $s*$newHeight/2; \r\n $y0 = $height/2 - $c*$newHeight/2 + $s*$newWidth/2; \r\n $result=array(); \r\n for ($j=0;$j<$newHeight;++$j) \r\n for ($i=0;$i<$newWidth;++$i) \r\n { \r\n $y=-$s*$i+$c*$j+$y0; \r\n $x=$c*$i+$s*$j+$x0; \r\n if (isset($bitmap[$y][$x])) \r\n $result[$j][$i]=$bitmap[$y][$x]; \r\n } \r\n return array($result,$newWidth,$newHeight); \r\n }", "function orientation_check($file_path, $prefs)\n\t{\n\t\tif ( ! function_exists('exif_read_data'))\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\t// Not all images are supported\n\t\t$exif = @exif_read_data($file_path);\n\n\t\tif ( ! $exif OR ! isset($exif['Orientation']))\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\t$orientation = $exif['Orientation'];\n\n\t\tif ($orientation == 1)\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\t// Image is rotated, let's see by how much\n\t\t$deg = 0;\n\n\t\tswitch ($orientation) {\n\t\t\tcase 3:\n\t\t\t\t$deg = 180;\n\t\t\t\tbreak;\n\t\t\tcase 6:\n\t\t\t\t$deg = 270;\n\t\t\t\tbreak;\n\t\t\tcase 8:\n\t\t\t\t$deg = 90;\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif ($deg)\n\t\t{\n\t\t\tee()->load->library('image_lib');\n\n\t\t\tee()->image_lib->clear();\n\n\t\t\t// Set required memory\n\t\t\ttry\n\t\t\t{\n\t\t\t\tee('Memory')->setMemoryForImageManipulation($file_path);\n\t\t\t}\n\t\t\tcatch (\\Exception $e)\n\t\t\t{\n\t\t\t\tlog_message('error', $e->getMessage().': '.$file_path);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t$config = array(\n\t\t\t\t'rotation_angle'\t=> $deg,\n\t\t\t\t'library_path'\t\t=> ee()->config->item('image_library_path'),\n\t\t\t\t'image_library'\t\t=> ee()->config->item('image_resize_protocol'),\n\t\t\t\t'source_image'\t\t=> $file_path\n\t\t\t);\n\n\t\t\tee()->image_lib->initialize($config);\n\n\t\t\tif ( ! ee()->image_lib->rotate())\n\t\t\t{\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t$new_image = ee()->image_lib->get_image_properties('', TRUE);\n\t\t\tee()->image_lib->clear();\n\n\t\t\t// We need to reset some prefs\n\t\t\tif ($new_image)\n\t\t\t{\n\t\t\t\tee()->load->helper('number');\n\t\t\t\t$f_size = get_file_info($file_path);\n\t\t\t\t$prefs['file_height'] = $new_image['height'];\n\t\t\t\t$prefs['file_width'] = $new_image['width'];\n\t\t\t\t$prefs['file_hw_original'] = $new_image['height'].' '.$new_image['width'];\n\t\t\t\t$prefs['height'] = $new_image['height'];\n\t\t\t\t$prefs['width'] = $new_image['width'];\n\t\t\t}\n\n\t\t\treturn $prefs;\n\t\t}\n\t}", "public function rotatePageImage($pageId, $rotate)\n {\n # PUT /accounts/{accountId}/envelopes/{envelopeId}/documents/{documentId}/pages/{pageId}/page_image\n }", "function setImageOrientation()\n\t{\n\n\t\tif ($this->width < $this->height) {\n\t\t\t$this->orientation = 'portrait';\n\t\t}\n\n\t\tif ($this->width > $this->height) {\n\t\t\t$this->orientation = 'landscape';\n\t\t}\n\n\t\tif ($this->width == $this->height) {\n\t\t\t$this->orientation = 'square';\n\t\t}\n\t}", "function RotatedText($x, $y, $txt, $angle)\n{\n\t$this->Rotate($angle,$x,$y);\n\t$this->Text($x,$y,$txt);\n\t$this->Rotate(0);\n}", "public function rotate($theta_)\n\t{\n\t\t$x = $this->x*cos($theta_) - $this->y*sin($theta_);\n\t\t$y = $this->x*sin($theta_) + $this->y*cos($theta_);\n\t\t\n\t\t$this->setX($x);\n\t\t$this->setY($y);\n\t}", "public function ieditor_rotate ($sImagePath) {\n\n\t\t\t/**\n\t\t\t * UMIRU CUSTOM - START\n\t\t\t */\n\t\t\ttry {\n\t\t\t\t$oImagemagic = $this->getImageMagic();\n\t\t\t\tif (!$oImagemagic->rotate($sImagePath)) {\n\t\t\t\t\tthrow new Exception('Failed to rotate image by ImageMagic');\n\t\t\t\t}\n\t\t\t\t$this->deleteOriginalImages($sImagePath);\n\t\t\t\treturn str_replace(CURRENT_WORKING_DIR, '', $sImagePath);\n\t\t\t} catch (Exception $e) {}\n\t\t\t/**\n\t\t\t * UMIRU CUSTOM - END\n\t\t\t */\n\n\t\t\t$oImage = new umiImageFile($sImagePath);\n\t\t\ttry {\n\t\t\t\t$oImage->rotate();\n\t\t\t\t$this->deleteOriginalImages($sImagePath);\n\t\t\t} catch (coreException $e) {\n\t\t\t\treturn \"\";\n\t\t\t}\n\t\t\treturn $oImage->getFilePath(true);\n\t\t}", "function image_mirror_gd()\n\t{\t\t\n\t\tif ( ! $src_img = $this->image_create_gd())\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\t\t\n\t\t$width = $this->src_width;\n\t\t$height = $this->src_height;\n\n\t\tif ($this->rotation == 'hor')\n\t\t{\n\t\t\tfor ($i = 0; $i < $height; $i++)\n\t\t\t{\t\t \n\t\t\t\t$left = 0; \n\t\t\t\t$right = $width-1; \n\t\n\t\t\t\twhile ($left < $right)\n\t\t\t\t{ \n\t\t\t\t\t$cl = imagecolorat($src_img, $left, $i); \n\t\t\t\t\t$cr = imagecolorat($src_img, $right, $i);\n\t\t\t\t\t\n\t\t\t\t\timagesetpixel($src_img, $left, $i, $cr); \n\t\t\t\t\timagesetpixel($src_img, $right, $i, $cl); \n\t\t\t\t\t\n\t\t\t\t\t$left++; \n\t\t\t\t\t$right--; \n\t\t\t\t} \n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfor ($i = 0; $i < $width; $i++)\n\t\t\t{\t\t \n\t\t\t\t$top = 0; \n\t\t\t\t$bot = $height-1; \n\t\n\t\t\t\twhile ($top < $bot)\n\t\t\t\t{ \n\t\t\t\t\t$ct = imagecolorat($src_img, $i, $top);\n\t\t\t\t\t$cb = imagecolorat($src_img, $i, $bot);\n\t\t\t\t\t\n\t\t\t\t\timagesetpixel($src_img, $i, $top, $cb); \n\t\t\t\t\timagesetpixel($src_img, $i, $bot, $ct); \n\t\t\t\t\t\n\t\t\t\t\t$top++; \n\t\t\t\t\t$bot--; \n\t\t\t\t} \n\t\t\t}\t\t\n\t\t}\n\t\t\n\t\t/** ---------------------------------\n\t\t/** Save the Image\n\t\t/** ---------------------------------*/\n\t\tif ( ! $this->image_save_gd($src_img))\n\t\t{\t\t\n\t\t\treturn FALSE;\n\t\t}\n\t\t\n\t\t/** ---------------------------------\n\t\t/** Kill the file handles\n\t\t/** ---------------------------------*/\n\t\timagedestroy($src_img);\n\t\t\n\t\t// Set the file to 777\n\t\t@chmod($this->full_dst_path, FILE_WRITE_MODE);\t\t\t\n\t\t\n\t\treturn TRUE;\n\t}", "protected function fix_image_orientation( $filename, $filecontent ) {\r\n\t\t\t$data = exif_read_data( $filename );\r\n\t\t\tif ( !empty( $data['Orientation'] ) ) {\r\n\t\t\t\tswitch( $data['Orientation'] ) {\r\n\t\t\t\t\tcase 3: { $newAngle = 180; } break;\r\n\t\t\t\t\tcase 6: { $newAngle = -90; } break;\r\n\t\t\t\t\tcase 8: { $newAngle = 90; } break;\r\n\t\t\t\t\tdefault: $newAngle = false;\r\n\t\t\t\t}\r\n\t\t\t\tif ( $newAngle ) {\r\n\t\t\t\t\t$image = imagecreatefromstring( $filecontent );\r\n\t\t\t\t\t$image = imagerotate( $image, $newAngle, 0 );\r\n\t\t\t\t\t$this->save_image( $image, $filename );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}", "function RotatedText($x,$y,$txt,$angle)\n\t{\n\t $this->Rotate($angle,$x,$y);\n\t $this->Text($x,$y,$txt);\n\t $this->Rotate(0);\n\t}", "function RotatedText($x, $y, $txt, $angle) {\n\t $this->Rotate($angle,$x,$y);\n\t $this->Text($x,$y,$txt);\n\t $this->Rotate(0);\n\t}", "function frameImage($inside = 0, $imagesPath = array(), $imgHeight = 600, $imagesWidth = array(), $imagesAngles = array(), $poleColor = null, $poleWidth = 1, $poleHeight = 1)\n{ \n $rowImagick = new Imagick();\n \n foreach($imagesPath as $imgIndex => $imgPath) {\n $imagick = new Imagick(realpath($imgPath));\n\n $imagick->getImageGeometry();\n $imgGeo = $imagick->getImageGeometry();\n $imgOrgWidth = $imgGeo['width'];\n $imgOrgHeight = $imgGeo['height'];\n $imgWidth = $imagesWidth[$imgIndex];\n\n if(isset($imagesAngles[$imgIndex])) {\n $angleX = ($imagesAngles[$imgIndex]) == 90 ? - ($imagesAngles[$imgIndex] - 10) : - $imagesAngles[$imgIndex];\n } else {\n $angleX = -100;\n }\n $angleY = 0;\n $thetX = deg2rad ($angleX);\n $thetY = deg2rad ($angleY);\n\n $s_x1y1 = array(0, 0); // LEFT BOTTOM\n $s_x2y1 = array($imgWidth, 0); // RIGHT BOTTOM\n $s_x1y2 = array(0, $imgHeight); // LEFT TOP\n $s_x2y2 = array($imgWidth, $imgHeight); // RIGHT TOP\n\n $d_x1y1 = array(\n $s_x1y1[0] * cos($thetX) - $s_x1y1[1] * sin($thetY),\n $s_x1y1[0] * sin($thetX) + $s_x1y1[1] * cos($thetY)\n );\n $d_x2y1 = array(\n $s_x2y1[0] * cos($thetX) - $s_x2y1[1] * sin($thetY),\n $s_x2y1[0] * sin($thetX) + $s_x2y1[1] * cos($thetY)\n );\n $d_x1y2 = array(\n $s_x1y2[0] * cos($thetX) - $s_x1y2[1] * sin($thetY),\n $s_x1y2[0] * sin($thetX) + $s_x1y2[1] * cos($thetY)\n );\n $d_x2y2 = array(\n $s_x2y2[0] * cos($thetX) - $s_x2y2[1] * sin($thetY),\n $s_x2y2[0] * sin($thetX) + $s_x2y2[1] * cos($thetY)\n );\n\n $imageprops = $imagick->getImageGeometry();\n $imagick->setImageBackgroundColor(new ImagickPixel('transparent'));\n $imagick->resizeimage($imgWidth, $imgHeight, \\Imagick::FILTER_LANCZOS, 0, true); \n if($poleColor) {\n $imagick->borderImage($poleColor, $poleWidth, $poleHeight);\n }\n\n $points = array(\n $s_x1y2[0], $s_x1y2[1], # Source Top Left\n $d_x1y2[0], $d_x1y2[1], # Destination Top Left\n $s_x1y1[0], $s_x1y1[1], # Source Bottom Left \n $d_x1y1[0], $d_x1y1[1], # Destination Bottom Left \n $s_x2y1[0], $s_x2y1[1], # Source Bottom Right \n $d_x2y1[0], $d_x2y1[1], # Destination Bottom Right \n $s_x2y2[0], $s_x2y2[1], # Source Top Right \n $d_x2y2[0], $d_x2y2[1] # Destination Top Right \n );\n //echo '<pre>'; print_r($points); die;\n\n $imagick->setImageVirtualPixelMethod(\\Imagick::VIRTUALPIXELMETHOD_BACKGROUND);\n $imagick->distortImage(\\Imagick::DISTORTION_PERSPECTIVE, $points, true);\n //$imagick->scaleImage($imgWidth, $imgHeight, false);\n $rowImagick->addImage($imagick); \n }\n\n $rowImagick->resetIterator();\n $combinedRow = $rowImagick->appendImages(false);\n\n $canvas = generateFinalImage($combinedRow);\n header(\"Content-Type: image/png\");\n echo $canvas->getImageBlob();\n}", "public function rotation($direction)\n\t{\n \n $direction = strtoupper($direction);\n\n $data[\"queen\"]= $this->queen_model->get_queen();\n if($data['queen']==null) {\n //error_no_queen_yet : 405\n $this->respond_errors(\"error no queen yet\",405);\n return;\n }\n $queen=$this->queen_model->mapper($data['queen']);\n\n $errors=$queen->rotate($direction);\n\n if (sizeof($errors)>0){\n //error_bad_direction_value :1\n $this->respond_errors($errors,100);\n\n }else{\n $this->queen_model->update_queen_facing($queen);\n $this->respond($queen,200);\n \n }\n\n }", "public function rotate(?callable $copy = null): void;" ]
[ "0.7718361", "0.7675992", "0.7526446", "0.7262501", "0.7246608", "0.7246608", "0.7188207", "0.7151774", "0.7146723", "0.7057935", "0.7020458", "0.70078576", "0.69567716", "0.69564265", "0.6948983", "0.69157284", "0.686234", "0.68500435", "0.68397003", "0.6777366", "0.6740516", "0.6735296", "0.67180145", "0.66925234", "0.66197675", "0.661746", "0.66122925", "0.6591009", "0.6571336", "0.65552026", "0.65436953", "0.6524585", "0.65229404", "0.6508857", "0.641931", "0.6363662", "0.63506716", "0.63506716", "0.63506716", "0.6264536", "0.6261228", "0.62601614", "0.6256856", "0.6226541", "0.6207946", "0.6149422", "0.60952324", "0.6044313", "0.60424113", "0.6034097", "0.59785867", "0.5905858", "0.59004974", "0.58945066", "0.5890701", "0.58440655", "0.58305675", "0.58300686", "0.5781203", "0.577798", "0.5763489", "0.57627654", "0.5746797", "0.5709538", "0.5687362", "0.5687362", "0.5665958", "0.56445676", "0.5611738", "0.5606514", "0.5606514", "0.5573038", "0.5551469", "0.5502264", "0.54522985", "0.5436084", "0.54203737", "0.54125017", "0.5387177", "0.537636", "0.5376141", "0.5351264", "0.53121036", "0.53036016", "0.52817786", "0.5277705", "0.5274572", "0.52717805", "0.5234624", "0.52236235", "0.5170613", "0.5160145", "0.51326376", "0.51284313", "0.5127218", "0.51213735", "0.5120061", "0.5104247", "0.5090185", "0.5061554" ]
0.5473446
74
Flip the image along the horizontal or vertical axis. // Flip the image from top to bottom $image>flip(Image::HORIZONTAL); // Flip the image from left to right $image>flip(Image::VERTICAL);
public function flip($direction) { if ($direction !== Image::HORIZONTAL) { // Flip vertically $direction = Image::VERTICAL; } $this->_do_flip($direction); return $this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function imageflip(&$image, $x = 0, $y = 0, $width = null, $height = null) {\n\tif ($width < 1)\n\t\t$width = imagesx($image);\n\tif ($height < 1)\n\t\t$height = imagesy($image);\n\t// Truecolor provides better results, if possible.\n\tif (function_exists('imageistruecolor') && imageistruecolor($image)) {\n\t\t$tmp = imagecreatetruecolor(1, $height);\n\t} else {\n\t\t$tmp = imagecreate(1, $height);\n\t}\n\t$x2 = $x + $width - 1;\n\tfor ($i = (int) floor(($width - 1) / 2); $i >= 0; $i--) {\n\t\t// Backup right stripe.\n\t\timagecopy($tmp, $image, 0, 0, $x2 - $i, $y, 1, $height);\n\t\t// Copy left stripe to the right.\n\t\timagecopy($image, $image, $x2 - $i, $y, $x + $i, $y, 1, $height);\n\t\t// Copy backuped right stripe to the left.\n\t\timagecopy($image, $tmp, $x + $i, $y, 0, 0, 1, $height);\n\t}\n\timagedestroy($tmp);\n\treturn true;\n}", "public function flipVertical() {\n\t\tif(!$this->image) {\n\t\t\ttrigger_error('The image does not exist or is not readable.', E_USER_WARNING);\n\t\t\treturn false;\n\t\t}\n\n\t\t$working_image = imagecreatetruecolor($this->width, $this->height);\n\t\tif(imagecopyresampled($working_image, $this->image, 0, 0, 0, $this->height-1, $this->width, $this->height, $this->width, 0-$this->height)) {\n\t\t\t$this->image = $working_image;\n\t\t} else {\n\t\t\ttrigger_error('Flip vertical failed.', E_USER_WARNING);\n\t\t\treturn false;\n\t\t}\n\t}", "function imageflip(&$image, $x = 0, $y = 0, $width = null, $height = null)\n {\n if ($width < 1) $width = imagesx($image);\n if ($height < 1) $height = imagesy($image);\n // Truecolor provides better results, if possible.\n if (function_exists('imageistruecolor') && imageistruecolor($image))\n {\n $tmp = imagecreatetruecolor(1, $height);\n }\n else\n {\n $tmp = imagecreate(1, $height);\n }\n\n // My own change to preserve alpha (amarriner)\n imagealphablending($tmp, false);\n imagesavealpha($tmp, true);\n\n $x2 = $x + $width - 1;\n for ($i = (int) floor(($width - 1) / 2); $i >= 0; $i--)\n {\n // Backup right stripe.\n imagecopy($tmp, $image, 0, 0, $x2 - $i, $y, 1, $height);\n // Copy left stripe to the right.\n imagecopy($image, $image, $x2 - $i, $y, $x + $i, $y, 1, $height);\n // Copy backuped right stripe to the left.\n imagecopy($image, $tmp, $x + $i, $y, 0, 0, 1, $height);\n }\n imagedestroy($tmp);\n return true;\n }", "function _flip_image_resource($img, $horz, $vert)\n {\n }", "abstract public function flip();", "protected function _do_flip($direction)\n {\n $flipped = $this->_create($this->width, $this->height);\n\n // Loads image if not yet loaded\n $this->_load_image();\n\n if ($direction === Image::HORIZONTAL)\n {\n for ($x = 0; $x < $this->width; $x++)\n {\n // Flip each row from top to bottom\n imagecopy($flipped, $this->_image, $x, 0, $this->width - $x - 1, 0, 1, $this->height);\n }\n }\n else\n {\n for ($y = 0; $y < $this->height; $y++)\n {\n // Flip each column from left to right\n imagecopy($flipped, $this->_image, 0, $y, 0, $this->height - $y - 1, $this->width, 1);\n }\n }\n\n // Swap the new image for the old one\n imagedestroy($this->_image);\n $this->_image = $flipped;\n\n // Reset the width and height\n $this->width = imagesx($flipped);\n $this->height = imagesy($flipped);\n }", "public function flipHorizontal(): void\n {\n $this->flip(['direction' => 'h']);\n }", "abstract function flip($direction);", "public function flipVertical(): void\n {\n $this->flip(['direction' => 'v']);\n }", "public function flipHorizontal() {\n\t\tif(!$this->image) {\n\t\t\ttrigger_error('The image does not exist or is not readable.', E_USER_WARNING);\n\t\t\treturn false;\n\t\t}\n\n\t\t$working_image = imagecreatetruecolor($this->width, $this->height);\n\t\tif(imagecopyresampled($working_image, $this->image, 0, 0, $this->width-1, 0, $this->width, $this->height, 0-$this->width, $this->height)) {\n\t\t\t$this->image = $working_image;\n\t\t} else {\n\t\t\ttrigger_error('Flip horizontal failed.', E_USER_WARNING);\n\t\t\treturn false;\n\t\t}\n\t}", "public function flip(){\n $this->flip = !$this->flip;\n }", "public function flip(): self;", "public function flip($direction);", "public static function flip_iamge(){\n\n}", "public function test_flip() {\n\t\t$file = DIR_TESTDATA . '/images/one-blue-pixel-100x100.png';\n\n\t\t$imagick_image_editor = new WP_Image_Editor_Imagick( $file );\n\t\t$imagick_image_editor->load();\n\n\t\t$property = new ReflectionProperty( $imagick_image_editor, 'image' );\n\t\t$property->setAccessible( true );\n\n\t\t$color_top_left = $property->getValue( $imagick_image_editor )->getImagePixelColor( 0, 0 )->getColor();\n\n\t\t$imagick_image_editor->flip( true, false );\n\n\t\t$this->assertSame( $color_top_left, $property->getValue( $imagick_image_editor )->getImagePixelColor( 0, 99 )->getColor() );\n\t}", "public function test_flip() {\n\n\t\t$file = DIR_TESTDATA . '/images/gradient-square.jpg';\n\n\t\t$imagick_image_editor = new WP_Image_Editor_Imagick( $file );\n\t\t$imagick_image_editor->load();\n\n\t\t$property = new ReflectionProperty( $imagick_image_editor, 'image' );\n\t\t$property->setAccessible( true );\n\n\t\t$color_top_left = $property->getValue( $imagick_image_editor )->getImagePixelColor( 1, 1 )->getColor();\n\n\t\t$imagick_image_editor->flip( true, false );\n\n\t\t$this->assertEquals( $color_top_left, $property->getValue( $imagick_image_editor )->getImagePixelColor( 0, 99 )->getColor() );\n\t}", "public function flip($dir = 'both') {\n\t\tif(!$this->image) {\n\t\t\ttrigger_error('The image does not exist or is not readable.', E_USER_WARNING);\n\t\t\treturn false;\n\t\t}\n\t\t$dir = substr(strtolower($dir), 0, 1);\n\t\tswitch($dir) {\n\t\t\tdefault:\n\t\t\t\t $res_v = $this->flipVertical();\n\t\t\t\t $res_h = $this->flipHorizontal();\n\t\t\t\t return $res_v && $res_h;\n\t\t\tbreak;\n\t\t\tcase 'v':\n\t\t\t\treturn $this->flipVertical();\n\t\t\tbreak;\n\t\t\tcase 'h':\n\t\t\t\treturn $this->flipHorizontal();\n\t\t\tbreak;\n\t\t}\n\t}", "public function flip($direction) {\r\n $this->imageFlip = $direction;\r\n return $this;\r\n }", "function Flip_On_Front_end( $atts )\n{\n // var_dump( $atts );\n $image = get_post_meta($atts['id'], 'image_url_value', true);\n $backside = get_post_meta($atts['id'], 'description_value', true);\n $flip = get_post_meta($atts['id'], 'transition_value', true);\n $flip_class = '';\n\n if ($flip == 'Left-to-Right' ) {\n\n $flip_class = 'horizontal';\n } elseif ($flip == 'Top-to-bottom' ) { \n\n $flip_class = 'vertical';\n }\n \n \n ?>\n <div class=\"flip-box\" id=\"flip-id\">\n <div class=\"flip-box-inner <?php echo( $flip_class ); ?>\" id=\"inner-id\">\n <div class=\"flip-box-front\">\n <img src=\"<?php echo($image) ?>\" alt=\"Smiley face\" />\n </div>\n <div class=\"flip-box-back\" id=\"inner-back\">\n <div>\n <?php echo $backside; ?>\n </div>\n </div>\n </div>\n </div>\n <?php\n}", "public function flip()\n {\n $this->resource->flipImage();\n return $this;\n }", "public function flip()\n {\n return $this->toBase()->flip();\n }", "public function flip()\n\t{\n\t\treturn $this->toBase()->flip();\n\t}", "private function imageflip(&$result, &$img, $rx = 0, $ry = 0, $x = 0, $y = 0, $size_x = null, $size_y = null)\r\n {\r\n if ($size_x < 1) {\r\n $size_x = imagesx($img);\r\n }\r\n\r\n if ($size_y < 1) {\r\n $size_y = imagesy($img);\r\n }\r\n\r\n imagecopyresampled($result, $img, $rx, $ry, ($x + $size_x - 1), $y, $size_x, $size_y, 0 - $size_x, $size_y);\r\n }", "function __flip(&$tmp) {\n\n\t\t// call `convert -flip`\n\t\t//\n\t\t$cmd = $this->__command(\n\t\t\t'convert',\n\t\t\t\" -flip \"\n \t\t\t. escapeshellarg(realpath($tmp->target))\n \t\t\t. \" \"\n \t\t\t. escapeshellarg(realpath($tmp->target))\n \t);\n\n exec($cmd, $result, $errors);\n\t\treturn ($errors == 0);\n\t\t}", "public function backImage()\r\n {\r\n $wrapper = imagecreatetruecolor(16 * $this->ratio(), 32 * $this->ratio());\r\n $background = imagecolorallocatealpha($wrapper, 255, 255, 255, 127);\r\n imagefill($wrapper, 0, 0, $background);\r\n\r\n imagecopy($wrapper, $this->image, 4 * $this->ratio(), 8 * $this->ratio(), 32 * $this->ratio(),\r\n 20 * $this->ratio(), 8 * $this->ratio(), 12 * $this->ratio());\r\n // Head back\r\n imagecopy($wrapper, $this->image, 4 * $this->ratio(), 0 * $this->ratio(), 24 * $this->ratio(),\r\n 8 * $this->ratio(), 8 * $this->ratio(), 8 * $this->ratio());\r\n // Arms back\r\n $this->imageflip($wrapper, $this->image, 0 * $this->ratio(), 8 * $this->ratio(), 52 * $this->ratio(),\r\n 20 * $this->ratio(), 4 * $this->ratio(), 12 * $this->ratio());\r\n imagecopy($wrapper, $this->image, 12 * $this->ratio(), 8 * $this->ratio(), 52 * $this->ratio(),\r\n 20 * $this->ratio(), 4 * $this->ratio(), 12 * $this->ratio());\r\n // Legs back\r\n $this->imageflip($wrapper, $this->image, 4 * $this->ratio(), 20 * $this->ratio(), 12 * $this->ratio(),\r\n 20 * $this->ratio(), 4 * $this->ratio(), 12 * $this->ratio());\r\n imagecopy($wrapper, $this->image, 8 * $this->ratio(), 20 * $this->ratio(), 12 * $this->ratio(),\r\n 20 * $this->ratio(), 4 * $this->ratio(), 12 * $this->ratio());\r\n // Hat back\r\n imagecopy($wrapper, $this->image, 4 * $this->ratio(), 0 * $this->ratio(), 56 * $this->ratio(),\r\n 8 * $this->ratio(), 8 * $this->ratio(), 8 * $this->ratio());\r\n\r\n return $wrapper;\r\n }", "public function Flip()\n {\n return $this->setOption('flip', true);\n }", "function flip(&$arr, $i) \n{ \n\t$start = 0; \n\twhile ($start < $i) \n\t{ \n\t\t$temp = $arr[$start]; \n\t\t$arr[$start] = $arr[$i]; \n\t\t$arr[$i] = $temp; \n\t\t$start++; \n\t\t$i--; \n\t} \n}", "function image_mirror_gd()\n\t{\t\t\n\t\tif ( ! $src_img = $this->image_create_gd())\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\t\t\n\t\t$width = $this->src_width;\n\t\t$height = $this->src_height;\n\n\t\tif ($this->rotation == 'hor')\n\t\t{\n\t\t\tfor ($i = 0; $i < $height; $i++)\n\t\t\t{\t\t \n\t\t\t\t$left = 0; \n\t\t\t\t$right = $width-1; \n\t\n\t\t\t\twhile ($left < $right)\n\t\t\t\t{ \n\t\t\t\t\t$cl = imagecolorat($src_img, $left, $i); \n\t\t\t\t\t$cr = imagecolorat($src_img, $right, $i);\n\t\t\t\t\t\n\t\t\t\t\timagesetpixel($src_img, $left, $i, $cr); \n\t\t\t\t\timagesetpixel($src_img, $right, $i, $cl); \n\t\t\t\t\t\n\t\t\t\t\t$left++; \n\t\t\t\t\t$right--; \n\t\t\t\t} \n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfor ($i = 0; $i < $width; $i++)\n\t\t\t{\t\t \n\t\t\t\t$top = 0; \n\t\t\t\t$bot = $height-1; \n\t\n\t\t\t\twhile ($top < $bot)\n\t\t\t\t{ \n\t\t\t\t\t$ct = imagecolorat($src_img, $i, $top);\n\t\t\t\t\t$cb = imagecolorat($src_img, $i, $bot);\n\t\t\t\t\t\n\t\t\t\t\timagesetpixel($src_img, $i, $top, $cb); \n\t\t\t\t\timagesetpixel($src_img, $i, $bot, $ct); \n\t\t\t\t\t\n\t\t\t\t\t$top++; \n\t\t\t\t\t$bot--; \n\t\t\t\t} \n\t\t\t}\t\t\n\t\t}\n\t\t\n\t\t/** ---------------------------------\n\t\t/** Save the Image\n\t\t/** ---------------------------------*/\n\t\tif ( ! $this->image_save_gd($src_img))\n\t\t{\t\t\n\t\t\treturn FALSE;\n\t\t}\n\t\t\n\t\t/** ---------------------------------\n\t\t/** Kill the file handles\n\t\t/** ---------------------------------*/\n\t\timagedestroy($src_img);\n\t\t\n\t\t// Set the file to 777\n\t\t@chmod($this->full_dst_path, FILE_WRITE_MODE);\t\t\t\n\t\t\n\t\treturn TRUE;\n\t}", "function flip(&$tmp) {\r\r\n\t\treturn $this->__flip(&$tmp);\r\r\n\t\t}", "public static function change_image_type(){\n/**\n*\n*This function change the image type like convert png to jpg or bmp or gif\n*\n*/\npublic static function rotate()\n}", "public function frontImage()\r\n {\r\n $wrapper = imagecreatetruecolor(16 * $this->ratio(), 32 * $this->ratio());\r\n $background = imagecolorallocatealpha($wrapper, 255, 255, 255, 127);\r\n imagefill($wrapper, 0, 0, $background);\r\n\r\n imagecopy($wrapper, $this->image, 4 * $this->ratio(), 0 * $this->ratio(), 8 * $this->ratio(),\r\n 8 * $this->ratio(), 8 * $this->ratio(), 8 * $this->ratio());\r\n //arms\r\n imagecopy($wrapper, $this->image, 0 * $this->ratio(), 8 * $this->ratio(), 44 * $this->ratio(),\r\n 20 * $this->ratio(), 4 * $this->ratio(), 12 * $this->ratio());\r\n $this->imageflip($wrapper, $this->image, 12 * $this->ratio(), 8 * $this->ratio(), 44 * $this->ratio(),\r\n 20 * $this->ratio(), 4 * $this->ratio(), 12 * $this->ratio());\r\n //chest\r\n imagecopy($wrapper, $this->image, 4 * $this->ratio(), 8 * $this->ratio(), 20 * $this->ratio(),\r\n 20 * $this->ratio(), 8 * $this->ratio(), 12 * $this->ratio());\r\n //legs\r\n imagecopy($wrapper, $this->image, 4 * $this->ratio(), 20 * $this->ratio(), 4 * $this->ratio(),\r\n 20 * $this->ratio(), 4 * $this->ratio(), 12 * $this->ratio());\r\n $this->imageflip($wrapper, $this->image, 8 * $this->ratio(), 20 * $this->ratio(), 4 * $this->ratio(),\r\n 20 * $this->ratio(), 4 * $this->ratio(), 12 * $this->ratio());\r\n //hat\r\n imagecopy($wrapper, $this->image, 4 * $this->ratio(), 0 * $this->ratio(), 40 * $this->ratio(),\r\n 8 * $this->ratio(), 8 * $this->ratio(), 8 * $this->ratio());\r\n\r\n return $wrapper;\r\n }", "function setImageOrientation()\n\t{\n\n\t\tif ($this->width < $this->height) {\n\t\t\t$this->orientation = 'portrait';\n\t\t}\n\n\t\tif ($this->width > $this->height) {\n\t\t\t$this->orientation = 'landscape';\n\t\t}\n\n\t\tif ($this->width == $this->height) {\n\t\t\t$this->orientation = 'square';\n\t\t}\n\t}", "public function image_mirror_gd()\n\t{\n\t\tif ( ! $src_img = $this->image_create_gd())\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\n\t\t$width = $this->orig_width;\n\t\t$height = $this->orig_height;\n\n\t\tif ($this->rotation_angle === 'hor')\n\t\t{\n\t\t\tfor ($i = 0; $i < $height; $i++)\n\t\t\t{\n\t\t\t\t$left = 0;\n\t\t\t\t$right = $width - 1;\n\n\t\t\t\twhile ($left < $right)\n\t\t\t\t{\n\t\t\t\t\t$cl = imagecolorat($src_img, $left, $i);\n\t\t\t\t\t$cr = imagecolorat($src_img, $right, $i);\n\n\t\t\t\t\timagesetpixel($src_img, $left, $i, $cr);\n\t\t\t\t\timagesetpixel($src_img, $right, $i, $cl);\n\n\t\t\t\t\t$left++;\n\t\t\t\t\t$right--;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfor ($i = 0; $i < $width; $i++)\n\t\t\t{\n\t\t\t\t$top = 0;\n\t\t\t\t$bottom = $height - 1;\n\n\t\t\t\twhile ($top < $bottom)\n\t\t\t\t{\n\t\t\t\t\t$ct = imagecolorat($src_img, $i, $top);\n\t\t\t\t\t$cb = imagecolorat($src_img, $i, $bottom);\n\n\t\t\t\t\timagesetpixel($src_img, $i, $top, $cb);\n\t\t\t\t\timagesetpixel($src_img, $i, $bottom, $ct);\n\n\t\t\t\t\t$top++;\n\t\t\t\t\t$bottom--;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Show the image\n\t\tif ($this->dynamic_output === TRUE)\n\t\t{\n\t\t\t$this->image_display_gd($src_img);\n\t\t}\n\t\telseif ( ! $this->image_save_gd($src_img)) // ... or save it\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\n\t\t// Kill the file handles\n\t\timagedestroy($src_img);\n\n\t\tchmod($this->full_dst_path, $this->file_permissions);\n\n\t\treturn TRUE;\n\t}", "public function testFlip() {\n $data = array(\n 'true' => true,\n 'false' => false,\n 'null' => null,\n 'zero' => 0,\n 'stringZero' => '0',\n 'empty' => array(),\n 'array' => array(\n 'false' => false,\n 'null' => null,\n 'empty' => array()\n )\n );\n\n $this->assertEquals(array(\n 1 => 'true',\n 0 => 'stringZero',\n 'empty' => array(),\n 'array' => array(\n 'empty' => array()\n )\n ), Hash::flip($data));\n\n $data = array(\n 'foo' => 'bar',\n 1 => 'one',\n 2 => 'two',\n true,\n false,\n null,\n 'key' => 'value',\n 'baz' => 'bar',\n );\n\n $this->assertEquals(array(\n 'bar' => 'baz',\n 'one' => '',\n 'two' => '',\n 1 => '',\n 'value' => 'key'\n ), Hash::flip($data));\n\n $this->assertEquals(array(\n 1 => 'boolean',\n 123 => 'integer',\n 'foobar' => 'strings',\n 1988 => 'numeric',\n 'empty' => array(),\n 'one' => array(\n 1 => 'depth',\n 'two' => array(\n 2 => 'depth',\n 'three' => array(\n 3 => 'depth',\n 1 => 'true',\n 0 => 'zero',\n 'four' => array(\n 'five' => array(\n 'six' => array(\n 'seven' => array(\n 'We can go deeper!' => 'key'\n )\n )\n )\n )\n )\n )\n )\n ), Hash::flip($this->expanded));\n }", "public function flip(): self\n {\n return Factory::create(array_flip($this->items));\n }", "public static function isVertical($image)\n {\n return ! self::isHorizontal($image);\n }", "public function invert();", "function autoRotateImage($image) {\n $orientation = $image->getImageOrientation();\n\n switch($orientation) {\n case imagick::ORIENTATION_BOTTOMRIGHT:\n $image->rotateimage(\"#000\", 180); // rotate 180 degrees\n break;\n\n case imagick::ORIENTATION_RIGHTTOP:\n $image->rotateimage(\"#000\", 90); // rotate 90 degrees CW\n break;\n\n case imagick::ORIENTATION_LEFTBOTTOM:\n $image->rotateimage(\"#000\", -90); // rotate 90 degrees CCW\n break;\n }\n\n // Now that it's auto-rotated, make sure the EXIF data is correct in case the EXIF gets saved with the image!\n $image->setImageOrientation(imagick::ORIENTATION_TOPLEFT);\n}", "function __flip(&$tmp) {\r\r\n\t\tasido::trigger_abstract_error(\r\r\n\t\t\t__CLASS__,\r\r\n\t\t\t__FUNCTION__\r\r\n\t\t\t);\r\r\n\t\t}", "public function flip(): self\n {\n return new static(array_flip($this->array));\n }", "public static function mirror(){\n\n}", "function RotatedImage($file,$x,$y,$w,$h,$angle)\n{\n $this->Rotate($angle,$x,$y);\n $this->Image($file,$x,$y,$w,$h);\n $this->Rotate(0);\n}", "function woocommerce_swap_image_product() {\n\tglobal $product, $sh_option;\n\tif( $sh_option['woo-hover-flip-image'] == '1' ) {\n\t\t$attachment_ids = $product->get_gallery_image_ids();\n\t\t$attachment_ids = array_values( $attachment_ids );\n\n\t\tif( ! empty( $attachment_ids['0'] ) ) {\n\t\t\t$secondary_image_id \t= $attachment_ids['0'];\n\t\t\t$secondary_image_alt \t= get_post_meta( $secondary_image_id, '_wp_attachment_image_alt', true );\n\t\t\t$secondary_image_title \t= get_the_title( $secondary_image_id );\n\n\t\t\techo wp_get_attachment_image(\n\t\t\t\t$secondary_image_id,\n\t\t\t\t'shop_catalog',\n\t\t\t\t'',\n\t\t\t\tarray(\n\t\t\t\t\t'class' => 'secondary-image attachment-shop-catalog wp-post-image wp-post-image--secondary',\n\t\t\t\t\t'alt' \t=> $secondary_image_alt,\n\t\t\t\t\t'title' => $secondary_image_title,\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t}\n}", "public function applyFilter(Image $image)\n {\n // transparent background if possible\n\n $mirror = strpos($this->rotation, '!') === false ? false : true;\n $rotation = $mirror ? substr($this->rotation, 1) : $this->rotation;\n if ($mirror) {\n $image->flip('h');\n }\n\n return $image->rotate(-$rotation);\n }", "function fix_orientation($fileandpath) { if(!file_exists($fileandpath))\n return false;\n try {\n @$exif = read_exif_data($fileandpath, 'IFD0');\n }\n catch (Exception $exp) {\n $exif = false;\n }\n // Get all the exif data from the file\n // If we dont get any exif data at all, then we may as well stop now\n if(!$exif || !is_array($exif))\n return false;\n\n // I hate case juggling, so we're using loweercase throughout just in case\n $exif = array_change_key_case($exif, CASE_LOWER);\n\n // If theres no orientation key, then we can give up, the camera hasn't told us the\n // orientation of itself when taking the image, and i'm not writing a script to guess at it!\n if(!array_key_exists('orientation', $exif))\n return false;\n\n // Gets the GD image resource for loaded image\n $img_res = $this->get_image_resource($fileandpath);\n\n // If it failed to load a resource, give up\n if(is_null($img_res))\n return false;\n\n // The meat of the script really, the orientation is supplied as an integer,\n // so we just rotate/flip it back to the correct orientation based on what we\n // are told it currently is\n\n switch($exif['orientation']) {\n\n // Standard/Normal Orientation (no need to do anything, we'll return true as in theory, it was successful)\n case 1: return true; break;\n\n // Correct orientation, but flipped on the horizontal axis (might do it at some point in the future)\n case 2:\n $final_img = $this->imageflip($img_res, IMG_FLIP_HORIZONTAL);\n break;\n\n // Upside-Down\n case 3:\n $final_img = $this->imageflip($img_res, IMG_FLIP_VERTICAL);\n break;\n\n // Upside-Down & Flipped along horizontal axis\n case 4:\n $final_img = $this->imageflip($img_res, IMG_FLIP_BOTH);\n break;\n\n // Turned 90 deg to the left and flipped\n case 5:\n $final_img = imagerotate($img_res, -90, 0);\n $final_img = $this->imageflip($img_res, IMG_FLIP_HORIZONTAL);\n break;\n\n // Turned 90 deg to the left\n case 6:\n $final_img = imagerotate($img_res, -90, 0);\n break;\n\n // Turned 90 deg to the right and flipped\n case 7:\n $final_img = imagerotate($img_res, 90, 0);\n $final_img = $this->imageflip($img_res,IMG_FLIP_HORIZONTAL);\n break;\n\n // Turned 90 deg to the right\n case 8:\n $final_img = imagerotate($img_res, 90, 0);\n break;\n\n }\n if(!isset($final_img))\n return false;\n if (!is_writable($fileandpath)) {\n chmod($fileandpath, 0777);\n }\n unlink($fileandpath);\n\n // Save it and the return the result (true or false)\n $done = $this->save_image_resource($final_img,$fileandpath);\n\n return $done;\n }", "public function flip()\n\t{\n\t\treturn new static(array_flip($this->items));\n\t}", "function fixImageOrientation($filename) \n{\n\t$exif = @exif_read_data($filename);\n\t \n\tif($exif) \n\t{ \n\t\t//fix the Orientation if EXIF data exists\n\t\tif(!empty($exif['Orientation'])) \n\t\t{\n\t\t\tswitch($exif['Orientation']) \n\t\t\t{\n\t\t\t\tcase 3:\n\t\t\t\t$createdImage = imagerotate($filename,180,0);\n\t\t\t\tbreak;\n\t\t\t\tcase 6:\n\t\t\t\t$createdImage = imagerotate($filename,-90,0);\n\t\t\t\tbreak;\n\t\t\t\tcase 8:\n\t\t\t\t$createdImage = imagerotate($filename,90,0);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t} \n}", "public function flip()\n {\n return new static(array_flip($this->items));\n }", "public function landscape() {\n\t}", "function reverse()\n {\n }", "protected function adjustImageOrientation()\n { \n $exif = @exif_read_data($this->file);\n \n if($exif && isset($exif['Orientation'])) {\n $orientation = $exif['Orientation'];\n \n if($orientation != 1){\n $img = imagecreatefromjpeg($this->file);\n \n $mirror = false;\n $deg = 0;\n \n switch ($orientation) {\n \n case 2:\n $mirror = true;\n break;\n \n case 3:\n $deg = 180;\n break;\n \n case 4:\n $deg = 180;\n $mirror = true; \n break;\n \n case 5:\n $deg = 270;\n $mirror = true; \n break;\n \n case 6:\n $deg = 270;\n break;\n \n case 7:\n $deg = 90;\n $mirror = true; \n break;\n \n case 8:\n $deg = 90;\n break;\n }\n \n if($deg) $img = imagerotate($img, $deg, 0); \n if($mirror) $img = $this->mirrorImage($img);\n \n $this->image = str_replace('.jpg', \"-O$orientation.jpg\", $this->file); \n imagejpeg($img, $this->file, $this->quality);\n }\n }\n }", "public function flip()\n {\n return new static(array_flip($this->elements));\n }", "function flip(iterable $iterable): Iterator\n{\n return Iterator::from(static function () use ($iterable): Generator {\n foreach ($iterable as $k => $v) {\n yield $v => $k;\n }\n });\n}", "private function rotate_gd($image, $orientation)\n {\n switch ($orientation) {\n case 2:\n $image = imagerotate($image, 180, 0);\n imageflip($image, IMG_FLIP_VERTICAL);\n break;\n\n case 3:\n $image = imagerotate($image, 180, 0);\n break;\n\n case 4:\n $image = imagerotate($image, 180, 0);\n imageflip($image, IMG_FLIP_HORIZONTAL);\n break;\n\n case 5:\n $image = imagerotate($image, -90, 0);\n imageflip($image, IMG_FLIP_HORIZONTAL);\n break;\n\n case 6:\n $image = imagerotate($image, -90, 0);\n break;\n\n case 7:\n $image = imagerotate($image, -90, 0);\n imageflip($image, IMG_FLIP_VERTICAL);\n break;\n\n case 8:\n $image = imagerotate($image, 90, 0);\n break;\n }\n\n return $image;\n }", "function image_fix_orientation($path){\n\t\t$exif = exif_read_data($path);\n\n\t\t//fix the Orientation if EXIF data exist\n\t\tif(!empty($exif['Orientation'])) {\n\t\t switch($exif['Orientation']) {\n\t\t case 8:\n\t\t $createdImage = imagerotate($image,90,0);\n\t\t break;\n\t\t case 3:\n\t\t $createdImage = imagerotate($image,180,0);\n\t\t break;\n\t\t case 6:\n\t\t $createdImage = imagerotate($image,-90,0);\n\t\t break;\n\t\t }\n\t\t}\n\t}", "public function flip()\n {\n $this->items = array_flip($this->items);\n\n return $this;\n }", "public function flip(string $flip = null)\n {\n if ($flip !== Flip::BOTH &&\n $flip !== Flip::HORIZONTAL &&\n $flip !== Flip::VERTICAL &&\n $flip !== null\n ) {\n throw new InvalidFlipException();\n }\n\n $this->buildParams['flip'] = $flip;\n\n if ($flip === null) {\n unset($this->buildParams['flip']);\n }\n\n return $this;\n }", "function RotatedImage($file,$x,$y,$w,$h,$angle) {\n\t\t$this->Rotate($angle,$x,$y);\n\t\t$this->Image($file,$x,$y,$w,$h);\n\t\t$this->Rotate(0);\n\t}", "function RotatedImage($file,$x,$y,$w,$h,$angle) {\n\t\t$this->Rotate($angle,$x,$y);\n\t\t$this->Image($file,$x,$y,$w,$h);\n\t\t$this->Rotate(0);\n\t}", "public function mirror($mode)\n {\n if ($mode == \"vertical\") {\n $this->addConvertOption('flip');\n } elseif ($mode == \"horizontal\") {\n $this->addConvertOption('flop');\n }\n\n return $this;\n }", "public function reverse();", "public function reverse();", "public function reverse();", "public function reverse();", "public function flip() {\n $h= array_flip($this->_hash);\n if (xp::errorAt(__FILE__, __LINE__ - 1)) {\n $e= new FormatException('hash contains values which are not scalar');\n xp::gc(__FILE__);\n throw $e;\n }\n $this->_hash= $h;\n return TRUE;\n }", "function flipDiagonally($arr) {\n\t $out = array();\n\t foreach ($arr as $key => $subarr) {\n\t foreach ($subarr as $subkey => $subvalue) {\n\t $out[$subkey][$key] = $subvalue;\n\t }\n\t }\n\t return $out;\n\t}", "function RotatedImage($file,$x,$y,$w,$h,$angle)\n {\n $this->Rotate($angle,$x,$y);\n $this->Image($file,$x,$y,$w,$h);\n $this->Rotate(0);\n }", "function is_landscape($image) {\n\tif(get_width($image) > get_height($image)) return true;\n\treturn false;\n}", "function RotatedImage($file,$x,$y,$w,$h,$angle)\n\t{\n\t $this->Rotate($angle,$x,$y);\n\t $this->Image($file,$x,$y,$w,$h);\n\t $this->Rotate(0);\n\t}", "function rotate($img_name,$rotated_image,$direction){\n\t\t$image = $img_name;\n\t\t$extParts=explode(\".\",$image);\n\t\t$ext=end($extParts);\n\t\t$filename=$rotated_image;\n\t\t//How many degrees you wish to rotate\n\t\t$degrees = 0;\n\t\tif($direction=='R'){\n\t\t\t$degrees = 90;\n\t\t}\n\t\tif($direction=='L'){\n\t\t\t$degrees = -90;\n\t\t}\n\t\t\n\t\tif($ext==\"jpg\" || $ext== \"jpeg\" || $ext==\"JPG\" || $ext== \"JPEG\"){\n\t\t\t$source = imagecreatefromjpeg($image) ;\n\t\t\t$rotate = imagerotate($source, $degrees, 0) ;\n\t\t\timagejpeg($rotate,$filename) ;\n\t\t}\n\t\t\n\t\t\n\t\tif($ext==\"GIF\" || $ext== \"gif\"){\n\t\t\t$source = imagecreatefromgif($image) ;\n\t\t\t$rotate = imagerotate($source, $degrees, 0) ;\n\t\t\timagegif($rotate,$filename) ;\n\t\t\t\n\t\t}\n\t\t\n\t\tif($ext==\"png\" || $ext== \"PNG\"){\n\t\t\t$source = imagecreatefrompng($image) ;\n\t\t\t$rotate = imagerotate($source, $degrees, 0) ;\n\t\t\timagepng($rotate,$filename) ;\n\t\t\t\n\t\t}\n\t\treturn $rotate;\t\n\t\t\n\t}", "public function reversed();", "public function image();", "public function image();", "public function imageDownAction()\n {\n\n $imageId = $this->params()->fromRoute('id');\n $offerId = $this->galleryTable->getOfferIdByImage($imageId)->toArray();\n $oldImageOrder = $this->params()->fromRoute('imageOrder');\n $newImageOrder = $oldImageOrder + 1;\n\n $this->galleryTable->updateImageOrder($imageId, $newImageOrder, $oldImageOrder, $offerId['offer_id']);\n return $this->redirect()->toRoute('languageRoute/adminOffersGallery', array('offerId' => $offerId['offer_id']));\n\n }", "public function matrix()\n {\n echo \"在Linux下通过,Matrix,展示>>{$this->imgFile->play()}<<\";\n }", "function image_rotate()\n\t{\n\t\t// Allowed rotation values\n\t\t\n\t\t$degs = array(90, 180, 270, 'vrt', 'hor');\t\n\t\n\t\t\tif ($this->rotation == '' OR ! in_array($this->rotation, $degs))\n\t\t\t{\n\t\t\t$this->set_error('imglib_rotation_angle_required');\n\t\t\treturn FALSE;\t\t\t\n\t\t\t}\n\t\n\t\t/** -------------------------------------\n\t\t/** Reassign the width and height\n\t\t/** -------------------------------------*/\n\t\n\t\tif ($this->rotation == 90 OR $this->rotation == 270)\n\t\t{\n\t\t\t$this->dst_width\t= $this->src_height;\n\t\t\t$this->dst_height\t= $this->src_width;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->dst_width\t= $this->src_width;\n\t\t\t$this->dst_height\t= $this->src_height;\n\t\t}\n\t\n\t\t/** -------------------------------------\n\t\t/** Choose resizing function\n\t\t/** -------------------------------------*/\n\t\t\n\t\tif ($this->resize_protocol == 'imagemagick' OR $this->resize_protocol == 'netpbm')\n\t\t{\n\t\t\t$protocol = 'image_process_'.$this->resize_protocol;\n\t\t\n\t\t\treturn $this->$protocol('rotate');\n\t\t}\n\t\t\n \t\tif ($this->rotation == 'hor' OR $this->rotation == 'vrt')\n \t\t{\n\t\t\treturn $this->image_mirror_gd();\n \t\t}\n\t\telse\n\t\t{\t\t\n\t\t\treturn $this->image_rotate_gd();\n\t\t}\n\t}", "function RotatedImage($file,$x,$y,$w,$h,$bln_rotate)\n\t{\n\t $img_size= getimagesize($file);\n\t \n\t $aspect_y=$h/$img_size[1];\n\t $aspect_x=$w/$img_size[0];\n\t \n\t if ($bln_rotate==1){\n\t\t //Check to see if the image fits better at 90 degrees\n\t\t $aspect_y2=$w/$img_size[1];\n\t\t $aspect_x2=$h/$img_size[0];\n\t\t \n\t\t if($aspect_x<$aspect_y)\n\t\t {\n\t\t \t$aspect1=$aspect_x;\n\t\t }\n\t\t else {\n\t\t \t$aspect1=$aspect_y;\n\t\t }\n\t\t \n\t\t if($aspect_x2<$aspect_y2)\n\t\t {\n\t\t \t$aspect2=$aspect_x2;\n\t\t }\n\t\t else {\n\t\t \t$aspect2=$aspect_y2;\n\t\t }\n\t\t \n\t\t if ($aspect1<$aspect2)\n\t\t {\n\t\t \t$angle=90;\n\t\t \t$y=$y+$h;\n\t\t \t$t=$h;\n\t\t \t$h=$w;\n\t\t \t$w=$t;\n\t\t \t$aspect_y=$aspect_y2;\n\t\t \t$aspect_x=$aspect_x2;\n\t\t }\n\t }\n\t \n\t \n\t \n\t \n\t \tif ($aspect_x>$aspect_y){\n\t \t\t$flt_adjust=$aspect_y;\n\t \t\t$w=$flt_adjust*$img_size[0];\n\t \t\t\n\t \t}\n\t \telse{\n\t \t\t$flt_adjust=$aspect_x;\n\t \t\t$h=$flt_adjust*$img_size[1];\n\t \t}\n\t \n\t \t\n\t \t\n\t $this->Rotate($angle,$x,$y);\n\t $this->Image($file,$x,$y,$w,$h,'JPG');\n\t $this->Rotate(0);\n\t}", "function rotateImage($param=array())\r\n {\r\n $img = isset($param['src']) ? $param['src'] : false;\r\n $newname= isset($param['newname']) ? $param['newname'] : $img;\r\n $degrees= isset($param['deg']) ? $param['deg'] : false;\r\n $out = false;\r\n \r\n if($img)\r\n {\r\n \r\n switch(exif_imagetype($img)){\r\n \tcase 1:\r\n \t\t//gif\r\n \t\t$destimg = imagecreatefromgif($img);\r\n \t\t$transColor = imagecolorallocatealpha($destimg, 255, 255, 255, 127);\r\n \t\t$rotatedImage = imagerotate($destimg, $degrees, $transColor);\r\n \t\timagesavealpha($rotatedImage, true);\r\n \t\timagegif($rotatedImage, $newname);\r\n \tbreak;\r\n \tcase 2:\r\n \t\t//jpg\r\n \t\t$destimg = imagecreatefromjpeg($img);\r\n \t\t$transColor = imagecolorallocatealpha($destimg, 255, 255, 255, 127);\r\n \t\t$rotatedImage = imagerotate($destimg, $degrees, $transColor);\r\n \t\timagesavealpha($rotatedImage, true);\r\n \t\timagejpeg($rotatedImage, $newname);\r\n \tbreak;\r\n \tcase 3:\r\n \t\t//png\r\n \t\t$destimg = imagecreatefrompng($img);\r\n \t\t$transColor = imagecolorallocatealpha($destimg, 255, 255, 255, 127);\r\n \t\t$rotatedImage = imagerotate($destimg, $degrees, $transColor);\r\n \t\timagesavealpha($rotatedImage, true);\r\n \t\timagepng($rotatedImage, $newname);\r\n \tbreak;\r\n }\r\n \r\n $out = $img;\r\n }\r\n \r\n return $out;\r\n }", "public function isHorizontal() {\n\t\t$this->direction=\"H\";\n\t}", "public function rotateLeft();", "public function turnRight();", "public function isVertical() {\n\t\t$this->direction=\"V\";\n\t}", "public function rotate()\n {\n // not possible in php?\n }", "public function rotateRight();", "protected function fix_image_orientation( $filename, $filecontent ) {\r\n\t\t\t$data = exif_read_data( $filename );\r\n\t\t\tif ( !empty( $data['Orientation'] ) ) {\r\n\t\t\t\tswitch( $data['Orientation'] ) {\r\n\t\t\t\t\tcase 3: { $newAngle = 180; } break;\r\n\t\t\t\t\tcase 6: { $newAngle = -90; } break;\r\n\t\t\t\t\tcase 8: { $newAngle = 90; } break;\r\n\t\t\t\t\tdefault: $newAngle = false;\r\n\t\t\t\t}\r\n\t\t\t\tif ( $newAngle ) {\r\n\t\t\t\t\t$image = imagecreatefromstring( $filecontent );\r\n\t\t\t\t\t$image = imagerotate( $image, $newAngle, 0 );\r\n\t\t\t\t\t$this->save_image( $image, $filename );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}", "function acadp_exif_rotate( $file ){\n\n\tif( ! function_exists( 'exif_read_data' ) ) {\n\t\treturn $file;\n\t}\n\n\t$exif = @exif_read_data( $file['tmp_name'] );\n\t$exif_orient = isset( $exif['Orientation'] ) ? $exif['Orientation'] : 0;\n\t$rotate_image = 0;\n\n\tif( 6 == $exif_orient ) {\n\t\t$rotate_image = 90;\n\t} else if ( 3 == $exif_orient ) {\n\t\t$rotate_image = 180;\n\t} else if ( 8 == $exif_orient ) {\n\t\t$rotate_image = 270;\n\t}\n\n\tif( $rotate_image ) {\n\n\t\tif( class_exists( 'Imagick' ) ) {\n\n\t\t\t$imagick = new Imagick();\n\t\t\t$imagick_pixel = new ImagickPixel();\n\t\t\t$imagick->readImage( $file['tmp_name'] );\n\t\t\t$imagick->rotateImage( $imagick_pixel, $rotate_image );\n\t\t\t$imagick->setImageOrientation( 1 );\n\t\t\t$imagick->writeImage( $file['tmp_name'] );\n\t\t\t$imagick->clear();\n\t\t\t$imagick->destroy();\n\n\t\t} else {\n\n\t\t\t$rotate_image = -$rotate_image;\n\n\t\t\tswitch( $file['type'] ) {\n\t\t\t\tcase 'image/jpeg' :\n\t\t\t\t\tif( function_exists( 'imagecreatefromjpeg' ) ) {\n\t\t\t\t\t\t$source = imagecreatefromjpeg( $file['tmp_name'] );\n\t\t\t\t\t\t$rotate = imagerotate( $source, $rotate_image, 0 );\n\t\t\t\t\t\timagejpeg( $rotate, $file['tmp_name'] );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'image/png' :\n\t\t\t\t\tif( function_exists( 'imagecreatefrompng' ) ) {\n\t\t\t\t\t\t$source = imagecreatefrompng( $file['tmp_name'] );\n\t\t\t\t\t\t$rotate = imagerotate( $source, $rotate_image, 0 );\n\t\t\t\t\t\timagepng( $rotate, $file['tmp_name'] );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'image/gif' :\n\t\t\t\t\tif( function_exists( 'imagecreatefromgif' ) ) {\n\t\t\t\t\t\t$source = imagecreatefromgif( $file['tmp_name'] );\n\t\t\t\t\t\t$rotate = imagerotate( $source, $rotate_image, 0 );\n\t\t\t\t\t\timagegif( $rotate, $file['tmp_name'] );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\treturn $file;\n\n}", "function albums_reorder_images($album) {\n\t$images = albums_get_images($album);\n\n\t//Only reorder if album contains images.\n\tif ($images != FALSE) {\n\t\t$number = 1;\n\t\tforeach ($images as $image) {\n\t\t\t$parts = explode('.', $image['filename']);\n\t\t\tif (isset($parts[3])) {\n\t\t\t\trename(ALBUMS_DIR.'/'.$album.'/'.$image['filename'], ALBUMS_DIR.'/'.$album.'/'.$number.'.'.$parts[1].'.'.$parts[2].'.'.$parts[3]);\n\t\t\t\t$number++;\n\t\t\t}\n\t\t}\n\t}\n}", "public static function flip($array, $isArray = true, $isMultiple = true)\n {\n if (!$isMultiple)\n return array_flip($array);\n\n $result = [];\n foreach ($array as $key => $value) {\n\n if (empty($value) || !(is_numeric($value) || is_string($value)))\n continue;\n\n if ($isArray || isset($result[$value])) {\n if (!is_array($result[$value]))\n $result[$value] = [$result[$value]];\n\n $result[$value][] = $key;\n } else {\n $result[$value] = $key;\n }\n }\n\n return $result;\n }", "protected function getLiipImagine_Filter_Loader_FlipService()\n {\n return $this->services['liip_imagine.filter.loader.flip'] = new \\Liip\\ImagineBundle\\Imagine\\Filter\\Loader\\FlipFilterLoader();\n }", "protected function transform(sfImage $image)\n {\n $resource_w = $image->getWidth();\n $resource_h = $image->getHeight();\n\n $scale_w = $this->getWidth()/$resource_w;\n $scale_h = $this->getHeight()/$resource_h;\n switch ($this->getMethod())\n {\n case 'deflate':\n case 'inflate':\n\n return $image->resize($this->getWidth(), $this->getHeight());\n\n case 'left':\n $image->scale(max($scale_w, $scale_h));\n\n return $image->crop(0, (int)round(($image->getHeight() - $this->getHeight()) / 2), $this->getWidth(), $this->getHeight());\n\n case 'right':\n $image->scale(max($scale_w, $scale_h));\n\n return $image->crop(($image->getWidth() - $this->getWidth()), (int)round(($image->getHeight() - $this->getHeight()) / 2),$this->getWidth(), $this->getHeight());\n\n case 'top':\n $image->scale(max($scale_w, $scale_h));\n\n return $image->crop((int)round(($image->getWidth() - $this->getWidth()) / 2), 0, $this->getWidth(), $this->getHeight());\n\n case 'bottom':\n $image->scale(max($scale_w, $scale_h));\n\n return $image->crop((int)round(($image->getWidth() - $this->getWidth()) / 2), ($image->getHeight() - $this->getHeight()), $this->getWidth(), $this->getHeight());\n \n case 'center':\n $image->scale(max($scale_w, $scale_h));\n \n $left = (int)round(($image->getWidth() - $this->getWidth()) / 2);\n $top = (int)round(($image->getHeight() - $this->getHeight()) / 2);\n\n return $image->crop($left, $top, $this->getWidth(), $this->getHeight());\n case 'scale':\n return $image->scale(min($scale_w, $scale_h));\n\n case 'fit': \n default:\n $img = clone $image;\n\n $image->create($this->getWidth(), $this->getHeight());\n \n // Set a background color if specified\n if(!is_null($this->getBackground()) && $this->getBackground() != '')\n {\n $image->fill(0,0, $this->getBackground());\n }\n\n $img->scale(min($this->getWidth() / $img->getWidth(), $this->getHeight() / $img->getHeight()));\n \n $image->overlay($img, 'center');\n\n return $image;\n \n }\n }", "function RotatedImage($file, $x, $y, $w, $h, $angle) {\n\t\t$this->Rotate($angle, $x, $y);\n\t\t$this->Image($file, $x, $y, $w, $h);\n\t\t$this->Rotate(0);\n\t}", "function getImage();", "public function rotateFlipImage($request)\n {\n $returnType = '\\SplFileObject';\n $isBinary = true;\n $hasReturnType = true;\n $request = $this->getHttpRequest($request, 'GET');\n $options = $this->createHttpClientOptions();\n \n try {\n $response = $this->client->send($request, $options);\n return $this->processResponse($request, $response, $hasReturnType, $returnType, $isBinary);\n } catch (RequestException $e) {\n $this->processException($e);\n }\n }", "function orientation_check($file_path, $prefs)\n\t{\n\t\tif ( ! function_exists('exif_read_data'))\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\t// Not all images are supported\n\t\t$exif = @exif_read_data($file_path);\n\n\t\tif ( ! $exif OR ! isset($exif['Orientation']))\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\t$orientation = $exif['Orientation'];\n\n\t\tif ($orientation == 1)\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\t// Image is rotated, let's see by how much\n\t\t$deg = 0;\n\n\t\tswitch ($orientation) {\n\t\t\tcase 3:\n\t\t\t\t$deg = 180;\n\t\t\t\tbreak;\n\t\t\tcase 6:\n\t\t\t\t$deg = 270;\n\t\t\t\tbreak;\n\t\t\tcase 8:\n\t\t\t\t$deg = 90;\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif ($deg)\n\t\t{\n\t\t\tee()->load->library('image_lib');\n\n\t\t\tee()->image_lib->clear();\n\n\t\t\t// Set required memory\n\t\t\ttry\n\t\t\t{\n\t\t\t\tee('Memory')->setMemoryForImageManipulation($file_path);\n\t\t\t}\n\t\t\tcatch (\\Exception $e)\n\t\t\t{\n\t\t\t\tlog_message('error', $e->getMessage().': '.$file_path);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t$config = array(\n\t\t\t\t'rotation_angle'\t=> $deg,\n\t\t\t\t'library_path'\t\t=> ee()->config->item('image_library_path'),\n\t\t\t\t'image_library'\t\t=> ee()->config->item('image_resize_protocol'),\n\t\t\t\t'source_image'\t\t=> $file_path\n\t\t\t);\n\n\t\t\tee()->image_lib->initialize($config);\n\n\t\t\tif ( ! ee()->image_lib->rotate())\n\t\t\t{\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t$new_image = ee()->image_lib->get_image_properties('', TRUE);\n\t\t\tee()->image_lib->clear();\n\n\t\t\t// We need to reset some prefs\n\t\t\tif ($new_image)\n\t\t\t{\n\t\t\t\tee()->load->helper('number');\n\t\t\t\t$f_size = get_file_info($file_path);\n\t\t\t\t$prefs['file_height'] = $new_image['height'];\n\t\t\t\t$prefs['file_width'] = $new_image['width'];\n\t\t\t\t$prefs['file_hw_original'] = $new_image['height'].' '.$new_image['width'];\n\t\t\t\t$prefs['height'] = $new_image['height'];\n\t\t\t\t$prefs['width'] = $new_image['width'];\n\t\t\t}\n\n\t\t\treturn $prefs;\n\t\t}\n\t}", "public function actionRotate($imageid,$direction)\n\t{\n\t\t\n\t\t// the image object is created from the database to avoid user input\n\t\t$image = Image::model()->findByPk($imageid);\n\t\t// where to return after the operation\n\t\t$rotatedurl = Yii::app()->user->returnUrl;\n\t\t\n\t\t// temporary filename for the created rotated image\n\t\t$tempfilename = Image::FULLIMAGETEMPPATH . uniqid() . '.jpg';\n\t\t// the image variable $rotated is created based on the original JPG in the file system\n\t\t\n\t\t// if the file does not exist, the user is redirected away\n\t\tif (!file_exists($image->getImageFile('full',false,Image::FULLIMAGEPATH)))\n\t\t{\n\t\t\t$rotatedurl['rotated']='fail_file_not_found';\n\t\t\t$this->redirect($rotatedurl);\n\t\t}\n\t\t\t\t\n\t\t// the original full image is evaluated to determine if it's a JPG\n\t\t// should the file not be jpg, execution is terminated and user is presented\n\t\t// with an error\n\t\t$originalFullImage = $image->getImageFile('full',false,Image::FULLIMAGEPATH);\n\t\t// getimagesize returns information of image size, but also of type among other things\n\t\t$information = getimagesize($originalFullImage);\n\t\tif ($information['mime'] != 'image/jpeg')\n\t\t{\n\t\t\t$rotatedurl['rotated']='fail_not_jpg';\n\t\t\t$this->redirect($rotatedurl);\n\t\t}\n\n\t\t// an uncompressed image is created from the original full size image\n\t\t$rotate = imagecreatefromjpeg($originalFullImage);\n\t\t// the original full image is unset to save memory\n\t\tunset($originalFullImage);\n\t\t\n\t\t// defining the direction of the rotation\n\t\tswitch($direction) \n\t\t{\n\t\t\tcase 'clockwise':\n\t\t\t\t$angle = -90; \t\n\t\t\t\tbreak;\n\t\t\tcase 'counterclockwise':\n\t\t\t\t$angle = 90; \t\n\t\t\t\tbreak;\n\t\t}\n\t\t\n\t\t// creates the rotated image\n\t\t$rotated = imagerotate($rotate,$angle,0);\n\t\tunset($rotate);\n\t\t// saves the rotated image as a jpeg to the temporary file directory\n\t\timagejpeg($rotated,$tempfilename,100);\n\t\tunset($rotated);\n\t\t\n\t\t// the existance of the rotated image is evaluated before anything is deleted\n\t\tif(file_exists($tempfilename))\n\t\t{\n\t\t\t// deletes all the physical image files for the image object\n\t\t\t$image->deleteImage(array('small', 'light', 'medium', 'large','full'));\n\t\t\t\n\t\t\t// moving the generated image to it's desired location\n\t\t\trename($tempfilename,$image->getImageFile('full',false,Image::FULLIMAGEPATH));\n\t\t\t\n\t\t\t// generating thumbnails for the rotated image\n\t\t\t$image->generateThumbnails();\n\t\t}\n\n\t\t$rotatedurl['rotated']='true';\n\t\t$this->redirect($rotatedurl);\n\t\t\t\t\n\t}", "private function rotate_imagick($imagePath, $orientation)\n {\n $imagick = new Imagick($imagePath);\n $imagick->setImageOrientation(imagick::ORIENTATION_TOPLEFT);\n $deg = 0;\n\n switch ($orientation) {\n case 2:\n $deg = 180;\n $imagick->flipImage();\n break;\n\n case 3:\n $deg = -180;\n break;\n\n case 4:\n $deg = -180;\n $imagick->flopImage();\n break;\n\n case 5:\n $deg = -90;\n $imagick->flopImage();\n break;\n\n case 6:\n $deg = 90;\n break;\n\n case 7:\n $deg = -90;\n $imagick->flipImage();\n break;\n\n case 8:\n $deg = -90;\n break;\n }\n $imagick->rotateImage(new ImagickPixel('#00000000'), $deg);\n $imagick->writeImage($imagePath);\n $imagick->clear();\n $imagick->destroy();\n }", "function RotatedImage($file, $x, $y, $w, $h, $angle) {\n $this->Rotate($angle, $x, $y);\n $this->Image($file, $x, $y, $w, $h);\n $this->Rotate(0);\n }", "public function imageToASCII($image){\n $image = 'image.jpg'; \n // Supports http if allow_url_fopen is enabled \n $image = file_get_contents($image); \n $img = imagecreatefromstring($image); \n\n $width = imagesx($img); \n $height = imagesy($img); \n\n for($h=0;$h<$height;$h++){ \n for($w=0;$w<=$width;$w++){ \n $rgb = imagecolorat($img, $w, $h); \n $a = ($rgb >> 24) & 0xFF; \n $r = ($rgb >> 16) & 0xFF; \n $g = ($rgb >> 8) & 0xFF; \n $b = $rgb & 0xFF; \n $a = abs(($a / 127) - 1); \n if($w == $width){ \n echo '<br>'; \n }else{ \n echo '<span style=\"color:rgba('.$r.','.$g.','.$b.','.$a.');\">#</span>'; \n } \n } \n } \n }", "public function rotateLeft(): Orientation\n {\n return new North();\n }", "private static function flipDiagonally($arr)\n\t{\n\t\t$out = array();\n\t\tforeach ($arr as $key => $subarr) {\n\t\t\tforeach ($subarr as $subkey => $subvalue) {\n\t\t\t\t$out[$subkey][$key] = $subvalue;\n\t\t\t}\n\t\t}\n\t\treturn $out;\n\t}" ]
[ "0.74767643", "0.74740124", "0.7435241", "0.74295914", "0.73990226", "0.73853934", "0.73138785", "0.69941926", "0.69708556", "0.6954947", "0.68692875", "0.6749272", "0.67014897", "0.6616811", "0.6534605", "0.65026665", "0.641083", "0.63535464", "0.6193806", "0.6083866", "0.6080166", "0.6021272", "0.58907515", "0.5761385", "0.5702727", "0.5698392", "0.5547173", "0.54687876", "0.54561204", "0.5440811", "0.53580666", "0.5283487", "0.5222844", "0.51923317", "0.5188513", "0.51802737", "0.5159363", "0.51586163", "0.5100235", "0.5018492", "0.50162864", "0.49932197", "0.49741793", "0.49528927", "0.49459976", "0.49427876", "0.49326324", "0.49111274", "0.4870215", "0.48141116", "0.47935376", "0.47378433", "0.4683064", "0.46657422", "0.46611443", "0.46514237", "0.46287838", "0.46281388", "0.46281388", "0.4615598", "0.46103498", "0.46103498", "0.46103498", "0.46103498", "0.46030718", "0.45955178", "0.45913413", "0.45878863", "0.45868117", "0.4582045", "0.4576645", "0.4562937", "0.4562937", "0.4534291", "0.4524097", "0.4522352", "0.45106128", "0.44919947", "0.44913492", "0.44659653", "0.4457271", "0.44450098", "0.44173053", "0.44106233", "0.43977678", "0.43910548", "0.4387207", "0.43804345", "0.4377427", "0.43596148", "0.4358632", "0.43579683", "0.4356642", "0.43274686", "0.43152627", "0.43081978", "0.42978367", "0.42971668", "0.42958906", "0.4289078" ]
0.6438851
16
Sharpen the image by a given amount. // Sharpen the image by 20% $image>sharpen(20);
public function sharpen($amount) { // The amount must be in the range of 1 to 100 $amount = min(max($amount, 1), 100); $this->_do_sharpen($amount); return $this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function sharpenImage()\n\t{\n\t\t$this->checkImage();\n\n\t\tif (!$this->saveState && $this->sharpen == true) {\n\t\t\t$sharpness = $this->findSharp($this->width, $this->optimalWidth);\n\t\t\t$sharpenMatrix = array(\n\t\t\t\tarray(-1, -2, -1),\n\t\t\t\tarray(-2, $sharpness + 12, -2),\n\t\t\t\tarray(-1, -2, -1)\n\t\t\t);\n\t\t\t$divisor = $sharpness;\n\t\t\t$offset = 0;\n\t\t\tif (function_exists('imageconvolution')) {\n\t\t\t\timageconvolution($this->imageResized, $sharpenMatrix, $divisor, $offset);\n\t\t\t} else {\n\t\t\t\t$this->imageconvolution($this->imageResized, $sharpenMatrix, $divisor, $offset);\n\t\t\t}\n\t\t}\n\t}", "public function sharpen($amount);", "abstract public function sharpen($amount);", "public function sharpenAction()\n {\n $image = __DIR__ . '/../../../data/media/test.jpg';\n $sharpen = $this->thumbnailer->createSharpen();\n $thumb = $this->thumbnailer->create($image, [], [$sharpen]);\n\n $thumb\n ->resize(200, 200)\n ->show()\n ->save('public/sharpen_test.jpg');\n\n return false;\n }", "public function sharpen() {\r\n\t\t$matrix = array(\r\n\t\t\tarray(-1, -1, -1),\r\n\t\t\tarray(-1, 16, -1),\r\n\t\t\tarray(-1, -1, -1)\r\n\t\t);\r\n\t\t$this->convolution($matrix, array_sum(array_map('array_sum', $matrix)));\r\n\t}", "function sharpen($amount = 20, $radius = 0.5, $threshold = 2)\n {\n $img = $this->getWorkingImageResource();\n \n if ($amount > 500)\n {\n $amount = 500; \n }\n if ($radius > 50)\n {\n $radius = 50; \n }\n if ($threshold > 255)\n {\n $threshold = 255; \n }\n\n $amount = $amount * 0.016; \n $radius = abs(round($radius * 2)); \n $w = $this->getWorkingImageWidth();\n $h = $this->getWorkingImageHeight();\n\n $imgCanvas = imagecreatetruecolor($w, $h); \n $imgBlur = imagecreatetruecolor($w, $h); \n\n if (function_exists('imageconvolution'))\n { \n $matrix = array( \n array( 1, 2, 1 ), \n array( 2, 4, 2 ), \n array( 1, 2, 1 ) \n ); \n\n imagecopy ($imgBlur, $img, 0, 0, 0, 0, $w, $h); \n imageconvolution($imgBlur, $matrix, 16, 0); \n } \n else\n { \n for ($i = 0; $i < $radius; $i++)\n { \n imagecopy ($imgBlur, $img, 0, 0, 1, 0, $w - 1, $h); // left \n imagecopymerge ($imgBlur, $img, 1, 0, 0, 0, $w, $h, 50); // right \n imagecopymerge ($imgBlur, $img, 0, 0, 0, 0, $w, $h, 50); // center \n imagecopy ($imgCanvas, $imgBlur, 0, 0, 0, 0, $w, $h); \n imagecopymerge ($imgBlur, $imgCanvas, 0, 0, 0, 1, $w, $h - 1, 33.33333 ); // up \n imagecopymerge ($imgBlur, $imgCanvas, 0, 1, 0, 0, $w, $h, 25); // down \n } \n } \n\n // Calculate the difference between the blurred pixels and the original \n // and set the pixels \n // each row\n for ($x = 0; $x < $w-1; $x++)\n { \n // each pixel \n for ($y = 0; $y < $h; $y++)\n { \n if($threshold > 0)\n { \n $rgbOrig = ImageColorAt($img, $x, $y); \n $rOrig = (($rgbOrig >> 16) & 0xFF); \n $gOrig = (($rgbOrig >> 8) & 0xFF); \n $bOrig = ($rgbOrig & 0xFF); \n\n $rgbBlur = ImageColorAt($imgBlur, $x, $y); \n\n $rBlur = (($rgbBlur >> 16) & 0xFF); \n $gBlur = (($rgbBlur >> 8) & 0xFF); \n $bBlur = ($rgbBlur & 0xFF); \n\n // When the masked pixels differ less from the original \n // than the threshold specifies, they are set to their original value. \n if(abs($rOrig - $rBlur) >= $threshold) \n {\n $rNew = max(0, min(255, ($amount * ($rOrig - $rBlur)) + $rOrig));\n }\n else\n {\n $rNew = $rOrig;\n }\n\n if(abs($gOrig - $gBlur) >= $threshold)\n {\n $gNew = max(0, min(255, ($amount * ($gOrig - $gBlur)) + $gOrig));\n }\n else\n {\n $gNew = $gOrig;\n }\n\n if(abs($bOrig - $bBlur) >= $threshold)\n {\n $bNew = max(0, min(255, ($amount * ($bOrig - $bBlur)) + $bOrig));\n }\n else\n {\n $bNew = $bOrig;\n }\n\n if (($rOrig != $rNew) || ($gOrig != $gNew) || ($bOrig != $bNew))\n { \n $pixCol = ImageColorAllocate($img, $rNew, $gNew, $bNew); \n ImageSetPixel($img, $x, $y, $pixCol); \n }\n }\n else\n {\n $rgbOrig = ImageColorAt($img, $x, $y); \n $rOrig = (($rgbOrig >> 16) & 0xFF); \n $gOrig = (($rgbOrig >> 8) & 0xFF); \n $bOrig = ($rgbOrig & 0xFF); \n $rgbBlur = ImageColorAt($imgBlur, $x, $y); \n $rBlur = (($rgbBlur >> 16) & 0xFF); \n $gBlur = (($rgbBlur >> 8) & 0xFF); \n $bBlur = ($rgbBlur & 0xFF); \n\n $rNew = ($amount * ($rOrig - $rBlur)) + $rOrig; \n if($rNew>255)\n {\n $rNew = 255;\n } \n elseif($rNew<0)\n {\n $rNew = 0;\n } \n $gNew = ($amount * ($gOrig - $gBlur)) + $gOrig; \n if($gNew>255)\n {\n $gNew=255;\n } \n elseif($gNew<0)\n {\n $gNew=0;\n } \n $bNew = ($amount * ($bOrig - $bBlur)) + $bOrig; \n if($bNew>255)\n {\n $bNew=255;\n } \n elseif($bNew<0)\n {\n $bNew=0;\n } \n $rgbNew = ($rNew << 16) + ($gNew <<8) + $bNew; \n ImageSetPixel($img, $x, $y, $rgbNew); \n }\n } \n } \n \n $this->setWorkingImageResource($img);\n imagedestroy($imgCanvas);\n imagedestroy($imgBlur);\n }", "private function sharpenImage($image) {\n $matrix = array(\n array(-1,-1,-1,),\n array(-1,16,-1,),\n array(-1,-1,-1,)\n );\n $divisor = 8;\n $offset = 0;\n imageconvolution($image, $matrix, $divisor, $offset);\n if($this->verbose) {\n $this->createVerbose('Applying filter: Sharpen');\n }\n return $image;\n }", "public function Sharpen(float $sharpen, float $flat = 0, float $jagged = 0)\n {\n $this->setOption('sharp', $sharpen);\n\n if ($flat) $this->setOption('sharpf', $flat);\n\n if ($jagged) $this->setOption('sharpj', $jagged);\n\n return $this;\n }", "public function sharpen ($type = 'default', $radius = 0, $sigma = 1)\n {\n $sharpen = [\n [0, -1, 0],\n [-1, 5, -1],\n [0, -1, 0]\n ];\n\n // calculate the sharpen divisor\n $divisor = array_sum(array_map('array_sum', $sharpen));\n\n // apply the matrix\n imageconvolution($this->resource, $sharpen, $divisor, 0);\n }", "public function getSharps() {\n return $this->sharps;\n }", "public function AjaxSharpenL()\n {\n $image_name = $_POST['filename'];\n $image = Image::make(public_path() . '/' . $image_name)->sharpen(35);\n $image_path = public_path() . '/' . $image_name;\n if (File::exists($image_path)) {\n File::delete($image_path);\n }\n $image->save(public_path() . '/' . $image_name);\n $data = [];\n $data['src'] = '/' . $image_name;\n $data['name'] = $image_name;\n\n return $data;\n }", "public function sharp($value)\n {\n $this->args = array_merge($this->args, ['sharp' => $value]);\n\n return $this;\n }", "public function smooth($value=6)\n\t{\n\t\tif (!function_exists('imagefilter')) {\n\t\t\tthrow new Exception('imagefilter function is only available if PHP is compiled with the bundled version of the GD library.');\n\t\t}\n\t\t$this->checkImage();\n\t\t$value = max(-12, min($value, 12));\n\t\timagefilter($this->imageResized, IMG_FILTER_SMOOTH, $value);\n\n\t\treturn $this;\n\t}", "private function read_the_original_image_and_write() {\r\n\t\tfor ( $x = 0; $x <= $this->radius; $x += 0.01 ) {\r\n\r\n\t\t\t/* standard form for the equation of a circle ... don't tell me you never knew that ... */\r\n\t\t\t$y = sqrt( $this->diameter * $x - pow( $x , 2 ) ) + $this->radius;\r\n\r\n\t\t\t/* i think i should call this successive scans ... */\r\n\t\t\tfor ( $i = $x; $i < $this->diameter - $x; $i++ ) {\r\n\r\n\t\t\t\t/* half of the circle ... */\r\n\t\t\t\timagesetpixel (\r\n\t\t\t\t\t$this->cutted_image , $i, $y,\r\n\t\t\t\t\timagecolorat( $this->original_image, $i, $y )\r\n\t\t\t\t);\r\n\r\n\t\t\t\t/* the other half of course ... */\r\n\t\t\t\timagesetpixel (\r\n\t\t\t\t\t$this->cutted_image , $i, $this->diameter - $y,\r\n\t\t\t\t\timagecolorat( $this->original_image, $i, $this->diameter - $y )\r\n\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t/* avoid the white line when the diameter is an even number ... */\r\n\t\tif ( ! is_float( $this->radius ) )\r\n\t\t\tfor ( $i = 0; $i < $this->diameter; $i++ )\r\n\r\n\t\t\t\timagesetpixel (\r\n\t\t\t\t\t$this->cutted_image , $i, $this->radius - 1,\r\n\t\t\t\t\timagecolorat( $this->original_image, $i, $this->radius - 1 )\r\n\t\t\t\t);\r\n\r\n\t\t/* woo ... not as difficult as you think ... that's all ... */\r\n\t\treturn;\r\n\r\n\t}", "public function run(Request $request, Image $image)\n {\n $sharpen = $this->getSharpen($request->get('sharp'));\n\n if ($sharpen) {\n $image->sharpen($sharpen);\n }\n\n return $image;\n }", "function cilikke($src, $dest, $new_width) {\r\n\t$info = getimagesize($src);\r\n\t$mime = $info[\"mime\"];\r\n\tif( $mime == 'image/jpeg' ) $source_image = imagecreatefromjpeg($src);\r\n\telseif( $mime == 'image/png' ) $source_image = imagecreatefrompng($src);\r\n\t$width = imagesx($source_image);\r\n\t$height = imagesy($source_image);\r\n\t$new_height = floor($height * ($new_width / $width));\r\n\tif($new_width < $width && $new_height < $height)\r\n\t{\r\n\t\t$virtual_image = imagecreatetruecolor($new_width, $new_height);\t\r\n\t\timagecopyresampled($virtual_image, $source_image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);\r\n\t\timagejpeg($virtual_image, $dest);\r\n\t}else\r\n\t\tcopy($src, $dest);\r\n}", "public function noise($value=30)\n\t{\n\t\t$this->checkImage();\n\t\t$value = max(0, min($value, 255));\n\t\t$imageX = $this->optimalWidth;\n\t\t$imageY = $this->optimalHeight;\n\t\t$rand1 = $value;\n\t\t$rand2 = -1 * $value;\n\n\t\tfor ($x = 0; $x < $imageX; ++$x) {\n\t\t\tfor ($y = 0; $y < $imageY; ++$y) {\n\t\t\t\tif (rand(0,1)) {\n\t\t\t\t\t$rgb = imagecolorat($this->imageResized, $x, $y);\n\t\t\t\t\t$red = ($rgb >> 16) & 0xFF;\n\t\t\t\t\t$green = ($rgb >> 8) & 0xFF;\n\t\t\t\t\t$blue = $rgb & 0xFF;\n\t\t\t\t\t$modifier = rand($rand2, $rand1);\n\t\t\t\t\t$red += $modifier;\n\t\t\t\t\t$green += $modifier;\n\t\t\t\t\t$blue += $modifier;\n\t\t\t\t\tif ($red > 255) $red = 255;\n\t\t\t\t\tif ($green > 255) $green = 255;\n\t\t\t\t\tif ($blue > 255) $blue = 255;\n\t\t\t\t\tif ($red < 0) $red = 0;\n\t\t\t\t\tif ($green < 0) $green = 0;\n\t\t\t\t\tif ($blue < 0) $blue = 0;\n\t\t\t\t\t$newCol = imagecolorallocate($this->imageResized, $red, $green, $blue);\n\t\t\t\t\timagesetpixel($this->imageResized, $x, $y, $newCol);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn $this;\n\t}", "public function rasterbate($value=6)\n\t{\n\t\t$this->checkImage();\n\t\t$blockSize = (int)$value;\n\t\t$imageX = $this->optimalWidth;\n\t\t$imageY = $this->optimalHeight;\n\t\t$origImage = $this->imageResized;\n\n\t\t$this->imageResized = imagecreatetruecolor($imageX, $imageY);\n\t\t$background = imagecolorallocate($this->imageResized, 255, 255, 255);\n\t\timagefill($this->imageResized, 0, 0, $background);\n\n\t\tfor ($x = 0; $x < $imageX; $x += $blockSize) {\n\t\t\tfor ($y = 0; $y < $imageY; $y += $blockSize) {\n\t\t\t\t$thisCol = imagecolorat($origImage, $x, $y);\n\t\t\t\t$newR = 0;\n\t\t\t\t$newG = 0;\n\t\t\t\t$newB = 0;\n\t\t\t\t$colours = array();\n\t\t\t\tfor ($k = $x; $k < $x + $blockSize; ++$k) {\n\t\t\t\t\tfor ($l = $y; $l < $y + $blockSize; ++$l) {\n\t\t\t\t\t\tif ($k < 0) { $colours[] = $thisCol; continue; }\n\t\t\t\t\t\tif ($k >= $imageX) { $colours[] = $thisCol; continue; }\n\t\t\t\t\t\tif ($l < 0) { $colours[] = $thisCol; continue; }\n\t\t\t\t\t\tif ($l >= $imageY) { $colours[] = $thisCol; continue; }\n\t\t\t\t\t\t$colours[] = imagecolorat($origImage, $k, $l);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tforeach($colours as $colour) {\n\t\t\t\t\t$newR += ($colour >> 16) & 0xFF;\n\t\t\t\t\t$newG += ($colour >> 8) & 0xFF;\n\t\t\t\t\t$newB += $colour & 0xFF;\n\t\t\t\t}\n\t\t\t\t$numElems = count($colours);\n\t\t\t\t$newR = round($newR /= $numElems);\n\t\t\t\t$newG = round($newG /= $numElems);\n\t\t\t\t$newB = round($newB /= $numElems);\n\t\t\t\t$newCol = imagecolorallocate($this->imageResized, $newR, $newG, $newB);\n\t\t\t\t$newX = ($x+$blockSize)-($blockSize/2);\n\t\t\t\t$newY = ($y+$blockSize)-($blockSize/2);\n\t\t\t\t$newRgb = array($newR, $newG, $newB);\n\t\t\t\t$hsv = $this->rgb2hsv($newRgb);\n\t\t\t\t$newSize = round($blockSize * ((100 - $hsv[2]) / 100));\n\t\t\t\tif ($newSize > 0) {\n\t\t\t\t\timagefilledellipse($this->imageResized, $newX, $newY, $newSize, $newSize, $newCol);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\timagedestroy($origImage);\n\n\t\treturn $this;\n\t}", "function miniw($image_file, $destination, $width, $quality){\r\n# $image_file = sumber gambar\r\n# $destination = hasil thumbnail (path + file)\r\n# $width = lebar thumbnail (pixel)\r\n# $quality = kualitas JPG thumbnail\r\n\r\n$thumbw = $width; //lebar=100; tinggi akan diproposionalkan\r\n\r\n$src_img = imagecreatefromjpeg($image_file);\r\n$size[0] = ImageSX($src_img); // lebar\r\n$size[1] = ImageSY($src_img); // tinggi\r\n\r\n$thumbh = ($thumbw/$size[0])*$size[1]; //height\r\n$scale = min($thumbw/$size[0], $thumbh/$size[1]);\r\n$width = (int)($size[0]*$scale);\r\n$height = (int)($size[1]*$scale);\r\n$deltaw = (int)(($thumbw - $width)/2);\r\n$deltah = (int)(($thumbh - $height)/2);\r\n\r\nif($thumbw < $size[0]){\r\n$dst_img = imagecreatetruecolor($thumbw, $thumbh);\r\nimagecopyresampled($dst_img, $src_img, 0,0, 0,0, $thumbw, $thumbh,\r\n$size[0], $size[1]);\r\ntouch($destination);\r\nimagejpeg($dst_img, $destination, $quality); // Ini hasil akhirnya.\r\nimagedestroy($dst_img);\r\n} else {\r\n$dst_img = imagecreatetruecolor($size[0], $size[1]);\r\nimagecopyresampled($dst_img, $src_img, 0,0, 0,0, $size[0], $size[1],\r\n$size[0], $size[1]);\r\ntouch($destination);\r\nimagejpeg($dst_img, $destination, $quality); // Ini hasil akhirnya.\r\nimagedestroy($dst_img);\r\n}\r\n\r\nimagedestroy($src_img);\r\n}", "function lcd_resample($src, $dst, $strength)\n// Resamples an image ($src) onto another image ($dst) which should be\n// 1/3rd of the width and height of $src, and true-colour. This is done\n// using an LCD RGB subpixel antialiasing algorithm. $strength determines\n// the amount of 'LCDness' of the resampling.\n//\n// Try something like:\n// $dst = ImageCreateTrueColor(ImageSX($src)/3, ImageSY($src)/3);\n// lcd_resample($src, $dst, 2);\n// ImageTrueColorToPalette($dst, TRUE, 255);\n// ImagePNG($dst, $output);\n{\n\n // Get width and height of src and dst images.\n $sw = ImageSX($src);\n $sh = ImageSY($src);\n $dw = ImageSX($dst);\n $dh = ImageSY($dst);\n\n# XXX: Should really check here that $sw == $dw/3, etc.\n\n // $strength controls the influence weighting factors of neighbouring\n // source pixels. Each destination pixel \"covers\" 9 (3*3) source\n // pixels, but we actually look at 25 (5*5) pixels because of the RGB\n // subpixel offsets. The influence factors ($c0..$c3) determine how\n // these pixels are used.\n switch ($strength) {\n default:\n case 0: $c0 = 0; $c1 = 1; $c2 = 2; $c3 = 4; break;\n case 1: $c0 = 1; $c1 = 1; $c2 = 1; $c3 = 1; break;\n case 2: $c0 = 1; $c1 = 1; $c2 = 2; $c3 = 2; break;\n case 3: $c0 = 1; $c1 = 2; $c2 = 4; $c3 = 4; break;\n }\n\n // $cd: denominator of the matrix. That sounds SO dramatic.\n $cd = $c0*4 + $c1*2 + $c2*2 + $c3;\n\n // Allocate a mini-array for the 5x5 array of source pixels\n // (potentially) used by the resampler.\n $c = array();\n\n // Loop through all pixels in the destination image.\n for($dy=0; $dy<$dh; $dy++)\n\tfor($dx=0; $dx<$dw; $dx++) {\n\n\t // Calculate the coordinates for the centre pixel in the source\n\t // equivalent to the current destination pixel.\n\t $sx = 2 + $dx * 3;\n\t $sy = 2 + $dy * 3;\n\n\t // Get the source pixels into $c\n\t _get_25_pixels($src, $c, $sx, $sy, $sw, $sh);\n\n\t // Calculate red component from leftmost pixel block\n\t $r =\n\t\t$c[0][0]*$c0 + $c[5][0]*$c1 + $c[10][0]*$c0 +\n\t\t$c[1][0]*$c2 + $c[6][0]*$c3 + $c[11][0]*$c2 +\n\t\t$c[2][0]*$c0 + $c[7][0]*$c1 + $c[12][0]*$c0;\n\n\t // Calculate green component from centre pixel block\n\t $g =\n\t\t$c[1][1]*$c0 + $c[6][1]*$c1 + $c[11][1]*$c0 +\n\t\t$c[2][1]*$c2 + $c[7][1]*$c3 + $c[12][1]*$c2 +\n\t\t$c[3][1]*$c0 + $c[8][1]*$c1 + $c[13][1]*$c0;\n\n\t // Calculate blue component from rightmost pixel block\n\t $b =\n\t\t$c[2][2]*$c0 + $c[7][2]*$c1 + $c[12][2]*$c0 +\n\t\t$c[3][2]*$c2 + $c[8][2]*$c3 + $c[13][2]*$c2 +\n\t\t$c[4][2]*$c0 + $c[9][2]*$c1 + $c[14][2]*$c0;\n\n\t // Convert to 0..255 integers for RGB.\n\t $r = intval($r/$cd);\n\t $g = intval($g/$cd);\n\t $b = intval($b/$cd);\n\n\t // Set destination pixel.\n\t $col = ImageColorAllocate($dst, $r, $g, $b);\n\t ImageSetPixel($dst, $dx, $dy, $col);\n\t}\n}", "private function custom_round_pixelate($blocksize)\n\t{\n\t\t$imagex = imagesx($this->image);\n\t\t$imagey = imagesy($this->image);\n\n\t\tfor ($x=0; $x<$imagex; $x+=$blocksize)\n\t\t{\n\t\t\tfor ($y = 0; $y < $imagey; $y += $blocksize)\n\t\t\t{\n\t\t\t\t$colour = imagecolorat($this->image, $x, $y);\n\t\t\t\timagefilledellipse($this->image, $x - $blocksize / 2, $y - $blocksize / 2, $blocksize, $blocksize, $colour);\n\t\t\t}\n\t\t}\n\t}", "public function getSharp($index) {\n if (isset($this->sharps[$index])) {\n return $this->sharps[$index];\n }\n\n return null;\n }", "private function custom_oil($strength, $diff, $brushsize)\n\t{\n\t\t$imagex = imagesx($this->image);\n\t\t$imagey = imagesy($this->image);\n\n\t\tfor ($x = 0; $x < $imagex; ++$x)\n\t\t{\n\t\t\tfor ($y = 0; $y < $imagey; ++$y)\n\t\t\t{\n\t\t\t\tif(rand(0, $strength) < 2)\n\t\t\t\t{\n\t\t\t\t\t$rgb = imagecolorat($this->image, $x, $y);\n\t\t\t\t\t$red = ($rgb >> 16) & 0xFF;\n\t\t\t\t\t$green = ($rgb >> 8) & 0xFF;\n\t\t\t\t\t$blue = $rgb & 0xFF;\n\t\t\t\t\t$modifier = rand($diff * -1, $diff);\n\t\t\t\t\t$red += $modifier;\n\t\t\t\t\t$green += $modifier;\n\t\t\t\t\t$blue += $modifier;\n\n\t\t\t\t\tif ($red > 255) $red = 255;\n\t\t\t\t\tif ($green > 255) $green = 255;\n\t\t\t\t\tif ($blue > 255) $blue = 255;\n\t\t\t\t\tif ($red < 0) $red = 0;\n\t\t\t\t\tif ($green < 0) $green = 0;\n\t\t\t\t\tif ($blue < 0) $blue = 0;\n\n\t\t\t\t\t$colour = imagecolorallocate($this->image, $red, $green, $blue);\n\t\t\t\t\t//imagesetpixel($image, $x, $y, $newcol);\n\t\t\t\t\timagefilledellipse($this->image, $x, $y, $brushsize, $brushsize, $colour);\n\t\t\t\t}//end if\n\t\t\t}//end for\n\t\t}//end for\n\t}", "function fastimagecopyresampled ($dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h, $quality = 3) {\n // Just include this function and change all \"imagecopyresampled\" references to \"fastimagecopyresampled\".\n // Typically from 30 to 60 times faster when reducing high resolution images down to thumbnail size using the default quality setting.\n // Author: Tim Eckel - Date: 09/07/07 - Version: 1.1 - Project: FreeRingers.net - Freely distributable - These comments must remain.\n //\n // Optional \"quality\" parameter (defaults is 3). Fractional values are allowed, for example 1.5. Must be greater than zero.\n // Between 0 and 1 = Fast, but mosaic results, closer to 0 increases the mosaic effect.\n // 1 = Up to 350 times faster. Poor results, looks very similar to imagecopyresized.\n // 2 = Up to 95 times faster. Images appear a little sharp, some prefer this over a quality of 3.\n // 3 = Up to 60 times faster. Will give high quality smooth results very close to imagecopyresampled, just faster.\n // 4 = Up to 25 times faster. Almost identical to imagecopyresampled for most images.\n // 5 = No speedup. Just uses imagecopyresampled, no advantage over imagecopyresampled.\n \n if (empty($src_image) || empty($dst_image) || $quality <= 0) { return false; }\n if ($quality < 5 && (($dst_w * $quality) < $src_w || ($dst_h * $quality) < $src_h)) {\n $temp = imagecreatetruecolor ($dst_w * $quality + 1, $dst_h * $quality + 1);\n imagecopyresized ($temp, $src_image, 0, 0, $src_x, $src_y, $dst_w * $quality + 1, $dst_h * $quality + 1, $src_w, $src_h);\n imagecopyresampled ($dst_image, $temp, $dst_x, $dst_y, 0, 0, $dst_w, $dst_h, $dst_w * $quality, $dst_h * $quality);\n imagedestroy ($temp);\n } else imagecopyresampled ($dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);\n return true;\n}", "function sharpen_resized_jpeg_images($resized_file) {\r\n $image = wp_load_image($resized_file); \r\n if(!is_resource($image))\r\n return new WP_Error('error_loading_image', $image, $file); \r\n $size = @getimagesize($resized_file);\r\n if(!$size)\r\n return new WP_Error('invalid_image', __('Could not read image size'), $file); \r\n list($orig_w, $orig_h, $orig_type) = $size; \r\n switch($orig_type) {\r\n case IMAGETYPE_JPEG:\r\n $matrix = array(\r\n array(-1, -1, -1),\r\n array(-1, 16, -1),\r\n array(-1, -1, -1),\r\n ); \r\n $divisor = array_sum(array_map('array_sum', $matrix));\r\n $offset = 0; \r\n imageconvolution($image, $matrix, $divisor, $offset);\r\n imagejpeg($image, $resized_file,apply_filters('jpeg_quality', 90, 'edit_image'));\r\n break;\r\n case IMAGETYPE_PNG:\r\n return $resized_file;\r\n case IMAGETYPE_GIF:\r\n return $resized_file;\r\n } \r\n return $resized_file;\r\n}", "function scaleByFactor($size)\r\n {\r\n $new_x = round($size * $this->img_x, 0);\r\n $new_y = round($size * $this->img_y, 0);\r\n return $this->_resize($new_x, $new_y);\r\n }", "public function pixelate($value=10, $native=true)\n\t{\n\t\t$this->checkImage();\n\t\t$blockSize = (int)$value;\n\t\t$native = (bool)$native;\n\n\t\tif ($native && function_exists('imagefilter') && version_compare(PHP_VERSION, '5.3.0') >= 0) {\n\t\t\timagefilter($this->imageResized, IMG_FILTER_PIXELATE, $blockSize, true);\n\t\t} else {\n\t\t\t$imageX = $this->optimalWidth;\n\t\t\t$imageY = $this->optimalHeight;\n\t\t\tfor ($x = 0; $x < $imageX; $x += $blockSize) {\n\t\t\t\tfor ($y = 0; $y < $imageY; $y += $blockSize) {\n\t\t\t\t\t$thisCol = imagecolorat($this->imageResized, $x, $y);\n\t\t\t\t\t$newR = 0;\n\t\t\t\t\t$newG = 0;\n\t\t\t\t\t$newB = 0;\n\t\t\t\t\t$colours = array();\n\t\t\t\t\tfor ($k = $x; $k < $x + $blockSize; ++$k) {\n\t\t\t\t\t\tfor ($l = $y; $l < $y + $blockSize; ++$l) {\n\t\t\t\t\t\t\tif ($k < 0) { $colours[] = $thisCol; continue; }\n\t\t\t\t\t\t\tif ($k >= $imageX) { $colours[] = $thisCol; continue; }\n\t\t\t\t\t\t\tif ($l < 0) { $colours[] = $thisCol; continue; }\n\t\t\t\t\t\t\tif ($l >= $imageY) { $colours[] = $thisCol; continue; }\n\t\t\t\t\t\t\t$colours[] = imagecolorat($this->imageResized, $k, $l);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tforeach($colours as $colour) {\n\t\t\t\t\t\t$newR += ($colour >> 16) & 0xFF;\n\t\t\t\t\t\t$newG += ($colour >> 8) & 0xFF;\n\t\t\t\t\t\t$newB += $colour & 0xFF;\n\t\t\t\t\t}\n\t\t\t\t\t$numElems = count($colours);\n\t\t\t\t\t$newR = round($newR /= $numElems);\n\t\t\t\t\t$newG = round($newG /= $numElems);\n\t\t\t\t\t$newB = round($newB /= $numElems);\n\t\t\t\t\t$newCol = imagecolorallocate($this->imageResized, $newR, $newG, $newB);\n\t\t\t\t\timagefilledrectangle($this->imageResized, $x, $y, $x + $blockSize - 1, $y + $blockSize - 1, $newCol);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn $this;\n\t}", "function noisemaker($im)\n{\n imageSetThickness($im, 2);\n for ($i = 1; $i < 200; $i++) {\n imageSetPixel($im, rand(5, 195), rand(75, 5), imageColorAllocate($im, 8, 24, 89));\n }\n for ($i = 1; $i < 4; $i++) {\n imageline($im, rand(5, 195), rand(60, 20), rand(5, 195), rand(60, 20), imageColorAllocate($im, 240, 240, 240));\n }\n return;\n}", "function fastimagecopyresampled (&$dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h, $quality) {\n // Plug-and-Play fastimagecopyresampled function replaces much slower imagecopyresampled.\n // Just include this function and change all \"imagecopyresampled\" references to \"fastimagecopyresampled\".\n // Typically from 30 to 60 times faster when reducing high resolution images down to thumbnail size using the default quality setting.\n // Author: Tim Eckel - Date: 12/17/04 - Project: FreeRingers.net - Freely distributable.\n //\n // Optional \"quality\" parameter (defaults is 3). Fractional values are allowed, for example 1.5.\n // 1 = Up to 600 times faster. Poor results, just uses imagecopyresized but removes black edges.\n // 2 = Up to 95 times faster. Images may appear too sharp, some people may prefer it.\n // 3 = Up to 60 times faster. Will give high quality smooth results very close to imagecopyresampled.\n // 4 = Up to 25 times faster. Almost identical to imagecopyresampled for most images.\n // 5 = No speedup. Just uses imagecopyresampled, highest quality but no advantage over imagecopyresampled.\n\n if (empty($src_image) || empty($dst_image)) { return false; }\n if ($quality <= 1) {\n $temp = imagecreatetruecolor ($dst_w + 1, $dst_h + 1);\n imagecopyresized ($temp, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w + 1, $dst_h + 1, $src_w, $src_h);\n imagecopyresized ($dst_image, $temp, 0, 0, 0, 0, $dst_w, $dst_h, $dst_w, $dst_h);\n imagedestroy ($temp);\n } elseif ($quality < 5 && (($dst_w * $quality) < $src_w || ($dst_h * $quality) < $src_h)) {\n $tmp_w = $dst_w * $quality;\n $tmp_h = $dst_h * $quality;\n $temp = imagecreatetruecolor ($tmp_w + 1, $tmp_h + 1);\n imagecopyresized ($temp, $src_image, $dst_x * $quality, $dst_y * $quality, $src_x, $src_y, $tmp_w + 1, $tmp_h + 1, $src_w, $src_h);\n imagecopyresampled ($dst_image, $temp, 0, 0, 0, 0, $dst_w, $dst_h, $tmp_w, $tmp_h);\n imagedestroy ($temp);\n } else {\n imagecopyresampled ($dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);\n }\n return true;\n }", "function fastimagecopyresampled ($dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h, $quality = 3) {\r\n // Plug-and-Play fastimagecopyresampled function replaces much slower imagecopyresampled.\r\n // Just include this function and change all \"imagecopyresampled\" references to \"fastimagecopyresampled\".\r\n // Typically from 30 to 60 times faster when reducing high resolution images down to thumbnail size using the default quality setting.\r\n // Author: Tim Eckel - Date: 12/17/04 - Project: FreeRingers.net - Freely distributable.\r\n //\r\n // Optional \"quality\" parameter (defaults is 3). Fractional values are allowed, for example 1.5.\r\n // 1 = Up to 600 times faster. Poor results, just uses imagecopyresized but removes black edges.\r\n // 2 = Up to 95 times faster. Images may appear too sharp, some people may prefer it.\r\n // 3 = Up to 60 times faster. Will give high quality smooth results very close to imagecopyresampled.\r\n // 4 = Up to 25 times faster. Almost identical to imagecopyresampled for most images.\r\n // 5 = No speedup. Just uses imagecopyresampled, highest quality but no advantage over imagecopyresampled.\r\n\r\n if (empty($src_image) || empty($dst_image)) { return false; }\r\n if ($quality <= 1) {\r\n $temp = imagecreatetruecolor ($dst_w + 1, $dst_h + 1);\r\n imagecopyresized ($temp, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w + 1, $dst_h + 1, $src_w, $src_h);\r\n imagecopyresized ($dst_image, $temp, 0, 0, 0, 0, $dst_w, $dst_h, $dst_w, $dst_h);\r\n imagedestroy ($temp);\r\n } elseif ($quality < 5 && (($dst_w * $quality) < $src_w || ($dst_h * $quality) < $src_h)) {\r\n $tmp_w = $dst_w * $quality;\r\n $tmp_h = $dst_h * $quality;\r\n $temp = imagecreatetruecolor ($tmp_w + 1, $tmp_h + 1);\r\n imagecopyresized ($temp, $src_image, $dst_x * $quality, $dst_y * $quality, $src_x, $src_y, $tmp_w + 1, $tmp_h + 1, $src_w, $src_h);\r\n imagecopyresampled ($dst_image, $temp, 0, 0, 0, 0, $dst_w, $dst_h, $tmp_w, $tmp_h);\r\n imagedestroy ($temp);\r\n } else {\r\n imagecopyresampled ($dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);\r\n }\r\n //return true;\r\n}", "function compress($source, $destination) {\n\n // Get the dimensions of the image\n list($img_in_width, $img_in_height) = getimagesize($source);\n\n // Define the output width\n $out_width = 200;\n \n // Define the height based on the aspect ratio\n $out_height = $out_width * $img_in_height / $img_in_width;\n\n // Create an output image\n $img_out = imagecreatetruecolor($out_width, $out_height);\n \n // Load the input image\n $img_in = imagecreatefromjpeg($source);\n \n // Copy the contents of the image to the output, resizing in the process\n imagecopyresampled($img_out, $img_in, 0, 0, 0, 0, $out_width, $out_height, $img_in_width, $img_in_height);\n \n // Save the file as a JPEG image to the destination\n imagejpeg($img_out, $destination);\n}", "public function selectiveBlur($amount) {\n\t\tif(!$this->image) {\n\t\t\ttrigger_error('The image does not exist or is not readable.', E_USER_WARNING);\n\t\t\treturn false;\n\t\t}\n\t\t$amount = (int) $amount;\n\t\t$res = true;\n\t\twhile($amount > 0) {\n\t\t\t$res = imagefilter($this->image, IMG_FILTER_SELECTIVE_BLUR) && $res;\n\t\t\t$amount--;\n\t\t}\n\t\treturn $res;\n\t}", "function resize_square($size){\n\n //container for new image\n $new_image = imagecreatetruecolor($size, $size);\n\n\n if($this->width > $this->height){\n $this->resize_by_height($size);\n\n imagecolortransparent($new_image, imagecolorallocate($new_image, 0, 0, 0));\n imagealphablending($new_image, false);\n imagesavealpha($new_image, true);\n imagecopy($new_image, $this->image, 0, 0, ($this->get_width() - $size) / 2, 0, $size, $size);\n }else{\n $this->resize_by_width($size);\n\n imagecolortransparent($new_image, imagecolorallocate($new_image, 0, 0, 0));\n imagealphablending($new_image, false);\n imagesavealpha($new_image, true);\n imagecopy($new_image, $this->image, 0, 0, 0, ($this->get_height() - $size) / 2, $size, $size);\n }\n\n $this->image = $new_image;\n\n //reset sizes\n $this->width = $size;\n $this->height = $size;\n\n return true;\n }", "function fastimagecopyresampled(&$dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h, $quality = 3)\n{\n // Just include this function and change all \"imagecopyresampled\" references to \"fastimagecopyresampled\".\n // Typically from 30 to 60 times faster when reducing high resolution images down to thumbnail size using the default quality setting.\n // Author: Tim Eckel - Date: 12/17/04 - Project: FreeRingers.net - Freely distributable.\n //\n // Optional \"quality\" parameter (defaults is 3). Fractional values are allowed, for example 1.5.\n // 1 = Up to 600 times faster. Poor results, just uses imagecopyresized but removes black edges.\n // 2 = Up to 95 times faster. Images may appear too sharp, some people may prefer it.\n // 3 = Up to 60 times faster. Will give high quality smooth results very close to imagecopyresampled.\n // 4 = Up to 25 times faster. Almost identical to imagecopyresampled for most images.\n // 5 = No speedup. Just uses imagecopyresampled, highest quality but no advantage over imagecopyresampled.\n\n if (empty($src_image) || empty($dst_image)) {\n return false;\n }\n if ($quality <= 1) {\n $temp = imagecreatetruecolor($dst_w + 1, $dst_h + 1);\n imagecopyresized($temp, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w + 1, $dst_h + 1, $src_w, $src_h);\n imagecopyresized($dst_image, $temp, 0, 0, 0, 0, $dst_w, $dst_h, $dst_w, $dst_h);\n imagedestroy($temp);\n } elseif ($quality < 5 && (($dst_w * $quality) < $src_w || ($dst_h * $quality) < $src_h)) {\n $tmp_w = $dst_w * $quality;\n $tmp_h = $dst_h * $quality;\n $temp = imagecreatetruecolor($tmp_w + 1, $tmp_h + 1);\n imagecopyresized($temp, $src_image, $dst_x * $quality, $dst_y * $quality, $src_x, $src_y, $tmp_w + 1, $tmp_h + 1, $src_w, $src_h);\n imagecopyresampled($dst_image, $temp, 0, 0, 0, 0, $dst_w, $dst_h, $tmp_w, $tmp_h);\n imagedestroy($temp);\n } else {\n imagecopyresampled($dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);\n }\n return true;\n}", "function imageresize($img,$target=\"\",$width=0,$height=0,$percent=0)\n{\n if (strpos($img,\".jpg\") !== false or strpos($img,\".jpeg\") !== false){\n\t $image = ImageCreateFromJpeg($img);\n\t $extension = \".jpg\";\n } elseif (strpos($img,\".png\") !== false) {\n\t $image = ImageCreateFromPng($img);\n\t $extension = \".png\";\n } elseif (strpos($img,\".gif\") !== false) {\n\t $image = ImageCreateFromGif($img);\n\t $extension = \".gif\";\n }elseif(getfiletype($img)=='bmp'){\n\t\t$image = ImageCreateFromwbmp($img);\n\t\t$extension = '.bmp';\n }\n\n $size = getimagesize ($img);\n\n // calculate missing values\n if ($width and !$height) {\n\t $height = ($size[1] / $size[0]) * $width;\n } elseif (!$width and $height) {\n\t $width = ($size[0] / $size[1]) * $height;\n } elseif ($percent) {\n\t $width = $size[0] / 100 * $percent;\n\t $height = $size[1] / 100 * $percent;\n } elseif (!$width and !$height and !$percent) {\n\t $width = 100; // here you can enter a standard value for actions where no arguments are given\n\t $height = ($size[1] / $size[0]) * $width;\n }\n\n $thumb = imagecreatetruecolor ($width, $height);\n\n if (function_exists(\"imageCopyResampled\"))\n {\n\t if (!@ImageCopyResampled($thumb, $image, 0, 0, 0, 0, $width, $height, $size[0], $size[1])) {\n\t\t ImageCopyResized($thumb, $image, 0, 0, 0, 0, $width, $height, $size[0], $size[1]);\n\t }\n\t} else {\n\t ImageCopyResized($thumb, $image, 0, 0, 0, 0, $width, $height, $size[0], $size[1]);\n\t}\n\n //ImageCopyResampleBicubic ($thumb, $image, 0, 0, 0, 0, $width, $height, $size[0], $size[1]);\n\n if (!$target) {\n\t $target = \"temp\".$extension;\n }\n\n $return = true;\n\n switch ($extension) {\n\t case \".jpeg\":\n\t case \".jpg\": {\n\t\t imagejpeg($thumb, $target, 100);\n\t break;\n\t }\n\t case \".gif\": {\n\t\t imagegif($thumb, $target);\n\t break;\n\t }\n\t case \".png\": {\n\t\t imagepng($thumb, $target);\n\t break;\n\t }\n\t case \".bmp\": {\n\t\t imagewbmp($thumb,$target);\n\t }\n\t default: {\n\t\t $return = false;\n\t }\n }\n\n // report the success (or fail) of the action\n return $return;\n}", "function pixelate($image, $output, $pixelate_x = 20, $pixelate_y = 20)\n{\n if(!file_exists($image))\n echo 'File \"'. $image .'\" not found';\n\n // get the input file extension and create a GD resource from it\n $ext = pathinfo($image, PATHINFO_EXTENSION);\n if($ext == \"jpg\" || $ext == \"jpeg\")\n $img = imagecreatefromjpeg($image);\n elseif($ext == \"png\")\n $img = imagecreatefrompng($image);\n elseif($ext == \"gif\")\n $img = imagecreatefromgif($image);\n else\n echo 'Unsupported file extension';\n\n // now we have the image loaded up and ready for the effect to be applied\n // get the image size\n $size = getimagesize($image);\n $height = $size[1];\n $width = $size[0];\n\n // start from the top-left pixel and keep looping until we have the desired effect\n for($y = 0;$y < $height;$y += $pixelate_y+1)\n {\n\n for($x = 0;$x < $width;$x += $pixelate_x+1)\n {\n // get the color for current pixel\n $rgb = imagecolorsforindex($img, imagecolorat($img, $x, $y));\n\n // get the closest color from palette\n $color = imagecolorclosest($img, $rgb['red'], $rgb['green'], $rgb['blue']);\n imagefilledrectangle($img, $x, $y, $x+$pixelate_x, $y+$pixelate_y, $color);\n\n } \n }\n\n // save the image\n $output_name = $output .'_pix.jpg';\n\n imagejpeg($img, $output_name);\n imagedestroy($img); \n}", "public function reseize($path, $source, $width, $height, $nama_ori){\n \t//$source = sumber gambar yang akan di reseize\n $config['image_library'] = 'gd2';\n $config['source_image'] = $source;\n $config['new_image'] = $path.$width.'_'.$nama_ori;\n $config['overwrite'] = TRUE;\n $config['create_thumb'] = false;\n $config['width'] = $width;\n if($height>0){\n \t$config['maintain_ratio'] = false;\n \t$config['height'] = $height;\n }else{\n \t$config['maintain_ratio'] = true;\n }\n\n $this->image_lib->initialize($config);\n\n $this->image_lib->resize();\n $this->image_lib->clear();\n }", "function swf_shapefillbitmapclip($bitmapid)\n{\n}", "public function darken(double $value, bool $percent = false)\n\t{\n\t\tif ($percent) {\n\t\t\t$value /= 100;\n\t\t}\n\t\tif ($value < 0 or $value > 1) {\n\t\t\tthrow new \\OutOfRangeException($percent . ' is out of [0, 1] range.');\n\t\t}\n\t\t$sat = $this->saturation->getValue();\n\t\t$sat *= (1 - $value);\n\t\tif ($sat < 0) {\n\t\t\t$sat = 0;\n\t\t}\n\t\t$this->saturation->setValue($sat);\n\t}", "public function swim()\n {\n }", "function make_thumb($folder,$src,$dest,$thumb_width) {\n\n\t$source_image = imagecreatefromjpeg($folder.'/'.$src);\n\t$width = imagesx($source_image);\n\t$height = imagesy($source_image);\n\t\n\t$thumb_height = floor($height*($thumb_width/$width));\n\t\n\t$virtual_image = imagecreatetruecolor($thumb_width,$thumb_height);\n\t\n\timagecopyresampled($virtual_image,$source_image,0,0,0,0,$thumb_width,$thumb_height,$width,$height);\n\t\n\timagejpeg($virtual_image,$dest,100);\n\t\n}", "function imagecropauto($image, $mode = -1, $threshold = 0.5, $color = -1)\n{\n}", "function scaleByLength($size)\r\n {\r\n if ($this->img_x >= $this->img_y) {\r\n $new_x = $size;\r\n $new_y = round(($new_x / $this->img_x) * $this->img_y, 0);\r\n } else {\r\n $new_y = $size;\r\n $new_x = round(($new_y / $this->img_y) * $this->img_x, 0);\r\n }\r\n return $this->_resize($new_x, $new_y);\r\n }", "function scaleByPercentage($size)\r\n {\r\n return $this->scaleByFactor($size / 100);\r\n }", "public function scatter($value=4)\n\t{\n\t\t$this->checkImage();\n\t\t$value = (int)$value;\n\t\t$imageX = $this->optimalWidth;\n\t\t$imageY = $this->optimalHeight;\n\t\t$rand1 = $value;\n\t\t$rand2 = -1 * $value;\n\n\t\tfor ($x = 0; $x < $imageX; ++$x) {\n\t\t\tfor ($y = 0; $y < $imageY; ++$y) {\n\t\t\t\t$distX = rand($rand2, $rand1);\n\t\t\t\t$distY = rand($rand2, $rand1);\n\t\t\t\tif ($x + $distX >= $imageX) continue;\n\t\t\t\tif ($x + $distX < 0) continue;\n\t\t\t\tif ($y + $distY >= $imageY) continue;\n\t\t\t\tif ($y + $distY < 0) continue;\n\t\t\t\t$oldCol = imagecolorat($this->imageResized, $x, $y);\n\t\t\t\t$newCol = imagecolorat($this->imageResized, $x + $distX, $y + $distY);\n\t\t\t\timagesetpixel($this->imageResized, $x, $y, $newCol);\n\t\t\t\timagesetpixel($this->imageResized, $x + $distX, $y + $distY, $oldCol);\n\t\t\t}\n\t\t}\n\n\t\treturn $this;\n\t}", "public function clip() {}", "public static function makeCover($sourceImg, $destImg)\r\n\t{\r\n\t\t$image = new Imagick($sourceImg);\r\n\t\t$w_orig = $image->getImageWidth();\r\n\t\t$h_orig = $image->getImageHeight();\r\n\t\t$w_new = SmIMAGE;\r\n\t\t$h_new = SmIMAGE * COVERASPECT;\r\n\t\t$ratio_orig = $h_orig / $w_orig;\r\n\r\n\t\tif($ratio_orig == COVERASPECT) {\r\n\t\t\t// Only resize\r\n\t\t\t$image->resizeImage($w_new, $h_new, Imagick::FILTER_CATROM, 1, TRUE);\r\n\t\t} else {\r\n\t\t\tif($ratio_orig >= COVERASPECT) {\r\n\t\t\t\t// Taller than target\r\n\t\t\t\t$w_temp = $w_new;\r\n\t\t\t\t$h_temp = $w_new * $ratio_orig;\r\n\t\t\t\t$w_center = 0;\r\n\t\t\t\t$h_center = ($h_temp - $h_new) / 2;\r\n\t\t\t} else {\r\n\t\t\t\t// Wider than target\r\n\t\t\t\t$w_temp = $h_new / $ratio_orig;\r\n\t\t\t\t$h_temp = $h_new;\r\n\t\t\t\t$w_center = ($w_temp - $w_new) / 2;\r\n\t\t\t\t$h_center = 0;\r\n\t\t\t}\r\n\t\t\t$image->resizeImage($w_temp, $h_temp, Imagick::FILTER_CATROM, 1, TRUE);\r\n\t\t\t$image->cropImage($w_new, $h_new, $w_center, $h_center);\r\n\t\t}\r\n\r\n\t\t$image->setImageCompression(Imagick::COMPRESSION_JPEG);\r\n\t\t$image->setImageCompressionQuality(80);\r\n\t\t$image->writeImage($destImg);\r\n\t\t$image->destroy();\r\n\t}", "public function applyFilter(\\Intervention\\Image\\Image $image)\n {\n return $image->fit(120, 120);\n }", "function ImageCopyBicubic ($dst_img, $src_img, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h) {\n\n global $CFG;\n\n if (function_exists('ImageCopyResampled') and $CFG->gdversion >= 2) { \n return ImageCopyResampled($dst_img, $src_img, $dst_x, $dst_y, $src_x, $src_y,\n $dst_w, $dst_h, $src_w, $src_h);\n }\n\n $totalcolors = imagecolorstotal($src_img);\n for ($i=0; $i<$totalcolors; $i++) { \n if ($colors = ImageColorsForIndex($src_img, $i)) {\n ImageColorAllocate($dst_img, $colors['red'], $colors['green'], $colors['blue']);\n }\n }\n\n $scaleX = ($src_w - 1) / $dst_w; \n $scaleY = ($src_h - 1) / $dst_h; \n\n $scaleX2 = $scaleX / 2.0; \n $scaleY2 = $scaleY / 2.0; \n\n for ($j = 0; $j < $dst_h; $j++) { \n $sY = $j * $scaleY; \n\n for ($i = 0; $i < $dst_w; $i++) { \n $sX = $i * $scaleX; \n\n $c1 = ImageColorsForIndex($src_img,ImageColorAt($src_img,(int)$sX,(int)$sY+$scaleY2)); \n $c2 = ImageColorsForIndex($src_img,ImageColorAt($src_img,(int)$sX,(int)$sY)); \n $c3 = ImageColorsForIndex($src_img,ImageColorAt($src_img,(int)$sX+$scaleX2,(int)$sY+$scaleY2)); \n $c4 = ImageColorsForIndex($src_img,ImageColorAt($src_img,(int)$sX+$scaleX2,(int)$sY)); \n\n $red = (int) (($c1['red'] + $c2['red'] + $c3['red'] + $c4['red']) / 4); \n $green = (int) (($c1['green'] + $c2['green'] + $c3['green'] + $c4['green']) / 4); \n $blue = (int) (($c1['blue'] + $c2['blue'] + $c3['blue'] + $c4['blue']) / 4); \n\n $color = ImageColorClosest ($dst_img, $red, $green, $blue); \n ImageSetPixel ($dst_img, $i + $dst_x, $j + $dst_y, $color); \n } \n } \n}", "function stretchDraw($x1, $y1, $x2, $y2, $image)\r\n {\r\n echo \"$this->_canvas.drawImage(\\\"$image\\\", $x1, $y1, $x2-$x1+1, $y2-$y1+1);\\n\";\r\n }", "function image_mirror_gd()\n\t{\t\t\n\t\tif ( ! $src_img = $this->image_create_gd())\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\t\t\n\t\t$width = $this->src_width;\n\t\t$height = $this->src_height;\n\n\t\tif ($this->rotation == 'hor')\n\t\t{\n\t\t\tfor ($i = 0; $i < $height; $i++)\n\t\t\t{\t\t \n\t\t\t\t$left = 0; \n\t\t\t\t$right = $width-1; \n\t\n\t\t\t\twhile ($left < $right)\n\t\t\t\t{ \n\t\t\t\t\t$cl = imagecolorat($src_img, $left, $i); \n\t\t\t\t\t$cr = imagecolorat($src_img, $right, $i);\n\t\t\t\t\t\n\t\t\t\t\timagesetpixel($src_img, $left, $i, $cr); \n\t\t\t\t\timagesetpixel($src_img, $right, $i, $cl); \n\t\t\t\t\t\n\t\t\t\t\t$left++; \n\t\t\t\t\t$right--; \n\t\t\t\t} \n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfor ($i = 0; $i < $width; $i++)\n\t\t\t{\t\t \n\t\t\t\t$top = 0; \n\t\t\t\t$bot = $height-1; \n\t\n\t\t\t\twhile ($top < $bot)\n\t\t\t\t{ \n\t\t\t\t\t$ct = imagecolorat($src_img, $i, $top);\n\t\t\t\t\t$cb = imagecolorat($src_img, $i, $bot);\n\t\t\t\t\t\n\t\t\t\t\timagesetpixel($src_img, $i, $top, $cb); \n\t\t\t\t\timagesetpixel($src_img, $i, $bot, $ct); \n\t\t\t\t\t\n\t\t\t\t\t$top++; \n\t\t\t\t\t$bot--; \n\t\t\t\t} \n\t\t\t}\t\t\n\t\t}\n\t\t\n\t\t/** ---------------------------------\n\t\t/** Save the Image\n\t\t/** ---------------------------------*/\n\t\tif ( ! $this->image_save_gd($src_img))\n\t\t{\t\t\n\t\t\treturn FALSE;\n\t\t}\n\t\t\n\t\t/** ---------------------------------\n\t\t/** Kill the file handles\n\t\t/** ---------------------------------*/\n\t\timagedestroy($src_img);\n\t\t\n\t\t// Set the file to 777\n\t\t@chmod($this->full_dst_path, FILE_WRITE_MODE);\t\t\t\n\t\t\n\t\treturn TRUE;\n\t}", "function crop_image_square($source, $destination, $image_type, $square_size, $image_width, $image_height, $quality){\n\tif($image_width <= 0 || $image_height <= 0){return false;} //return false if nothing to resize\n\n\tif( $image_width > $image_height )\n\t{\n\t\t$y_offset = 0;\n\t\t$x_offset = ($image_width - $image_height) / 2;\n\t\t$s_size \t= $image_width - ($x_offset * 2);\n\t}else{\n\t\t$x_offset = 0;\n\t\t$y_offset = ($image_height - $image_width) / 2;\n\t\t$s_size = $image_height - ($y_offset * 2);\n\t}\n\t$new_canvas\t= imagecreatetruecolor( $square_size, $square_size); //Create a new true color image\n\n\t//Copy and resize part of an image with resampling\n\tif(imagecopyresampled($new_canvas, $source, 0, 0, $x_offset, $y_offset, $square_size, $square_size, $s_size, $s_size)){\n\t\tsave_image($new_canvas, $destination, $image_type, $quality);\n\t}\n\n\treturn true;\n}", "public static function crop(){\n\n}", "private function makeSquare($image_path, $i)\n {\n//\n// $img1 = $this->image_instance($image_path[$i]);\n//\n// $img1->resize(520, 520);\n// $img1->save(public_path() . '/' . $this->store_path . '/' . $this->square_name);\n// $this->result['square_path'][$i] = $this->store_path . '/' . $this->square_name;\n//\n//\n//\n//\n//\n//\n//\n\n $this->square_name = $this->rand . 'square_image.jpg';\n\n $img1 = $this->image_instance($image_path[$i]);\n $img1->resize(520, 520);\n\n\n $watermark = Image::make(public_path($this->watermark_path));\n// $watermarkSize = $img->width() - 200; //size of the image minus 20 margins\n// $watermarkSize = $img->width() / 2; //half of the image size\n $watermarkSize = round($img1->width() * ((100 - $this->resizePercentage) / 100), 2); //watermark will be $resizePercentage less then the actual width of the image\n $watermark->resize($watermarkSize, null, function ($constraint) {\n $constraint->aspectRatio();\n });\n $img1->insert($watermark, $this->position);\n\n\n $img1->save(public_path() . '/' . $this->store_path . '/' . $this->square_name);\n $this->result['square_path'][$i] = $this->store_path . '/' . $this->square_name;\n\n\n }", "private function _scale()\n\t{\n\t\t//scale down the image by 55%\n\t\t$weaponImageSize = $this->weapon->getImageGeometry();\n\t\t$this->weaponScale['w'] = $weaponImageSize['width'] * 0.55;\n\t\t$this->weaponScale['h'] = $weaponImageSize['height'] * 0.55;\n\n\t\t$this->weapon->scaleImage($this->weaponScale['w'], $this->weaponScale['h']);\n\n\t\t//scale down the image by 30%\n\t\t$emblemImageSize = $this->emblem->getImageGeometry();\n\t\t$this->emblemScale['w'] = $emblemImageSize['width'] * 0.30;\n\t\t$this->emblemScale['h'] = $emblemImageSize['height'] * 0.30;\n\n\t\t$this->emblem->scaleImage($this->emblemScale['w'], $this->emblemScale['h']);\n\n\t\t//scale down the image by 70%\n\t\t$profileImageSize = $this->profile->getImageGeometry();\n\t\t$this->profileScale['w'] = $profileImageSize['width'] * 0.70;\n\t\t$this->profileScale['h'] = $profileImageSize['height'] * 0.70;\n\n\t\t$this->profile->scaleImage($this->profileScale['w'], $this->profileScale['h']);\n\t}", "public static function STRETCH()\n {\n return new ThumbnailAspectMode(self::STRETCH);\n }", "function image_scale($src_abspath, $dest_abspath, $aspect, $width, $strategy)\n{\n $im = new \\Imagick($src_abspath);\n $im = image_scale_im_obj($im, $aspect, $width, $strategy);\n return image_return_write($im, $dest_abspath);\n}", "public function frontImage()\r\n {\r\n $wrapper = imagecreatetruecolor(16 * $this->ratio(), 32 * $this->ratio());\r\n $background = imagecolorallocatealpha($wrapper, 255, 255, 255, 127);\r\n imagefill($wrapper, 0, 0, $background);\r\n\r\n imagecopy($wrapper, $this->image, 4 * $this->ratio(), 0 * $this->ratio(), 8 * $this->ratio(),\r\n 8 * $this->ratio(), 8 * $this->ratio(), 8 * $this->ratio());\r\n //arms\r\n imagecopy($wrapper, $this->image, 0 * $this->ratio(), 8 * $this->ratio(), 44 * $this->ratio(),\r\n 20 * $this->ratio(), 4 * $this->ratio(), 12 * $this->ratio());\r\n $this->imageflip($wrapper, $this->image, 12 * $this->ratio(), 8 * $this->ratio(), 44 * $this->ratio(),\r\n 20 * $this->ratio(), 4 * $this->ratio(), 12 * $this->ratio());\r\n //chest\r\n imagecopy($wrapper, $this->image, 4 * $this->ratio(), 8 * $this->ratio(), 20 * $this->ratio(),\r\n 20 * $this->ratio(), 8 * $this->ratio(), 12 * $this->ratio());\r\n //legs\r\n imagecopy($wrapper, $this->image, 4 * $this->ratio(), 20 * $this->ratio(), 4 * $this->ratio(),\r\n 20 * $this->ratio(), 4 * $this->ratio(), 12 * $this->ratio());\r\n $this->imageflip($wrapper, $this->image, 8 * $this->ratio(), 20 * $this->ratio(), 4 * $this->ratio(),\r\n 20 * $this->ratio(), 4 * $this->ratio(), 12 * $this->ratio());\r\n //hat\r\n imagecopy($wrapper, $this->image, 4 * $this->ratio(), 0 * $this->ratio(), 40 * $this->ratio(),\r\n 8 * $this->ratio(), 8 * $this->ratio(), 8 * $this->ratio());\r\n\r\n return $wrapper;\r\n }", "public function apply($resource){\n\t\t// Extract arguments\n\t\t@list(,$level)=func_get_args();\n\t\t$level=abs((int)$level);\n\t\tif(!$level){\n\t\t $level=5;\n\t\t}\n\t\t// Get resolution\n\t\t$width=imagesx($resource);\n\t\t$height=imagesy($resource);\n\t\tif(!$width || !$height){\n\t\t\tthrow new Exception(\"An error was encountered while getting image resolution\");\n\t\t}\n\t\t// Apply effect\n\t\t$x=0;\n\t\tdo{\n\t\t\t$y=0;\n\t\t\tdo{\n\t\t\t\t// Get current pixel color\n\t\t\t\tlist($r,$g,$b,$a)=$this->_getColorAt($resource,$x,$y);\n\t\t\t\t// Generate noise\n\t\t\t\t$z=rand(-$level,$level);\n\t\t\t\t// Define color\n\t\t\t\t$r+=$z;\n\t\t\t\t$g+=$z;\n\t\t\t\t$b+=$z;\n\t\t\t\tif($r<0)\t\t$r=0;\n\t\t\t\telseif($r>255)\t$r=255;\n\t\t\t\tif($g<0)\t\t$g=0;\n\t\t\t\telseif($g>255)\t$g=255;\n\t\t\t\tif($b<0)\t\t$b=0;\n\t\t\t\telseif($b>255)\t$b=255;\n\t\t\t\t// Define new pixel\n\t\t\t\timagesetpixel($resource,$x,$y,imagecolorallocatealpha($resource,$r,$g,$b,$a));\n\t\t\t}\n\t\t\twhile(++$y<$height);\n\t\t}\n\t\twhile(++$x<$width);\n\t\treturn $resource;\n\t}", "function jpeg_quality_callback($arg)\n{\n\treturn (int)100;\n}", "function crop_image_square($source, $destination, $image_type, $square_size, $image_width, $image_height, $quality){\n if($image_width <= 0 || $image_height <= 0){return false;} //return false if nothing to resize\n\n if($image_width > $image_height)\n {\n $y_offset = 0;\n $x_offset = ($image_width - $image_height) / 2;\n $s_size \t= $image_width - ($x_offset * 2);\n }else{\n $x_offset = 0;\n $y_offset = ($image_height - $image_width) / 2;\n $s_size = $image_height - ($y_offset * 2);\n }\n $new_canvas\t= imagecreatetruecolor( $square_size, $square_size); //Create a new true color image\n\n //Copy and resize part of an image with resampling\n if(imagecopyresampled($new_canvas, $source, 0, 0, $x_offset, $y_offset, $square_size, $square_size, $s_size, $s_size)){\n save_image($new_canvas, $destination, $image_type, $quality);\n }\n\n return true;\n}", "function make_thumb($src,$dest) {\n try {\n // Create a new SimpleImage object\n $image = new \\claviska\\SimpleImage();\n\n // load file\n $image->fromFile($src);\n // img getMimeType\n $mime = $image->getMimeType();\n $w = $image->getWidth();\n\n // Manipulate it\n // $image->bestFit(200, 300) // proportionally resize to fit inside a 250x400 box\n // $image->flip('x') // flip horizontally\n // $image->colorize('DarkGreen') // tint dark green\n // $image->sharpen()\n // $image->border('darkgray', 1) // add a 2 pixel black border\n // $image->overlay('flag.png', 'bottom right') // add a watermark image\n // $image->toScreen(); // output to the screen\n if ($w > 1000) {\n $image->autoOrient(); // adjust orientation based on exif data\n // $image->resize($resizeWidth); // 1365\n // $image->resize(1024); // 1365\n $image->resize(800); // 1067\n }\n $image->toFile($dest,$mime,$outIMGquality);\n // echo \"mime type: \".$mime;\n } catch(Exception $err) {\n // Handle errors\n echo $err->getMessage();\n }\n}", "function csh($spades, $hearts, $diamonds, $clubs) {\n return '<span class=\"handWrapper\">' .\n rsh($spades, $hearts, $diamonds, $clubs) .\n '</span>';\n}", "private function findSharp($orig, $final)\n\t{\n\t\t$final = $final * (750.0 / $orig);\n\t\t$a = 52;\n\t\t$b = -0.27810650887573124;\n\t\t$c = .00047337278106508946;\n\t\t$result = $a + $b * $final + $c * $final * $final;\n\n\t\treturn max(round($result), 0);\n\t}", "function imagecompress($source, $destination, $quality) {\r\n $info = getimagesize($source);\r\n if ($info['mime'] == 'image/jpeg')\r\n $image = imagecreatefromjpeg($source);\r\n elseif ($info['mime'] == 'image/gif')\r\n $image = imagecreatefromgif($source);\r\n elseif ($info['mime'] == 'image/png')\r\n $image = imagecreatefrompng($source);\r\n imagejpeg($image, $destination, $quality);\r\n unlink($source);\r\n return $destination;\r\n}", "function thumb($width, $height)\n\t\t{\n\t\t // not allowing it to be more than 3x greater than the other\n\t\t if (!$height) {\n $reduction = $width / $this->width;\n $height = $this->height * $reduction;\n if ($height > 3*$width) $height = 3*$width;\n\t\t }\n\t\t if (!$width) {\n $reduction = $height / $this->height;\n $width = $this->width * $reduction;\n if ($width > 3*$height) $width = 3*$height;\n\t\t }\n\t\t \n\t\t\t// Picks the best fit from the original to the destination image, cropping when necessary\n\t\t\tif (!$this->image) return;\n\t\t\t$ratio = $this->width / $this->height;\n\t\t \n\t\t\tif ($width / $height > $ratio) {\n\t\t\t\t $new_height = $width / $ratio;\n\t\t\t\t $new_width = $width;\n\t\t\t} else {\n\t\t\t\t $new_width = $height * $ratio;\n\t\t\t\t $new_height = $height;\n\t\t\t}\n\t\t \n\t\t\t$x_mid = $new_width / 2; //horizontal middle\n\t\t\t$y_mid = $new_height / 2; //vertical middle\n\t\t \n\t\t\t$process = imagecreatetruecolor(round($new_width), round($new_height));\n\t\t \n\t\t\timagecopyresampled($process, $this->image, 0, 0, 0, 0, $new_width, $new_height, $this->width, $this->height);\n\t\t\t$thumb = imagecreatetruecolor($width, $height);\n\t\t\timagecopyresampled($thumb, $process, 0, 0, ($x_mid-($width/2)), ($y_mid-($height/2)), $width, $height, $width, $height);\n\t\t\t\n\t\t\timagedestroy($process);\n\t\t\treturn $this->image = $thumb;\n\t\t}", "function resize( $jpg ) {\n\t$im = @imagecreatefromjpeg( $jpg );\n\t$filename = $jpg;\n\t$percent = 0.5;\n\tlist( $width, $height ) = getimagesize( $filename );\n\tif ( $uploader_name == \"c_master_imgs\" ):\n\t\t$new_width = $width;\n\t$new_height = $height;\n\telse :\n\t\tif ( $width > 699 ): $new_width = 699;\n\t$percent = 699 / $width;\n\t$new_height = $height * $percent;\n\telse :\n\t\t$new_width = $width;\n\t$new_height = $height;\n\tendif;\n\tendif; // end if measter images do not resize\n\t//if ( $new_height>600){ $new_height = 600; }\n\t$im = imagecreatetruecolor( $new_width, $new_height );\n\t$image = imagecreatefromjpeg( $filename );\n\timagecopyresampled( $im, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height );\n\t@imagejpeg( $im, $jpg, 80 );\n\t@imagedestroy( $im );\n}", "function upgrade_profile_image($id, $dir='users') {\n global $CFG;\n\n $im = ImageCreateFromJPEG($CFG->dataroot .'/'. $dir .'/'. $id .'/f1.jpg'); \n\n if (function_exists('ImageCreateTrueColor') and $CFG->gdversion >= 2) {\n $im1 = ImageCreateTrueColor(100,100);\n $im2 = ImageCreateTrueColor(35,35);\n } else {\n $im1 = ImageCreate(100,100);\n $im2 = ImageCreate(35,35);\n }\n \n if (function_exists('ImageCopyResampled') and $CFG->gdversion >= 2) { \n ImageCopyBicubic($im1, $im, 0, 0, 2, 2, 100, 100, 96, 96);\n } else {\n imagecopy($im1, $im, 0, 0, 0, 0, 100, 100);\n $c = ImageColorsForIndex($im1,ImageColorAt($im1,2,2)); \n $color = ImageColorClosest ($im1, $c['red'], $c['green'], $c['blue']); \n ImageSetPixel ($im1, 0, 0, $color); \n $c = ImageColorsForIndex($im1,ImageColorAt($im1,2,97)); \n $color = ImageColorClosest ($im1, $c['red'], $c['green'], $c['blue']); \n ImageSetPixel ($im1, 0, 99, $color); \n $c = ImageColorsForIndex($im1,ImageColorAt($im1,97,2)); \n $color = ImageColorClosest ($im1, $c['red'], $c['green'], $c['blue']); \n ImageSetPixel ($im1, 99, 0, $color); \n $c = ImageColorsForIndex($im1,ImageColorAt($im1,97,97)); \n $color = ImageColorClosest ($im1, $c['red'], $c['green'], $c['blue']); \n ImageSetPixel ($im1, 99, 99, $color); \n for ($x = 1; $x < 99; $x++) { \n $c1 = ImageColorsForIndex($im1,ImageColorAt($im,$x,1)); \n $color = ImageColorClosest ($im, $c1['red'], $c1['green'], $c1['blue']); \n ImageSetPixel ($im1, $x, 0, $color); \n $c2 = ImageColorsForIndex($im1,ImageColorAt($im1,$x,98)); \n $color = ImageColorClosest ($im1, $red, $green, $blue); \n $color = ImageColorClosest ($im, $c2['red'], $c2['green'], $c2['blue']); \n ImageSetPixel ($im1, $x, 99, $color); \n } \n for ($y = 1; $y < 99; $y++) { \n $c3 = ImageColorsForIndex($im1,ImageColorAt($im, 1, $y)); \n $color = ImageColorClosest ($im, $red, $green, $blue); \n $color = ImageColorClosest ($im, $c3['red'], $c3['green'], $c3['blue']); \n ImageSetPixel ($im1, 0, $y, $color); \n $c4 = ImageColorsForIndex($im1,ImageColorAt($im1, 98, $y)); \n $color = ImageColorClosest ($im, $c4['red'], $c4['green'], $c4['blue']); \n ImageSetPixel ($im1, 99, $y, $color); \n } \n } \n ImageCopyBicubic($im2, $im, 0, 0, 2, 2, 35, 35, 96, 96);\n\n if (function_exists('ImageJpeg')) {\n if (ImageJpeg($im1, $CFG->dataroot .'/'. $dir .'/'. $id .'/f1.jpg', 90) and \n ImageJpeg($im2, $CFG->dataroot .'/'. $dir .'/'. $id .'/f2.jpg', 95) ) {\n @chmod($CFG->dataroot .'/'. $dir .'/'. $id .'/f1.jpg', 0666);\n @chmod($CFG->dataroot .'/'. $dir .'/'. $id .'/f2.jpg', 0666);\n return 1;\n }\n } else {\n notify('PHP has not been configured to support JPEG images. Please correct this.');\n }\n return 0;\n}", "public function clipEvenOdd() {}", "function duotone (&$image, $rplus, $gplus, $bplus) {\n $imagex = imagesx($image);\n $imagey = imagesy($image);\n\n for ($x = 0; $x <$imagex; ++$x) {\n for ($y = 0; $y <$imagey; ++$y) {\n $rgb = imagecolorat($image, $x, $y);\n $red = ($rgb >> 16) & 0xFF;\n $green = ($rgb >> 8) & 0xFF;\n $blue = $rgb & 0xFF;\n $red = (int)(($red+$green+$blue)/3);\n $green = $red + $gplus;\n $blue = $red + $bplus;\n $red += $rplus;\n\n if ($red > 255) $red = 255;\n if ($green > 255) $green = 255;\n if ($blue > 255) $blue = 255;\n if ($red < 0) $red = 0;\n if ($green < 0) $green = 0;\n if ($blue < 0) $blue = 0;\n\n $newcol = imagecolorallocate ($image, $red,$green,$blue);\n imagesetpixel ($image, $x, $y, $newcol);\n }\n }\n }", "function image_resize($filename){\n\t\t$width = 1000;\n\t\t$height = 500;\n\t\t$save_file_location = $filename;\n\t\t// File type\n\t\t//header('Content-Type: image/jpg');\n\t\t$source_properties = getimagesize($filename);\n\t\t$image_type = $source_properties[2];\n\n\t\t// Get new dimensions\n\t\tlist($width_orig, $height_orig) = getimagesize($filename);\n\n\t\t$ratio_orig = $width_orig/$height_orig;\n\t\tif ($width/$height > $ratio_orig) {\n\t\t\t$width = $height*$ratio_orig;\n\t\t} else {\n\t\t\t$height = $width/$ratio_orig;\n\t\t}\n\t\t// Resampling the image \n\t\t$image_p = imagecreatetruecolor($width, $height);\n\t\tif( $image_type == IMAGETYPE_JPEG ) {\n\t\t\t$image = imagecreatefromjpeg($filename);\n\t\t}else if($image_type == IMAGETYPE_GIF){\n\t\t\t$image = imagecreatefromgif($filename);\n\t\t}else if($image_type == IMAGETYPE_PNG){\n\t\t\t$image = imagecreatefrompng($filename);\n\t\t}\n\t\t$finalIMG = imagecopyresampled($image_p, $image, 0, 0, 0, 0,\n\t\t$width, $height, $width_orig, $height_orig);\n\t\t// Display of output image\n\n\t\tif( $image_type == IMAGETYPE_JPEG ) {\n\t\t\timagejpeg($image_p, $save_file_location);\n\t\t}else if($image_type == IMAGETYPE_GIF){\n\t\t\timagegif($image_p, $save_file_location);\n\t\t}else if($image_type == IMAGETYPE_PNG){\n\t\t\t$imagepng = imagepng($image_p, $save_file_location);\n\t\t}\n\t}", "public function fit()\n\t{\n\t\t// Load image\n\t\tif( $this->im == NULL) $this->im = imagecreatefromstring( file_get_contents( $this->imageFilePath ) );\n\n\t\tif($this->resizeFlag)\n\t\t{\n\t\t\t$newWidth=$this->width;\n\t\t\t$newHeight=$this->height;\n\t\n\t\t\t$t=imagecreatetruecolor($newWidth,$newHeight);\n\t\t\timagecopyresampled($t,$this->im,0,0,0,0,$newWidth,$newHeight,imagesx($this->im),imagesy($this->im));\n\t\t\timagedestroy($this->im);\n\t\t\t$this->im=$t;\n\t\t\t//imagedestroy($t);\t\n\t\t\t$this->debug[]=\"[RESIZE] TRUE -> $newWidth $newHeight\";\n\t\t}\n\n\t\t// Counter to keep track of iterations\n\t\t$cc = 0;\n\n\t\t// Use the buffer NOT the filesystem to compute intermediate image size\n\t\tob_start();\n\n\t\t// Loop forever\n\t\twhile( true )\n\t\t{\n\t\t\t// Empty buffer\n\t\t\tob_clean();\n\n\t\t\t// Keep track of previous quality setting\n\t\t\t$this->cq = $this->q;\n\n\t\t\t// Create and fill buffer with image with current quality setting\n\t\t\timagejpeg( $this->im, NULL, $this->cq );\n\n\t\t\t// Compute current image size from size of buffer\n\t\t\t$currentSize = strlen( ob_get_contents() );\n\n\t\t\t// Some debug\n\t\t\t$this->debug[] = \" \" . $this->low . \" >>> \" . $this->cq . \" <<< \" . $this->high . \" [ $currentSize / \" . $this->targetSize . \" ]\";\n\n\t\t\t// Break loop if target size is reached - very rare!\n\t\t\tif ( $currentSize == $this->targetSize )\n\t\t\t\tbreak;\n\n\t\t\t// If size > target then change quality range\n\t\t\tif ( $currentSize > $this->targetSize )\n\t\t\t{\n\t\t\t\t$this->high = $this->q;\n\t\t\t\t$this->q = ( $this->q + $this->low ) / 2;\n\t\t\t}\n\n\t\t\t// If size < target then change quality range\n\t\t\tif ( $currentSize < $this->targetSize )\n\t\t\t{\n\t\t\t\t$this->low = $this->q;\n\t\t\t\t$this->q = ( $this->q + $this->high ) / 2;\n\t\t\t}\n\n\t\t\t// Break loop if high/low gap below precision AND size is < target size\n\t\t\tif ( ( ( $this->high - $this->low ) < $this->precision ) && ( $currentSize <= $this->targetSize ) )\n\t\t\t\tbreak;\n\n\t\t\t// Break loop of counter has reached maximum iterations - target size either to low/high\n\t\t\tif ( $cc == $this->maxIterations )\n\t\t\t\tbreak;\n\n\t\t\t// Continue loop incrementing counter\n\t\t\t$cc++;\n\t\t}\n\n\t\t// Final debug\n\t\t$this->debug[] = \"Final Quality Setting = \" . $this->cq;\n\n\t\t// Disable buffer\n\t\tob_end_clean();\n\t}", "function ImageCopyBicubic ($dst_img, $src_img, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h) {\n\n global $CFG;\n\n if (function_exists(\"ImageCopyResampled\") and $CFG->gdversion >= 2) {\n return ImageCopyResampled($dst_img, $src_img, $dst_x, $dst_y, $src_x, $src_y,\n $dst_w, $dst_h, $src_w, $src_h);\n }\n\n $totalcolors = imagecolorstotal($src_img);\n for ($i=0; $i<$totalcolors; $i++) {\n if ($colors = ImageColorsForIndex($src_img, $i)) {\n ImageColorAllocate($dst_img, $colors['red'], $colors['green'], $colors['blue']);\n }\n }\n\n $scaleX = ($src_w - 1) / $dst_w;\n $scaleY = ($src_h - 1) / $dst_h;\n\n $scaleX2 = $scaleX / 2.0;\n $scaleY2 = $scaleY / 2.0;\n\n for ($j = 0; $j < $dst_h; $j++) {\n $sY = $j * $scaleY;\n\n for ($i = 0; $i < $dst_w; $i++) {\n $sX = $i * $scaleX;\n\n $c1 = ImageColorsForIndex($src_img,ImageColorAt($src_img,(int)$sX,(int)$sY+$scaleY2));\n $c2 = ImageColorsForIndex($src_img,ImageColorAt($src_img,(int)$sX,(int)$sY));\n $c3 = ImageColorsForIndex($src_img,ImageColorAt($src_img,(int)$sX+$scaleX2,(int)$sY+$scaleY2));\n $c4 = ImageColorsForIndex($src_img,ImageColorAt($src_img,(int)$sX+$scaleX2,(int)$sY));\n\n $red = (int) (($c1['red'] + $c2['red'] + $c3['red'] + $c4['red']) / 4);\n $green = (int) (($c1['green'] + $c2['green'] + $c3['green'] + $c4['green']) / 4);\n $blue = (int) (($c1['blue'] + $c2['blue'] + $c3['blue'] + $c4['blue']) / 4);\n\n $color = ImageColorClosest ($dst_img, $red, $green, $blue);\n ImageSetPixel ($dst_img, $i + $dst_x, $j + $dst_y, $color);\n }\n }\n}", "public function merge($image, $percentage = .2);", "function compress($source, $destination, $quality) \n{\n\t$info = getimagesize($source);\n\n\tif ($info['mime'] == 'image/jpeg') \n\t\t$image = imagecreatefromjpeg($source);\n\n\telseif ($info['mime'] == 'image/gif') \n\t\t$image = imagecreatefromgif($source);\n\n\telseif ($info['mime'] == 'image/png') \n\t\t$image = imagecreatefrompng($source);\n\n\timagejpeg($image, $destination, $quality);\n\n\treturn $destination;\n}", "function getSharings()\n {\n $sharing = new Sharing();\n\n //$sharing->whereAdd(sprintf('profile_id != %d', common_current_user()->getProfile()->id));\n\n $sharing->orderBy('created DESC');\n\n if(!empty($this->pc)) {\n $sharing->whereAdd(sprintf('(lower(displayName) LIKE \"%%%s%%\" OR lower(summary) LIKE \"%%%s%%\")', strtolower($this->pc), strtolower($this->pc)));\n }\n\n if($this->sharing_category_id != 0) {\n $sharing->whereAdd(sprintf('sharing_category_id = %d', $this->sharing_category_id));\n }\n\n if($this->sharing_city_id != 0) {\n $sharing->whereAdd(sprintf('sharing_city_id = %d', $this->sharing_city_id));\n }\n\n if($this->sharing_type_id != 0) {\n $sharing->whereAdd(sprintf('sharing_type_id = %d', $this->sharing_type_id));\n }\n\n if($this->gratuito == true) {\n $sharing->whereAdd('price = 0');\n }\n\n $offset = ($this->page - 1) * PROFILES_PER_PAGE;\n $limit = PROFILES_PER_PAGE + 1;\n \n $sharing->find();\n\n return $sharing;\n }", "function resizeImage($image,$width,$height,$scale,$stype) {\n\t$newImageWidth = ceil($width * $scale);\n\t$newImageHeight = ceil($height * $scale);\n\t$newImage = imagecreatetruecolor($newImageWidth,$newImageHeight);\n\tswitch($stype) {\n case 'gif':\n $source = imagecreatefromgif($image);\n break;\n case 'jpg':\n $source = imagecreatefromjpeg($image);\n break;\n case 'jpeg':\n $source = imagecreatefromjpeg($image);\n break;\n case 'png':\n $source = imagecreatefrompng($image);\n break;\n }\n\timagecopyresampled($newImage, $source,0,0,0,0, $newImageWidth, $newImageHeight, $width, $height);\n\timagejpeg($newImage,$image,90);\n\tchmod($image, 0777);\n\treturn $image;\n}", "function findSharp($intOrig, $intFinal)\n{\n $intFinal = $intFinal * (750.0 / $intOrig);\n $intA = 52;\n $intB = -0.27810650887573124;\n $intC = .00047337278106508946;\n $intRes = $intA + $intB * $intFinal + $intC * $intFinal * $intFinal;\n return max(round($intRes), 0);\n}", "function compressedImage($source, $path, $quality) \n {\n\n $info = getimagesize($source);\n\n if ($info['mime'] == 'image/jpeg') \n $image = imagecreatefromjpeg($source);\n\n elseif ($info['mime'] == 'image/gif') \n $image = imagecreatefromgif($source);\n\n elseif ($info['mime'] == 'image/png') \n $image = imagecreatefrompng($source);\n\n // Save image \n imagejpeg($image, $path, $quality);\n // sReturn compressed image \n return $path;\n\n }", "function spc_resizeImage( $file, $thumbpath, $max_side , $fixfor = NULL ) {\n\n\tif ( file_exists( $file ) ) {\n\t\t$type = getimagesize( $file );\n\n\t\tif (!function_exists( 'imagegif' ) && $type[2] == 1 ) {\n\t\t\t$error = __( 'Filetype not supported. Thumbnail not created.' );\n\t\t}\n\t\telseif (!function_exists( 'imagejpeg' ) && $type[2] == 2 ) {\n\t\t\t$error = __( 'Filetype not supported. Thumbnail not created.' );\n\t\t}\n\t\telseif (!function_exists( 'imagepng' ) && $type[2] == 3 ) {\n\t\t\t$error = __( 'Filetype not supported. Thumbnail not created.' );\n\t\t} else {\n\n\t\t\t// create the initial copy from the original file\n\t\t\tif ( $type[2] == 1 ) {\n\t\t\t\t$image = imagecreatefromgif( $file );\n\t\t\t}\n\t\t\telseif ( $type[2] == 2 ) {\n\t\t\t\t$image = imagecreatefromjpeg( $file );\n\t\t\t}\n\t\t\telseif ( $type[2] == 3 ) {\n\t\t\t\t$image = imagecreatefrompng( $file );\n\t\t\t}\n\n\t\t\tif ( function_exists( 'imageantialias' ))\n\t\t\t\timageantialias( $image, TRUE );\n\n\t\t\t$image_attr = getimagesize( $file );\n\n\t\t\t// figure out the longest side\n if($fixfor){\n \t if($fixfor == 'width'){\n \t \t$image_width = $image_attr[0];\n\t\t\t\t$image_height = $image_attr[1];\n\t\t\t\t$image_new_width = $max_side;\n\n\t\t\t\t$image_ratio = $image_width / $image_new_width;\n\t\t\t\t$image_new_height = $image_height / $image_ratio;\n \t }elseif($fixfor == 'height'){\n \t $image_width = $image_attr[0];\n\t\t\t\t$image_height = $image_attr[1];\n\t\t\t\t$image_new_height = $max_side;\n\n\t\t\t\t$image_ratio = $image_height / $image_new_height;\n\t\t\t\t$image_new_width = $image_width / $image_ratio;\t\n \t }\n }else{\n\t\t\tif ( $image_attr[0] > $image_attr[1] ) {\n\t\t\t\t$image_width = $image_attr[0];\n\t\t\t\t$image_height = $image_attr[1];\n\t\t\t\t$image_new_width = $max_side;\n\n\t\t\t\t$image_ratio = $image_width / $image_new_width;\n\t\t\t\t$image_new_height = $image_height / $image_ratio;\n\t\t\t\t//width is > height\n\t\t\t} else {\n\t\t\t\t$image_width = $image_attr[0];\n\t\t\t\t$image_height = $image_attr[1];\n\t\t\t\t$image_new_height = $max_side;\n\n\t\t\t\t$image_ratio = $image_height / $image_new_height;\n\t\t\t\t$image_new_width = $image_width / $image_ratio;\n\t\t\t\t//height > width\n\t\t\t}\n }\t\n\n\t\t\t$thumbnail = imagecreatetruecolor( $image_new_width, $image_new_height);\n\t\t\t@ imagecopyresampled( $thumbnail, $image, 0, 0, 0, 0, $image_new_width, $image_new_height, $image_attr[0], $image_attr[1] );\n\n\t\t\t// move the thumbnail to its final destination\n\t\t\tif ( $type[2] == 1 ) {\n\t\t\t\tif (!imagegif( $thumbnail, $thumbpath ) ) {\n\t\t\t\t\t$error = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\telseif ( $type[2] == 2 ) {\n\t\t\t\tif (!imagejpeg( $thumbnail, $thumbpath ) ) {\n\t\t\t\t\t$error = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\telseif ( $type[2] == 3 ) {\n\t\t\t\tif (!imagepng( $thumbnail, $thumbpath ) ) {\n\t\t\t\t\t$error = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else {\n\t\t$error = 0;\n\t}\n\n\tif (!empty ( $error ) ) {\n\t\treturn $error;\n\t} else {\n\t\treturn $thumbpath;\n\t}\n}", "function image_reproportion()\n\t{\n\t\tif ( ! is_numeric($this->dst_width) OR ! is_numeric($this->dst_height) OR $this->dst_width == 0 OR $this->dst_height == 0)\n\t\t\treturn;\n\t\t\n\t\tif ( ! is_numeric($this->src_width) OR ! is_numeric($this->src_height) OR $this->src_width == 0 OR $this->src_height == 0)\n\t\t\treturn;\n\t\n\t\tif (($this->dst_width >= $this->src_width) AND ($this->dst_height >= $this->src_height))\n\t\t{\n\t\t\t$this->dst_width = $this->src_width;\n\t\t\t$this->dst_height = $this->src_height;\n\t\t}\n\t\t\n\t\t$new_width\t= ceil($this->src_width*$this->dst_height/$this->src_height);\t\t\n\t\t$new_height\t= ceil($this->dst_width*$this->src_height/$this->src_width);\n\t\t\n\t\t$ratio = (($this->src_height/$this->src_width) - ($this->dst_height/$this->dst_width));\n\n\t\tif ($this->master_dim != 'width' AND $this->master_dim != 'height')\n\t\t{\n\t\t\t$this->master_dim = ($ratio < 0) ? 'width' : 'height';\n\t\t}\n\t\t\n\t\tif (($this->dst_width != $new_width) AND ($this->dst_height != $new_height))\n\t\t{\n\t\t\tif ($this->master_dim == 'height')\n\t\t\t{\n\t\t\t\t$this->dst_width = $new_width;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->dst_height = $new_height;\n\t\t\t}\n\t\t}\n\t}", "function reduce_image_size($dest_folder,$image_name,$files)\n{\n //REDUCE IMAGE RESOLUTION\n if($files)\n {\n //echo 123;exit;\n $dest = $dest_folder.$image_name;\n $width = 300;\n $height = 300;\n list($width_orig, $height_orig) = getimagesize($files);\n $ratio_orig = $width_orig/$height_orig;\n if ($width/$height > $ratio_orig)\n {\n $width = $height*$ratio_orig;\n }\n else\n {\n $height = $width/$ratio_orig;\n }\n $image_p = imagecreatetruecolor($width, $height);\n $image = imagecreatefromjpeg($files);\n imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);\n imagejpeg($image_p,$dest, 100);\n ImageDestroy ($image_p);\n }\n //END OF REDUCING IMAGE RESOLUTION\n}", "function resizetopercentage($iPercentage)\n\t{\n\t\t$iPercentageMultiplier = $iPercentage / 100;\n\t\t$iNewWidth = $this->width * $iPercentageMultiplier;\n\t\t$iNewHeight = $this->height * $iPercentageMultiplier;\n\n\t\t$this->resize($iNewWidth, $iNewHeight);\n\t}", "public function flop()\n {\n $this->resource->flopImage();\n return $this;\n }", "function resizeImage($sourceImage, $targetImage, $maxWidth, $maxHeight, $quality = 80) {\n echo 'sourceImage ';\n echo $sourceImage;\n echo ' targetImage ';\n echo $targetImage;\n // Obtain image from given source file.\n\tif (!$image = @imagecreatefromjpeg($sourceImage)) {\n\t\techo 'false';\n return false;\n }\n\techo ' pre list ';\n // Get dimensions of source image.\n list($origWidth, $origHeight) = getimagesize($sourceImage);\n\n if ($maxWidth == 0) {\n $maxWidth = $origWidth;\n }\n\n if ($maxHeight == 0) {\n $maxHeight = $origHeight;\n }\n\n // Calculate ratio of desired maximum sizes and original sizes.\n $widthRatio = $maxWidth / $origWidth;\n $heightRatio = $maxHeight / $origHeight;\n\n // Ratio used for calculating new image dimensions.\n $ratio = min($widthRatio, $heightRatio);\n\n // Calculate new image dimensions.\n $newWidth = (int)$origWidth * $ratio;\n $newHeight = (int)$origHeight * $ratio;\n\techo 'pre true color ';\n // Create final image with new dimensions.\n\t$newImage = imagecreatetruecolor($newWidth, $newHeight);\n\techo 'post true color ';\n\n // $image = str_replace(' ','_',$image);\n\n\timagecopyresampled($newImage, $image, 0, 0, 0, 0, $newWidth, $newHeight, $origWidth, $origHeight);\n\techo 'post resampled ';\n\n // CREATE PROGRESSIVE IMG INSTANCE\n // $imageProg = imagecreatefromjpeg($image);\n // imageinterlace($imageProg, true);\n // echo 'post progressive';\n\n\timagejpeg($newImage, $targetImage, $quality);\n // imagejpeg($imageProg, $targetImage, $quality);\n\techo 'post imagejpeg ';\n\n // FREE UP MEMORY\n imagedestroy($image);\n imagedestroy($newImage);\n // imagedestroy($imageProg);\n\n return true;\n}", "public function emboss() {\r\n\t\t$matrix = array(\r\n\t\t\tarray(1, 1, -1),\r\n\t\t\tarray(1, 1, -1),\r\n\t\t\tarray(1, -1, -1)\r\n\t\t);\r\n\t\t$this->convolution($matrix, array_sum(array_map('array_sum', $matrix)));\r\n\t}", "function drush_large_images_compress($dir, $min_size, $quality) {\n if ($quality > 100 || $quality < 1) {\n drush_set_error('Detected invalid quality value; must be between 1 and 100');\n drush_die();\n }\n\n if ($quality < 40) {\n if (!drush_confirm(dt('WARNING! Are you sure you want to use such a low quality?'))) {\n drush_user_abort();\n drush_die();\n }\n }\n\n // Build an array of all managed files\n $result = db_query('SELECT fid, uri FROM file_managed');\n $fids_uris = array();\n if ($result) {\n while ($row = $result->fetchAssoc()) {\n $fids_uris[$row['fid']] = str_replace(array('public://', 'private://'), '', $row['uri']);\n }\n }\n\n $images = large_images_find_images($dir, $min_size);\n if (!empty($images)) {\n foreach ($images as $image_fullpath) {\n $original_filesize = filesize($image_fullpath);\n\n // No matter where the executes drush from, we want our pathing to start from the Drupal root directory\n drush_shell_exec('pwd');\n $pwd = drush_shell_exec_output();\n $path_from_drupal_root = ltrim(str_replace($pwd, '', $image_fullpath), '/');\n\n // Remove \"sites/default/files\" and similar from the path\n // to get the same type of path we see in the file_managed table's \"uri\" column\n $public_prefix = variable_get('file_public_path', conf_path() . '/files');\n $private_prefix = variable_get('file_public_path');\n $temp_prefix = variable_get('file_temporary_path');\n $uri_without_scheme = ltrim(str_replace(array($public_prefix, $private_prefix, $temp_prefix), '', $path_from_drupal_root), '/');\n\n $fids = array();\n foreach ($fids_uris as $fid => $uri) {\n // Check if the uri without the scheme is referenced by file_managed\n if ($uri == $uri_without_scheme) {\n $fids[] = $fid;\n }\n }\n\n // Compress them image\n if (large_images_compress_image($image_fullpath, $quality)) {\n // If we don't clear the cache, filesize() will return the old size\n clearstatcache(TRUE, $image_fullpath);\n\n // Update the database\n $fids_status = '';\n if (!empty($fids)) {\n foreach (file_load_multiple($fids) as $file) {\n $file->filesize = filesize($file->uri);\n file_save($file);\n }\n $fids_status = '| db-updated FID #' . implode(', #', $fids);\n }\n\n drush_log(dt('!path | !old --> !new !fids_status', array(\n '!path' => $path_from_drupal_root,\n '!old' => large_images_human_filesize($original_filesize),\n '!new' => large_images_human_filesize(filesize($image_fullpath)),\n '!fids_status' => $fids_status,\n )), 'ok');\n }\n else {\n drush_set_error(dt('!path | Error compressing file', array('!path' => $path_from_drupal_root)));\n }\n }\n }\n else {\n drush_log(dt('No image files found.'), 'ok');\n }\n}", "function resize($image_name, $size, $folder_name) {\n $file_extension = getFileExtension($image_name);\n switch ($file_extension) {\n case 'jpg':\n case 'jpeg':\n $image_src = imagecreatefromjpeg($folder_name . '/' . $image_name);\n break;\n case 'png':\n $image_src = imagecreatefrompng($folder_name . '/' . $image_name);\n break;\n case 'gif':\n $image_src = imagecreatefromgif($folder_name . '/' . $image_name);\n break;\n }\n $true_width = imagesx($image_src);\n $true_height = imagesy($image_src);\n\n $width = $size;\n $height = ($width / $true_width) * $true_height;\n\n $image_des = imagecreatetruecolor($width, $height);\n\n imagecopyresampled($image_des, $image_src, 0, 0, 0, 0, $width, $height, $true_width, $true_height);\n\n switch ($file_extension) {\n case 'jpg':\n case 'jpeg':\n imagejpeg($image_des, $folder_name . '/' . $image_name, 100);\n break;\n case 'png':\n imagepng($image_des, $folder_name . '/' . $image_name, 8);\n break;\n case 'gif':\n imagegif($image_des, $folder_name . '/' . $image_name, 100);\n break;\n }\n return $image_des;\n}", "function imageflip(&$image, $x = 0, $y = 0, $width = null, $height = null) {\n\tif ($width < 1)\n\t\t$width = imagesx($image);\n\tif ($height < 1)\n\t\t$height = imagesy($image);\n\t// Truecolor provides better results, if possible.\n\tif (function_exists('imageistruecolor') && imageistruecolor($image)) {\n\t\t$tmp = imagecreatetruecolor(1, $height);\n\t} else {\n\t\t$tmp = imagecreate(1, $height);\n\t}\n\t$x2 = $x + $width - 1;\n\tfor ($i = (int) floor(($width - 1) / 2); $i >= 0; $i--) {\n\t\t// Backup right stripe.\n\t\timagecopy($tmp, $image, 0, 0, $x2 - $i, $y, 1, $height);\n\t\t// Copy left stripe to the right.\n\t\timagecopy($image, $image, $x2 - $i, $y, $x + $i, $y, 1, $height);\n\t\t// Copy backuped right stripe to the left.\n\t\timagecopy($image, $tmp, $x + $i, $y, 0, 0, 1, $height);\n\t}\n\timagedestroy($tmp);\n\treturn true;\n}", "public function intern_resizeDiscSize($percentage = -10)\n\t{\n\t\t$factor = (100 + $percentage) /100;\n\t\tif ($this->srcOrientation == EImageProcessor::LANDSCAPE) $this->resize($this->srcWidth * $factor);\n\t\telse $this->resize_height($this->srcHeight * $factor);\n\t}", "function tfnm_star_rating( $rating ){\n\t$image_name = floor( $rating );\n\t$decimal = $rating - $image_name;\n\n\tif( $decimal >= .5 ){\n\t\t$image_name .= '_half';\n\t}\n\n\treturn plugin_dir_url( dirname( __FILE__ ) ) . 'public/images/yelp_stars/web_and_ios/regular/regular_' . $image_name . '.png';\n}", "public function run() {\n\n // make enough memory available to scale bigger images\n ini_set('memory_limit', $this->thumb->options['memory']);\n \n // create the gd lib image object\n switch($this->thumb->image->mime()) {\n case 'image/jpeg':\n $image = @imagecreatefromjpeg($this->thumb->image->root()); \n break;\n case 'image/png':\n $image = @imagecreatefrompng($this->thumb->image->root()); \n break;\n case 'image/gif':\n $image = @imagecreatefromgif($this->thumb->image->root()); \n break;\n default:\n raise('The image mime type is invalid');\n break;\n } \n\n // check for a valid created image object\n if(!$image) raise('The image could not be created');\n\n // cropping stuff needs a couple more steps \n if($this->thumb->options['crop'] == true) {\n\n // Starting point of crop\n $startX = floor($this->thumb->tmp->width() / 2) - floor($this->thumb->result->width() / 2);\n $startY = floor($this->thumb->tmp->height() / 2) - floor($this->thumb->result->height() / 2);\n \n // Adjust crop size if the image is too small\n if($startX < 0) $startX = 0;\n if($startY < 0) $startY = 0;\n \n // create a temporary resized version of the image first\n $thumb = imagecreatetruecolor($this->thumb->tmp->width(), $this->thumb->tmp->height()); \n $thumb = $this->keepColor($thumb);\n imagecopyresampled($thumb, $image, 0, 0, 0, 0, $this->thumb->tmp->width(), $this->thumb->tmp->height(), $this->thumb->source->width(), $this->thumb->source->height()); \n \n // crop that image afterwards \n $cropped = imagecreatetruecolor($this->thumb->result->width(), $this->thumb->result->height()); \n $cropped = $this->keepColor($cropped);\n imagecopyresampled($cropped, $thumb, 0, 0, $startX, $startY, $this->thumb->tmp->width(), $this->thumb->tmp->height(), $this->thumb->tmp->width(), $this->thumb->tmp->height()); \n imagedestroy($thumb);\n \n // reasign the variable\n $thumb = $cropped;\n\n } else {\n $thumb = imagecreatetruecolor($this->thumb->result->width(), $this->thumb->result->height()); \n $thumb = $this->keepColor($thumb);\n imagecopyresampled($thumb, $image, 0, 0, 0, 0, $this->thumb->result->width(), $this->thumb->result->height(), $this->thumb->source->width(), $this->thumb->source->height()); \n } \n \n // convert the thumbnail to grayscale \n if($this->thumb->options['grayscale']) {\n imagefilter($thumb, IMG_FILTER_GRAYSCALE);\n }\n\n // convert the image to a different format\n if($this->thumb->options['to']) {\n\n switch($this->thumb->options['to']) {\n case 'jpg': \n imagejpeg($thumb, $this->thumb->root(), $this->thumb->options['quality']); \n break;\n case 'png': \n imagepng($thumb, $this->thumb->root(), 0); \n break; \n case 'gif': \n imagegif($thumb, $this->thumb->root()); \n break; \n }\n\n // keep the original file's format\n } else {\n\n switch($this->thumb->image->mime()) {\n case 'image/jpeg': \n imagejpeg($thumb, $this->thumb->root(), $this->thumb->options['quality']); \n break;\n case 'image/png': \n imagepng($thumb, $this->thumb->root(), 0); \n break; \n case 'image/gif': \n imagegif($thumb, $this->thumb->root()); \n break;\n }\n\n }\n\n imagedestroy($thumb);\n \n }", "function wave_region($img, $x, $y, $width, $height,$amplitude = 5.5,$period = 10)\n {\n // Make a copy of the image twice the size\n\t$period = rand(10,20);\n\t$amplitude = rand(3,7.5);\n $mult = 2;\n $img2 = imagecreatetruecolor($width * $mult, $height * $mult);\n imagecopyresampled ($img2,$img,0,0,$x,$y,$width * $mult,$height * $mult,$width, $height);\n\n // Wave it\n for ($i = 0;$i < ($width * $mult);$i += 2)\n {\n imagecopy($img2,$img2,\n $x + $i + rand(-2,-1),$y + sin($i / $period) * $amplitude, // dest\n $x + $i,$y, // src\n 2,($height * $mult));\n }\n \n // Resample it down again\n imagecopyresampled ($img,$img2,$x,$y,0,0,$width, $height,$width * $mult,$height * $mult);\n imagedestroy($img2);\n }", "function roll($sides) {\n return mt_rand(1,$sides);\n}", "private function custom_noise($diff)\n\t{\n\t\t$imagex = imagesx($this->image);\n\t\t$imagey = imagesy($this->image);\n\n\t\tfor($x = 0; $x < $imagex; ++$x)\n\t\t{\n\t\t\tfor($y = 0; $y < $imagey; ++$y)\n\t\t\t{\n\t\t\t\tif(rand(0, 1) )\n\t\t\t\t{\n\t\t\t\t\t$rgb = imagecolorat($this->image, $x, $y);\n\t\t\t\t\t$red = ($rgb >> 16) & 0xFF;\n\t\t\t\t\t$green = ($rgb >> 8) & 0xFF;\n\t\t\t\t\t$blue = $rgb & 0xFF;\n\t\t\t\t\t$modifier = rand($diff * -1, $diff);\n\t\t\t\t\t$red += $modifier;\n\t\t\t\t\t$green += $modifier;\n\t\t\t\t\t$blue += $modifier;\n\n\t\t\t\t\tif ($red > 255) $red = 255;\n\t\t\t\t\tif ($green > 255) $green = 255;\n\t\t\t\t\tif ($blue > 255) $blue = 255;\n\t\t\t\t\tif ($red < 0) $red = 0;\n\t\t\t\t\tif ($green < 0) $green = 0;\n\t\t\t\t\tif ($blue < 0) $blue = 0;\n\n\t\t\t\t\t$newcol = imagecolorallocate($this->image, $red, $green, $blue);\n\t\t\t\t\timagesetpixel($this->image, $x, $y, $newcol);\n\t\t\t\t}//end if\n\t\t\t}//end for\n\t\t}//end for\n\t}", "function cropImage($CurWidth,$CurHeight,$iSize,$DestFolder,$SrcImage,$Quality,$ImageType)\r\n{\t \r\n\t//Check Image size is not 0\r\n\tif($CurWidth <= 0 || $CurHeight <= 0) \r\n\t{\r\n\t\treturn false;\r\n\t}\r\n\t\r\n\t//abeautifulsite.net has excellent article about \"Cropping an Image to Make Square\"\r\n\t//http://www.abeautifulsite.net/blog/2009/08/cropping-an-image-to-make-square-thumbnails-in-php/\r\n\tif($CurWidth>$CurHeight)\r\n\t{\r\n\t\t$y_offset = 0;\r\n\t\t$x_offset = ($CurWidth - $CurHeight) / 2;\r\n\t\t$square_size \t= $CurWidth - ($x_offset * 2);\r\n\t}else{\r\n\t\t$x_offset = 0;\r\n\t\t$y_offset = ($CurHeight - $CurWidth) / 2;\r\n\t\t$square_size = $CurHeight - ($y_offset * 2);\r\n\t}\r\n\t\r\n\t$NewCanves \t= imagecreatetruecolor($iSize, $iSize);\t\r\n\tif(imagecopyresampled($NewCanves, $SrcImage,0, 0, $x_offset, $y_offset, $iSize, $iSize, $square_size, $square_size))\r\n\t{\r\n\t\tswitch(strtolower($ImageType))\r\n\t\t{\r\n\t\t\tcase 'image/png':\r\n\t\t\t\timagepng($NewCanves,$DestFolder);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 'image/gif':\r\n\t\t\t\timagegif($NewCanves,$DestFolder);\r\n\t\t\t\tbreak;\t\t\t\r\n\t\t\tcase 'image/jpeg':\r\n\t\t\tcase 'image/pjpeg':\r\n\t\t\t\timagejpeg($NewCanves,$DestFolder,$Quality);\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\treturn false;\r\n\t\t}\r\n\t//Destroy image, frees memory\t\r\n\tif(is_resource($NewCanves)) {imagedestroy($NewCanves);} \r\n\treturn true;\r\n\r\n\t}\r\n\t \r\n}", "function color_picker($p,$maxPixel,$numberSpirals,$start_color,$end_color){\n\t\t$start_dec = hexdec($start_color);\n\t\t$end_dec = hexdec($end_color);\n\t\t$rgb = $start_dec;\n\t\t$r = ($rgb >> 16) & 0xFF;\n\t\t$g = ($rgb >> 8) & 0xFF;\n\t\t$b = $rgb & 0xFF;\n\t\t$HSL=RGB_TO_HSV ($r, $g, $b);\n\t\t$start_H=$HSL['H']; \n\t\t$start_S=$HSL['S']; \n\t\t$start_V=$HSL['V']; \n\t\t$rgb = $end_dec;\n\t\t$r = ($rgb >> 16) & 0xFF;\n\t\t$g = ($rgb >> 8) & 0xFF;\n\t\t$b = $rgb & 0xFF;\n\t\t$HSL=RGB_TO_HSV ($r, $g, $b);\n\t\t$end_H=$HSL['H']; \n\t\t$end_S=$HSL['S']; \n\t\t$end_V=$HSL['V']; \n\t\t$range=$start_H-$end_H;\n\t\tif($start_H<$end_H)\t\t$range=$end_H-$start_H;\n\t\t//if($range<0) $range+=1.0;\n\t\t$percentage = $p/$maxPixel; // 0 to 1.0\n\t\tif($start_H>$end_H)\t\t$H = $start_H - $percentage*$range;\n\t\telse\t$H = $start_H + $percentage*$range;\n\t\tif($H<0) $H+=1.0;\n\t\t$range=$start_S-$end_S;\n\t\tif($start_S<$end_S)\t\t$range=$end_S-$start_S;\n\t\t//if($range<0) $range+=1.0;\n\t\tif($start_S>$end_S)\t\t$S = $start_S - $percentage*$range;\n\t\telse\t$S = $start_S + $percentage*$range;\n\t\tif($S<0) $S+=1.0;\n\t\t$range=$start_V-$end_V;\n\t\tif($start_V<$end_V)\t\t$range=$end_V-$start_V;\n\t\t//if($range<0) $range+=1.0;\n\t\tif($start_V>$end_V)\t\t$V = $start_V - $percentage*$range;\n\t\telse\t$V = $start_V + $percentage*$range;\n\t\tif($V<0) $V+=1.0;\n\t\t$color_HSV=array('H'=>$H,'S'=>$S,'V'=>$V);\n\t\treturn $color_HSV;\n\t}", "public function auto_smush( $name = '' ) {\r\n\t\t// Add only to auto smush settings.\r\n\t\tif ( 'auto' !== $name ) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t$setting_status = $this->settings->get( 'auto' );\r\n\r\n\t\t?>\r\n\t\t<div class=\"sui-toggle-content\">\r\n\t\t\t<div class=\"sui-notice <?php echo $setting_status ? '' : ' sui-hidden'; ?>\" style=\"margin-top: 10px\">\r\n\t\t\t\t<div class=\"sui-notice-content\">\r\n\t\t\t\t\t<div class=\"sui-notice-message\">\r\n\t\t\t\t\t\t<i class=\"sui-notice-icon sui-icon-info sui-md\" aria-hidden=\"true\"></i>\r\n\t\t\t\t\t\t<p><?php esc_html_e( 'Note: We will only automatically compress the image sizes selected above.', 'wp-smushit' ); ?></p>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t\t<?php\r\n\t}", "public function CashShutter($arrayShutter, $folder ){\n\t\t$arrayShutterNew = array();\n\t\t$i = 0;\n\t\twhile ($i < count($arrayShutter)){\n\t\t\t$results = array();\n\t\t\tfor ($ii = 0; $ii < 200; $ii++){\n\t\t\t\t$adress = './' . $folder . '/ShutterFiles/' . $arrayShutter[$i]['id'] . '.jpg';\n\t\t\t\t$results[] = $adress;\n\t\t\t\texec(\"php workerCashFiles.php \".$arrayShutter[$i]['thumb'].\" \".$adress.\" >> /dev/null &\");\n\t\t\t\t$arrayShutterNew[] = array('id' => $arrayShutter[$i]['id'], 'thumb' => $adress);\n\t\t\t\t$i++;\n if($i == count($arrayShutter)){break;}\n\t\t\t}\n\t\t\t$this->waiter($results);\n\t\t}\n\t\treturn $arrayShutterNew;\n\t}", "function large_images_compress_image($filepath, $quality = 80) {\n $backup = drush_get_option('backup', FALSE);\n if ($backup) {\n copy($filepath, $filepath . '_lgbak');\n }\n\n $info = getimagesize($filepath);\n\n if ($info['mime'] == 'image/jpeg') {\n $image = imagecreatefromjpeg($filepath);\n\n if (imagejpeg($image, $filepath, $quality)) {\n return TRUE;\n }\n }\n elseif ($info['mime'] == 'image/png') {\n $image = imagecreatefrompng($filepath);\n\n // PNG quality is backwards compared to jpeg.\n // The scale is 0 to 9 (0 being full quality)\n $png_quality = ($quality - 100) / 11.111111;\n $png_quality = round(abs($png_quality));\n\n if (imagepng($image, $filepath, $png_quality)) {\n return TRUE;\n }\n }\n\n return FALSE;\n}" ]
[ "0.780681", "0.7317228", "0.7188619", "0.708618", "0.69203883", "0.6801079", "0.6792776", "0.5747679", "0.57320493", "0.57206446", "0.5687695", "0.55936396", "0.5477889", "0.5205381", "0.51199985", "0.5086683", "0.5029578", "0.49629986", "0.47916767", "0.4741838", "0.4726139", "0.47036272", "0.4691044", "0.46817705", "0.46816555", "0.4677103", "0.46735063", "0.46699503", "0.46653143", "0.4620784", "0.4572932", "0.4570895", "0.45470023", "0.45393723", "0.45317885", "0.45238182", "0.45124808", "0.4497549", "0.44824547", "0.4478316", "0.44725832", "0.4467708", "0.44474933", "0.44413063", "0.44294327", "0.44221", "0.442067", "0.4407962", "0.44076562", "0.44058412", "0.44015846", "0.43988115", "0.4398318", "0.43937618", "0.43915197", "0.43888918", "0.4386762", "0.43813583", "0.43808293", "0.4379979", "0.43768844", "0.436842", "0.43626994", "0.43541467", "0.43496817", "0.43496794", "0.43489444", "0.43486863", "0.43358308", "0.43357497", "0.43265027", "0.4326247", "0.43248612", "0.43192074", "0.4309157", "0.429238", "0.42844358", "0.4284082", "0.42710206", "0.42473647", "0.42268667", "0.4217064", "0.421001", "0.42061695", "0.42059743", "0.41932636", "0.41932607", "0.41898116", "0.41873127", "0.4183638", "0.4178471", "0.4175602", "0.41676927", "0.41646063", "0.41590738", "0.41569227", "0.41562212", "0.41494057", "0.41461405", "0.4145542" ]
0.6656477
7
Add a reflection to an image. The most opaque part of the reflection will be equal to the opacity setting and fade out to full transparent. Alpha transparency is preserved. // Create a 50 pixel reflection that fades from 0100% opacity $image>reflection(50); // Create a 50 pixel reflection that fades from 1000% opacity $image>reflection(50, 100, TRUE); // Create a 50 pixel reflection that fades from 060% opacity $image>reflection(50, 60, TRUE); [!!] By default, the reflection will be go from transparent at the top to opaque at the bottom.
public function reflection($height = NULL, $opacity = 100, $fade_in = FALSE) { if ($height === NULL OR $height > $this->height) { // Use the current height $height = $this->height; } // The opacity must be in the range of 0 to 100 $opacity = min(max($opacity, 0), 100); $this->_do_reflection($height, $opacity, $fade_in); return $this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function reflection($height=null, $opacity=null, $fade_in=null);", "public function transform(sfImage $image)\r\n {\r\n\r\n // Get the actual image resource\r\n $resource = $image->getAdapter()->getHolder();\r\n\r\n //get the resource dimentions\r\n $width = $image->getWidth();\r\n $height = $image->getHeight();\r\n\r\n $reflection = $image->copy();\r\n\r\n $reflection->flip()->resize($width, $this->reflection_height);\r\n\r\n $r_resource = $reflection->getAdapter()->getHolder();\r\n\r\n $dest_resource = $reflection->getAdapter()->getTransparentImage($width, $height + $this->reflection_height);\r\n\r\n imagecopymerge($dest_resource, $resource, 0, 0, 0 ,0, $width, $height, 100);\r\n\r\n imagecopymerge($dest_resource, $r_resource, 0, $height, 0 ,0, $width, $this->reflection_height, 100);\r\n\r\n // Increments we are going to increase the transparency\r\n $increment = 100 / $this->reflection_height;\r\n\r\n // Overlay line we use to apply the transparency\r\n $line = imagecreatetruecolor($width, 1);\r\n\r\n // Use white as our overlay color\r\n imagefilledrectangle($line, 0, 0, $width, 1, imagecolorallocate($line, 255, 255, 255));\r\n\r\n $tr = $this->start_transparency;\r\n\r\n // Start at the bottom of the original image\r\n for ($i = $height; $i <= $height + $this->reflection_height; $i++)\r\n {\r\n\r\n if ($tr > 100)\r\n {\r\n $tr = 100;\r\n }\r\n\r\n imagecopymerge($dest_resource, $line, 0, $i, 0, 0, $width, 1, $tr);\r\n\r\n $tr += $increment;\r\n\r\n }\r\n\r\n // To set a new resource for the image object\r\n $image->getAdapter()->setHolder($dest_resource);\r\n\r\n return $image;\r\n }", "public function __construct($reflection_height=20, $start_transparency=30)\r\n {\r\n $this->setReflectionHeight($reflection_height);\r\n $this->setStartTransparency($start_transparency);\r\n }", "public function reflectionAction()\n {\n $image = __DIR__ . '/../../../data/media/test.jpg';\n $reflection = $this->thumbnailer->createReflection(40, 40, 80, true, '#a4a4a4');\n $thumb = $this->thumbnailer->create($image, [], [$reflection]);\n\n $thumb\n ->resize(200, 200)\n ->show()\n ->save('public/resized_test.jpg');\n\n return false;\n }", "function voegToe()\n{\n echo \"<style> #foto{ opacity: 0.5%; fill-rule: alpha(opacity=50) } </style>\";\n\n}", "abstract public function buildEffect();", "function fpg_reflections($name, $params) {\n\t$begin = \"ZEND_BEGIN_ARG_INFO(arginfo_fann_%s_$name, 0)\";\n\t$arg = \"ZEND_ARG_INFO(0, %s)\";\n\t$end = \"ZEND_END_ARG_INFO()\";\n\t// getter\n\tif ($params['has_getter']) {\n\t\tfpg_printf($begin, 'get');\n\t\tfpg_printf($arg, 'ann');\n\t\t$first = true;\n\t\tforeach ($params['params'] as $param_name => $param_type) {\n\t\t\tif ($first)\n\t\t\t\t$first = false;\n\t\t\telse\n\t\t\t\tfpg_printf($arg, $param_name);\n\t\t}\n\t\tfpg_printf($end);\n\t\tfpg_printf(); // EOL\n\t}\n\t// setter\n\tif ($params['has_setter']) {\n\t\tfpg_printf($begin, 'set');\n\t\tfpg_printf($arg, 'ann');\n\t\tforeach ($params['params'] as $param_name => $param_type) {\n\t\t\tfpg_printf($arg, $param_name);\n\t\t}\n\t\tfpg_printf($end);\n\t\tfpg_printf();\n\t}\n}", "public function getOpacity() {}", "public function setOpacity($opacity) {}", "public function injectReflectionService(\\F3\\FLOW3\\Reflection\\ReflectionService $reflectionService) {\n\t\t$this->reflectionService = $reflectionService;\n\t}", "function imageVerbose($property, $size = null);", "protected function initializeReflection() {}", "public function __construct($opacity)\r\n {\r\n $this->setOpacity($opacity);\r\n }", "public function effect1()\n {\n }", "public function setConstantOpacity($opacity) {}", "public function injectReflectionService(\\TYPO3\\Flow\\Reflection\\ReflectionService $reflectionService) {\n\t\t$this->reflectionService = $reflectionService;\n\t}", "function hook_image_effect_info_alter(&$effects) {\n // Override the Image module's crop effect with more options.\n $effects['image_crop']['effect callback'] = 'mymodule_crop_effect';\n $effects['image_crop']['dimensions callback'] = 'mymodule_crop_dimensions';\n $effects['image_crop']['form callback'] = 'mymodule_crop_form';\n}", "public function opacity($value) {\n return $this->setProperty('opacity', $value);\n }", "public function opacity($value) {\n return $this->setProperty('opacity', $value);\n }", "public function opacity($value) {\n return $this->setProperty('opacity', $value);\n }", "public function opacity($value) {\n return $this->setProperty('opacity', $value);\n }", "public function colorImage() {}", "function _add_image_data( $im ) {\n\t\t$width = imagesx( $im );\n\t\t$height = imagesy( $im );\n\t\t\n\t\t\n\t\t$pixel_data = array();\n\t\t\n\t\t$opacity_data = array();\n\t\t$current_opacity_val = 0;\n\t\t\n\t\tfor ( $y = $height - 1; $y >= 0; $y-- ) {\n\t\t\tfor ( $x = 0; $x < $width; $x++ ) {\n\t\t\t\t$color = imagecolorat( $im, $x, $y );\n\t\t\t\t\n\t\t\t\t$alpha = ( $color & 0x7F000000 ) >> 24;\n\t\t\t\t$alpha = ( 1 - ( $alpha / 127 ) ) * 255;\n\t\t\t\t\n\t\t\t\t$color &= 0xFFFFFF;\n\t\t\t\t$color |= 0xFF000000 & ( $alpha << 24 );\n\t\t\t\t\n\t\t\t\t$pixel_data[] = $color;\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t$opacity = ( $alpha <= 127 ) ? 1 : 0;\n\t\t\t\t\n\t\t\t\t$current_opacity_val = ( $current_opacity_val << 1 ) | $opacity;\n\t\t\t\t\n\t\t\t\tif ( ( ( $x + 1 ) % 32 ) == 0 ) {\n\t\t\t\t\t$opacity_data[] = $current_opacity_val;\n\t\t\t\t\t$current_opacity_val = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif ( ( $x % 32 ) > 0 ) {\n\t\t\t\twhile ( ( $x++ % 32 ) > 0 )\n\t\t\t\t\t$current_opacity_val = $current_opacity_val << 1;\n\t\t\t\t\n\t\t\t\t$opacity_data[] = $current_opacity_val;\n\t\t\t\t$current_opacity_val = 0;\n\t\t\t}\n\t\t}\n\t\t\n\t\t$image_header_size = 40;\n\t\t$color_mask_size = $width * $height * 4;\n\t\t$opacity_mask_size = ( ceil( $width / 32 ) * 4 ) * $height;\n\t\t\n\t\t\n\t\t$data = pack( 'VVVvvVVVVVV', 40, $width, ( $height * 2 ), 1, 32, 0, 0, 0, 0, 0, 0 );\n\t\t\n\t\tforeach ( $pixel_data as $color )\n\t\t\t$data .= pack( 'V', $color );\n\t\t\n\t\tforeach ( $opacity_data as $opacity )\n\t\t\t$data .= pack( 'N', $opacity );\n\t\t\n\t\t\n\t\t$image = array(\n\t\t\t'width' => $width,\n\t\t\t'height' => $height,\n\t\t\t'color_palette_colors' => 0,\n\t\t\t'bits_per_pixel' => 32,\n\t\t\t'size' => $image_header_size + $color_mask_size + $opacity_mask_size,\n\t\t\t'data' => $data,\n\t\t);\n\t\t\n\t\t$this->_images[] = $image;\n\t}", "function imagecustom($im, $text) {\n}", "function image_filter($im, $name){\n\tif($im && imagefilter($im, IMG_FILTER_NEGATE)){\n\t\timagepng($im, '../upload/filter/effect_invert/'. $name);\n\t}\n\tif($im && imagefilter($im, IMG_FILTER_GRAYSCALE)){\n\t\timagepng($im, '../upload/filter/effect_grayscale/'. $name);\n\t}\n\tif($im && imagefilter($im, IMG_FILTER_BRIGHTNESS, 20)){\n\t\timagepng($im, '../upload/filter/effect_brightness/'. $name);\n\t}\n\tif($im && imagefilter($im, IMG_FILTER_CONTRAST, 20)){\n\t\timagepng($im, '../upload/filter/effect_contrast/'. $name);\n\t}\n\t\n\t\t\n\tif($im && imagefilter($im, IMG_FILTER_COLORIZE, 255, 0, 0)){\n\t\timagepng($im, '../upload/filter/effect_color_red/'. $name);\n\t}\n\t\n\tif($im && imagefilter($im, IMG_FILTER_COLORIZE, 0, 255, 0)){\n\t\timagepng($im, '../upload/filter/effect_color_green/'. $name);\n\t}\n\t\n\tif($im && imagefilter($im, IMG_FILTER_COLORIZE, 0, 0, 255)){\n\t\timagepng($im, '../upload/filter/effect_color_blue/'. $name);\n\t}\n\t\n\t\n\t\n\t//if($im && imagefilter($im, IMG_FILTER_EDGEDETECT, 20)){\n\t//\timagepng($im, '../upload/filter/effect_brightness/'. $name);\n\t//}\n\t\n\tif($im && imagefilter($im, IMG_FILTER_EMBOSS)){\n\t\timagepng($im, '../upload/filter/effect_emboss/'. $name);\n\t}\n\t\n\tif($im && imagefilter($im, IMG_FILTER_GAUSSIAN_BLUR)){\n\t\timagepng($im, '../upload/filter/effect_gaussian_blue/'. $name);\n\t}\n\t\n\t//if($im && imagefilter($im, IMG_FILTER_SELECTIVE_BLUR, 20)){\n\t//\timagepng($im, '../upload/filter/effect_brightness/'. $name);\n\t//}\n\n\tif($im && imagefilter($im, IMG_FILTER_MEAN_REMOVAL, 20)){\n\t\timagepng($im, '../upload/filter/effect_mean_remove/'. $name);\n\t}\n\n\tif($im && imagefilter($im, IMG_FILTER_SMOOTH, 1)){\n\t\timagepng($im, '../upload/filter/effect_smooth/'. $name);\n\t}\n\n\tif($im && imagefilter($im, IMG_FILTER_PIXELATE, 3, TRUE)){\n\t\timagepng($im, '../upload/filter/effect_brightness/'. $name);\n\t}\n}", "public function implement_all_effects()\n\t{\n\t\tforeach ($this->collection as $image)\n\t\t{\n\t\t\t$image->implement_effects();\n\t\t}\n\t}", "function img ( $arguments = \"\" ) {\n $arguments = func_get_args();\n $rc = new ReflectionClass('timg');\n return $rc->newInstanceArgs( $arguments ); \n}", "function zend_reflection_function2($one, $two = 'two') {\n \n return 'blah';\n}", "public function show(Vision $vision)\n {\n //\n }", "public function frontImage()\r\n {\r\n $wrapper = imagecreatetruecolor(16 * $this->ratio(), 32 * $this->ratio());\r\n $background = imagecolorallocatealpha($wrapper, 255, 255, 255, 127);\r\n imagefill($wrapper, 0, 0, $background);\r\n\r\n imagecopy($wrapper, $this->image, 4 * $this->ratio(), 0 * $this->ratio(), 8 * $this->ratio(),\r\n 8 * $this->ratio(), 8 * $this->ratio(), 8 * $this->ratio());\r\n //arms\r\n imagecopy($wrapper, $this->image, 0 * $this->ratio(), 8 * $this->ratio(), 44 * $this->ratio(),\r\n 20 * $this->ratio(), 4 * $this->ratio(), 12 * $this->ratio());\r\n $this->imageflip($wrapper, $this->image, 12 * $this->ratio(), 8 * $this->ratio(), 44 * $this->ratio(),\r\n 20 * $this->ratio(), 4 * $this->ratio(), 12 * $this->ratio());\r\n //chest\r\n imagecopy($wrapper, $this->image, 4 * $this->ratio(), 8 * $this->ratio(), 20 * $this->ratio(),\r\n 20 * $this->ratio(), 8 * $this->ratio(), 12 * $this->ratio());\r\n //legs\r\n imagecopy($wrapper, $this->image, 4 * $this->ratio(), 20 * $this->ratio(), 4 * $this->ratio(),\r\n 20 * $this->ratio(), 4 * $this->ratio(), 12 * $this->ratio());\r\n $this->imageflip($wrapper, $this->image, 8 * $this->ratio(), 20 * $this->ratio(), 4 * $this->ratio(),\r\n 20 * $this->ratio(), 4 * $this->ratio(), 12 * $this->ratio());\r\n //hat\r\n imagecopy($wrapper, $this->image, 4 * $this->ratio(), 0 * $this->ratio(), 40 * $this->ratio(),\r\n 8 * $this->ratio(), 8 * $this->ratio(), 8 * $this->ratio());\r\n\r\n return $wrapper;\r\n }", "protected function transform(sfImage $image)\r\n {\r\n $new_img = $image->getAdapter()->getTransparentImage($image->getWidth(), $image->getHeight());\r\n\r\n imagealphablending($new_img, false);\r\n imagesavealpha($new_img, true);\r\n\r\n $opacity = (int)round(127-((127/100)*$this->getOpacity()));\r\n\r\n // imagesavealpha($new_img, true);\r\n $width = $image->getWidth();\r\n $height = $image->getHeight();\r\n\r\n for ($x=0;$x<$width; $x++)\r\n {\r\n for ($y=0;$y<$height; $y++)\r\n {\r\n $rgb = imagecolorat($image->getAdapter()->getHolder(), $x, $y);\r\n $r = ($rgb >> 16) & 0xFF;\r\n $g = ($rgb >> 8) & 0xFF;\r\n $b = $rgb & 0xFF;\r\n $alpha = ($rgb & 0x7F000000) >> 24;\r\n\r\n $new_opacity = ($alpha + ((127-$alpha)/100)*$this->getOpacity());\r\n\r\n $colors[$alpha] = $new_opacity;\r\n\r\n $color = imagecolorallocatealpha($new_img, $r, $g, $b, $new_opacity);\r\n imagesetpixel($new_img,$x, $y, $color);\r\n }\r\n }\r\n\r\n $image->getAdapter()->setHolder($new_img);\r\n\r\n return $image;\r\n }", "function imagesetstyle($image, $style)\n{\n}", "public function reveal($object);", "public function aparecer() {\n // Referencia al objeto dentro de la clase\n echo '<img src=\"' . $this -> foto . '\">';\n\n }", "public function apply($resource){\n\t\t// Extract arguments\n\t\t@list(,$level)=func_get_args();\n\t\t$level=abs((int)$level);\n\t\tif(!$level){\n\t\t $level=5;\n\t\t}\n\t\t// Get resolution\n\t\t$width=imagesx($resource);\n\t\t$height=imagesy($resource);\n\t\tif(!$width || !$height){\n\t\t\tthrow new Exception(\"An error was encountered while getting image resolution\");\n\t\t}\n\t\t// Apply effect\n\t\t$x=0;\n\t\tdo{\n\t\t\t$y=0;\n\t\t\tdo{\n\t\t\t\t// Get current pixel color\n\t\t\t\tlist($r,$g,$b,$a)=$this->_getColorAt($resource,$x,$y);\n\t\t\t\t// Generate noise\n\t\t\t\t$z=rand(-$level,$level);\n\t\t\t\t// Define color\n\t\t\t\t$r+=$z;\n\t\t\t\t$g+=$z;\n\t\t\t\t$b+=$z;\n\t\t\t\tif($r<0)\t\t$r=0;\n\t\t\t\telseif($r>255)\t$r=255;\n\t\t\t\tif($g<0)\t\t$g=0;\n\t\t\t\telseif($g>255)\t$g=255;\n\t\t\t\tif($b<0)\t\t$b=0;\n\t\t\t\telseif($b>255)\t$b=255;\n\t\t\t\t// Define new pixel\n\t\t\t\timagesetpixel($resource,$x,$y,imagecolorallocatealpha($resource,$r,$g,$b,$a));\n\t\t\t}\n\t\t\twhile(++$y<$height);\n\t\t}\n\t\twhile(++$x<$width);\n\t\treturn $resource;\n\t}", "public function getReflectionService() {}", "public function injectReflection($refl)\n {\n $this->reflection = $refl;\n return $this;\n }", "public function transparentAction() {\n $width = 400;\n $height = 300;\n $radius = 200;\n $numberOfSpots = 20;\n $intensity = 20;\n\n // get service\n $heatmap = $this->get('morgenstille.visual.heatmap')->create($width, $height);\n\n // add random spots to the heatmap\n for($i = 0; $i < $numberOfSpots; $i++) {\n $heatmap->add(new SpotInterpolate(rand(0, $width), rand(0, $height), rand(0, $radius), rand(0, $intensity)));\n }\n\n // render the heatmap and return the png response\n return $heatmap->renderPngResponse(new TransparentRenderer($heatmap->getMinValue(), $heatmap->getMaxValue()));\n\n }", "public function image();", "public function image();", "function setTransparency($new_image,$image_source) { \n $transparencyIndex = imagecolortransparent($image_source); \n $transparencyColor = array('red' => 255, 'green' => 255, 'blue' => 255); \n \n if ($transparencyIndex >= 0) { \n $transparencyColor = imagecolorsforindex($image_source, $transparencyIndex); \n } \n \n $transparencyIndex = imagecolorallocate($new_image, $transparencyColor['red'], $transparencyColor['green'], $transparencyColor['blue']); \n imagefill($new_image, 0, 0, $transparencyIndex); \n imagecolortransparent($new_image, $transparencyIndex); \n }", "function image_edit_apply_changes($image, $changes)\n {\n }", "abstract public function show($img);", "public function apply($resource){\n\t\t// Verify support\n\t\tif(!function_exists('imagefilter')){\n\t\t\tthrow new Exception(\"It seems your PHP version is not compiled with the bundled version of the GD library\");\n\t\t}\n\t\t// Extract arguments\n\t\t@list(,$color,$opacity)=func_get_args();\n\t\t$rgb=html2rgb($color);\n\t\t// Normalize\n\t\tif($opacity===null)\t\t$opacity=100;\n\t\telseif($opacity<0)\t\t$opacity=0;\n\t\telseif($opacity>100)\t$opacity=100;\n\t\t$a=(100-$opacity)*1.27;\n\t\t// Apply effect\n\t\tif(!imagefilter($resource,IMG_FILTER_COLORIZE,$rgb[0],$rgb[1],$rgb[2],$a)){\n\t\t\tthrow new Exception(\"COLORIZE filter failed\");\n\t\t}\n\t\treturn $resource;\n\t}", "public function effect($effect)\n {\n $args = array_slice(func_get_args(), 1);\n\n if($effect instanceof PictureEffect)\n {\n $this->effect[] = $effect;\n }\n else\n {\n $effectClass = \"Palette\\\\Effect\\\\\" . $effect;\n\n if(class_exists($effectClass))\n {\n $reflection = new ReflectionClass($effectClass);\n $this->effect[] = $reflection->newInstanceArgs($args);\n }\n else\n {\n throw new Exception('Unknown Palette effect instance');\n }\n }\n }", "public function contrast($factor)\n {\n if (imagefilter($this->sourceImage, IMG_FILTER_CONTRAST, $factor))\n $this->objet->setSource($this->sourceImage);\n }", "function construct_single_image(){\n\t\t\t\n\t\t\tvc_add_param( 'vc_single_image', \n\t\t\t\tarray(\n\t\t\t\t\t'type' => 'checkbox',\n\t\t\t\t\t'heading' => __(\"Add Photo Stack Effect\", \"CURLYTHEME\"),\n\t\t\t\t\t'param_name' => 'photo_frame',\n\t\t\t\t\t'weight'\t=> 1\n\t\t\t\t) \n\t\t\t);\n\t\t\t\n\t\t\tvc_add_param( 'vc_single_image', \n\t\t\t\tarray(\n\t\t\t\t\t'type' => 'checkbox',\n\t\t\t\t\t'heading' => __(\"Add Zoomify Effect\", \"CURLYTHEME\"),\n\t\t\t\t\t'param_name' => 'zoomify',\n\t\t\t\t\t'weight'\t=> 2\n\t\t\t\t) \n\t\t\t);\n\t\t\t\n\t\t}", "function hook_image_default_styles() {\n $styles = array();\n\n $styles['mymodule_preview'] = array(\n 'label' => 'My module preview',\n 'effects' => array(\n array(\n 'name' => 'image_scale',\n 'data' => array('width' => 400, 'height' => 400, 'upscale' => 1),\n 'weight' => 0,\n ),\n array(\n 'name' => 'image_desaturate',\n 'data' => array(),\n 'weight' => 1,\n ),\n ),\n );\n\n return $styles;\n}", "public function getOpacity()\r\n {\r\n return $this->opacity;\r\n }", "public function edit(Vision $vision)\n {\n //\n }", "abstract public function getReflection($method);", "public function addFilter($_image, $filter, $param1, $param2, $param3)\n {\n \n //se o filtro estiver no array de filtros simples\n if(array_key_exists($filter,self::$_simpleFilters))\n {\n imagefilter($_image, self::$_simpleFilters[$filter]);\n return $_image;\n }\n //verifico se o filtro e do array de customizados\n elseif(in_array($filter,self::$_customFilters))\n {\n //verifico que tipo de filtro e esse\n switch ($filter)\n {\n case \"sharpen\":\n require_once \"Custom/Sharpen.php\"; //Efeito Sharpen\n //arumando as propriedades para que nao ocorra nehum tipo de erro durante a execucao\n $param1 = (($param1 > 200 || $param1 < 50)?50:$param1);\n $param2 = (($param2 > 1 || $param2 < 0.5)?0.5:$param2);\n $param3 = (($param3 > 5 || $param3 < 0)?0:$param3);\n\n //instanciando a classe do Sharpen\n $sharpen = new Sharpen;\n $_image = $sharpen->addSharpen($_image, $param1, $param2, $param3);\n return $_image;\n break;\n\n case \"noise\":\n require_once \"Custom/Noise.php\"; //Efeito Noise\n //instanciando a classe de noise\n $noise = new Noise;\n $_image = $noise->addNoise($_image);\n return $_image;\n break;\n\n case \"scatter\":\n require_once \"Custom/Scatter.php\"; //Efeito Scatter\n //instanciando a classe de scatter\n $scatter = new Scatter;\n $_image = $scatter->addScatter($_image);\n return $_image;\n break;\n\n case \"pixelate\":\n require_once \"Custom/Pixelate.php\"; //Efeito Pixelate\n //instanciando a classe de pixelate\n $pixelate = new Pixelate;\n $_image = $pixelate->addPixelate($_image);\n return $_image;\n break;\n\n case \"interlace\":\n require_once \"Custom/Interlace.php\"; //Efeito Interlace\n //instanciando a classe de interlace\n $interlace = new Interlace;\n $_image = $interlace->addInterlace($_image);\n return $_image;\n break;\n\n case \"screen\":\n require_once \"Custom/Screen.php\"; //Efeito Screen\n //instanciando a classe de Screen\n $screen = new Screen;\n $_image = $screen->addScreen($_image);\n return $_image;\n break;\n }\n }\n //se o filtro estiver no array de filtros simples\n elseif(array_key_exists($filter,self::$_advancedFilters))\n {\n //verifico se o filtro recebe mais de um parametro\n if($filter == 'colorize')\n {\n imagefilter($_image, self::$_advancedFilters[$filter], $param1, $param2, $param3);\n return $_image;\n }\n\n //caso contrario\n else\n {\n imagefilter($_image, self::$_advancedFilters[$filter], $param1);\n return $_image;\n }\n }\n //se nao existir entao sera lancada uma excessao\n else\n {\n throw new Exception(\"Filtro inexistente - Absent filter\");\n return false;\n }\n }", "protected function _callback($reflection) {\n\t\t$args = array_merge(array($reflection), $this->args);\n\t\t// Call the particular filtering checker\n\t\t$res = call_user_func_array(array($this, $this->method), $args);\n\t\t// Return that value, taking negate into account\n\t\treturn $this->negate ? !$res : $res;\n\t}", "public function addImageDescriptors($value)\n {\n $this->addToFirstFrameWithoutProperty($value, 'imageDescriptor');\n }", "public function getReflect()\n {\n return $this->_reflect;\n }", "public function created(Vision $vision)\n {\n //\n }", "public function __construct( $colorDefinition, int $opacity = 100 )\n {\n\n parent::__construct( '#000000', $opacity );\n\n if ( TypeTool::IsInteger( $colorDefinition ) )\n {\n $this->setGdValue( $colorDefinition );\n }\n else if ( is_array( $colorDefinition ) )\n {\n $this->setARGB( $colorDefinition );\n $this->data[ 'gd' ] = $this->createGdValue();\n }\n else\n {\n $this->setWebColor( $colorDefinition );\n $this->data[ 'gd' ] = $this->createGdValue();\n }\n\n }", "public function reflect(string $file): ReflectionHierarchy;", "public function setIntensity($intensity) {}", "public function setOpacity($opacity=1.0){\n\t\ttry{\n\t\t\tif(!is_float($value))\n\t\t\t\tthrow new Exception(\"opacity value must be a float number, value provided is \".$opacity);\n\t\t\t\tif($opacity< 0.0 || $opacity> 1)\n\t\t\t\t\tthrow new Exception(\"opacity value must be between 0.0 to 1.0, value provided is \".$opacity);\n\t\t\t\t\t$this->opacity = $opacity;\n\t\t}catch(Exception $e){\n\t\t\tthrow new Exception(ErrorHelper::formatMessage(__FUNCTION__,__CLASS__,$e));\n\t\t}\n\t}", "public static function reflectionFunction($strFunctionName)\n\t{\n\t\tJSONRPC_server::assertFunctionNameAllowed($strFunctionName);\n\n\n\t\tforeach(JSONRPC_server::$arrFilterPlugins as $objFilterPlugin)\n\t\t\t$objFilterPlugin->resolveFunctionName($strFunctionName);\n\n\n\t\tif(function_exists($strFunctionName))\n\t\t\t$reflector=new ReflectionFunction($strFunctionName);\n\t\telse if(is_callable($strFunctionName))\n\t\t{\n\t\t\t$arrClassAndStaticMethod=explode(\"::\", $strFunctionName);\n\t\t\t$reflector=new ReflectionMethod($arrClassAndStaticMethod[0], $arrClassAndStaticMethod[1]);\n\t\t}\n\t\telse\n\t\t\tthrow new JSONRPC_Exception(\"The function \\\"\".$strFunctionName.\"\\\" is not defined or loaded.\", JSONRPC_Exception::METHOD_NOT_FOUND);\n\n\n\t\t$arrFunctionReflection=array(\n\t\t\t\"function_return_type\"=>\"unknown\",\n\t\t\t\"function_documentation_comment\"=>$reflector->getDocComment(),\n\t\t\t\"function_params\"=>array(),\n\t\t);\n\n\t\tstatic $arrTypeMnemonicsToTypes=array(\n\t\t\t\"n\"=>\"integer\",\n\t\t\t\"f\"=>\"float\",\n\t\t\t\"str\"=>\"string\",\n\t\t\t\"arr\"=>\"array\",\n\t\t\t\"b\"=>\"boolean\",\n\t\t\t\"obj\"=>\"object\",\n\t\t\t\"mx\"=>\"mixed\",\n\t\t);\n\n\t\tstatic $arrPHPTypesToTypes=array(\n\t\t\t\"int\"=>\"integer\",\n\t\t\t\"double\"=>\"float\",\n\t\t\t\"float\"=>\"float\",\n\t\t\t\"string\"=>\"string\",\n\t\t\t\"array\"=>\"array\",\n\t\t\t\"bool\"=>\"boolean\",\n\t\t\t\"object\"=>\"object\",\n\t\t\t\"mixed\"=>\"mixed\",\n\t\t\t\"null\"=>\"null\",\n\t\t\t\"none\"=>\"unknown\",\n\t\t);\n\n\t\tif(strpos($arrFunctionReflection[\"function_documentation_comment\"], \"@return\")!==false)\n\t\t{\n\t\t\t$arrReturnParts=explode(\"@return\", $arrFunctionReflection[\"function_documentation_comment\"], 2);\n\t\t\t$arrReturnParts=explode(\".\", $arrReturnParts[1], 2);\n\t\t\t$strReturnType=trim($arrReturnParts[0]);\n\n\t\t\tif(in_array($strReturnType, $arrTypeMnemonicsToTypes))\n\t\t\t\t$arrFunctionReflection[\"function_return_type\"]=$strReturnType;\n\t\t\telse if(isset($arrPHPTypesToTypes[strtolower($strReturnType)]))\n\t\t\t\t$arrFunctionReflection[\"function_return_type\"]=$arrPHPTypesToTypes[strtolower($strReturnType)];\n\t\t}\n\n\t\t$nErrorsPosition=strpos($arrFunctionReflection[\"function_documentation_comment\"], \"@errors\");\n\t\tif($nErrorsPosition!==false)\n\t\t{\n\t\t\t$arrParts=preg_split(\"/[\\.\\r\\n]+/\", substr($arrFunctionReflection[\"function_documentation_comment\"], $nErrorsPosition+strlen(\"@errors \")));\n\t\t\t$arrFunctionReflection[\"function_error_constants\"]=preg_split(\"/[\\s,]+/\", $arrParts[0]);\n\t\t}\n\t\telse\n\t\t\t$arrFunctionReflection[\"function_error_constants\"]=array();\n\n\t\t$arrReflectionParameters=$reflector->getParameters();\n\t\tforeach($arrReflectionParameters as $reflectionParameter)\n\t\t{\n\t\t\t$arrParam=array(\n\t\t\t\t\"param_name\"=>str_replace(array(\"\\$\", \"&\"), array(\"\", \"\"), $reflectionParameter->getName()),\n\t\t\t);\n\n\t\t\t\n\t\t\t$arrParam[\"param_type\"]=\"unknown\";\n\t\t\tforeach($arrTypeMnemonicsToTypes as $strMnemonic=>$strType)\n\t\t\t{\n\t\t\t\tif(\n\t\t\t\t\tsubstr($arrParam[\"param_name\"], 0, strlen($strMnemonic))===$strMnemonic\n\t\t\t\t\t&& ctype_upper(substr($arrParam[\"param_name\"], strlen($strMnemonic), 1))\n\t\t\t\t)\n\t\t\t\t{\n\t\t\t\t\t$arrParam[\"param_type\"]=$strType;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tif($reflectionParameter->isDefaultValueAvailable())\n\t\t\t{\n\t\t\t\t$arrParam[\"param_default_value_json\"]=json_encode($reflectionParameter->getDefaultValue());\n\t\t\t\t$arrParam[\"param_default_value_constant_name\"] = self::reflectionConstantName($reflectionParameter->getName(), $arrFunctionReflection[\"function_documentation_comment\"]);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$arrParam[\"param_default_value_json\"]=\"\";\n\t\t\t\t$arrParam[\"param_default_value_constant_name\"] = \"\";\n\t\t\t}\n\t\t\t$arrFunctionReflection[\"function_params\"][]=$arrParam;\n\t\t}\n\t\t\n\t\tif(!self::$_bCodeComments)\n\t\t\tunset($arrFunctionReflection[\"function_documentation_comment\"]);\n\t\t\n\t\treturn $arrFunctionReflection;\n\t}", "public static function edit_image()\n{\n\n\n\t/*\n\t* Change Background\n\t*/\n\n\t/*\n\t* Change other setting\n\t*/\n}", "function accouk_photo_info($atts) {\n\n $camera = null;\n $lens = null;\n $date_taken = null;\n $focal_length = null;\n $aperture = null;\n $shutter_speed = null;\n $iso = null;\n\n // Read EXIF data\n $exif = exif_read_data( wp_get_original_image_path( get_post_thumbnail_id() ) );\n\n // Calculate properties from EXIF data\n if(isset($exif['Make']) && isset($exif['Model'])) {\n $camera = $exif['Make'] . \" \" . $exif['Model'];\n }\n\n if(isset($exif['UndefinedTag:0xA434'])) { \n $lens = $exif['UndefinedTag:0xA434'];\n }\n\n if(isset($exif['DateTimeOriginal'])) {\n $exif_date_as_obj = date_create_from_format(\"Y:m:d H:i:s\", $exif['DateTimeOriginal']);\n if($exif_date_as_obj) {\n $date_taken = date_format($exif_date_as_obj, \"d/m/Y H:i\");\n }\n }\n\n if(isset($exif['FocalLength'])) {\n $exp = explode(\"/\", $exif['FocalLength']);\n $focal_length = $exp[0] / $exp[1];\n $focal_length .= \"mm\";\n }\n\n if(isset($exif['COMPUTED']['ApertureFNumber'])) {\n $aperture = $exif['COMPUTED']['ApertureFNumber'];\n } else if(isset($exif['FNumber'])) {\n $exp = explode(\"/\", $exif['FNumber']);\n $aperture = \"f/\";\n $aperture .= number_format($exp[0] / $exp[1], 1);\n }\n\n if(isset($exif['ExposureTime'])) {\n $exp = explode(\"/\", $exif['ExposureTime']);\n $time = $exp[0] / $exp[1];\n if($time < 1) {\n $shutter_speed = $exif['ExposureTime'] . \" second\";\n } else if ($time === 1) {\n $shutter_speed = \"1 second\";\n } else {\n $shutter_speed = round($time, 2) . \" seconds\";\n }\n }\n\n if(isset($exif['ISOSpeedRatings'])) {\n $iso = $exif['ISOSpeedRatings'];\n } \n\n // Override with user supplied\n $img_meta = shortcode_atts(array(\n 'camera' => $camera,\n\t\t'lens' => $lens,\n 'date_taken' => $date_taken,\n 'focal_length' => $focal_length,\n 'aperture' => $aperture,\n 'shutter_speed' => $shutter_speed,\n 'iso' => $iso,\n 'lat' => $lat,\n 'lng' => $lng\n\t), $atts);\n\n\n // Work out if a map could be shown.\n $map_url = null;\n\n include_once('svc/map-svcs.php');\n $ms = new MapSvcs;\n\n // Manual co-ordinates supplied\n if(isset($img_meta['lat']) && isset($img_meta['lng'])) {\n $lat_lng = array($img_meta['lat'], $img_meta['lng']);\n $map_url = $ms->get_map_url(wp_upload_dir(), $lat_lng);\n } \n \n // Otherwise look at the EXIF data\n else if(isset($exif['GPSLatitude'])) {\n\n $lat_dms = $exif['GPSLatitude'];\n $lat_ref = $exif['GPSLatitudeRef'];\n $lng_dms = $exif['GPSLongitude'];\n $lng_ref = $exif['GPSLongitudeRef'];\n\n $lat_lng = $ms->exif_dms_to_decimal_degrees($lat_dms, $lat_ref, $lng_dms, $lng_ref);\n\n $map_url = $ms->get_map_url(wp_upload_dir(), $lat_lng);\n\n }\n\n // Output with template\n ob_start();\n include('templates/photo-info.php');\n $element = ob_get_contents();\n ob_end_clean();\n\n\treturn $element;\n}", "function stInterDogmaEffect() { $current_effect_type = self::getGameStateValue('current_effect_type');\n \n // Indicate the potential new (non-demand) dogma to come\n if ($current_effect_type == 0) { // I demand dogma : there is only one for this version of this game\n $current_effect_number = 1; // Switch on the first non-demand dogma, if exists\n }\n else {\n $current_effect_number = self::getGameStateValue('current_effect_number') + 1; // Next non-demand dogma, if exists\n }\n \n $card_id = self::getGameStateValue('dogma_card_id');\n $card = self::getCardInfo($card_id);\n \n // Check whether this new dogma exists actually or not\n if ($current_effect_number > 3 || $card['non_demand_effect_'.$current_effect_number] === null) {\n // No card has more than 3 non-demand dogma => there is no more effect\n // or the next non-demand-dogma effect is not defined\n \n $sharing_bonus = self::getGameStateValue('sharing_bonus');\n $launcher_id = self::getGameStateValue('active_player');\n \n // Stats\n $i_demand_effects = false;\n $executing_players = self::getExecutingPlayers();\n foreach($executing_players as $player_id => $stronger_or_equal) {\n if ($player_id == $launcher_id) {\n continue;\n }\n if ($stronger_or_equal) { // This player had effectively shared some dogma effects of the card\n self::incStat(1, 'sharing_effects_number', $player_id);\n }\n else { // The card had an I demand effect, and at least one player executed it with effects\n self::incStat(1, 'i_demand_effects_number', $player_id);\n $i_demand_effects = true;\n }\n\n }\n if ($i_demand_effects) {\n self::incStat(1, 'dogma_actions_number_with_i_demand', $launcher_id);\n }\n if ($sharing_bonus == 1) {\n self::incStat(1, 'dogma_actions_number_with_sharing', $launcher_id);\n }\n \n // Award the sharing bonus if needed\n if ($sharing_bonus == 1) {\n self::notifyGeneralInfo('<span class=\"minor_information\">${text}</span>', array('i18n'=>array('text'), 'text'=>clienttranslate('Sharing bonus.')));\n $player_who_launched_the_dogma = self::getGameStateValue('active_player');\n try {\n self::executeDraw($player_who_launched_the_dogma); // Draw a card with age consistent with player board\n }\n catch (EndOfGame $e) {\n // End of the game: the exception has reached the highest level of code\n self::trace('EOG bubbled from self::stInterDogmaEffect');\n self::trace('interDogmaEffect->justBeforeGameEnd');\n $this->gamestate->nextState('justBeforeGameEnd');\n return;\n }\n }\n \n // The active player may have changed during the dogma. Reset it on the player whose turn was\n $this->gamestate->changeActivePlayer($launcher_id);\n \n // Reset player table\n self::resetPlayerTable();\n \n // [R] Disable the flags used when in dogma \n self::setGameStateValue('dogma_card_id', -1);\n self::setGameStateValue('current_effect_type', -1);\n self::setGameStateValue('current_effect_number', -1);\n self::setGameStateValue('sharing_bonus', -1);\n self::setGameStateValue('current_player_under_dogma_effect', -1);\n self::setGameStateValue('step', -1);\n self::setGameStateValue('step_max', -1);\n self::setGameStateValue('special_type_of_choice', -1);\n self::setGameStateValue('choice', -1);\n self::setGameStateValue('splay_direction', -1);\n self::setGameStateValue('n_min', -1);\n self::setGameStateValue('n_max', -1);\n self::setGameStateValue('solid_constraint', -1);\n self::setGameStateValue('owner_from', -1);\n self::setGameStateValue('location_from', -1);\n self::setGameStateValue('owner_to', -1);\n self::setGameStateValue('location_to', -1);\n self::setGameStateValue('bottom_to', -1);\n self::setGameStateValue('age_min', -1);\n self::setGameStateValue('age_max', -1);\n self::setGameStateValue('color_array', -1);\n self::setGameStateValue('with_icon', -1);\n self::setGameStateValue('without_icon', -1);\n self::setGameStateValue('not_id', -1);\n self::setGameStateValue('can_pass', -1);\n self::setGameStateValue('n', -1);\n self::setGameStateValue('id_last_selected', -1);\n self::setGameStateValue('age_last_selected', -1);\n self::setGameStateValue('color_last_selected', -1);\n self::setGameStateValue('score_keyword', -1);\n self::setGameStateValue('auxiliary_value', -1);\n for($i=1; $i<=9; $i++) {\n self::setGameStateInitialValue('nested_id_'.$i, -1);\n self::setGameStateInitialValue('nested_current_effect_number_'.$i, -1);\n }\n \n // End of this player action\n self::trace('interDogmaEffect->interPlayerTurn');\n $this->gamestate->nextState('interPlayerTurn');\n return;\n }\n \n // There is another (non-demand) effect to perform\n self::setGameStateValue('current_effect_type', 1);\n self::setGameStateValue('current_effect_number', $current_effect_number);\n \n // Jump to this effect\n self::trace('interDogmaEffect->dogmaEffect');\n $this->gamestate->nextState('dogmaEffect');\n }", "public function effects($value)\n {\n return $this->setProperty('effects', $value);\n }", "public function show(Picture $image)\n {\n //\n }", "static function add_spotlight(): void {\r\n self::add_acf_field(self::spotlight, [\r\n 'label' => 'Spotlight posts',\r\n 'min' => 0,\r\n 'max' => 5,\r\n 'layout' => 'row',\r\n 'button_label' => 'Add spotlight',\r\n 'collapsed' => self::qualify_field(self::spotlight_post),\r\n 'type' => 'repeater',\r\n 'instructions' => 'These are the text-only posts highlighted just below the menu on the front page. You can add up to 5 of them, or remove all of them to turn off spotlight altogether.',\r\n 'required' => 0,\r\n 'conditional_logic' => 0,\r\n 'wrapper' => [\r\n 'width' => '',\r\n 'class' => '',\r\n 'id' => '',\r\n ],\r\n ]);\r\n }", "public function effect()\n {\n if (null === $this->effect) {\n $this->effect = new Effect\\Imagick($this);\n }\n if (null === $this->effect->getImage()) {\n $this->effect->setImage($this);\n }\n return $this->effect;\n }", "public function effect($filter, $params = array(), $repeat = 1 )\n\t{\n\t\tif(!is_array($params)) $params = (array)$params;\t// force the params to be an array if they're not already\n\t\t$repeat = !is_numeric($repeat)?1:(int)$repeat;\t\t// the number of times to repeat a filter - i.e. to get a stronger blur, for example\n\t\t$filter_type = 'standard';\t// determines the type of filter that gets applied\n\t\t$param_length = 4;\t// determines how many parameters get passed to certain types of filters\n\n\t\tswitch($filter)\n\t\t{\n\t\t\tcase 'brightness':\n\t\t\tcase 'smooth':\n\t\t\t\t$param_length = 1;\n\t\t\t\t$params[0] = $this->constrain_int($params[0]);\n\t\t\t\tbreak;\n\t\t\tcase 'contrast':\n\t\t\t\t$param_length = 1;\n\t\t\t\t$params[0] = $this->constrain_int($params[0], -100, 100);\n\t\t\t\tbreak;\n\t\t\tcase 'colorize':\n\t\t\t\t$param_length = 3;\n\t\t\t\t$params[0] = $this->constrain_int($params[0]);\n\t\t\t\t$params[1] = $this->constrain_int($params[1]);\n\t\t\t\t$params[2] = $this->constrain_int($params[2]);\n\t\t\t\tbreak;\n\t\t\tcase 'multiply':\n\t\t\t\t$param_length = 3;\n\t\t\t\t$params[0] = abs(255 - $this->constrain_int($params[0]) ) * -1;\n\t\t\t\t$params[1] = abs(255 - $this->constrain_int($params[1]) ) * -1;\n\t\t\t\t$params[2] = abs(255 - $this->constrain_int($params[2]) ) * -1;\n\t\t\t\t\n\t\t\t\t$filter = 'colorize';\n\t\t\t\tbreak;\n\t\t\tcase 'pixelate':\n\t\t\t\t$param_length = 2;\n\t\t\t\t$params[0] = $this->constrain_int($params[0], 0);\n\t\t\t\t$params[1] = (isset($params[1]) && is_bool($params[1]))?$params[1]:false;\n\t\t\t\tbreak;\n\t\t\tcase 'negate':\n\t\t\tcase 'grayscale':\n\t\t\tcase 'edgedetect':\n\t\t\tcase 'emboss':\n\t\t\tcase 'gaussian_blur':\n\t\t\tcase 'selective_blur':\n\t\t\tcase 'mean_removal':\n\t\t\t\t$param_length = 0;\n\t\t\t\tbreak;\n\t\t\tcase 'emboss2':\n\t\t\t\t$matrix = array(array(2, 0, 0), array(0, -1, 0), array(0, 0, -1));\n\t\t\t\t$divisor = 1;\n\t\t\t\t$offset = 127;\n\t\t\t\t$filter_type = 'matrix';\n\t\t\t\tbreak;\n\t\t\tcase 'emboss3':\n\t\t\t\t$matrix = array(array(1, 1, -1), array(1, 1, -1), array(1, -1, -1));\n\t\t\t\t$divisor = 1;\n\t\t\t\t$offset = 127;\n\t\t\t\t$filter_type = 'matrix';\n\t\t\t\tbreak;\n\t\t\tcase 'edgedetect2':\n\t\t\t\t$matrix = array(array(1, 1, 1), array(1, 7, 1), array(1, 1, -1));\n\t\t\t\t$divisor = 1;\n\t\t\t\t$offset = 127;\n\t\t\t\t$filter_type = 'matrix';\n\t\t\t\tbreak;\n\t\t\tcase 'edgedetect3':\n\t\t\t\t$matrix = array(array(-1, -1, -1), array(0, 0, 0), array(1, 1, 1));\n\t\t\t\t$divisor = 1;\n\t\t\t\t$offset = 127;\n\t\t\t\t$filter_type = 'matrix';\n\t\t\t\tbreak;\n\t\t\tcase 'gaussian_blur2':\n\t\t\t\t$matrix = array(array(1, 2, 1), array(2, 4, 2), array(1, 2, 1));\n\t\t\t\t$divisor = 16;\n\t\t\t\t$offset = -1;\n\t\t\t\t$filter_type = 'matrix';\n\t\t\t\tbreak;\n\t\t\tcase 'sharpen':\n\t\t\t\t$matrix = array(array(0, -1, 0), array(-1, 5, -1), array(0, -1, 0));\n\t\t\t\t$divisor = 1;\n\t\t\t\t$offset = 63;\n\t\t\t\t$filter_type = 'matrix';\n\t\t\t\tbreak;\n\t\t\tcase 'rotate':\n\t\t\t\t$param_length = 2;\n\t\t\t\t$filter_type = 'function';\n\t\t\t\t$filter_function = \"image$filter\";\n\t\t\t\t$params[0] = $this->constrain_int($params[0], -360, 360);\n\t\t\t\t$params[1] = 0;\n\t\t\t\tbreak;\n\t\t\tcase 'round_pixelate':\n\t\t\t\t$param_length = 1;\n\t\t\t\t$filter_type = 'custom_method';\n\t\t\t\t$filter_function = \"custom_$filter\";\n\t\t\t\t$params[0] = $this->constrain_int($params[0], 0);\n\t\t\t\tbreak;\n\t\t\tcase 'scatter':\n\t\t\t\t$param_length = 1;\n\t\t\t\t$filter_type = 'custom_method';\n\t\t\t\t$filter_function = \"custom_$filter\";\n\t\t\t\t$params[0] = $this->constrain_int($params[0], 0, 50);\n\t\t\t\tbreak;\n\t\t\tcase 'noise':\n\t\t\t\t$param_length = 1;\n\t\t\t\t$filter_type = 'custom_method';\n\t\t\t\t$filter_function = \"custom_$filter\";\n\t\t\t\t$params[0] = $this->constrain_int($params[0], 0);\n\t\t\t\tbreak;\n\t\t\tcase 'oil':\n\t\t\t\t$param_length = 3;\n\t\t\t\t$filter_type = 'custom_method';\n\t\t\t\t$filter_function = \"custom_$filter\";\n\t\t\t\t$params[0] = $this->constrain_int($params[0], 0);\n\t\t\t\t$params[1] = $this->constrain_int($params[1], 0, 20);\n\t\t\t\t$params[2] = $this->constrain_int($params[2], 0, 50);\n\t\t\t\tbreak;\n\t\t}//end switch\n\t\t\n\t\tfor($i=0; $i<4; $i++)\n\t\t{\n\t\t\tif(!isset($params[$i]))\n\t\t\t\t$params[$i] = null;\n\t\t}\n\n\t\tif($filter_type == 'standard')\n\t\t{\n\t\t\t$filter_const = constant('IMG_FILTER_' . strtoupper($filter));\n\t\t\t// bit ugly, but for filters that expect 2 or 3 extra parameters, PHP gives a warning when more are passed\n\t\t\t// conversely, PHP doesn't care about extra parameters passed when it expects none\n\t\t\tswitch($param_length)\n\t\t\t{\n\t\t\t\tcase 0:\n\t\t\t\t\tfor($i=0; $i<$repeat; $i++)\n\t\t\t\t\t\timagefilter($this->image, $filter_const);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 1:\n\t\t\t\t\tfor($i=0; $i<$repeat; $i++)\n\t\t\t\t\t\timagefilter($this->image, $filter_const, $params[0]);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\tfor($i=0; $i<$repeat; $i++)\n\t\t\t\t\t\timagefilter($this->image, $filter_const, $params[0], $params[1]);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\tfor($i=0; $i<$repeat; $i++)\n\t\t\t\t\t\timagefilter($this->image, $filter_const, $params[0], $params[1], $params[2]);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tfor($i=0; $i<$repeat; $i++)\n\t\t\t\t\t\timagefilter($this->image, $filter_const, $params[0], $params[1], $params[2], $params[3]);\n\t\t\t\t\tbreak;\n\t\t\t}//end switch\n\t\t}//end if\n\t\t\n\t\tif($filter_type == 'matrix')\n\t\t{\n\t\t\tfor($i=0; $i<$repeat; $i++)\n\t\t\t\timageconvolution($this->image, $matrix, $divisor, $offset);\n\t\t}\n\t\tif($filter_type == 'function')\n\t\t{\n\t\t\tfor($i=0; $i<$repeat; $i++)\n\t\t\t\t$this->image = call_user_func($filter_function, $this->image, $params[0], $params[1]);\n\t\t}\n\t\tif($filter_type == 'custom_method')\n\t\t{\n\t\t\tswitch($param_length)\n\t\t\t{\n\t\t\t\tcase 1:\n\t\t\t\t\tfor($i=0; $i<$repeat; $i++)\n\t\t\t\t\t\t$this->$filter_function($params[0]);\n\t\t\t\tcase 2:\n\t\t\t\t\tfor($i=0; $i<$repeat; $i++)\n\t\t\t\t\t\t$this->$filter_function($params[0], $params[1]);\n\t\t\t\tcase 3:\n\t\t\t\t\tfor($i=0; $i<$repeat; $i++)\n\t\t\t\t\t\t$this->$filter_function($params[0], $params[1], $params[2]);\n\t\t\t}\n\t\t\t\n\t\t}//end if\n\t}", "protected function _colorize($img, $percent) {\n $phpErrorHandler = new PhpErrorHandler();\n $res = $phpErrorHandler->call(function()use($img){\n return imagealphablending($img, false);\n });\n if(! $res) {\n $function = 'imagealphablending';\n }\n else {\n $res = $phpErrorHandler->call(function()use($img){\n return imagesavealpha($img, true);\n });\n if(! $res) {\n $function = 'imagesavealpha';\n }\n else {\n $res = $phpErrorHandler->call(function()use($img, $percent){\n // Get a percent value 0 to 100\n $abs = abs(intval($percent));\n $pct = $abs ? (($abs - 1) % 100 + 1) : $abs;\n $alpha = 127 * (1 - $pct / 100);\n return imagefilter($img, IMG_FILTER_COLORIZE, 0, 0, 0, $alpha);\n });\n if($res) {\n return true;\n }\n $function = 'imagefilter';\n }\n }\n // T_PHP_FUNCTION_FAILED = image function '%s' failed\n $msg = $phpErrorHandler->getErrorMsg(sprintf(MediaConst::T_PHP_FUNCTION_FAILED, $function), \"cannot apply image fading\");\n // a PHP image function has failed\n throw new Exception\\RuntimeException($msg, MediaConst::E_PHP_FUNCTION_FAILED);\n }", "public function show(Image $image)\n {\n //\n }", "public function show(Image $image)\n {\n //\n }", "public function show(Image $image)\n {\n //\n }", "public function show(Image $image)\n {\n //\n }", "public function show(Image $image)\n {\n //\n }", "public function show(Image $image)\n {\n //\n }", "public function show(Image $image)\n {\n //\n }", "public function show(Image $image)\n {\n //\n }", "function getReflectionClass();", "private function FadeAndClick()\n {\n $this->AddFunction('getE');\n $this->AddFunction('init');\n $this->AddFunction('finditem');\n $this->AddFunction('fading');\n $this->AddFunction('textAttr');\n $this->AddFunction('setattr');\n $this->InsertVariable('initfns', NULL, 'clickShowInit');\n $this->InsertVariable('initfns', NULL, 'fade');\n $this->variables['initfns'] = array_unique($this->variables['initfns']);\n\n $fn = <<<JAVASCRIPT\nfunction clickShowInit() {\n var c, c1, e;\n for(c in clickElements) {\n c1 = clickElements[c];\n e = getE(c);\n e.addEventListener && e.addEventListener('click', function(e) {\n var t = finditem(e,clickElements), te;\n if(t) {\n t.show = !t.show;\n if(!(fading(t.id))) {\n te = getE(t.id);\n te && setattr(te,'opacity',t.show ? 1 : 0);\n }\n }\n },false);\n }\n}\\n\nJAVASCRIPT;\n $this->InsertFunction('clickShowEvent', $fn);\n\n $fn = <<<JAVASCRIPT\nfunction fade() {\n var f,f1,e,o;\n for(f in fades) {\n f1 = fades[f];\n if(!(clickElements[f] && clickElements[f].show) && f1.dir) {\n e = getE(f1.id);\n if(e) {\n o = (textAttr(e,'opacity') || fstart) * 1 + f1.dir;\n setattr(e,'opacity', o < .01 ? 0 : (o > .99 ? 1 : o));\n }\n }\n }\n setTimeout(fade,50);\n}\\n\nJAVASCRIPT;\n $this->InsertFunction('fadeEvent', $fn);\n }", "public function render()\n {\n $this->image->blurImage($this->radius, $this->sigma, $this->channel);\n }", "function getImage();", "public function drawDimensions() {\n\t\tset_image_header();\n\n\t\t$this->selectTriggers();\n\t\t$this->calcDimentions();\n\n\t\tif (function_exists('imagecolorexactalpha') && function_exists('imagecreatetruecolor')\n\t\t\t\t&& @imagecreatetruecolor(1, 1)\n\t\t) {\n\t\t\t$this->im = imagecreatetruecolor(1, 1);\n\t\t}\n\t\telse {\n\t\t\t$this->im = imagecreate(1, 1);\n\t\t}\n\n\t\t$this->initColors();\n\n\t\timageOut($this->im);\n\t}", "public function contrast($level = 0) {\n if (isset($this->_resource) && is_float($level) && $level >= -1 && $level <= 1) {\n $level = floor($level * 100);\n imagefilter($this->_resource, IMG_FILTER_CONTRAST, $level);\n } else {\n trigger_error(\"CAMEMISResizeImage::contrast() attempting to access a non-existent resource (check if the image was loaded by CAMEMISResizeImage::__construct())\", E_USER_WARNING);\n }\n\n return $this;\n }", "protected function setTransparencyColor():void{\n\n\t\tif(!$this->options->imageTransparent){\n\t\t\treturn;\n\t\t}\n\n\t\t$transparencyColor = $this->background;\n\n\t\tif($this::moduleValueIsValid($this->options->transparencyColor)){\n\t\t\t$transparencyColor = $this->prepareModuleValue($this->options->transparencyColor);\n\t\t}\n\n\t\t$this->imagick->transparentPaintImage($transparencyColor, 0.0, 10, false);\n\t}", "public function ImagePreserverTransparent($transparent){\r\n $this->image_transparent=$transparent;\r\n }", "Public function displayInfo(){ \r\n\t\t\techo \"The info about the dress.\"; \r\n\t\t\techo $this->color; \r\n\t\t\techo $this->fabric ; \r\n\t\t\techo $this->design;\r\n\t\t\techo self::MEDIUM;\r\n\t\t}", "public function logoAction();", "public function test_flip() {\n\n\t\t$file = DIR_TESTDATA . '/images/gradient-square.jpg';\n\n\t\t$imagick_image_editor = new WP_Image_Editor_Imagick( $file );\n\t\t$imagick_image_editor->load();\n\n\t\t$property = new ReflectionProperty( $imagick_image_editor, 'image' );\n\t\t$property->setAccessible( true );\n\n\t\t$color_top_left = $property->getValue( $imagick_image_editor )->getImagePixelColor( 1, 1 )->getColor();\n\n\t\t$imagick_image_editor->flip( true, false );\n\n\t\t$this->assertEquals( $color_top_left, $property->getValue( $imagick_image_editor )->getImagePixelColor( 0, 99 )->getColor() );\n\t}", "public function setReflection($reflection){\r\n\r\n $this->request = ClosureDispatcher::bind($reflection);\r\n }", "function sharpen($amount = 20, $radius = 0.5, $threshold = 2)\n {\n $img = $this->getWorkingImageResource();\n \n if ($amount > 500)\n {\n $amount = 500; \n }\n if ($radius > 50)\n {\n $radius = 50; \n }\n if ($threshold > 255)\n {\n $threshold = 255; \n }\n\n $amount = $amount * 0.016; \n $radius = abs(round($radius * 2)); \n $w = $this->getWorkingImageWidth();\n $h = $this->getWorkingImageHeight();\n\n $imgCanvas = imagecreatetruecolor($w, $h); \n $imgBlur = imagecreatetruecolor($w, $h); \n\n if (function_exists('imageconvolution'))\n { \n $matrix = array( \n array( 1, 2, 1 ), \n array( 2, 4, 2 ), \n array( 1, 2, 1 ) \n ); \n\n imagecopy ($imgBlur, $img, 0, 0, 0, 0, $w, $h); \n imageconvolution($imgBlur, $matrix, 16, 0); \n } \n else\n { \n for ($i = 0; $i < $radius; $i++)\n { \n imagecopy ($imgBlur, $img, 0, 0, 1, 0, $w - 1, $h); // left \n imagecopymerge ($imgBlur, $img, 1, 0, 0, 0, $w, $h, 50); // right \n imagecopymerge ($imgBlur, $img, 0, 0, 0, 0, $w, $h, 50); // center \n imagecopy ($imgCanvas, $imgBlur, 0, 0, 0, 0, $w, $h); \n imagecopymerge ($imgBlur, $imgCanvas, 0, 0, 0, 1, $w, $h - 1, 33.33333 ); // up \n imagecopymerge ($imgBlur, $imgCanvas, 0, 1, 0, 0, $w, $h, 25); // down \n } \n } \n\n // Calculate the difference between the blurred pixels and the original \n // and set the pixels \n // each row\n for ($x = 0; $x < $w-1; $x++)\n { \n // each pixel \n for ($y = 0; $y < $h; $y++)\n { \n if($threshold > 0)\n { \n $rgbOrig = ImageColorAt($img, $x, $y); \n $rOrig = (($rgbOrig >> 16) & 0xFF); \n $gOrig = (($rgbOrig >> 8) & 0xFF); \n $bOrig = ($rgbOrig & 0xFF); \n\n $rgbBlur = ImageColorAt($imgBlur, $x, $y); \n\n $rBlur = (($rgbBlur >> 16) & 0xFF); \n $gBlur = (($rgbBlur >> 8) & 0xFF); \n $bBlur = ($rgbBlur & 0xFF); \n\n // When the masked pixels differ less from the original \n // than the threshold specifies, they are set to their original value. \n if(abs($rOrig - $rBlur) >= $threshold) \n {\n $rNew = max(0, min(255, ($amount * ($rOrig - $rBlur)) + $rOrig));\n }\n else\n {\n $rNew = $rOrig;\n }\n\n if(abs($gOrig - $gBlur) >= $threshold)\n {\n $gNew = max(0, min(255, ($amount * ($gOrig - $gBlur)) + $gOrig));\n }\n else\n {\n $gNew = $gOrig;\n }\n\n if(abs($bOrig - $bBlur) >= $threshold)\n {\n $bNew = max(0, min(255, ($amount * ($bOrig - $bBlur)) + $bOrig));\n }\n else\n {\n $bNew = $bOrig;\n }\n\n if (($rOrig != $rNew) || ($gOrig != $gNew) || ($bOrig != $bNew))\n { \n $pixCol = ImageColorAllocate($img, $rNew, $gNew, $bNew); \n ImageSetPixel($img, $x, $y, $pixCol); \n }\n }\n else\n {\n $rgbOrig = ImageColorAt($img, $x, $y); \n $rOrig = (($rgbOrig >> 16) & 0xFF); \n $gOrig = (($rgbOrig >> 8) & 0xFF); \n $bOrig = ($rgbOrig & 0xFF); \n $rgbBlur = ImageColorAt($imgBlur, $x, $y); \n $rBlur = (($rgbBlur >> 16) & 0xFF); \n $gBlur = (($rgbBlur >> 8) & 0xFF); \n $bBlur = ($rgbBlur & 0xFF); \n\n $rNew = ($amount * ($rOrig - $rBlur)) + $rOrig; \n if($rNew>255)\n {\n $rNew = 255;\n } \n elseif($rNew<0)\n {\n $rNew = 0;\n } \n $gNew = ($amount * ($gOrig - $gBlur)) + $gOrig; \n if($gNew>255)\n {\n $gNew=255;\n } \n elseif($gNew<0)\n {\n $gNew=0;\n } \n $bNew = ($amount * ($bOrig - $bBlur)) + $bOrig; \n if($bNew>255)\n {\n $bNew=255;\n } \n elseif($bNew<0)\n {\n $bNew=0;\n } \n $rgbNew = ($rNew << 16) + ($gNew <<8) + $bNew; \n ImageSetPixel($img, $x, $y, $rgbNew); \n }\n } \n } \n \n $this->setWorkingImageResource($img);\n imagedestroy($imgCanvas);\n imagedestroy($imgBlur);\n }", "protected function _addParamToImage($img, $name, $text)\r\n\t{\r\n\t\t$config = $this->getConfig()->getChildren(\"image\")->getChildren($name);\r\n\t\tif(!$config->getInteger(\"show\"))\r\n\t\t{\r\n\t\t\treturn $img;\r\n\t\t}\r\n\t\t$color = $this->getColor($name, $img);\r\n\t\t$shColor = $this->getShadowColor($name, $img);\r\n\t\tif($config->getInteger(\"show\") && $config->getInteger(\"shadow\"))\r\n\t\t{\r\n\t\t\timagettftext($img, $config->getInteger(\"size\"), 0, $this->getShadowCoord(\"x\", $config), $this->getShadowCoord(\"y\", $config), $shColor, $this->getFont($config), $text);\r\n\t\t}\r\n\t\timagettftext($img, $config->getInteger(\"size\"), 0, $config->getInteger(\"x\"), $config->getInteger(\"y\"), $color, $this->getFont($config), $text);\r\n\t\treturn $img;\r\n\t}", "public function showImage()\n {\n }", "function hook_image_styles_alter(&$styles) {\n // Check that we only affect a default style.\n if ($styles['thumbnail']['storage'] == IMAGE_STORAGE_DEFAULT) {\n // Add an additional effect to the thumbnail style.\n $styles['thumbnail']['effects'][] = array(\n 'name' => 'image_desaturate',\n 'data' => array(),\n 'weight' => 1,\n 'effect callback' => 'image_desaturate_effect',\n );\n }\n}", "function piechart($data, $label, $width, $img_file)\n{\n\n// true = show label, false = don't show label.\n$show_label = true;\n\n// true = show percentage, false = don't show percentage.\n$show_percent = true;\n\n// true = show text, false = don't show text.\n$show_text = true;\n\n// true = show parts, false = don't show parts.\n$show_parts = true;\n\n// 'square' or 'round' label.\n$label_form = 'round';\n\n\n\n// Colors of the slices.\n$colors = array('003366', 'CCD6E0', '7F99B2', 'F7EFC6', 'C6BE8C', 'CC6600', '990000', '520000', 'BFBFC1', '808080', '9933FF', 'CC6699', '99FFCC', 'FF6666', '3399CC', '99FF66', '3333CC', 'FF0033', '996699', 'FF00FF', 'CCCCFF', '000033', '99CC33', '996600', '996633', '996666', '3399CC', '663333');\n\n// true = use random colors, false = use colors defined above\n$random_colors = false;\n\n// Background color of the chart\n$background_color = 'F6F6F6';\n\n// Text color.\n$text_color = '000000';\n\n\n\n// true = darker shadow, false = lighter shadow...\n$shadow_dark = true;\n\n/***************************************************\n* DO NOT CHANGE ANYTHING BELOW THIS LINE!!! *\n****************************************************/\n\nif (!function_exists('imagecreate'))\n\tdie('Sorry, the script requires GD2 to work.');\n\n\n\n\n$img = ImageCreateTrueColor($width + getxtrawidth($data, $label), $height +getxtraheight($data, $label) );\n\nImageFill($img, 0, 0, colorHex($img, $background_color));\n\nforeach ($colors as $colorkode) \n{\n\t$fill_color[] = colorHex($img, $colorkode);\n\t$shadow_color[] = colorHexshadow($img, $colorkode, $shadow_dark);\n}\n\n$label_place = 5;\n\nif (is_array($label))\n{\n\tfor ($i = 0; $i < count($label); $i++) \n\t{\n\t\tif ($label_form == 'round' && $show_label)\n\t\t{\n\t\t\timagefilledellipse($img, $width + 11,$label_place + 5, 10, 10, colorHex($img, $colors[$i % count($colors)]));\n\t\t\timageellipse($img, $width + 11, $label_place + 5, 10, 10, colorHex($img, $text_color));\n\t\t}\n\t\telse if ($label_form == 'square' && $show_label)\n\t\t{\n\t\t\timagefilledrectangle($img, $width + 6, $label_place, $width + 16, $label_place + 10,colorHex($img, $colors[$i % count($colors)]));\n\t\t\timagerectangle($img, $width + 6, $label_place, $width + 16, $label_place + 10, colorHex($img, $text_color));\n\t\t}\n\n\t\tif ($show_percent)\n\t\t\t$label_output = $number[$i] . ' ';\n\t\tif ($show_text)\n\t\t\t$label_output = $label_output.$label[$i] . ' ';\n\t\tif ($show_parts)\n\t\t\t$label_output = $label_output . '- ' . $data[$i];\n\n\t\timagestring($img, '2', $width + 20, $label_place, $label_output, colorHex($img, $text_color));\n\t\t$label_output = '';\n\n\t\t$label_place = $label_place + 15;\n\t}\n}\n\n$centerX = round($width / 2);\n$centerY = round($height / 2);\n$diameterX = $width - 4;\n$diameterY = $height - 4;\n\n$data_sum = array_sum($data);\n\n$start = 270;\n\n$value_counter = 0;\n$value = 0;\n\nfor ($i = 0; $i < count($data); $i++) \n{\n\t$value += $data[$i];\n\t$end = ceil(($value/$data_sum) * 360) + 270;\n\t$slice[] = array($start, $end, $shadow_color[$value_counter % count($shadow_color)], $fill_color[$value_counter % count($fill_color)]);\n\t$start = $end;\n\t$value_counter++;\n}\n\nfor ($i = ($centerY + $shadow_height); $i > $centerY; $i--) \n{\n\tfor ($j = 0; $j < count($slice); $j++)\n\t{\n\t\tif ($slice[$j][0] == $slice[$j][1])\n\t\t\tcontinue;\n\t\tImageFilledArc($img, $centerX, $i, $diameterX, $diameterY, $slice[$j][0], $slice[$j][1], $slice[$j][2], IMG_ARC_PIE);\n\t}\n}\n\nfor ($j = 0; $j < count($slice); $j++)\n{\n\tif ($slice[$j][0] == $slice[$j][1])\n\t\tcontinue;\n\tImageFilledArc($img, $centerX, $centerY, $diameterX, $diameterY, $slice[$j][0], $slice[$j][1], $slice[$j][3], IMG_ARC_PIE);\n}\nheader('Content-type: image/jpg');\nImageJPEG($img, NULL, 100);\nImageDestroy($img);\n}", "function clrfl_get_stripe_opacity() {\n\t/* The darkness of the stripes is based on\n\t * lightness of the background color.\n\t */\n\t$bg_color = get_background_color();\n\n\t//find lightest hue\n\t$stripe_lightness = 0;\n\t$max_color_component = 0;\n\t//bias towards green, which is a higher energy color\n\t$biases = array(0.8, 1.0, 0.8);\n\tforeach (str_split($bg_color, 2) as $hex) {\n\t\t$bias = array_pop($biases);\n\t\t$hex = hexdec($hex);\n\t\t$lightness = $hex * $bias;\n\t\tif ($max_color_component < $lightness) {\n\t\t\t$max_color_component = $lightness;\n\t\t}\n\t}\n\t$stripe_lightness = $max_color_component;\n\n\t//how close to white are we?\n\t//aka, how black are we?\n\t//full black would be 1.0\n\t//a full hue is 0.0\n\t$factor = (255.0 - $stripe_lightness) / 255.0;\n\n\t//notice how things are looking like a polynomial\n\t$pure_bias = 0.65;\n\n\t//the magic formula, our wizardry is done\n\treturn ($factor) * $pure_bias;\n\n\t/*\n\t * If you ever need a reason why\n\t * high school math is useful...\n\t */\n}", "public function showImageFromGet() {\n\n\t\t// $imageFilename = UniteFunctionsRev::getGetVar(\"img\");\n\t\t$imageID = intval( UniteFunctionsRev::getGetVar( 'img' ) );\n\t\t$maxWidth = UniteFunctionsRev::getGetVar( 'w',-1 );\n\t\t$maxHeight = UniteFunctionsRev::getGetVar( 'h',-1 );\n\t\t$type = UniteFunctionsRev::getGetVar( 't','' );\n\n\t\t// set effect\n\t\t$effect = UniteFunctionsRev::getGetVar( 'e' );\n\t\t$effectArgument1 = UniteFunctionsRev::getGetVar( 'ea1' );\n\n\t\tif ( ! empty( $effect ) ) {\n\t\t\t$this->setEffect( $effect,$effectArgument1 ); }\n\n\t\t$this->showImageByID( $imageID );\n\t\techo 'sechs<br>';\n\t\t// $this->showImage($imageFilename,$maxWidth,$maxHeight,$type);\n\t}", "protected function setTransparencyColor():void{\n\n\t\tif($this->options->outputType === QROutputInterface::GDIMAGE_JPG || !$this->options->imageTransparent){\n\t\t\treturn;\n\t\t}\n\n\t\t$transparencyColor = $this->background;\n\n\t\tif($this::moduleValueIsValid($this->options->transparencyColor)){\n\t\t\t$transparencyColor = $this->prepareModuleValue($this->options->transparencyColor);\n\t\t}\n\n\t\timagecolortransparent($this->image, $transparencyColor);\n\t}", "function __construct()\n {\n $this\n ->setOpacity(1.0)\n ->setUpdatedAt(new \\DateTime('now'))\n ->setActive(false)\n ;\n }", "public static function frame($image, $margin = 20, $color = '666', $alpha = 100)\n {\n $img = self::ensureImageInterfaceInstance($image);\n\n $size = $img->getSize();\n\n $pasteTo = new Point($margin, $margin);\n\n $palette = new RGB();\n $color = $palette->color($color, $alpha);\n\n $box = new Box($size->getWidth() + ceil($margin * 2), $size->getHeight() + ceil($margin * 2));\n\n $finalImage = static::getImagine()->create($box, $color);\n\n $finalImage->paste($img, $pasteTo);\n\n return $finalImage;\n }" ]
[ "0.68388355", "0.58590525", "0.55752647", "0.5130943", "0.49125236", "0.48945642", "0.47592044", "0.47167438", "0.46296737", "0.45433605", "0.4489357", "0.44642133", "0.44349244", "0.44130448", "0.44097447", "0.4372867", "0.43535054", "0.43534693", "0.43534693", "0.43534693", "0.43534693", "0.4342826", "0.432542", "0.43084517", "0.4305909", "0.42942113", "0.42698604", "0.42583734", "0.4235437", "0.4163753", "0.4124002", "0.40791777", "0.40752575", "0.40643266", "0.4063351", "0.40538096", "0.40456414", "0.4042635", "0.40361634", "0.40361634", "0.40358827", "0.4027856", "0.40244016", "0.40227568", "0.39885396", "0.39806575", "0.39618304", "0.395669", "0.3943956", "0.3943761", "0.39368337", "0.39340663", "0.3924926", "0.3912588", "0.39121878", "0.391216", "0.3908899", "0.39030322", "0.38978693", "0.38972685", "0.38951632", "0.38945875", "0.3891899", "0.3888372", "0.38838065", "0.38794383", "0.38763404", "0.38733175", "0.38731742", "0.38675034", "0.38508025", "0.38508025", "0.38508025", "0.38508025", "0.38508025", "0.38508025", "0.38508025", "0.38508025", "0.38429058", "0.3841298", "0.38340065", "0.3821718", "0.38154292", "0.38072437", "0.3793514", "0.3788463", "0.37842587", "0.37751037", "0.37703273", "0.3767721", "0.37637416", "0.37606037", "0.3755464", "0.3754681", "0.37538", "0.37394217", "0.37392926", "0.37188515", "0.37143114", "0.37105602" ]
0.56454366
2
Add a watermark to an image with a specified opacity. Alpha transparency will be preserved. If no offset is specified, the center of the axis will be used. If an offset of TRUE is specified, the bottom of the axis will be used. // Add a watermark to the bottom right of the image $mark = Image::factory('upload/watermark.png'); $image>watermark($mark, TRUE, TRUE);
public function watermark(Image $watermark, $offset_x = NULL, $offset_y = NULL, $opacity = 100) { if ($offset_x === NULL) { // Center the X offset $offset_x = round(($this->width - $watermark->width) / 2); } elseif ($offset_x === TRUE) { // Bottom the X offset $offset_x = $this->width - $watermark->width; } elseif ($offset_x < 0) { // Set the X offset from the right $offset_x = $this->width - $watermark->width + $offset_x; } if ($offset_y === NULL) { // Center the Y offset $offset_y = round(($this->height - $watermark->height) / 2); } elseif ($offset_y === TRUE) { // Bottom the Y offset $offset_y = $this->height - $watermark->height; } elseif ($offset_y < 0) { // Set the Y offset from the bottom $offset_y = $this->height - $watermark->height + $offset_y; } // The opacity must be in the range of 1 to 100 $opacity = min(max($opacity, 1), 100); $this->_do_watermark($watermark, $offset_x, $offset_y, $opacity); return $this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function watermark($watermark, $offset_x=null, $offset_y=null, $opacity=null);", "public function add_watermark_to_( $image ) {\n\n\t\t// TODO Select graphics library from plugin settings (this is GD, add Imagick)\n\n\t\t$watermark_file = get_attached_file( $this->settings['watermark']['image'] );\n\n\t\t$watermark = imagecreatefrompng( $watermark_file );\n\t\t$new_image = imagecreatefromjpeg( $image );\n\n\t\t$margin = ( $this->settings['watermark']['position'] ) ? $this->settings['watermark']['position'] : 50;\n\n\t\t$watermark_width = imagesx( $watermark );\n\t\t$watermark_height = imagesy( $watermark );\n\t\t$new_image_width = imagesx( $new_image );\n\t\t$new_image_height = imagesy( $new_image );\n\n\t\tif ( $this->settings['watermark']['position'] == 'topleft' ) {\n\t\t\t$x_pos = $margin;\n\t\t\t$y_pos = $margin;\n\t\t} elseif ( $this->settings['watermark']['position'] == 'topright' ) {\n\t\t\t$x_pos = $new_image_width - $watermark_width - $margin;\n\t\t\t$y_pos = $margin;\n\t\t} elseif ( $this->settings['watermark']['position'] == 'bottomleft' ) {\n\t\t\t$x_pos = $margin;\n\t\t\t$y_pos = $new_image_height - $watermark_height - $margin;\n\t\t} elseif ( $this->settings['watermark']['position'] == 'bottomright' ) {\n\t\t\t$x_pos = $new_image_width - $watermark_width - $margin;\n\t\t\t$y_pos = $new_image_height - $watermark_height - $margin;\n\t\t} else {\n\t\t\t$x_pos = ( $new_image_width / 2 ) - ( $watermark_width / 2 );\n\t\t\t$y_pos = ( $new_image_height / 2 ) - ( $watermark_height / 2 );\n\t\t}\n\n\t\tif ( $this->settings['watermark']['position'] == 'repeat' ) {\n\t\t\timagesettile( $new_image, $watermark );\n\t\t\timagefilledrectangle( $new_image, 0, 0, $new_image_width, $new_image_height, IMG_COLOR_TILED );\n\t\t} else {\n\t\t\timagecopy( $new_image, $watermark, $x_pos, $y_pos, 0, 0, $watermark_width, $watermark_height );\t\t\t\t\n\t\t}\n\n\t\t$success = imagejpeg( $new_image, $image, 100 );\n\t\timagedestroy( $new_image );\n\t}", "public function put_watermark( $watermark, $opacity = 0.5, $position = 'center', $offsetX = 0, $offsetY = 0, $file_index = null ) {\r\n\t\t\tif ( !is_file( $watermark ) ) {\r\n\t\t\t\tthrow new Exception( 'Watermark file does not exist (' . htmlspecialchars( $watermark ) . ')' );\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t$watermark_image = imagecreatefromstring( file_get_contents( $watermark ) );\r\n\t\t\tif ( !$watermark_image ) {\r\n\t\t\t\tthrow new Exception( 'GD extension cannot create an image from the Watermark image' );\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t$watermark_width = imagesx( $watermark_image );\r\n\t\t\t$watermark_height = imagesy( $watermark_image );\r\n\t\t\t\r\n\t\t\t// keep the opacity value in range\r\n\t\t\t$opacity = (int) ((( $opacity < 0 ) ? 0 : (( $opacity > 1 ) ? 1 : $opacity )) * 100);\r\n\t\t\tif ( $opacity < 100 ) {\r\n\t\t\t\t// workaround for transparent images because PHP's imagecopymerge does not support alpha channel\r\n\t\t\t\timagealphablending( $watermark_image, false );\r\n\t\t\t\timagefilter( $watermark_image, IMG_FILTER_COLORIZE, 0, 0, 0, 127 * ((100 - $opacity) / 100) );\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tfor( $i = 0; $i < $this->Files_ready_count; $i++ ) {\r\n\t\t\t\tif ( $file_index !== null && $file_index != $i ) {\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\tif ( in_array( $this->Files_ready[$i]['ext'], self::FTY_IMAGES_GD ) ) {\r\n\t\t\t\t\t$target_image = $this->create_image( $i );\r\n\t\t\t\t\t$target_width = imagesx( $target_image );\r\n\t\t\t\t\t$target_height = imagesy( $target_image );\r\n\r\n\t\t\t\t\tswitch( $position ) {\r\n\t\t\t\t\t\tcase 'top': {\r\n\t\t\t\t\t\t\t$x = ($target_width / 2) - ($watermark_width / 2) + $offsetX;\r\n\t\t\t\t\t\t\t$y = $offsetY;\r\n\t\t\t\t\t\t} break;\r\n\t\t\t\t\t\tcase 'left': {\r\n\t\t\t\t\t\t\t$x = $offsetX;\r\n\t\t\t\t\t\t\t$y = ($target_height / 2) - ($watermark_height / 2) + $offsetY;\r\n\t\t\t\t\t\t} break;\r\n\t\t\t\t\t\tcase 'right': {\r\n\t\t\t\t\t\t\t$x = $target_width - $watermark_width + $offsetX;\r\n\t\t\t\t\t\t\t$y = ($target_height / 2) - ($watermark_height / 2) + $offsetY;\r\n\t\t\t\t\t\t} break;\r\n\t\t\t\t\t\tcase 'bottom': {\r\n\t\t\t\t\t\t\t$x = ($target_width / 2) - ($watermark_width / 2) + $offsetX;\r\n\t\t\t\t\t\t\t$y = $target_height - $watermark_height + $offsetY;\r\n\t\t\t\t\t\t} break;\r\n\t\t\t\t\t\tcase 'top left': {\r\n\t\t\t\t\t\t\t$x = $offsetX;\r\n\t\t\t\t\t\t\t$y = $offsetY;\r\n\t\t\t\t\t\t} break;\r\n\t\t\t\t\t\tcase 'top right': {\r\n\t\t\t\t\t\t\t$x = $target_width - $watermark_width + $offsetX;\r\n\t\t\t\t\t\t\t$y = $offsetY;\r\n\t\t\t\t\t\t} break;\r\n\t\t\t\t\t\tcase 'bottom left': {\r\n\t\t\t\t\t\t\t$x = $offsetX;\r\n\t\t\t\t\t\t\t$y = $target_height - $watermark_height + $offsetY;\r\n\t\t\t\t\t\t} break;\r\n\t\t\t\t\t\tcase 'bottom right': {\r\n\t\t\t\t\t\t\t$x = $target_width - $watermark_width + $offsetX;\r\n\t\t\t\t\t\t\t$y = $target_height - $watermark_height + $offsetY;\r\n\t\t\t\t\t\t} break;\r\n\t\t\t\t\t\tdefault: {\t// center\r\n\t\t\t\t\t\t\t$x = ($target_width / 2) - ($watermark_width / 2) + $offsetX;\r\n\t\t\t\t\t\t\t$y = ($target_height / 2) - ($watermark_height / 2) + $offsetY;\r\n\t\t\t\t\t\t} break;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t// put the watermark on the target image\r\n\t\t\t\t\timagecopy( $target_image, $watermark_image, $x, $y, 0, 0, $watermark_width, $watermark_height );\r\n\r\n\t\t\t\t\t$this->save_image( $target_image, $i );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// destroy the image ressource to free the ram\r\n\t\t\timagedestroy( $watermark_image );\r\n\t\t}", "function escort_watermark_image( $filename, $upload_dir, $watermark_image ) {\n\n $original_image_path = trailingslashit( $upload_dir['basedir'] ) . $filename;\n \n $image_resource = new Imagick( $original_image_path );\n \n //$image_resource->blurImage( 20, 10 );\n\n $watermark_resource = new Imagick($watermark_image);\n\n // tamaños\n $iWidth = $image_resource->getImageWidth();\n $iHeight = $image_resource->getImageHeight();\n\n $wWidth = $watermark_resource->getImageWidth();\n $wHeight = $watermark_resource->getImageHeight();\n\n if ($iHeight < $wHeight || $iWidth < $wWidth) {\n // resize the watermark\n $watermark_resource->scaleImage($iWidth, $iHeight);\n \n // get new size\n $wWidth = $watermark_resource->getImageWidth();\n $wHeight = $watermark_resource->getImageHeight();\n }\n\n\n // calculate the position\n $x = ($iWidth - $wWidth) / 2;\n $y = ($iHeight - $wHeight) / 2;\n\n $image_resource->compositeImage( $watermark_resource, Imagick::COMPOSITE_OVER, $x, $y );\n \n return save_watermarked_image( $image_resource, $original_image_path, $upload_dir );\n \n}", "public function watermarkAction()\n {\n $watermarkPath = __DIR__ . '/../../../data/media/watermark.png';\n $image = __DIR__ . '/../../../data/media/test.jpg';\n\n $watermarkThumb = $this->thumbnailer->create($watermarkPath);\n $watermarkThumb->resize(100, 100);\n\n $watermark = $this->thumbnailer->createWatermark($watermarkThumb, [-1, -1], .3);\n $thumb = $this->thumbnailer->create($image, [], [$watermark]);\n\n $thumb\n ->resize(200, 200)\n ->show()\n ->save('public/watermark_test.jpg');\n\n return false;\n }", "private function applyWatermark(ImageInterface $image, ImageInterface $watermark)\n {\n $size = $image->getSize();\n $wSize = $watermark->getSize();\n\n $bottomRight = new Point($size->getWidth() - $wSize->getWidth(), $size->getHeight() - $wSize->getHeight());\n\n $image->paste($watermark, $bottomRight);\n\n return $image;\n }", "function create_watermark($image_path, $data)\n\t{\n\t\tee()->image_lib->clear();\n\n\t\t$config = $this->set_image_config($data, 'watermark');\n\t\t$config['source_image'] = $image_path;\n\n\t\tee()->image_lib->initialize($config);\n\n\t\t// watermark it!\n\n\t\tif ( ! ee()->image_lib->watermark())\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tee()->image_lib->clear();\n\n\t\treturn TRUE;\n\t}", "public function watermark()\n {\n $bMargin = $this->getBreakMargin();\n\n // Get current auto-page-break mode\n $auto_page_break = $this->AutoPageBreak;\n\n // Disable auto-page-break\n $this->SetAutoPageBreak(true, 1);\n\n // Define the path to the image that you want to use as watermark.\n\n $fontName = \"Helvetica\";\n $fontSize = 135;\n $fontStyle = \"B\";\n\n // Calcular ancho de la cadena\n $widthCadena = $this->GetStringWidth(trim(\"MY TEXT\"), $fontName, $fontStyle);\n $factorCentrado = round(($widthCadena * sin(deg2rad(45))) / 2, 0);\n\n // Get the page width/height\n $myPageWidth = $this->getPageWidth();\n $myPageHeight = $this->getPageHeight();\n\n // Find the middle of the page and adjust.\n $myX = ($myPageWidth / 2) - $factorCentrado - 10;\n $myY = ($myPageHeight / 2) - $factorCentrado + 5;\n\n // Set the transparency of the text to really light\n $this->SetAlpha(0.09);\n\n // Rotate 45 degrees and write the watermarking text\n $this->StartTransform();\n $this->Rotate(45, $myX, $myY);\n $this->SetFont($fontName, $fontStyle, $fontSize);\n $this->Text($myX, $myY, trim($this->watermark_text));\n $this->StopTransform();\n\n // Reset the transparency to default\n $this->SetAlpha(1);\n // Restore the auto-page-break status\n // $this->SetAutoPageBreak($auto_page_break, $bMargin);\n\n // Set the starting point for the page content\n $this->setPageMark();\n }", "function gallery_watermark($path){\n $image = new Imagick();\n $image->readImage(getcwd(). $path);\n\n // Open the watermark image\n // Important: the image should be obviously transparent with .png format\n $watermark = new Imagick();\n $watermark->readImage(getcwd(). \"/asset/images/watermark.png\");\n\n // Retrieve size of the Images to verify how to print the watermark on the image\n $img_Width = $image->getImageWidth();\n $img_Height = $image->getImageHeight();\n $watermark_Width = $watermark->getImageWidth();\n $watermark_Height = $watermark->getImageHeight();\n\n // // Check if the dimensions of the image are less than the dimensions of the watermark\n // // In case it is, then proceed to \n // if ($img_Height < $watermark_Height || $img_Width < $watermark_Width) {\n // // Resize the watermark to be of the same size of the image\n // $watermark->scaleImage($img_Width, $img_Height);\n\n // // Update size of the watermark\n // $watermark_Width = $watermark->getImageWidth();\n // $watermark_Height = $watermark->getImageHeight();\n // }\n\n // Calculate the position\n $x = ($img_Width - $watermark_Width) / 2;\n $y = ($img_Height - $watermark_Height) / 2;\n\n // Draw the watermark on your image\n $image->compositeImage($watermark, Imagick::COMPOSITE_OVER, $x, $y);\n\n\n // From now on depends on you what you want to do with the image\n // for example save it in some directory etc.\n // In this example we'll Send the img data to the browser as response\n // with Plain PHP\n // $image->writeImage(\"/test_watermark/<kambing class=\"\"></kambing>\" . $image->getImageFormat()); \n // header(\"Content-Type: image/\" . $image->getImageFormat());\n // echo $image;\n\n // Or if you prefer to save the image on some directory\n // Take care of the extension and the path !\n $image->writeImage(getcwd(). $path); \n }", "function watermark($anchor,$markImgFile,$padding=5,$alpha=50,&$autosave=null) \n { \n if(empty($anchor) || empty($markImgFile) || !file_exists($markImgFile)) \n { \n return $this; \n } \n \n $anchor=strtolower(trim($anchor)); \n if(!in_array($anchor,array('lt','rt','lb','rb','center'))) \n { \n $anchor='rb'; \n } \n \n if($padding<0) \n { \n $padding=0; \n } \n if($padding>10) \n { \n $padding=10; \n } \n \n $_tmpImage=null; \n \n //mark image info \n list($_mw,$_mh,$_mt)=getimagesize($markImgFile); \n switch($_mt) \n { \n case IMAGETYPE_GIF: \n $_tmpImage = imagecreatefromgif($markImgFile); \n break; \n case IMAGETYPE_JPEG: \n $_tmpImage = imagecreatefromjpeg($markImgFile); \n break; \n case IMAGETYPE_PNG: \n $_tmpImage = imagecreatefrompng($markImgFile); \n break; \n default: \n $_tmpImage = null; \n break; \n } \n \n if(!is_resource($_tmpImage)) \n { \n return $this; \n } \n \n $pos=array(); \n switch($anchor) \n { \n case 'lt': \n $pos[0]=$padding; \n $pos[1]=$padding; \n break; \n case 'rt': \n $pos[0]=$this->_width-$_mw-$padding; \n $pos[1]=$padding; \n break; \n case 'lb': \n $pos[0]=$padding; \n $pos[1]=$this->_height-$_mh-$padding; \n break; \n case 'rb': \n $pos[0]=$this->_width-$_mw-$padding; \n $pos[1]=$this->_height-$_mh-$padding; \n break; \n case 'center': \n $pos[0]=($this->_width-$_mw-$padding)*0.5; \n $pos[1]=($this->_height-$_mh-$padding)*0.5; \n break; \n } \n \n imagecopymerge($this->_image,$_tmpImage,$pos[0],$pos[1],0,0,$_mw,$_mh,50); \n imagedestroy($_tmpImage); \n \n if(isset($autosave)) \n { \n $_file=sprintf('%s%s_%s.%s', \n $this->_imagePathInfo['dirname'].DS, \n $this->_imagePathInfo['filename'], \n 'wm', \n $this->_imagePathInfo['extension'] \n ); \n \n if($this->saveAs($_file,$this->default_qulity,$this->default_smooth,$this->auto_dispose)) \n { \n $autosave=$_file; \n } \n } \n \n return $this; \n \n }", "public function watermark($overlay, $position = 'center', $opacity = 1, $xOffset = 0, $yOffset = 0) {\r\n $this->watermark = array(\"overlay\" => $overlay, \"position\" => $position, \"opacity\" => $opacity, \"xOffset\" => $xOffset, \"yOffset\" => $yOffset);\r\n return $this;\r\n }", "public static function watermark(){\n\n}", "private static function addWatermark($image, $watermark, $padding = 0)\n {\n // Check if the watermark is bigger than the image\n $image_width = $image->getImageWidth();\n $image_height = $image->getImageHeight();\n $watermark_width = $watermark->getImageWidth();\n $watermark_height = $watermark->getImageHeight();\n\n if ($image_width < $watermark_width + $padding || $image_height < $watermark_height + $padding)\n {\n return false;\n }\n\n // Calculate each position\n $positions = array();\n $positions[] = array($image_width - $watermark_width - $padding, $image_height - $watermark_height - $padding);\n $positions[] = array(0 + $padding, $image_height - $watermark_height - $padding);\n\n // Initialization\n $min = null;\n $min_colors = 0;\n\n // Calculate the number of colors inside each region and retrieve the minimum\n foreach($positions as $position)\n {\n $colors = $image->getImageRegion($watermark_width, $watermark_height, $position[0], $position[1])->getImageColors();\n\n if ($min === null || $colors <= $min_colors)\n {\n $min = $position;\n $min_colors = $colors;\n }\n }\n\n // Draw the watermark\n $image->compositeImage($watermark, Imagick::COMPOSITE_OVER, $min[0], $min[1]);\n\n return true;\n }", "function print_water_marked_image($path){\n $image = new Imagick();\n $image->readImage(_LOCAL_.$path);\n\n $height = $image->getImageHeight();\n $width = $image->getImageWidth();\n\n $watermark = new Imagick();\n $watermark->readImage($_SERVER[DOCUMENT_ROOT].__WATER_MARK_PATH__);\n $watermark = $watermark->flattenImages();\n $watermark->setImageOpacity(0.3);\n $watermark->setImageOrientation(Imagick::COLOR_ALPHA);\n\n $water_height = $watermark->getImageHeight();\n $water_width = $watermark->getImageWidth();\n\n $canvas = new Imagick();\n $canvas->newImage($width,$height,new ImagickPixel('white'));\n $canvas->setImageFormat('png');\n $canvas->compositeImage($image,imagick::COMPOSITE_OVER, 0, 0);\n\n $cal_margin_width = ($water_width-($width%$water_width))/2;\n $cal_margin_height = ($water_height-($height%$water_height))/2;\n $count_x = ($width-$width%$water_width)/$water_width;\n $count_y = ($height-$height%$water_height)/$water_height;\n for($i=0; $i<=$count_x;$i++){\n for ($j=0; $j <=$count_y; $j++) {\n $j+=2;\n if(!($i%2)){\n $canvas->compositeImage($watermark,imagick::COMPOSITE_OVER, $i*$water_width-$cal_margin_width, $j*$water_height-$cal_margin_height);\n }\n }\n }\n\n header('Content-type: image/png');\n echo $canvas;\n $image->destroy();\n $watermark->destroy();\n $canvas->destroy();\n}", "function create_watermark($source_file_path, $output_file_path)\r\n\t{\r\n\t\t$photo \t\t= imagecreatefromjpeg($source_file_path);\r\n\t\t$watermark \t= imagecreatefrompng($this->watermark_file);\r\n\t\t\r\n\t\t/* untuk mengatasi image dengan type png-24*/\r\n\t\timagealphablending($photo, true);\r\n\t\t\r\n\t\t$photo_x \t\t= imagesx($photo);\r\n\t\t$watermark_x \t= imagesx($watermark);\r\n\t\t$photo_y\t\t= imagesy($photo); \r\n\t\t$watermark_y\t= imagesy($watermark);\r\n\t\t\r\n\t\timagecopy($photo, $watermark, (($photo_x/2) - ($watermark_x/2)), (($photo_y/2) - ($watermark_y/2)), 0, 0, $watermark_x, $watermark_y);\r\n\t\timagejpeg($photo, $output_file_path, 100);\r\n\t}", "public function watermark(string $file, int $position = Image::WATERMARK_TOP_LEFT, int $opacity = 100): Image\n\t{\n\t\t// Check if the image exists\n\n\t\tif(file_exists($file) === false)\n\t\t{\n\t\t\tthrow new PixlException(vsprintf('The watermark image [ %s ] does not exist.', [$file]));\n\t\t}\n\n\t\t// Make sure that opacity is between 0 and 100\n\n\t\t$opacity = max(min((int) $opacity, 100), 0);\n\n\t\t// Add watermark to the image\n\n\t\t$this->processor->watermark($file, $position, $opacity);\n\n\t\treturn $this;\n\t}", "function watermarkText21Image ($SourceFile,$WaterMarkText) {\n header(\"Content-type: image/jpg\");\n //Using imagecopymerge() to create a translucent watermark\n \n // Load the image on which watermark is to be applied\n $original_image = imagecreatefromjpeg($SourceFile);\n // Get original parameters\n list($original_width, $original_height, $original_type, $original_attr) = getimagesize($original_image); \n \n // create watermark with orig size\n $watermark = imagecreatetruecolor(200, 60);\n \n $original_image = imagecreatefromjpeg($SourceFile);\n \n // Define text\n $font = $_SERVER['DOCUMENT_ROOT'].'/include/captcha/fonts/moloto.otf';\n $white = imagecolorallocate($watermark, 255, 255, 255);\n // Add some shadow to the text\n imagettftext($watermark, 18, 0, 30, 35, $white, $font, $WaterMarkText);\n \n // Set the margins for the watermark and get the height/width of the watermark image\n $marge_right = 10;\n $marge_bottom = 10;\n $sx = imagesx($watermark);\n $sy = imagesy($watermark);\n \n // Merge the watermark onto our photo with an opacity (transparency) of 50%\n imagecopymerge($original_image, \n $watermark,\n imagesx($original_image)/2 - $sx/2 , \n imagesy($original_image) /2 - $sy/2,\n 0, \n 0, \n imagesx($watermark), \n imagesy($watermark),\n 20\n );\n \n // Save the image to file and free memory\n imagejpeg($original_image, null, 100); //$SourceFile\n imagedestroy($original_image);\n}", "function _watermarkImageGD($file, $desfile, $wm_file, $position, $imgobj) {\r\n global $zoom;\r\n if ($imgobj->_size == null) {\r\n return false;\r\n }\r\n if ($imgobj->_type !== \"jpg\" && $imgobj->_type !== \"jpeg\" && $imgobj->_type !== \"png\" && $imgobj->_type !== \"gif\") {\r\n return false;\r\n }\r\n if ($imgobj->_type == \"gif\" && !function_exists(\"imagecreatefromgif\")) {\r\n \treturn false;\r\n }\r\n \r\n if ($imgobj->_type == \"jpg\" || $imgobj->_type == \"jpeg\") {\r\n $image = @imagecreatefromjpeg($file);\r\n } else if ($imgobj->_type == \"png\") {\r\n $image = @imagecreatefrompng($file);\r\n } else {\r\n \t$image = @imagecreatefromgif($file);\r\n }\r\n if (!$image) { return false; }\r\n \r\n $imginfo_wm = getimagesize($wm_file);\r\n $imgtype_wm = ereg_replace(\".*\\.([^\\.]*)$\", \"\\\\1\", $wm_file);\r\n if ($imgtype_wm == \"jpg\" || $imgtype_wm == \"jpeg\") {\r\n $watermark = @imagecreatefromjpeg($wm_file);\r\n } else {\r\n $watermark = @imagecreatefrompng($wm_file);\r\n }\r\n if (!$watermark) { return false; }\r\n \r\n $imagewidth = imagesx($image);\r\n $imageheight = imagesy($image);\r\n $watermarkwidth = $imginfo_wm[0];\r\n $watermarkheight = $imginfo_wm[1];\t\t\r\n $width_left = $imagewidth - $watermarkwidth;\r\n $height_left = $imageheight - $watermarkheight;\r\n switch ($position) {\r\n case \"TL\": // Top Left\r\n $startwidth = $width_left >= 5 ? 4 : $width_left;\r\n $startheight = $height_left >= 5 ? 5 : $height_left;\r\n break;\r\n case \"TM\": // Top middle \r\n $startwidth = intval(($imagewidth - $watermarkwidth) / 2);\r\n $startheight = $height_left >= 5 ? 5 : $height_left;\r\n break;\r\n case \"TR\": // Top right\r\n $startwidth = $imagewidth - $watermarkwidth-4;\r\n $startheight = $height_left >= 5 ? 5 : $height_left;\r\n break;\r\n case \"CL\": // Center left\r\n $startwidth = $width_left >= 5 ? 4 : $width_left;\r\n $startheight = intval(($imageheight - $watermarkheight) / 2);\r\n break;\r\n default:\r\n case \"C\": // Center (the default)\r\n $startwidth = intval(($imagewidth - $watermarkwidth) / 2);\r\n $startheight = intval(($imageheight - $watermarkheight) / 2);\r\n break;\r\n case \"CR\": // Center right\r\n $startwidth = $imagewidth - $watermarkwidth-4;\r\n $startheight = intval(($imageheight - $watermarkheight) / 2);\r\n break;\r\n case \"BL\": // Bottom left\r\n $startwidth = $width_left >= 5 ? 5 : $width_left;\r\n $startheight = $imageheight - $watermarkheight-5;\r\n break;\r\n case \"BM\": // Bottom middle\r\n $startwidth = intval(($imagewidth - $watermarkwidth) / 2);\r\n $startheight = $imageheight - $watermarkheight-5;\r\n break;\r\n case \"BR\": // Bottom right\r\n $startwidth = $imagewidth - $watermarkwidth-4;\r\n $startheight = $imageheight - $watermarkheight-5;\r\n break;\r\n }\r\n imagecopy($image, $watermark, $startwidth, $startheight, 0, 0, $watermarkwidth, $watermarkheight);\r\n @$zoom->platform->unlink($desfile);\r\n if ($imgobj->_type == \"jpg\" || $imgobj->_type == \"jpeg\") {\r\n imagejpeg($image, $desfile, $this->_JPEG_quality);\r\n } else if ($imgobj->_type == \"png\") {\r\n imagepng($image, $desfile);\r\n } else {\r\n \timagegif($image, $desfile);\r\n }\r\n imagedestroy($image);\r\n imagedestroy($watermark);\r\n return true;\r\n }", "function _watermarkImageIM($file, $desfile, $wm_file, $position, $imgobj) {\r\n $imginfo_wm = getimagesize($wm_file);\r\n\r\n $imagewidth = $imgobj->_size[0];\r\n $imageheight = $imgobj->_size[1];\r\n $watermarkwidth = $imginfo_wm[0];\r\n $watermarkheight = $imginfo_wm[1];\t\t\r\n $width_left = $imagewidth - $watermarkwidth;\r\n $height_left = $imageheight - $watermarkheight;\r\n switch ($position) {\r\n case \"TL\": // Top Left\r\n $startwidth = $width_left >= 5 ? 4 : $width_left;\r\n $startheight = $height_left >= 5 ? 5 : $height_left;\r\n break;\r\n case \"TM\": // Top middle \r\n $startwidth = intval(($imagewidth - $watermarkwidth) / 2);\r\n $startheight = $height_left >= 5 ? 5 : $height_left;\r\n break;\r\n case \"TR\": // Top right\r\n $startwidth = $imagewidth - $watermarkwidth-4;\r\n $startheight = $height_left >= 5 ? 5 : $height_left;\r\n break;\r\n case \"CL\": // Center left\r\n $startwidth = $width_left >= 5 ? 4 : $width_left;\r\n $startheight = intval(($imageheight - $watermarkheight) / 2);\r\n break;\r\n default:\r\n case \"C\": // Center (the default)\r\n $startwidth = intval(($imagewidth - $watermarkwidth) / 2);\r\n $startheight = intval(($imageheight - $watermarkheight) / 2);\r\n break;\r\n case \"CR\": // Center right\r\n $startwidth = $imagewidth - $watermarkwidth-4;\r\n $startheight = intval(($imageheight - $watermarkheight) / 2);\r\n break;\r\n case \"BL\": // Bottom left\r\n $startwidth = $width_left >= 5 ? 5 : $width_left;\r\n $startheight = $imageheight - $watermarkheight-5;\r\n break;\r\n case \"BM\": // Bottom middle\r\n $startwidth = intval(($imagewidth - $watermarkwidth) / 2);\r\n $startheight = $imageheight - $watermarkheight-5;\r\n break;\r\n case \"BR\": // Bottom right\r\n $startwidth = $imagewidth - $watermarkwidth-4;\r\n $startheight = $imageheight - $watermarkheight-5;\r\n break;\r\n }\r\n\r\n\t\t$cmd = $this->_IM_path.\"convert -draw \\\"image over $startwidth,$startheight 0,0 '$wm_file'\\\" \\\"$file\\\" \\\"$desfile\\\"\";\r\n\t\t$output = $retval = null;\r\n exec($cmd, $output, $retval);\r\n \r\n if($retval) {\r\n return false;\r\n } else {\r\n return true;\r\n }\r\n }", "public function watermark()\n\t{\n\t\treturn ($this->wm_type === 'overlay') ? $this->overlay_watermark() : $this->text_watermark();\n\t}", "public function watermark($image)\n {\n if (! $this->isInterventionImage($image)) {\n $image = $this->make($image);\n }\n\n $watermark = $this->watermarkImagePath;\n $image->fill($watermark);\n\n return $image;\n }", "public function apply($imgSource, $imgTarget, $imgWatermark, $position = 0, $type = 'image', $padding=10){\n\t\t# Set watermark position\n\t\t$this->watermarkPosition = $position;\n\n\t\t# Get function name to use for create image\n\t\t$functionSource = $this->getFunction($imgSource, 'open');\n\t\t$this->imgSource = $functionSource($imgSource);\n\n\t\t# Check is image or text\n if($type == 'text'){\n $font_height=imagefontheight(10);\n $font_width=imagefontwidth(5);\n\n $width = (strlen($imgWatermark)*$font_width)+10+5 ; // Canvas width = String with, added with some margin\n $height=$font_height + 10+5; // Canvas height = String height, added with some margin\n\n $stamp = imagecreate($width, $height);\n imagecolorallocate($stamp, 235, 235, 235);\n $text_color = imagecolorallocate ($stamp, 3, 3, 3);\n imagestring($stamp, 25, 10, 7, $imgWatermark, $text_color);\n\n $this->imgWatermark = $stamp;\n\n $sx = imagesx($stamp);\n $sy = imagesy($stamp);\n $sizesWatermark = ['width' => $sx, 'height' => $sy];\n }else{\n # Get function name to use for create image\n $functionWatermark = $this->getFunction($imgWatermark, 'open');\n $this->imgWatermark = $functionWatermark($imgWatermark);\n\n # Get watermark images size\n $sizesWatermark = $this->getImgSizes($this->imgWatermark);\n }\n\n # Get watermark position\n $positions = $this->getPositions($padding);\n\n # Apply watermark\n imagecopy($this->imgSource, $this->imgWatermark, $positions['x'], $positions['y'], 0, 0, $sizesWatermark['width'], $sizesWatermark['height']);\n\n # Get function name to use for save image\n $functionTarget = $this->getFunction($imgTarget, 'save');\n\n # Save image\n $functionTarget($this->imgSource, $imgTarget, 100);\n\n # Destroy temp images\n imagedestroy($this->imgSource);\n imagedestroy($this->imgWatermark);\n\t}", "public function applyWaterMark($sourceFileName, $waterMarkFileName, $horizontalPosition, $verticalPosition, $horizontalMargin, $verticalMargin, $opacity, $shrinkToFit, $stretchToFit) \n {\n $sourceImage = $this->loadImage($sourceFileName);\n \n if ($sourceImage) {\n $waterMarkImage = $this->loadImage($waterMarkFileName);\n\n if ($waterMarkImage) {\n //get image properties\n $sourceWidth = imagesx($sourceImage);\n $sourceHeight = imagesy($sourceImage);\n $waterMarkWidth = imagesx($waterMarkImage);\n $waterMarkHeight = imagesy($waterMarkImage);\n\n if (($shrinkToFit && ($waterMarkWidth > $sourceWidth || $waterMarkHeight > $sourceHeight)) || \n (($stretchToFit && $waterMarkWidth < $sourceWidth && $waterMarkHeight < $sourceHeight))) {\n $maxHeight = $sourceHeight;\n\n $maxWidth = $sourceWidth;\n\n if ($horizontalPosition === 'left' || $horizontalPosition === 'right') { \n $maxWidth -= $horizontalMargin;\n }\n\n if ($verticalPosition === 'top' || $verticalPosition === 'bottom') { \n $maxHeight -= $verticalMargin;\n }\n\n if ($maxWidth > 0 && $maxHeight > 0) {\n $waterMarkImageTemp = $waterMarkImage;\n \n $waterMarkImage = null;\n \n $this->resizeVirtualImage($waterMarkImageTemp, $waterMarkImage, $maxHeight, $maxWidth, false, null);\n \n $waterMarkWidth = imagesx($waterMarkImage);\n \n $waterMarkHeight = imagesy($waterMarkImage);\n \n imagedestroy($waterMarkImageTemp);\n }\n }\n\n //calculate stamp position\n $destX = 0;\n if ($horizontalPosition === 'left') {\n $destX = $horizontalMargin;\n }\n elseif ($horizontalPosition === 'right') {\n $destX = $sourceWidth - $waterMarkWidth - $horizontalMargin;\n }\n else { //center\n $destX = ($sourceWidth - $waterMarkWidth) / 2;\n }\n\n $destY = 0;\n if ($verticalPosition === 'top') {\n $destY = $verticalMargin;\n }\n elseif ($verticalPosition === 'bottom') {\n $destY = $sourceHeight - $waterMarkHeight - $verticalMargin;\n }\n else { //middle\n $destY = ($sourceHeight - $waterMarkHeight) / 2;\n }\n \n //stamp the watermark\n if ($opacity === 100) {\n imagecopy($sourceImage, $waterMarkImage, $destX, $destY, 0, 0, $waterMarkWidth, $waterMarkHeight);\n }\n else if ($opacity !== 0) {\n imagecopymerge($sourceImage, $waterMarkImage, $destX, $destY, 0, 0, $waterMarkWidth, $waterMarkHeight, $opacity);\n } \n\n //delete original image\n unlink($sourceFileName);\n\n //save the resulted image\n $this->saveImage($sourceImage, $sourceFileName);\n\n //free memory resource\n imagedestroy($waterMarkImage);\n }\n\n //free memory resource\n imagedestroy($sourceImage);\n }\n }", "public static function watermark($image, $watermarkImage, array $start = [0, 0])\n {\n if (!isset($start[0], $start[1])) {\n throw new InvalidParamException('$start must be an array of two elements.');\n }\n\n $img = self::ensureImageInterfaceInstance($image);\n $watermark = self::ensureImageInterfaceInstance($watermarkImage);\n $img->paste($watermark, new Point($start[0], $start[1]));\n\n return $img;\n }", "function Watermarker($stampPath, //chemin du logo\r\n\t\t\t\t $vAlign=POSITION_TOP, // alignement vertical du logo\r\n\t\t\t\t $hAlign=POSITION_LEFT, // alignement horizontal du logo\r\n\t\t\t\t $vMargin = 5, //marge verticale du logo\r\n\t\t\t\t $hMargin = 5, // marge horizontale du logo\r\n\t\t\t\t $transparence=100) {\r\n\t\t$this->stampPath = $stampPath;\r\n\t\t$this->vAlign = $vAlign;\r\n\t\t$this->hAlign = $hAlign;\r\n\t\t$this->alpha = $transparence/100;\r\n\t}", "function watermarkText2Image ($imageUrl,$imgName,$WaterMarkText, $thb = true) {\n header(\"Content-type: image/jpg\");\n\n //amire kerul a watermark\n if ($thb) {\n $SourceFile = $imageUrl . 'tn_' . $imgName;\n } else {\n $SourceFile = $imageUrl . $imgName;\n }\n list($originalWidth, $originalHeight, $original_type, $original_attr) = getimagesize($SourceFile);\n $sourceImage = imagecreatefromjpeg($SourceFile);\n \n //watermark eloallitasa\n $new_w = (int)($originalWidth);\n $new_h = (int)($originalWidth)*0.15;\n $font = $_SERVER['DOCUMENT_ROOT'].'/include/captcha/fonts/walk_rounded.ttf';\n $fontSize = $new_h/2;\n $angel = 0;\n $the_box = calculateTextBox($WaterMarkText, $font, $fontSize, $angel);\n \n $watermark = imagecreatetruecolor($new_w,$new_h);\n \n \n $white = imagecolorallocate($watermark, 255, 255, 255);\n // Add some shadow to the text\n //$WaterMarkText = 'ww='.$the_box[\"width\"].' nw='.$new_w;\n //imagettftext($watermark, $new_h/2, 0, ($new_w - $the_box[\"width\"])/6, 2*$new_h/3, $white, $font, $WaterMarkText);\n imagettftext($watermark, \n $fontSize,\n $angel,\n $the_box[\"left\"] + ($new_w / 2) - ($the_box[\"width\"] / 2), \n $the_box[\"top\"] + ($new_h / 2) - ($the_box[\"height\"] / 2), \n $white, \n $font, \n $WaterMarkText); \n \n $sx = imagesx($watermark);\n $sy = imagesy($watermark);\n \n imagecopymerge($sourceImage, \n $watermark,\n 0,//imagesx($original_image)/2 , //dest x - $sx/2\n imagesy($sourceImage)/2- $sy/2, //dest y \n 0, //source origo x\n 0, //source origo y\n imagesx($watermark), \n imagesy($watermark),\n 30\n );\n \n // megjelenitem a thumbnailt a watermark szoveggel\n imagejpeg($sourceImage, null, 100); //$SourceFile\n imagedestroy($sourceImage);\n\n}", "public function imageAdapterGdWatermarkPngInsidePng(UnitTester $I)\n {\n $I->wantToTest('Image\\Adapter\\Gd - watermark() - png inside png');\n\n $image = new Gd(\n dataDir('assets/images/example-png.png')\n );\n\n $watermark = new Gd(\n dataDir('assets/images/example-png.png')\n );\n $watermark->resize(null, 30, Enum::HEIGHT);\n\n $outputDir = 'tests/image/gd';\n $outputImage = 'watermark.png';\n $output = outputDir($outputDir . '/' . $outputImage);\n $offsetX = 20;\n $offsetY = 20;\n $opacity = 75;\n\n $hash = '10787c3c3e181818';\n\n $image->watermark($watermark, $offsetX, $offsetY, $opacity)\n ->save($output)\n ;\n\n $I->amInPath(\n outputDir($outputDir)\n );\n\n $I->seeFileFound($outputImage);\n\n $I->assertTrue(\n $this->checkImageHash($output, $hash)\n );\n\n $I->safeDeleteFile($outputImage);\n }", "function addStamp($image)\n{\n\n // Load the stamp and the photo to apply the watermark to\n // http://php.net/manual/en/function.imagecreatefromgif.php\n $stamp = imagecreatefromgif(\"./happy_trans.gif\");\n $im = imagecreatefrompng($image);\n\n // Set the margins for the stamp and get the height/width of the stamp image\n $marge_right = 10;\n $marge_bottom = 10;\n $sx = imagesx($stamp);\n $sy = \n imagesy($stamp);\n\n // Copy the stamp image onto our photo using the margin offsets and the photo \n // width to calculate positioning of the stamp. \n imagecopy($im, $stamp, imagesx($im) - $sx - $marge_right, imagesy($im) - $sy - $marge_bottom, 0, 0, imagesx($stamp), imagesy($stamp));\n\n # (Commented) This cannot be here, problems with outputing resize.php as HTML\n # header('Content-type: image/png');\n\n // Output and free memory\n imagepng($im, \"./test.png\");\n imagedestroy($im);\n imagedestroy($stamp);\n}", "public static function create_watermark( $main_img_obj, $watermark_img_obj, $alpha_level = 100 )\n\t{\n\t\t$alpha_level\t/= 100;\t# convert 0-100 (%) alpha to decimal\n\n\t\t# calculate our images dimensions\n\t\t$main_img_obj_w\t= imagesx( $main_img_obj );\n\t\t$main_img_obj_h\t= imagesy( $main_img_obj );\n\t\t$watermark_img_obj_w\t= imagesx( $watermark_img_obj );\n\t\t$watermark_img_obj_h\t= imagesy( $watermark_img_obj );\n\n\t\t# determine center position coordinates\n\t\t$main_img_obj_min_x\t= floor( ( $main_img_obj_w / 2 ) - ( $watermark_img_obj_w / 2 ) );\n\t\t$main_img_obj_max_x\t= ceil( ( $main_img_obj_w / 2 ) + ( $watermark_img_obj_w / 2 ) );\n\t\t$main_img_obj_min_y\t= floor( 3 * ( $main_img_obj_h / 4 ) - ( $watermark_img_obj_h / 2 ) );\n\t\t$main_img_obj_max_y\t= ceil( 3 * ( $main_img_obj_h / 4 ) + ( $watermark_img_obj_h / 2 ) ); \n\n\t\t# create new image to hold merged changes\n\t\t$return_img\t= imagecreatetruecolor( $main_img_obj_w, $main_img_obj_h );\n\n\t\t# walk through main image\n\t\tfor( $y = 0; $y < $main_img_obj_h; $y++ ) {\n\t\t\tfor( $x = 0; $x < $main_img_obj_w; $x++ ) {\n\t\t\t\t$return_color\t= NULL;\n\n\t\t\t\t# determine the correct pixel location within our watermark\n\t\t\t\t$watermark_x\t= $x - $main_img_obj_min_x;\n\t\t\t\t$watermark_y\t= $y - $main_img_obj_min_y;\n\n\t\t\t\t# fetch color information for both of our images\n\t\t\t\t$main_rgb = imagecolorsforindex( $main_img_obj, imagecolorat( $main_img_obj, $x, $y ) );\n\n\t\t\t\t# if our watermark has a non-transparent value at this pixel intersection\n\t\t\t\t# and we're still within the bounds of the watermark image\n\t\t\t\tif (\t$watermark_x >= 0 && $watermark_x < $watermark_img_obj_w &&\n\t\t\t\t\t\t\t$watermark_y >= 0 && $watermark_y < $watermark_img_obj_h ) {\n\t\t\t\t\t$watermark_rbg = imagecolorsforindex( $watermark_img_obj, imagecolorat( $watermark_img_obj, $watermark_x, $watermark_y ) );\n\n\t\t\t\t\t# using image alpha, and user specified alpha, calculate average\n\t\t\t\t\t$watermark_alpha\t= round( ( ( 127 - $watermark_rbg['alpha'] ) / 127 ), 2 );\n\t\t\t\t\t$watermark_alpha\t= $watermark_alpha * $alpha_level;\n\n\t\t\t\t\t# calculate the color 'average' between the two - taking into account the specified alpha level\n\t\t\t\t\t$avg_red\t\t= self::_get_ave_color( $main_rgb['red'],\t\t$watermark_rbg['red'],\t\t$watermark_alpha );\n\t\t\t\t\t$avg_green\t= self::_get_ave_color( $main_rgb['green'],\t$watermark_rbg['green'],\t$watermark_alpha );\n\t\t\t\t\t$avg_blue\t\t= self::_get_ave_color( $main_rgb['blue'],\t$watermark_rbg['blue'],\t\t$watermark_alpha );\n\n\t\t\t\t\t# calculate a color index value using the average RGB values we've determined\n\t\t\t\t\t$return_color\t= self::_get_image_color( $return_img, $avg_red, $avg_green, $avg_blue );\n\n\t\t\t\t# if we're not dealing with an average color here, then let's just copy over the main color\n\t\t\t\t} else {\n\t\t\t\t\t$return_color\t= imagecolorat( $main_img_obj, $x, $y );\n\n\t\t\t\t} # END if watermark\n\n\t\t\t\t# draw the appropriate color onto the return image\n\t\t\t\timagesetpixel( $return_img, $x, $y, $return_color );\n\n\t\t\t} # END for each X pixel\n\t\t} # END for each Y pixel\n\n\t\t# return the resulting, watermarked image for display\n\t\treturn $return_img;\n\n\t}", "public static function watermark($srcImage, $watermark, $x = 0, $y = 0, $pct = null, $copy = false) {\n $srcImage = $srcImage instanceof Image ? $srcImage : Image::load($srcImage);\n $watermark = $watermark instanceof Image ? $watermark : Image::load($watermark);\n return $srcImage->merge($watermark, $x, $y, $pct, $copy);\n }", "public function watermark($file, $transparency=40, $padding=2, $position='BR')\n\t{\n\t\t$this->checkImage();\n\t\t$watermark = $this->openFile($file);\n\t\t$width = imagesx($watermark);\n\t\t$height = imagesy($watermark);\n\t\t$transparency = max(0, min($transparency, 100));\n\t\t$padding = (int)$padding;\n\n\t\tswitch(strtoupper($position)) {\n\t\t\tcase 'TL': // Top left\n\t\t\t\t$destX = $padding;\n\t\t\t\t$destY = $padding;\n\t\t\t\tbreak;\n\t\t\tcase 'TR': // Top right\n\t\t\t\t$destX = $this->optimalWidth - $width - $padding;\n\t\t\t\t$destY = $padding;\n\t\t\t\tbreak;\n\t\t\tcase 'BL': // Bottom left\n\t\t\t\t$destX = $padding;\n\t\t\t\t$destY = $this->optimalHeight - $height - $padding;\n\t\t\t\tbreak;\n\t\t\tdefault: // Bottom right\n\t\t\t\t$destX = $this->optimalWidth - $width - $padding;\n\t\t\t\t$destY = $this->optimalHeight - $height - $padding;\n\t\t\t\tbreak;\n\t\t}\n\n\t\t$this->imagecopymergeAlpha($this->imageResized, $watermark, $destX, $destY, 0, 0, $width, $height, $transparency);\n\t\timagedestroy($watermark);\n\n\t\treturn $this;\n\t}", "public function setWatermark(int $events, int $lowmark, int $highmark): void {}", "function _watermarkImageNetPBM($file, $desfile, $wm_file, $position, $imgobj) {\r\n return true; //TODO\r\n }", "public function enableWaterMark($text = null)\n {\n $this->SetWatermarkText($text != null ? $text: \\Yii::$app->name);\n $this->showWatermarkText = true;\n $this->watermarkTextAlpha = 0.1;\n }", "public function getWatermark($width, $height){\n if (is_null($width) && is_null($height)) {\n return public_path(\"/frontend/images/watermark.png\");\n }\n\n //if thumbnail exist returns it\n if (File::exists(public_path(\"/frontend/images/thumbs/\" . \"{$width}x{$height}/watermark.png\"))) {\n return public_path(\"/frontend/images/thumbs/\" . \"{$width}x{$height}/watermark.png\");\n }\n\n// //If original image doesn't exists returns a default image which shows that original image doesn't exist.\n// if (!File::exists(public_path(\"{$images_path}/\" . $path))) {\n//\n// /*\n// * 2 ways\n// */\n//\n// //1. recursive call for the default image\n// //return $this->getImageThumbnail(\"error/no-image.png\", $width, $height, $type);\n//\n// //2. returns an image placeholder generated from placehold.it\n// return \"http://placehold.it/{$width}x{$height}\";\n// }\n\n// $allowedMimeTypes = ['image/jpeg', 'image/gif', 'image/png'];\n// $contentType = mime_content_type(public_path(\"{$images_path}/\" . $path));\n//\n// if (in_array($contentType, $allowedMimeTypes)) { //Checks if is an image\n\n $image = Image::make(public_path(\"/frontend/images/watermark.png\"));\n\n// switch ($type) {\n// case \"fit\": {\n $image->fit($width, $height, function ($constraint) {\n $constraint->upsize();\n });\n// break;\n// }\n// case \"resize\": {\n// //stretched\n// $image->resize($width, $height);\n// }\n// case \"background\": {\n// $image->resize($width, $height, function ($constraint) {\n// //keeps aspect ratio and sets black background\n// $constraint->aspectRatio();\n// $constraint->upsize();\n// });\n// }\n// case \"resizeCanvas\": {\n// $image->resizeCanvas($width, $height, 'center', false, 'rgba(0, 0, 0, 0)'); //gets the center part\n// }\n// }\n\n //relative directory path starting from main directory of images\n// $dir_path = (dirname($path) == '.') ? \"\" : dirname($path);\n\n //Create the directory if it doesn't exist\n if (!File::exists(public_path(\"/frontend/images/thumbs/\" . \"{$width}x{$height}\"))) {\n File::makeDirectory(public_path(\"/frontend/images/thumbs/\" . \"{$width}x{$height}\"), 0775, true);\n }\n\n //Save the thumbnail\n $image->save(public_path(\"/frontend/images/thumbs/\" . \"{$width}x{$height}/watermark.png\"));\n\n //return the url of the thumbnail\n return public_path(\"/frontend/images/thumbs/\" . \"{$width}x{$height}/watermark.png\");\n }", "public function imageAdapterGdWatermarkPngInsideJpg(UnitTester $I)\n {\n $I->wantToTest('Image\\Adapter\\Gd - watermark() - png inside jpg');\n\n $this->checkJpegSupport($I);\n\n $image = new Gd(\n dataDir('assets/images/example-jpg.jpg')\n );\n\n $watermark = new Gd(\n dataDir('assets/images/example-png.png')\n );\n\n $outputDir = 'tests/image/gd';\n $outputImage = 'watermark.jpg';\n $output = outputDir($outputDir . '/' . $outputImage);\n $offsetX = 200;\n $offsetY = 200;\n\n $hash = 'fbf9f3e3c3c18183';\n\n $image->watermark($watermark, $offsetX, $offsetY)\n ->save($output)\n ;\n\n $I->amInPath(\n outputDir($outputDir)\n );\n\n $I->seeFileFound($outputImage);\n\n $I->assertTrue(\n $this->checkImageHash($output, $hash)\n );\n\n $I->safeDeleteFile($outputImage);\n }", "public function imageAdapterGdWatermarkJpgInsidePng(UnitTester $I)\n {\n $I->wantToTest('Image\\Adapter\\Gd - watermark() - jpg inside png');\n\n $this->checkJpegSupport($I);\n\n $image = new Gd(\n dataDir('assets/images/example-png.png')\n );\n\n $watermark = new Gd(\n dataDir('assets/images/example-jpg.jpg')\n );\n $watermark->resize(50, 50, Enum::NONE);\n\n $outputDir = 'tests/image/gd';\n $outputImage = 'watermark.png';\n $output = outputDir($outputDir . '/' . $outputImage);\n $offsetX = 10;\n $offsetY = 10;\n $opacity = 50;\n\n $hash = '107c7c7c7e1c1818';\n\n // Resize to 200 pixels on the shortest side\n $image->watermark($watermark, $offsetX, $offsetY, $opacity)\n ->save($output)\n ;\n\n $I->amInPath(\n outputDir($outputDir)\n );\n\n $I->seeFileFound($outputImage);\n\n $I->assertTrue(\n $this->checkImageHash($output, $hash)\n );\n\n $I->safeDeleteFile($outputImage);\n }", "public function updateWatermarks() {\n set_time_limit(0);\n $watermark = trim(Mage::getStoreConfig(\"tragento/api/tragento-watermark\"));\n $db = Mage::getSingleton('core/resource')->getConnection('core_read');\n $query = \"SELECT * FROM tragento_product\";\n $products = $db->fetchAll($query);\n $i=0;\n $total = count($products);\n echo 'Total watermarks to generate '.$total.PHP_EOL;\n foreach ($products as $p) {\n $i++;\n echo 'Generating '.$i.PHP_EOL;\n echo $this->applyWatermark($this->getProductImage($p['product_id']),$watermark);\n echo PHP_EOL;\n }\n }", "function watermark( $img, $cpr, $font, $font_size, $rgbtext, $rgbtsdw, $hotspot, $txp, $typ, $sxp, $syp )\n\t{\n\t\tstrtolower( substr( $img, strlen( $img ) - 4, 4 ) ) == \"jpeg\" ? $suffx = \"jpeg\" : $suffx = strtolower( substr( $img, strlen( $img ) - 3, 3 ) );\n\t\tswitch( $suffx )\n\t\t{\n\t\t\tcase \"jpg\":\n\t\t\t\t$image = imageCreateFromJpeg( $img );\n\t\t\t\tbreak;\n\t\t\tcase \"jpeg\":\n\t\t\t\t$image = imageCreateFromJpeg( $img );\n\t\t\t\tbreak;\n\t\t\tbreak;\n\t\t\tcase \"gif\":\n\t\t\t\t$image = imageCreateFromGif( $img );\n\t\t\t\tbreak;\n\t\t\tbreak;\n\t\t\tcase \"png\":\n\t\t\t\t$image = imageCreateFromPng( $img );\n\t\t\t\tbreak;\n\t\t}\n \tif( $hotspot != 0 )\n \t{\n \t\t$ix = imagesx( $image );\n \t\t$iy = imagesy( $image );\n \t\t$tsw = strlen( $text ) * $font_size / imagefontwidth( $font ) * 3;\n \t\t$tsh = $font_size / imagefontheight( $font );\n \t\tswitch ( $hotspot )\n \t\t{\n \t\tcase 1:\n \t\t\t$txp = $txp; $typ = $tsh * $tsh + imagefontheight( $font ) * 2 + $typ;\n \t\t\tbreak;\n \t\tcase 2:\n \t\t\t$txp = floor( ( $ix - $tsw ) / 2 ); $typ = $tsh * $tsh + imagefontheight( $font ) * 2 + $typ;\n \t\t\tbreak;\n \t\tcase 3:\n \t\t\t$txp = $ix - $tsw - $txp; $typ = $tsh * $tsh + imagefontheight( $font ) * 2 + $typ;\n \t\t\tbreak;\n \t\tcase 4:\n \t\t\t$txp = $txp; $typ = floor( ( $iy - $tsh ) / 2 );\n \t\t\tbreak;\n \t\tcase 5:\n \t\t\t$txp = floor( ( $ix - $tsw ) / 2 ); $typ = floor( ( $iy - $tsh ) / 2 );\n \t\t\tbreak;\n \t\tcase 6:\n \t\t\t$txp = $ix - $tsw - $txp; $typ = floor( ( $iy - $tsh ) / 2 );\n \t\t\tbreak;\n \t\tcase 7:\n \t\t\t$txp = $txp; $typ = $iy - $tsh - $typ;\n \t\t\tbreak;\n \t\tcase 8:\n \t\t\t$txp = floor( ( $ix - $tsw ) / 2 ); $typ = $iy - $tsh - $typ;\n \t\t\tbreak;\n \t\tcase 9:\n \t\t\t$txp = $ix - $tsw - $txp; $typ = $iy - $tsh - $typ;\n \t\t\tbreak;\n \t\t}\n \t}\n \t\tImageTTFText( $image, $font_size, 0, $txp + $sxp, $typ + $syp, imagecolorallocate( $image, HexDec( $rgbtsdw ) & 0xff, ( HexDec( $rgbtsdw ) >> 8 ) & 0xff, ( HexDec( $rgbtsdw ) >> 16 ) & 0xff ), $font, $cpr );\n \t\tImageTTFText( $image, $font_size, 0, $txp, $typ, imagecolorallocate( $image, HexDec( $rgbtext ) & 0xff, ( HexDec( $rgbtext ) >> 8 ) & 0xff, ( HexDec( $rgbtext ) >> 16 ) & 0xff ), $font, $cpr );\n\t\tswitch( $suffx )\n\t\t{\n\t\t\tcase \"jpg\":\n \t\t\t\theader( \"Content-type: image/jpg\" );\n \t\t\t\timageJpeg( $image );\n \t\t\t\timageDestroy( $image );\n\t\t\t\tbreak;\n\t\t\tcase \"jpeg\":\n \t\t\t\theader( \"Content-type: image/jpg\" );\n \t\t\t\timageJpeg( $image );\n \t\t\t\timageDestroy( $image );\n\t\t\t\tbreak;\n\t\t\tbreak;\n\t\t\tcase \"gif\":\n \t\t\t\theader( \"Content-type: image/gif\" );\n \t\t\t\timageGif( $image );\n \t\t\t\timageDestroy( $image );\n\t\t\t\tbreak;\n\t\t\tbreak;\n\t\t\tcase \"png\":\n \t\t\t\theader( \"Content-type: image/png\" );\n \t\t\t\timagePng( $image );\n \t\t\t\timageDestroy( $image );\n\t\t\t\tbreak;\n\t\t}\n\t}", "function watermarkImage($file, $desfile, $imgobj) {\r\n switch ($this->_conversiontype){\r\n //Imagemagick\r\n case 1:\r\n if($this->_watermarkImageIM($file, $desfile, $this->_wm_file, $this->_wm_position, $imgobj))\r\n return true;\r\n else\r\n return false;\r\n break;\r\n //NetPBM\r\n case 2:\r\n if($this->_watermarkImageNETPBM($file, $desfile, $this->_wm_file, $this->_wm_position, $imgobj))\r\n return true;\r\n else\r\n return false;\r\n break;\r\n //GD1 & GD2\r\n case 3 || 4:\r\n if($this->_watermarkImageGD($file, $desfile, $this->_wm_file, $this->_wm_position, $imgobj))\r\n return true;\r\n else\r\n return false;\r\n break;\r\n }\r\n return true;\r\n }", "function create_image(){\r\n\t$wmark = imagecreatefrompng('img/stamp.png');\r\n\t//Load jpg image\r\n\t$image = imagecreatefromjpeg('img/image'.rand(1,3).'.jpg');\r\n\t\r\n\t//Get image width/height\r\n\t$width = imagesx($image);\r\n\t$height = imagesy($image);\r\n\t\r\n\t// Set the margins for the stamp and get the height/width of the stamp image\r\n\t$marge_right = 10;\r\n\t$marge_bottom = 10;\r\n\t$sx = imagesx($wmark);\r\n\t$sy = imagesy($wmark);\r\n\t\r\n\t// Copy the stamp image onto our photo using the margin offsets and the photo width to calculate positioning of the stamp. \r\n\timagecopy($image, $wmark, $width-$sx-$marge_right, $height-$sy-$marge_bottom,0,0,$sx,$sy);\r\n\t\r\n\t// Prepare the final image and save to path. If you only pass $image it will output to the browser instead of a file.\r\n\timagepng($image,\"generatedImage.png\");\r\n\t\r\n\t// Output and free memory\r\n\timagedestroy($image);\r\n}", "private function watermark_imagick($name, $ext, $logo, $w_logo, $h_logo, $div_photo)\n {\n #Not just me babe, All the places mises you ..\n $im = new \\Imagick($name);\n\n $watermark = new \\Imagick($logo);\n //$watermark->readImage($);\n\n #how big are the images?\n $iWidth = $im->getImageWidth();\n $iHeight = $im->getImageHeight();\n $wWidth = $watermark->getImageWidth();\n $wHeight = $watermark->getImageHeight();\n\n if ($iHeight < $wHeight || $iWidth < $wWidth) {\n #resize the watermark\n $watermark->scaleImage($iWidth, $iHeight);\n\n #get new size\n $wWidth = $watermark->getImageWidth();\n $wHeight = $watermark->getImageHeight();\n }\n\n #calculate the position\n $x = (($iWidth - ($wWidth - 5)) / $div_photo) * $w_logo;\n $y = (($iHeight - ($wHeight - 5)) / $div_photo) * $h_logo;\n\n #an exception for gif image\n #generating thumb with 10 frames only, big gif is a devil\n $composite_over = \\imagick::COMPOSITE_OVER;\n\n if ($ext == 'gif') {\n $i = 0;\n //$gif_new = new Imagick();\n foreach ($im as $frame) {\n $frame->compositeImage($watermark, $composite_over, $x, $y);\n\n //\t$gif_new->addImage($frame->getImage());\n if ($i >= 10) {\n # more than 10 frames, quit it\n break;\n }\n $i++;\n }\n $im->writeImages($name, true);\n return;\n }\n\n $im->compositeImage($watermark, $composite_over, $x, $y);\n\n $im->writeImages($name, false);\n }", "public function watermark(string $path, string $position = 'bottom-right', int $x = 0, int $y = 0): static\n {\n $this->watermark = true;\n $this->watermarkPath = $path;\n $this->watermarkPosition = $position;\n $this->watermarkX = $x;\n $this->watermarkY = $y;\n\n return $this;\n }", "public function imageAdapterGdWatermarkJpgInsideJpg(UnitTester $I)\n {\n $I->wantToTest('Image\\Adapter\\Gd - watermark() - jpg inside jpg');\n\n $this->checkJpegSupport($I);\n\n $image = new Gd(\n dataDir('assets/images/example-jpg.jpg')\n );\n\n $watermark = new Gd(\n dataDir('assets/images/example-jpg.jpg')\n );\n $watermark->resize(250, null, Enum::WIDTH);\n\n $outputDir = 'tests/image/gd';\n $outputImage = 'watermark.jpg';\n $output = outputDir($outputDir . '/' . $outputImage);\n $offsetX = 200;\n $offsetY = 200;\n $opacity = 50;\n\n $hash = 'fbf9f3e3c3c18183';\n\n // Resize to 200 pixels on the shortest side\n $image->watermark($watermark, $offsetX, $offsetY, $opacity)\n ->save($output)\n ;\n\n $I->amInPath(\n outputDir($outputDir)\n );\n\n $I->seeFileFound($outputImage);\n\n $I->assertTrue(\n $this->checkImageHash($output, $hash)\n );\n\n $I->safeDeleteFile($outputImage);\n }", "public function genwatermarkAction(Request $request)\n {\n //tim domain cua host\n $domainSource = CommonMethod::getDomainSource();\n trimRequest($request);\n\n $dir = !empty($request->dir)?$request->dir:'images/';\n $code = !empty($request->code)?$request->code:null;\n $position = !empty($request->position)?$request->position:null;\n // get all images to gen watermark\n $lists = self::getimagestogenwatermark($dir);\n // gen watermark\n foreach($lists as $value) {\n //bo /images/ phia truoc dir de lay savePath\n $savePath = substr(dirname($value), 8);\n // return $imageOrigin\n CommonMethod::createWatermark($value, $domainSource, $savePath, $code, $position);\n }\n return redirect('admin/genwatermark')->with('success', 'Đã tạo watermark cho '.count($lists).' ảnh');\n }", "protected static function ImageMagickWatermark($in_file, $out_file, $wm_file)\n {\n $command_composite =\n \"composite -gravity SouthWest \".\n escapeshellarg($wm_file).\n \" \".\n escapeshellarg($in_file).\n \" -strip \".\n escapeshellarg($out_file);\n\n shell_exec($command_composite);\n }", "protected function getLiipImagine_Filter_Loader_WatermarkService()\n {\n return $this->services['liip_imagine.filter.loader.watermark'] = new \\Liip\\ImagineBundle\\Imagine\\Filter\\Loader\\WatermarkFilterLoader($this->get('liip_imagine'), ($this->targetDirs[3].'/app'));\n }", "protected function addWatermarkFilterIfExists(&$set, $width, $height)\n {\n if( isset($set['watermark']) )\n {\n if( ! empty($set['watermark'][1])) \n {\n $set['filters'][] = ['target', [$set['watermark'][1]]];\n }\n\n if( ! empty($set['watermark'][2])) \n {\n $set['filters'][] = ['margin', [$set['watermark'][2]]]; // @codeCoverageIgnore\n }\n\n $set['filters'][] = ['mix', [$set['watermark'][0]]];\n } \n }", "private function add_watermark( $attachment_id )\n\t{\n\t\t$attachment = get_post( $attachment_id );\n\n\t\tif ( get_post_type( $attachment->post_parent ) == 'ptx-gallery' && $this->settings['watermark']['image'] ) {\n\n\t\t\t$watermark_file = get_attached_file( $this->settings['watermark']['image'] );\n\t\t\t$watermark_file_type = wp_check_filetype( $watermark_file );\n\n\t\t\tif ( $watermark_file_type['ext'] == 'png' )\n\t\t\t{\n\t\t\t\t$file = get_attached_file( $attachment_id, 'full' );\n\t\t\t\t$this->copy_original( $file, $attachment_id );\n\t\t\t\t$this->add_watermark_to_( $file );\n\t\t\t} else {\n\t\t\t\tdie( 'Watermark is not a png file' );\n\t\t\t}\n\t\t}\n\t}", "public function addWatermark($imageIds, $watermarkImageId)\n {\n /** @var Image[] $imageRecords */\n $imageRecords = $this->repository->findBy(['id' => $imageIds]);\n $watermarkRecord = $this->repository->find($watermarkImageId);\n\n $photos = [];\n foreach ($imageRecords as $key => $record) {\n $photos[$key] = $this->imagine->load($this->fileSystem->getImage($record->getImagePath()));\n }\n $watermark = $this->imagine->load($this->fileSystem->getImage($watermarkRecord->getImagePath()));\n\n foreach ($photos as $key => $photo) {\n $image = $this->applyWatermark($photo, $watermark);\n $this->fileSystem->saveImage($image->get('png'), $imageRecords[$key]->getImagePath());\n $this->em->persist($imageRecords[$key]);\n }\n $this->em->flush();\n\n return $imageRecords;\n }", "function setWaterMark($filePath, $doc) {\r\n $docType = DocTypes::model()->getDocumentByDocTypeDesc($doc);\r\n $this->filePath = $filePath;\r\n $path = $this->getValidFile();\r\n $im = new Imagick($path);\r\n try {\r\n $outputtype = $im->getFormat();\r\n $size = $im->getImageLength();\r\n if ($docType->water_mark_text != null) {\r\n $draw = new ImagickDraw();\r\n $draw->setFontSize($docType->water_mark_font_size);\r\n $draw->setFillOpacity($docType->water_mark_opacity);\r\n $draw->setGravity(Imagick::GRAVITY_CENTER);\r\n $im->annotateImage($draw, 0, 0, $docType->water_mark_angle, $docType->water_mark_text);\r\n }\r\n return $im;\r\n } catch (Exception $e) {\r\n $message = $e->getMessage();\r\n }\r\n }", "function imagecopymerge_alpha($dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h, $pct){\n\t$cut = imagecreatetruecolor($src_w, $src_h); \n\n // copying relevant section from background to the cut resource \n\timagecopy($cut, $dst_im, 0, 0, $dst_x, $dst_y, $src_w, $src_h); \n\n // copying relevant section from watermark to the cut resource \n\timagecopy($cut, $src_im, 0, 0, $src_x, $src_y, $src_w, $src_h); \n\n // insert cut resource to destination image \n\timagecopymerge($dst_im, $cut, $dst_x, $dst_y, 0, 0, $src_w, $src_h, $pct); \n}", "function setPageWatermark($page_watermark) {\n if (!(filesize($page_watermark) > 0))\n throw new Error(create_invalid_value_message($page_watermark, \"page_watermark\", \"html-to-pdf\", \"The file must exist and not be empty.\", \"set_page_watermark\"), 470);\n \n $this->files['page_watermark'] = $page_watermark;\n return $this;\n }", "protected static function GDWatermark($in_file, $out_file, $wm_file)\n {\n $watermark = imagecreatefrompng($wm_file);\n\n $image = self::imageCreateFrom($in_file);\n\n $margin_right = 5;\n $margin_bottom = 5;\n $wm_sx = imagesx($watermark);\n $wm_sy = imagesy($watermark);\n $im_sx = imagesx($image);\n $im_sy = imagesy($image);\n\n imagecopy($image, $watermark,\n $margin_right, $im_sy - $wm_sy - $margin_bottom, // w tym miejscu smaruj watermark\n 0, 0, // od tych współrzędnych bierzesz watermark\n $wm_sx, $wm_sy // cały watermark bierzesz\n );\n\n self::imagePut($image, $out_file);\n\n imagedestroy($image);\n imagedestroy($watermark);\n }", "public function test_image_preserves_alpha() {\n\n\t\t$file = DIR_TESTDATA . '/images/transparent.png';\n\n\t\t$editor = wp_get_image_editor( $file );\n\t\t$editor->load();\n\n\t\t$save_to_file = tempnam( get_temp_dir(), '' ) . '.png';\n\t\t\n\t\t$editor->save( $save_to_file );\n\n\t\t$this->assertImageAlphaAtPoint( $save_to_file, array( 0,0 ), 127 );\n\t}", "function imagecopymerge_alpha($dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h, $pct){\n $cut = imagecreatetruecolor($src_w, $src_h); \n\n // copying relevant section from background to the cut resource \n imagecopy($cut, $dst_im, 0, 0, $dst_x, $dst_y, $src_w, $src_h); \n \n // copying relevant section from watermark to the cut resource \n imagecopy($cut, $src_im, 0, 0, $src_x, $src_y, $src_w, $src_h); \n \n // insert cut resource to destination image \n imagecopymerge($dst_im, $cut, $dst_x, $dst_y, 0, 0, $src_w, $src_h, $pct);\n\n }", "public static function apply_watermark($y_exe_composite, $y_file, $y_watermark_file, $y_quality, $y_watermark_gravity) {\n\t//--\n\t\\SmartFileSysUtils::raise_error_if_unsafe_path($y_exe_composite, 'no'); // on windows must use like on unix: / as path separator and without drive letter as: /path/to/exe\n\t//--\n\t\\SmartFileSysUtils::raise_error_if_unsafe_path($y_file);\n\t\\SmartFileSysUtils::raise_error_if_unsafe_path($y_watermark_file);\n\t//--\n\treturn (string) $y_exe_composite.' -dissolve 100 -gravity '.$y_watermark_gravity.' \"'.$y_watermark_file.'\" \"'.$y_file.'\" \"'.$y_file.'\"';\n\t//--\n}", "function transparent($psdata, $src_img, &$size_x, &$size_y, &$image, &$mask) {\n // Generate an unique image id\n $id = $this->generate_id();\n\n // Generate the unique temporary file name for this image; \n // we'll use it for imagemagick temporary files\n $tempfile = $psdata->mk_filename();\n\n // Save image as PNG for further processing\n imagepng($src_img, $tempfile.'.png');\n\n // Call image magick - convert to raw RGBA samples (binary)\n safe_exec('\"'.IMAGE_MAGICK_CONVERT_EXECUTABLE.'\"'.\" ${tempfile}.png ${tempfile}.rgba\", $output);\n\n // read raw RGBA samples\n $samples = file_get_contents($tempfile.'.rgba');\n\n // Determine image size and create a truecolor copy of this image \n // (as we don't want to work with palette-based images manually)\n $size_x = imagesx($src_img); \n $size_y = imagesy($src_img);\n \n // write stream header to the postscript file\n $psdata->write(\"/image-{$id}-init { image-{$id}-data 0 setfileposition mask-{$id}-data 0 setfileposition } def\\n\");\n\n // Create IMAGE data stream\n $psdata->write(\"/image-{$id}-data currentfile << /Filter /ASCIIHexDecode >> /ReusableStreamDecode filter\\n\");\n\n // initialize line length counter\n $ctr = 0;\n \n for ($i = 0; $i < strlen($samples); $i += 4) {\n // Save image pixel to the stream data\n $r = ord($samples{$i});\n $g = ord($samples{$i+1});\n $b = ord($samples{$i+2});\n $psdata->write(sprintf(\"%02X%02X%02X\",$r,$g,$b));\n\n // Increate the line length counter; check if stream line needs to be terminated\n $ctr += 6;\n if ($ctr > MAX_LINE_LENGTH) { \n $psdata->write(\"\\n\");\n $ctr = 0;\n }\n };\n\n // terminate the stream data\n $psdata->write(\">\\ndef\\n\");\n\n // Create MASK data stream\n $psdata->write(\"/mask-{$id}-data currentfile << /Filter /ASCIIHexDecode >> /ReusableStreamDecode filter\\n\");\n\n // initialize line length counter\n $ctr = 0;\n\n // initialize mask bit counter\n $bit_ctr = 0;\n $mask_data = 0xff;\n\n for ($y = 0; $y < $size_y; $y++) {\n for ($x = 0; $x < $size_x; $x++) {\n // Check if this pixel should be transparent\n $a = ord($samples{($y*$size_x + $x)*4+3});\n \n if ($a < 255) {\n $mask_data = ($mask_data << 1) | 0x1;\n } else {\n $mask_data = ($mask_data << 1);\n };\n $bit_ctr ++;\n \n // If we've filled the whole byte, write it into the mask data stream\n if ($bit_ctr >= 8 || $x + 1 == $size_x) { \n // Pad mask data, in case we have completed the image row\n while ($bit_ctr < 8) {\n $mask_data = ($mask_data << 1) | 0x01;\n $bit_ctr ++;\n };\n \n $psdata->write(sprintf(\"%02X\", $mask_data & 0xff)); \n\n // Clear mask data after writing \n $mask_data = 0xff;\n $bit_ctr = 0;\n\n // Increate the line length counter; check if stream line needs to be terminated\n $ctr += 1;\n if ($ctr > MAX_LINE_LENGTH) { \n $psdata->write(\"\\n\");\n $ctr = 0;\n }\n };\n };\n };\n\n // terminate the stream data\n // Write any incomplete mask byte to the mask data stream\n if ($bit_ctr != 0) {\n while ($bit_ctr < 8) {\n $mask_data <<= 1;\n $mask_data |= 1;\n $bit_ctr ++;\n }\n $psdata->write(sprintf(\"%02X\", $mask_data));\n };\n $psdata->write(\">\\ndef\\n\");\n\n // return image and mask data references\n $image = \"image-{$id}-data\";\n $mask = \"mask-{$id}-data\";\n\n // Delete temporary files \n unlink($tempfile.'.png');\n unlink($tempfile.'.rgba');\n\n return $id;\n }", "public static function watermark($img, $logo_path = false, $h_logo = 1, $w_logo = 1, $div_photo = 2)\n {\n #is this file really exsits ?\n if (!file_exists($img)) {\n return;\n }\n\n if (!is_int($h_logo)) {\n $h_logo = strtolower($h_logo);\n switch ($h_logo) {\n case 'top':\n $h_logo = 0;\n break;\n case 'center':\n $h_logo = $div_photo / 2;\n break;\n case 'down':\n $h_logo = $div_photo;\n break;\n default :\n $h_logo = $div_photo / 2;\n }\n }\n\n if (!is_int($w_logo)) {\n $w_logo = strtolower($w_logo);\n switch ($w_logo) {\n case 'left':\n $w_logo = 0;\n break;\n case 'center':\n $w_logo = $div_photo / 2;\n break;\n case 'right':\n $w_logo = $div_photo;\n break;\n default :\n $w_logo = $div_photo / 2;\n }\n }\n\n $ext = File::extension($img);\n $ext_logo = File::extension($logo_path);\n $src_logo = false;\n\n #check size logo\n $h_logo = ($h_logo > $div_photo) ? $div_photo : $h_logo;\n $h_logo = ($h_logo < 0) ? 0 : $h_logo;\n $w_logo = ($w_logo > $div_photo) ? $div_photo : $w_logo;\n $w_logo = ($w_logo < 0) ? 0 : $w_logo;\n\n if (file_exists($logo_path)) {\n if ($ext_logo == 'png')\n $src_logo = imagecreatefrompng($logo_path);\n else if ($ext_logo == 'gif')\n $src_logo = imagecreatefromgif($logo_path);\n else if ($ext_logo == 'jpg' || $ext_logo == 'jpeg')\n $src_logo = imagecreatefromjpeg($logo_path);\n }\n\n\n #no watermark pic\n if (!$src_logo) {\n return;\n }\n\n #if there is imagick lib, then we should use it\n if (function_exists('phpversion') && phpversion('imagick')) {\n self::watermark_imagick($img, $ext, $logo_path, $w_logo, $h_logo, $div_photo);\n return;\n }\n\n #now, lets work and detect our image extension\n if (strpos($ext, 'jpg') !== false || strpos($ext, 'jpeg') !== false) {\n $src_img = @imagecreatefromjpeg($img);\n } elseif (strpos($ext, 'png') !== false) {\n $src_img = @imagecreatefrompng($img);\n } elseif (strpos($ext, 'gif') !== false) {\n return;\n $src_img = @imagecreatefromgif($img);\n } else {\n return;\n }\n\n #detect width, height for the image\n $bwidth = @imageSX($src_img);\n $bheight = @imageSY($src_img);\n\n #detect width, height for the watermark image\n $lwidth = @imageSX($src_logo);\n $lheight = @imageSY($src_logo);\n\n\n if ($bwidth > $lwidth + 5 && $bheight > $lheight + 5) {\n #where exaxtly do we have to make the watermark ..\n $src_x = (($bwidth - ($lwidth + 5)) / $div_photo) * $w_logo;\n $src_y = (($bheight - ($lheight + 5)) / $div_photo) * $h_logo;\n\n #make it now, watermark it\n @ImageAlphaBlending($src_img, true);\n @ImageCopy($src_img, $src_logo, $src_x, $src_y, 0, 0, $lwidth, $lheight);\n\n if (strpos($ext, 'jpg') !== false || strpos($ext, 'jpeg') !== false) {\n @imagejpeg($src_img, $img);\n } elseif (strpos($ext, 'png') !== false) {\n @imagepng($src_img, $img);\n } elseif (strpos($ext, 'gif') !== false) {\n @imagegif($src_img, $img);\n } elseif (strpos($ext, 'bmp') !== false) {\n @imagebmp($src_img, $img);\n }\n } else {\n #image is not big enough to watermark it\n return false;\n }\n return true;\n }", "public function applyQrCodeAsWatermark($quality, $position)\n {\n if (!empty($this->files)) {\n foreach ($this->files as $key => $val) {\n \n $currentImageFilename = $this->picturesFolder . '/' . $val['picture'];\n $qrcode = $this->picturesFolder . '/' . $val['qrcode']; \n \n $this->watImage->setImage(array('file' => $currentImageFilename, 'quality' => $quality)); // file to use and export quality\n $this->watImage->setWatermark(array('file' => $qrcode, 'position' => $position)); // watermark to use and it's position\n $this->watImage->applyWatermark();\n if (!$this->watImage->generate($currentImageFilename)) {\n print_r($this->watImage->errors);\n } \n }\n }\n return true;\n }", "function imagecopymerge_alpha($dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h, $pct){\n // creating a cut resource \n $cut = imagecreatetruecolor($src_w, $src_h);\n\n // copying relevant section from background to the cut resource \n imagecopy($cut, $dst_im, 0, 0, $dst_x, $dst_y, $src_w, $src_h);\n\n // copying relevant section from watermark to the cut resource \n imagecopy($cut, $src_im, 0, 0, $src_x, $src_y, $src_w, $src_h);\n\n // insert cut resource to destination image \n imagecopymerge($dst_im, $cut, $dst_x, $dst_y, 0, 0, $src_w, $src_h, $pct);\n }", "function alpha($psdata, $src_img, &$size_x, &$size_y, &$image, &$mask) {\n $id = $this->generate_id();\n\n // Generate the unique temporary file name for this image; \n // we'll use it for imagemagick temporary files\n $tempfile = $psdata->mk_filename();\n\n // Save image as PNG for further processing\n imagepng($src_img, $tempfile.'.png');\n\n // Call image magick - convert to raw RGB samples (binary)\n safe_exec('\"'.IMAGE_MAGICK_CONVERT_EXECUTABLE.'\"'.\" ${tempfile}.png ${tempfile}.rgba\", $output);\n\n // read raw rgba samples\n $samples = file_get_contents($tempfile.'.rgba');\n\n // Determine image size\n $size_x = imagesx($src_img); \n $size_y = imagesy($src_img);\n \n // write stread header to the postscript file\n $psdata->write(\"/image-{$id}-init { image-{$id}-data 0 setfileposition } def\\n\");\n $psdata->write(\"/image-{$id}-data currentfile << /Filter /ASCIIHexDecode >> /ReusableStreamDecode filter\\n\");\n\n // initialize line length counter\n $ctr = 0;\n\n // Save visible background color\n $handler =& get_css_handler('background-color');\n $bg = $handler->get_visible_background_color();\n\n for ($i = 0; $i < strlen($samples); $i += 4) {\n // Save image pixel to the stream data\n $r = ord($samples{$i});\n $g = ord($samples{$i+1});\n $b = ord($samples{$i+2});\n $a = 255-ord($samples{$i+3});\n\n // Calculate approximate color \n $r = (int)($r + ($bg[0] - $r)*$a/255);\n $g = (int)($g + ($bg[1] - $g)*$a/255);\n $b = (int)($b + ($bg[2] - $b)*$a/255);\n\n // Save image pixel to the stream data\n $psdata->write(sprintf(\"%02X%02X%02X\",\n min(max($r,0),255),\n min(max($g,0),255),\n min(max($b,0),255)));\n\n // Increate the line length counter; check if stream line needs to be terminated\n $ctr += 6;\n if ($ctr > MAX_LINE_LENGTH) { \n $psdata->write(\"\\n\");\n $ctr = 0;\n }\n };\n\n // terminate the stream data\n $psdata->write(\">\\ndef\\n\");\n\n // return image and mask data references\n $image = \"image-{$id}-data\";\n $mask = \"\";\n\n // Delete temporary files \n unlink($tempfile.'.png');\n unlink($tempfile.'.rgba');\n\n return $id;\n }", "public function test_image_preserves_alpha() {\n\t\t$file = DIR_TESTDATA . '/images/transparent.png';\n\n\t\t$editor = new WP_Image_Editor_Imagick( $file );\n\n\t\t$this->assertNotInstanceOf( 'WP_Error', $editor );\n\n\t\t$editor->load();\n\n\t\t$save_to_file = tempnam( get_temp_dir(), '' ) . '.png';\n\n\t\t$editor->save( $save_to_file );\n\n\t\t$im = new Imagick( $save_to_file );\n\t\t$pixel = $im->getImagePixelColor( 0, 0 );\n\t\t$expected = $pixel->getColorValue( imagick::COLOR_ALPHA );\n\n\t\t$this->assertImageAlphaAtPointImagick( $save_to_file, array( 0, 0 ), $expected );\n\n\t\tunlink( $save_to_file );\n\t}", "public static function Watermark($mode, $in_file, $mid_file, $out_file, $format, $wm_file, $switch = true)\n {\n switch($mode)\n {\n case 'im':\n self::ImageMagickResize($in_file, $mid_file, $format);\n self::ImageMagickWatermark($mid_file, $out_file, $wm_file);\n break;\n case 'gd':\n self::GDResize($in_file, $mid_file, $format, $switch);\n self::GDWatermark($mid_file, $out_file, $wm_file);\n break;\n }\n }", "public function initialize(){\n\t\t\t$this->watermarkImage = \"img\" . DIRECTORY_SEPARATOR . \"watermark.png\";\n\t\t\t$this->errors = array();\n\t\t}", "public function test_image_preserves_alpha_on_resize() {\n\n\t\t$file = DIR_TESTDATA . '/images/transparent.png';\n\n\t\t$editor = wp_get_image_editor( $file );\n\t\t$editor->load();\n\t\t$editor->resize(5,5);\n\t\t$save_to_file = tempnam( get_temp_dir(), '' ) . '.png';\n\t\t\n\t\t$editor->save( $save_to_file );\n\n\t\t$this->assertImageAlphaAtPoint( $save_to_file, array( 0,0 ), 127 );\n\n\t}", "public function getPositions($padding){\n\t\t$imgSource = $this->getImgSizes($this->imgSource);\n\t\t$imgWatermark = $this->getImgSizes($this->imgWatermark);\n\t\t$positionX = 0;\n\t\t$positionY = 0;\n\n\t\t# Centered\n\t\tif($this->watermarkPosition == 0){\n\t\t\t$positionX = ( $imgSource['width'] / 2 ) - ( $imgWatermark['width'] / 2 );\n\t\t\t$positionY = ( $imgSource['height'] / 2 ) - ( $imgWatermark['height'] / 2 );\n\t\t}\n\n\t\t# Top Left\n\t\tif($this->watermarkPosition == 1){\n\t\t\t$positionX = $padding;\n\t\t\t$positionY = $padding;\n\t\t}\n\n\t\t# Top Right\n\t\tif($this->watermarkPosition == 2){\n\t\t\t$positionX = $imgSource['width'] - $imgWatermark['width'];\n\t\t\t$positionY = $padding;\n\t\t}\n\n\t\t# Footer Right\n\t\tif($this->watermarkPosition == 3){\n\t\t\t$positionX = ($imgSource['width'] - $imgWatermark['width']) - $padding;\n\t\t\t$positionY = ($imgSource['height'] - $imgWatermark['height']) - $padding;\n\t\t}\n\n\t\t# Footer left\n\t\tif($this->watermarkPosition == 4){\n\t\t\t$positionX = $padding;\n\t\t\t$positionY = $imgSource['height'] - $imgWatermark['height'];\n\t\t}\n\n\t\t# Top Centered\n\t\tif($this->watermarkPosition == 5){\n\t\t\t$positionX = ( ( $imgSource['height'] - $imgWatermark['width'] ) / 2 );\n\t\t\t$positionY = $padding;\n\t\t}\n\n\t\t# Center Right\n\t\tif($this->watermarkPosition == 6){\n\t\t\t$positionX = $imgSource['width'] - $imgWatermark['width'];\n\t\t\t$positionY = ( $imgSource['height'] / 2 ) - ( $imgWatermark['height'] / 2 );\n\t\t}\n\n\t\t# Footer Centered\n\t\tif($this->watermarkPosition == 7){\n\t\t\t$positionX = ( ( $imgSource['width'] - $imgWatermark['width'] ) / 2 );\n\t\t\t$positionY = $imgSource['height'] - $imgWatermark['height'];\n\t\t}\n\n\t\t# Center Left\n\t\tif($this->watermarkPosition == 8){\n\t\t\t$positionX = $padding;\n\t\t\t$positionY = ( $imgSource['height'] / 2 ) - ( $imgWatermark['height'] / 2 );\n\t\t}\n\n\t\treturn array('x' => $positionX, 'y' => $positionY);\n\t}", "public function setValue($value) {\n // Nevim jestli ma smysl definovat ty defaultni hodnoty jako atributy, pripadne v configu nebo vys\n $this->model->watermark_pos = arr::get($value, 'x', 0);\n// $this->model->watermark_y = arr::get($value, 'y', 0);\n $this->model->watermark_width = arr::get($value, 'width', 20);\n $this->model->watermark_opacity = arr::get($value, 'opacity', 50);\n \n // Nevolame parent::setValue($val), protoze tento prvek je virtuani (nevaze se primo na jeden atribut modelu)\n }", "function saveImageWithText($text, $color, $source_file,$x,$y) {\n $public_file_path = '.';\n\n // dublicate the realimage\n list($width, $height) = getimagesize($source_file);\n $image_p = imagecreatetruecolor($width, $height);\n $image = imagecreatefromjpeg($source_file);\n imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width, $height);\n\n // text size and colors\n $text_color = imagecolorallocate($image_p, 0, 0, 0);\n $bg_color = imagecolorallocate($image_p, 255, 255, 255);\n $font = $public_file_path . '/arial.ttf';\n $font_size = 12;\n\n // Set the text position\n $offset_x = $x;\n $offset_y = $y;\n $dims = imagettfbbox($font_size, 0, $font, $text);\n $text_width = $dims[4] - $dims[6] + $offset_x;\n $text_height = $dims[3] - $dims[5] + $offset_y;\n\n\n // Add text\n imagettftext($image_p, $font_size, 0, $offset_x, $offset_y, $text_color, $font, $text);\n\n // Save\n imagejpeg($image_p, $public_file_path . '/output.jpg', 100);\n\n // Clear\n imagedestroy($image);\n imagedestroy($image_p);\n}", "function resizeUpload($field,$pic_dir,$name_dir,$cropratio=NULL,$watermark=NULL,$max_width,$max_height,$add_to_filename=NULL, $quality=90){\r\n\t\tglobal $font_path, $font_size, $water_mark_text_1, $water_mark_text;\r\n\t\t$maxwidth = $max_width; // Max new width or height, can not exceed this value.\r\n\t\t$maxheight = $max_height;\r\n\t\t$dir = $pic_dir; // Directory to save resized image. (Include a trailing slash - /)\r\n\t\t// Collect the post variables.\r\n\t\t$postvars = array(\r\n\t\t\t\"image\" => trim($_FILES[\"$field\"][\"name\"]),\r\n\t\t\t\"image_tmp\" => $_FILES[\"$field\"][\"tmp_name\"],\r\n\t\t\t\"image_size\" => (int)$_FILES[\"$field\"][\"size\"],\r\n\t\t\t);\r\n\t\t\t// Array of valid extensions.\r\n\t\t\t$valid_exts = array(\"jpg\",\"jpeg\",\"gif\",\"png\");\r\n\t\t\t$mod_exts = array(\"gif\",\"png\");\r\n\t\t\t// Select the extension from the file.\r\n\t\t\t$ext = end(explode(\".\",strtolower(trim($_FILES[\"$field\"][\"name\"]))));\r\n\t\t\t//echo (\"Image size: \" . $postvars[\"image_size\"] . \"<br> Ext: \" . $ext . \"<br>\");\r\n\t\t\t// Check is valid extension.\r\n\t\t\tif(in_array($ext,$valid_exts)){\r\n\t\t\t\tif($ext == \"jpg\" || $ext == \"jpeg\"){\r\n\t\t\t\t\t$image = imagecreatefromjpeg($postvars[\"image_tmp\"]);\r\n\t\t\t\t}\r\n\t\t\t\telse if($ext == \"gif\"){\r\n\t\t\t\t\t$image = imagecreatefromgif($postvars[\"image_tmp\"]);\r\n\t\t\t\t}\r\n\t\t\t\telse if($ext == \"png\"){\r\n\t\t\t\t\t$image = imagecreatefrompng($postvars[\"image_tmp\"]);\r\n\t\t\t\t}\r\n\t\t\t\t// Grab the width and height of the image.\r\n\t\t\t\tlist($width,$height) = getimagesize($postvars[\"image_tmp\"]);\r\n\t\t\t\t// Ratio cropping\r\n\t\t\t\t$offsetX\t= 0;\r\n\t\t\t\t$offsetY\t= 0;\r\n\t\t\t\tif ($cropratio) {\r\n\t\t\t\t\t\t$cropRatio = explode(':', (string) $cropratio);\r\n\t\t\t\t\t\t$ratioComputed\t\t= $width / $height;\r\n\t\t\t\t\t\t$cropRatioComputed\t= (float) $cropRatio[0] / (float) $cropRatio[1];\r\n\t\t\t\t\t\tif ($ratioComputed < $cropRatioComputed)\r\n\t\t\t\t\t\t{ // Image is too tall so we will crop the top and bottom\r\n\t\t\t\t\t\t\t$origHeight\t= $height;\r\n\t\t\t\t\t\t\t$height\t\t= $width / $cropRatioComputed;\r\n\t\t\t\t\t\t\t$offsetY\t= ($origHeight - $height) / 2;\r\n\t\t\t\t\t\t\t$smallestSide = $width;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse if ($ratioComputed > $cropRatioComputed)\r\n\t\t\t\t\t\t{ // Image is too wide so we will crop off the left and right sides\r\n\t\t\t\t\t\t\t$origWidth\t= $width;\r\n\t\t\t\t\t\t\t$width\t\t= $height * $cropRatioComputed;\r\n\t\t\t\t\t\t\t$offsetX\t= ($origWidth - $width) / 2;\r\n\t\t\t\t\t\t\t$smallestSide = $height;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t// We get the other dimension by multiplying the quotient of the new width or height divided by\r\n\t\t\t\t// the old width or height.\r\n\t\t\t $w_adjust = ($maxwidth / $width);\r\n\t\t\t $h_adjust = ($maxheight / $height);\r\n\t\t\t if (($width >= $maxwidth)||($height >= $maxheight)) {\r\n\t\t\t\t if($w_adjust <= $h_adjust)\r\n\t\t\t\t {\r\n\t\t\t\t\t $newwidth=floor($width*$w_adjust);\r\n\t\t\t\t\t $newheight=floor($height*$w_adjust);\r\n\t\t\t\t } else {\r\n\t\t\t\t\t $newwidth=floor($width*$h_adjust);\r\n\t\t\t\t\t $newheight=floor($height*$h_adjust);\r\n\t\t\t\t }\r\n\t\t\t } else {\r\n\t\t\t\t \t$newwidth=$width;\r\n\t\t\t\t\t$newheight=$height;\r\n\t\t\t }\r\n\t\t\t\t// Create temporary image file.\r\n\t\t\t\t$tmp = imagecreatetruecolor($newwidth,$newheight);\r\n\t\t\t\t\r\n\t\t\t\t// Copy the image to one with the new width and height.\r\n\t\t\t\t\timagecopyresampled($tmp,$image,0,0,$offsetX,$offsetY,$newwidth,$newheight,$width,$height);\r\n\t\t\t\t\t// Create random 5 digit number for filename. Add to current timestamp.\r\n\t\t\t\t\t$rand = rand(10000,99999);\r\n\t\t\t\t\t$rand .= time();\r\n\t\t\t\t\t$origfilename = $name_dir.$rand ;\r\n if ($add_to_filename){ $origfilename .= \"_\".$add_to_filename; }\r\n $origfilename .= \".jpg\";\r\n\t\t\t\t\t\r\n\t\t\t\t\t$filename = $dir.$rand;\r\n if ($add_to_filename){ $filename .= \"_\".$add_to_filename; }\r\n $filename .= \".jpg\";\r\n\r\n\t\t\t\tif ($watermark) {\r\n\t\t\t\t\t//Apply watermark here\t\t\t\t\t\r\n\t\t\t\t\t$maroon = imagecolorallocate($tmp, 134, 22, 0);\r\n\t\t\t\t\t$white = imagecolorallocate($tmp, 255, 255, 255);\r\n\t\t\t\t\t/*$base_height = $newheight-20;\r\n\t\t\t\t\t$base_width = $newwidth/5;*/\r\n\t\t\t\t\t//$borderOffset = 4;\r\n\t\t\t\t\t$dimensions = imagettfbbox($font_size, 0, $font_path, $water_mark_text);\r\n\t\t\t\t\t$lineWidth = ($dimensions[2] - $dimensions[0]);\r\n\t\t\t\t\t$textX = (ImageSx($tmp) - $lineWidth) / 2;\r\n\t\t\t\t\t$textY = ($newheight/10)*9;\t\t\t\t\t\r\n\t\t\t\t // Add some shadow to the text\t\t\t\t\t\r\n\t\t\t\t\timagettftext($tmp, $font_size, 0, $textX+1,$textY+1, $white, $font_path, $water_mark_text);\r\n\t\t\t\t\timagettftext($tmp, $font_size, 0, $textX, $textY, $maroon, $font_path, $water_mark_text);\r\n\t\t\t\t}\t\t\t\t\t\t\t\r\n\r\n\t\t\t\t// Create image file with specified quality in % (low quality image in less image sharpness)\r\n\t\t\t\timagejpeg($tmp,$filename,$quality);\r\n\t\t\t\treturn $origfilename;\r\n\r\n\t\t\t\timagedestroy($image);\r\n\t\t\t\timagedestroy($tmp);\t\r\n\r\n\t\t\t}\r\n\r\n\t\r\n\r\n\t}", "public function rewrite_title_watermark( $title ) {\n\t\t$screen = get_current_screen();\n\n\t\tif ( $screen->post_type == $this->post_type ) {\n\t\t\t$title = $this->enter_title_here;\n\t\t}\n\n\t\treturn $title;\n\t}", "public function underlay($layer, $position = null, $blendMode = null)\n {\n $underlay = ClassUtils::forceInstance($layer, ImageOverlay::class, null, $position, $blendMode);\n $underlay->setStackPosition(LayerStackPosition::UNDERLAY);\n\n return $this->addAction($underlay);\n }", "public function execute($image)\n {\n $source = $this->argument(0)->required()->value();\n $position = $this->argument(1)->type('string')->value();\n $x = $this->argument(2)->type('digit')->value(0);\n $y = $this->argument(3)->type('digit')->value(0);\n\n // build watermark\n $watermark = $image->getDriver()->init($source);\n\n // define insertion point\n $image_size = $image->getSize()->align($position, $x, $y);\n $watermark_size = $watermark->getSize()->align($position);\n $target = $image_size->relativePosition($watermark_size);\n\n // insert image at position\n return $image->getCore()->compositeImage($watermark->getCore(), \\Imagick::COMPOSITE_DEFAULT, $target->x, $target->y);\n }", "function setMultipageWatermark($multipage_watermark) {\n if (!(filesize($multipage_watermark) > 0))\n throw new Error(create_invalid_value_message($multipage_watermark, \"multipage_watermark\", \"html-to-pdf\", \"The file must exist and not be empty.\", \"set_multipage_watermark\"), 470);\n \n $this->files['multipage_watermark'] = $multipage_watermark;\n return $this;\n }", "public function ImagePreserverTransparent($transparent){\r\n $this->image_transparent=$transparent;\r\n }", "abstract public function applyToImage(Image $image, $posx = 0, $posy = 0);", "abstract public function applyToImage(Image $image, $posx = 0, $posy = 0);", "public function applyMask($image)\n {\n $this->setForceAlpha(true)->saveIfRequired('mask');\n\n $image = PIMCORE_DOCUMENT_ROOT . \"/\" . ltrim($image, \"/\");\n\n $this->addConvertOption('alpha', 'off')->addConvertOption('compose', 'CopyOpacity')\n ->addConvertOption('composite')\n ->addFilter('alpha', $image);\n\n\n return $this;\n }", "public function rewrite_title_watermark($title)\r\n\t{\r\n\t\t$screen = get_current_screen();\r\n\r\n\t\tif ($screen->post_type == $this->_post_type) {\r\n\t\t\t$title = $this->_enter_title_here;\r\n\t\t}\r\n\r\n\t\treturn $title;\r\n\t}", "public function setOpacity($opacity) {}", "public function test_image_preserves_alpha_on_resize() {\n\t\t$file = DIR_TESTDATA . '/images/transparent.png';\n\n\t\t$editor = new WP_Image_Editor_Imagick( $file );\n\n\t\t$this->assertNotInstanceOf( 'WP_Error', $editor );\n\n\t\t$editor->load();\n\t\t$editor->resize( 5, 5 );\n\t\t$save_to_file = tempnam( get_temp_dir(), '' ) . '.png';\n\n\t\t$editor->save( $save_to_file );\n\n\t\t$im = new Imagick( $save_to_file );\n\t\t$pixel = $im->getImagePixelColor( 0, 0 );\n\t\t$expected = $pixel->getColorValue( imagick::COLOR_ALPHA );\n\n\t\t$this->assertImageAlphaAtPointImagick( $save_to_file, array( 0, 0 ), $expected );\n\n\t\tunlink( $save_to_file );\n\t}", "function setTransparency($new_image,$image_source) { \n $transparencyIndex = imagecolortransparent($image_source); \n $transparencyColor = array('red' => 255, 'green' => 255, 'blue' => 255); \n \n if ($transparencyIndex >= 0) { \n $transparencyColor = imagecolorsforindex($image_source, $transparencyIndex); \n } \n \n $transparencyIndex = imagecolorallocate($new_image, $transparencyColor['red'], $transparencyColor['green'], $transparencyColor['blue']); \n imagefill($new_image, 0, 0, $transparencyIndex); \n imagecolortransparent($new_image, $transparencyIndex); \n }", "public function getWatermark($text = false, $maximumWidth = NULL, $maximumHeight = NULL, $ratioMode = ImageInterface::RATIOMODE_INSET) {\n\n\t\t$processingInstructions = array(\n\t\t\tarray(\n\t\t\t\t'command' => 'thumbnail',\n\t\t\t\t'options' => array(\n\t\t\t\t\t'size' => array(\n\t\t\t\t\t\t'width' => intval($maximumWidth ?: $this->width),\n\t\t\t\t\t\t'height' => intval($maximumHeight ?: $this->height)\n\t\t\t\t\t),\n\t\t\t\t\t'mode' => $ratioMode\n\t\t\t\t),\n\t\t\t),\n\t\t);\n\t\treturn new ImageVariant($this, $processingInstructions);\n\n\t}", "public function store(Request $request)\n {\n $path_little = 'little images/';\n $path_original='original images/';\n $path_water='water images/';\n $file = $request->file('file');\n\n // save image, create little image, drawing watermark\n foreach ($file as $f) {\n $filename = str_random(20) .'.' . $f->getClientOriginalExtension() ?: 'png';\n $img = ImageInt::make($f);\n $img->save($path_original . $filename);\n $imgwater = ImageInt::make($f)->insert('watermark.png','center')->save($path_water . $filename);\n $img->resize(200,200)->save($path_little . $filename);\n Image::create(['title' => $request->title, 'img' => $filename]);\n }\n\n return redirect('home');\n }", "private function imagecopymerge_alpha($dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $opacity = 1, $rotate = 0, $color = 0){\n $src_w = imagesx($src_im);\n $src_h = imagesy($src_im);\n if ($rotate) {\n $transparent = imagecolorallocatealpha($src_im, 0, 0, 0, 127);\n\n $src_im = imagerotate($src_im, $rotate, $transparent);\n $dx = imagesx($src_im) - $src_w;\n $dy = imagesy($src_im) - $src_h;\n }else{\n $dx = $dy = 0;\n }\n\n // Creating a cut resource\n $cut = imagecreatetruecolor($src_w + $dx, $src_h + $dy);\n // Copying relevant section from background to the cut resource\n imagecopy($cut, $dst_im, 0, 0, $dst_x - round($dx / 2), $dst_y - round($dy / 2), $src_w + $dx, $src_h + $dy);\n // Copying relevant section from watermark to the cut resource\n imagecopy($cut, $src_im, 0, 0, $src_x, $src_y, $src_w + $dx, $src_h + $dy);\n // Insert cut resource to destination image\n imagecopymerge($dst_im, $cut, $dst_x - round($dx / 2), $dst_y - round($dy / 2), 0, 0, $src_w + $dx, $src_h + $dy, round($opacity * 100));\n // Destroy temporary image\n imagedestroy($cut);\n }", "function imageText($text, $font_file, $font_size = 12, $color = '#000000', $position = 'center', $x_offset = 0, $y_offset = 0, $stroke_color = null, $stroke_size = null, $alignment = null, $letter_spacing = 0) {\r\n $this->imageText = array(\"text\"=>$text, \"font_file\"=>$font_file, \"font_size\" =>$font_size, \"color\" => $color, \"position\" => $position, \"x_offset\" => $x_offset, \"y_offset\" => $y_offset, \"stroke_color\" => $stroke_color, \"stroke_size\" => $stroke_size, \"alignment\" => $alignment, \"letter_spacing\" => $letter_spacing);\r\n return $this;\r\n }", "public function overlay($layer, $position = null, $blendMode = null)\n {\n return $this->addAction(\n ClassUtils::verifyInstance(\n $layer,\n BasePositionalSourceContainer::class,\n ImageOverlay::class,\n $position,\n $blendMode\n )\n );\n }", "public function frontImage()\r\n {\r\n $wrapper = imagecreatetruecolor(16 * $this->ratio(), 32 * $this->ratio());\r\n $background = imagecolorallocatealpha($wrapper, 255, 255, 255, 127);\r\n imagefill($wrapper, 0, 0, $background);\r\n\r\n imagecopy($wrapper, $this->image, 4 * $this->ratio(), 0 * $this->ratio(), 8 * $this->ratio(),\r\n 8 * $this->ratio(), 8 * $this->ratio(), 8 * $this->ratio());\r\n //arms\r\n imagecopy($wrapper, $this->image, 0 * $this->ratio(), 8 * $this->ratio(), 44 * $this->ratio(),\r\n 20 * $this->ratio(), 4 * $this->ratio(), 12 * $this->ratio());\r\n $this->imageflip($wrapper, $this->image, 12 * $this->ratio(), 8 * $this->ratio(), 44 * $this->ratio(),\r\n 20 * $this->ratio(), 4 * $this->ratio(), 12 * $this->ratio());\r\n //chest\r\n imagecopy($wrapper, $this->image, 4 * $this->ratio(), 8 * $this->ratio(), 20 * $this->ratio(),\r\n 20 * $this->ratio(), 8 * $this->ratio(), 12 * $this->ratio());\r\n //legs\r\n imagecopy($wrapper, $this->image, 4 * $this->ratio(), 20 * $this->ratio(), 4 * $this->ratio(),\r\n 20 * $this->ratio(), 4 * $this->ratio(), 12 * $this->ratio());\r\n $this->imageflip($wrapper, $this->image, 8 * $this->ratio(), 20 * $this->ratio(), 4 * $this->ratio(),\r\n 20 * $this->ratio(), 4 * $this->ratio(), 12 * $this->ratio());\r\n //hat\r\n imagecopy($wrapper, $this->image, 4 * $this->ratio(), 0 * $this->ratio(), 40 * $this->ratio(),\r\n 8 * $this->ratio(), 8 * $this->ratio(), 8 * $this->ratio());\r\n\r\n return $wrapper;\r\n }", "function _add_image_data( $im ) {\n\t\t$width = imagesx( $im );\n\t\t$height = imagesy( $im );\n\t\t\n\t\t\n\t\t$pixel_data = array();\n\t\t\n\t\t$opacity_data = array();\n\t\t$current_opacity_val = 0;\n\t\t\n\t\tfor ( $y = $height - 1; $y >= 0; $y-- ) {\n\t\t\tfor ( $x = 0; $x < $width; $x++ ) {\n\t\t\t\t$color = imagecolorat( $im, $x, $y );\n\t\t\t\t\n\t\t\t\t$alpha = ( $color & 0x7F000000 ) >> 24;\n\t\t\t\t$alpha = ( 1 - ( $alpha / 127 ) ) * 255;\n\t\t\t\t\n\t\t\t\t$color &= 0xFFFFFF;\n\t\t\t\t$color |= 0xFF000000 & ( $alpha << 24 );\n\t\t\t\t\n\t\t\t\t$pixel_data[] = $color;\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t$opacity = ( $alpha <= 127 ) ? 1 : 0;\n\t\t\t\t\n\t\t\t\t$current_opacity_val = ( $current_opacity_val << 1 ) | $opacity;\n\t\t\t\t\n\t\t\t\tif ( ( ( $x + 1 ) % 32 ) == 0 ) {\n\t\t\t\t\t$opacity_data[] = $current_opacity_val;\n\t\t\t\t\t$current_opacity_val = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif ( ( $x % 32 ) > 0 ) {\n\t\t\t\twhile ( ( $x++ % 32 ) > 0 )\n\t\t\t\t\t$current_opacity_val = $current_opacity_val << 1;\n\t\t\t\t\n\t\t\t\t$opacity_data[] = $current_opacity_val;\n\t\t\t\t$current_opacity_val = 0;\n\t\t\t}\n\t\t}\n\t\t\n\t\t$image_header_size = 40;\n\t\t$color_mask_size = $width * $height * 4;\n\t\t$opacity_mask_size = ( ceil( $width / 32 ) * 4 ) * $height;\n\t\t\n\t\t\n\t\t$data = pack( 'VVVvvVVVVVV', 40, $width, ( $height * 2 ), 1, 32, 0, 0, 0, 0, 0, 0 );\n\t\t\n\t\tforeach ( $pixel_data as $color )\n\t\t\t$data .= pack( 'V', $color );\n\t\t\n\t\tforeach ( $opacity_data as $opacity )\n\t\t\t$data .= pack( 'N', $opacity );\n\t\t\n\t\t\n\t\t$image = array(\n\t\t\t'width' => $width,\n\t\t\t'height' => $height,\n\t\t\t'color_palette_colors' => 0,\n\t\t\t'bits_per_pixel' => 32,\n\t\t\t'size' => $image_header_size + $color_mask_size + $opacity_mask_size,\n\t\t\t'data' => $data,\n\t\t);\n\t\t\n\t\t$this->_images[] = $image;\n\t}", "public function register_settings() {\n\t\tif ( ! empty( $_GET['page'] ) && self::SLUG == $_GET['page'] && 'upload' == $this->settings['watermark_type'] && ! wp_attachment_is_image( $this->settings['watermark_attachment_id'] ) ) {\n\t\t\t$this->settings['watermark_type'] = $this->default_settings['watermark_type'];\n\n\t\t\t$option = (array) get_option( self::OPTION_NAME, array() );\n\t\t\t$option['watermark_type'] = $this->settings['watermark_type'];\n\t\t\tupdate_option( self::OPTION_NAME, $option );\n\t\t}\n\n\t\tadd_settings_section( 'wpcom-watermark-image-uploads_base', null, array( $this, 'settings_section_base_description' ), self::SLUG );\n\t\tadd_settings_section( 'wpcom-watermark-image-uploads_watermark-selection', __( 'Watermark Selection', 'wpcom-watermark-image-uploads' ), array( $this, 'settings_section_watermark_selection' ), self::SLUG );\n\n\t\t// Don't show this next bit to Enterprise users\n\t\tif ( ! $this->is_enterprise() ) {\n\t\t\tadd_settings_field( 'wpcom-watermark-image-uploads_watermark-selection_field-theme', $this->make_watermark_selection_title( 'From Your Theme', 'theme', ! $this->theme_watermark_exists() ), array( $this, 'settings_field_image_selection_from_theme' ), self::SLUG, 'wpcom-watermark-image-uploads_watermark-selection' );\n\t\t}\n\n\t\tif ( current_user_can( 'upload_files' ) ) {\n\t\t\tadd_settings_field( 'wpcom-watermark-image-uploads_watermark-selection_field-upload', $this->make_watermark_selection_title( 'Uploaded', 'upload' ), array( $this, 'settings_field_image_selection_from_upload' ), self::SLUG, 'wpcom-watermark-image-uploads_watermark-selection' );\n\t\t}\n\n\t\tadd_settings_field( 'wpcom-watermark-image-uploads_watermark-selection_field-none', $this->make_watermark_selection_title( 'No Watermark', 'none' ), '__return_false', self::SLUG, 'wpcom-watermark-image-uploads_watermark-selection' );\n\n\t\tregister_setting( self::OPTION_NAME, self::OPTION_NAME, array( $this, 'setting_sanitization' ) );\n\t}", "function voegToe()\n{\n echo \"<style> #foto{ opacity: 0.5%; fill-rule: alpha(opacity=50) } </style>\";\n\n}", "function insertarEstampa($urlimagen, $urlestampa)\n {\n $estampa = imagecreatefrompng($urlestampa);\n $im = imagecreatefromjpeg($urlimagen);\n // Establecer los márgenes para la estampa y obtener el alto/ancho de la imagen de la estampa\n $margen_dcho = 10;\n $margen_inf = 10;\n $sx = imagesx($estampa);\n $sy = imagesy($estampa);\n // Copiar la imagen de la estampa sobre nuestra foto usando los índices de márgen y el\n // ancho de la foto para calcular la posición de la estampa. \n imagecopy($im, $estampa, imagesx($im) - $sx - $margen_dcho, imagesy($im) - $sy - $margen_inf, 0, 0, imagesx($estampa), imagesy($estampa));\n // Imprimir y liberar memoria\n imagejpeg($im, $urlimagen);\n imagedestroy($im);\n }", "private function image_proses($upload_data) {\n\t\t$this->input->post('foto');\n\t\t$this->load->library('image_lib');\n\t\t\n $config['image_library'] = 'GD2';\n $config['source_image'] = 'assets/uploads/'.$upload_data['file_name'];\n $config['new_image'] = 'assets/results/'.$upload_data['raw_name'].'-done.jpg';\n\t\t\n $config['wm_type'] = 'overlay';\n $config['wm_overlay_path'] = 'assets/images/desain.png';\n $config['wm_opacity'] = '50';\n $config['wm_vrt_alignment'] = 'top'; \n $config['wm_hor_alignment'] = 'left';\n $config['wm_hor_offset'] = '10';\n $config['wm_vrt_offset'] = '10';\n\n $this->image_lib->initialize($config);\n\n if (!$this->image_lib->watermark()) {\n echo $this->image_lib->display_errors();\n }\n\t\t\n\t\t$data['file_name'] = $upload_data['raw_name'].'-resize.jpg';\n\n $this->load->view('result', $data);\n }", "function imagecustom($im, $text) {\n}", "protected function saveAlpha(Png $png, $flag)\n {\n if ($flag) {\n $png->alphaBlending(false);\n if (false == @imagesavealpha($png->getHandler(), $flag)) {\n throw new CanvasException(sprintf(\n 'Faild Saving The Alpha Channel Information To The Png Canvas \"%s\"'\n , (string) $this\n ));\n }\n }\n\n return $this;\n }", "function research_glyph($image, $label){\n return '<div class=\"glyph\">\n <div class=\"glyph-image\" style=\"background-image: url(\\'' . get_static_uri($image) . '\\');\"></div>\n <div class=\"glyph-label\">' . $label . '</div>\n </div>';\n}", "protected function _addParamToImage($img, $name, $text)\r\n\t{\r\n\t\t$config = $this->getConfig()->getChildren(\"image\")->getChildren($name);\r\n\t\tif(!$config->getInteger(\"show\"))\r\n\t\t{\r\n\t\t\treturn $img;\r\n\t\t}\r\n\t\t$color = $this->getColor($name, $img);\r\n\t\t$shColor = $this->getShadowColor($name, $img);\r\n\t\tif($config->getInteger(\"show\") && $config->getInteger(\"shadow\"))\r\n\t\t{\r\n\t\t\timagettftext($img, $config->getInteger(\"size\"), 0, $this->getShadowCoord(\"x\", $config), $this->getShadowCoord(\"y\", $config), $shColor, $this->getFont($config), $text);\r\n\t\t}\r\n\t\timagettftext($img, $config->getInteger(\"size\"), 0, $config->getInteger(\"x\"), $config->getInteger(\"y\"), $color, $this->getFont($config), $text);\r\n\t\treturn $img;\r\n\t}", "public function store(Request $request)\n {\n\t\t$user = Auth::user();\n\t\t\n\t\t$input = $request->all();\n\t\t$path2 = 'default_profile.png';\n\t\t\n\t\t$images = array();\n\t\t\n\t\t$path = array();\n\t\t\n\t\t$path[0] = 'no_image.svg';\n\n\t\t$storage_path = \"../storage/app/public/\";\n\t\t$save_path = \"image/product/\";\n\n\t\t$watermark = Image::make(storage_path('../storage/app/public/image/homepage/watermark_50.png'));\n\t\t\n\t\tif($files = $request->file('images')){\n\t\t\t$i = 0;\n\t\t\tforeach($files as $key => $file){\n\t\t\t\tif ($file->isValid()) {\n\n\t\t\t\t\t// 이미지 회전 후 저장\n\t\t\t\t\t$rotate = $request->{'img_rotate'.($i + 1)} * -1;\n\t\t\t\t\t$img = InterventionImage::make($files[$i]);\n\n\t\t\t\t\tif($img->width() >= 1000){\n\t\t\t\t\t\t$img->resize(700, null, function ($constraint) {\n\t\t\t\t\t\t\t$constraint->aspectRatio(); //비율유지\n\t\t\t\t\t\t})->rotate($rotate)->encode('jpg');\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$img->rotate($rotate)->encode('jpg');\n\t\t\t\t\t}\n\n\t\t\t\t\t//#1\n\t\t\t\t\t$watermarkSize = $img->width() - 20; //size of the image minus 20 margins\n\t\t\t\t\t//#2\n\t\t\t\t\t$watermarkSize = $img->width() / 2; //half of the image size\n\t\t\t\t\t//#3\n\t\t\t\t\t$resizePercentage = 70;//70% less then an actual image (play with this value)\n\n\t\t\t\t\t$watermarkSize = round($img->width() * ((100 - $resizePercentage) / 100), 2);\n\n\t\t\t\t\t// resize watermark width keep height auto\n\t\t\t\t\t$watermark->resize($watermarkSize, null, function ($constraint) {\n\t\t\t\t\t\t$constraint->aspectRatio();\n\t\t\t\t\t});\n\n\t\t\t\t\t$hash = md5($img->__toString(). time());\n\t\t\t\t\t$path[$i] = $storage_path.$save_path.$hash.\".jpg\";\n\n\t\t\t\t\t//insert resized watermark to image center aligned\n\t\t\t\t\t$img->insert($watermark, 'center');\n\n\t\t\t\t\t$img->save($path[$i]);\n\n\t\t\t\t\t$path[$i] = '/'.str_replace($storage_path.$save_path,\"\",$path[$i]);\n\n\t\t\t\t\t$i++;\n\t\t\t\t}\t\n\t\t\t}\n\t\t}\n\n\t\t$save_path2 = \"image/\";\n\t\t\n\t\tif($request->hasFile('artist_img')){\n\t\t\tif ($request->file('artist_img')->isValid()) {\n\n\t\t\t\t// 이미지 회전 후 저장\n\t\t\t\t$rotate = $request->img_rotate_artist * -1;\n\t\t\t\t$img = InterventionImage::make($request->file('artist_img'));\n\n\t\t\t\tif($img->width() >= 100){\n\t\t\t\t\t$img->resize(100, null, function ($constraint) {\n\t\t\t\t\t\t$constraint->aspectRatio(); //비율유지\n\t\t\t\t\t})->rotate($rotate)->encode('jpg');\n\t\t\t\t}else{\n\t\t\t\t\t$img->rotate($rotate)->encode('jpg');\n\t\t\t\t}\n\n\t\t\t\t$hash = md5($img->__toString(). time());\n\t\t\t\t$path2 = $storage_path.$save_path2.$hash.\".jpg\";\n\t\t\t\t$img->save($path2);\n\n\t\t\t\t$path2 = '/'.str_replace($storage_path.$save_path2,\"\",$path2);\n\t\t\t}\n\t\t}\n\n\t\t$betting_set = DB::table('tlca_batting_set')->first(); \n\t\t\n\t\t$art_date = $request->input('date_y').$request->input('date_m').$request->input('date_d');\n\t\t\n\t\tdate_default_timezone_set(\"Asia/Seoul\");\n\t\t\n\t\t$start_batting_day = date(\"Y/m/d\",strtotime($betting_set->end_time.\" +1 days\"));\n\t\t$end_batting_day = date(\"Y/m/d\",strtotime($start_batting_day.\" +\".($betting_set->batting_term - 1).\" days\"));\n\t\t\n\t\t$ca_use = Category::where('id', $request->input('category'))->first()->ca_use;\n\t\tinfo(str_replace(',', '', $request->input('coin_price')));\n\n\t\t$today = date(\"Y-m-d\");\n\t\tif( $request->input('batting_yn') == 1){\n\t\t\tProduct::create([\n\t \t'title' => $request->input('title'),\n\t \t'seller_id' => $user->id,\n\t \t'artist_img' => $path2,\n\t \t'artist_name' => $request->input('artist_name'),\n\t \t'artist_intro' => $request->input('artist_intro'),\n\t \t'artist_career' => $request->input('artist_career'),\n\t \t'image1' => $path[0],\n\t \t'image2' => isset($path[1])?$path[1]:NULL,\n\t \t'image3' => isset($path[2])?$path[2]:NULL,\n\t \t'image4' => isset($path[3])?$path[3]:NULL,\n\t \t'image5' => isset($path[4])?$path[4]:NULL,\n\t \t'introduce' => $request->input('introduce'),\n\t \t'art_width_size' => $request->input('art_width_size'),\n\t \t'art_height_size' => $request->input('art_height_size'),\n\t \t'art_date' => $art_date,\n\t \t'ca_id' => $request->input('category'),\n\t \t'ca_use' => $ca_use,\n\t\t\t\t'coin_price' => str_replace(',', '', $request->input('coin_price')),\n\t\t\t\t'cash_price' => str_replace(',', '', $request->input('cash_price')),\n\t\t\t\t'delivery_price' => str_replace(',', '', $request->input('delivery_price')),\n\t \t'batting_yn' => $request->input('batting_yn'),\n\t \t'start_time' => $start_batting_day,\n\t\t\t\t'end_time' => $end_batting_day,\n\t\t\t\t'created_at' => $today,\n\t\t\t\t'updated_at' => $today\n\t ]);\t\n\t\t}else{\n\t\t\tProduct::create([\n\t \t'title' => $request->input('title'),\n\t \t'seller_id' => $user->id,\n\t \t'artist_img' => $path2,\n\t \t'artist_name' => $request->input('artist_name'),\n\t \t'artist_intro' => $request->input('artist_intro'),\n\t \t'artist_career' => $request->input('artist_career'),\n\t \t'image1' => $path[0],\n\t \t'image2' => isset($path[1])?$path[1]:NULL,\n\t \t'image3' => isset($path[2])?$path[2]:NULL,\n\t \t'image4' => isset($path[3])?$path[3]:NULL,\n\t \t'image5' => isset($path[4])?$path[4]:NULL,\n\t \t'introduce' => $request->input('introduce'),\n\t \t'art_width_size' => $request->input('art_width_size'),\n\t \t'art_height_size' => $request->input('art_height_size'),\n\t \t'art_date' => $art_date,\n\t \t'ca_id' => $request->input('category'),\n\t \t'ca_use' => $ca_use,\n\t\t\t\t'coin_price' => str_replace(',', '', $request->input('coin_price')),\n\t\t\t\t'cash_price' => str_replace(',', '', $request->input('cash_price')),\n\t\t\t\t'delivery_price' => str_replace(',', '', $request->input('delivery_price')),\n\t\t\t\t'created_at' => $today,\n\t\t\t\t'updated_at' => $today\n\t ]);\t\n\t\t}\n\n\t\tUser::where('id',$user->id)->update([\n\t\t\t'level' => '2',\n\t\t]);\n\t\t\n\t\tif($this->device == 'pc'){\n\t\t\treturn redirect(route('mypage.myart_list'));\n\t\t}else{\n\t\t\treturn redirect(route('mypage.mobile_mypage',['index' => 1]));\n\t\t}\n }", "public function setConstantOpacity($opacity) {}", "function __write(&$image) {\r\r\n\t\tasido::trigger_abstract_error(\r\r\n\t\t\t__CLASS__,\r\r\n\t\t\t__FUNCTION__\r\r\n\t\t\t);\r\r\n\t\t}" ]
[ "0.8594125", "0.775226", "0.7401763", "0.73029447", "0.73026496", "0.7153652", "0.7117748", "0.69545376", "0.6895416", "0.6851341", "0.68019307", "0.6738347", "0.67224705", "0.66621417", "0.6597992", "0.65832454", "0.6577887", "0.6549959", "0.652484", "0.64720017", "0.6461848", "0.6437693", "0.6366577", "0.635816", "0.627154", "0.6258353", "0.6182532", "0.6126844", "0.6053623", "0.60343975", "0.60324985", "0.6011154", "0.5956145", "0.59025794", "0.5853778", "0.5835987", "0.58062065", "0.57498884", "0.56352633", "0.5603714", "0.5578549", "0.5551876", "0.5532891", "0.5532849", "0.5529177", "0.55214417", "0.55185884", "0.5509605", "0.536886", "0.5323464", "0.53196454", "0.52739626", "0.52303845", "0.5085921", "0.5080141", "0.50080425", "0.50076133", "0.49819422", "0.49616063", "0.4878147", "0.48678815", "0.48312315", "0.47964153", "0.47646132", "0.47456017", "0.47165486", "0.46944043", "0.4693901", "0.4654074", "0.46395963", "0.46039885", "0.45904624", "0.45466003", "0.45463964", "0.45321676", "0.45287296", "0.45287296", "0.45199287", "0.45105785", "0.45056993", "0.44606107", "0.44331455", "0.44206437", "0.43920806", "0.43912548", "0.43764585", "0.43705752", "0.43375733", "0.43321663", "0.4326292", "0.42948055", "0.42358303", "0.41637373", "0.4156893", "0.41537943", "0.4146724", "0.411407", "0.41111025", "0.4101523", "0.40997624" ]
0.8034334
1
Set the background color of an image. This is only useful for images with alpha transparency. // Make the image background black $image>background('000'); // Make the image background black with 50% opacity $image>background('000', 50);
public function background($color, $opacity = 100) { if ($color[0] === '#') { // Remove the pound $color = substr($color, 1); } if (strlen($color) === 3) { // Convert shorthand into longhand hex notation $color = preg_replace('/./', '$0$0', $color); } // Convert the hex into RGB values list ($r, $g, $b) = array_map('hexdec', str_split($color, 2)); // The opacity must be in the range of 0 to 100 $opacity = min(max($opacity, 0), 100); $this->_do_background($r, $g, $b, $opacity); return $this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function set_background_color()\n {\n imagecolorallocate(\n $this->img,\n L_BACKGROUND_COLOR_R,\n L_BACKGROUND_COLOR_G,\n L_BACKGROUND_COLOR_B\n );\n }", "public static function background($value)\n {\n self::$background = Color::toRGBA($value);\n }", "protected function setTransparencyColor():void{\n\n\t\tif(!$this->options->imageTransparent){\n\t\t\treturn;\n\t\t}\n\n\t\t$transparencyColor = $this->background;\n\n\t\tif($this::moduleValueIsValid($this->options->transparencyColor)){\n\t\t\t$transparencyColor = $this->prepareModuleValue($this->options->transparencyColor);\n\t\t}\n\n\t\t$this->imagick->transparentPaintImage($transparencyColor, 0.0, 10, false);\n\t}", "public function background($value) {\n return $this->setProperty('background', $value);\n }", "public function background($value) {\n return $this->setProperty('background', $value);\n }", "public function background($value) {\n return $this->setProperty('background', $value);\n }", "public function background($value) {\n return $this->setProperty('background', $value);\n }", "public function setBackgroundColor($backgroundColor) {}", "public function setBackgroundImage($url);", "public function background($color, $quality=null);", "protected function setTransparencyColor():void{\n\n\t\tif($this->options->outputType === QROutputInterface::GDIMAGE_JPG || !$this->options->imageTransparent){\n\t\t\treturn;\n\t\t}\n\n\t\t$transparencyColor = $this->background;\n\n\t\tif($this::moduleValueIsValid($this->options->transparencyColor)){\n\t\t\t$transparencyColor = $this->prepareModuleValue($this->options->transparencyColor);\n\t\t}\n\n\t\timagecolortransparent($this->image, $transparencyColor);\n\t}", "function background_color()\n {\n }", "public function background($color)\n {\n $this->background = $color;\n }", "private function setBackground($width, $height)\n {\n list($r, $g, $b, $a) = self::$background;\n\n $color = imagecolorallocate($this->image, $r, $g, $b);\n\n if ($a === 0) {\n imagecolortransparent($this->image, $color);\n }\n\n imagefilledrectangle($this->image, 0, 0, $width, $height, $color);\n }", "function setBackground($c1 = 0xEEEEEE, $c2 = false)\n {\n if ($c2 === false) {\n $c2 = $c1;\n }\n $this->bg1 = $this->hexcol($c1);\n $this->bg2 = $this->hexcol($c2);\n }", "function setBackground($c1 = 0xEEEEEE, $c2 = false)\n {\n if ($c2 === false) {\n $c2 = $c1;\n }\n $this->bg1 = $this->hexcol($c1);\n $this->bg2 = $this->hexcol($c2);\n }", "function show_background_color()\r\n\t\t{\r\n\t\t\t$image = get_background_image();\r\n\t\t\t/* If there's an image, just call the normal WordPress callback. We won't do anything here. */\r\n\t\t\tif ( !empty( $image ) ) {\r\n\t\t\t\t_custom_background_cb();\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\t/* Get the background color. */\r\n\t\t\t$color = get_background_color();\r\n\t\t\t/* If no background color, return. */\r\n\t\t\tif ( empty( $color ) )\r\n\t\t\t\treturn;\r\n\t\t\t/* Use 'background' instead of 'background-color'. */\r\n\t\t\t$style = \"background: #{$color};\";\r\n\t\t?>\r\n\t\t\t<style type=\"text/css\">\r\n\t\t\t\tbody.custom-background {\r\n\t\t\t\t\t<?php echo trim( $style );?>\r\n\t\t\t\t}\r\n\t\t\t</style>\r\n\t\t<?php\r\n\t\t}", "public function imageBackgroundColor($color)\n {\n $this->imageBackgroundColor = $color;\n\n return $this;\n }", "public function bg($value)\n {\n $this->args = array_merge($this->args, ['bg' => $value]);\n\n return $this;\n }", "function get_background_color()\n {\n }", "protected function setBgColor():void{\n\n\t\tif(isset($this->background)){\n\t\t\treturn;\n\t\t}\n\n\t\tif($this::moduleValueIsValid($this->options->bgColor)){\n\t\t\t$this->background = $this->prepareModuleValue($this->options->bgColor);\n\n\t\t\treturn;\n\t\t}\n\n\t\t$this->background = $this->prepareModuleValue([255, 255, 255]);\n\t}", "function imagesetstyle($image, $style)\n{\n}", "function background_image()\n {\n }", "public function setBackgroundColor($color) {}", "public static function edit_image()\n{\n\n\n\t/*\n\t* Change Background\n\t*/\n\n\t/*\n\t* Change other setting\n\t*/\n}", "public function setBackground(string $value)\n {\n $this->styles['background-color'] = HtmlBuilder::validateColor($value);\n }", "function setTransparency($new_image,$image_source) { \n $transparencyIndex = imagecolortransparent($image_source); \n $transparencyColor = array('red' => 255, 'green' => 255, 'blue' => 255); \n \n if ($transparencyIndex >= 0) { \n $transparencyColor = imagecolorsforindex($image_source, $transparencyIndex); \n } \n \n $transparencyIndex = imagecolorallocate($new_image, $transparencyColor['red'], $transparencyColor['green'], $transparencyColor['blue']); \n imagefill($new_image, 0, 0, $transparencyIndex); \n imagecolortransparent($new_image, $transparencyIndex); \n }", "public function setBackgroundColor($var)\n {\n GPBUtil::checkInt32($var);\n $this->backgroundColor = $var;\n\n return $this;\n }", "protected function _do_background($r, $g, $b, $opacity)\n {\n $this->_load_image();\n\n // Convert an opacity range of 0-100 to 127-0\n $opacity = round(abs(($opacity * 127 / 100) - 127));\n\n // Create a new background\n $background = $this->_create($this->width, $this->height);\n\n // Allocate the color\n $color = imagecolorallocatealpha($background, $r, $g, $b, $opacity);\n\n // Fill the image with white\n imagefilledrectangle($background, 0, 0, $this->width, $this->height, $color);\n\n // Alpha blending must be enabled on the background!\n imagealphablending($background, TRUE);\n\n // Copy the image onto a white background to remove all transparency\n if (imagecopy($background, $this->_image, 0, 0, 0, 0, $this->width, $this->height))\n {\n // Swap the new image for the old one\n imagedestroy($this->_image);\n $this->_image = $background;\n }\n }", "public function setColorBackground(int $r, int $g, int $b) : void\n\t{\n\t\t$this->colorBackground = imagecolorallocate($this->im, $r, $g, $b);\n\t\timagefill($this->im, 0, 0, $this->colorBackground);\n\t}", "protected function setBgColor():void{\n\n\t\tif(isset($this->background)){\n\t\t\treturn;\n\t\t}\n\n\t\tif($this::moduleValueIsValid($this->options->bgColor)){\n\t\t\t$this->background = $this->prepareModuleValue($this->options->bgColor);\n\n\t\t\treturn;\n\t\t}\n\n\t\t$this->background = $this->prepareModuleValue('white');\n\t}", "public function updateBackgroundImage($image) {\n\t\t//Argument 1 must be a string\n\t\tEden_Twitter_Error::i()->argument(1, 'string');\n\t\t\n\t\t$this->_query['image'] = $image;\n\t\t\n\t\treturn $this->_upload(self::URL_UPDATE_BACKGROUND, $this->_query);\n\t}", "function kickstart_background_callback() {\n if ( ! get_background_color() ) {\n return;\n }\n printf( '<style>body { background-color: #%s; }</style>' . \"\\n\", get_background_color() );\n}", "function bgimg($img){\n\treturn \"background: url('\".$img.\"'); background-size: cover; background-position: 0 50%;\";\n}", "protected function applyBackgroundTransparency($file, $width, $height)\n { \n imagealphablending($file, false);\n imagesavealpha($file, true);\n imagefilledrectangle($file, 0, 0, $width, $height, $this->transparentBackground($file));\n }", "function remove_custom_background()\n {\n }", "public function colorImage() {}", "function shell_custom_background(){\r\n\r\n\t\t/* Custom Background */\r\n\t\tadd_theme_support( 'custom-background', array( 'default-color' => 'f9f9f9' ) );\r\n\t}", "function modshrink_s_register_custom_background() {\n\t$args = array(\n\t\t'default-color' => 'ffffff',\n\t\t'default-image' => '',\n\t);\n\n\t$args = apply_filters( 'modshrink_s_custom_background_args', $args );\n\n\tif ( function_exists( 'wp_get_theme' ) ) {\n\t\tadd_theme_support( 'custom-background', $args );\n\t} else {\n\t\tdefine( 'BACKGROUND_COLOR', $args['default-color'] );\n\t\tif ( ! empty( $args['default-image'] ) )\n\t\t\tdefine( 'BACKGROUND_IMAGE', $args['default-image'] );\n\t\tadd_custom_background();\n\t}\n}", "public function backgroundColor(array $color);", "public function setBackgroundColor($color)\n {\n //create canvas\n $canvas = $this->generateCanvas($this->getWidth(), $this->getHeight(), $color);\n\n //merge the background canvas with the main picture\n $this->mergeImage($canvas);\n\n return $this;\n }", "function fanwood_custom_background_callback() {\n\n\t/* Get the background image. */\n\t$image = get_background_image();\n\n\t/* If there's an image, just call the normal WordPress callback. We won't do anything here. */\n\tif ( !empty( $image ) ) {\n\t\t_custom_background_cb();\n\t\treturn;\n\t}\n\n\t/* Get the background color. */\n\t$color = get_background_color();\n\n\t/* If no background color, return. */\n\tif ( empty( $color ) )\n\t\treturn;\n\n\t/* Use 'background' instead of 'background-color'. */\n\t$style = \"background: #{$color};\";\n\n?>\n<style type=\"text/css\">body.custom-background { <?php echo trim( $style ); ?> }</style>\n<?php\n\n}", "protected function image_create($background = null)\r\n {\r\n // Check for GD2 support\r\n if ( ! \\function_exists('imagegd2') ) \\Core::show_500(\\__('captcha.requires_GD2'));\r\n\r\n // Create a new image (black)\r\n static::$image = \\imagecreatetruecolor(static::$config['width'], static::$config['height']);\r\n\r\n // Use a background image\r\n if ( !empty($background) )\r\n {\r\n /*\r\n // Create the image using the right function for the filetype\r\n $function = '\\\\imagecreatefrom' . static::image_type($filename);\r\n static::$background_image = $function($background);\r\n\r\n // Resize the image if needed\r\n if ( \\imagesx(static::background_image) !== static::$config['width'] || \\imagesy(static::background_image) !== static::$config['height'] )\r\n {\r\n \\imagecopyresampled(static::image, static::background_image, 0, 0, 0, 0, static::$config['width'], static::$config['height'], \\imagesx(static::background_image), \\imagesy(static::background_image));\r\n }\r\n\r\n // Free up resources\r\n \\imagedestroy(static::background_image);\r\n */\r\n }\r\n }", "function featuredBG($size = 'full', $pos_x = 'center', $pos_y = 'center', $repeat = 'no-repeat'){\n $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), $size );\n $url = $thumb['0'];\n echo 'style=\"background: url('. $url .')'. $pos_x .' '. $pos_y .' ' . $repeat .'\"';\n}", "public function setBackgroundColor($background) {\n\t\t//Argument 3 must be a string\n\t\tEden_Twitter_Error::i()->argument(1, 'string');\n\t\t$this->_query['profile_background_color'] = $backgroud;\n\t\t\n\t\treturn $this;\n\t}", "public function ImagePreserverTransparent($transparent){\r\n $this->image_transparent=$transparent;\r\n }", "public function setBackgroundImage($image, $mode = null, $relativePath = false)\n {\n $imagePath = $relativePath ?\n PIMCORE_DOCUMENT_ROOT . \"/\" . ltrim($image, \"/\")\n : $image;\n\n if (is_file($imagePath)) {\n //if a specified file as a background exists\n //creates the temp file for the background\n $newImage = $this->createTmpImage($imagePath, 'background');\n if ($mode == \"cropTopLeft\") {\n //crop the background image\n $newImage->crop(0, 0, $this->getWidth(), $this->getHeight());\n } else {\n // default behavior (fit)\n $newImage->resize($this->getWidth(), $this->getHeight());\n }\n $newImage->save($newImage->getOutputPath());\n\n //save current state of the thumbnail to the tmp file\n $this->saveIfRequired('gravity');\n\n //save the current state of the file (with a background)\n $this->compositeCommandOptions = [];\n $this->addCompositeOption('gravity', 'center ' . $this->getOutputPath() . ' ' . $newImage->getOutputPath() . ' ' . $this->getOutputPath());\n $this->processCommand($this->getCompositeCommand());\n $this->imagePath = $this->getOutputPath();\n }\n\n\n return $this;\n }", "function gcb_custom_background() {\r\n\tadd_custom_background( apply_filters( 'gcb_args' , 'gcb_do_theme_background' ) );\t\r\n}", "function get_background_image()\n {\n }", "function bethel_get_default_background_args() {\n\treturn array ('default-color' => '#f5f5f5',\n\t\t\t\t 'default-image' => get_stylesheet_directory_uri().'/images/background.jpg',\n\t\t\t\t 'default-repeat' => 'repeat'\n\t );\n}", "function alpha($psdata, $src_img, &$size_x, &$size_y, &$image, &$mask) {\n $id = $this->generate_id();\n\n // Generate the unique temporary file name for this image; \n // we'll use it for imagemagick temporary files\n $tempfile = $psdata->mk_filename();\n\n // Save image as PNG for further processing\n imagepng($src_img, $tempfile.'.png');\n\n // Call image magick - convert to raw RGB samples (binary)\n safe_exec('\"'.IMAGE_MAGICK_CONVERT_EXECUTABLE.'\"'.\" ${tempfile}.png ${tempfile}.rgba\", $output);\n\n // read raw rgba samples\n $samples = file_get_contents($tempfile.'.rgba');\n\n // Determine image size\n $size_x = imagesx($src_img); \n $size_y = imagesy($src_img);\n \n // write stread header to the postscript file\n $psdata->write(\"/image-{$id}-init { image-{$id}-data 0 setfileposition } def\\n\");\n $psdata->write(\"/image-{$id}-data currentfile << /Filter /ASCIIHexDecode >> /ReusableStreamDecode filter\\n\");\n\n // initialize line length counter\n $ctr = 0;\n\n // Save visible background color\n $handler =& get_css_handler('background-color');\n $bg = $handler->get_visible_background_color();\n\n for ($i = 0; $i < strlen($samples); $i += 4) {\n // Save image pixel to the stream data\n $r = ord($samples{$i});\n $g = ord($samples{$i+1});\n $b = ord($samples{$i+2});\n $a = 255-ord($samples{$i+3});\n\n // Calculate approximate color \n $r = (int)($r + ($bg[0] - $r)*$a/255);\n $g = (int)($g + ($bg[1] - $g)*$a/255);\n $b = (int)($b + ($bg[2] - $b)*$a/255);\n\n // Save image pixel to the stream data\n $psdata->write(sprintf(\"%02X%02X%02X\",\n min(max($r,0),255),\n min(max($g,0),255),\n min(max($b,0),255)));\n\n // Increate the line length counter; check if stream line needs to be terminated\n $ctr += 6;\n if ($ctr > MAX_LINE_LENGTH) { \n $psdata->write(\"\\n\");\n $ctr = 0;\n }\n };\n\n // terminate the stream data\n $psdata->write(\">\\ndef\\n\");\n\n // return image and mask data references\n $image = \"image-{$id}-data\";\n $mask = \"\";\n\n // Delete temporary files \n unlink($tempfile.'.png');\n unlink($tempfile.'.rgba');\n\n return $id;\n }", "private function _setTransparency($color) {\r\n\t\t// Define a color as transparent\r\n\t\timagecolortransparent($this->_resource, $color);\r\n\t\t\r\n\t\t// Enable alpha-blending and save that information\r\n\t\timagealphablending($this->_resource, true);\r\n\t\timagesavealpha($this->_resource, true);\r\n\t}", "function gs_background_markup( $color = '', $opacity = 1 ) {\n\n\t$rtn = '';\n\n\tif ( ! ( '' === $color ) ) {\n\t\t$rgba = 'rgba(' . hex2rgb( $color ) . ',' . $opacity . ')';\n\t\t$rtn .= 'linear-gradient(' . $rgba . ',' . $rgba . ')'; //no-repeat center center/cover\n\n\t\treturn 'background-image: ' . $rtn;\n\t}\n\n\treturn $rtn;\n}", "public function setBgImage($image, $repeat = StyleConstants::REPEAT,\n\t\t\t\t\t\t\t\t$position = -1) {\n\t\t$file = fopen($image, 'r');\n\t\tif (!$file) {\n\t\t\tthrow new StyleException('Cannot open image');\n\t\t}\n\t\tswitch($repeat) {\n\t\t\tcase StyleConstants::REPEAT:\n\t\t\t\t$repeat = 'repeat';break;\n\t\t\tcase StyleConstants::NO_REPEAT:\n\t\t\t\t$repeat = 'no-repeat';break;\n\t\t\tcase StyleConstants::STRETCH:\n\t\t\t\t$repeat = 'stretch';break;\n\t\t\tdefault:\n\t\t\t\tthrow new StyleException('Invalid repeat value');\n\t\t}\n\t\tswitch($position) {\n\t\t\tcase -1:\n\t\t\t\tbreak;\n\t\t\tcase StyleConstants::LEFT:\n\t\t\t\t$position = 'left';break;\n\t\t\tcase StyleConstants::RIGHT:\n\t\t\t\t$position = 'right';break;\n\t\t\tcase StyleConstants::CENTER:\n\t\t\t\t$position = 'center';break;\n\t\t\tcase StyleConstants::TOP:\n\t\t\t\t$position = 'top';break;\n\t\t\tcase StyleConstants::BOTTOM:\n\t\t\t\t$position = 'left';break;\n\t\t\tdefault:\n\t\t\t\tthrow new StyleException('Invalid background-position value');\n\t\t}\n\t\t$dataImg = fread($file, filesize($image));\n\t\t$dateImgB64 = base64_encode($dataImg);\n\t\tfclose($file);\n\t\t$binaryElement = $this->contentDocument->createElement('office:binary-data', $dateImgB64);\n\t\t$imageElement = $this->contentDocument->createElement('style:background-image');\n\t\t$imageElement->setAttribute('style:repeat', $repeat);\n\t\tif ($position != -1) {\n\t\t\t$imageElement->setAttribute('style:position', $position);\n\t\t}\n\t\t$imageElement->appendChild($binaryElement);\n\t\t$this->tableProp->appendChild($imageElement);\n\t}", "protected function drawChartImageBackground( &$image ){\n\n\t\tforeach ( $this->testResultRanges as $key => $testResultRange) {\n\n\t\t\t$lastX = NULL;\n\t\t\t$lastY = NULL;\n\n\t\t\t$colorRGB = $this->getChartIndexColor($key);\n\t\t\t$colorBg = imagecolorallocatealpha($image, $colorRGB[0], $colorRGB[1], $colorRGB[2],110);\n\n\t\t\t$bgPoints = array();\n\t\t\tforeach ( $testResultRange as $testResult ){\n\t\t\t\t$newX = intval( $this->transformX( $testResult->getTimestamp() ) );\n\t\t\t\t$newY = intval( $this->transformY( $testResult->getValue() ) );\n\t\t\t\tif( $lastX !== NULL ){\n\n\t\t\t\t\t$bgPoints[] = $lastX;\n\t\t\t\t\t$bgPoints[] = $lastY;\n\t\t\t\t\t$bgPoints[] = $newX;\n\t\t\t\t\t$bgPoints[] = $lastY;\n\t\t\t\t\t$bgPoints[] = $newX;\n\t\t\t\t\t$bgPoints[] = $newY;\n\n\t\t\t\t}\n\n\t\t\t\t$lastX = $newX;\n\t\t\t\t$lastY = $newY;\n\t\t\t}\n\n\t\t\t$bgPoints[] = intval( $this->transformX( $testResultRange->getLast()->getTimestamp() ) );\n\t\t\t$bgPoints[] = intval( $this->transformY( 0 ) );\n\t\t\t$bgPoints[] = intval( $this->transformX( $testResultRange->getFirst()->getTimestamp() ) );\n\t\t\t$bgPoints[] = intval( $this->transformY( 0 ) );\n\n\t\t\t\t// draw filled chart background\n\t\t\tif ( count($bgPoints) > 7 ){\n\t\t\t\timagefilledpolygon ($image, $bgPoints , count($bgPoints)/2 , $colorBg );\n\t\t\t}\n\t\t}\n\t}", "public function addBackground($Settings = array(\"R\"=>230, \"G\"=>230, \"B\"=>230, \"Dash\"=>1, \"DashR\"=>240, \"DashG\"=>240, \"DashB\"=>240)) {\n\t\t $this->drawFilledRectangle(0, 0, $this->XSize, $this->YSize,$Settings);\n\t\t $this->drawRectangle(0,0,$this->XSize - 1,$this->YSize - 1,array(\"R\"=> 80,\"G\"=>80,\"B\"=>80));\n\t}", "public function setBackground($color = null)\n {\n if (null === $color) {\n $this->background = null;\n\n return;\n }\n\n if (!isset(static::$availableBackgroundColors[$color])) {\n throw new \\InvalidArgumentException(sprintf(\n 'Invalid background color specified: \"%s\". Expected one of (%s)',\n $color,\n implode(', ', array_keys(static::$availableBackgroundColors))\n ));\n }\n\n $this->background = static::$availableBackgroundColors[$color];\n }", "protected function keepColor($image) {\n imagesavealpha($image, true);\n $color = imagecolorallocatealpha($image, 0, 0, 0, 127);\n imagefill($image, 0, 0, $color);\n return $image;\n }", "function pl_bg_color(){\n\t\n\tif( pl_check_color_hash( get_set_color( 'the_bg' ) ) )\n\t\treturn get_set_color( 'the_bg' );\n\telse \n\t\treturn 'FFFFFF';\t\n}", "function _custom_background_cb()\n {\n }", "public static function addPNGBackground($source, $red, $green, $blue)\n {\n if (! is_resource($source)) {\n throw new \\Exception('$source must of of type resource, ' . gettype($source) . ' given.');\n }\n \n // Create a new true color image with the same size\n $w = imagesx($source);\n $h = imagesy($source);\n $newImage = imagecreatetruecolor($w, $h);\n // Fill the new image with white background\n $bg = imagecolorallocate($source, $red, $green, $blue);\n imagefill($newImage, 0, 0, $bg);\n \n // Copy original transparent image onto the new image\n imagecopy($newImage, $source, 0, 0, 0, 0, $w, $h);\n return $newImage;\n }", "public function setBgColor($color) {\n\t\tif (!isColor($color)) {\n\t\t\tthrow new StyleException('Invalid color value');\n\t\t}\n\t\t$this->tableProp->setAttribute('fo:background-color', $color);\n\t}", "public function backgroundColor($color)\n {\n return $this->addAction(ClassUtils::verifyInstance($color, Background::class));\n }", "public function setBackgroundColor($backgroundColor) {\n $this->backgroundColor = $backgroundColor;\n return $this;\n }", "function my_custom_background_cb() {\n\t// $background is the saved custom image, or the default image.\n\t$background = set_url_scheme( get_background_image() );\n\n\t// $color is the saved custom color.\n\t// A default has to be specified in style.css. It will not be printed here.\n\t$color = get_background_color();\n\n\tif ( $color === get_theme_support( 'custom-background', 'default-color' ) ) {\n\t\t$color = false;\n\t}\n\n\t$type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type=\"text/css\"';\n\n\tif ( ! $background && ! $color ) {\n\t\tif ( is_customize_preview() ) {\n\t\t\tprintf( '<style%s id=\"custom-background-css\"></style>', $type_attr );\n\t\t}\n\t\treturn;\n\t}\n\n\t$style = $color ? \"background-color: #$color;\" : '';\n\n\tif ( $background ) {\n\t\t$image = ' background-image: url(\"' . esc_url_raw( $background ) . '\");';\n\n\t\t// Background Position.\n\t\t$position_x = get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) );\n\t\t$position_y = get_theme_mod( 'background_position_y', get_theme_support( 'custom-background', 'default-position-y' ) );\n\n\t\tif ( ! in_array( $position_x, array( 'left', 'center', 'right' ), true ) ) {\n\t\t\t$position_x = 'left';\n\t\t}\n\n\t\tif ( ! in_array( $position_y, array( 'top', 'center', 'bottom' ), true ) ) {\n\t\t\t$position_y = 'top';\n\t\t}\n\n\t\t$position = \" background-position: $position_x $position_y;\";\n\n\t\t// Background Size.\n\t\t$size = get_theme_mod( 'background_size', get_theme_support( 'custom-background', 'default-size' ) );\n\n\t\tif ( ! in_array( $size, array( 'auto', 'contain', 'cover' ), true ) ) {\n\t\t\t$size = 'auto';\n\t\t}\n\n\t\t$size = \" background-size: $size;\";\n\n\t\t// Background Repeat.\n\t\t$repeat = get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) );\n\n\t\tif ( ! in_array( $repeat, array( 'repeat-x', 'repeat-y', 'repeat', 'no-repeat' ), true ) ) {\n\t\t\t$repeat = 'repeat';\n\t\t}\n\n\t\t$repeat = \" background-repeat: $repeat;\";\n\n\t\t// Background Scroll.\n\t\t$attachment = get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'default-attachment' ) );\n\n\t\tif ( 'fixed' !== $attachment ) {\n\t\t\t$attachment = 'scroll';\n\t\t}\n\n\t\t$attachment = \" background-attachment: $attachment;\";\n\n\t\t$style .= $image . $position . $size . $repeat . $attachment;\n\t}\n ?>\n \n <style<?php echo $type_attr; ?> id=\"custom-background-css\">\n body.custom-background { <?php echo trim( $style ); ?> }\n .menu-toggle { background: <?php echo \"#$color;\" ?> }\n .menu-toggle:focus, .menu-toggle:active, .menu-toggle:hover { background: <?php echo \"#$color;\" ?> }\n </style>\n\n<?php \n}", "public function set_plot_bg_color($values, $by_lines = FALSE)\n\t{\n\t\t$this->plot_bg_color = $values;\n\t\t$this->plot_bg_by_lines = $by_lines;\n\t}", "public function set_plot_bg_color($values, $by_lines = FALSE)\n\t{\n\t\t$this->plot_bg_color = $values;\n\t\t$this->plot_bg_by_lines = $by_lines;\n\t}", "public function fit(IImageInformation $src, $width, $height, $backgroundcolor = 0xFFFFFF);", "public function Background(string $color)\n {\n return $this->setOption('bg', $color);\n }", "private static function background($im, int $width, int $height) {\n $path = __DIR__ . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'bgs' . DIRECTORY_SEPARATOR;\n $dir = dir($path);\n\n $bgs = [];\n while (false !== ($file = $dir->read())) {\n if ('.' != $file[0] && substr($file, -4) == '.jpg') {\n $bgs[] = $path . $file;\n }\n }\n $dir->close();\n\n $gb = $bgs[array_rand($bgs)];\n\n list($w, $h) = @getimagesize($gb);\n // Resample\n $bgImage = @imagecreatefromjpeg($gb);\n @imagecopyresampled($im, $bgImage, 0, 0, 0, 0, $width, $height, $w, $h);\n }", "public function setBgColor($bgcolor)\n\t{\n\t\t$this->bgcolor = ((is_array($bgcolor) && count($bgcolor) == 3) ? $bgcolor : false);\n\t\treturn $this;\n\t}", "public function setBGColor($arrColor)\r\n\t{\r\n\t\t$this->bgColor = $arrColor;\r\n\t}", "private function _prepare_image($width, $height, $background_color = '#FFFFFF') {\r\n\r\n // create a blank image\r\n $identifier = imagecreatetruecolor((int)$width <= 0 ? 1 : (int)$width, (int)$height <= 0 ? 1 : (int)$height);\r\n\r\n // if we are creating a transparent image, and image type supports transparency\r\n if ($background_color === -1 && $this->target_type !== 'jpg') {\r\n\r\n // disable blending\r\n imagealphablending($identifier, false);\r\n\r\n // allocate a transparent color\r\n $background_color = imagecolorallocatealpha($identifier, 0, 0, 0, 127);\r\n\r\n // we also need to set this for saving GIFs\r\n imagecolortransparent($identifier, $background_color);\r\n\r\n // save full alpha channel information\r\n imagesavealpha($identifier, true);\r\n\r\n // if we are not creating a transparent image\r\n } else {\r\n\r\n // convert hex color to rgb\r\n $background_color = $this->_hex2rgb($background_color);\r\n\r\n // prepare the background color\r\n $background_color = imagecolorallocate($identifier, $background_color['r'], $background_color['g'], $background_color['b']);\r\n\r\n }\r\n\r\n // fill the image with the background color\r\n imagefill($identifier, 0, 0, $background_color);\r\n\r\n // return the image's identifier\r\n return $identifier;\r\n\r\n }", "public function backgroundColor()\n {\n return '#dddddd';\n }", "function hyde_custom_background_cb() {\n\t$background = set_url_scheme( get_background_image() );\n\n\t// $color is the saved custom color.\n\t// A default has to be specified in style.css. It will not be printed here.\n\t$color = get_background_color();\n\n\tif ( $color === get_theme_support( 'custom-background', 'default-color' ) ) {\n\t\t$color = false;\n\t}\n\n\tif ( ! $background && ! $color )\n\t\treturn;\n\n\t$style = $color ? \"background-color: #$color;\" : '';\n\n\tif ( $background ) {\n\t\t$image = \" background-image: url('$background');\";\n\n\t\t$repeat = get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) );\n\t\tif ( ! in_array( $repeat, array( 'no-repeat', 'repeat-x', 'repeat-y', 'repeat' ) ) )\n\t\t\t$repeat = 'repeat';\n\t\t$repeat = \" background-repeat: $repeat;\";\n\n\t\t$position = get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) );\n\t\tif ( ! in_array( $position, array( 'center', 'right', 'left' ) ) )\n\t\t\t$position = 'left';\n\t\t$position = \" background-position: top $position;\";\n\n\t\t$attachment = get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'default-attachment' ) );\n\t\tif ( ! in_array( $attachment, array( 'fixed', 'scroll' ) ) )\n\t\t\t$attachment = 'scroll';\n\t\t$attachment = \" background-attachment: $attachment;\";\n\n\t\t$style .= $image . $repeat . $position . $attachment;\n\t}\n?>\n<style type=\"text/css\" id=\"custom-background-css\">\n.sidebar { <?php echo trim( $style ); ?> }\n</style>\n<?php\n}", "public static function fakeImage($_dimx,$_dimy,$_bg='EEE') {\n\t\tlist($_r,$_g,$_b)=self::rgb($_bg);\n\t\t$_img=imagecreatetruecolor($_dimx,$_dimy);\n\t\t$_bg=imagecolorallocate($_img,$_r,$_g,$_b);\n\t\timagefill($_img,0,0,$_bg);\n\t\tif (PHP_SAPI!='cli' && !headers_sent())\n\t\t\theader(F3::HTTP_Content.': image/png');\n\t\timagepng($_img,NULL,self::PNG_Compress,PNG_NO_FILTER);\n\t\t// Free resources\n\t\timagedestroy($_img);\n\t}", "public function getBackgroundColor() {}", "public function getBackgroundColor() {}", "public function getBackgroundColor() {}", "function zbx_colormix($image, $bgColor, $fgColor, $alpha) {\n\t$r = $bgColor[0] + ($fgColor[0] - $bgColor[0]) * $alpha;\n\t$g = $bgColor[1] + ($fgColor[1] - $bgColor[1]) * $alpha;\n\t$b = $bgColor[2] + ($fgColor[2] - $bgColor[2]) * $alpha;\n\n\treturn imagecolorresolvealpha($image, $r, $g, $b, 0);\n}", "function bgColor() {\n\t$color = dechex(rand(0x000000, 0xDDDDDD));\n\treturn \"#{$color}\";\n}", "public function paintImage($image, string $color)\r\n {\r\n $backgroundColor = $this->hexToRgb($color);\r\n $backgroundColor = imagecolorallocate(\r\n $image, \r\n $backgroundColor['red'], \r\n $backgroundColor['green'],\r\n $backgroundColor['blue']\r\n );\r\n\r\n imagefill($image, 0, 0, $backgroundColor);\r\n\r\n return $image;\r\n }", "function draw_image($word, $img_width = 200, $img_height = 80)\n {\n $noise_img = @imagecreatefromjpeg($this->bg_image);\n $noise_width = imagesx($noise_img);\n $noise_height = imagesy($noise_img);\n\n /* resize the background image to fit the size of image output */\n $image = imagecreatetruecolor($img_width, $img_height);\n imagecopyresampled(\n $image,\n $noise_img,\n 0, 0, 0, 0,\n $img_width,\n $img_height,\n $noise_width,\n $noise_height\n );\n /* put text image into background image */\n imagecopymerge(\n $image,\n $this->draw_text($word, $img_width, $img_height),\n 0, 0, 0, 0,\n $img_width,\n $img_height,\n 50\n );\n return $image;\n }", "public function setTransparency($value)\r\n {\r\n $this->_cleanse($value, __METHOD__);\r\n $this->_transparent = $value;\r\n \r\n return $this;\r\n }", "public function setBgColour(string $colour): void\n {\n $this->bgColour = $colour;\n }", "function background($args) {\r\n\t\t$description = $args['description'];\r\n\t\tunset($args['description']);\r\n\t\t\r\n\t\t// if plain is true at this point we must have come from a post meta box so do some switching of the args around\r\n\t\t$form_prefix = $this->metabox_id_fix($args);\r\n\t\t$form_value = $this->metabox_value_fix($args);\r\n\t\t\r\n\t\t$args['selections'] = array('0'=>'0','1'=>'1','2'=>'2','3'=>'3','4'=>'4','5'=>'5','6'=>'6','7'=>'7','8'=>'8','9'=>'9','10'=>'10','11'=>'11','12'=>'12','13'=>'13','14'=>'14','15'=>'15','16'=>'16','17'=>'17');\r\n\t\t$args['plain']=true; // switch to plain mode\r\n\r\n\t\t// add font size\r\n\t\t$args['id'] = $form_prefix . \"[background-color]\";\r\n\t\t$args['value'] = $form_value['background-color'];\r\n\t\t$args['width'] = '75';\r\n\t\t$args['tooltip'] = 'Background Color';\r\n\t\t$this->color($args);\r\n\t\t\r\n\t\tif ($args['gradient']) {\r\n\t\t\t// add font units\r\n\t\t\t$args['id'] = $form_prefix . \"[gradient]\";\r\n\t\t\t$args['value'] = $form_value['gradient'];\r\n\t\t\t$args['width'] = '75';\r\n\t\t\t$args['tooltip'] = 'Gradient End Point Color';\r\n\t\t\t$this->color($args);\r\n\t\t}\r\n\t\t\r\n\t\t$args['id'] = $form_prefix . \"[position]\";\r\n\t\t$args['value'] = $form_value['position'];\r\n\t\t$args['width'] = '135';\r\n\t\t$this->backgroundpositions($args);\r\n\t\t\r\n\t\t$args['id'] = $form_prefix . \"[repeat]\";\r\n\t\t$args['value'] = $form_value['repeat'];\r\n\t\t$args['width'] = '135';\r\n\t\t$this->backgroundrepeat($args);\r\n\t\t\r\n\t\tprint \"<div style='height:3px;'></div>\";\r\n\t\t// add font units\r\n\t\t$args['id'] = $form_prefix . \"[image]\";\r\n\t\t$args['value'] = $form_value['image'];\r\n\t\t$args['width'] = '400';\r\n\t\t$args['placeholder'] = 'Upload a background image';\r\n\t\t$args['tooltip'] = 'Upload an image or enter a URL to use as the backround. The image must be hosted on the same domain as this website.';\r\n\t\t$this->attachment($args);\r\n\t\t\r\n\t\t$this->description($description);\r\n\t}", "function extra_custom_background_cb() {\n\t$background = set_url_scheme( get_background_image() );\n\n\t// $color is the saved custom color.\n\t// A default has to be specified in style.css. It will not be printed here.\n\t$color = get_background_color();\n\n\tif ( $color === get_theme_support( 'custom-background', 'default-color' ) ) {\n\t\t$color = false;\n\t}\n\n\tif ( ! $background && ! $color ) {\n\t\treturn;\n\t}\n\n\t$style = $color ? \"background-color: #$color;\" : '';\n\n\tif ( $background ) {\n\t\t$image = \" background-image: url('$background');\";\n\n\t\t$_repeat = get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) );\n\t\tif ( ! in_array( $_repeat, array( 'no-repeat', 'repeat-x', 'repeat-y', 'repeat' ) ) ) {\n\t\t\t$_repeat = 'repeat';\n\t\t}\n\n\t\t$repeat = \" background-repeat: $_repeat;\";\n\n\t\tif ( 'no-repeat' == $_repeat ) {\n\t\t\t$repeat .= \" background-size: cover;\";\n\t\t}\n\n\t\t$position = get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) );\n\n\t\tif ( ! in_array( $position, array( 'center', 'right', 'left' ) ) ) {\n\t\t\t$position = 'left';\n\t\t}\n\n\t\t$position = \" background-position: top $position;\";\n\n\t\t$attachment = get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'default-attachment' ) );\n\n\t\tif ( ! in_array( $attachment, array( 'fixed', 'scroll' ) ) ) {\n\t\t\t$attachment = 'scroll';\n\t\t}\n\n\t\t$attachment = \" background-attachment: $attachment;\";\n\n\t\t$style .= $image . $repeat . $position . $attachment;\n\t}\n?>\n<style type=\"text/css\" id=\"extra-custom-background-css\">\nbody.custom-background { <?php echo trim( $style ); ?> }\n</style>\n<?php\n}", "public function setWelcomeScreenBackgroundImageUrl(?string $value): void {\n $this->getBackingStore()->set('welcomeScreenBackgroundImageUrl', $value);\n }", "public function updateBackground ($id, $bg){\n\t\t\t$query = new Query();\n\n\t\t\t$query->tables = array('pgdb');\n\t\t\t$query->fields = array('bg');\n\t\t\t$query->values = array($bg);\n\t\t\t$query->filters = \"Id=\".$id;\n\n\t\t\t$query->DoUpdate();\n\t\t}", "public function set_bg_colour($colour) {\n\t\t$this->bg_colour = $colour;\n\t}", "function fp_setup() {\n\t\n\tadd_theme_support('custom-background', array('default-color' => 'ffffff'));\n\t\n}", "public function setBackgroundMode($backgroundMode) {\n $this->backgroundMode = $backgroundMode;\n }", "public function test_image_preserves_alpha() {\n\t\t$file = DIR_TESTDATA . '/images/transparent.png';\n\n\t\t$editor = new WP_Image_Editor_Imagick( $file );\n\n\t\t$this->assertNotInstanceOf( 'WP_Error', $editor );\n\n\t\t$editor->load();\n\n\t\t$save_to_file = tempnam( get_temp_dir(), '' ) . '.png';\n\n\t\t$editor->save( $save_to_file );\n\n\t\t$im = new Imagick( $save_to_file );\n\t\t$pixel = $im->getImagePixelColor( 0, 0 );\n\t\t$expected = $pixel->getColorValue( imagick::COLOR_ALPHA );\n\n\t\t$this->assertImageAlphaAtPointImagick( $save_to_file, array( 0, 0 ), $expected );\n\n\t\tunlink( $save_to_file );\n\t}", "public function setBackColor($value)\r\n {\r\n $this->_cleanse($value, __METHOD__);\r\n $this->_backColor = $value;\r\n \r\n return $this;\r\n }", "protected function _colorize($img, $percent) {\n $phpErrorHandler = new PhpErrorHandler();\n $res = $phpErrorHandler->call(function()use($img){\n return imagealphablending($img, false);\n });\n if(! $res) {\n $function = 'imagealphablending';\n }\n else {\n $res = $phpErrorHandler->call(function()use($img){\n return imagesavealpha($img, true);\n });\n if(! $res) {\n $function = 'imagesavealpha';\n }\n else {\n $res = $phpErrorHandler->call(function()use($img, $percent){\n // Get a percent value 0 to 100\n $abs = abs(intval($percent));\n $pct = $abs ? (($abs - 1) % 100 + 1) : $abs;\n $alpha = 127 * (1 - $pct / 100);\n return imagefilter($img, IMG_FILTER_COLORIZE, 0, 0, 0, $alpha);\n });\n if($res) {\n return true;\n }\n $function = 'imagefilter';\n }\n }\n // T_PHP_FUNCTION_FAILED = image function '%s' failed\n $msg = $phpErrorHandler->getErrorMsg(sprintf(MediaConst::T_PHP_FUNCTION_FAILED, $function), \"cannot apply image fading\");\n // a PHP image function has failed\n throw new Exception\\RuntimeException($msg, MediaConst::E_PHP_FUNCTION_FAILED);\n }", "public function background($background)\n {\n return $this->addAction(ClassUtils::verifyInstance($background, Background::class));\n }", "function background_img($link){\n\t\t\t\techo \"<style> body{background: url(\". $link. \");\n\t\t\t\t\t\t\t\t\tbackground-repeat: no-repeat;\n\t\t\t\t\t\t\t\t\tbackground-size: cover;\n\t\t\t\t\t\t\t\t\t} </style>\";\n\t\t\t}", "public function testPropertyBackgroundColor($value)\n {\n $object = new ConditionalTextStyle();\n $object->setBackgroundColor($value);\n\n $this->assertEquals($value, $object->getBackgroundColor());\n }", "function vibe_custom_background_cb(){\n $background = set_url_scheme( get_background_image() );\n\n // $color is the saved custom color.\n // A default has to be specified in style.css. It will not be printed here.\n $color = get_theme_mod( 'background_color' );\n\n if ( ! $background && ! $color )\n return;\n\n $style = $color ? \"background-color: #$color;\" : '';\n\n if ( $background ) {\n $image = \" background-image: url('$background');\";\n\n $repeat = get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) );\n if ( ! in_array( $repeat, array( 'no-repeat', 'repeat-x', 'repeat-y', 'repeat' ) ) )\n $repeat = 'repeat';\n $repeat = \" background-repeat: $repeat;\";\n\n $position = get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) );\n if ( ! in_array( $position, array( 'center', 'right', 'left' ) ) )\n $position = 'left';\n $position = \" background-position: top $position;\";\n\n $attachment = get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'default-attachment' ) );\n if ( ! in_array( $attachment, array( 'fixed', 'scroll' ) ) )\n $attachment = 'scroll';\n $attachment = \" background-attachment: $attachment;\";\n\n $style .= $image . $repeat . $position . $attachment;\n\n echo '\n <div id=\"background_fixed\">\n <img src=\"'.$background.'\" />\n </div>\n <style type=\"text/css\">\n #background_fixed{position: fixed;top:0;left:0;width:200%;height:200%;}\n </style>\n ';\n }\n\n}", "public function test_image_preserves_alpha() {\n\n\t\t$file = DIR_TESTDATA . '/images/transparent.png';\n\n\t\t$editor = wp_get_image_editor( $file );\n\t\t$editor->load();\n\n\t\t$save_to_file = tempnam( get_temp_dir(), '' ) . '.png';\n\t\t\n\t\t$editor->save( $save_to_file );\n\n\t\t$this->assertImageAlphaAtPoint( $save_to_file, array( 0,0 ), 127 );\n\t}" ]
[ "0.79896325", "0.7035235", "0.663013", "0.6621289", "0.6621289", "0.6621289", "0.6621289", "0.6566006", "0.65092456", "0.6485428", "0.641499", "0.63589096", "0.6237104", "0.62353545", "0.61726856", "0.61726856", "0.60831445", "0.6063705", "0.605798", "0.59767365", "0.5962902", "0.59521425", "0.5938888", "0.59327763", "0.5905889", "0.5887677", "0.58761406", "0.5856979", "0.5834381", "0.5788079", "0.57783204", "0.5722692", "0.57123154", "0.5707184", "0.5663244", "0.5653676", "0.5626278", "0.56213254", "0.55966926", "0.5513349", "0.55041367", "0.54996026", "0.5482953", "0.5431093", "0.5400931", "0.54000336", "0.5395726", "0.5372632", "0.5339422", "0.530454", "0.53026426", "0.5301562", "0.52772164", "0.5219184", "0.5214553", "0.52123934", "0.5209227", "0.51872754", "0.51453227", "0.5136999", "0.51063186", "0.50955826", "0.508503", "0.5070907", "0.5040478", "0.5030422", "0.5030422", "0.50279963", "0.5021172", "0.5020564", "0.4991124", "0.49901405", "0.49871325", "0.49775273", "0.49766678", "0.4974236", "0.496966", "0.496966", "0.49667415", "0.49659082", "0.4964935", "0.4964919", "0.49556994", "0.49526498", "0.49384734", "0.49174333", "0.49136567", "0.49108657", "0.4876786", "0.4874001", "0.48624438", "0.48579648", "0.48557946", "0.4855485", "0.48452833", "0.47957665", "0.4793602", "0.47862828", "0.47767046", "0.47446406" ]
0.5427761
44
Save the image. If the filename is omitted, the original image will be overwritten. // Save the image as a PNG $image>save('saved/cool.png'); // Overwrite the original image $image>save(); [!!] If the file exists, but is not writable, an exception will be thrown. [!!] If the file does not exist, and the directory is not writable, an exception will be thrown.
public function save($file = NULL, $quality = 100) { if ($file === NULL) { // Overwrite the file $file = $this->file; } if (is_file($file)) { if ( ! is_writable($file)) { throw new Exception('File must be writable'); } } else { // Get the directory of the file $directory = realpath(pathinfo($file, PATHINFO_DIRNAME)); if ( ! is_dir($directory) OR ! is_writable($directory)) { throw new Exception('Directory must be writable'); } } // The quality must be in the range of 1 to 100 $quality = min(max($quality, 1), 100); return $this->_do_save($file, $quality); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abstract public function save($img, $filename);", "protected function save()\n {\n switch ($this->image_info['mime']) {\n \n case 'image/gif':\n imagegif($this->image, $this->getPath(true));\n break;\n \n case 'image/jpeg':\n imagejpeg($this->image, $this->getPath(true), $this->quality);\n break;\n \n case 'image/jpg':\n imagejpeg($this->image, $this->getPath(true), $this->quality);\n break;\n \n case 'image/png':\n imagepng($this->image, $this->getPath(true), round($this->quality / 10));\n break;\n \n default:\n $_errors[] = $this->image_info['mime'] . ' images are not supported';\n return $this->errorHandler();\n break;\n }\n \n chmod($this->getPath(true), 0777);\n }", "public function saveImage($filename)\n\t{\n\t\timagejpeg( $this->im, \"$filename\", $this->cq );\n\t}", "public function save() {\n \n $checkError = $this->isError();\n if (!$checkError) {\n \n $ext = $this->getImageExt();\n $quality = $this->__imageQuality;\n $dirSavePath = dirname($this->__imageSavePath);\n \n if (empty($this->__imageSavePath) || !is_dir($dirSavePath)) {\n $this->setError(__d('cloggy','Image save path not configured or maybe not exists.'));\n } else { \n \n /*\n * create resized image\n */\n switch($ext) {\n \n case 'jpg':\n case 'jpeg':\n\n if (imagetypes() & IMG_JPG) {\n @imagejpeg($this->__imageResized,$this->__imageSavePath,$quality); \n }\n\n break;\n\n case 'gif':\n\n if (imagetypes() & IMG_GIF) {\n @imagegif($this->__imageResized,$this->__imageSavePath); \n }\n\n break;\n\n case 'png':\n\n $scaleQuality = round($this->__imageQuality/100) * 9;\n $invertScaleQuality = 9 - $scaleQuality;\n\n if (imagetypes() & IMG_PNG) {\n @imagepng($this->__imageResized,$this->__imageSavePath,$invertScaleQuality); \n }\n\n break;\n\n } \n \n } \n \n /*\n * destroy resized image\n */\n if ($this->__imageResized) {\n \n //destroy resized image\n imagedestroy($this->__imageResized);\n \n } \n \n }\n \n }", "function save(&$image) {\r\r\n\t\treturn $this->__write($image);\r\r\n\t\t}", "private function savePhoto()\n {\n $image = Image::make($this->filePath);\n\n File::exists($this->sanghaPhotosPath()) or File::makeDirectory($this->sanghaPhotosPath());\n\n $image->resize(400, null, function ($constraint) {\n $constraint->aspectRatio();\n $constraint->upsize();\n })\n ->save($this->sanghaPhotosPath() . $this->fileName)\n ->resize(200, null, function ($constraint) {\n $constraint->aspectRatio();\n })\n ->save($this->sanghaPhotosPath() . 'tn_' . $this->fileName);\n\n }", "function saveImage()\n\t{\n\n\t\tif (!$this->ImageStream) {\n\t\t\t$this->printError('image not loaded');\n\t\t}\n\n\t\tswitch ($this->type) {\n\t\t\tcase 1:\n\t\t\t\t/* store a interlaced gif image */\n\t\t\t\tif ($this->interlace === true) {\n\t\t\t\t\timageinterlace($this->ImageStream, 1);\n\t\t\t\t}\n\n\t\t\t\timagegif($this->ImageStream, $this->sFileLocation);\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\t/* store a progressive jpeg image (with default quality value)*/\n\t\t\t\tif ($this->interlace === true) {\n\t\t\t\t\timageinterlace($this->ImageStream, 1);\n\t\t\t\t}\n\n\t\t\t\timagejpeg($this->ImageStream, $this->sFileLocation, $this->jpegquality);\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\t/* store a png image */\n\t\t\t\timagepng($this->ImageStream, $this->sFileLocation);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t$this->printError('invalid imagetype');\n\n\t\t\t\tif (!file_exists($this->sFileLocation)) {\n\t\t\t\t\t$this->printError('file not stored');\n\t\t\t\t}\n\t\t}\n\t}", "public function save( $filename )\n {\n \n }", "public function save($img, $name, $path = null)\n {\n $path = $path ?: $this->path;\n\n $this->disk->put($path .'/'. $name, $img->stream());\n }", "public function save()\n {\n\n $photo = $this->flyer->addPhoto($this->makePhoto());\n\n\n // move the photo to the images folder\n $this->file->move($photo->baseDir(), $photo->name);\n\n\n// Image::make($this->path)\n// ->fit(200)\n// ->save($this->thumbnail_path);\n\n // generate a thumbnail\n $this->thumbnail->make($photo->path, $photo->thumbnail_path);\n }", "public function save($file = NULL)\n {\n if($file === NULL && $this->storage)\n {\n $this->storage->save($this);\n }\n elseif($file !== NULL)\n {\n $this->savePicture($file);\n }\n else\n {\n trigger_error('Image file to save is not defined', E_USER_WARNING);\n }\n }", "private function saveImage()\n {\n $name = $_FILES['image']['name'];\n $tmp_name = $_FILES['image']['tmp_name'];\n\n return move_uploaded_file($tmp_name, 'images/' . $name);\n }", "function save($filename, $image_type=IMAGETYPE_JPEG, $compression=75, $permissions=null) \n {\n //salva imagen tipo JPEG\n if( $image_type == IMAGETYPE_JPEG )\n {\n imagejpeg($this->image,$filename,$compression);\n } \n //Salva imagen GIF.\n elseif( $image_type == IMAGETYPE_GIF ) \n {\n imagegif($this->image,$filename); \n } \n //Salva imagen PNG\n //Necesita una imagen transparente.\n elseif( $image_type == IMAGETYPE_PNG ) \n { \n imagealphablending($this->image, false);\n imagesavealpha($this->image,true);\n imagepng($this->image,$filename);\n } \n if( $permissions != null) \n {\n chmod($filename,$permissions);\n }\n }", "public function saveToFile($name = null)\n {\n // Self Generate File Location\n if (!$name) {\n $name = uniqid() . '.png';\n }\n // Save to File\n file_put_contents($name, base64_decode($this->getImage()));\n return $name;\n }", "private function save()\n {\n $this->collage->setImageFormat('jpeg');\n return $this->collage->writeImage($this->name);\n }", "public function save($file)\r\n\t{\r\n\t\tif(empty($this->img))\r\n\t\t{\r\n\t\t\t$this->render();\r\n\t\t}\r\n\t\timagepng($this->img, $file);\r\n\t}", "public function save()\n {\n $this->validate();\n $this->validate(['image' => 'required|image']);\n\n // try to upload image and resize by ImageSaverController config\n try {\n $imageSaver = new ImageSaverController();\n $this->imagePath = $imageSaver->loadImage($this->image->getRealPath())->saveAllSizes();\n }catch (\\RuntimeException $exception){\n dd($exception);\n }\n\n $this->PostSaver();\n\n $this->resetAll();\n $this->ChangeCreatedMode();\n $this->swAlert([\n 'title' => 'Good job',\n 'text' => 'successfully added',\n 'icon' => 'success'\n ]);\n $this->render();\n }", "public function saveToFile($file_path = \"\") {\n// is there an image resource to work with?\n if (isset($this->_resource)) {\n if (!is_dir(dirname($file_path))) {\n $parent_directory = dirname($file_path);\n $mode = 0777;\n $recursive = true;\n mkdir($parent_directory, $mode, $recursive);\n }\n switch ($this->_mimetype) {\n case \"image/jpeg\":\n $file_extension = \"jpg\";\n break;\n case \"image/png\":\n $file_extension = \"png\";\n break;\n case \"image/gif\":\n $file_extension = \"gif\";\n break;\n }\n\n// filling out the file path\n $file_path = sprintf(\"%s.%s\", $file_path, $file_extension);\n switch ($this->_mimetype) {\n case \"image/jpeg\":\n imagejpeg($this->_resource, $file_path);\n break;\n case \"image/png\":\n imagepng($this->_resource, $file_path);\n break;\n case \"image/gif\":\n imagegif($this->_resource, $file_path);\n break;\n }\n\n// assigning the new image file_location attribute\n $this->_file_location = $file_path;\n\n// changing the mode (so that all can make good use of the new image file)\n chmod($this->_file_location, 0777);\n } else {\n trigger_error(\"CAMEMISResizeImage::saveToFile() attempting to access a non-existent resource (check if the image was loaded by CAMEMISResizeImage::__construct())\", E_USER_WARNING);\n }\n\n return $this;\n }", "public function save($filename, $size=null, $margin=null, $foreground=null, $background=null){ }", "public function save($file, $path);", "function imageSaveFile($property, \\SplFileInfo $file);", "function save( $format = 'jpg', $filename = NULL, $jpegquality = 100 )\n\t{\n\t\t//if no filename, set up OB to cpature the output\n\t\tif( $filename == NULL )\n\t\t{\n\t\t\t$do_return = true;\n\t\t\tob_start();\n\t\t}\n\t\t\n\t\t//save the image based on supplied format\n\t\tswitch( $format )\n\t\t{\n\t\t\tcase 'jpg':\n\t\t\tcase 'jpeg':\n\t\t\t\t$result = imagejpeg( $this->im, $filename, $jpegquality );\n\t\t\t\tbreak;\n\t\t\tcase 'gif':\n\t\t\t\t$result = imagegif( $this->im, $filename );\n\t\t\t\tbreak;\n\t\t\tcase 'png':\n\t\t\t\t$result = imagepng( $this->im, $filename );\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tif( $do_return ) { ob_end_clean(); }\n\t\t\t\tthrow new Exception( 'Image Class: Invalid save format \\''.$format.'\\'' );\n\t\t}\n\t\t\n\t\t//return the image data as needed\n\t\tif( $do_return )\n\t\t{\n\t\t\t$data = ob_get_flush();\n\t\t\treturn $data;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn $result;\n\t\t}\n\t}", "public function save($filename, $type = false, $quality = 75) {\n\n // Check if we have been sent a file type.\n if (!$type) {\n\n // Attempt to detect the file type from the filename extention.\n $type = substr($filename, -3, 3);\n }\n\n // Detect which type of image we are being asked to output.\n switch (strtolower($type)) {\n case \"png\":\n $result = imagepng($this->current, $filename);\n break;\n case \"gif\":\n $result = imagegif($this->current, $filename);\n break;\n case \"wbmp\":\n $result = imagewbmp($this->current, $filename);\n break;\n case \"xbm\":\n $result = imagexbm($this->current, $filename);\n break;\n case \"jpg\":\n case \"jpeg\":\n default:\n \timageinterlace($this->current, 1);\n $result = imagejpeg($this->current, $filename, $quality);\n break;\n }\n\n // Report on our success.\n return $result;\n }", "protected function _store($im)\n {\n if (!is_null($this->_options['savePath'])) {\n switch ($this->_options['imageType']) {\n case 'gif':\n imagegif($im, $this->_options['savePath']);\n break;\n case 'jpeg':\n imagejpeg($im, $this->_options['savePath']);\n break;\n case 'png':\n default:\n imagepng($im, $this->_options['savePath']);\n }\n }\n \n return $im; \n }", "function logonscreener_image_save($image, $filename, $quality = 100) {\n if (!imagejpeg($image, $filename, $quality)) {\n logonscreener_log(\"Could not write to tmp file with $quality% quality.\");\n return FALSE;\n }\n\n // Clear the cached file size and get the image information.\n clearstatcache();\n $filesize = filesize($filename);\n\n if ($filesize > LOGONSCREENER_MAX_FILESIZE) {\n logonscreener_log(\"Quality = $quality%. Filesize = $filesize B.\");\n $filename = logonscreener_image_save($image, $filename, --$quality);\n }\n else {\n logonscreener_log(\"Resulted image quality: $quality%.\", \"Resulted file size: $filesize.\");\n }\n\n return $filename;\n}", "public function save()\n {\n $dir = $this->pathTmpImage;\n\n $files = scandir($dir);\n\n foreach ($files as $file) {\n if ($file == $_POST['image']) { \n copy($this->pathTmpImage . $file, $this->pathResult . $file);\n }\n }\n\n //$this->dbInsert($_POST['image']);\n\n unlink($this->pathTmpImage . $_POST['image']);\n }", "public function save($img, $pathToSave): string\n {\n $fileName = $this->getHash();\n $fullFileName = $this->generatePath($fileName, $pathToSave);\n\n if ($this->saving($fullFileName, $img)) {\n return $fileName;\n }\n return 'false';\n }", "function savePreviewImage($filename, $destinationFile){\n\t\t $this->resizeSaveImage($filename, $destinationFile, self::previewWidth);\n\t }", "private function intern_save ($targetPath = null)\n\t{\n\t\tif ($this->newImage == null) $this->newImage = $this->srcImage;\n\n\t\tif ($targetPath == null) $targetPath = $this->srcPath;\n\t\telse\n\t\t{\n\t\t\tif (Pathfinder::isAbsolute($targetPath)) $targetPath = $targetPath;\n\t\t\t$targetPath = $this->dataRootPath . $this->getRelativePath($targetPath);\n\t\t}\n\n\t\t// create folders if necessary\n\t\t$this->setUpFolder($targetPath);\n\t\t// remove file from folder with same name\n\t\t$this->intern_removePrevious($targetPath);\n\n\t\t// save\n\t\tswitch($this->srcInfo['extension']) {\n\t\t\tcase 'jpg':\n\t\t\tcase 'jpeg':\n\t\t\t\timagejpeg ( $this->newImage, $targetPath);\n\t\t\t\tbreak;\n\t\t\tcase 'png':\n\t\t\t\timagepng ( $this->newImage, $targetPath);\n\t\t\t\tbreak;\n\t\t\tcase 'gif':\n\t\t\t\timagegif ( $this->newImage, $targetPath);\n\t\t}\n\t\t$this->intern_end();\n\t}", "function savefile($sFileName = null)\n\t{\n\t\tif ((isset($sFileName)) && ($sFileName != '')) {\n\t\t\t$this->setLocations($sFileName);\n\t\t}\n\n\t\t$this->saveImage();\n\t}", "public function save($filename = null)\n {\n $this->writeFile($this->openFile($filename), $this->getContent());\n }", "function save($filename, $compression=75, $permissions=null) \r\n\t{\r\n $success = true;\r\n $image_type = $this->type;\r\n \r\n ob_start(); \r\n //$mime = image_type_to_mime_type( $image_type );\r\n //header(\"Content-type: $mime\");\r\n \r\n if( $image_type == IMAGETYPE_JPEG ) {\r\n if (!$success = imagejpeg($this->image, null ))\r\n {\r\n $this->setError( \"DSCImage::save( 'jpeg' ) Failed\" );\r\n }\r\n } elseif( $image_type == IMAGETYPE_GIF ) {\r\n if (!$success = imagegif($this->image, null ))\r\n {\r\n $this->setError( \"DSCImage::save( 'gif' ) Failed\" );\r\n }\r\n } elseif( $image_type == IMAGETYPE_PNG ) {\r\n if (!$success = imagepng($this->image, null ))\r\n {\r\n $this->setError( \"DSCImage::save( 'png' ) Failed\" );\r\n }\r\n }\r\n\r\n if ($success)\r\n {\r\n $imgToWrite = ob_get_contents();\r\n ob_end_clean();\r\n \r\n if (!JFile::write( $filename, $imgToWrite)) \r\n {\r\n $this->setError( JText::_( \"Could not write file\" ).\": \".$filename );\r\n return false;\r\n }\r\n \r\n if( $permissions != null) {\r\n chmod($filename,$permissions);\r\n }\r\n unset($this->image);\r\n return true; \r\n }\r\n \r\n return false;\r\n\t}", "function image_return_write($im, $write_to_abspath)\n{\n $return = $im->writeImage($write_to_abspath);\n $im->clear();\n $im->destroy();\n return $return;\n}", "protected function saveImage()\n {\n if ( $this->initialImage != $this->image )\n {\n $this->deleteOldImage();\n\n $imageHandler= new CImageHandler();\n $imageHandler->load( $this->getTempFolder( TRUE ) . $this->image );\n $imageHandler->save($this->getImagesFolder( TRUE ) . $imageHandler->getBaseFileName() );\n\n $settings = $this->getThumbsSettings();\n\n if ( !empty( $settings ) )\n {\n $imageHandler= new CImageHandler();\n $imageHandler->load( $this->getTempFolder( TRUE ) . $this->image );\n\n foreach( $settings as $prefix => $dimensions )\n {\n list( $width, $height ) = $dimensions;\n $imageHandler\n ->thumb( $width, $height )\n ->save( $this->getImagesFolder( TRUE ) . $prefix . $imageHandler->getBaseFileName() );\n }\n }\n\n @unlink( $this->getTempFolder( TRUE ) . $this->image );\n }\n }", "public function save(string $destination, int $quality = 80): void\n\t{\n\t\tif ($this->_extension === self::EXT_PNG || $this->_extension === self::EXT_GIF) {\n\t\t\timagesavealpha($this->_resource, true);\n\t\t}\n\n\t\tswitch ($this->_extension) {\n\t\t\tcase self::EXT_JPG:\n\t\t\t\timagejpeg($this->_resource, $destination, $quality);\n\t\t\t\tbreak;\n\t\t\tcase self::EXT_JPEG:\n\t\t\t\timagejpeg($this->_resource, $destination, $quality);\n\t\t\t\tbreak;\n\t\t\tcase self::EXT_GIF:\n\t\t\t\timagegif($this->_resource, $destination);\n\t\t\t\tbreak;\n\t\t\tcase self::EXT_PNG:\n\t\t\t\timagepng($this->_resource, $destination);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t$this->showError('Failed to save image!');\n\t\t}\n\t}", "function imageSave($property, UploadedFile $file);", "function save($filePath);", "function save_img() {\n imagejpeg($this->img, 'captcha.jpg');\n\n // Libération de la mémoire\n imagedestroy($this->img);\n \n }", "public function save(?string $file = null, int $quality = 95): void\n\t{\n\t\t$file ??= $this->image;\n\n\t\t// Mage sure that the file or directory is writable\n\n\t\tif(file_exists($file))\n\t\t{\n\t\t\tif(!is_writable($file))\n\t\t\t{\n\t\t\t\tthrow new PixlException(vsprintf('The file [ %s ] isn\\'t writable.', [$file]));\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$pathInfo = pathinfo($file);\n\n\t\t\tif(!is_writable($pathInfo['dirname']))\n\t\t\t{\n\t\t\t\tthrow new PixlException(vsprintf('The directory [ %s ] isn\\'t writable.', [$pathInfo['dirname']]));\n\t\t\t}\n\t\t}\n\n\t\t// Save the image\n\n\t\t$this->processor->save($file, $this->normalizeImageQuality($quality));\n\t}", "public function SaveProfileImg() {\n $file_name = $_SESSION['user_id'] . \"-\" . time() . \"-\" . $this->ImageName;\n $file_size = $this->ImageSize;\n $file_tmp = $this->ImageTmpName;\n $tmp = explode('.', $file_name);\n $file_ext = end($tmp);\n $expensions = array(\"jpeg\", \"jpg\", \"png\", \"gif\");\n \n if (in_array($file_ext, $expensions) === false) {\n throw new Exception(\"extension not allowed, please choose a JPEG or PNG or GIF file.\");\n }\n \n if ($file_size > 2097152) {\n throw new Exception('File size must be excately 2 MB');\n }\n \n if (empty($errors) == true) {\n move_uploaded_file($file_tmp, \"data/profile/\" . $file_name);\n return \"data/profile/\" . $file_name;\n } else {\n echo \"Error\";\n }\n }", "private function saveAsImage($url, $file, $path,$filename)\n {\n $resource = fopen($path . $filename, 'a');\n fwrite($resource, $file);\n fclose($resource);\n }", "public function save($target,$file_name)\n\t{\n\t\tif(!$this->_target) return $this->copy($target,$file_name);\n\t\t\n\t\t$path = $this->_prepare_path($target, $file_name); \n\t\t\n\t\tswitch($this->type){\n\t\t\t\tcase IMAGE_TYPE_PNG : imagepng($this->source, $path); break;\n\t\t\t\tcase IMAGE_TYPE_JPG : imagejpeg($this->source, $path); break;\n\t\t\t\tcase IMAGE_TYPE_GIF : imagegif($this->source,$path); break;\n\t\t}\n\t\t\n\t\t\n\t\t\n\n\t}", "public function saveGame($name, $data, $imageData) {\n $savedGames = fopen(\"../../../ressources/savedGames/\".$name.\".json\", \"wb\");\n $savedGamesImg = fopen(\"../../../ressources/savedGames/\".$name.\".txt\", \"wb\");\n\tfwrite($savedGames, $data);\n\tfwrite($savedGamesImg, $imageData);\n\tfclose($savedGames);\n\tfclose($savedGamesImg);\n }", "protected function savePicture($file)\n {\n $this->loadImageResource();\n\n // SUPPORT FOR CMYK IMAGES\n $colorSpace = new Colorspace();\n $colorSpace->apply($this);\n\n // APPLY EFFECT ON IMAGE\n foreach($this->effect as $effect)\n {\n if($effect instanceof PictureEffect)\n {\n $effect->apply($this);\n }\n }\n\n // CREATE DIRECTORY BY FILE PATH\n if(!file_exists($directory = dirname($file)))\n {\n mkdir($directory, 0777, TRUE);\n }\n\n // Zjistíme v jakém formátu máme obrázek uložit.\n $imageSaveFormat = $this->saveAs ?: strtolower(pathinfo($file, PATHINFO_EXTENSION));\n\n // Provedeme uložení obrázku přes GD.\n if($this->isGd())\n {\n // Uložení do WebP.\n if($imageSaveFormat === EPictureFormat::WEBP)\n {\n if($this->progressive)\n {\n imageinterlace($this->resource, TRUE);\n }\n\n imagewebp($this->resource, $file, $this->quality);\n }\n // Uložení do PNG.\n elseif($imageSaveFormat === EPictureFormat::PNG)\n {\n if($this->progressive)\n {\n imageinterlace($this->resource, TRUE);\n }\n\n imagepng($this->resource, $file, 9);\n }\n // Uložení do GIF.\n elseif($imageSaveFormat === EPictureFormat::GIF)\n {\n $gifResource = $this->resource;\n\n if($this->isGdImageTransparent($gifResource))\n {\n $validAlpha = ceil(0.333 * 127);\n $visiblePixels = 0;\n\n $height = imagesy($gifResource);\n $width = imagesx($gifResource);\n\n $transparentColor = imagecolorallocate($gifResource, 0xfe, 0x3, 0xf4);\n\n // FIX GIF IMAGE OPACITY\n for($x = 0; $x < $width; $x++)\n {\n for($y = 0; $y < $height; $y++)\n {\n $pixelIndex = imagecolorat($gifResource, $x, $y);\n $pixelColor = imagecolorsforindex($gifResource, $pixelIndex);\n\n if($pixelColor['alpha'] <= $validAlpha)\n {\n $visiblePixels++;\n }\n }\n }\n\n if(!$visiblePixels)\n {\n $validAlpha = 127;\n }\n\n for($x = 0; $x < $width; $x++)\n {\n for($y = 0; $y < $height; $y++)\n {\n $pixelIndex = imagecolorat($gifResource, $x, $y);\n $pixelColor = imagecolorsforindex($gifResource, $pixelIndex);\n\n if($pixelColor['alpha'] >= $validAlpha)\n {\n imagesetpixel($gifResource, $x, $y, $transparentColor);\n }\n else\n {\n $visiblePixel = imagecolorallocatealpha(\n\n $gifResource,\n $pixelColor['red'],\n $pixelColor['green'],\n $pixelColor['blue'],\n 0\n );\n\n imagesetpixel($gifResource, $x, $y, $visiblePixel);\n }\n }\n }\n\n imagecolortransparent($gifResource, $transparentColor);\n }\n\n if($this->progressive)\n {\n imageinterlace($gifResource, TRUE);\n }\n\n imagegif($gifResource, $file);\n }\n // Uložení do JPG.\n else\n {\n $image = $this->resource;\n\n $width = imagesx($image);\n $height = imagesy($image);\n\n $background = imagecreatetruecolor($width, $height);\n $whiteColor = imagecolorallocate($background, 255, 255, 255);\n\n imagefilledrectangle($background, 0, 0, $width, $height, $whiteColor);\n imagecopy($background, $image, 0, 0, 0, 0, $width, $height);\n\n if($this->progressive)\n {\n imageinterlace($background, TRUE);\n }\n\n imagejpeg($background, $file, $this->quality);\n }\n }\n // Provedeme uložení obrázku přes Imagick.\n else\n {\n // Uložení do WebP.\n if($imageSaveFormat === EPictureFormat::WEBP)\n {\n // There are problems with saving webP via imagick.\n // We will fall back to use GD extension to save image.\n $imageGd = $this->convertResource($this::WORKER_GD);\n\n if($this->progressive)\n {\n imageinterlace($imageGd, TRUE);\n }\n\n imagewebp($imageGd, $file, $this->quality);\n }\n // Uložení do JPG.\n elseif($imageSaveFormat === EPictureFormat::JPG)\n {\n $background = $this->createImagick();\n $background->newImage(\n\n $this->resource->getImageWidth(),\n $this->resource->getImageHeight(),\n '#FFFFFF'\n );\n\n $background->compositeImage($this->resource, Imagick::COMPOSITE_OVER, 0, 0);\n $background->setImageFormat('jpg');\n $background->setImageCompression(Imagick::COMPRESSION_JPEG);\n $background->setImageCompressionQuality($this->quality);\n\n if($this->progressive)\n {\n $background->setInterlaceScheme(Imagick::INTERLACE_PLANE);\n }\n\n $background->writeImage($file);\n }\n // Uložení do GIF.\n elseif($imageSaveFormat === EPictureFormat::GIF)\n {\n $validAlpha = 0.333;\n $visiblePixels = 0;\n $iterator = $this->resource->getPixelIterator();\n\n /** @var $pixel \\ImagickPixel */\n foreach($iterator as $row => $pixels)\n {\n foreach ($pixels as $col => $pixel)\n {\n $color = $pixel->getColor(TRUE);\n\n if($color['a'] >= $validAlpha)\n {\n $visiblePixels++;\n }\n }\n\n $iterator->syncIterator();\n }\n\n if(!$visiblePixels)\n {\n $validAlpha = 0;\n }\n\n // SAVE NEW ALPHA COLOR VALUE\n foreach($iterator as $row => $pixels)\n {\n foreach ($pixels as $col => $pixel)\n {\n $color = $pixel->getColor(TRUE);\n $pixel->setColorValue(Imagick::COLOR_ALPHA, $color['a'] >= $validAlpha ? 1 : 0);\n }\n\n $iterator->syncIterator();\n }\n\n if($this->progressive)\n {\n $this->resource->setInterlaceScheme(Imagick::INTERLACE_PLANE);\n }\n\n $this->resource->writeImage($file);\n }\n // Uložení do PNG.\n else\n {\n if($this->progressive)\n {\n $this->resource->setInterlaceScheme(Imagick::INTERLACE_PLANE);\n }\n\n $this->resource->writeImage($file);\n }\n }\n\n // Nastavení práv založenému obrázku.\n chmod($file, 0777);\n touch($file, filemtime($this->getImage()));\n\n // Odstranění dočasných souborů.\n foreach($this->tmpImage as $tmpImage)\n {\n unlink($tmpImage);\n }\n }", "public function getSavePath() {\n return $this->__imageSavePath;\n }", "private function save_image($source, $destination, $image_type){\n\tswitch(strtolower($image_type)){//determine mime type\n\tcase 'image/png':\n\t imagepng($source, $destination); return true; //save png file\n\t break;\n\tcase 'image/gif':\n\t imagegif($source, $destination); return true; //save gif file\n\t break; \n\tcase 'image/jpeg': case 'image/pjpeg':\n\t imagejpeg($source, $destination, '90'); return true; //save jpeg file\n\t break;\n\tdefault: return false;\n\t} \n\t}", "private function CacheSave($image, $file)\n {\n switch($this->saveAs) {\n case 'jpeg':\n case 'jpg':\n if($this->verbose) { self::verbose(\"Saving image as JPEG to cache using quality = {$this->quality}.\"); }\n imagejpeg($image, $file, $this->quality);\n break;\n\n case 'png':\n if($this->verbose) { self::verbose(\"Saving image as PNG to cache.\"); }\n // Turn off alpha blending and set alpha flag\n imagealphablending($image, false);\n imagesavealpha($image, true);\n imagepng($image, $file);\n break;\n\n default:\n self::errorMessage('No support to save as this file extension.');\n break;\n }\n if($this->verbose) {\n clearstatcache();\n $cacheFilesize = filesize($file);\n self::verbose(\"File size of cached file: {$cacheFilesize} bytes.\");\n $filesize = $this->imgInfo['filesize'];\n self::verbose(\"Cache file has a file size of \" . round($cacheFilesize/$filesize*100) . \"% of the original size.\");\n }\n }", "public function saveToDisk(uploadedFile $image)\n {\n $uploadDirectory = 'uploads/images';\n $path = $this->kernel->getProjectDir().'/public/'.$uploadDirectory;\n\n $imageName = uniqid().'.'.$image->guessExtension();\n\n $image->move($path, $imageName);\n\n return '/'.$uploadDirectory.'/'.$imageName;\n }", "public function saveImage($savePath, $imageQuality = \"100\") {\n switch ($this->ext) {\n case 'image/jpg':\n case 'image/jpeg':\n // Check PHP supports this file type\n if (imagetypes() & IMG_JPG) {\n imagejpeg($this->newImage, $savePath, $imageQuality);\n }\n break;\n\n case 'image/gif':\n // Check PHP supports this file type\n if (imagetypes() & IMG_GIF) {\n imagegif($this->newImage, $savePath);\n }\n break;\n\n case 'image/png':\n $invertScaleQuality = 9 - round(($imageQuality / 100) * 9);\n\n // Check PHP supports this file type\n if (imagetypes() & IMG_PNG) {\n imagepng($this->newImage, $savePath, $invertScaleQuality);\n }\n break;\n }\n\n imagedestroy($this->newImage);\n }", "public function save(string $fileName, string $extension = 'png', string $fileClass = Image::class, array $extraData = []) {\n\t\t$image = $this->getImage();\n\t\t$fileName = $this->generateValidFileName($fileName, $extension);\n\t\t$serverPath = $this->getServerPath();\n\n\t\tif (!$image->saveAs($serverPath . $fileName)) {\n\t\t\t$this->handleError($image);\n\t\t} else {\n\t\t\treturn $this->createFile($fileName, $fileClass, $extraData);\n\t\t}\n\t}", "public function save(Photo $photo);", "public function save($filename) {\r\n file_put_contents($filename, $this->contents);\r\n }", "function imageSaveToFile($file,$quality=0)\n {\n if ($quality == 0) $quality = $this->quality;\n\n if (count($this->error) == 0)\n {\n // no errors, try to save image\n if ($this->imgType == 'gif') $saved = imagegif($this->imgSrc,$file);\n if ($this->imgType == 'jpg') $saved = imagejpeg($this->imgSrc,$file,$quality);\n if ($this->imgType == 'png') $saved = imagepng($this->imgSrc,$file);\n\n if (!$saved)\n {\n // image was not written\n $this->error[] = 'InstantImage: cannot write image to file';\n return false;\n }\n else\n {\n $this->fileToFlush = $file;\n return true;\n }\n }\n else\n {\n // errors, doesn't make sense to save the wrong image\n $this->error[] = 'InstantImage: do not save the image because of errors';\n return false;\n }\n }", "public function save($value){\n $target_path = IMG_PATH.DS.$this->file_name;\n try {\n //move the uploaded file to target path\n move_uploaded_file($value, $target_path);\n return $this->_add_photo();\n } catch (Exception $e) {\n throw $e;\n }\n }", "public function save($path = 'barcode.png')\n {\n $dir = dirname($path);\n if (!file_exists($dir)) {\n mkdir($dir, 0644, true);\n }\n imagepng($this->_image, $path);\n }", "function save_image($source, $destination, $image_type, $quality){\n switch(strtolower($image_type)){//determine mime type\n case 'image/png':\n imagepng($source, $destination); return true; //save png file\n break;\n case 'image/gif':\n imagegif($source, $destination); return true; //save gif file\n break;\n case 'image/jpeg': case 'image/pjpeg':\n imagejpeg($source, $destination, $quality); return true; //save jpeg file\n break;\n default: return false;\n }\n}", "function saveImage() {\n $_UPLOADS = $GLOBALS[\"server_upload_folder\"];\n $uploadOk = 1;\n\n $filePath = $_UPLOADS . basename($_FILES[\"image\"][\"name\"]);\n $imageFileType = pathinfo($filePath, PATHINFO_EXTENSION);\n\n // Check if file already exists\n if (file_exists($filePath)) {\n $uploadOk = 0;\n }\n\n // Check file size\n if ($_FILES[\"image\"][\"size\"] > 500000) {\n $uploadOk = 0;\n }\n\n // Allow certain file formats\n if($imageFileType != \"jpg\" && $imageFileType != \"png\" && $imageFileType != \"jpeg\" && $imageFileType != \"gif\" ) {\n $uploadOk = 0;\n }\n\n // If everything is ok, try to upload file\n if($uploadOk == 1) {\n\n if (move_uploaded_file($_FILES[\"image\"][\"tmp_name\"], $filePath)) {\n return $filePath;\n }\n }\n}", "public function saving(Model $model)\n {\n $file_name = $model->getAttribute($this->image_attribute_name);\n if (\n (!$file_name) ||\n (!Storage::has($this->getNormalPath(2, $file_name)))\n ) {\n if (\n (Storage::has(\"public/application/{$this->default_image_name}\")) &&\n (!Storage::has($this->getNormalPath(2, $this->default_image_name)))\n ) {\n try {\n /** @var Image $image */\n $image = ImageFacade::make(storage_path(\"app/public/application/{$this->default_image_name}\"));\n $this->loadMultipleImages([$image]);\n $this->saveImages();\n } catch (\\RuntimeException $exception) {\n logger($exception->getMessage());\n }\n }\n $model->setAttribute($this->image_attribute_name, $this->default_image_name);\n }\n }", "public function saveImage($targetPath = null)\n\t{\n\t\t$this->intern_save($targetPath);\n\t}", "public function we_save($resave = false, $skipHook = false){\n\t\t// get original width and height of the image\n\t\t$arr = $this->getOrigSize(true, true);\n\t\t$origw = $this->getElement('origwidth');\n\t\t$this->setElement('origwidth', isset($arr[0]) ? $arr[0] : 0, 'attrib');\n\t\t$this->setElement('origheight', isset($arr[1]) ? $arr[1] : 0, 'attrib');\n\t\t//if ($origw != $this->getElement('origwidth')){$this->DocChanged = true;}\n\t\tif(!$this->getElement('width')){\n\t\t\t$this->setElement('width', $this->getElement('origwidth'), 'attrib');\n\t\t}\n\t\tif(!$this->getElement('height')){\n\t\t\t$this->setElement('height', $this->getElement('origheight'), 'attrib');\n\t\t}\n\n\t\t$docChanged = $this->DocChanged; // will be reseted in parent::we_save()\n\t\tif(parent::we_save($resave, $skipHook)){\n\t\t\tif($docChanged){\n\t\t\t\t$this->DocChanged = true;\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}", "function save_image($source, $destination, $image_type, $quality){\n\tswitch(strtolower($image_type)){//determine mime type\n\t\tcase 'image/png':\n\t\t\timagepng($source, $destination); return true; //save png file\n\t\t\tbreak;\n\t\tcase 'image/gif':\n\t\t\timagegif($source, $destination); return true; //save gif file\n\t\t\tbreak;\n\t\tcase 'image/jpeg': case 'image/pjpeg':\n\t\t\timagejpeg($source, $destination, $quality); return true; //save jpeg file\n\t\t\tbreak;\n\t\tdefault: return false;\n\t}\n}", "function save($path, $file) {\n // сохраняем миниатюру]\n // создать миниатюру\n // if (!move_uploaded_file($_FILES['qqfile']['tmp_name'], $path.'small/small_'.$file)) {\n // return false;\n // }\n // если всё нормально, то\n // сохраняем оригинальный файл\n if(!move_uploaded_file($_FILES['qqfile']['tmp_name'], $path.$file)){\n return false;\n }\n\n // создать миниатюру\n $image = new SimpleImage();\n $image->load($path.$file);\n $image->resize(400, 200);\n $image->save($path.'small/small_'.$file);\n\n return true;\n }", "function writeImageToFile($img, $userid, $picno, $file=\"\") {\n if ($file == '') {\n $filename= $userid.$picno.'.jpg';\n } else {\n $filename = $file;\n }\n\n $img = imagecreatefromstring( $img );\n imagejpeg($img, USER_IMAGE_DIR.$filename);\n\n return ($filename);\n}", "protected function saveImage($previous_image = '')\n {\n $image = UploadedFile::getInstanceByName('image');\n if ($image) {\n $file = pathinfo($image->name);\n $filename = uniqid().'.'.$file['extension'];\n $path = Yii::getAlias('@webroot').'/images/stamp/';\n if($image->saveAs($path.$filename)){\n if ($previous_image !== '') {\n unlink($path . $previous_image);\n }\n return $filename;\n }\n }else{\n return '';\n }\n }", "private function writeImage($filename, $content) {\n\t\ttry {\n\t\t\t\n\t\t\tif (empty($filename)) {\n\t\t\t\tthrow new Exception('No filename given for target file.');\n\t\t\t}\n\t\t\t\n\t\t\tif (empty($content)) {\n\t\t\t\tthrow new Exception('cant write to file: ' . $filename .\" , no content specified.\");\n\t\t\t}\n\t\t\n\t\t\t$fp = fopen($filename,\"w\");\n\t\t\t$b = fwrite($fp,$content);\n\t\t\tfclose($fp);\n\t\t\tif($b != -1){\n\t\t\t\treturn true;\n\t\t\t} else {\n\t\t\t\tthrow new Exception('Could not write to disk, check permissons');\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t} catch (Exception $ex) {\n\t\t\tthrow $ex;\n\t\t}\n\t}", "public function save() {\n// is there an image resource and file location to work with?\n if (isset($this->_resource, $this->_file_location)) {\n switch ($this->_mimetype) {\n case \"image/jpeg\":\n imagejpeg($this->_resource, $this->_file_location);\n break;\n case \"image/png\":\n imagepng($this->_resource, $this->_file_location);\n break;\n case \"image/gif\":\n imagegif($this->_resource, $this->_file_location);\n break;\n }\n } else {\n trigger_error(\"CAMEMISResizeImage::save() attempting to access a non-existent resource (check if the image was loaded by CAMEMISResizeImage::__construct())\", E_USER_WARNING);\n }\n\n return $this;\n }", "public static function save_image($image)\n {\n $image_name = str_random(60);\n ini_set('allow_url_fopen', 1);\n $image = \\Image::make($image);\n $image->save(config('filesystems.disks.cars.root').'/'.$image_name.'.jpg');\n\n return $image_name.'.jpg';\n }", "public function save(string $path, $filename = null): bool {\n $filename = $filename ?: $this->getName();\n\n return file_put_contents($path.$filename, $this->getContent()) !== false;\n }", "private function saveGdImage( $dst_img, $filepath, $type ) {\n\t\t$successSaving = false;\n\t\tswitch ( $type ) {\n\t\t\tcase IMAGETYPE_JPEG:\n\t\t\t\t$successSaving = imagejpeg( $dst_img,$filepath,$this->jpg_quality );\n\t\t\t\tbreak;\n\t\t\tcase IMAGETYPE_PNG:\n\t\t\t\t$successSaving = imagepng( $dst_img,$filepath );\n\t\t\t\tbreak;\n\t\t\tcase IMAGETYPE_GIF:\n\t\t\t\t$successSaving = imagegif( $dst_img,$filepath );\n\t\t\t\tbreak;\n\t\t\tcase IMAGETYPE_BMP:\n\t\t\t\t$successSaving = imagewbmp( $dst_img,$filepath );\n\t\t\t\tbreak;\n\t\t}\n\n\t\treturn($successSaving);\n\t}", "function savePNG($filename, $w, $h, $thumb_w = 0, $thumb_h = 0)\n {\n $im = $this->drawIm($w, $h);\n $im = $this->convertToThumbnail($im, $thumb_w, $thumb_h);\n\n //- Save PNG data\n\n imagepng($im, $filename);\n\n imagedestroy($im);\n }", "function savePNG($filename, $w, $h, $thumb_w = 0, $thumb_h = 0)\n {\n $im = $this->drawIm($w, $h);\n $im = $this->convertToThumbnail($im, $thumb_w, $thumb_h);\n\n //- Save PNG data\n\n imagepng($im, $filename);\n\n imagedestroy($im);\n }", "function save($filename, $type, $quality) {\r\n return null; //PEAR::raiseError(\"No Save method exists\", true);\r\n }", "function save_image($source, $image_type, $destination_folder){\n\t switch(strtolower($image_type)){//determine mime type\n\t\t case 'image/png': \n\t\t\t imagepng($source, $destination_folder); return true; //save png file\n\t\t\t break;\n\t\t case 'image/gif': \n\t\t\t imagegif($source, $destination_folder); return true; //save gif file\n\t\t\t break; \n\t\t case 'image/jpeg': case 'image/pjpeg': \n\t\t\t imagejpeg($source, $destination_folder); return true; //save jpeg file\n\t\t\t break;\n\t\t default: return false;\n\t }\n }", "public function saveAs( $newName ) {\n if ( $this->folder != \"\" ) {\n $folder = $this->folder . \"/\";\n } else {\n $folder = \"\";\n }\n if ( $this->mimetype == 'image/jpeg' ) {\n imagejpeg( $this->image, \"$folder$newName\" );\n }\n if ( $this->mimetype == 'image/png' ) {\n imagepng( $this->image, \"$folder$newName\" );\n }\n if ( $this->mimetype == 'image/gif' ) {\n imagegif( $this->image, \"$folder$newName\" );\n }\n\n return $this;\n }", "public function saveAs(string $path): void;", "public function save($pathToOutputFile)\n {\n switch($this->type)\n {\n case 'image/jpg':\n case 'image/jpeg':\n return imagejpeg($this->getWorkingImageResource(), $pathToOutputFile, self::JPEG_QUALITY);\n\n case 'image/png':\n return imagepng($this->getWorkingImageResource(), $pathToOutputFile);\n }\n }", "public function save($filename, $content);", "public function saveScreenshot($filename = null, $filepath = null)\n {\n // Under Cygwin, uniqid with more_entropy must be set to true.\n // No effect in other environments.\n $filename = $filename ?: sprintf('%s_%s_%s.%s', $this->getMinkParameter('browser_name'), date('c'), uniqid('', true), 'png');\n $filepath = $filepath ? $filepath : (ini_get('upload_tmp_dir') ? ini_get('upload_tmp_dir') : sys_get_temp_dir());\n file_put_contents($filepath . '/' . $filename, $this->getSession()->getScreenshot());\n }", "public static function save_file($_file)\n {\n $photo_file = MyUtil::gen_file_name();\n $new_file = $_SERVER['DOCUMENT_ROOT'] . \"/statics/images/upload/$photo_file\";\n if (file_put_contents($new_file, $_file)) {\n $img_type = exif_imagetype($new_file);\n $ext = image_type_to_extension($img_type, TRUE);\n rename($new_file, $new_file . $ext);\n $new_file = $new_file . $ext;\n return $photo_file . $ext;\n }\n }", "function we_save($resave = 0) {\n\n\t\t// get original width and height of the image\n\t\t$arr = $this->getOrigSize(true, true);\n\t\t$this->setElement(\"origwidth\",isset($arr[0]) ? $arr[0] : 0);\n\t\t$this->setElement(\"origheight\",isset($arr[1]) ? $arr[1] : 0);\n\t\t$docChanged = $this->DocChanged; // will be reseted in parent::we_save()\n\t\tif (parent::we_save($resave)) {\n\t\t\tif($docChanged){\n\t\t\t\t$thumbs = $this->getThumbs();\n\t\t\t\tinclude_once($_SERVER[\"DOCUMENT_ROOT\"].\"/webEdition/we/include/\".\"we_delete_fn.inc.php\");\n\t\t\t\tdeleteThumbsByImageID($this->ID);\n\t\t\t\tif(count($thumbs)){\n\t\t\t\t\tforeach($thumbs as $thumbID) {\n\t\t\t\t\t\t$thumbObj = new we_thumbnail();\n\t\t\t\t\t\t$thumbObj->initByThumbID($thumbID,$this->ID,$this->Filename,$this->Path,$this->Extension,$this->getElement(\"origwidth\"),$this->getElement(\"origheight\"),$this->getDocument());\n\t\t\t\t\t\t$thumbObj->createThumb();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}", "public function writeimg() {\n\t\t$data = Input::all();\n\t\t$img = $data['imgdata'];\n\t\t$student_id = $data['student_id'];\n\t\t$img = str_replace('data:image/png;base64,', '', $img);\n\t\t$img = str_replace(' ', '+', $img);\n\t\t$imgdat = base64_decode($img);\n\t\t$myPublicFolder = public_path();\n\t\t$savePath = $myPublicFolder.\"/photo\";\n\t\t$path = $savePath.\"/$student_id.png\";\n\t\tFile::delete($path);\n\t\tFile::put($path , $imgdat);\n\t\t$last_add = Student::orderby('id', 'desc')->first();\n\t\tStudent::where('student_id', '=', $student_id)->update(array('pic' => \"$student_id.png\"));\n\t\treturn View::make('finish', array('imgid' => Student::where('student_id', '=', $student_id)->firstOrFail()->group));\n\t}", "public function saveStickerToImage()\n {\n $this->sticker->saveToS3($this->stickerDir . $this->getDriverLogoImageName());\n }", "public function saveImageToUser($image, $user);", "function saveImageObjectToFile($objImage, $imageType, $fileName, $quality)\n\t{\n\t\t$filePath = dirname($fileName);\n\t\tif (!is_dir($filePath))\n\t\t\tmkdir($filePath, 0777, true);\n\t\t\n\t\t// If the file already exists\n\t\tif(is_file($fileName))\n\t\t\t@unlink($fileName);\n\n\t\t\t\t\n\t\tswitch ($imageType)\n\t\t{\n\t\t\tcase 1: $res = @imagegif($objImage,$fileName); break;\n\t\t\tcase 2: $res = @imagejpeg($objImage,$fileName,intval($quality*100)); break;\n\t\t\tcase 3: $res = @imagepng($objImage,$fileName,intval($quality*9)); break;\n\t\t}\n\t\t\t\t\n\t\tif (!$res)\n\t\t\t$this->lastError = 'error_saving_image_file';\n\t\t\n\t\tchmod($fileName, 0777);\n\t\t\n\t\treturn $res;\n\t}", "function save()\n {\n }", "function save()\n {\n }", "function savePicture($filepath,$data)\n {\n $file = fopen($filepath,\"w+\");\n fwrite($file,$data);\n fclose($file);\n }", "public function saveImageFile($file, $name){\n $path = 'assets/images/'.$name;\n\n //aqui movemos el archivo desde la ruta temporal a nuestra ruta\n //usamos la variable $resultado para almacenar el resultado del\n // proceso de mover el archivo almacenara true o false\n $result = move_uploaded_file($file, $path);\n return $result;\n }", "public function saveFile()\n {\n $newFileName = $this->generateFilename();\n $this->getOwner()->setAttribute($this->attributeName, $newFileName);\n return $this->uploadManager->save($this->getUploadedFileInstance(), $this->getUploadPath(), $newFileName);\n }", "public static function saveImageToDisk($originalName, $image)\n {\n $path = 'groups/'.Str::random().'-'.$originalName;\n\n Storage::disk('public')->put($path, $image);\n\n return $path;\n }", "public function save($file=null, $quality=null);", "function saveThumbnailImage($filename, $destinationFile){\n\t\t $this->resizeSaveImage($filename, $destinationFile, self::thumbWidth);\n\t }", "public function saveSVG($filename = 'pig.svg')\n\t{\n\t\t$svg = $this->renderSVG();\n\t\t$path = dirname(__FILE__) . '/' . $filename;\n\t\tvar_dump($path);\n\n\t\tfile_put_contents($path, $svg);\n\t}", "public function save(array $options = []) {\n/* if (preg_match('/image/', $this->mime_type)) {\n $this->isImage = true;\n $manager = new ImageManager(array('driver' => 'gd'));\n $image = Storage::disk('public')->get($this->myFile);\n $imageOrig = $manager->make($image); \n //Get width and height of the image\n $this->img_width = $imageOrig->width();\n $this->img_height = $imageOrig->height();\n }*/\n parent::save($options);\n $this->createThumbs();\n }", "public static function save($file)\n {\n //caminho para salvar a imagem\n $target = \"img/prods/\" . $file['name'];\n\n //tipos de arquivos permitidos\n $allowed = ['jpg', 'jpeg', 'png', 'gif'];\n\n //pegando a extensão da imagem passada\n $fileExtension = explode('.', $file['name']);\n $fileExtension = strtolower(end($fileExtension));\n\n //verficação para testar a integridade do arquivo passado\n if ($file['error'] == 0) {\n if ($file['size'] < 7000000) {\n if (in_array($fileExtension, $allowed)) {\n\n //se tudo estiver ok, adicione ele na pasta\n move_uploaded_file($file['tmp_name'], $target);\n }\n }\n }\n }", "public function save($filename = self::DEFAULT_NAME)\r\n {\r\n $this->dom->save($filename);\r\n }", "public function saveImage($imageResource, $fileName)\n {\n $filePart = explode(\".\", $fileName);\n \n $fileExtension = strtolower($filePart[count($filePart) - 1]);\n \n if ($fileExtension === 'bmp') {\n return imagebmp($imageResource, $fileName);\n }\n elseif ($fileExtension === 'gd2') {\n return imagegd2($imageResource, $fileName);\n }\n elseif ($fileExtension === 'gd') {\n return imagegd($imageResource, $fileName);\n }\n elseif ((imagetypes() & IMG_GIF) && $fileExtension === 'gif') {\n return imagegif($imageResource, $fileName);\n }\n elseif ((imagetypes() & IMG_JPG) && ($fileExtension === 'jpeg' || $fileExtension === 'jpg')) {\n return imagejpeg($imageResource, $fileName);\n }\n elseif ((imagetypes() & IMG_PNG) && $fileExtension === 'png') {\n return imagepng($imageResource, $fileName);\n }\n elseif ((imagetypes() & IMG_WBMP) && $fileExtension === 'wbmp') {\n return imagewbmp($imageResource, $fileName);\n }\n elseif ((imagetypes() & IMG_WEBP) && $fileExtension === 'webp') {\n return imagewebp($imageResource, $fileName);\n }\n elseif ($fileExtension === 'xbm') {\n return imagexbm($imageResource, $fileName);\n }\n elseif ((imagetypes() & IMG_XPM) && $fileExtension === 'xpm') {\n return imagexbm($imageResource, $fileName);\n }\n else {\n return false;\n }\n }", "public final function save()\n {\n }", "function save($path, $file) {\n $input = fopen(\"php://input\", \"r\");\n $temp = tmpfile();\n $realSize = stream_copy_to_stream($input, $temp);\n fclose($input);\n\n if ($realSize != $this->getSize()){\n return false;\n }\n\n\n $target = fopen($path.$file, \"w\");\n fseek($temp, 0, SEEK_SET);\n stream_copy_to_stream($temp, $target);\n fclose($target);\n\n // создать миниатюру\n $image = new SimpleImage();\n $image->load($path.$file);\n $image->resizeToHeight(200);\n $image->save($path.'small/small_'.$file);\n ;\n\n return true;\n }", "public function save()\n {\n if ($this->createDirectoryStructure($this->getPath())) {\n $content = $this->generateContents();\n file_put_contents($this->getPathname(), $content);\n }\n }", "protected function savePhoto(UploadedFile $image)\n {\n $fileName = str_random(40) . '.' . $image->guessClientExtension();\n $destinationPath = public_path() . DIRECTORY_SEPARATOR . 'img';\n $image->move($destinationPath, $fileName);\n return $fileName;\n }" ]
[ "0.7662879", "0.69788116", "0.6926806", "0.68358123", "0.6674351", "0.6625614", "0.6565919", "0.6548842", "0.6491323", "0.6469623", "0.6458421", "0.6442479", "0.64292246", "0.6367738", "0.63242394", "0.6324052", "0.62599343", "0.6175783", "0.61396295", "0.60573727", "0.6042098", "0.6039094", "0.60253227", "0.6016332", "0.60114413", "0.6010242", "0.59964985", "0.5994813", "0.5956977", "0.5944094", "0.593899", "0.5936708", "0.5915973", "0.59114194", "0.58925235", "0.5883676", "0.5868357", "0.5864335", "0.58488107", "0.5842506", "0.5829298", "0.5820448", "0.58041996", "0.5787419", "0.57667935", "0.5737257", "0.5733376", "0.5723771", "0.5723606", "0.57132083", "0.56981325", "0.5689933", "0.56897074", "0.5688219", "0.5675688", "0.56555164", "0.56531644", "0.56529486", "0.56516355", "0.5647689", "0.56424016", "0.5638765", "0.5632156", "0.5623519", "0.5621012", "0.5606748", "0.56067", "0.5603541", "0.5600337", "0.5598201", "0.5598201", "0.55930763", "0.5590069", "0.55843896", "0.55783314", "0.55749017", "0.55719453", "0.5570236", "0.5548533", "0.5546488", "0.55415416", "0.55406284", "0.55296713", "0.55296475", "0.55180854", "0.55180854", "0.5511761", "0.5504002", "0.5493271", "0.5482448", "0.54756165", "0.5475214", "0.5463694", "0.54422975", "0.54314274", "0.5421276", "0.5409709", "0.53936404", "0.5381719", "0.538122", "0.5374103" ]
0.0
-1
Render the image and return the binary string. // Render the image at 50% quality $data = $image>render(NULL, 50); // Render the image as a PNG $data = $image>render('png');
public function render($type = NULL, $quality = 100) { if ($type === NULL) { // Use the current image type $type = image_type_to_extension($this->type, FALSE); } return $this->_do_render($type, $quality); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function image_render()\r\n {\r\n // Send the correct HTTP header\r\n \\header(\"Cache-Control:no-cache,must-revalidate\");\r\n \\header(\"Pragma:no-cache\");\r\n \\header('Content-Type: image/'.static::$image_type);\r\n \\header(\"Connection:close\");\r\n\r\n // Pick the correct output function\r\n $function = '\\\\image'.static::$image_type;\r\n $function(static::$image);\r\n\r\n // Free up resources\r\n \\imagedestroy(static::$image);\r\n }", "protected function dumpImage():string{\n\t\tob_start();\n\n\t\ttry{\n\n\t\t\tswitch($this->options->outputType){\n\t\t\t\tcase QROutputInterface::GDIMAGE_GIF:\n\t\t\t\t\timagegif($this->image);\n\t\t\t\t\tbreak;\n\t\t\t\tcase QROutputInterface::GDIMAGE_JPG:\n\t\t\t\t\timagejpeg($this->image, null, max(0, min(100, $this->options->jpegQuality)));\n\t\t\t\t\tbreak;\n\t\t\t\t// silently default to png output\n\t\t\t\tcase QROutputInterface::GDIMAGE_PNG:\n\t\t\t\tdefault:\n\t\t\t\t\timagepng($this->image, null, max(-1, min(9, $this->options->pngCompression)));\n\t\t\t}\n\n\t\t}\n\t\t// not going to cover edge cases\n\t\t// @codeCoverageIgnoreStart\n\t\tcatch(Throwable $e){\n\t\t\tthrow new QRCodeOutputException($e->getMessage());\n\t\t}\n\t\t// @codeCoverageIgnoreEnd\n\n\t\t$imageData = ob_get_contents();\n\t\timagedestroy($this->image);\n\n\t\tob_end_clean();\n\n\t\treturn $imageData;\n\t}", "public function stream()\r\n\t{\r\n\t\tif(empty($this->img))\r\n\t\t{\r\n\t\t\t$this->render();\r\n\t\t}\r\n\t\theader('Content-type: image/png');\r\n\t\timagepng($this->img);\r\n\t}", "public function render()\n {\n header('Content-Type: image/png');\n\n imagepng($this->imageResource);\n imagedestroy($this->imageResource);\n }", "private function _renderToImageData(&$canvas) {\n\t\tob_start();\n\n\t\tswitch ($this->params['type']) {\n\t\t\tcase IMAGETYPE_GIF:\n\t\t\t\timagegif($canvas);\n\t\t\tbreak;\n\t\t\tcase IMAGETYPE_JPEG:\n\t\t\t\timagejpeg($canvas, null, $this->params['quality']);\n\t\t\tbreak;\n\t\t\tcase IMAGETYPE_PNG:\n\t\t\t\t//\tcalculate PNG quality, because it runs from 0 (uncompressed) to 9, instead of 0 - 100.\n\t\t\t\t$pngQuality = ($this->params['quality'] - 100) / 11.111111;\n\t\t\t\t$pngQuality = round(abs($pngQuality));\n\t\t\t\timagepng($canvas, null, $pngQuality, NULL);\n\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new Exception('Sorry, this image type is not supported');\n\t\t}\n\n\t\t$imgData = ob_get_contents();\n\t\tob_end_clean();\n\t\treturn $imgData;\n\t}", "public function render() {\n if (!$this->layout) return false;\n \n $mime = $this->layoutInfo['mime'] ? $this->layoutInfo['mime'] : 'image/png';\n \n header('Content-Type: ' . $mime);\n switch ($mime) {\n case 'image/jpeg':\n imagejpeg($this->layout);\n break;\n case 'image/gif':\n imagegif($this->layout);\n case 'image/png':\n default:\n imagepng($this->layout);\n break;\n }\n }", "public function png(){\n #header(\"Expires: \" . date(DATE_RFC822,strtotime($this->cache.\" seconds\")));\n header(\"content-type: image/png\");\n $graphdata = implode(' ', $graphdata);\n echo `$graphdata`;\n }", "public function getImage()\n\t{\n\t\treturn $this->generator->render($this->generateCode(), $this->params);\n\t}", "public function image();", "public function image();", "function dumpGraphic()\r\n {\r\n // Graphic component that dumps binary data\r\n header(\"Content-type: $this->_binarytype\");\r\n\r\n // Tries to prevent the browser from caching the image\r\n header(\"Pragma: no-cache\");\r\n header(\"Cache-Control: no-cache, must-revalidate\");// HTTP/1.1\r\n header(\"Expires: Mon, 26 Jul 1997 05:00:00 GMT\");// Date in the past\r\n\r\n if($this->hasValidDataField())\r\n {\r\n echo $this->readDataFieldValue();\r\n }\r\n\r\n exit;\r\n }", "function output($im) {\r\n\t\t//capture output buffer\r\n\t\tob_start();\r\n\t\t\timagejpeg($im);\r\n\t\t\t$output = ob_get_contents();\r\n\t\tob_end_clean();\r\n\t\t//echo encoded image\r\n\t\techo base64_encode($output);\r\n\t\treturn;\r\n\t}", "public function base64()\n {\n ob_start();\n\n imagepng($this->image);\n\n $string = ob_get_contents();\n\n ob_end_clean();\n\n return 'data:image/png;base64,'.base64_encode($string);\n }", "function print_image($path){\n $image = new Imagick();\n $image->readImage(_LOCAL_.$path);\n $height = $image->getImageHeight();\n $width = $image->getImageWidth();\n\n $canvas = new Imagick();\n $canvas->newImage($width,$height,new ImagickPixel('white'));\n $canvas->setImageFormat('png');\n $canvas->compositeImage($image,imagick::COMPOSITE_OVER, 0, 0);\n\n header('Content-type: image/png');\n echo $canvas;\n $image->destroy();\n $canvas->destroy();\n}", "public function testRender()\n {\n\n ob_start();\n $this->chart->render();\n $result = ob_get_clean();\n\n $renderedParts = TestUtils::parseRenderedImg($result);\n $expectedParts = $this->getExpectedResultArray();\n\n TestUtils::compareArrays($this, $expectedParts, $renderedParts);\n }", "function output()\r\n\t{\r\n\t\theader(\"Cache-Control: no-store, no-cache, must-revalidate\"); \r\n\t\theader(\"Expires: \" . date(\"r\"));\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\tswitch($this->image_type)\r\n\t\t{\r\n\t\t\tcase SI_IMAGE_JPG:\r\n\t\t\t\theader(\"Content-Type: image/jpeg\");\r\n\t\t\t\timagejpeg($this->im, null, 90);\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase SI_IMAGE_GIF:\r\n\t\t\t\theader(\"Content-Type: image/gif\");\r\n\t\t\t\timagegif($this->im);\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tdefault:\r\n\t\t\t\theader(\"Content-Type: image/gif\");\r\n\t\t\t\timagepng($this->im);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\r\n\t\timagedestroy($this->im);\r\n\t}", "function output($image_type=IMAGETYPE_JPEG)\n {\n //JPEG\n if( $image_type == IMAGETYPE_JPEG )\n {\n imagejpeg($this->image);\n } \n //GIF\n elseif( $image_type == IMAGETYPE_GIF ) \n {\n imagegif($this->image); \n } \n //PNG\n elseif( $image_type == IMAGETYPE_PNG ) \n {\n imagepng($this->image);\n } \n }", "public function handle($imageData)\n\t{\n\t\t$image = Image::make($imageData);\n\t\t$image->fit(50, 50);\n\t\treturn (string) $image->encode();\n\t}", "public function getImageOutputStream() {\n\t\t\t//Send Modified Header\n\t\t\theader(\"Content-Type: image/png\");\n\t\t\t\n\t\t\t//Output Image and destroy the Stream\n\t\t\timagepng($this->image);\n\t\t\timagedestroy($this->image);\n\t\t}", "public function render($type=null, $quality=null);", "protected function _do_render($type, $quality)\n {\n $this->_load_image();\n\n // Get the save function and IMAGETYPE\n list($save, $type) = $this->_save_function($type, $quality);\n\n // Capture the output\n ob_start();\n\n // Render the image\n $status = isset($quality) ? $save($this->_image, NULL, $quality) : $save($this->_image, NULL);\n\n if ($status === TRUE AND $type !== $this->type)\n {\n // Reset the image type and mime type\n $this->type = $type;\n $this->mime = image_type_to_mime_type($type);\n }\n\n return ob_get_clean();\n }", "public function toPng()\n {\n return $this->filter('conv', ['f' => 'png']);\n }", "protected function renderImage(){\n \n return sprintf(\n '<img src=\"%s\" title=\"%s\" alt=\"%s\">',\n $this->getField('url'),\n $this->getField('title',''),\n $this->getField('alt','')\n );\n \n }", "public function render(): string\n {\n $src = (string)$this->arguments['src'];\n if (($src === '' && $this->arguments['image'] === null) || ($src !== '' && $this->arguments['image'] !== null)) {\n throw new Exception('You must either specify a string src or a File object.', 1382284106);\n }\n\n if ((string)$this->arguments['fileExtension'] && !GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], (string)$this->arguments['fileExtension'])) {\n throw new Exception(\n 'The extension ' . $this->arguments['fileExtension'] . ' is not specified in $GLOBALS[\\'TYPO3_CONF_VARS\\'][\\'GFX\\'][\\'imagefile_ext\\']'\n . ' as a valid image file extension and can not be processed.',\n 1618989190\n );\n }\n\n try {\n $image = $this->imageService->getImage($src, $this->arguments['image'], (bool)$this->arguments['treatIdAsReference']);\n $cropString = $this->arguments['crop'];\n if ($cropString === null && $image->hasProperty('crop') && $image->getProperty('crop')) {\n $cropString = $image->getProperty('crop');\n }\n $cropVariantCollection = CropVariantCollection::create((string)$cropString);\n $cropVariant = $this->arguments['cropVariant'] ?: 'default';\n $cropArea = $cropVariantCollection->getCropArea($cropVariant);\n $processingInstructions = [\n 'width' => $this->arguments['width'],\n 'height' => $this->arguments['height'],\n 'minWidth' => $this->arguments['minWidth'],\n 'minHeight' => $this->arguments['minHeight'],\n 'maxWidth' => $this->arguments['maxWidth'],\n 'maxHeight' => $this->arguments['maxHeight'],\n 'crop' => $cropArea->isEmpty() ? null : $cropArea->makeAbsoluteBasedOnFile($image),\n ];\n if (!empty($this->arguments['fileExtension'] ?? '')) {\n $processingInstructions['fileExtension'] = $this->arguments['fileExtension'];\n }\n $processedImage = $this->imageService->applyProcessingInstructions($image, $processingInstructions);\n $imageUri = $this->imageService->getImageUri($processedImage, $this->arguments['absolute']);\n\n if (!$this->tag->hasAttribute('data-focus-area')) {\n $focusArea = $cropVariantCollection->getFocusArea($cropVariant);\n if (!$focusArea->isEmpty()) {\n $this->tag->addAttribute('data-focus-area', $focusArea->makeAbsoluteBasedOnFile($image));\n }\n }\n $this->tag->addAttribute('data-lazy', $imageUri);\n // $this->tag->addAttribute('src', $imageUri);\n $this->tag->addAttribute('width', $processedImage->getProperty('width'));\n $this->tag->addAttribute('height', $processedImage->getProperty('height'));\n\n // The alt-attribute is mandatory to have valid html-code, therefore add it even if it is empty\n if (empty($this->arguments['alt'])) {\n $this->tag->addAttribute('alt', $image->hasProperty('alternative') ? $image->getProperty('alternative') : '');\n }\n // Add title-attribute from property if not already set and the property is not an empty string\n $title = (string)($image->hasProperty('title') ? $image->getProperty('title') : '');\n if (empty($this->arguments['title']) && $title !== '') {\n $this->tag->addAttribute('title', $title);\n }\n } catch (ResourceDoesNotExistException $e) {\n // thrown if file does not exist\n throw new Exception($e->getMessage(), 1509741911, $e);\n } catch (\\UnexpectedValueException $e) {\n // thrown if a file has been replaced with a folder\n throw new Exception($e->getMessage(), 1509741912, $e);\n } catch (\\RuntimeException $e) {\n // RuntimeException thrown if a file is outside of a storage\n throw new Exception($e->getMessage(), 1509741913, $e);\n } catch (\\InvalidArgumentException $e) {\n // thrown if file storage does not exist\n throw new Exception($e->getMessage(), 1509741914, $e);\n }\n\n return $this->tag->render();\n }", "public function render()\n\t{\n\t\tif ($this->_getWidth() <= $this->_getMaxWidth() && $this->_getHeight() <= $this->_getMaxHeight())\n\t\t{\n\t\t\t$backgroundColor = $this->_getBackgroundColor();\n\t\t\t$textColor = $this->_getTextColor();\n\t\t\t$cachePath = $this->_getCacheDir() . '/' . $this->_getWidth() . '_' . $this->_getHeight() . '_' . (strlen($backgroundColor) === 3 ? $backgroundColor[0] . $backgroundColor[0] . $backgroundColor[1] . $backgroundColor[1] . $backgroundColor[2] . $backgroundColor[2] : $backgroundColor) . '_' . (strlen($textColor) === 3 ? $textColor[0] . $textColor[0] . $textColor[1] . $textColor[1] . $textColor[2] . $textColor[2] : $textColor) . '.png';\n\t\t\theader('Content-type: image/png');\n\t\t\theader('Expires: ' . gmdate('D, d M Y H:i:s \\G\\M\\T', time () + $this->_getExpires()));\n\t\t\theader('Cache-Control: public');\n\t\t\tif ($this->cacheIsEnabled() && Lumia_Utility_Filesystem::isReallyWritable($cachePath))\n\t\t\t{\n\t\t\t\t// send header identifying cache hit & send cached image\n\t\t\t\theader('img-src-cache: hit');\n\t\t\t\tprint file_get_contents($cachePath);\n\t\t\t} else\n\t\t\t{\n\t\t\t\t// cache disabled or no cached copy exists\n\t\t\t\t// send header identifying cache miss if cache enabled\n\t\t\t\tif ($this->cacheIsEnabled())\n\t\t\t\t{\n\t\t\t\t\theader('img-src-cache: miss');\n\t\t\t\t}\n\n\t\t\t\t$image = $this->_createImage();\n\t\t\t\timagepng($image);\n\n\t\t\t\t// write cache\n\t\t\t\tif ($this->cacheIsEnabled() && Lumia_Utility_Filesystem::isReallyWritable($this->_getCacheDir()))\n\t\t\t\t{\n\t\t\t\t\timagepng($image, $cachePath);\n\t\t\t\t}\n\n\t\t\t\timagedestroy($image);\n\t\t\t}\n\t\t\t\t\n\t\t\texit;\n\t\t} \n\t\t\n\t\tthrow new Lumia_Placeholder_Exception(__METHOD__ . '() Placeholder size may not exceed ' . $this->_getMaxWidth() . 'x' . $this->_getMaxHeight() . ' pixels.');\n\t}", "function OutputImage ($im, $format, $quality)\n{\n switch ($format)\n {\n case \"JPEG\": \n ImageJPEG ($im, \"\", $quality);\n break;\n case \"PNG\":\n ImagePNG ($im);\n break;\n case \"GIF\":\n ImageGIF ($im);\n break;\n }\n}", "public function display()\n {\n header(\"Content-Type: image/png; name=\\\"barcode.png\\\"\");\n imagepng($this->_image);\n }", "public function render()\n {\n Response::setContentType('png');\n\n $fontSize = rand(0, 30);\n $string = StringUtility::getRandomString($this->length, true);\n foreach (str_split($string) as $char) {\n if (!$this->fixedSpacing) {\n $fontSize = rand(0, 30);\n }\n imagettftext($this->image, 30, $fontSize, $this->left, $this->top, $this->getFontColor(), $this->getFont(), $char);\n $this->left += $this->getSpacing();\n }\n\n Processor::setInternalSessionValue($this->name, $string);\n imagepng($this->image);\n imagedestroy($this->image);\n }", "public function send()\n {\n header(static::CONTENT_TYPE_HEADER);\n imagepng($this->imageResource);\n }", "public function generateBlankImage($config){ \n\t\t$image = imagecreatetruecolor($config['img_width'], $config['img_height']);\n\t\timagesavealpha($image, true);\n\t\t$transparent = imagecolorallocatealpha($image, 0, 0, 0, 127);\n\t\timagefill($image, 0, 0, $transparent);\n\t\t// cache the output\n\t\tob_start();\n\t\timagepng($image);\n\t\t$img = ob_get_contents();\n\t\tob_end_clean();\n\t\t// return the string\n\t\treturn base64_encode($img);\n\t}", "function outputImage( $code, $filename ) {\n\n if ( empty( $this->filePath ) ) {\n #Header( \"Content-type: text/plain\"); \n Header( \"Content-type: image/\".$this->imgMime); \n } else {\n if ( empty($filename) ) $filename = \"$code.\".$this->imgType;\n $filename = $this->filePath.$filename;\n }\n\n $func = \"image\".$this->imgType;\n \n if ( $this->imgQuality < 100 ) \n\n // Output JPEG with lower quality to browser or file\n\t \n $func($this->img, $filename,$this->imgQuality); \n\n else {\n if ( $filename ) \n\n // Output image to file\n\t\t\n $func($this->img, $filename); \n else\n\n // Output image to browser\n\n $func($this->img); \n }\n\n ImageDestroy($this->img);\n return $filename;\n}", "public function draw(){\n\t\t$this->doOutputResource();\n\t\t$defExt=\"gif\";\n\t\t$ext = ($this->outputFilename && strtolower(substr($this->outputFilename,-3))==\"$defExt\") ? substr($this->outputFilename,-4) :\".$defExt\";\n\t\t$out = $this->outputFilename.$ext;\n\t\tif(!$this->outputFilename){\n\t\t\theader(\"Content-Type: image/gif\");\n\t\t\t$out=null;\n\t\t}\n\t\t$this->outputFilename = $out;\n\t\treturn imagegif($this->outImage,$this->outputFilename);\n\t}", "public function assemble() {\n $image_check = $this->_checkImage();\n // Image check is bad so we pass control back to the old OsC image wrapper\n if ( 'abort' == $image_check ) {\n return false;\n }\n // If we have to only we generate a thumb .. this is very resource intensive\n if ( 'no_thumb_required' !== $image_check ) {\n $this->_generateThumbnail();\n }\n return $this->_imageBody();\n }", "public function output()\n {\n $imageFile = $this->storage->getPath($this);\n\n if(file_exists($imageFile))\n {\n header('Content-Type: image');\n header('Content-Length: ' . filesize($imageFile));\n\n readfile($imageFile);\n exit;\n }\n }", "protected function _render()\r\n\t{\r\n\t\tCore::getLang()->load(\"Signature\");\r\n\t\t$config = $this->getConfig()->getChildren(\"image\");\r\n\t\t$statsConfig = $config->getChildren(\"stats\");\r\n\t\t$planetsConfig = $config->getChildren(\"planets\");\r\n\r\n\t\t$user = $this->getUser();\r\n\t\t$img = imagecreatefrompng(AD.\"img/\".$config->getString(\"background\"));\r\n\r\n\t\tif($statsConfig->getInteger(\"show\"))\r\n\t\t{\r\n\t\t\t$result = Core::getQuery()->select(\"user\", array(\"userid\"));\r\n\t\t\t$totalUser = fNumber(Core::getDB()->num_rows($result));\r\n\t\t\tCore::getDB()->free_result($result);\r\n\t\t\t$this->_addParamToImage($img, \"stats\", Core::getLang()->get(\"RANK\").\" \".$user->getFormattedRank().\"/\".$totalUser);\r\n\t\t}\r\n\r\n\t\tif($planetsConfig->getInteger(\"show\"))\r\n\t\t{\r\n\t\t\t$result = Core::getQuery()->select(\"planet\", array(\"planetid\"), \"\", \"userid = '{$user->getUserid()}' AND ismoon = 0\");\r\n\t\t\t$planets = Core::getLang()->get(\"NUMBER_OF_COLONY\").\" \".fNumber(Core::getDB()->num_rows($result) - 1);\r\n\t\t\tCore::getDB()->free_result($result);\r\n\t\t\t$this->_addParamToImage($img, \"planets\", $planets);\r\n\t\t}\r\n\r\n\t\t$this->_addParamToImage($img, \"username\", $user->getUsername());\r\n\t\t$this->_addParamToImage($img, \"gamename\", Core::getConfig()->get(\"pagetitle\"));\r\n\t\t$this->_addParamToImage($img, \"planet\", $user->getHomePlanet()->getPlanetname().\" [\".$user->getHomePlanet()->getCoords(false).\"]\");\r\n\t\t$this->_addParamToImage($img, \"points\", Core::getLang()->get(\"POINTS\").\" \".$user->getFormattedPoints());\r\n\r\n\t\tif($user->getAid())\r\n\t\t{\r\n\t\t\t$this->_addParamToImage($img, \"alliance\", Core::getLang()->get(\"ALLIANCE\").\" \".$user->getAlliance()->getTag());\r\n\t\t}\r\n\r\n\t\timagepng($img, $this->getCachePath().$this->getUserId().self::IMAGE_FILE_EXTENSION, $config->getInteger(\"quality\"));\r\n\t\timagedestroy($img);\r\n\t\treturn $this;\r\n\t}", "public function getImage();", "public function getImage();", "public function getImage();", "public function getImage();", "public function render()\n\t{\n\t\t//set our header to display an image\n\t\theader('Content-Type: image/png');\n\n\t\t//print the image\n\t\techo $this->bg;\n\t}", "function showImage()\n\t{\n\t\tif (!$this->ImageStream) {\n\t\t\t$this->printError('image not loaded');\n\t\t}\n\n\t\tswitch ($this->type) {\n\t\t\tcase 1:\n\t\t\t\timagegif($this->ImageStream);\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\timagejpeg($this->ImageStream);\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\timagepng($this->ImageStream);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t$this->printError('invalid imagetype');\n\t\t}\n\t}", "function printImage($image = \"\")\n {\n $image = $this->returnImage($image);\n Header(\"Content-type: \".$this->contenttype.\"\\nContent-Length: \" . strlen($image));\n print $image;\n }", "public function colorImage() {}", "function OutputImage ($im, $format, $quality) \n{ \n\tswitch ($format) \n\t{ \n\t\tcase \"JPEG\": \n\t\t\tImageJPEG ($im, NULL, $quality); \n\t\t\tbreak; \n\t\tcase \"PNG\": \n\t\t\tImagePNG ($im); \n\t\t\tbreak; \n\t\tcase \"GIF\": \n\t\t\tImageGIF ($im); \n\t\t\tbreak; \n\t} \n}", "public function run(Image $image)\n {\n $format = $this->getFormat($image);\n $quality = $this->getQuality();\n\n if (in_array($format, ['jpg', 'pjpg'], true)) {\n $image = $image->getDriver()\n ->newImage($image->width(), $image->height(), '#fff')\n ->insert($image, 'top-left', 0, 0);\n }\n\n if ('pjpg' === $format) {\n $image->interlace();\n $format = 'jpg';\n }\n\n return $image->encode($format, $quality);\n }", "public function toGDImage() {}", "function string2image($string) {\n\t\t$converted = imagecreatefromstring($string);\n\t\tob_start();\n\t\timagepng($converted);\n\t\t$contents = ob_get_contents();\n\t\tob_end_clean();\n\t\treturn \"<img src='data:image/png;base64,\".base64_encode($contents).\"' />\";\n\t\timagedestroy($converted);\n\t}", "public function output_image()\n {\n if (empty($this->tmp_img)) {\n if ( ! $this->SILENT_MODE) {\n trigger_error('No temporary image for resizing!', E_USER_WARNING);\n }\n return false;\n }\n header('Content-Type: image/' . $this->output_type);\n $this->_set_new_size_auto();\n if ($this->output_width != $this->source_width || $this->output_height != $this->source_height || $this->output_type != $this->source_type) {\n $this->tmp_resampled = imagecreatetruecolor($this->output_width, $this->output_height);\n imagecopyresampled($this->tmp_resampled, $this->tmp_img, 0, 0, 0, 0, $this->output_width, $this->output_height, $this->source_width, $this->source_height);\n }\n $func_name = 'image' . $this->output_type;\n strlen($this->output_type) ? $func_name($this->tmp_resampled) : null;\n return true;\n }", "public function render()\n {\n $this->image->blurImage($this->radius, $this->sigma, $this->channel);\n }", "public function image($type = 'png')\n {\n $this->swallow();\n // if redirecting\n if ($this->redirect) {\n /*header(\"Location: {$this->redirect}\");\n // more headers\n foreach ( $this->headers as $header ) {\n header($header);\n }*/\n $this->redirect($this->redirect, array(), false);\n } else {\n // header json data\n header('Content-Type: image/'.$type);\n // more headers\n foreach ($this->headers as $header) {\n header($header);\n }\n // set css data string\n $results = implode(\"\\n\", $this->vars);\n // send\n echo $results;\n }\n }", "public function clientOutput()\n {\n\t\theader( \"Content-type: image/jpeg\" );\n imagejpeg( $this->im, NULL, $this->cq);\n }", "function base64_png_img_tag($base64_png) {\n $tag = \"<img style='display:block;' id='base64image' \" . \n \"src='data:image/png;base64, \" . $base64_png . \"' />\";\n return $tag;\n}", "public function build()\n {\n if ($this->_inline) {\n $encoded_image = base64_encode(file_get_contents($this->_attributes['src']));\n $mime_type = image_type_to_mime_type($this->_image_type);\n $this->_attributes['src'] = \"data:{$mime_type};base64,{$encoded_image}\";\n\n if (isset($this->_attributes['async'])) {\n unset($this->_attributes['async']);\n }\n }\n\n $attributes = join(' ', $this->_makeAttributesArr());\n if (!empty($attributes)) {\n $attributes = ' ' . $attributes;\n }\n return \"<img{$attributes}>\";\n }", "public function imageToASCII($image){\n $image = 'image.jpg'; \n // Supports http if allow_url_fopen is enabled \n $image = file_get_contents($image); \n $img = imagecreatefromstring($image); \n\n $width = imagesx($img); \n $height = imagesy($img); \n\n for($h=0;$h<$height;$h++){ \n for($w=0;$w<=$width;$w++){ \n $rgb = imagecolorat($img, $w, $h); \n $a = ($rgb >> 24) & 0xFF; \n $r = ($rgb >> 16) & 0xFF; \n $g = ($rgb >> 8) & 0xFF; \n $b = $rgb & 0xFF; \n $a = abs(($a / 127) - 1); \n if($w == $width){ \n echo '<br>'; \n }else{ \n echo '<span style=\"color:rgba('.$r.','.$g.','.$b.','.$a.');\">#</span>'; \n } \n } \n } \n }", "public function output()\r\n {\r\n // look for a cached version and use it if it exists\r\n $this->_checkCache();\r\n \r\n // build the path to the font file\r\n $font = $this->_config['paths']['font'] . \"/\" . $this->_font;\r\n \r\n // find the dimensions of the text being created\r\n list($height, $width, $offset) = $this->_calculateDimensions($font);\r\n \r\n // create an image with the dimensions of the text to be generated\r\n $im = imagecreatetruecolor($width, $height);\r\n \r\n // set colors\r\n $txt = imagecolorallocate(\r\n $im, hexdec(\r\n substr($this->_color,0,2)), \r\n hexdec(substr($this->_color,2,2)), \r\n hexdec(substr($this->_color,4,2)\r\n )\r\n );\r\n $bg = imagecolorallocate(\r\n $im, hexdec(\r\n substr($this->_backColor,0,2)), \r\n hexdec(substr($this->_backColor,2,2)), \r\n hexdec(substr($this->_backColor,4,2)\r\n )\r\n );\r\n \r\n // make background transparent if requested\r\n if ($this->_transparent) {\r\n imagecolortransparent($im, $bg);\r\n }\r\n \r\n // fill the image with the background color\r\n imagefilledrectangle($im, 0, 0, $width, $height, $bg);\r\n \r\n // write the text to the image\r\n imagettftext($im, $this->_size, 0, 0, $offset, $txt, $font, $this->_text);\r\n \r\n // generate image based on desired output type\r\n ob_start();\r\n \r\n switch ($this->_config['output']) {\r\n case 'png':\r\n header('Content-type: image/png');\r\n imagepng($im);\r\n break;\r\n case 'gif':\r\n header('Content-type: image/gif');\r\n imagegif($im);\r\n break;\r\n case 'jpg':\r\n header('Content-type: image/jpg');\r\n imagejpeg($im);\r\n break;\r\n }\r\n \r\n $buffer = ob_get_clean();\r\n imagedestroy($im);\r\n \r\n // save to the cache\r\n $this->_saveCache($buffer);\r\n \r\n // display the image\r\n echo $buffer;\r\n }", "function optimize_image_basic(string $binaryImage, int $jpegCompressionQuality = 95): string\n {\n $image = new Imagick();\n $image->readImageBlob($binaryImage);\n $image->optimizeImageLayers();\n $image->stripImage();\n $format = $image->getImageFormat();\n if ($format === 'jpg' || $format === 'jpeg') {\n $image->setImageCompression(Imagick::COMPRESSION_JPEG);\n if ($image->getImageCompressionQuality() > $jpegCompressionQuality) {\n $image->setImageCompressionQuality($jpegCompressionQuality);\n }\n $image->setInterlaceScheme(Imagick::INTERLACE_JPEG);\n } else if ($format === 'png') {\n $image->setOption('png:compression-level', 9);\n $image->setInterlaceScheme(Imagick::INTERLACE_PNG);\n } else if ($format === 'gif') {\n $image->setInterlaceScheme(Imagick::INTERLACE_GIF);\n }\n $blob = $image->getImageBlob();\n $image->clear();\n $image->destroy();\n return $blob;\n }", "function generateQRImageTag( $identifier){\n\n ob_start();\n QRCode::png($identifier,false,'L',9,2);\n $imageString = base64_encode(ob_get_clean());\n return '<img src =\"data:image/png;base64,'.$imageString.'\"/>';\n }", "public function render(): string\n {\n $image_attributes = '';\n foreach ($this->attributes as $attribute => $value) {\n if (\n is_string($attribute) &&\n is_string($value) &&\n in_array($attribute, Settings::ignoredCustomAttributes()) === false\n ) {\n $image_attributes .= \"{$attribute}=\\\"{$value}\\\" \";\n }\n }\n return \"<img src=\\\"{$this->insert}\\\" {$image_attributes}/>\";\n }", "public function create_image(){\n\t\t$md5_hash = md5(rand(0,999));\n\t\t$security_code = substr($md5_hash, 15, 5);\n\t\t$this->Session->write('security_code',$security_code);\n\t\t$width = 80;\n\t\t$height = 22;\n\t\t$image = ImageCreate($width, $height);\n\t\t$black = ImageColorAllocate($image, 37, 170, 226);\n\t\t$white = ImageColorAllocate($image, 255, 255, 255);\n\t\tImageFill($image, 0, 0, $black);\n\t\tImageString($image, 5, 18, 3, $security_code, $white);\n\t\theader(\"Content-Type: image/jpeg\");\n\t\tImageJpeg($image);\n\t\tImageDestroy($image);\n\t}", "public function getOpengraphImage();", "public static function renderFile();", "public function renderImageAction()\n {\n $config = \\Zend_Registry::get('configs');\n $path = $config['upload']['rodape']['destination'];\n\n $this->_helper->layout()->disableLayout();\n $this->_helper->viewRenderer->setNoRender(true);\n\n $params = $this->_getAllParams();\n\n $entity = $this->getService('Artefato')->findBy(array(\n 'sqArtefato' => $params['sqArtefato']\n ));\n $enderecoImagem = $path . '/' . $entity[0]->getDeImagemRodape();\n $dto = new \\Core_Dto_Search(\n array(\n 'resize' => true,\n 'width' => 120,\n 'height' => 120\n )\n );\n\n return $this->showImage($dto, $enderecoImagem);\n }", "public function display() {\n //send header to browser\n header( \"Content-type: {$this->mimetype}\" );\n\n //output image\n if ( $this->mimetype == 'image/jpeg' ) {\n imagejpeg( $this->image );\n }\n if ( $this->mimetype == 'image/png' ) {\n imagepng( $this->image );\n }\n if ( $this->mimetype == 'image/gif' ) {\n imagegif( $this->image );\n }\n }", "public function render(): Image\n {\n if (!is_resource($this->image)) {\n throw new \\RuntimeException(\n 'Attempt to render invalid resource as image.'\n );\n }\n\n header('Content-type: image/png');\n imagepng($this->image, null, 9, PNG_ALL_FILTERS);\n\n return $this;\n }", "function show( $img )\n {\n\t\theader( \"Content-type: image/\" . substr( $img, strlen( $img ) - 4, 4 ) == \"jpeg\" ? \"jpeg\" : substr( $img, strlen( $img ) - 3, 3 ) );\n \treadfile( $img );\n }", "protected function writeGifAndPng() {}", "function image_hwstring($width, $height)\n {\n }", "function drawImage($filename){\n $img=imagecreatetruecolor(400,300);\n drawFromUserdata($img); //draw on $img\n imagepng($img, $filename); //output the $img to the given $filename as PNG\n imagedestroy($img); //destroy the $img\n }", "public function generate(Image $image);", "public function output() {\n //\n // Get information on the image\n //\n $this->Information();\n\n //\n // Calculate new width and height for the image\n //\n $this->CalcWidthHeight();\n\n //\n // Creating a filename for the cache\n //\n $cacheFileName = $this->CacheFileName();\n\n //\n // Is there already a valid image in the cache directory, then use it and exit\n //\n $imageModifiedTime = filemtime($this->pathToImage);\n $cacheModifiedTime = is_file($cacheFileName) ? filemtime($cacheFileName) : null;\n\n // If cached image is valid, output it.\n if(!$this->ignoreCache && is_file($cacheFileName) && $imageModifiedTime < $cacheModifiedTime) {\n if($this->verbose) { self::verbose(\"Cache file is valid, output it.\"); }\n $this->outputFile($cacheFileName);\n }\n\n if($this->verbose) { self::verbose(\"Cache is not valid, process image and create a cached version of it.\"); }\n\n // If there is no valid cached file, create one, store in cache, and output this.\n //\n // Open up the original image from file\n //\n $image = $this->PrepareImageForCache();\n\n //\n // Resize the image if needed\n //\n $image = $this->Resize($image);\n //\n // Apply filters and postprocessing of image\n //\n if($this->sharpen) {\n $image = $this->sharpen($image);\n }\n //\n // Save the image\n //\n $this->CacheSave($image, $cacheFileName);\n //\n // Output the resulting image\n //\n $this->outputFile($cacheFileName);\n }", "function setPNGHTTPContentType(){\n header('Content-type: image/png');\n}", "function image_display_gd($resource)\n\t{\n\t\theader(\"Content-Disposition: filename={$this->file_name};\");\n\t\theader(\"Content-Type: {$this->mime_type}\");\n\t\theader('Content-Transfer-Encoding: binary');\n\t\theader('Last-Modified: '.gmdate('D, d M Y H:i:s', $this->EE->localize->now).' GMT'); \n\t\n\t\tswitch ($this->image_type)\n\t\t{\n\t\t\tcase 1 \t\t:\timagegif($resource);\n\t\t\t\tbreak;\n\t\t\tcase 2\t\t:\timagejpeg($resource, '', $this->quality);\n\t\t\t\tbreak;\n\t\t\tcase 3\t\t:\timagepng($resource);\n\t\t\t\tbreak;\n\t\t\tdefault\t\t:\techo 'Unable to display the image';\n\t\t\t\tbreak;\t\t\n\t\t}\t\t\t\n\t}", "public function getImage() {}", "final public function getImage() {\n\t\t\tif(strlen($this->text) === 0)\n\t\t\t\treturn null;\n\t\t\t\n\t\t\t$data = $this->getTCPDFBarcode()->getBarcodeArray();\n\t\t\tif($data === false)\n\t\t\t\treturn null;\n\t\t\t\n\t\t\t$image = new Image($data['maxw'], $data['maxh']);\n\t\t\t\n\t\t\t$x = 0;\n\t\t\tforeach($data['bcode'] as $bar) {\n\t\t\t\tfor($i = 0; $i < $bar['w']; ++$i) {\n\t\t\t\t\tfor($y = 0; $y < $bar['h']; ++$y)\n\t\t\t\t\t\t$image->setPixel($x + $i, $bar['p'] + $y, (int)$bar['t']);\n\t\t\t\t}\n\t\t\t\t$x += $bar['w'];\n\t\t\t}\n\t\t\t\n\t\t\treturn $image;\n\t\t}", "function displayImage($image) {\n header(\"Content-type: image/jpg\");\n imagejpeg($image);\n imagedestroy($image);\n}", "public function getAsString() {\n\t\t$image = $this->getImage();\n\t\t$string = $image->toString();\n\n\t\tif ($string === false) {\n\t\t\t$this->handleError($image);\n\t\t} else {\n\t\t\treturn $string;\n\t\t}\n\t}", "abstract public function render() ;", "public function image() {\n\t\t$image = new WkImage();\n\n\t\t$command = new Command($image->getImage()->getCommand() . ' --htmldoc');\n\n\t\tif ($command->execute()) {\n\t\t\techo $command->getOutput();\n\t\t} else {\n\t\t\techo $command->getError();\n\t\t}\n\t}", "public function filerendererAction() {\n\t\t$filename = basename($this->_getParam('image'));\n\t\t$this->_helper->layout()->disableLayout();\n\t\t$this->_helper->viewRenderer->setNoRender();\n\t\t$this->getResponse()\n\t\t\t\t->setHeader('Content-Type', 'image/jpeg')\n\t\t\t\t->setBody(file_get_contents(ROOT_DIR . '/files/' . $filename));\n\t}", "public function render();", "public function render();", "public function render();", "public function render();", "public function render();", "public function render();", "public function render();", "public function render();", "public function render();", "public function render();", "public function render();", "public function render();", "public function render();", "public function render();", "public function render();", "public function render();", "public function render();", "public function render();", "function getImage();", "public abstract function render();", "public abstract function render();" ]
[ "0.6845505", "0.6737439", "0.66208655", "0.66094285", "0.6591611", "0.65501165", "0.6513753", "0.64308685", "0.641859", "0.641859", "0.6394242", "0.63301736", "0.6313328", "0.6285644", "0.62258816", "0.61851156", "0.61792576", "0.61117417", "0.61000764", "0.60812074", "0.6080328", "0.60608596", "0.6030976", "0.60231334", "0.5974721", "0.59546137", "0.5933001", "0.59268063", "0.5919602", "0.5907285", "0.5901546", "0.58948046", "0.5890977", "0.58692324", "0.5862565", "0.58586526", "0.58586526", "0.58586526", "0.58586526", "0.58507526", "0.58406675", "0.58399546", "0.58372355", "0.5837165", "0.5820402", "0.57834536", "0.578173", "0.5773017", "0.5772194", "0.57538027", "0.57477635", "0.5747607", "0.57388395", "0.57352364", "0.57263285", "0.57193476", "0.5718965", "0.5715026", "0.5712708", "0.57085925", "0.57043165", "0.57011247", "0.5690955", "0.5681793", "0.5674198", "0.56581104", "0.5654411", "0.56537527", "0.56312716", "0.562894", "0.5621575", "0.56154275", "0.5607492", "0.56074476", "0.5596229", "0.55959165", "0.55915517", "0.5584753", "0.55751663", "0.5574561", "0.5574561", "0.5574561", "0.5574561", "0.5574561", "0.5574561", "0.5574561", "0.5574561", "0.5574561", "0.5574561", "0.5574561", "0.5574561", "0.5574561", "0.5574561", "0.5574561", "0.5574561", "0.5574561", "0.5574561", "0.55677813", "0.5561528", "0.5561528" ]
0.6014523
24
Loads an image into GD.
protected function _load_image() { if ( ! is_resource($this->_image)) { // Gets create function $create = $this->_create_function; // Open the temporary image $this->_image = $create($this->file); // Preserve transparency when saving imagesavealpha($this->_image, TRUE); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadImage()\n\t{\n\t\tswitch ($this->type) {\n\t\t\tcase 1:\n\t\t\t\t$this->ImageStream = @imagecreatefromgif($this->sFileLocation);\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\t$this->ImageStream = @imagecreatefromjpeg($this->sFileLocation);\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\t$this->ImageStream = @imagecreatefrompng($this->sFileLocation);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t$this->printError('invalid imagetype');\n\t\t}\n\n\t\tif (!$this->ImageStream) {\n\t\t\t$this->printError('image not loaded');\n\t\t}\n\t}", "protected function loadImage()\n {\n if (!is_resource($this->tmpImage)) {\n $create = $this->createFunctionName;\n $this->tmpImage = $create($this->filePath);\n imagesavealpha($this->tmpImage, true);\n }\n }", "public function load()\n\t{\n\t\tif (!$this->isValidImage()) {\n\t\t\treturn false;\n\t\t}\n\n\t\t$this->image = new SimpleImage();\n\n\t\t$this->image->fromFile($this->source_path);\n\n\t\treturn true;\n\t}", "function load($filename)\n {\n $image_info = getimagesize($filename);\n $this->image_type = $image_info[2];\n //crea la imagen JPEG.\n if( $this->image_type == IMAGETYPE_JPEG ) \n {\n $this->image = imagecreatefromjpeg($filename);\n } \n //crea la imagen GIF.\n elseif( $this->image_type == IMAGETYPE_GIF ) \n {\n $this->image = imagecreatefromgif($filename);\n } \n //Crea la imagen PNG\n elseif( $this->image_type == IMAGETYPE_PNG ) \n {\n $this->image = imagecreatefrompng($filename);\n }\n }", "function load_image( $filename = '' )\n\t{\n\t\tif( !is_file( $filename ) )\n\t\t\tthrow new Exception( 'Image Class: could not find image \\''.$filename.'\\'.' );\n\t\t\t\t\t\t\t\t\n\t\t$ext = $this->get_ext( $filename );\n\t\t\n\t\tswitch( $ext )\n\t\t{\n\t\t\tcase 'jpeg':\n\t\t\tcase 'jpg':\n\t\t\t\t$this->im = imagecreatefromjpeg( $filename );\n\t\t\t\tbreak;\n\t\t\tcase 'gif':\n\t\t\t\t$this->im = imagecreatefromgif( $filename );\n\t\t\t\tbreak;\n\t\t\tcase 'png':\n\t\t\t\t$this->im = imagecreatefrompng( $filename );\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new Exception( 'Image Class: An unsupported file format was supplied \\''. $ext . '\\'.' );\n\t\t}\n\t\t\n\t\treturn TRUE;\n\t}", "public function load_image()\n\t{\n if (file_exists($this->local_file)) {\n $image_size = $this->image_size();\n if (preg_match('/jpeg/', $image_size['mime'])) {\n $file = imagecreatefromjpeg($this->local_file);\n } elseif (preg_match('/gif/', $image_size['mime'])) {\n $file = imagecreatefromgif($this->local_file);\n } elseif (preg_match('/png/', $image_size['mime'])) {\n $file = imagecreatefrompng($this->local_file);\n } else {\n \t$file = null;\n }\n return $file;\n }\n\t}", "public function load_png($imgname)\n\t{\n\t\t// imagecreatefrompng() returns error msg and breaks the code\n\t\t// this function returns an error image instead of breaking\n\t\t//\n\t\t$im = @imagecreatefrompng($imgname); /* Attempt to open */\n\t\tif (!$im) { /* See if it failed */\n\t\t\t$im = imagecreatetruecolor(150, 30); /* Create a blank image */\n\t\t\t$bgc = imagecolorallocate($im, 255, 255, 255);\n\t\t\t$tc = imagecolorallocate($im, 0, 0, 0);\n\t\t\timagefilledrectangle($im, 0, 0, 150, 30, $bgc);\n\t\t\t/* Output an errmsg */\n\t\t\timagestring($im, 1, 5, 5, \"Error loading $imgname\", $tc);\n\t\t}\n\t\treturn $im;\n\t}", "function _load_image_file( $file ) {\n\t\t// Run a cheap check to verify that it is an image file.\n\t\tif ( false === ( $size = getimagesize( $file ) ) )\n\t\t\treturn false;\n\t\t\n\t\tif ( false === ( $file_data = file_get_contents( $file ) ) )\n\t\t\treturn false;\n\t\t\n\t\tif ( false === ( $im = imagecreatefromstring( $file_data ) ) )\n\t\t\treturn false;\n\t\t\n\t\tunset( $file_data );\n\t\t\n\t\t\n\t\treturn $im;\n\t}", "function LoadGif($imgname)\n{\n $im = @imagecreatefromgif($imgname);\n\n /* See if it failed */\n if(!$im)\n {\n /* Create a blank image */\n $im = imagecreatetruecolor (96, 96);\n $bgc = imagecolorallocate ($im, 255, 255, 255);\n $tc = imagecolorallocate ($im, 0, 0, 0);\n\n imagefilledrectangle ($im, 0, 0, 96, 96, $bgc);\n\n /* Output an error message */\n imagestring ($im, 1, 5, 5, 'Mapler.me failed.', $tc);\n imagestring ($im, 1, 5, 20, $imgname, $tc);\n }\n\n return $im;\n}", "public static function get_gd_resource(self $img)\n\t\t{\n\t\t\t$im = null;\n\n\t\t\tswitch ($img->format()) {\n\t\t\t\tcase 1: $im = imagecreatefromgif($img->get_path()); break;\n\t\t\t\tcase 2: $im = imagecreatefromjpeg($img->get_path()); break;\n\t\t\t\tcase 3: $im = imagecreatefrompng($img->get_path()); break;\n\t\t\t}\n\n\t\t\tif (!is_resource($im)) {\n\t\t\t\tthrow new \\System\\Error\\File(sprintf('Failed to open image \"%s\". File is not readable or format \"%s\" is not supported.', $path, self::get_suffix($format)));\n\t\t\t}\n\n\t\t\treturn $im;\n\t\t}", "public function load($file){\n\n //kill any previous image that might still be in memory before we load a new one\n if(isset($this->image) && !empty($this->image)){\n imagedestroy($this->image);\n }\n\n //get the parameters of the image\n $image_params = getimagesize($file);\n\n //save the image params to class vars\n list($this->width, $this->height, $this->type, $this->attributes) = $image_params;\n $this->mime_type = $image_params['mime'];\n\n //check that an image type was found\n if(isset($this->type) && !empty($this->type)){\n //find the type of image so it can be loaded into memory\n switch ($this->type) {\n case IMAGETYPE_JPEG:\n $this->image = imagecreatefromjpeg($file);\n break;\n\n case IMAGETYPE_GIF:\n $this->image = imagecreatefromgif($file);\n break;\n\n case IMAGETYPE_PNG:\n $this->image = imagecreatefrompng($file);\n break;\n\n }\n\n if(isset($this->image) && !empty($this->image)){\n return true;\n }else{\n return true;\n }\n }else{\n return false;\n }\n }", "public function load_image($https = false)\n {\n return $this->load(\"image\", $https);\n }", "function loadFile ($image) {\r\n if ( !$dims=@GetImageSize($image) ) {\r\n trigger_error('Could not find image '.$image);\r\n return false;\r\n }\r\n if ( in_array($dims['mime'],$this->types) ) {\r\n $loader=$this->imgLoaders[$dims['mime']];\r\n $this->source=$loader($image);\r\n $this->sourceWidth=$dims[0];\r\n $this->sourceHeight=$dims[1];\r\n $this->sourceMime=$dims['mime'];\r\n $this->initThumb();\r\n return true;\r\n } else {\r\n trigger_error('Image MIME type '.$dims['mime'].' not supported');\r\n return false;\r\n }\r\n }", "function LoadPNG($imgname)\n{\n $im = @imagecreatefrompng($imgname);\n\n /* See if it failed */\n if(!$im)\n {\n /* Create a blank image */\n $im = imagecreatetruecolor (96, 96);\n $bgc = imagecolorallocate ($im, 255, 255, 255);\n $tc = imagecolorallocate ($im, 0, 0, 0);\n\n imagefilledrectangle ($im, 0, 0, 96, 96, $bgc);\n\n /* Output an error message */\n imagestring ($im, 1, 5, 5, 'Mapler.me failed.', $tc);\n imagestring ($im, 1, 5, 20, $imgname, $tc);\n }\n\n return $im;\n}", "function LoadImage($filename)\r\n {\r if (!($from_info = getimagesize($file)))\r\n return false;\r\n\r\n $from_type = $from_info[2];\r\n\r\n $new_img = Array(\r\n 'f' => $filename,\r\n 'w' => $from_info[0],\r\n 'h' => $from_info[1],\r\n );\r\n\r\n $id = false;\r\n if (($this->use_IM && false)\r\n || (($from_type == IMAGETYPE_GIF) && $this->GIF_IM && false))\r\n {\r $id = count($this->images)+1;\r\n $this->images[$id] = Array(0, $filename, 0, $new_img);\r\n }\r\n elseif ($img = $this->_gd_load($filename))\r\n {\r $id = count($this->images)+1;\r\n $this->images[$id] = Array(1, $filename, &$img, $new_img);\r\n }\r\n\r\n return $id;\r\n }", "function loadImage($filename) {\n $image = false;\n $imageInfo = getimagesize($filename);\n $imageType = '';\n $imageType = $imageInfo[2];\n if( $imageType == IMAGETYPE_JPEG ) {\n $image = imagecreatefromjpeg($filename);\n } elseif( $imageType == IMAGETYPE_GIF ) {\n $image = imagecreatefromgif($filename);\n } elseif( $imageType == IMAGETYPE_PNG ) {\n $image = imagecreatefrompng($filename);\n }\n return $image ? array('image' => $image, 'imgType' => $imageType, 'imageInfo' => $imageInfo) : array();\n}", "public function openImage($src)\n {\n $this->path=substr($src,0,strlen($src)-strlen(strstr($src, '.')));\n $this->imageSuffix=substr(strstr($src, '.'),1);\n $info=getimagesize($src);\n $this->imageX=$info[0];\n $this->imageY=$info[1];\n $this->imageInfo=$info;\n $type=image_type_to_extension($info[2],false);\n $this->imageType=$type;\n $createImageType='imagecreatefrom'.$type;\n $this->image=$createImageType($src);\n }", "protected function _loadImageResource($source)\n {\n if (empty($source) || !is_readable($source)) {\n return false;\n }\n\n try {\n $result = imagecreatefromstring(file_get_contents($source));\n } catch (Exception $e) {\n _log(\"GD failed to open the file. Details:\\n$e\", Zend_Log::ERR);\n return false;\n }\n\n return $result;\n }", "public static function load($image)\n {\n return new Adapter\\Gd($image);\n }", "public function getImage();", "public function getImage();", "public function getImage();", "public function getImage();", "public static function fromFile($file) {\n\t\tif(ImageHelperConfig::CHECK_IMAGE_FILE){\n\t\t\t// Check if the file exists and is readable. We're using fopen() instead of file_exists()\n\t\t\t// because not all URL wrappers support the latter.\n\t\t\t$handle = @fopen($file, 'r');\n\t\t\tif ($handle === false) {\n\t\t\t\tthrow new \\Exception(\"File not found: $file\", ErrorCodeConstant::ERR_FILE_NOT_FOUND);\n\t\t\t}\n\t\t\tfclose($handle);\t\n\t\t}\n\n\t\t// Get image info\n\t\t$info = getimagesize($file);\n\t\tif ($info === false) {\n\t\t\tthrow new \\Exception(\"Invalid image file: $file\", ErrorCodeConstant::ERR_INVALID_IMAGE);\n\t\t}\n\t\t$mimeType = $info['mime'];\n\n\t\t// Create image object from file\n\t\tswitch($mimeType) {\n\t\t\tcase 'image/gif' :\n\t\t\t\t// Load the gif\n\t\t\t\t$gif = imagecreatefromgif($file);\n\t\t\t\tif ($gif) {\n\t\t\t\t\t// Copy the gif over to a true color image to preserve its transparency. This is a\n\t\t\t\t\t// workaround to prevent imagepalettetruecolor() from borking transparency.\n\t\t\t\t\t$width = imagesx($gif);\n\t\t\t\t\t$height = imagesy($gif);\n\t\t\t\t\t$image = imagecreatetruecolor($width, $height);\n\t\t\t\t\t$transparentColor = imagecolorallocatealpha($image, 0, 0, 0, 127);\n\t\t\t\t\timagecolortransparent($image, $transparentColor);\n\t\t\t\t\timagefill($image, 0, 0, $transparentColor);\n\t\t\t\t\timagecopy($image, $gif, 0, 0, 0, 0, $width, $height);\n\t\t\t\t\timagedestroy($gif);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'image/jpeg' :\n\t\t\t\t$image = imagecreatefromjpeg($file);\n\t\t\t\tbreak;\n\t\t\tcase 'image/png' :\n\t\t\t\t$image = imagecreatefrompng($file);\n\t\t\t\tbreak;\n\t\t\tcase 'image/webp' :\n\t\t\t\t$image = imagecreatefromwebp($file);\n\t\t\t\tbreak;\n\t\t}\n\t\tif (!$image) {\n\t\t\tthrow new \\Exception(\"Unsupported image: $file\", ErrorCodeConstant::ERR_UNSUPPORTED_FORMAT);\n\t\t}\n\n\t\t// Convert pallete images to true color images\n\t\timagepalettetotruecolor($image);\n\n\t\t$exif = null;\n\t\t// Load exif data from JPEG images\n\t\tif (ImageHelperConfig::USE_IMAGE_EXIF && $mimeType === 'image/jpeg' && function_exists('exif_read_data')) {\n\t\t\t$exif = @exif_read_data($file);\n\t\t}\n\n\t\treturn array('image'=>$image, 'mimeType'=>$mimeType,'exif'=>$exif);\n\t}", "public function action_image()\n\t{\n\t\t//Image::load(DOCROOT.'/files/04_2021/79199dcc06baf4cc230262fcbb4d1094.jpg')->preset('mypreset', DOCROOT.'/files/04_2021/ea7e8ed4bc9d6f7c03f5f374e30b183b.png');\n\t\t$image = Image::forge();\n\n\t\t// Or with optional config\n\t\t$image = Image::forge(array(\n\t\t\t\t'quality' => 80\n\t\t));\n\t\t$image->load(DOCROOT.'/files/04_2021/79199dcc06baf4cc230262fcbb4d1094.jpg')\n\t\t\t\t\t->crop_resize(200, 200)\n\t\t\t\t\t->rounded(100)\n\t\t\t\t\t->output();\n\t\t// Upload an image and pass it directly into the Image::load method.\n\t\tUpload::process(array(\n\t\t\t'path' => DOCROOT.DS.'files'\n\t\t));\n\n\t\tif (Upload::is_valid())\n\t\t{\n\t\t\t$data = Upload::get_files(0);\n\n\t\t\t// Using the file upload data, we can force the image's extension\n\t\t\t// via $force_extension\n\t\t\tImage::load($data['file'], false, $data['extension'])\n\t\t\t\t\t->crop_resize(200, 200)\n\t\t\t\t\t->save('image');\n\t\t} \n\t}", "function open_image($file) {\n\t\t$im = @imagecreatefromjpeg($file);\n\t\tif ($im !== false) { return $im; }\n\t\t# GIF:\n\t\t$im = @imagecreatefromgif($file);\n\t\tif ($im !== false) { return $im; }\n\t\t# PNG:\n\t\t$im = @imagecreatefrompng($file);\n\t\tif ($im !== false) { return $im; }\n\t\t# GD File:\n\t\t$im = @imagecreatefromgd($file);\n\t\tif ($im !== false) { return $im; }\n\t\t# GD2 File:\n\t\t$im = @imagecreatefromgd2($file);\n\t\tif ($im !== false) { return $im; }\n\t\t# WBMP:\n\t\t$im = @imagecreatefromwbmp($file);\n\t\tif ($im !== false) { return $im; }\n\t\t# XBM:\n\t\t$im = @imagecreatefromxbm($file);\n\t\tif ($im !== false) { return $im; }\n\t\t# XPM:\n\t\t$im = @imagecreatefromxpm($file);\n\t\tif ($im !== false) { return $im; }\n\t\t# Try and load from string:\n\t\t$im = @imagecreatefromstring(file_get_contents($file));\n\t\tif ($im !== false) { return $im; }\n\t\treturn false;\n\t}", "public function load($path, $config)\n\t{\n\t\t$this->data = [];\n\t\t$img = $this->_create($path);\n\t\t$size = getimagesize($path);\n\t\tif (!$size) {\n\t\t\tthrow new \\Exception(\"Could not read size from file '\" . $path . \"'.\");\n\t\t}\n\t\t$width = array_shift($size);\n\t\t$height = array_shift($size);\n\t\tfor ($y = 0; $y < $height; $y++) {\n\t\t\t$this->data[$y] = [];\n\t\t\tfor ($x = 0; $x < $width; $x++) {\n\t\t\t\t$color_index = imagecolorat($img, $x, $y);\n\t\t\t\t$rgba = imagecolorsforindex($img, $color_index);\n\t\t\t\t$hex = $config->getClosestColor($rgba);\n\t\t\t\t$this->data[$y][$x] = new Pixel($hex);\n\t\t\t}\n\t\t}\n\t}", "function loadImage($image_data) {\n\t\tif (empty($image_data['name']) && empty($image_data['tmp_name'])) {\n\t\t\treturn '';\n\t\t}\n\t\t\n\t\t$file_name = $this->image_path . DS . $image_data['name'];\n\t\t$file_name_arr = explode('.', $file_name);\n\t\t$file_name_ext = $file_name_arr[count($file_name_arr)-1];\n\t\tunset($file_name_arr[count($file_name_arr)-1]);\n\t\t$file_name_prefix = implode('.' , $file_name_arr);\n\t\t$counter = '';\n\t\t$file_name = $file_name_prefix . $counter . '.' . $file_name_ext;\n\t\t$i = 1;\n\t\twhile (file_exists($file_name)) {\n\t\t\t$counter = '_' . $i;\n\t\t\t$file_name = $file_name_prefix . $counter . '.' . $file_name_ext;\n\t\t\t$i++;\n\t\t}\n\n\t\t$tmp_name = $image_data['tmp_name'];\n\t\t$width = 88;\n\t\t$height = 88;\n\t\t\n\t\t// zmenim velikost obrazku\n\t\tApp::import('Model', 'Image');\n\t\t$this->Image = new Image;\n\t\t\n\t\t\n\t\tif (file_exists($tmp_name)) {\n\t\t\tif ($this->Image->resize($tmp_name, $file_name, $width, $height)) {\n\t\t\t\t$file_name = str_replace($this->image_path . DS, '', $file_name);\n\t\t\t\treturn $file_name;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "public function image();", "public function image();", "private function _openImage($value)\n {\n if (!extension_loaded(\"gd\")) {\n /** Bear_Filter_Image_Exception_GdExtensionNotLoaded */\n require_once \"Bear/Filter/Image/Exception/GdExtensionNotLoaded.php\";\n\n throw new Bear_Filter_Image_Exception_GdExtensionNotLoaded();\n }\n\n if (!file_exists($value)) {\n /** Bear_Filter_Image_Exception_FileNotFound */\n require_once \"Bear/Filter/Image/Exception/FileNotFound.php\";\n\n throw new Bear_Filter_Image_Exception_FileNotFound($value);\n }\n\n $blob = @file_get_contents($value);\n if (!$blob) {\n /** Bear_Filter_Image_Exception_CouldNotReadFile */\n require_once \"Bear/Filter/Image/Exception/CouldNotReadFile.php\";\n\n throw new Bear_Filter_Image_Exception_CouldNotReadFile($value);\n }\n\n $gd = @imagecreatefromstring($blob);\n if (!$gd) {\n /** Bear_Filter_Image_Exception_CouldNotLoadFile */\n require_once \"Bear/Filter/Image/Exception/CouldNotLoadFile.php\";\n\n throw new Bear_Filter_Image_Exception_CouldNotLoadFile($value);\n }\n\n return $gd;\n }", "function getImage();", "protected function loadImageResource()\n {\n if(empty($this->resource))\n {\n if(($this->worker === NULL || $this->worker === $this::WORKER_IMAGICK) && self::imagickAvailable())\n {\n $this->resource = $this->createImagick($this->image);\n }\n elseif(($this->worker === NULL || $this->worker === $this::WORKER_GD) && self::gdAvailable())\n {\n $this->resource = $this->getGdResource($this->image);\n }\n else\n {\n throw new Exception('Required extensions missing, extension GD or Imagick is required');\n }\n }\n }", "function logonscreener_image_load($file, $extension) {\n $function = 'imagecreatefrom' . $extension;\n\n if (!function_exists($function) || !($image = $function($file))) {\n logonscreener_log(\"$function() does not exist or it did not return what was expected.\");\n return FALSE;\n }\n\n return $image;\n}", "public function __construct($gd_image) {}", "public function load()\n {\n $size = @getimagesize($this->file);\n if (!$size) {\n throw new \\Exception(sprintf('Could not read image size of the file #%s', $this->file));\n }\n $this->type = $size[2];\n if (!is_file($this->file) && !preg_match('|^https?:#|', $this->file)) {\n throw new \\Exception(sprintf('File #%s doesn&#8217;t exist?', $this->file));\n }\n $this->image = @imagecreatefromstring(file_get_contents($this->file));\n if (!is_resource($this->image)) {\n throw new \\Exception(sprintf('File #%s is not an image.', $this->file));\n }\n $this->updateSize($size[0], $size[1]);\n $this->mime_type = $size['mime'];\n\n return $this;\n }", "public function test_it_loads_an_image_string_into_a_resource()\n {\n imagepng(imagecreatefromstring($this->imagePath), $this->compareTestSaveLocation);\n imagepng($this->image->getImageResource(), $this->testImageSaveLocation);\n\n $correctImage = file_get_contents($this->compareTestSaveLocation);\n $testImage = file_get_contents($this->testImageSaveLocation);\n\n $this->assertEquals($correctImage, $testImage);\n }", "public function load($id)\n\t{\n\t\treturn Image::model()->findByPk($id);\n\t}", "public function getGdImage()\n\t{\n\t if ($this->empty()) {\n\t return null;\n\t }\n\t \n\t\treturn imagecreatefromstring($this->data);\n\t}", "function loadData ($image,$mime) {\r\n if ( in_array($mime,$this->types) ) {\r\n $this->source=imagecreatefromstring($image);\r\n $this->sourceWidth=imagesx($this->source);\r\n $this->sourceHeight=imagesy($this->source);\r\n $this->sourceMime=$mime;\r\n $this->initThumb();\r\n return true;\r\n } else {\r\n trigger_error('Image MIME type '.$mime.' not supported');\r\n return false;\r\n }\r\n }", "public function load($name = null)\n {\n $filename = null;\n if (null !== $name) {\n $filename = ((strpos($name, '[') !== false) && (strpos($name, ']') !== false)) ?\n substr($name, 0, strpos($name, '[')) : $name;\n $this->name = $name;\n }\n\n if ((null === $this->name) || ((null !== $filename) && !file_exists($filename))) {\n throw new Exception('Error: The image file has not been passed to the image adapter');\n }\n\n if (null !== $this->resource) {\n $this->resource->readImage($this->name);\n } else {\n $this->resource = new \\Imagick($this->name);\n }\n\n $this->width = $this->resource->getImageWidth();\n $this->height = $this->resource->getImageHeight();\n\n switch ($this->resource->getImageColorspace()) {\n case \\Imagick::COLORSPACE_GRAY:\n $this->colorspace = self::IMAGE_GRAY;\n break;\n case \\Imagick::COLORSPACE_RGB:\n case \\Imagick::COLORSPACE_SRGB:\n $this->colorspace = self::IMAGE_RGB;\n break;\n case \\Imagick::COLORSPACE_CMYK:\n $this->colorspace = self::IMAGE_CMYK;\n break;\n }\n\n $this->format = strtolower($this->resource->getImageFormat());\n if ($this->resource->getImageColors() < 256) {\n $this->indexed = true;\n }\n\n if ((strpos($this->format, 'jp') !== false) && function_exists('exif_read_data')) {\n $exif = @exif_read_data($this->name);\n if ($exif !== false) {\n $this->exif = $exif;\n }\n }\n\n return $this;\n }", "public function load($resource)\n {\n if (strpos($resource, 'http') === 0) {\n $content = $this->loadExternalImage($resource);\n $this->image->readImageBlob($content);\n } else {\n $fullPath = $this->basePath .'/'. $resource;\n $this->image->readImage($fullPath);\n }\n\n return $this->image;\n }", "public function toGDImage() {}", "function showImage()\n\t{\n\t\tif (!$this->ImageStream) {\n\t\t\t$this->printError('image not loaded');\n\t\t}\n\n\t\tswitch ($this->type) {\n\t\t\tcase 1:\n\t\t\t\timagegif($this->ImageStream);\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\timagejpeg($this->ImageStream);\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\timagepng($this->ImageStream);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t$this->printError('invalid imagetype');\n\t\t}\n\t}", "protected function getTestImage($load_expected = TRUE, array $stubs = []) {\n if (!$load_expected && !in_array('load', $stubs)) {\n $stubs = array_merge(['load'], $stubs);\n }\n\n $this->toolkit = $this->getToolkitMock($stubs);\n\n $this->toolkit->expects($this->any())\n ->method('getPluginId')\n ->will($this->returnValue('gd'));\n\n if (!$load_expected) {\n $this->toolkit->expects($this->never())\n ->method('load');\n }\n\n $this->image = new Image($this->toolkit, $this->source);\n\n return $this->image;\n }", "public static function load($image)\n {\n if (!is_file($image) || !is_readable($image)) {\n throw new JIT\\JITImageNotFound(\n sprintf('Error loading image <code>%s</code>. Check it exists and is readable.', \\General::sanitize(str_replace(DOCROOT, '', $image)))\n );\n }\n\n $meta = self::getMetaInformation($image);\n\n switch ($meta->type) {\n // GIF\n case IMAGETYPE_GIF:\n $resource = imagecreatefromgif($image);\n break;\n\n // JPEG\n case IMAGETYPE_JPEG:\n // GD 2.0.22 supports basic CMYK to RGB conversion.\n // RE: https://github.com/symphonycms/jit_image_manipulation/issues/47\n $gdSupportsCMYK = version_compare(GD_VERSION, '2.0.22', '>=');\n\n // Can't handle CMYK JPEG files\n if ($meta->channels > 3 && $gdSupportsCMYK === false) {\n throw new JIT\\JITException('Cannot load CMYK JPG images');\n\n // Can handle CMYK, or image has less than 3 channels.\n } else {\n $resource = imagecreatefromjpeg($image);\n }\n break;\n\n // PNG\n case IMAGETYPE_PNG:\n $resource = imagecreatefrompng($image);\n break;\n\n default:\n throw new JIT\\JITException('Unsupported image type. Supported types: GIF, JPEG and PNG');\n break;\n }\n\n if (!is_resource($resource)) {\n throw new JIT\\JITGenerationError(\n sprintf('Error creating image <code>%s</code>. Check it exists and is readable.', General::sanitize(str_replace(DOCROOT, '', $image)))\n );\n }\n\n return new self($resource, $meta, $image);\n }", "protected function loadImages() {\r\n $this->images = new \\App\\Table\\ImagesTable(App::getInstance()->getDb());\r\n }", "public function getOpengraphImage();", "public function loadImage($imagePath, $width, $height) {\n $fileInfo = pathinfo($imagePath);\n $cacheFileName = $fileInfo['filename'] . '_' . $width . 'x' . $height . '.' . $fileInfo['extension'];\n $cacheFile = $cacheFileName;\n if(file_exists('image/cache/' . $cacheFile)) {\n return new Image($cacheFile, 'image/cache/');\n }\n else {\n return false;\n }\n }", "protected function readImage(): void\n {\n // set default path\n $path = $this->pathFile;\n\n // handle caching\n if (!empty($this->pathCache)) {\n // write / refresh cache file if necessary\n if (!$this->isCached()) {\n $this->writeCache();\n }\n\n // replace path if file is cached\n if ($this->isCached()) {\n $path = $this->pathCache;\n }\n }\n\n // get image information\n $read = @getimagesize($path);\n if (false === $read) {\n throw new \\RuntimeException(\n sprintf(\n \"Couldn't read image at %s\",\n $path\n )\n );\n }\n\n // detect image type\n switch ($read[2]) {\n case IMAGETYPE_GIF:\n $this->image = @imagecreatefromgif($path);\n\n break;\n\n case IMAGETYPE_JPEG:\n $this->image = @imagecreatefromjpeg($path);\n\n break;\n\n case IMAGETYPE_PNG:\n $this->image = @imagecreatefrompng($path);\n\n break;\n\n default:\n // image type not supported\n throw new \\UnexpectedValueException(\n sprintf(\n 'Image type %s not supported',\n image_type_to_mime_type($read[2])\n )\n );\n }\n\n if (false === $this->image) {\n throw new \\RuntimeException(\n sprintf(\n \"Couldn't read image at %s\",\n $path\n )\n );\n }\n\n // set image dimensions\n $this->width = $read[0];\n $this->height = $read[1];\n\n // set mime type\n $this->mimeType = $read['mime'];\n\n // set modified date\n $this->modified = @filemtime($path);\n }", "function open_image ($file) {\r\n global $type;\r\n $size=getimagesize($file);\r\n switch($size[\"mime\"]){\r\n case \"image/jpeg\":\r\n $im = imagecreatefromjpeg($file); //jpeg file\r\n break;\r\n case \"image/gif\":\r\n $im = imagecreatefromgif($file); //gif file\r\n break;\r\n case \"image/png\":\r\n $im = imagecreatefrompng($file); //png file\r\n break;\r\n default: \r\n $im=false;\r\n break;\r\n }\r\n return $im;\r\n}", "public function getImage() {}", "public function __construct($img = false) {\n\t\tif($img) {\n\t\t\t$img = (string) $img;\n\t\t\tif(file_exists($img) && is_readable($img)) {\n\t\t\t\t// Basic details we need to figure out how to handle the image.\n\t\t\t\t$supported_image_type = false;\n\t\t\t\t$img_extension = pathinfo($img, PATHINFO_EXTENSION);\n\t\t\t\t$img_file_name = pathinfo($img, PATHINFO_BASENAME);\n\t\t\t\t$img_mime = mime_content_type($img);\n\t\t\t\t$img_size = getimagesize($img);\n\n\t\t\t\t// Convert valid types to a true color image.\n\t\t\t\tswitch($img_extension) {\n\t\t\t\t\tcase 'gif':\n\t\t\t\t\t\tif($img_mime === 'image/gif') {\n\t\t\t\t\t\t\t$supported_image_type = true;\n\t\t\t\t\t\t\t$gif_img = imagecreatefromgif($img);\n\t\t\t\t\t\t\tif($gif_img) {\n\t\t\t\t\t\t\t\t$this->image = imagecreatetruecolor($img_size[0], $img_size[1]);\n\t\t\t\t\t\t\t\tif(!imagecopy($this->image, $gif_img, 0, 0, 0, 0, $img_size[0], $img_size[1])) {\n\t\t\t\t\t\t\t\t\t$this->image = false;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'png':\n\t\t\t\t\t\tif($img_mime === 'image/png') {\n\t\t\t\t\t\t\t$supported_image_type = true;\n\t\t\t\t\t\t\t$png_img = imagecreatefrompng($img);\n\t\t\t\t\t\t\tif($png_img) {\n\t\t\t\t\t\t\t\t$this->image = imagecreatetruecolor($img_size[0], $img_size[1]);\n\t\t\t\t\t\t\t\tif(!imagecopy($this->image, $png_img, 0, 0, 0, 0, $img_size[0], $img_size[1])) {\n\t\t\t\t\t\t\t\t\t$this->image = false;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'jpg':\n\t\t\t\t\tcase 'jpeg':\n\t\t\t\t\t\t$img_extension = 'jpg';\n\t\t\t\t\t\tif($img_mime === 'image/jpeg') {\n\t\t\t\t\t\t\t$supported_image_type = true;\n\t\t\t\t\t\t\t$jpg_img = imagecreatefromjpeg($img);\n\t\t\t\t\t\t\tif($jpg_img) {\n\t\t\t\t\t\t\t\t$this->image = imagecreatetruecolor($img_size[0], $img_size[1]);\n\t\t\t\t\t\t\t\tif(!imagecopy($this->image, $jpg_img, 0, 0, 0, 0, $img_size[0], $img_size[1])) {\n\t\t\t\t\t\t\t\t\t$this->image = false;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\t// If we have a working image, get rolling.\n\t\t\t\tif($supported_image_type && $this->image) {\n\t\t\t\t\t// Make alpha work.\n\t\t\t\t\timagealphablending($this->image, true);\n\t\t\t\t\timagesavealpha($this->image, true);\n\n\t\t\t\t\t// Set helpful info about the file.\n\t\t\t\t\t$this->width = $img_size[0];\n\t\t\t\t\t$this->height = $img_size[1];\n\t\t\t\t\t$this->path = $img;\n\t\t\t\t\t$this->filename = $img_file_name;\n\t\t\t\t\t$this->mime = $img_mime;\n\t\t\t\t\t$this->ext = $img_extension;\n\t\t\t\t\t$this->aspect = $this->width/$this->height;\n\t\t\t\t\tif($this->aspect > 1) {\n\t\t\t\t\t\t$this->orientation = 'landscape';\n\t\t\t\t\t} else if($this->aspect < 1) {\n\t\t\t\t\t\t$this->orientation = 'portrait';\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$this->orientation = 'square';\n\t\t\t\t\t}\n\t\t\t\t\treturn true;\n\t\t\t\t} else {\n\t\t\t\t\ttrigger_error('The image could not be opened because it is not a valid image.', E_USER_WARNING);\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\ttrigger_error('The image does not exist or is not readable.', E_USER_WARNING);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "function drawImage($filename){\n $img=imagecreatetruecolor(400,300);\n drawFromUserdata($img); //draw on $img\n imagepng($img, $filename); //output the $img to the given $filename as PNG\n imagedestroy($img); //destroy the $img\n }", "public function getImage() {\n $items = $this->getItems();\n shuffle($items); // Randomize order of items to generate different baords each load\n $board_arrangement = $this->arrange($items);\n\n $image = imagecreatetruecolor(IMGSIZE, IMGSIZE);\n $black = imagecolorallocate($image, 0, 0, 0);\n imagefill($image, 0, 0, $black);\n\n return $this->drawImage($image, $board_arrangement, 0, 0, IMGSIZE);\n }", "function GDImage($im, $x=null, $y=null, $w=0, $h=0, $link=''){\n\t\t\tob_start();\n\t\t\timagepng($im);\n\t\t\t$data = ob_get_clean();\n\t\t\t$this->MemImage($data, $x, $y, $w, $h, $link);\n\t\t}", "function wp_load_image($file)\n {\n }", "private function createImageResource()\n {\n // In case of failure, image will be false\n\n $mimeType = $this->getMimeTypeOfSource();\n\n if ($mimeType == 'image/png') {\n $image = imagecreatefrompng($this->source);\n if ($image === false) {\n throw new ConversionFailedException(\n 'Gd failed when trying to load/create image (imagecreatefrompng() failed)'\n );\n }\n return $image;\n }\n\n if ($mimeType == 'image/jpeg') {\n $image = imagecreatefromjpeg($this->source);\n if ($image === false) {\n throw new ConversionFailedException(\n 'Gd failed when trying to load/create image (imagecreatefromjpeg() failed)'\n );\n }\n return $image;\n }\n\n /*\n throw new InvalidInputException(\n 'Unsupported mime type:' . $mimeType\n );*/\n }", "public function image_display_gd($resource)\n\t{\n\t\theader('Content-Disposition: filename='.$this->source_image.';');\n\t\theader('Content-Type: '.$this->mime_type);\n\t\theader('Content-Transfer-Encoding: binary');\n\t\theader('Last-Modified: '.gmdate('D, d M Y H:i:s', time()).' GMT');\n\n\t\tswitch ($this->image_type)\n\t\t{\n\t\t\tcase 1\t:\timagegif($resource);\n\t\t\t\tbreak;\n\t\t\tcase 2\t:\timagejpeg($resource, NULL, $this->quality);\n\t\t\t\tbreak;\n\t\t\tcase 3\t:\timagepng($resource);\n\t\t\t\tbreak;\n\t\t\tdefault:\techo 'Unable to display the image';\n\t\t\t\tbreak;\n\t\t}\n\t}", "function createImg()\n {\n // imagem de origem\n if ($this->ext == \"png\")\n $img_origem= imagecreatefrompng($this->origem);\n\t\telseif ($this->ext == \"gif\")\n $img_origem= imagecreatefromgif($this->origem);\n elseif ($this->ext == \"jpg\" || $this->ext == \"jpeg\")\n $img_origem= imagecreatefromjpeg($this->origem);\n\t\t\telseif ($this->ext == \"jpg\" || $this->ext == \"jpeg\")\n $img_origem= imagecreatefromwbmp($this->origem);\n return $img_origem;\n }", "function load_image_to_edit($attachment_id, $mime_type, $size = 'full')\n {\n }", "function photonfill_get_lazyload_image( $attachment_id, $img_size, $attr = array() ) {\n\treturn Photonfill()->get_lazyload_image( $attachment_id, $img_size, $attr );\n}", "public function loadImage($fileName)\n {\n $filePart = explode(\".\", $fileName);\n\n $fileExtension = strtolower($filePart[count($filePart) - 1]);\n\n if ($fileExtension === 'bmp') {\n return imagecreatefrombmp($fileName);\n }\n elseif ($fileExtension === 'gd2') {\n return imagecreatefromgd2($fileName);\n }\n elseif ($fileExtension === 'gd') {\n return imagecreatefromgd($fileName);\n }\n elseif ((imagetypes() & IMG_GIF) && $fileExtension === 'gif') {\n return imagecreatefromgif($fileName);\n }\n elseif ((imagetypes() & IMG_JPG) && ($fileExtension === 'jpeg' || $fileExtension === 'jpg')) {\n //return imagecreatefromjpeg($fileName); //TODO: this trigger fatal error\n //return @imagecreatefromjpeg($fileName); //TODO: this suppress fatal error but subsequent code is not running\n try { //TODO: this is workaround to load jpeg image\n return imagecreatefromstring(file_get_contents($fileName));\n } catch (Exception $ex) {\n return false;\n }\n }\n elseif ((imagetypes() & IMG_PNG) && $fileExtension === 'png') {\n return imagecreatefrompng($fileName);\n }\n elseif ((imagetypes() & IMG_WBMP) && $fileExtension === 'wbmp') {\n return imagecreatefromwbmp($fileName);\n }\n elseif ((imagetypes() & IMG_WEBP) && $fileExtension === 'webp') {\n return imagecreatefromwebp($fileName);\n }\n elseif ($fileExtension === 'xbm') {\n return imagecreatefromxbm($fileName);\n }\n elseif ((imagetypes() & IMG_XPM) && $fileExtension === 'xpm') {\n return imagecreatefromxbm($fileName);\n }\n else {\n return false;\n }\n }", "public function load($imagePath, $options = [])\n {\n // support image URLs\n if (preg_match(\"@^https?://@\", $imagePath)) {\n $tmpFilename = \"imagick_auto_download_\" . md5($imagePath) . \".\" . File::getFileExtension($imagePath);\n $tmpFilePath = PIMCORE_SYSTEM_TEMP_DIRECTORY . \"/\" . $tmpFilename;\n\n $this->tmpFiles[] = $tmpFilePath;\n\n File::put($tmpFilePath, \\Pimcore\\Tool::getHttpData($imagePath));\n $imagePath = $tmpFilePath;\n }\n\n if (!stream_is_local($imagePath)) {\n // imagick is only able to deal with local files\n // if your're using custom stream wrappers this wouldn't work, so we create a temp. local copy\n $tmpFilePath = PIMCORE_SYSTEM_TEMP_DIRECTORY . \"/imagick-tmp-\" . uniqid() . \".\" . File::getFileExtension($imagePath);\n copy($imagePath, $tmpFilePath);\n $imagePath = $tmpFilePath;\n $this->tmpFiles[] = $imagePath;\n }\n\n $this->imagePath = $imagePath;\n\n $this->initResource();\n\n $this->setModified(false);\n\n return $this;\n }", "public function getImageResource()\n {\n return imagecreatefromstring($this->getRaw());\n }", "public function loadFrom($path)\n {\n // Avoid repeat load of broken images\n $hash = sha1($path ?? '');\n if ($this->hasFailed($hash, null)) {\n return $this;\n }\n\n // Handle resource\n $error = self::FAILED_UNKNOWN;\n try {\n $this->setImageResource($this->getImageManager()->make($path));\n $this->markSuccess($hash, null);\n $error = null;\n } catch (NotReadableException $ex) {\n // Handle unsupported image encoding on load (will be marked as failed)\n // Unsupported exceptions are handled without being raised as exceptions\n $error = self::FAILED_INVALID;\n } finally {\n if ($error) {\n $this->markFailed($hash, null, $error);\n }\n }\n\n return $this;\n }", "private function loadImage($imageUrl)\n {\n $filename = pathinfo($imageUrl)['basename'];\n //change extension to jpg\n $filename = preg_replace('/\\\\.[^.\\\\s]{3,4}$/', '.jpg', $filename);\n\n $localPath = $this->cacheDir . \"/$filename\";\n\n $image = imagecreatefromstring(file_get_contents($imageUrl));\n imagejpeg($image, $localPath, $this->jpegQuality);\n imagedestroy($image);\n\n return $localPath;\n }", "public static function test_image($source) {\n\t\tif (strlen($source) < 10) {\n\t\t\tdebug_event('Art', 'Invalid image passed', 1);\n\t\t\treturn false;\n\t\t}\n\n\t\t// Check to make sure PHP:GD exists. If so, we can sanity check\n\t\t// the image.\n\t\tif (function_exists('ImageCreateFromString')) {\n\t\t\t $image = ImageCreateFromString($source);\n\t\t\t if (!$image || imagesx($image) < 5 || imagesy($image) < 5) {\n\t\t\t\tdebug_event('Art', 'Image failed PHP-GD test',1);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}", "private function createimage($imgSrc, $extension) {\r\n //echo \"$imgSrc,$extension\";\r\n ini_set('gd.jpeg_ignore_warning', 1);\r\n $info = getimagesize($imgSrc);\r\n $extension = str_replace(\"image/\", \"\", $info['mime']);\r\n switch ($extension) {\r\n case 'jpg' :\r\n case 'jpeg' :\r\n $image = imagecreatefromjpeg($imgSrc);\r\n break;\r\n case 'png' :\r\n $image = imagecreatefrompng($imgSrc);\r\n break;\r\n case 'gif' :\r\n $image = imagecreatefromgif($imgSrc);\r\n break;\r\n }\r\n //echo $image;die();\r\n return $image;\r\n }", "function image_create_gd($path = '', $image_type = '')\n\t{\n\t\tif ($path == '')\n\t\t\t$path = $this->full_src_path;\n\t\t\t\n\t\tif ($image_type == '')\n\t\t\t$image_type = $this->image_type;\n\n\t\t\n\t\tswitch ($image_type)\n\t\t{\n\t\t\tcase\t 1 :\n\t\t\t\t\t\tif ( ! function_exists('imagecreatefromgif'))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$this->set_error(array('imglib_unsupported_imagecreate', 'imglib_gif_not_supported'));\n\t\t\t\t\t\t\treturn FALSE;\n\t\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\t$im = @imagecreatefromgif($path);\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ($im === FALSE)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$this->set_error(array('imglib_image_process_failed'));\n\t\t\t\t\t\t\treturn FALSE;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\treturn $im;\n\t\t\t\tbreak;\n\t\t\tcase 2 :\n\t\t\t\t\t\tif ( ! function_exists('imagecreatefromjpeg'))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$this->set_error(array('imglib_unsupported_imagecreate', 'imglib_jpg_not_supported'));\n\t\t\t\t\t\t\treturn FALSE;\n\t\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\t$im = @imagecreatefromjpeg($path);\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ($im === FALSE)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$this->set_error(array('imglib_image_process_failed'));\n\t\t\t\t\t\t\treturn FALSE;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\treturn $im;\n\t\t\t\tbreak;\n\t\t\tcase 3 :\n\t\t\t\t\t\tif ( ! function_exists('imagecreatefrompng'))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$this->set_error(array('imglib_unsupported_imagecreate', 'imglib_png_not_supported'));\t\t\t\t\n\t\t\t\t\t\t\treturn FALSE;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t$im = @imagecreatefrompng($path);\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ($im === FALSE)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$this->set_error(array('imglib_image_process_failed'));\n\t\t\t\t\t\t\treturn FALSE;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\treturn $im;\n\t\t\t\tbreak;\t\t\t\n\t\t\n\t\t}\n\t\t\n\t\t$this->set_error(array('imglib_unsupported_imagecreate'));\n\t\treturn FALSE;\n\t}", "public function isValidImage()\n\t{\n\t\t$src = $this->source_path;\n\t\t$extension = \\strtolower(\\substr($src, (\\strrpos($src, '.') + 1)));\n\n\t\tif (!\\in_array($extension, $this->image_extensions)) {\n\t\t\treturn false;\n\t\t}\n\n\t\t$r = @\\imagecreatefromstring(\\file_get_contents($src));\n\n\t\treturn \\is_resource($r) && \\get_resource_type($r) === 'gd';\n\t}", "private function create_img_stream()\n {\n $this->img = imagecreate(L_IMG_WIDTH,L_IMG_HEIGHT);\n }", "private function lazyLoad(): void\n\t{\n\t\tif (empty($this->_resource)) {\n\t\t\tif ($this->_cache && !$this->isCacheExpired()) {\n\t\t\t\t$this->_cacheSkip = true;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t$resource = $this->getImageResource($this->_imagePath, $this->_extension);\n\t\t\t$this->_resource = $resource;\n\t\t}\n\t}", "protected function _createImage()\n {\n $this->_height = $this->scale * 60;\n $this->_width = 1.8 * $this->_height;\n $this->_image = imagecreate($this->_width, $this->_height);\n ImageColorAllocate($this->_image, 0xFF, 0xFF, 0xFF);\n }", "public function getImage()\n {\n if($this->image == null){\n return \"https://place-hold.it/50x50\";\n }\n else return IMG_PATH.\"/\".$this->image;\n }", "public function setImage($image, $type = 'image', $size = array(800, 600)) \n { \n if (file_exists($image) && is_readable($image)) {\n $info = $this->_getImageInfo($image);\n \n switch ($info['mime']) {\n case 'image/png':\n $img = imagecreatefrompng($image);\n break;\n case 'image/jpeg':\n $img = imagecreatefromjpeg($image);\n break;\n case 'image/gif':\n $old = imagecreatefromgif($image);\n $img = imagecreatetruecolor($info[0], $info[1]);\n imagecopy($image, $old, 0, 0, 0, 0, $info[0], $info[1]);\n break;\n default:\n break;\n }\n }\n\n switch ($type) {\n case 'image':\n if ($img) $this->images[] = $img;\n break;\n case 'layout':\n if ($img) {\n $this->layout = $img;\n $this->layoutInfo = $info;\n } else {\n $this->layout = imagecreatetruecolor($size[0], $size[1]);\n $gray = imagecolorallocate($this->layout, 128, 128, 128);\n imagefilledrectangle($this->layout, 0, 0, $size[0], $size[1], $gray);\n $this->layoutInfo = $this->_getImageInfo($this->layout);\n }\n break;\n default:\n break;\n }\n }", "public function getImage($name)\n\t{\n\t\t//Todo: Implement.\n\t}", "function is_gd_image($image)\n {\n }", "private function createImageResource()\n {\n // We are currently using vips_image_new_from_file(), but we could consider\n // calling vips_jpegload / vips_pngload instead\n $result = /** @scrutinizer ignore-call */ vips_image_new_from_file($this->source, []);\n if ($result === -1) {\n /*throw new ConversionFailedException(\n 'Failed creating new vips image from file: ' . $this->source\n );*/\n $message = /** @scrutinizer ignore-call */ vips_error_buffer();\n throw new ConversionFailedException($message);\n }\n\n if (!is_array($result)) {\n throw new ConversionFailedException(\n 'vips_image_new_from_file did not return an array, which we expected'\n );\n }\n\n if (count($result) != 1) {\n throw new ConversionFailedException(\n 'vips_image_new_from_file did not return an array of length 1 as we expected ' .\n '- length was: ' . count($result)\n );\n }\n\n $im = array_shift($result);\n return $im;\n }", "function captcha_show_gd_img( $content=\"\" )\n\t{\n\t\t//-----------------------------------------\n\t\t// Is GD Available?\n\t\t//-----------------------------------------\n\t\t\n\t\tif ( ! extension_loaded('gd') )\n\t\t{\n\t\t\tif ( $this->show_error_gd_img )\n\t\t\t{\n\t\t\t\t@header( \"Content-Type: image/gif\" );\n\t\t\t\tprint base64_decode( \"R0lGODlhyAA8AJEAAN/f3z8/P8zMzP///yH5BAAAAAAALAAAAADIADwAAAL/nI+py+0Po5y02ouz3rz7D4biSJbmiabqyrbuC8fyTNf2jef6zvf+DwwKh8Si8YhMlgACwEHQXESfzgOzykQAqgMmFMr9Rq+GbHlqAFsFWnFVrfwIAvQAu15P0A14Nn8/ADhXd4dnl2YYCAioGHBgyDbnNzBIV0gYxzEYWdg1iLAnScmFuQdAt2UKZTcl+mip+HoYG+tKOfv3N5l5garnmPt6CwyaFzrranu7i0crObvoaKvMyMhrIQhFuyzcyGwXcOpoLYg7DGsZXk5r6DSN51RNfF0RPU5sy7gpnH5bjLhrk7Y9/RQNisfq2CRJauTR6xUuFyBx/yrWypMMmTlq/9IwQnKWcKG5cvMeShBIMOFIaV9w2eti6SBABAyjvBRFMaZCMaxsqtxl8iShjpj+VfqGCJg4XzOfJCK5DVWliFNXlSIENKjWrVy7ev0KNqzYsWTFwhlFU8waLk+efGF7hi0aSgu3iGmV1cxdoGTinimbiGOeP8SWhps6z3AkeMMWW20mMykqQyuJDbYWdufKBJWc2uWmAJZdO0yOKfTCCqHGiO4E/oKGriTYaBw5g/MDqynNlW9Uhmx66tM2i05dNcM8O6Rg2MHLYKraLTpDcLebTke4APkcduAoku0DWpe24MI96ewZPdiy6Rlx/0Y+XJevlNu/z6vtlHFxZbpv9f9edYkfxgVmjnqSxXYOYPfFVMgXIHGC0ltWDNXYJ6Lsw82AFVpWEk4pEabgbsfBM5FphyDWRh1OLCUgbC06NtNU6UV1T1Jl3YhjjjruyGOPPv4IZJBC6tDXGUDB4UUaK06RhRl/0aWWF3CR4YWESraR1ZCh6dMOiMNIFE2GI/bRJYiIEeULiloyUNSFLzWC3VXcqEJXTBe1qApDpbXUEYxr2tYeQCyyGMuIcxbokHfPvPjHf25mqeWHoLEX0iH0UScmUzSWNxmj20yH6Z+/yNTeM0N1cumkg9E4GHnluLcfeKLm95yLoO5ZKJrhgeaQm4xlFGshcK3pYZ9LradQrmY5nmhVdMm+qqpKYkIqpDyltWkpjJJaaKmd6kXjHUXvDPborOaei2666q7LbrvuvgtvvPLOS2+9YBUAADs=\" );\n\t\t\t\texit();\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\texit();\n\t\t\t}\n\t\t}\n\t\t\t\t\n\t\t//-----------------------------------------\n\t\t// INIT\n\t\t//-----------------------------------------\n\t\t\n\t\t$content = ' '. preg_replace( \"/(\\w)/\", \"\\\\1 \", $content ) .' ';\n\t\t$allow_fonts = isset( $this->ipsclass->vars['captcha_allow_fonts'] ) ? $this->ipsclass->vars['captcha_allow_fonts'] : 1;\n\t\t$use_fonts = 0;\n\t\t$tmp_x = 135;\n\t\t$tmp_y = 20;\n\t\t$image_x = 200;\n\t\t$image_y = 60;\n\t\t$circles = 3;\n\t\t$continue_loop = TRUE;\n\t\t$_started = FALSE;\n\t\t\n\t\t//-----------------------------------------\n\t\t// Get backgrounds and fonts...\n\t\t//-----------------------------------------\n\t\t\n\t\t$backgrounds = $this->_captcha_show_gd_img_get_backgrounds();\n\t\t$fonts = $this->_captcha_show_gd_img_get_fonts();\n\t\n\t\t//-----------------------------------------\n\t\t// Seed rand functions for PHP versions that don't\n\t\t//-----------------------------------------\n\t\t\n\t\tmt_srand( (double) microtime() * 1000000 );\n\t\t\n\t\t//-----------------------------------------\n\t\t// Got a background?\n\t\t//-----------------------------------------\n\t\t\n\t\tif ( $this->ipsclass->vars['gd_version'] > 1 )\n\t\t{\n\t\t\twhile ( $continue_loop )\n\t\t\t{\n\t\t\t\tif ( is_array( $backgrounds ) AND count( $backgrounds ) )\n\t\t\t\t{\n\t\t\t\t\t$i = mt_rand(0, count( $backgrounds ) - 1 );\n\t\t\t\t\n\t\t\t\t\t$background = $backgrounds[ $i ];\n\t\t\t\t\t$_file_extension = preg_replace( \"#^.*\\.(\\w{2,4})$#is\", \"\\\\1\", strtolower( $background ) );\n\t\t\t\t\n\t\t\t\t\tswitch( $_file_extension )\n\t\t\t\t\t{\n\t\t\t\t\t\tcase 'jpg':\n\t\t\t\t\t\tcase 'jpe':\n\t\t\t\t\t\tcase 'jpeg':\n\t\t\t\t\t\t\tif ( ! function_exists('imagecreatefromjpeg') OR ! $im = @imagecreatefromjpeg($background) )\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tunset( $backgrounds[ $i ] );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$continue_loop = FALSE;\n\t\t\t\t\t\t\t\t$_started = TRUE;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'gif':\n\t\t\t\t\t\t\tif ( ! function_exists('imagecreatefromgif') OR ! $im = @imagecreatefromgif($background) )\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tunset( $backgrounds[ $i ] );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$continue_loop = FALSE;\n\t\t\t\t\t\t\t\t$_started = TRUE;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'png':\n\t\t\t\t\t\t\tif ( ! function_exists('imagecreatefrompng') OR ! $im = @imagecreatefrompng($background) )\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tunset( $backgrounds[ $i ] );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$continue_loop = FALSE;\n\t\t\t\t\t\t\t\t$_started = TRUE;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$continue_loop = FALSE;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t//-----------------------------------------\n\t\t// Still not got one? DO OLD FASHIONED\n\t\t//-----------------------------------------\n\t\t\n\t\tif ( $_started !== TRUE )\n\t\t{\n\t\t\tif ( $this->ipsclass->vars['gd_version'] == 1 )\n\t\t\t{\n\t\t\t\t$im = imagecreate($image_x, $image_y);\n\t\t\t\t$tmp = imagecreate($tmp_x, $tmp_y);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$im = imagecreatetruecolor($image_x, $image_y);\n\t\t\t\t$tmp = imagecreatetruecolor($tmp_x, $tmp_y);\n\t\t\t}\n\t\t\t\n\t\t\t$white = ImageColorAllocate($tmp, 255, 255, 255);\n\t\t\t$black = ImageColorAllocate($tmp, 0, 0, 0);\n\t\t\t$grey = ImageColorAllocate($tmp, 200, 200, 200 );\n\n\t\t\timagefill($tmp, 0, 0, $white);\n\n\t\t\tfor ( $i = 1; $i <= $circles; $i++ )\n\t\t\t{\n\t\t\t\t$values = array(\n\t\t\t\t\t\t\t\t0 => rand(0, $tmp_x - 10),\n\t\t\t\t\t\t\t\t1 => rand(0, $tmp_y - 3),\n\t\t\t\t\t\t\t\t2 => rand(0, $tmp_x - 10),\n\t\t\t\t\t\t\t\t3 => rand(0, $tmp_y - 3),\n\t\t\t\t\t\t\t\t4 => rand(0, $tmp_x - 10),\n\t\t\t\t\t\t\t\t5 => rand(0, $tmp_y - 3),\n\t\t\t\t\t\t\t\t6 => rand(0, $tmp_x - 10),\n\t\t\t\t\t\t\t\t7 => rand(0, $tmp_y - 3),\n\t\t\t\t\t\t\t\t8 => rand(0, $tmp_x - 10),\n\t\t\t\t\t\t\t\t9 => rand(0, $tmp_y - 3),\n\t\t\t\t\t\t\t\t10 => rand(0, $tmp_x - 10),\n\t\t\t\t\t\t\t\t11 => rand(0, $tmp_y - 3),\n\t\t\t\t\t\t );\n\n\t\t\t\t$randomcolor = imagecolorallocate( $tmp, rand(100,255), rand(100,255),rand(100,255) );\n\t\t\t\timagefilledpolygon($tmp, $values, 6, $randomcolor );\n\t\t\t}\n\n\t\t\t$num = strlen($content);\n\t\t\t$x_param = 0;\n\t\t\t$y_param = 0;\n\n\t\t\tfor( $i = 0; $i < $num; $i++ )\n\t\t\t{\n\t\t\t\t$x_param += rand(-1,12);\n\t\t\t\t$y_param = rand(-3,8);\n\t\t\t\t\n\t\t\t\tif( $x_param + 18 > $image_x )\n\t\t\t\t{\n\t\t\t\t\t$x_param -= ceil( $x_param + 18 - $image_x );\n\t\t\t\t}\n\n\t\t\t\t$randomcolor = imagecolorallocate( $tmp, rand(0,150), rand(0,150),rand(0,150) );\n\n\t\t\t\timagestring($tmp, 5, $x_param+1, $y_param+1, $content{$i}, $grey);\n\t\t\t\timagestring($tmp, 5, $x_param, $y_param, $content{$i}, $randomcolor);\n\t\t\t}\n\n\t\t\t//-----------------------------------------\n\t\t\t// Distort by resizing\n\t\t\t//-----------------------------------------\n\n\t\t\timagecopyresized($im, $tmp, 0, 0, 0, 0, $image_x, $image_y, $tmp_x, $tmp_y);\n\n\t\t\timagedestroy($tmp);\n\t\t\t\n\t\t\t//-----------------------------------------\n\t\t\t// Background dots and lines\n\t\t\t//-----------------------------------------\n\n\t\t\t$random_pixels = $image_x * $image_y / 10;\n\n\t\t\tfor ($i = 0; $i < $random_pixels; $i++)\n\t\t\t{\n\t\t\t\t$randomcolor = imagecolorallocate( $im, rand(0,150), rand(0,150),rand(0,150) );\n\t\t\t\tImageSetPixel($im, rand(0, $image_x), rand(0, $image_y), $randomcolor);\n\t\t\t}\n\n\t\t\t$no_x_lines = ($image_x - 1) / 5;\n\n\t\t\tfor ( $i = 0; $i <= $no_x_lines; $i++ )\n\t\t\t{\n\t\t\t\tImageLine( $im, $i * $no_x_lines, 0, $i * $no_x_lines, $image_y, $grey );\n\t\t\t\tImageLine( $im, $i * $no_x_lines, 0, ($i * $no_x_lines)+$no_x_lines, $image_y, $grey );\n\t\t\t}\n\n\t\t\t$no_y_lines = ($image_y - 1) / 5;\n\n\t\t\tfor ( $i = 0; $i <= $no_y_lines; $i++ )\n\t\t\t{\n\t\t\t\tImageLine( $im, 0, $i * $no_y_lines, $image_x, $i * $no_y_lines, $grey );\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t//-----------------------------------------\n\t\t\t// Can we use fonts?\n\t\t\t//-----------------------------------------\n\t\t\t\n\t\t\tif ( $allow_fonts AND function_exists('imagettftext') AND is_array( $fonts ) AND count( $fonts ) )\n\t\t\t{\n\t\t\t\tif ( function_exists('imageantialias') )\n\t\t\t\t{\n\t\t\t\t\timageantialias( $im, TRUE );\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t$num = strlen($content);\n\t\t\t\t$x_param = -18;\n\t\t\t\t$y_param = 0;\n\t\t\t\t$_font = $fonts[ mt_rand( 0, count( $fonts ) - 1 ) ];\n\t\t\t\t\n\t\t\t\tfor( $i = 0; $i < $num; $i++ )\n\t\t\t\t{\n\t\t\t\t\t$y_param = rand( 35, 48 );\n\t\t\t\t\t\n\t\t\t\t\t# Main color\n\t\t\t\t\t$col_r = rand(50,200);\n\t\t\t\t\t$col_g = rand(0,150);\n\t\t\t\t\t$col_b = rand(50,200);\n\t\t\t\t\t# High light\n\t\t\t\t\t$col_r_l = ( $col_r + 50 > 255 ) ? 255 : $col_r + 50;\n\t\t\t\t\t$col_g_l = ( $col_g + 50 > 255 ) ? 255 : $col_g + 50;\n\t\t\t\t\t$col_b_l = ( $col_b + 50 > 255 ) ? 255 : $col_b + 50;\n\t\t\t\t\t# Low light\n\t\t\t\t\t$col_r_d = ( $col_r - 50 < 0 ) ? 0 : $col_r - 50;\n\t\t\t\t\t$col_g_d = ( $col_g - 50 < 0 ) ? 0 : $col_g - 50;\n\t\t\t\t\t$col_b_d = ( $col_b - 50 < 0 ) ? 0 : $col_b - 50;\n\t\t\t\t\t\n\t\t\t\t\t$color_main = imagecolorallocate( $im, $col_r, $col_g, $col_b );\n\t\t\t\t\t$color_light = imagecolorallocate( $im, $col_r_l, $col_g_l, $col_b_l );\n\t\t\t\t\t$color_dark = imagecolorallocate( $im, $col_r_d, $col_g_d, $col_b_d );\n\t\t\t\t\t$_slant = mt_rand( -20, 40 );\n\t\t\t\t\t\n\t\t\t\t\tif ( $i == 1 OR $i == 3 OR $i == 5 )\n\t\t\t\t\t{\n\t\t\t\t\t\tfor( $ii = 0 ; $ii < 2 ; $ii++ )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$a = $x_param + 50;\n\t\t\t\t\t\t\t$b = mt_rand(0,100);\n\t\t\t\t\t\t\t$c = $a + 20;\n\t\t\t\t\t\t\t$d = $b + 20;\n\t\t\t\t\t\t\t$e = ( $i == 3 ) ? mt_rand( 280, 320 ) : mt_rand( -280, -320 );\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\timagearc( $im, $a , $b , $c, $d, 0, $e, $color_light );\n\t\t\t\t\t\t\timagearc( $im, $a+1, $b+1, $c, $d, 0, $e, $color_main );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif ( ! $_result = @imagettftext( $im, 24, $_slant, $x_param - 1, $y_param - 1, $color_light, $_font, $content{$i} ) )\n\t\t\t\t\t{\n\t\t\t\t\t\t$use_fonts = FALSE;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t@imagettftext( $im, 24, $_slant, $x_param + 1, $y_param + 1, $color_dark, $_font, $content{$i} );\n\t\t\t\t\t\t@imagettftext( $im, 24, $_slant, $x_param, $y_param, $color_main, $_font, $content{$i} );\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t$x_param += rand( 15, 18 );\n\t\t\t\t\t\n\t\t\t\t\tif( $x_param + 18 > $image_x )\n\t\t\t\t\t{\n\t\t\t\t\t\t$x_param -= ceil( $x_param + 18 - $image_x );\n\t\t\t\t\t}\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t$use_fonts = TRUE;\n\t\t\t}\n\t\t\t\n\t\t\tif ( ! $use_fonts )\n\t\t\t{\n\t\t\t\t//-----------------------------------------\n\t\t\t\t// Continue with nice background image\n\t\t\t\t//-----------------------------------------\n\t\t\t\n\t\t\t\t$tmp = imagecreatetruecolor($tmp_x , $tmp_y );\n\t\t\t\t$tmp2 = imagecreatetruecolor($image_x, $image_y);\n\t\t\n\t\t\t\t$white = imagecolorallocate( $tmp, 255, 255, 255 );\n\t\t\t\t$black = imagecolorallocate( $tmp, 0, 0, 0 );\n\t\t\t\t$grey = imagecolorallocate( $tmp, 100, 100, 100 );\n\t\t\t\t$transparent = imagecolorallocate( $tmp2, 255, 255, 255 );\n\t\t\t\t$_white = imagecolorallocate( $tmp2, 255, 255, 255 );\n\t\t\t\n\t\t\t\timagefill($tmp , 0, 0, $white );\n\t\t\t\timagefill($tmp2, 0, 0, $_white);\n\t\t\t\n\t\t\t\t$num = strlen($content);\n\t\t\t\t$x_param = 0;\n\t\t\t\t$y_param = 0;\n\n\t\t\t\tfor( $i = 0; $i < $num; $i++ )\n\t\t\t\t{\n\t\t\t\t\tif ( $i > 0 )\n\t\t\t\t\t{\n\t\t\t\t\t\t$x_param += rand( 6, 12 );\n\t\t\t\t\t\t\n\t\t\t\t\t\tif( $x_param + 18 > $image_x )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$x_param -= ceil( $x_param + 18 - $image_x );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\t$y_param = rand( 0, 5 );\n\t\t\t\t\n\t\t\t\t\t$randomcolor = imagecolorallocate( $tmp, rand(50,200), rand(50,200),rand(50,200) );\n\n\t\t\t\t\timagestring( $tmp, 5, $x_param + 1, $y_param + 1, $content{$i}, $grey );\n\t\t\t\t\timagestring( $tmp, 5, $x_param , $y_param , $content{$i}, $randomcolor );\n\t\t\t\t}\n\t\t\t\n\t\t\t\timagecopyresized($tmp2, $tmp, 0, 0, 0, 0, $image_x, $image_y, $tmp_x, $tmp_y );\n\t\t\t\n\t\t\t\t$tmp2 = $this->captcha_show_gd_img_wave( $tmp2, 8, true );\n\t\t\t\n\t\t\t\timagecolortransparent( $tmp2, $transparent );\n\t\t\t\timagecopymerge( $im, $tmp2, 0, 0, 0, 0, $image_x, $image_y, 100 );\n\t\t\n\t\t\t\timagedestroy($tmp);\n\t\t\t\timagedestroy($tmp2);\n\t\t\t}\n\t\t}\n\t\t\n\t\t//-----------------------------------------\n\t\t// Blur?\n\t\t//-----------------------------------------\n\t\t\n\t\tif ( function_exists( 'imagefilter' ) )\n\t\t{\n\t\t\t@imagefilter( $im, IMG_FILTER_GAUSSIAN_BLUR );\n\t\t}\n\t\t\n\t\t//-----------------------------------------\n\t\t// Render a border\n\t\t//-----------------------------------------\n\t\t\n\t\t$black = imagecolorallocate( $im, 0, 0, 0 );\n\t\t\n\t\timageline( $im, 0, 0, $image_x, 0, $black );\n\t\timageline( $im, 0, 0, 0, $image_y, $black );\n\t\timageline( $im, $image_x - 1, 0, $image_x - 1, $image_y, $black );\n\t\timageline( $im, 0, $image_y - 1, $image_x, $image_y - 1, $black );\n\t\t\n\t\t//-----------------------------------------\n\t\t// Show it!\n\t\t//-----------------------------------------\n\t\t\n\t\t@header( \"Content-Type: image/jpeg\" );\n\t\t\n\t\timagejpeg( $im );\n\t\timagedestroy( $im );\n\t\t\n\t\texit();\n\t}", "public function from($image, $path = NULL, $from = \"file\"){\n\t\ttry{\n\t\t\t# Set path file just for $image->fromFile() method: if $path is NULL then just use $image -> it will contain path and image name, else combine home_path, user path and image name\n\t\t\t$this->_file = ($path != NULL) ? Settings::get('home_path') . $path . $image : $image;\n\t\t\tswitch($from){\n\t\t\t\tcase \"string\":\n\t\t\t\t\t# Get the image from the string using File.class.php (if $path is NULL, then it will try to get the image from 'file_path')\n\t\t\t\t\t$this->fromString(File::get($image, false, $path));\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"uri\":\n\t\t\t\t\t# Get the image from the URL (Just input the image URL)\n\t\t\t\t\t$this->fromDataUri($image);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"file\":\n\t\t\t\tdefault:\n\t\t\t\t\t# Get the image from the file (using _file)\n\t\t\t\t\t$this->fromFile($this->_file);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\t# Return object with loaded image if success\n\t\t\treturn $this;\n\t\t}catch(Exception $e){\n\t\t\t# Return error if we can't get the image\n\t\t\tself::$return['code'] = \"601\";\n\t\t\treturn self::$return;\t\t\n\t\t}\n\t\t\n\t}", "public function loadFile($thumbnail, $image)\n {\n // on failure, use identify instead\n $imgData = @getimagesize($image);\n if (!$imgData)\n {\n exec($this->magickCommands['identify'].' '.escapeshellarg($image), $stdout, $retval);\n if ($retval === 1)\n {\n throw new Exception('Image could not be identified.');\n }\n else\n {\n // get image data via identify\n list($img, $type, $dimen) = explode(' ', $stdout[0]);\n list($width, $height) = explode('x', $dimen);\n\n $this->sourceWidth = $width;\n $this->sourceHeight = $height;\n $this->sourceMime = $this->mimeMap[strtolower($type)];\n }\n }\n else\n {\n // use image data from getimagesize()\n $this->sourceWidth = $imgData[0];\n $this->sourceHeight = $imgData[1];\n $this->sourceMime = $imgData['mime'];\n }\n $this->image = $image;\n\n // open file resource\n $source = fopen($image, 'r');\n\n $this->source = $source;\n\n $thumbnail->initThumb($this->sourceWidth, $this->sourceHeight, $this->maxWidth, $this->maxHeight, $this->scale, $this->inflate);\n\n return true;\n }", "private function create_from_file($from_file)\n\t{\n\t\t// only proceed if the file details can be read by GD\n\t\tif(($details = getimagesize($from_file)) !== false)\n\t\t{\n\t\t\t$this->filename = $from_file;\n\t\t\tlist($this->width, $this->height) = $details;\n\t\t\t$this->mime = $details['mime'];\n\n\t\t\tswitch($details['mime'])\n\t\t\t{\n\t\t\t\tcase 'image/png':\n\t\t\t\t\t$this->image = \\imagecreatefrompng($this->filename);\n\t\t\t\t\t$this->format = 'png';\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'image/gif':\n\t\t\t\t\t$this->image = \\imagecreatefrompng($this->filename);\n\t\t\t\t\t$this->format = 'gif';\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'image/jpeg':\n\t\t\t\t\t$this->image = \\imagecreatefromjpeg($this->filename);\n\t\t\t\t\t$this->format = 'jpg';\n\t\t\t}\n\t\t}//end if\n\t}", "function image_display_gd($resource)\n\t{\n\t\theader(\"Content-Disposition: filename={$this->file_name};\");\n\t\theader(\"Content-Type: {$this->mime_type}\");\n\t\theader('Content-Transfer-Encoding: binary');\n\t\theader('Last-Modified: '.gmdate('D, d M Y H:i:s', $this->EE->localize->now).' GMT'); \n\t\n\t\tswitch ($this->image_type)\n\t\t{\n\t\t\tcase 1 \t\t:\timagegif($resource);\n\t\t\t\tbreak;\n\t\t\tcase 2\t\t:\timagejpeg($resource, '', $this->quality);\n\t\t\t\tbreak;\n\t\t\tcase 3\t\t:\timagepng($resource);\n\t\t\t\tbreak;\n\t\t\tdefault\t\t:\techo 'Unable to display the image';\n\t\t\t\tbreak;\t\t\n\t\t}\t\t\t\n\t}", "public function getImageResource()\n {\n if (is_null($this->image) && !is_null($this->full_path)) {\n $this->image = self::createResource($this->full_path);\n }\n\n if (is_resource($this->image) && get_resource_type($this->image) === 'gd') {\n imagesavealpha($this->image, true);\n } else {\n throw new \\InvalidArgumentException('Image is not valid.');\n }\n\n return $this->image;\n }", "protected function loadImageData($filename = null)\n {\n if ($filename === null) {\n /* Set to blank image */\n return parent::loadImageData($filename);\n }\n \n $im = $this -> getImageFromFile($filename);\n $this -> readImageFromImagick($im);\n }", "public static function fromGdImage($gdImage, $imgType = 'jpeg') : self\n\t{\n\t\t$data = self::gdImgToBase64($gdImage, $imgType);\n\t\t\n\t\treturn new static($data, $imgType);\n\t}", "abstract public function createImage(\n string $src,\n string $title = ''\n ): Image;", "protected function setImage($filename) {\n $size = getimagesize($filename);\n $this->ext = $size['mime'];\n\n switch ($this->ext) {\n // Image is a JPG\n case 'image/jpg':\n case 'image/jpeg':\n // create a jpeg extension\n $this->image = imagecreatefromjpeg($filename);\n break;\n\n // Image is a GIF\n case 'image/gif':\n $this->image = @imagecreatefromgif($filename);\n break;\n\n // Image is a PNG\n case 'image/png':\n $this->image = @imagecreatefrompng($filename);\n break;\n\n // Mime type not found\n default:\n throw new Exception(\"File is not an image, please use another file type.\", 1);\n }\n\n $this->origWidth = imagesx($this->image);\n $this->origHeight = imagesy($this->image);\n }", "public function setImage($url= NULL){\n\t\ttry{\n\t\t\tif(!is_null($url)){\n\t\t\t\t$this->imgResource = new ImageResource($url);\t\t\t\t\n\t\t\t}else{\n\t\t\t\t$this->setImageRepetition();\n\t\t\t\t$this->setImageAttachment();\n\t\t\t\t$this->setImagePosition();\n\t\t\t\t$this->imgResource = NULL;\t\t\t\t\n\t\t\t}\n\t\t}catch(Exception $e){\n\t\t\tthrow new Exception(ErrorHelper::formatMessage(__FUNCTION__,__CLASS__,$e));\n\t\t}\n\t}", "public function image($file) {\n\t\theader('Content-Type: image/png');\n\t\tdie(file_get_contents(APPPATH.'third_party/blog/images/'.$file));\n\t}", "public function __construct($file)\n {\n try\n {\n // Get the real path to the file\n $file = realpath($file);\n\n // Get the image information\n $info = getimagesize($file);\n }\n catch (Exception $e)\n {\n // Ignore all errors while reading the image\n }\n\n if (empty($file) OR empty($info))\n {\n // throw new Exception('Not an image or invalid image: :file',\n // array(':file' => Kohana::debug_path($file)));\n return '';\n }\n\n // Store the image information\n $this->file = $file;\n $this->width = $info[0];\n $this->height = $info[1];\n $this->type = $info[2];\n $this->mime = image_type_to_mime_type($this->type);\n\n // Set the image creation function name\n switch ($this->type)\n {\n case IMAGETYPE_JPEG:\n $create = 'imagecreatefromjpeg';\n break;\n case IMAGETYPE_GIF:\n $create = 'imagecreatefromgif';\n break;\n case IMAGETYPE_PNG:\n $create = 'imagecreatefrompng';\n break;\n }\n\n if ( ! isset($create) OR ! function_exists($create))\n {\n // throw new Exception('Installed GD does not support :type images',\n // array(':type' => image_type_to_extension($this->type, FALSE)));\n }\n\n // Save function for future use\n $this->_create_function = $create;\n\n // Save filename for lazy loading\n $this->_image = $this->file;\n }", "public function load(ObjectManager $manager)\n {\n $assetsDir = '/var/feeds/assets';\n\n if (!is_dir($assetsDir)) {\n $assetsDir = sys_get_temp_dir();\n }\n\n copy('web/images/logo.png', \"$assetsDir/hash.png\");\n }", "public function image($name) {\n\t\t\t$r=new Resource(Resource::GRAPHICS, $name);\n\t\t\t$this->addResource($r);\n\t\t\treturn $r;\n\t\t}", "public static function load($name) {\n\t $name = str_replace(\"\\\\\", DS, $name);\n\t\t$imagineBase = \\Configure::read('Imagine.base');\n\t\tif (empty($imagineBase)) {\n\t\t\t$imagineBase = \\CakePlugin::path('Imagine') . 'Vendor' . DS . 'Imagine' . DS . 'lib' . DS;\n\t\t}\n\n\t\t$filePath = $imagineBase . $name . '.php';\n\t\tif (file_exists($filePath)) {\n\t\t\trequire_once($filePath);\n\t\t\treturn;\n\t\t}\n\n\t\t$imagineBase = $imagineBase . 'Image' . DS;\n\t\tif (file_exists($imagineBase . $name . '.php')) {\n\t\t\trequire_once($imagineBase . $name . '.php');\n\t\t\treturn;\n\t\t}\n\t}", "public function _create($path)\n\t{\n\t\tif (!is_readable($path)) {\n\t\t\tthrow new \\Exception(\"Cannot open image file '\" . $path . \"'.\");\n\t\t}\n\t\t$img = null;\n\t\tswitch (exif_imagetype($path)) {\n\t\t\tcase IMAGETYPE_PNG:\n\t\t\t\t$img = imagecreatefrompng($path);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new \\Exception(\"Cannot read image type from file '\" . $path . \"'.\");\n\t\t}\n\t\tif (!$img) {\n\t\t\tthrow new \\Exception(\"Could not create image from file '\" . $path . \"'.\");\n\t\t}\n\t\treturn $img;\n\t}", "public function __construct($image)\n {\n $this->image = imagecreatefromstring($image);\n }", "private function getGdSrcImage( $filepath, $type ) {\n\t\t// create the image\n\t\t$src_img = false;\n\t\tswitch ( $type ) {\n\t\t\tcase IMAGETYPE_JPEG:\n\t\t\t\t$src_img = @imagecreatefromjpeg( $filepath );\n\t\t\t\tbreak;\n\t\t\tcase IMAGETYPE_PNG:\n\t\t\t\t$src_img = @imagecreatefrompng( $filepath );\n\t\t\t\tbreak;\n\t\t\tcase IMAGETYPE_GIF:\n\t\t\t\t$src_img = @imagecreatefromgif( $filepath );\n\t\t\t\tbreak;\n\t\t\tcase IMAGETYPE_BMP:\n\t\t\t\t$src_img = @imagecreatefromwbmp( $filepath );\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t$this->throwError( \"wrong image format, can't resize\" );\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif ( $src_img == false ) {\n\t\t\t$this->throwError( \"Can't resize image\" );\n\t\t}\n\n\t\treturn($src_img);\n\t}", "private function openFile($file)\n\t{\n\t\t$extension = strtolower(strrchr($file, '.'));\n\t\tswitch($extension) {\n\t\t\tcase '.jpg':\n\t\t\tcase '.jpeg':\n\t\t\t\t$img = @imagecreatefromjpeg($file);\n\t\t\t\tbreak;\n\t\t\tcase '.gif':\n\t\t\t\t$img = @imagecreatefromgif ($file);\n\t\t\t\tbreak;\n\t\t\tcase '.png':\n\t\t\t\t$img = @imagecreatefrompng($file);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new Exception('image type not allowed');\n\t\t\t\tbreak;\n\t\t}\n\t\t\n\t\tif (!$img) {\n\t\t\tthrow new Exception('image file not found');\n\t\t}\n\n\t\treturn $img;\n\t}", "public function getImage()\n {\n if ($this->isEmpty()) {\n return null;\n }\n\n $filePath = $this->getFile()->getPath()->__toString();\n\n switch ($this->imageType) {\n case ImageType::JPEG:\n return imagecreatefromjpeg($filePath) ?: null;\n case ImageType::PNG:\n return imagecreatefrompng($filePath) ?: null;\n case ImageType::GIF:\n return imagecreatefromgif($filePath) ?: null;\n }\n\n return null;\n }" ]
[ "0.7279598", "0.6560022", "0.6535591", "0.65068156", "0.6391081", "0.6183456", "0.6068901", "0.60112375", "0.59473675", "0.59314656", "0.5929995", "0.5923906", "0.591783", "0.5917558", "0.5894933", "0.58916134", "0.58810747", "0.58702743", "0.5832721", "0.57782984", "0.57782984", "0.57782984", "0.57782984", "0.5777479", "0.57142097", "0.5699849", "0.56069076", "0.55793405", "0.55621517", "0.55621517", "0.5553413", "0.5551425", "0.5496279", "0.5494537", "0.5472626", "0.54631805", "0.5393228", "0.5390506", "0.5380616", "0.5376354", "0.5352796", "0.5350855", "0.5343612", "0.53423905", "0.53104097", "0.5282032", "0.526968", "0.5251604", "0.5201072", "0.51901907", "0.5180702", "0.51584196", "0.5118534", "0.5068688", "0.5059142", "0.50591195", "0.5058938", "0.5052769", "0.5044302", "0.5039199", "0.50200534", "0.50077236", "0.49953464", "0.49940467", "0.4985745", "0.49732745", "0.49723634", "0.49637657", "0.4957472", "0.49500814", "0.49109325", "0.49038145", "0.48737848", "0.48734596", "0.4872156", "0.48681536", "0.48640785", "0.48617905", "0.485909", "0.4855972", "0.4855609", "0.48392755", "0.483552", "0.48264024", "0.48240858", "0.48174754", "0.48157215", "0.4808604", "0.48049772", "0.4797243", "0.47941524", "0.47940624", "0.47898537", "0.478935", "0.4779468", "0.4778719", "0.47625968", "0.47568256", "0.47491154", "0.47452098" ]
0.68958074
1
Presize width and height
protected function _do_resize($width, $height) { $pre_width = $this->width; $pre_height = $this->height; // Loads image if not yet loaded $this->_load_image(); // Test if we can do a resize without resampling to speed up the final resize if ($width > ($this->width / 2) AND $height > ($this->height / 2)) { // The maximum reduction is 10% greater than the final size $reduction_width = round($width * 1.1); $reduction_height = round($height * 1.1); while ($pre_width / 2 > $reduction_width AND $pre_height / 2 > $reduction_height) { // Reduce the size using an O(2n) algorithm, until it reaches the maximum reduction $pre_width /= 2; $pre_height /= 2; } // Create the temporary image to copy to $image = $this->_create($pre_width, $pre_height); if (imagecopyresized($image, $this->_image, 0, 0, 0, 0, $pre_width, $pre_height, $this->width, $this->height)) { // Swap the new image for the old one imagedestroy($this->_image); $this->_image = $image; } } // Create the temporary image to copy to $image = $this->_create($width, $height); // Execute the resize if (imagecopyresampled($image, $this->_image, 0, 0, 0, 0, $width, $height, $pre_width, $pre_height)) { // Swap the new image for the old one imagedestroy($this->_image); $this->_image = $image; // Reset the width and height $this->width = imagesx($image); $this->height = imagesy($image); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function resize(){\n\n}", "abstract public function resize($properties);", "public function resize($width, $height = null);", "public function resizePx($width,$height) {\n\t\t$this->_width = $width;\n\t\t$this->_height = $height;\n\t\treturn $this;\n\t}", "function resize($width,$height)\n {\n $new_image = imagecreatetruecolor($width, $height);\n imagecopyresampled($new_image, $this->image, 0, 0, 0, 0, $width, $height, $this->getWidth(), $this->getHeight());\n $this->image = $new_image; \n }", "public function resize($width, $height, $crop_top = 0, $crop_bottom = 0, $crop_left = 0, $crop_right = 0) {}", "function __resize(&$tmp, $width, $height) {\n\t\t\n\t\t// call `convert -geometry`\n\t\t//\n\t\t$cmd = $this->__command(\n\t\t\t'convert',\n \t\"-geometry {$width}x{$height}! \"\n \t\t. escapeshellarg(realpath($tmp->target))\n \t\t. \" \"\n \t\t. escapeshellarg(realpath($tmp->target))\n \t);\n\n exec($cmd, $result, $errors);\n\t\treturn ($errors == 0);\n\t\t}", "protected function update_size($width = \\false, $height = \\false)\n {\n }", "public function resize($width=null, $height=null, $master=null);", "function image_reproportion()\n\t{\n\t\tif ( ! is_numeric($this->dst_width) OR ! is_numeric($this->dst_height) OR $this->dst_width == 0 OR $this->dst_height == 0)\n\t\t\treturn;\n\t\t\n\t\tif ( ! is_numeric($this->src_width) OR ! is_numeric($this->src_height) OR $this->src_width == 0 OR $this->src_height == 0)\n\t\t\treturn;\n\t\n\t\tif (($this->dst_width >= $this->src_width) AND ($this->dst_height >= $this->src_height))\n\t\t{\n\t\t\t$this->dst_width = $this->src_width;\n\t\t\t$this->dst_height = $this->src_height;\n\t\t}\n\t\t\n\t\t$new_width\t= ceil($this->src_width*$this->dst_height/$this->src_height);\t\t\n\t\t$new_height\t= ceil($this->dst_width*$this->src_height/$this->src_width);\n\t\t\n\t\t$ratio = (($this->src_height/$this->src_width) - ($this->dst_height/$this->dst_width));\n\n\t\tif ($this->master_dim != 'width' AND $this->master_dim != 'height')\n\t\t{\n\t\t\t$this->master_dim = ($ratio < 0) ? 'width' : 'height';\n\t\t}\n\t\t\n\t\tif (($this->dst_width != $new_width) AND ($this->dst_height != $new_height))\n\t\t{\n\t\t\tif ($this->master_dim == 'height')\n\t\t\t{\n\t\t\t\t$this->dst_width = $new_width;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->dst_height = $new_height;\n\t\t\t}\n\t\t}\n\t}", "public function define_size($p_width,$p_w_unity,$p_height,$p_h_unity)\r\n\t\t{\r\n\t\t\t$this->c_width = $p_width;\r\n\t\t\t$this->c_w_unity = $p_w_unity;\r\n\t\t\t$this->c_height = $p_height;\r\n\t\t\t$this->c_h_unity = $p_h_unity;\r\n\t\t}", "public function setDimensions($width, $height) {}", "public function setResolution()\n\t{\n\t\t$args=func_get_args();\n\n\t\tif(count($args)==0 or count($args)>2) return;\n\n\t\t$this->resizeFlag=true;\n\n\t\t$this->width=$args[0];\n\t\t$this->height=$args[1];\n\n\t}", "public function resize()\n\t{\n\t\t$protocol = ($this->image_library === 'gd2') ? 'image_process_gd' : 'image_process_'.$this->image_library;\n\t\treturn $this->$protocol('resize');\n\t}", "function resizeToWidth($width) {\r\n\t\t$ratio = $width / $this->getWidth();\r\n\t\t$height = $this->getheight() * $ratio;\r\n\t\t$this->resize($width,$height);\r\n\t}", "public function resizeTo($width, $height, $resizeOption = 'default') {\n switch (strtolower($resizeOption)) {\n case 'exact':\n $this->resizeWidth = $width;\n $this->resizeHeight = $height;\n break;\n case 'maxwidth':\n $this->resizeWidth = $width;\n $this->resizeHeight = $this->resizeHeightByWidth($width);\n break;\n case 'maxheight':\n $this->resizeWidth = $this->resizeWidthByHeight($height);\n $this->resizeHeight = $height;\n break;\n case 'proportionally':\n $ratio_orig = $this->origWidth / $this->origHeight;\n $this->resizeWidth = $width;\n $this->resizeHeight = $height;\n if ($width / $height > $ratio_orig)\n $this->resizeWidth = $height * $ratio_orig;\n else\n $this->resizeHeight = $width / $ratio_orig;\n break;\n default:\n if ($this->origWidth > $width || $this->origHeight > $height) {\n if ($this->origWidth > $this->origHeight) {\n $this->resizeHeight = $this->resizeHeightByWidth($width);\n $this->resizeWidth = $width;\n } else if ($this->origWidth < $this->origHeight) {\n $this->resizeWidth = $this->resizeWidthByHeight($height);\n $this->resizeHeight = $height;\n } else {\n $this->resizeWidth = $width;\n $this->resizeHeight = $height;\n }\n } else {\n $this->resizeWidth = $width;\n $this->resizeHeight = $height;\n }\n break;\n }\n\n $this->newImage = imagecreatetruecolor($this->resizeWidth, $this->resizeHeight);\n if ($this->ext == \"image/gif\" || $this->ext == \"image/png\") {\n imagealphablending($this->newImage, false);\n imagesavealpha($this->newImage, true);\n $transparent = imagecolorallocatealpha($this->newImage, 255, 255, 255, 127);\n imagefilledrectangle($this->newImage, 0, 0, $this->resizeWidth, $this->resizeHeight, $transparent);\n }\n imagecopyresampled($this->newImage, $this->image, 0, 0, 0, 0, $this->resizeWidth, $this->resizeHeight, $this->origWidth, $this->origHeight);\n }", "function resize($iNewWidth, $iNewHeight)\n\t{\n\t\tif (!$this->ImageStream) {\n\t\t\t$this->printError('image not loaded');\n\t\t}\n\n\t\tif (function_exists(\"imagecopyresampled\")) {\n\t\t\t$ResizedImageStream = imagecreatetruecolor($iNewWidth, $iNewHeight);\n\t\t\timagecopyresampled($ResizedImageStream, $this->ImageStream, 0, 0, 0, 0, $iNewWidth, $iNewHeight, $this->width, $this->height);\n\t\t} else {\n\t\t\t$ResizedImageStream = imagecreate($iNewWidth, $iNewHeight);\n\t\t\timagecopyresized($ResizedImageStream, $this->ImageStream, 0, 0, 0, 0, $iNewWidth, $iNewHeight, $this->width, $this->height);\n\t\t}\n\n\t\t$this->ImageStream = $ResizedImageStream;\n\t\t$this->width = $iNewWidth;\n\t\t$this->height = $iNewHeight;\n\t\t$this->setImageOrientation();\n\t}", "protected function resize()\n {\n $width = $this->width;\n $height = $this->height;\n $orig_width = imagesx($this->image);\n $orig_height = imagesy($this->image);\n \n // Determine new image dimensions\n if($this->mode === \"crop\"){ // Crop image\n \n $max_width = $crop_width = $width;\n $max_height = $crop_height = $height;\n \n $x_ratio = @($max_width / $orig_width);\n $y_ratio = @($max_height / $orig_height);\n \n if($orig_width > $orig_height){ // Original is wide\n $height = $max_height;\n $width = ceil($y_ratio * $orig_width);\n \n } elseif($orig_height > $orig_width){ // Original is tall\n $width = $max_width;\n $height = ceil($x_ratio * $orig_height);\n \n } else { // Original is square\n $this->mode = \"fit\";\n \n return $this->resize();\n }\n \n // Adjust if the crop width is less than the requested width to avoid black lines\n if($width < $crop_width){\n $width = $max_width;\n $height = ceil($x_ratio * $orig_height);\n }\n \n } elseif($this->mode === \"fit\"){ // Fits the image according to aspect ratio to within max height and width\n $max_width = $width;\n $max_height = $height;\n \n $x_ratio = @($max_width / $orig_width);\n $y_ratio = @($max_height / $orig_height);\n \n if( ($orig_width <= $max_width) && ($orig_height <= $max_height) ){ // Image is smaller than max height and width so don't resize\n $tn_width = $orig_width;\n $tn_height = $orig_height;\n \n } elseif(($x_ratio * $orig_height) < $max_height){ // Wider rather than taller\n $tn_height = ceil($x_ratio * $orig_height);\n $tn_width = $max_width;\n \n } else { // Taller rather than wider\n $tn_width = ceil($y_ratio * $orig_width);\n $tn_height = $max_height;\n }\n \n $width = $tn_width;\n $height = $tn_height;\n \n } elseif($this->mode === \"fit-x\"){ // Sets the width to the max width and the height according to aspect ratio (will stretch if too small)\n $height = @round($orig_height * $width / $orig_width);\n \n if($orig_height <= $height){ // Don't stretch if smaller\n $width = $orig_width;\n $height = $orig_height;\n }\n \n } elseif($this->mode === \"fit-y\"){ // Sets the height to the max height and the width according to aspect ratio (will stretch if too small)\n $width = @round($orig_width * $height / $orig_height);\n \n if($orig_width <= $width){ // Don't stretch if smaller\n $width = $orig_width;\n $height = $orig_height;\n }\n } else {\n throw new \\Exception('Invalid mode: ' . $this->mode);\n }\n \n\n // Resize\n $this->temp = imagecreatetruecolor($width, $height);\n \n // Preserve transparency if a png\n if($this->image_info['mime'] == 'image/png'){\n imagealphablending($this->temp, false);\n imagesavealpha($this->temp, true);\n }\n \n imagecopyresampled($this->temp, $this->image, 0, 0, 0, 0, $width, $height, $orig_width, $orig_height);\n $this->sync();\n \n \n // Cropping?\n if($this->mode === \"crop\"){ \n $orig_width = imagesx($this->image);\n $orig_height = imagesy($this->image);\n \n $x_mid = $orig_width/2; // horizontal middle\n $y_mid = $orig_height/2; // vertical middle\n \n $this->temp = imagecreatetruecolor($crop_width, $crop_height);\n \n // Preserve transparency if a png\n if($this->image_info['mime'] == 'image/png'){\n imagealphablending($this->temp, false);\n imagesavealpha($this->temp, true);\n }\n\n imagecopyresampled($this->temp, $this->image, 0, 0, ($x_mid-($crop_width/2)), ($y_mid-($crop_height/2)), $crop_width, $crop_height, $crop_width, $crop_height);\n $this->sync();\n }\n }", "function resize($width, $height){\n\n $new_image = imagecreatetruecolor($width, $height);\n\n imagecolortransparent($new_image, imagecolorallocate($new_image, 0, 0, 0));\n imagealphablending($new_image, false);\n imagesavealpha($new_image, true);\n\n imagecopyresampled($new_image, $this->image, 0, 0, 0, 0, $width, $height, $this->get_width(), $this->get_height());\n $this->image = $new_image;\n\n //reset sizes\n $this->width = $width;\n $this->height = $height;\n\n return true;\n }", "private function resize($width,$height) {\n $newImage = imagecreatetruecolor($width, $height);\n imagealphablending($newImage, false);\n imagesavealpha($newImage, true);\n imagecopyresampled($newImage, $this->image, 0, 0, 0, 0, $width, $height, $this->getWidth(), $this->getHeight());\n $this->image = $newImage;\n }", "function calc_size()\n\t{\n\t\t\t$size = getimagesize(ROOT_PATH . $this->file);\n\t\t\t$this->width = $size[0];\n\t\t\t$this->height = $size[1];\n\t}", "public function ImageResize($file_resize_width, $file_resize_height){\r\n $this->proc_filewidth=$file_resize_width;\r\n $this->proc_fileheight=$file_resize_height;\r\n }", "function resizetowidth($iNewWidth)\n\t{\n\t\t$iNewHeight = ($iNewWidth / $this->width) * $this->height;\n\n\t\t$this->resize($iNewWidth, $iNewHeight);\n\t}", "protected function widenResizeMagic(): void\n {\n $this->image->widen($this->widenResize, function ($constraint) {\n $constraint->upsize();\n });\n }", "function wp_shrink_dimensions($width, $height, $wmax = 128, $hmax = 96)\n {\n }", "protected function update_size($width = \\null, $height = \\null)\n {\n }", "function resizeToWidth($width)\n {\n //obtine ratio dividiendo ancho dada entre el ancho actual de la imagen.\n $ratio = $width / $this->getWidth();\n //obtiene altura con la altura actual de la imagen por el ratio.\n $height = $this->getheight() * $ratio;\n //redimensiona imagen.\n $this->resize($width,$height);\n }", "private function resizeWithScaleExact($width, $height, $scale) {\n\t\t//$new_height = (int)($this->info['height'] * $scale);\n\t\t$new_width = $width * $scale;\n\t\t$new_height = $height * $scale;\n\t\t$xpos = 0;//(int)(($width - $new_width) / 2);\n\t\t$ypos = 0;//(int)(($height - $new_height) / 2);\n\n if (isset($this->info['mime']) && $this->info['mime'] == 'image/gif' && $this->isAnimated) {\n $this->imagick = new Imagick($this->file);\n $this->imagick = $this->imagick->coalesceImages();\n foreach ($this->imagick as $frame) {\n $frame->thumbnailImage($new_width, $new_height);\n $frame->setImagePage($new_width, $new_height, 0, 0);\n }\n } else {\n $image_old = $this->image;\n $this->image = imagecreatetruecolor($width, $height);\n $bcg = $this->backgroundColor;\n\n if (isset($this->info['mime']) && $this->info['mime'] == 'image/png') {\n imagealphablending($this->image, false);\n imagesavealpha($this->image, true);\n $background = imagecolorallocatealpha($this->image, $bcg[0], $bcg[1], $bcg[2], 127);\n imagecolortransparent($this->image, $background);\n } else {\n $background = imagecolorallocate($this->image, $bcg[0], $bcg[1], $bcg[2]);\n }\n\n imagefilledrectangle($this->image, 0, 0, $width, $height, $background);\n imagecopyresampled($this->image, $image_old, $xpos, $ypos, 0, 0, $new_width, $new_height, $this->info['width'], $this->info['height']);\n imagedestroy($image_old);\n }\n\n\t\t$this->info['width'] = $width;\n\t\t$this->info['height'] = $height;\n }", "public function resizeImage()\n {\n \treturn view('resizeImage');\n }", "protected function update_size( $width = false, $height = false ) {\n\t\tif ( ! $width )\n\t\t\t$width = imagesx( $this->image );\n\n\t\tif ( ! $height )\n\t\t\t$height = imagesy( $this->image );\n\n\t\treturn parent::update_size( $width, $height );\n\t}", "private function switchDimensions()\r\n {\r\n if (($this->ControlState & csLoading) != csLoading)\r\n {\r\n $temp=$this->_width;\r\n $this->_width=$this->_height;\r\n $this->_height=$temp;\r\n }\r\n }", "private function resize() {\n\t\tswitch($this->type) {\n\t\t\tcase 'image/jpeg':\n\t\t\t\t$originalImage = imagecreatefromjpeg($this->tempName);\n\t\t\tbreak;\n\t\t\tcase 'image/png':\n\t\t\t\t$originalImage = imagecreatefrompng($this->tempName);\n\t\t\tbreak;\n\t\t\tcase 'image/gif':\n\t\t\t\t$originalImage = imagecreatefromgif($this->tempName);\n\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tdie('FILE CANNOT BE RESIZED');\n\t\t\tbreak;\n\t\t}\n\n\t\t// Determine new height\n\t\t$this->newHeight = ($this->height / $this->width) * $this->newWidth;\n\n\t\t// Create new image\n\t\t$this->newImage = imagecreatetruecolor($this->newWidth, $this->newHeight);\n\n\t\t// Resample original image into new image\n\t\timagecopyresampled($this->newImage, $originalImage, 0, 0, 0, 0, $this->newWidth, $this->newHeight, $this->width, $this->height);\n\n\t\t// Switch based on image being resized\n\t\tswitch($this->type) {\n\t\t\tcase 'image/jpeg':\n\t\t\t\t// Source, Dest, Quality 0 to 100\n\t\t\t\timagejpeg($this->newImage, $this->destinationFolder.'/'.$this->newName, 80);\n\t\t\tbreak;\n\t\t\tcase 'image/png':\n\t\t\t\t// Source, Dest, Quality 0 (no compression) to 9\n\t\t\t\timagepng($this->newImage, $this->destinationFolder.'/'.$this->newName, 0);\n\t\t\tbreak;\n\t\t\tcase 'image/gif':\n\t\t\t\timagegif($this->newImage, $this->destinationFolder.'/'.$this->newName);\n\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tdie('YOUR FILE CANNOT BE RESIZED');\n\t\t\tbreak;\n\t\t}\n\n\t\t// DESTROY NEW IMAGE TO SAVE SERVER SPACE\n\t\timagedestroy($this->newImage);\n\t\timagedestroy($originalImage);\n\n\t\t// SUCCESSFULLY UPLOADED\n\t\t$this->result = true;\n\t\t$this->message = 'Image uploaded and resized successfully';\n\t}", "function resize( $w = 0, $h = 0 )\n\t{\n\t\tif( $w == 0 || $h == 0 )\n\t\t\treturn FALSE;\n\t\t\n\t\t//get the size of the current image\n\t\t$oldsize = $this->size();\n\t\t\n\t\t//create a target canvas\n\t\t$new_im = imagecreatetruecolor ( $w, $h );\n\t\n\t\t//copy and resize image to new canvas\n\t\timagecopyresampled( $new_im, $this->im, 0, 0, 0, 0, $w, $h, $oldsize->w, $oldsize->h );\n\t\t\n\t\t//delete the old image handle\n\t\timagedestroy( $this->im );\n\t\t\n\t\t//set the new image as the current handle\n\t\t$this->im = $new_im;\n\t}", "function __resize(&$tmp, $width, $height) {\r\r\n\t\tasido::trigger_abstract_error(\r\r\n\t\t\t__CLASS__,\r\r\n\t\t\t__FUNCTION__\r\r\n\t\t\t);\r\r\n\t\t}", "public function image_reproportion()\n\t{\n\t\tif (($this->width === 0 && $this->height === 0) OR $this->orig_width === 0 OR $this->orig_height === 0\n\t\t\tOR ( ! ctype_digit((string) $this->width) && ! ctype_digit((string) $this->height))\n\t\t\tOR ! ctype_digit((string) $this->orig_width) OR ! ctype_digit((string) $this->orig_height))\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\t// Sanitize\n\t\t$this->width = (int) $this->width;\n\t\t$this->height = (int) $this->height;\n\n\t\tif ($this->master_dim !== 'width' && $this->master_dim !== 'height')\n\t\t{\n\t\t\tif ($this->width > 0 && $this->height > 0)\n\t\t\t{\n\t\t\t\t$this->master_dim = ((($this->orig_height/$this->orig_width) - ($this->height/$this->width)) < 0)\n\t\t\t\t\t\t\t? 'width' : 'height';\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->master_dim = ($this->height === 0) ? 'width' : 'height';\n\t\t\t}\n\t\t}\n\t\telseif (($this->master_dim === 'width' && $this->width === 0)\n\t\t\tOR ($this->master_dim === 'height' && $this->height === 0))\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\tif ($this->master_dim === 'width')\n\t\t{\n\t\t\t$this->height = (int) ceil($this->width*$this->orig_height/$this->orig_width);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->width = (int) ceil($this->orig_width*$this->height/$this->orig_height);\n\t\t}\n\t}", "function resize_square($size){\n\n //container for new image\n $new_image = imagecreatetruecolor($size, $size);\n\n\n if($this->width > $this->height){\n $this->resize_by_height($size);\n\n imagecolortransparent($new_image, imagecolorallocate($new_image, 0, 0, 0));\n imagealphablending($new_image, false);\n imagesavealpha($new_image, true);\n imagecopy($new_image, $this->image, 0, 0, ($this->get_width() - $size) / 2, 0, $size, $size);\n }else{\n $this->resize_by_width($size);\n\n imagecolortransparent($new_image, imagecolorallocate($new_image, 0, 0, 0));\n imagealphablending($new_image, false);\n imagesavealpha($new_image, true);\n imagecopy($new_image, $this->image, 0, 0, 0, ($this->get_height() - $size) / 2, $size, $size);\n }\n\n $this->image = $new_image;\n\n //reset sizes\n $this->width = $size;\n $this->height = $size;\n\n return true;\n }", "function resize($new_x = 0, $new_y = 0)\r\n {\r\n // 0 means keep original size\r\n $new_x = (0 == $new_x) ? $this->img_x : $this->_parse_size($new_x, $this->img_x);\r\n $new_y = (0 == $new_y) ? $this->img_y : $this->_parse_size($new_y, $this->img_y);\r\n // Now do the library specific resizing.\r\n return $this->_resize($new_x, $new_y);\r\n }", "function imgResize($filename, $newWidth, $newHeight, $dir_out){\n\t\n\t// изменение размера изображения\n\n\t// 1 создадим новое изображение из файла\n\t$scr = imagecreatefromjpeg($filename); // или $imagePath\n\t\n\t// 2 создадим новое полноцветное изображение нужного размера\n\t$newImg = imagecreatetruecolor($newWidth, $newHeight);\n\n\t// 3 определим размер исходного изображения для 4 пункта\n\t$size = getimagesize($filename);\n\n\t// 4 копирует прямоугольную часть одного изображения на другое изображение, интерполируя значения пикселов таким образом, чтобы уменьшение размера изображения не уменьшало его чёткости\n\timagecopyresampled($newImg, $scr, 0, 0, 0, 0, $newWidth, $newHeight, $size[0], $size[1]);\n\n\t// 5 запишем изображение в файл по нужному пути\n\timagejpeg($newImg, $dir_out);\n\n\timagedestroy($scr);\n\timagedestroy($newImg);\t\t\n\t\n}", "public function setSize($width, $height) {\r\nif (null === $width && null === $height) {\r\n$this->new_width = $this->width;\r\n$this->new_height = $this->height;\r\n}\r\nelseif (isset($width) && isset($height)) {\r\n$this->new_width = $width;\r\n$this->new_height = $height;\r\n}\r\nelseif(isset($width) && !isset($height)) {\r\n$this->new_width = $width;\r\n$this->new_height = round($this->new_width * $this->height / $this->width);\r\n}\r\nelseif(!isset($width) && isset($height)) {\r\n$this->new_height = $height;\r\n$this->new_width = round($this->new_height * $this->width / $this->height);\r\n}\r\nif($this->new_height != (int)$this->new_height || $this->new_width != (int)$this->new_width)\r\nthrow new Exception('<b>Error:</b> Parameters 3 and 4 expect to be type of integer');\r\n}", "function image_resize_dimensions ( $args ) {\r\n\t\t/*\r\n\t\t * Changelog\r\n\t\t *\r\n\t\t * v8.1, November 11, 2009\r\n\t\t * - Now uses trigger_error instead of outputting errors to screen\r\n\t\t *\r\n\t\t * v8, December 02, 2007\r\n\t\t * - Cleaned by using math instead of logic\r\n\t\t * - Restructured the code\r\n\t\t * - Re-organised variable names\r\n\t\t *\r\n\t\t * v7, 20/07/2007\r\n\t\t * - Cleaned\r\n\t\t *\r\n\t\t * v6,\r\n\t\t * - Added cropping\r\n\t\t *\r\n\t\t * v5, 12/08/2006\r\n\t\t * - Changed to use args\r\n\t\t */\r\n\t\t\r\n\t\t/*\r\n\t\tThe 'exact' resize mode, will resize things to the exact limit.\r\n\t\tIf a width or height is 0, the appropriate value will be calculated by ratio\r\n\t\tResults with a 800x600 limit:\r\n\t\t\t*x*\t\t\t->\t800x600\r\n\t\tResults with a 0x600 limit:\r\n\t\t\t1280x1024\t->\t750x600\r\n\t\t\t1900x1200\t->\t950x600\r\n\t\t\t96x48\t\t->\t1200x600\r\n\t\t\t1000x500\t->\t1200x600\r\n\t\tResults with a 800x0 limit:\r\n\t\t\t1280x1024\t->\t800x640\r\n\t\t\t1900x1200\t->\t800x505\r\n\t\t\t96x48\t\t->\t800x400\r\n\t\t\t1000x500\t->\t800x400\r\n\t\t*/\r\n\t\t\r\n\t\t/*\r\n\t\tThe 'area' resize mode, will resize things to fit within the area.\r\n\t\tIf a width or height is 0, the appropriate value will be calculated by ratio\r\n\t\tResults with a 800x600 limit:\r\n\t\t\t1280x1024\t->\t750x600\r\n\t\t\t1900x1200\t->\t950x600\t-> 800x505\r\n\t\t\t96x48\t\t->\t96x48\t\tno change\r\n\t\t\t1000x500\t->\t800x400 = '800x'.(800/100)*500\r\n\t\tResults with a 0x600 limit:\r\n\t\t\t1280x1024\t->\t750x600\r\n\t\t\t1900x1200\t->\t950x600\r\n\t\t\t96x48\t\t->\t96x48\t\tno change\r\n\t\t\t1000x500\t->\t1000x500\tno change\r\n\t\tResults with a 800x0 limit:\r\n\t\t\t1280x1024\t->\t800x640\r\n\t\t\t1900x1200\t->\t950x600\t->\t800x505\r\n\t\t\t96x48\t\t->\t96x48\t\tno change\r\n\t\t\t1000x500\t->\t800x400\t= '800x'.(800/1000)*500\r\n\t\t*/\r\n\t\t\r\n\t\t// ---------\r\n\t\t$image = $x_original = $y_original = $x_old = $y_old = $resize_mode = $width_original = $width_old = $width_desired = $width_new = $height_original = $height_old = $height_desired = $height_new = null;\r\n\t\textract($args);\r\n\t\t\r\n\t\t// ---------\r\n\t\tif ( is_null($width_original) && !is_null($width_old) ) {\r\n\t\t\t$width_original = $width_old;\r\n\t\t\t$width_old = null;\r\n\t\t}\r\n\t\tif ( is_null($height_original) && !is_null($height_old) ) {\r\n\t\t\t$height_original = $height_old;\r\n\t\t\t$height_old = null;\r\n\t\t}\r\n\t\t\r\n\t\t//\r\n\t\tif ( is_null($width_original) && is_null($height_original) && !is_null($image) ) { // Get from image\r\n\t\t\t$image = image_read($image);\r\n\t\t\t$width_original = imagesx($image);\r\n\t\t\t$height_original = imagesy($image);\r\n\t\t}\r\n\t\t\r\n\t\t//\r\n\t\tif ( empty($width_original) || empty($height_original) ) { //\r\n\t\t\ttrigger_error('no original dimensions specified', E_USER_WARNING);\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\t// ---------\r\n\t\tif ( is_null($width_desired) && !is_null($width_new) ) {\r\n\t\t\t$width_desired = $width_new;\r\n\t\t\t$width_new = null;\r\n\t\t}\r\n\t\tif ( is_null($height_desired) && !is_null($height_new) ) {\r\n\t\t\t$height_desired = $height_new;\r\n\t\t\t$height_new = null;\r\n\t\t}\r\n\t\t\r\n\t\t//\r\n\t\tif ( is_null($width_desired) || is_null($height_desired) ) { // Don't do any resizing\r\n\t\t\ttrigger_error('no desired dimensions specified', E_USER_NOTICE);\r\n\t\t\t// return array( 'width' => $width_original, 'height' => $height_original );\r\n\t\t}\r\n\t\t\r\n\t\t// ---------\r\n\t\tif ( is_null($resize_mode) ) {\r\n\t\t\t$resize_mode = 'area';\r\n\t\t} elseif ( $resize_mode === 'none' ) { // Don't do any resizing\r\n\t\t\ttrigger_error('$resize_mode === \\'none\\'', E_USER_NOTICE);\r\n\t\t\t// return array( 'width' => $width_original, 'height' => $height_original );\r\n\t\t} elseif ( !in_array($resize_mode, array('area', 'crop', 'exact', true)) ) { //\r\n\t\t\ttrigger_error('Passed $resize_mode is not valid: ' . var_export(compact('resize_mode'), true), E_USER_WARNING);\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\t// ---------\r\n\t\tif ( is_null($x_original) && !is_null($x_old) ) {\r\n\t\t\t$x_original = $x_old;\r\n\t\t\tunset($x_old);\r\n\t\t}\r\n\t\tif ( is_null($y_original) && !is_null($y_old) ) {\r\n\t\t\t$y_original = $y_old;\r\n\t\t\tunset($y_old);\r\n\t\t}\r\n\t\tif ( is_null($x_original) )\r\n\t\t\t$x_original = 0;\r\n\t\tif ( is_null($y_original) )\r\n\t\t\t$y_original = 0;\r\n\t\t\t\r\n\t\t// ---------\r\n\t\t// Let's force integer values\r\n\t\t$width_original = intval($width_original);\r\n\t\t$height_original = intval($height_original);\r\n\t\t$width_desired = intval($width_desired);\r\n\t\t$height_desired = intval($height_desired);\r\n\t\t\r\n\t\t// ---------\r\n\t\t// Set proportions\r\n\t\tif ( $height_original !== 0 )\r\n\t\t\t$proportion_wh = $width_original / $height_original;\r\n\t\tif ( $width_original !== 0 )\r\n\t\t\t$proportion_hw = $height_original / $width_original;\r\n\t\t\r\n\t\tif ( $height_desired !== 0 )\r\n\t\t\t$proportion_wh_desired = $width_desired / $height_desired;\r\n\t\tif ( $width_desired !== 0 )\r\n\t\t\t$proportion_hw_desired = $height_desired / $width_desired;\r\n\t\t\t\r\n\t\t// ---------\r\n\t\t// Set cutoms\r\n\t\t$x_new = $x_original;\r\n\t\t$y_new = $y_original;\r\n\t\t$canvas_width = $canvas_height = null;\r\n\t\t\r\n\t\t// ---------\r\n\t\t$width_new = $width_original;\r\n\t\t$height_new = $height_original;\r\n\t\t\r\n\t\t// ---------\r\n\t\t// Do resize\r\n\t\tif ( $height_desired === 0 && $width_desired === 0 ) {\r\n\t\t\t// Nothing to do\r\n\t\t} elseif ( $height_desired === 0 && $width_desired !== 0 ) {\r\n\t\t\t// We don't care about the height\r\n\t\t\t$width_new = $width_desired;\r\n\t\t\tif ( $resize_mode !== 'exact' ) {\r\n\t\t\t\t// h = w*(h/w)\r\n\t\t\t\t$height_new = $width_desired * $proportion_hw;\r\n\t\t\t}\r\n\t\t} elseif ( $height_desired !== 0 && $width_desired === 0 ) {\r\n\t\t\t// We don't care about the width\r\n\t\t\tif ( $resize_mode !== 'exact' ) {\r\n\t\t\t\t // w = h*(w/h)\r\n\t\t\t\t$width_new = $height_desired * $proportion_wh;\r\n\t\t\t}\r\n\t\t\t$height_new = $height_desired;\r\n\t\t} else {\r\n\t\t\t// We care about both\r\n\r\n\t\t\tif ( $resize_mode === 'exact' || /* no upscaling */ ($width_original <= $width_desired && $height_original <= $height_desired) ) { // Nothing to do\r\n\t\t\t} elseif ( $resize_mode === 'area' ) { // Proportion to fit inside\r\n\t\t\t\t\r\n\r\n\t\t\t\t// Pick which option\r\n\t\t\t\tif ( $proportion_wh <= $proportion_wh_desired ) { // Option 1: wh\r\n\t\t\t\t\t// Height would of overflowed\r\n\t\t\t\t\t$width_new = $height_desired * $proportion_wh; // w = h*(w/h)\r\n\t\t\t\t\t$height_new = $height_desired;\r\n\t\t\t\t} else // if ( $proportion_hw <= $proportion_hw_desired )\r\n{ // Option 2: hw\r\n\t\t\t\t\t// Width would of overflowed\r\n\t\t\t\t\t$width_new = $width_desired;\r\n\t\t\t\t\t$height_new = $width_desired * $proportion_hw; // h = w*(h/w)\r\n\t\t\t\t}\r\n\t\t\t\r\n\t\t\t} elseif ( $resize_mode === 'crop' ) { // Proportion to occupy\r\n\t\t\t\t\r\n\r\n\t\t\t\t// Pick which option\r\n\t\t\t\tif ( $proportion_wh <= $proportion_wh_desired ) { // Option 2: hw\r\n\t\t\t\t\t// Height will overflow\r\n\t\t\t\t\t$width_new = $width_desired;\r\n\t\t\t\t\t$height_new = $width_desired * $proportion_hw; // h = w*(h/w)\r\n\t\t\t\t\t// Set custom\r\n\t\t\t\t\t$y_new = -($height_new - $height_desired) / 2;\r\n\t\t\t\t} else // if ( $proportion_hw <= $proportion_hw_desired )\r\n{ // Option 1: hw\r\n\t\t\t\t\t// Width will overflow\r\n\t\t\t\t\t$width_new = $height_desired * $proportion_wh; // w = h*(w/h)\r\n\t\t\t\t\t$height_new = $height_desired;\r\n\t\t\t\t\t// Set custom\r\n\t\t\t\t\t$x_new = -($width_new - $width_desired) / 2;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t// Set canvas\r\n\t\t\t\t$canvas_width = $width_desired;\r\n\t\t\t\t$canvas_height = $height_desired;\r\n\t\t\t\r\n\t\t\t}\r\n\t\t\r\n\t\t}\r\n\t\t\r\n\t\t// ---------\r\n\t\t// Set custom if they have not been set already\r\n\t\tif ( $canvas_width === null )\r\n\t\t\t$canvas_width = $width_new;\r\n\t\tif ( $canvas_height === null )\r\n\t\t\t$canvas_height = $height_new;\r\n\t\t\t\r\n\t\t// ---------\r\n\t\t// Compat\r\n\t\t$width_old = $width_original;\r\n\t\t$height_old = $height_original;\r\n\t\t$x_old = $x_original;\r\n\t\t$y_old = $y_original;\r\n\t\t\r\n\t\t// ---------\r\n\t\t// Return\r\n\t\t$return = compact('width_original', 'height_original', 'width_old', 'height_old', 'width_desired', 'height_desired', 'width_new', 'height_new', 'canvas_width', 'canvas_height', 'x_original', 'y_original', 'x_old', 'y_old', 'x_new', 'y_new');\r\n\t\t// echo '<--'; var_dump($return); echo '-->';\r\n\t\treturn $return;\r\n\t}", "function scaleByLength($size)\r\n {\r\n if ($this->img_x >= $this->img_y) {\r\n $new_x = $size;\r\n $new_y = round(($new_x / $this->img_x) * $this->img_y, 0);\r\n } else {\r\n $new_y = $size;\r\n $new_x = round(($new_y / $this->img_y) * $this->img_x, 0);\r\n }\r\n return $this->_resize($new_x, $new_y);\r\n }", "public function setSize($width,$height) \n {\n $this->width = $width;\n $this->height = $height;\n }", "function funcs_imageResize(&$width, &$height, $target, $bywidth = null) {\n\tif ($width<=$target && $height<=$target){\n\t\treturn;\n\t}\n\t//takes the larger size of the width and height and applies the \n\t//formula accordingly...this is so this script will work \n\t//dynamically with any size image \n\tif (is_null($bywidth)){\n\t\tif ($width > $height) { \n\t\t\t$percentage = ($target / $width); \n\t\t} else { \n\t\t\t$percentage = ($target / $height); \n\t\t}\n\t}else{\n\t\tif ($bywidth){\n\t\t\t$percentage = ($target / $width);\n\t\t\t//if height would increase as a result\n\t\t\tif ($height < round($height * $percentage)){\n\t\t\t\treturn;\n\t\t\t} \n\t\t}else{\n\t\t\t$percentage = ($target / $height); \n\t\t\t//if width would increase as a result\n\t\t\tif ($width < round($width * $percentage)){\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t} \n\t//gets the new value and applies the percentage, then rounds the value \n\t$width = round($width * $percentage); \n\t$height = round($height * $percentage); \n}", "function setSize($w=0,$h=0){\r\n $this->width = $w;\r\n $this->heigth=$h;\r\n }", "function scale($scale) {\r\n\t\t$width = $this->getWidth() * $scale/100;\r\n\t\t$height = $this->getheight() * $scale/100;\r\n\t\t$this->resize($width,$height);\r\n\t}", "private function intern_resize($newWidth, $newHeight, $keepRatio = true)\n\t{\n\t\t$this->newOrientation = ($newWidth > $newHeight) ? EImageProcessor::LANDSCAPE : EImageProcessor::PORTRAIT;\n\t\tif ($keepRatio !== true)\n\t\t\t$this->newImage = imagescale($this->srcImage, $newWidth, $newHeight);\n\t\telse {\n\t\t\t/*\n\t\t * Crop-to-fit PHP-GD\n\t\t * http://salman-w.blogspot.com/2009/04/crop-to-fit-image-using-aspphp.html\n\t\t *\n\t\t * Resize and center crop an arbitrary size image to fixed width and height\n\t\t * e.g. convert a large portrait/landscape image to a small square thumbnail\n\t\t *\n\t\t * Modified by Fry\n\t\t\t */\n\t\t\t$desired_aspect_ratio = $newWidth / $newHeight;\n\n\t\t\tif ($this->srcAspectRatio < $desired_aspect_ratio) {\n\t\t\t\t/*\n\t\t\t\t * Triggered when source image is taller\n\t\t\t\t */\n\t\t\t\t$temp_height = $newHeight;\n\t\t\t\t$temp_width = ( int )($newHeight * $this->srcAspectRatio);\n\t\t\t} else {\n\t\t\t\t/*\n\t\t\t\t * Triggered otherwise (i.e. source image is similar or wider)\n\t\t\t\t */\n\t\t\t\t$temp_width = $newWidth;\n\t\t\t\t$temp_height = ( int )($newWidth / $this->srcAspectRatio);\n\t\t\t}\n\n\t\t\t/*\n\t\t\t * Resize the image into a temporary GD image\n\t\t\t */\n\n\t\t\t$tempImage = imagecreatetruecolor($temp_width, $temp_height);\n\t\t\t$transparent = imagecolortransparent($tempImage, imagecolortransparent ($this->srcImage));\n\t\t\timagefill($tempImage, 0, 0, $transparent);\n\t\t\timagecopyresampled(\n\t\t\t\t$tempImage,\n\t\t\t\t$this->srcImage,\n\t\t\t\t0, 0,\n\t\t\t\t0, 0,\n\t\t\t\t$temp_width, $temp_height,\n\t\t\t\t$this->srcWidth, $this->srcHeight\n\t\t\t);\n\n\t\t\t$x0 = ($newWidth - $temp_width ) / 2;\n\t\t\t$y0 = ($newHeight - $temp_height) / 2;\n\n\t\t\t$this->newImage = imagecreatetruecolor($newWidth, $newHeight);\n\t\t\t$transparent = imagecolortransparent($this->newImage, imagecolorallocatealpha($this->newImage, 255, 235, 215, 127));\n\t\t\timagefill($this->newImage, 0, 0, $transparent);\n\t\t\timagecopyresampled(\n\t\t\t\t$this->newImage,\t\t\t$tempImage,\n\t\t\t\t$x0, $y0,\t\t\t\t\t0, 0,\n\t\t\t\t$temp_width, $temp_height, \t$temp_width, $temp_height\n\t\t\t);\n\t\t\timagedestroy($tempImage);\n\t\t}\n\t}", "public function resize($newWidth, $newHeight)\n {\n $imageIn = $this->getWorkingImageResource();\n $imageOut = imagecreatetruecolor($newWidth, $newHeight);\n imagecopyresampled(\n $imageOut, // resource dst_im\n $imageIn, // resource src_im\n 0, // int dst_x\n 0, // int dst_y\n 0, // int src_x\n 0, // int src_y\n $newWidth, // int dst_w\n $newHeight, // int dst_h\n $this->getWorkingImageWidth(), // int src_w\n $this->getWorkingImageHeight() // int src_h\n );\n\n $this->setWorkingImageResource($imageOut);\n }", "function imageResize($width, $height, $target) {\t\n\tif ($width > $height) { \n\t\t$percentage = ($target / $width); \n\t} else { \n\t\t$percentage = ($target / $height); \n\t} \n\n\t//gets the new value and applies the percentage, then rounds the value \n\t$width = round($width * $percentage); \n\t$height = round($height * $percentage); \n\n\t//returns the new sizes in html image tag format...this is so you \n\t//can plug this function inside an image tag and just get the \n\treturn \"width=\\\"$width\\\" height=\\\"$height\\\"\"; \n\t}", "public function resizeToWidth($width) {\n $ratio = $width / $this->getWidth();\n $height = $this->getheight() * $ratio;\n $this->resize($width,$height);\n }", "private function _setMapSize()\n {\n $this->map_obj->setSize($this->image_size[0], $this->image_size[1]);\n if ($this->_isResize()) {\n $this->map_obj->setSize($this->_download_factor*$this->image_size[0], $this->_download_factor*$this->image_size[1]);\n }\n }", "private function makeImageSize(): void\n {\n list($width, $height) = getimagesize($this->getUrl());\n $size = array('height' => $height, 'width' => $width );\n\n $this->width = $size['width'];\n $this->height = $size['height'];\n }", "public static function setSize($path,$target_width=150,$target_height=100) {\n\t\t$img = imagecreatefromjpeg($path);\n\t\tif (!$img) {\n\t\t\techo \"ERROR:could not create image handle \".$path;\n\t\t\texit(0);\n\t\t}\n\t\t$width = imageSX($img);\n\t\t$height = imageSY($img);\n\t\t$size = getimagesize($path);\n\t\tif (!$width || !$height) {\n\t\t\techo \"ERROR:Invalid width or height\";\n\t\t\texit(0);\n\t\t}\n\t\tif ($width > $target_width) {\n\t\t\t$width_ratio = $target_width/$width;\n\t\t}\n\t\telse {\n\t\t\t$width_ratio = 1;\t\n\t\t}\n\t\tif ($height > $target_height) {\n\t\t\t$height_ratio = $target_height/$height;\n\t\t}\n\t\telse {\n\t\t\t$height_ratio = 1;\t\n\t\t}\n\t\tif ($width_ratio==1 && $height_ratio==1) return $img;\n\t\t$ratio = min($width_ratio,$height_ratio);\n\t\t$new_height = $ratio * $height;\n\t\t$new_width = $ratio * $width;\n\t\t//file_put_contents(\"1.log\",\"$new_height = $ratio m $height; $new_width = $ratio m $width;\\n\",FILE_APPEND);\n\t\t$new_img = ImageCreateTrueColor($new_width, $new_height);\n\t\tif (!@imagecopyresampled($new_img, $img, 0, 0, 0, 0, $new_width, $new_height, $width, $height)) {\n\t\t\techo \"ERROR:Could not resize image\";\n\t\t\texit(0);\n\t\t}\t\t\n\t\treturn $new_img;\n\t}", "function imageResize($width, $height, $target){\n //formula accordingly...this is so this script will work\n //dynamically with any size image\n\n if ($width > $height) {\n $percentage = ($target / $width);\n } else {\n $percentage = ($target / $height);\n }\n\n //gets the new value and applies the percentage, then rounds the value\n $width = round($width * $percentage);\n $height = round($height * $percentage);\n\n //returns the new sizes in html image tag format...this is so you\n //\tcan plug this function inside an image tag and just get the\n\n return \"width=\".$width.\" height=\".$height.\"\";\n\n }", "public function resize(IImageInformation $src, $width, $height);", "public function resize($width, $height)\n\t{\n\t\t$wScale = $this->width / $width;\n\t\t$hScale = $this->height / $height;\n\t\t$maxScale = max($wScale, $hScale);\n\t\t// Decrease image dimensions\n\t\tif($maxScale > 1)\n\t\t{\n\t\t\t$width = $this->width / $maxScale;\n\t\t\t$height = $this->height / $maxScale;\n\t\t}\n\t\t// Increase image dimensions\n\t\telse\n\t\t{\n\t\t\t$minScale = min($wScale, $hScale);\n\t\t\t$width = $this->width / $minScale;\n\t\t\t$height = $this->height / $minScale;\n\t\t}\n\t\t$image = imagecreatetruecolor($this->width, $this->height);\n\t\timagecopyresampled($image, $this->image, 0, 0, 0, 0, $width, $height, $this->width, $this->height);\n\n\t\t$this->image = $image;\n\t\t$this->width = $width;\n\t\t$this->height = $height;\n\t}", "function smart_resize_image($file, $width = 0, $height = 0, $proportional = false, $output = \"file\", $delete_original = true, $use_linux_commands = false){\n\t\tif(($height <= 0) && ($width <= 0)){\n\t\t\treturn(false);\n\t\t}\n\t\t$info = getimagesize($file); // Paramètres par défaut de l'image\n\t\t$image = \"\";\n\t\t$final_width = 0;\n\t\t$final_height = 0;\n\t\tlist($width_old,$height_old) = $info;\n\t\t$trop_petite = false;\n\t\tif(($height > 0) && ($height > $height_old)){\n\t\t\t$trop_petite = true;\n\t\t}\n\t\tif(($width > 0) && ( $width > $width_old)){\n\t\t\t$trop_petite = true;\n\t\t}else{\n\t\t\t$trop_petite = false;\n\t\t}\n\t\tif($trop_petite){\n\t\t\treturn(false);\n\t\t}\n\t\tif($proportional){ // Calculer la proportionnalité\n\t\t\tif($width == 0){\n\t\t\t\t$factor = $height / $height_old;\n\t\t\t}elseif($height == 0){\n\t\t\t\t$factor = $width / $width_old;\n\t\t\t}else{\n\t\t\t\t$factor = min($width / $width_old,$height / $height_old);\n\t\t\t}\n\t\t\t$final_width = round($width_old * $factor);\n\t\t\t$final_height = round($height_old * $factor);\n\t\t}else{\n\t\t\t$final_width = ($width <= 0) ? $width_old : $width;\n\t\t\t$final_height = ($height <= 0) ? $height_old : $height;\n\t\t}\n\t\tswitch($info[2]){ // Charger l'image en mémoire en fonction du format\n\t\t\tcase IMAGETYPE_GIF:\n\t\t\t\t$image = imagecreatefromgif($file); break;\n\t\t\tcase IMAGETYPE_JPEG:\n\t\t\t\t$image = imagecreatefromjpeg($file); break;\n\t\t\tcase IMAGETYPE_PNG:\n\t\t\t\t$image = imagecreatefrompng($file); break;\n\t\t\tdefault:\n\t\t\t\treturn(false);\n\t\t}\n\t\t$image_resized = imagecreatetruecolor($final_width, $final_height); // Transparence pour les gif et les png\n\t\tif(($info[2] == IMAGETYPE_GIF) || ($info[2] == IMAGETYPE_PNG)){\n\t\t\t$transparency = imagecolortransparent($image);\n\t\t\tif($transparency >= 0){\n\t\t\t\t$transparent_color = imagecolorsforindex($image,$trnprt_indx);\n\t\t\t\t$transparency = imagecolorallocate($image_resized,$trnprt_color[\"red\"],$trnprt_color[\"green\"],$trnprt_color[\"blue\"]);\n\t\t\t\timagefill($image_resized,0,0,$transparency);\n\t\t\t\timagecolortransparent($image_resized,$transparency);\n\t\t\t}elseif($info[2] == IMAGETYPE_PNG){\n\t\t\t\timagealphablending($image_resized,false);\n\t\t\t\t$color = imagecolorallocatealpha($image_resized,0,0,0,127);\n\t\t\t\timagefill($image_resized,0,0,$color);\n\t\t\t\timagesavealpha($image_resized,true);\n\t\t\t}\n\t\t}\n\t\timagecopyresampled($image_resized,$image,0,0,0,0,$final_width,$final_height,$width_old,$height_old);\n\t\tif($delete_original){ // Suppression de l'image d'origine éventuelle\n\t\t\tif($use_linux_commands){\n\t\t\t\texec(\"rm \".$file);\n\t\t\t}else{\n\t\t\t\t@unlink($file);\n\t\t\t}\n\t\t}\n\t\tswitch(strtolower($output)){\n\t\t\tcase \"browser\": // Envoyer l'image par http avec son type MIME\n\t\t\t\t$mime = image_type_to_mime_type($info[2]); header(\"Content-type: $mime\"); $output = NULL; break;\n\t\t\tcase \"file\": // Ecraser l'image donnée (cas défaut)\n\t\t\t\t$output = $file; break;\n\t\t\tcase \"return\": // Retourner les infos de l'image redimensionnée en conservant celles de l'image d'origine\n\t\t\t\treturn($image_resized); break;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t\tswitch($info[2]){ // Retourner l'image redimensionnée en fonction de son format\n\t\t\tcase IMAGETYPE_GIF:\n\t\t\t\timagegif($image_resized,$output); break;\n\t\t\tcase IMAGETYPE_JPEG:\n\t\t\t\timagejpeg($image_resized,$output); break;\n\t\t\tcase IMAGETYPE_PNG:\n\t\t\t\timagepng($image_resized,$output); break;\n\t\t\tdefault:\n\t\t\t\treturn(false);\n\t\t}\n\t\treturn(true);\n\t}", "function resize_by_width($width){\n\n $ratio = $width / $this->width;\n $height = $this->height * $ratio;\n $this->resize($width, $height);\n\n return true;\n }", "function _resize() {\r\n return null; //PEAR::raiseError(\"No Resize method exists\", true);\r\n }", "public function resize($value) {\n return $this->setProperty('resize', $value);\n }", "static function resize($sourcePath, $newWidth = 100, $newHeight = 100)\n {\n switch (exif_imagetype($sourcePath)) {\n case IMAGETYPE_JPEG :\n $sourceImage = imagecreatefromjpeg($sourcePath);\n break;\n case IMAGETYPE_PNG :\n $sourceImage = imagecreatefrompng($sourcePath);\n break;\n case IMAGETYPE_GIF :\n $sourceImage = imagecreatefromgif($sourcePath);\n break;\n default:\n return;\n }\n\n // Create the new image (still blank/empty)\n $newImage = imagecreatetruecolor($newWidth, $newHeight);\n imagesetinterpolation($newImage, IMG_SINC);\n\n // Determine the source image Dimensions\n $sourceImageWidth = imagesx($sourceImage);\n $sourceImageHeight = imagesy($sourceImage);\n $sourceImageAspectRatio = $sourceImageWidth / $sourceImageHeight;\n $newImageAspectRatio = $newWidth / $newHeight;\n\n // Determine parameters and copy part of the source image into the new image\n if ($newImageAspectRatio >= $sourceImageAspectRatio) { // width is the limiting factor for the source image\n $src_x = 0;\n $src_w = $sourceImageWidth;\n $src_h = $src_w / $newImageAspectRatio;\n $src_y = ($sourceImageHeight - $src_h) / 2;\n } else { // height of source image is limiting factor\n $src_y = 0;\n $src_h = $sourceImageHeight;\n $src_w = $src_h * $newImageAspectRatio;\n $src_x = ($sourceImageWidth - $src_w) / 2;\n }\n\n imagecopyresampled($newImage, $sourceImage, 0, 0, $src_x, $src_y, $newWidth, $newHeight, $src_w, $src_h);\n\n // Save new image to destination path\n switch (exif_imagetype($sourcePath)) {\n case IMAGETYPE_JPEG :\n imagejpeg($newImage, $sourcePath, 100);\n break;\n case IMAGETYPE_PNG :\n imagepng($newImage, $sourcePath);\n break;\n case IMAGETYPE_GIF :\n imagegif($newImage, $sourcePath);\n break;\n }\n\n // Remove image resources to reallocate space\n imagedestroy($sourceImage);\n imagedestroy($newImage);\n }", "function resizetoheight($iNewHeight)\n\t{\n\t\t$iNewWidth = ($iNewHeight / $this->height) * $this->width;\n\n\t\t$this->resize($iNewWidth, $iNewHeight);\n\t}", "function image_resize ( $args ) { /*\r\n\t\t * Changelog\r\n\t\t *\r\n\t\t * Version 3, July 20, 2007\r\n\t\t * - Cleaned\r\n\t\t *\r\n\t\t * Version 2, August 12, 2006\r\n\t\t * - Changed it to use $args\r\n\t\t */\r\n\t\t\r\n\t\t// Set default variables\r\n\t\t$image = $width_old = $height_old = $width_new = $height_new = $canvas_width = $canvas_height = $canvas_size = null;\r\n\t\t\r\n\t\t$x_old = $y_old = $x_new = $y_new = 0;\r\n\t\t\r\n\t\t// Exract user\r\n\t\textract($args);\r\n\t\t\r\n\t\t// Read image\r\n\t\t$image = image_read($image,false);\r\n\t\tif ( empty($image) ) { // error\r\n\t\t\ttrigger_error('no image was specified', E_USER_WARNING);\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\t// Check new dimensions\r\n\t\tif ( empty($width_new) || empty($height_new) ) { // error\r\n\t\t\ttrigger_error('Desired/new dimensions not found', E_USER_WARNING);\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\t// Do old dimensions\r\n\t\tif ( empty($width_old) && empty($height_old) ) { // Get the old dimensions from the image\r\n\t\t\t$width_old = imagesx($image);\r\n\t\t\t$height_old = imagesy($image);\r\n\t\t}\r\n\t\t\r\n\t\t// Do canvas dimensions\r\n\t\tif ( empty($canvas_width) && empty($canvas_height) ) { // Set default\r\n\t\t\t$canvas_width = $width_new;\r\n\t\t\t$canvas_height = $height_new;\r\n\t\t}\r\n\t\t\r\n\t\t// Let's force integer values\r\n\t\t$width_old = intval($width_old);\r\n\t\t$height_old = intval($height_old);\r\n\t\t$width_new = intval($width_new);\r\n\t\t$height_new = intval($height_new);\r\n\t\t$canvas_width = intval($canvas_width);\r\n\t\t$canvas_height = intval($canvas_height);\r\n\t\t\r\n\t\t// Create the new image\r\n\t\t$image_new = imagecreatetruecolor($canvas_width, $canvas_height);\r\n\t\t\r\n\t\t// Resample the image\r\n\t\t$image_result = imagecopyresampled(\r\n\t\t\t/* the new image */\r\n\t\t\t$image_new,\r\n\t\t\t/* the old image to update */\r\n\t\t\t$image,\r\n\t\t\t/* the new positions */\r\n\t\t\t$x_new, $y_new,\r\n\t\t\t/* the old positions */\r\n\t\t\t$x_old, $y_old,\r\n\t\t\t/* the new dimensions */\r\n\t\t\t$width_new, $height_new,\r\n\t\t\t/* the old dimensions */\r\n\t\t\t$width_old, $height_old);\r\n\t\t\r\n\t\t// Check\r\n\t\tif ( !$image_result ) { // ERROR\r\n\t\t\ttrigger_error('the image failed to resample', E_USER_WARNING);\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\t// return\r\n\t\treturn $image_new;\r\n\t}", "public function reseize($path, $source, $width, $height, $nama_ori){\n \t//$source = sumber gambar yang akan di reseize\n $config['image_library'] = 'gd2';\n $config['source_image'] = $source;\n $config['new_image'] = $path.$width.'_'.$nama_ori;\n $config['overwrite'] = TRUE;\n $config['create_thumb'] = false;\n $config['width'] = $width;\n if($height>0){\n \t$config['maintain_ratio'] = false;\n \t$config['height'] = $height;\n }else{\n \t$config['maintain_ratio'] = true;\n }\n\n $this->image_lib->initialize($config);\n\n $this->image_lib->resize();\n $this->image_lib->clear();\n }", "function image_resize()\n\t{\n\t\t$protocol = 'image_process_'.$this->resize_protocol;\n\t\t\n\t\tif (substr($protocol, -3) == 'gd2')\n\t\t{\n\t\t\t$protocol = 'image_process_gd';\n\t\t}\n\t\t\n\t\treturn $this->$protocol('resize');\n\t}", "public function resize($width, $height, $type='regular')\n\t{\n\t\t$type = in_array($type, array('crop', 'regular') )?$type:'regular';\n\t\t\n\t\t// if both sizes are auto or the type is crop and either size is auto then do nothing\n\t\tif( (preg_match('/^(auto|nochange)$/', $width) && preg_match('/^(auto|nochange)$/', $height) ) || ( $type == 'crop' && ($width == 'auto' || $height == 'auto') ) )\n\t\t\treturn false;\n\t\t\n\t\t// if both sizes are not within constrained type limits then do nothing\n\t\t// they should be either 'auto', 'nochange', a % value, or an integer representing the pixel dimensions\n\t\tif(!preg_match('/^(auto|nochange|(\\d+)%?)$/', $width) && preg_match('/^(auto|nochange|(\\d+)%?)$/', $height) )\n\t\t\treturn false;\n\t\t\n\t\t// some types of resize also require a cropping action too so switch between them here\n\t\tswitch($type)\n\t\t{\n\t\t\tcase 'regular':\n\t\t\t{\n\t\t\t\t// determine the new width\n\t\t\t\tif($width == 'auto')\n\t\t\t\t{\n\t\t\t\t\tif(is_numeric($height))\n\t\t\t\t\t\t$width = (int)(intval($height) / $this->height * $this->width);\n\t\t\t\t\telse\n\t\t\t\t\t\t$width = $this->set_dimension($this->width, $height);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\t$width = $this->set_dimension($this->width, $width);\n\t\t\t\t\n\t\t\t\t// determine the new height\n\t\t\t\tif($height == 'auto')\n\t\t\t\t{\n\t\t\t\t\tif(is_numeric($width))\n\t\t\t\t\t\t$height = (int)(intval($width) / $this->width * $this->height);\n\t\t\t\t\telse\n\t\t\t\t\t\t$height = $this->set_dimension($this->height, $width);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\t$height = $this->set_dimension($this->height, $height);\n\n\t\t\t\t$image_p = imagecreatetruecolor($width, $height);\n\t\t\t\treturn (imagecopyresampled($image_p, $this->image, 0, 0, 0, 0, $width, $height, $this->width, $this->height) && $this->image = $image_p);\n\t\t\t\t\n\t\t\t\tbreak;\n\t\t\t}//end case\n\t\t\tcase 'crop':\n\t\t\t{\n\t\t\t\t$width = $this->set_dimension($this->width, $width);\n\t\t\t\t$height = $this->set_dimension($this->height, $height);\n\n\t\t\t\tif(($width / $height) < ($this->width / $this->height))\n\t\t\t\t{\n\t\t\t\t\t// landscape\n\t\t\t\t\t$ratio = $width / $height;\n\t\t\t\t\t$image_p = imagecreatetruecolor($width, $height);\n\t\t\t\t\t\n\t\t\t\t\timagecopyresampled(\n\t\t\t\t\t\t$image_p, // dst_im\n\t\t\t\t\t\t$this->image, // src_im\n\t\t\t\t\t\t0, // dst_x\n\t\t\t\t\t\t0, // dst_y\n\t\t\t\t\t\t($this->width / 2) - ($this->height * $ratio) / 2, // src_x\n\t\t\t\t\t\t0, // src_y\n\t\t\t\t\t\t$width, // dst_w\n\t\t\t\t\t\t$height, // dst_h\n\t\t\t\t\t\t$this->height * $ratio, // src_w\n\t\t\t\t\t\t$this->height // src_h\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t// portrait\n\t\t\t\t\t$ratio = $height / $width;\n\t\t\t\t\t$image_p = imagecreatetruecolor($width, $height);\n\t\t\t\t\t\n\t\t\t\t\timagecopyresampled(\n\t\t\t\t\t\t$image_p, // dst_im\n\t\t\t\t\t\t$this->image, // src_im\n\t\t\t\t\t\t0, // dst_x\n\t\t\t\t\t\t0, // dst_y\n\t\t\t\t\t\t0, // src_x\n\t\t\t\t\t\t0, // src_y\n\t\t\t\t\t\t$width, // dst_w\n\t\t\t\t\t\t$height, // dst_h\n\t\t\t\t\t\t$this->width, // src_w\n\t\t\t\t\t\t$this->width * $ratio // src_h\n\t\t\t\t\t);\n\t\t\t\t}//end if\n\t\t\t\treturn ($this->image = $image_p);\n\t\t\t\t\n\t\t\t\tbreak;\n\t\t\t}//end case\n\t\t}//end switch\n\t}", "public static function setMinSize(int $width, int $height) {}", "public function resize_crop($newWidth, $newHeight)\n\t{\n\t\t$this->intern_resize_crop($newWidth, $newHeight);\n\t}", "function image_resize($filename){\n\t\t$width = 1000;\n\t\t$height = 500;\n\t\t$save_file_location = $filename;\n\t\t// File type\n\t\t//header('Content-Type: image/jpg');\n\t\t$source_properties = getimagesize($filename);\n\t\t$image_type = $source_properties[2];\n\n\t\t// Get new dimensions\n\t\tlist($width_orig, $height_orig) = getimagesize($filename);\n\n\t\t$ratio_orig = $width_orig/$height_orig;\n\t\tif ($width/$height > $ratio_orig) {\n\t\t\t$width = $height*$ratio_orig;\n\t\t} else {\n\t\t\t$height = $width/$ratio_orig;\n\t\t}\n\t\t// Resampling the image \n\t\t$image_p = imagecreatetruecolor($width, $height);\n\t\tif( $image_type == IMAGETYPE_JPEG ) {\n\t\t\t$image = imagecreatefromjpeg($filename);\n\t\t}else if($image_type == IMAGETYPE_GIF){\n\t\t\t$image = imagecreatefromgif($filename);\n\t\t}else if($image_type == IMAGETYPE_PNG){\n\t\t\t$image = imagecreatefrompng($filename);\n\t\t}\n\t\t$finalIMG = imagecopyresampled($image_p, $image, 0, 0, 0, 0,\n\t\t$width, $height, $width_orig, $height_orig);\n\t\t// Display of output image\n\n\t\tif( $image_type == IMAGETYPE_JPEG ) {\n\t\t\timagejpeg($image_p, $save_file_location);\n\t\t}else if($image_type == IMAGETYPE_GIF){\n\t\t\timagegif($image_p, $save_file_location);\n\t\t}else if($image_type == IMAGETYPE_PNG){\n\t\t\t$imagepng = imagepng($image_p, $save_file_location);\n\t\t}\n\t}", "public function getResize()\n {\n $ratio = 1.0;\n $image = Input::get('img');\n $dir = Input::get('dir');\n\n $original_width = Image::make(base_path() . \"/\" . Config::get('lfm.images_dir') . $dir . \"/\" . $image)->width();\n $original_height = Image::make(base_path() . \"/\" . Config::get('lfm.images_dir') . $dir . \"/\" . $image)->height();\n\n $scaled = false;\n\n if ($original_width > 600)\n {\n $ratio = 600 / $original_width;\n $width = $original_width * $ratio;\n $height = $original_height * $ratio;\n $scaled = true;\n } else\n {\n $height = $original_height;\n $width = $original_width;\n }\n\n if ($height > 400)\n {\n $ratio = 400 / $original_height;\n $width = $original_width * $ratio;\n $height = $original_height * $ratio;\n $scaled = true;\n }\n\n return View::make('laravel-filemanager::resize')\n ->with('img', Config::get('lfm.images_url') . $dir . \"/\" . $image)\n ->with('dir', $dir)\n ->with('image', $image)\n ->with('height', number_format($height, 0))\n ->with('width', $width)\n ->with('original_height', $original_height)\n ->with('original_width', $original_width)\n ->with('scaled', $scaled)\n ->with('ratio', $ratio);\n }", "public function resize_square($side)\n\t{\n\t\tif ($this->srcOrientation == EImageProcessor::LANDSCAPE)\n\t\t\t$this->intern_resize_width($side, $side);\n\t\telse\n\t\t\t$this->intern_resize_height($side, $side);\n\t}", "public function _set_new_size_auto()\n {\n if (empty($this->source_width) || empty($this->source_height)) {\n if ( ! $this->SILENT_MODE) {\n trigger_error('Missing source image sizes!', E_USER_WARNING);\n }\n return false;\n }\n $k1 = $this->source_width / $this->limit_x;\n $k2 = $this->source_height / $this->limit_y;\n $k = $k1 >= $k2 ? $k1 : $k2;\n if ($this->reduce_only && $k1 <= 1 && $k2 <= 1) {\n $this->output_width = $this->source_width;\n $this->output_height = $this->source_height;\n } else {\n $this->output_width = round($this->source_width / $k, 0);\n $this->output_height = round($this->source_height / $k, 0);\n }\n return true;\n }", "function image_resize_dimensions($orig_w, $orig_h, $dest_w, $dest_h, $crop = \\false)\n {\n }", "public function resize_fit(IImageInformation $src, $width, $height);", "public function CalcWidthHeight()\n {\n list($this->width, $this->height) = $this->imgInfo;\n\n $aspectRatio = $this->width / $this->height;\n\n if($this->cropToFit && $this->newWidth && $this->newHeight) {\n $targetRatio = $this->newWidth / $this->newHeight;\n $this->cropWidth = $targetRatio > $aspectRatio ? $this->width : round($this->height * $targetRatio);\n $this->cropHeight = $targetRatio > $aspectRatio ? round($this->width / $targetRatio) : $this->height;\n if($this->verbose) { self::verbose(\"Crop to fit into box of {$this->newWidth}x{$this->newHeight}. Cropping dimensions: {$this->cropWidth}x{$this->cropHeight}.\"); }\n }\n else if($this->newWidth && !$this->newHeight) {\n $this->newHeight = round($this->newWidth / $aspectRatio);\n if($this->verbose) { self::verbose(\"New width is known {$this->newWidth}, height is calculated to {$this->newHeight}.\"); }\n }\n else if(!$this->newWidth && $this->newHeight) {\n $this->newWidth = round($this->newHeight * $aspectRatio);\n if($this->verbose) { self::verbose(\"New height is known {$this->newHeight}, width is calculated to {$this->newWidth}.\"); }\n }\n else if($this->newWidth && $this->newHeight) {\n $ratioWidth = $this->width / $this->newWidth;\n $ratioHeight = $this->height / $this->newHeight;\n $ratio = ($ratioWidth > $ratioHeight) ? $ratioWidth : $ratioHeight;\n $this->newWidth = round($this->width / $ratio);\n $this->newHeight = round($this->height / $ratio);\n if($this->verbose) { self::verbose(\"New width & height is requested, keeping aspect ratio results in {$this->newWidth}x{$this->newHeight}.\"); }\n }\n else {\n $this->newWidth = $this->width;\n $this->newHeight = $this->height;\n if($this->verbose) { self::verbose(\"Keeping original width & heigth.\"); }\n }\n }", "private function setDimensions(){\r\n list($width, $height) = getimagesize($this->fileName);\r\n $this->imageDimensions = array('width'=>$width,\r\n 'height'=>$height);\r\n \r\n }", "public function resize($width,$height) {\n\t\t$this->scaleImage($width,$height);\n\t\treturn $this;\n\t}", "private function __setOptimalSizeByLandscape() {\n \n $ratio = $this->__originalImageHeight / $this->__originalImageWidth;\n $newHeight = $this->__requestedWidth * $ratio;\n \n $this->__optimalWidth = $this->__requestedWidth;\n $this->__optimalHeight = $newHeight;\n \n }", "public function refreshDimensions()\n {\n if ('\\\\' === DIRECTORY_SEPARATOR) {\n if (preg_match('/^(\\d+)x(\\d+)(?: \\((\\d+)x(\\d+)\\))?$/', trim(getenv('ANSICON')), $matches)) {\n // extract [w, H] from \"wxh (WxH)\"\n // or [w, h] from \"wxh\"\n $this->width = (int) $matches[1];\n $this->height = isset($matches[4]) ? (int) $matches[4] : (int) $matches[2];\n } elseif (null !== $dimensions = $this->getConsoleMode()) {\n // extract [w, h] from \"wxh\"\n $this->width = (int) $dimensions[0];\n $this->height = (int) $dimensions[1];\n }\n } elseif ($sttyString = $this->getSttyColumns()) {\n if (preg_match('/rows.(\\d+);.columns.(\\d+);/i', $sttyString, $matches)) {\n // extract [w, h] from \"rows h; columns w;\"\n $this->width = (int) $matches[2];\n $this->height = (int) $matches[1];\n } elseif (preg_match('/;.(\\d+).rows;.(\\d+).columns/i', $sttyString, $matches)) {\n // extract [w, h] from \"; h rows; w columns\"\n $this->width = (int) $matches[2];\n $this->height = (int) $matches[1];\n }\n }\n $this->initialised = true;\n }", "function _image_get_preview_ratio($w, $h)\n {\n }", "protected function SetGridDimensions()\n {\n $this->g_height = $this->height - $this->pad_top - $this->pad_bottom;\n $this->g_width = $this->width - $this->pad_left - $this->pad_right;\n }", "public function test_resize() {\n\t\t$file = DIR_TESTDATA . '/images/waffles.jpg';\n\n\t\t$imagick_image_editor = new WP_Image_Editor_Imagick( $file );\n\t\t$imagick_image_editor->load();\n\n\t\t$imagick_image_editor->resize( 100, 50 );\n\n\t\t$this->assertSame(\n\t\t\tarray(\n\t\t\t\t'width' => 75,\n\t\t\t\t'height' => 50,\n\t\t\t),\n\t\t\t$imagick_image_editor->get_size()\n\t\t);\n\t}", "private function intern_resize_crop($newWidth, $newHeight)\n\t{\n\t\t/*\n\t\t * Crop-to-fit PHP-GD\n\t\t * http://salman-w.blogspot.com/2009/04/crop-to-fit-image-using-aspphp.html\n\t\t *\n\t\t * Resize and center crop an arbitrary size image to fixed width and height\n\t\t * e.g. convert a large portrait/landscape image to a small square thumbnail\n\t\t *\n\t\t * Modified by Fry\n\t\t */\n\t\t$desired_aspect_ratio = $newWidth / $newHeight;\n\n\t\tif ($this->srcAspectRatio > $desired_aspect_ratio) {\n\t\t\t/*\n\t\t\t * Triggered when source image is wider\n\t\t\t */\n\t\t\t$temp_height = $newHeight;\n\t\t\t$temp_width = ( int ) ($newHeight * $this->srcAspectRatio);\n\t\t} else {\n\t\t\t/*\n\t\t\t * Triggered otherwise (i.e. source image is similar or taller)\n\t\t\t */\n\t\t\t$temp_width = $newWidth;\n\t\t\t$temp_height = ( int ) ($newWidth / $this->srcAspectRatio);\n\t\t}\n\n\t\t/*\n\t\t * Resize the image into a temporary GD image\n\t\t */\n\n\t\t$tempImage = imagecreatetruecolor($temp_width, $temp_height);\n\t\timagecopyresampled(\n\t\t\t$tempImage,\t\t\t\t\t$this->srcImage,\n\t\t\t0, 0,\t\t\t0, 0,\n\t\t\t$temp_width, $temp_height,\t$this->srcWidth, $this->srcHeight\n\t\t);\n\n\t\t/*\n\t\t * Copy cropped region from temporary image into the desired GD image\n\t\t */\n\n\t\t$x0 = ($temp_width - $newWidth) / 2;\n\t\t$y0 = ($temp_height - $newHeight) / 2;\n\t\t$this->newImage = imagecreatetruecolor($newWidth, $newHeight);\n\t\timagecopy(\n\t\t\t$this->newImage,\t$tempImage,\n\t\t\t0, 0,\t$x0, $y0,\n\t\t\t$newWidth, $newHeight\n\t\t);\n\t\timagedestroy($tempImage);\n\t}", "function resizetopercentage($iPercentage)\n\t{\n\t\t$iPercentageMultiplier = $iPercentage / 100;\n\t\t$iNewWidth = $this->width * $iPercentageMultiplier;\n\t\t$iNewHeight = $this->height * $iPercentageMultiplier;\n\n\t\t$this->resize($iNewWidth, $iNewHeight);\n\t}", "public function size()\n { \n $props = $this->uri->ruri_to_assoc();\n\n if (!isset($props['o'])) exit(0);\n $w = -1;\n $h = -1;\n $m = 0;\n if (isset($props['w'])) $w = $props['w'];\n if (isset($props['h'])) $h = $props['h'];\n if (isset($props['m'])) $m = $props['m'];\n\n $this->img->set_img($props['o']);\n $this->img->set_size($w, $h, $m);\n $this->img->set_square($m);\n $this->img->get_img();\n }", "public function resize(float $ratio): void\n {\n $this->side = bcmul($ratio, $this->side, $this->scale);\n }", "private function intern_resize_width($newWidth, $newHeight = null, $keepRatio = true)\n\t{\n\t\tif ($newHeight == null)\n\t\t\t$this->newImage = imagescale($this->srcImage, $newWidth);\n\t\telse\n\t\t\t$this->intern_resize($newWidth, $newHeight, $keepRatio);\n\t}", "function resizer($image_file_name,$desc_location=null,$new_width=null,$new_height=null,$min_size=null,$show_image=true)\n\t{\n\t list($width, $height) = @getimagesize($image_file_name);\n\t if (empty($width) or empty($height)) {return false;}\n\n\t if (!is_null($min_size)) {\n\t if (is_null($min_size)) {$min_size=$new_width;}\n\t if (is_null($min_size)) {$min_size=$new_height;}\n\n\t if ($width>$height) {$new_height=$min_size;$new_width=null;}\n\t else {$new_width=$min_size;$new_height=null;}\n\t }\n\n\t// $my_new_height=$new_height;\n\t if (is_null($new_height) and !is_null($new_width))\n\t { $my_new_height=round($height*$new_width/$width);$my_new_width=$new_width; }\n\t elseif (!is_null($new_height))\n\t { $my_new_width=round($width*$new_height/$height);$my_new_height=$new_height; }\n\t//echo \"$my_new_width, $my_new_height <br/>\";\n\t $image_resized = imagecreatetruecolor($my_new_width, $my_new_height);\n\t $image = imagecreatefromjpeg($image_file_name);\n\t imagecopyresampled($image_resized, $image, 0, 0, 0, 0, $my_new_width, $my_new_height, $width, $height);\n\n\t //--(BEGIN)-->save , show or send image pointer as result\n\t if (!is_null($desc_location))\n\t imagejpeg($image_resized, $desc_location,100);\n\t elseif ($show_image==true)\n\t imagejpeg($image_resized);\n\t return $image_resized;\n\t //--(END)-->save , show or send image pointer as result\n\t}", "public function resizeWindow()\n {\n try {\n $windowSize = $this->getWindowSize();\n $this->getSession()->resizeWindow($windowSize['width'], $windowSize['height']);\n } catch (UnsupportedDriverActionException $e) {\n // Need this for unsupported drivers\n }\n }", "function resize_fit_or_smaller($width, $height) {\n\n\t\t$w = $this->getWidth();\n\t\t$h = $this->getHeight();\n\n\t\t$ratio = $width / $w;\n\t\tif (($h*$ratio)>$height)\n\t\t\t$ratio = $height / $h;\n\t\t\n\t\t$h *= $ratio;\n\t\t$w *= $ratio;\n\n\t\t$this->resize($w, $h);\n\t}", "function resize( $jpg ) {\n\t$im = @imagecreatefromjpeg( $jpg );\n\t$filename = $jpg;\n\t$percent = 0.5;\n\tlist( $width, $height ) = getimagesize( $filename );\n\tif ( $uploader_name == \"c_master_imgs\" ):\n\t\t$new_width = $width;\n\t$new_height = $height;\n\telse :\n\t\tif ( $width > 699 ): $new_width = 699;\n\t$percent = 699 / $width;\n\t$new_height = $height * $percent;\n\telse :\n\t\t$new_width = $width;\n\t$new_height = $height;\n\tendif;\n\tendif; // end if measter images do not resize\n\t//if ( $new_height>600){ $new_height = 600; }\n\t$im = imagecreatetruecolor( $new_width, $new_height );\n\t$image = imagecreatefromjpeg( $filename );\n\timagecopyresampled( $im, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height );\n\t@imagejpeg( $im, $jpg, 80 );\n\t@imagedestroy( $im );\n}", "function spc_resizeImage( $file, $thumbpath, $max_side , $fixfor = NULL ) {\n\n\tif ( file_exists( $file ) ) {\n\t\t$type = getimagesize( $file );\n\n\t\tif (!function_exists( 'imagegif' ) && $type[2] == 1 ) {\n\t\t\t$error = __( 'Filetype not supported. Thumbnail not created.' );\n\t\t}\n\t\telseif (!function_exists( 'imagejpeg' ) && $type[2] == 2 ) {\n\t\t\t$error = __( 'Filetype not supported. Thumbnail not created.' );\n\t\t}\n\t\telseif (!function_exists( 'imagepng' ) && $type[2] == 3 ) {\n\t\t\t$error = __( 'Filetype not supported. Thumbnail not created.' );\n\t\t} else {\n\n\t\t\t// create the initial copy from the original file\n\t\t\tif ( $type[2] == 1 ) {\n\t\t\t\t$image = imagecreatefromgif( $file );\n\t\t\t}\n\t\t\telseif ( $type[2] == 2 ) {\n\t\t\t\t$image = imagecreatefromjpeg( $file );\n\t\t\t}\n\t\t\telseif ( $type[2] == 3 ) {\n\t\t\t\t$image = imagecreatefrompng( $file );\n\t\t\t}\n\n\t\t\tif ( function_exists( 'imageantialias' ))\n\t\t\t\timageantialias( $image, TRUE );\n\n\t\t\t$image_attr = getimagesize( $file );\n\n\t\t\t// figure out the longest side\n if($fixfor){\n \t if($fixfor == 'width'){\n \t \t$image_width = $image_attr[0];\n\t\t\t\t$image_height = $image_attr[1];\n\t\t\t\t$image_new_width = $max_side;\n\n\t\t\t\t$image_ratio = $image_width / $image_new_width;\n\t\t\t\t$image_new_height = $image_height / $image_ratio;\n \t }elseif($fixfor == 'height'){\n \t $image_width = $image_attr[0];\n\t\t\t\t$image_height = $image_attr[1];\n\t\t\t\t$image_new_height = $max_side;\n\n\t\t\t\t$image_ratio = $image_height / $image_new_height;\n\t\t\t\t$image_new_width = $image_width / $image_ratio;\t\n \t }\n }else{\n\t\t\tif ( $image_attr[0] > $image_attr[1] ) {\n\t\t\t\t$image_width = $image_attr[0];\n\t\t\t\t$image_height = $image_attr[1];\n\t\t\t\t$image_new_width = $max_side;\n\n\t\t\t\t$image_ratio = $image_width / $image_new_width;\n\t\t\t\t$image_new_height = $image_height / $image_ratio;\n\t\t\t\t//width is > height\n\t\t\t} else {\n\t\t\t\t$image_width = $image_attr[0];\n\t\t\t\t$image_height = $image_attr[1];\n\t\t\t\t$image_new_height = $max_side;\n\n\t\t\t\t$image_ratio = $image_height / $image_new_height;\n\t\t\t\t$image_new_width = $image_width / $image_ratio;\n\t\t\t\t//height > width\n\t\t\t}\n }\t\n\n\t\t\t$thumbnail = imagecreatetruecolor( $image_new_width, $image_new_height);\n\t\t\t@ imagecopyresampled( $thumbnail, $image, 0, 0, 0, 0, $image_new_width, $image_new_height, $image_attr[0], $image_attr[1] );\n\n\t\t\t// move the thumbnail to its final destination\n\t\t\tif ( $type[2] == 1 ) {\n\t\t\t\tif (!imagegif( $thumbnail, $thumbpath ) ) {\n\t\t\t\t\t$error = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\telseif ( $type[2] == 2 ) {\n\t\t\t\tif (!imagejpeg( $thumbnail, $thumbpath ) ) {\n\t\t\t\t\t$error = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\telseif ( $type[2] == 3 ) {\n\t\t\t\tif (!imagepng( $thumbnail, $thumbpath ) ) {\n\t\t\t\t\t$error = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else {\n\t\t$error = 0;\n\t}\n\n\tif (!empty ( $error ) ) {\n\t\treturn $error;\n\t} else {\n\t\treturn $thumbpath;\n\t}\n}", "function resize( $width, $height ) {\n $new_image = imagecreatetruecolor( $width, $height );\n if ( $this->mimetype == 'image/gif' || $this->mimetype == 'image/png' ) {\n $current_transparent = imagecolortransparent( $this->image );\n if ( $current_transparent != -1 ) {\n $transparent_color = imagecolorsforindex( $this->image, $current_transparent );\n $current_transparent = imagecolorallocate( $new_image, $transparent_color['red'], $transparent_color['green'], $transparent_color['blue'] );\n imagefill( $new_image, 0, 0, $current_transparent );\n imagecolortransparent( $new_image, $current_transparent );\n } elseif ( $this->mimetype == 'image/png' ) {\n imagealphablending( $new_image, false );\n $color = imagecolorallocatealpha( $new_image, 0, 0, 0, 127 );\n imagefill( $new_image, 0, 0, $color );\n imagesavealpha( $new_image, true );\n }\n }\n imagecopyresampled( $new_image, $this->image, 0, 0, 0, 0, $width, $height, $this->width, $this->height );\n $this->image = $new_image;\n return $this;\n }", "private static function resize_image($source, $width, $height){\n\t\t$source_width = imagesx($source);\n\t\t$source_height = imagesy($source);\n\t\t$source_aspect = round($source_width / $source_height, 1);\n\t\t$target_aspect = round($width / $height, 1);\n\t\n\t\t$resized = imagecreatetruecolor($width, $height);\n\t\n\t\tif ($source_aspect < $target_aspect){\n\t\t\t// higher\n\t\t\t$new_size = array($width, ($width / $source_width) * $source_height);\n\t\t\t$source_pos = array(0, (($new_size[1] - $height) * ($source_height / $new_size[1])) / 2);\n\t\t}else if ($source_aspect > $target_aspect){\n\t\t\t// wider\n\t\t\t$new_size = array(($height / $source_height) * $source_width, $height);\n\t\t\t$source_pos = array((($new_size[0] - $width) * ($source_width / $new_size[0])) / 2, 0);\n\t\t}else{\n\t\t\t// same shape\n\t\t\t$new_size = array($width, $height);\n\t\t\t$source_pos = array(0, 0);\n\t\t}\n\t\n\t\tif ($new_size[0] < 1) $new_size[0] = 1;\n\t\tif ($new_size[1] < 1) $new_size[1] = 1;\n\t\n\t\timagecopyresampled($resized, $source, 0, 0, $source_pos[0], $source_pos[1], $new_size[0], $new_size[1], $source_width, $source_height);\n\t\n\t\treturn $resized;\n\t}", "public function resize($file, $size, $height, $name, $path)\n {\n\n if (!is_dir($path . '/'))\n if (!mkdir($path, 0777)) ;\n\n $array = explode('.', $name);\n $ext = strtolower(end($array));\n\n switch (strtolower($ext)) {\n\n case \"gif\":\n $out = imagecreatefromgif($file);\n break;\n\n case \"jpg\":\n $out = imagecreatefromjpeg($file);\n break;\n\n case \"jpeg\":\n $out = imagecreatefromjpeg($file);\n break;\n\n case \"png\":\n $out = imagecreatefrompng($file);\n break;\n }\n\n $src_w = imagesx($out);\n $src_h = imagesy($out);\n\n if ($src_w > $size || $src_h > $height) {\n\n if ($src_w > $size) {\n\n $dst_w = $size;\n $dst_h = floor($src_h / ($src_w / $size));\n\n\n $img_out = imagecreatetruecolor($dst_w, $dst_h);\n imagecopyresampled($img_out, $out, 0, 0, 0, 0, $dst_w, $dst_h, $src_w, $src_h);\n\n switch (strtolower($ext)) {\n case \"gif\":\n imagegif($img_out, $path . $name);\n break;\n case \"jpg\":\n imagejpeg($img_out, $path . $name, 100);\n break;\n case \"jpeg\":\n imagejpeg($img_out, $path . $name, 100);\n break;\n case \"png\":\n imagepng($img_out, $path . $name);\n break;\n }\n\n } else if ($src_h > $height) {\n\n $dst_h = $height;\n $dst_w = floor($src_w / ($src_h / $height));\n\n if ($dst_w > $size) {\n\n $dst_w = $size;\n $dst_h = floor($src_h / ($src_w / $size));\n\n }\n\n\n $img_out = imagecreatetruecolor($dst_w, $dst_h);\n imagecopyresampled($img_out, $out, 0, 0, 0, 0, $dst_w, $dst_h, $src_w, $src_h);\n\n switch (strtolower($ext)) {\n case \"gif\":\n imagegif($img_out, $path . $name);\n break;\n case \"jpg\":\n imagejpeg($img_out, $path . $name, 100);\n break;\n case \"jpeg\":\n imagejpeg($img_out, $path . $name, 100);\n break;\n case \"png\":\n imagepng($img_out, $path . $name);\n break;\n }\n\n }\n\n $array = explode('.', $name);\n $ext = strtolower(end($array));\n\n switch (strtolower($ext)) {\n\n case \"gif\":\n $out = imagecreatefromgif($path . $name);\n break;\n\n case \"jpg\":\n $out = imagecreatefromjpeg($path . $name);\n break;\n\n case \"jpeg\":\n $out = imagecreatefromjpeg($path . $name);\n break;\n\n case \"png\":\n $out = imagecreatefrompng($path . $name);\n break;\n }\n\n $src_w = imagesx($out);\n $src_h = imagesy($out);\n\n if ($src_h > $height) {\n\n $dst_h = $height;\n $dst_w = floor($src_w / ($src_h / $height));\n\n if ($dst_w > $size) {\n\n $dst_w = $size;\n $dst_h = floor($src_h / ($src_w / $size));\n\n }\n\n $img_out = imagecreatetruecolor($dst_w, $dst_h);\n imagecopyresampled($img_out, $out, 0, 0, 0, 0, $dst_w, $dst_h, $src_w, $src_h);\n\n switch (strtolower($ext)) {\n case \"gif\":\n imagegif($img_out, $path . $name);\n break;\n case \"jpg\":\n imagejpeg($img_out, $path . $name, 100);\n break;\n case \"jpeg\":\n imagejpeg($img_out, $path . $name, 100);\n break;\n case \"png\":\n imagepng($img_out, $path . $name);\n break;\n }\n\n }\n\n } else {\n\n copy($file, $path . $name);\n\n }\n\n\n }", "public function shrink($width = 0, $height = 0, $enlarge=false) {\n\n //if ($scale > 1) {\n // $scale = 1;\n //}\n\n //$this->resizeWithScale($this->info['width'] * $scale, $this->info['height'] * $scale, $scale);\n //$this->resizeWithScaleExact($width, $height, 1);\n\n //$this->resizeWithScale($width, $height, $scale);\n\n\t\t//$scale=$width/$height;\n //$this->resizeWithScale($this->info['width'] * $scale, $this->info['height'] * $scale, $scale);\n\n\t\t$s_ratio = $this->info['width']/$this->info['height'];\n\t\t$d_ratio = $width/$height;\n\n if ( $s_ratio > $d_ratio )\n {\n $cwidth = $this->info['width'];\n $cheight = round($this->info['width']*(1/$d_ratio));\n }\n elseif( $s_ratio < $d_ratio )\n {\n $cwidth = round($this->info['height']*$d_ratio);\n $cheight = $this->info['height'];\n }\n else\n {\n $cwidth = $this->info['width'];\n $cheight = $this->info['height'];\n }\n\n\t\tif ( ($this->info['width']<=$width) && ($this->info['height']<=$height) && !$enlarge )\n\t\t{\n\t\t\t$this->resizeWithScaleExact($cwidth, $cheight, 1);\n\t\t}\n\t\telse\n\t\t{\n\t $this->resizeWithScaleExact($width, $height, 1);\n\t\t}\n }", "function resize_image($src, $width, $height){\n // initializing\n $save_path = Wordless::theme_temp_path();\n $img_filename = Wordless::join_paths($save_path, md5($width . 'x' . $height . '_' . basename($src)) . '.jpg');\n\n // if file doesn't exists, create it\n if (!file_exists($img_filename)) {\n $to_scale = 0;\n $to_crop = 0;\n\n // Get orig dimensions\n list ($width_orig, $height_orig, $type_orig) = getimagesize($src);\n\n // get original image ... to improve!\n switch($type_orig){\n case IMAGETYPE_JPEG: $image = imagecreatefromjpeg($src);\n break;\n case IMAGETYPE_PNG: $image = imagecreatefrompng($src);\n break;\n case IMAGETYPE_GIF: $image = imagecreatefromgif($src);\n break;\n default:\n return;\n }\n\n // which is the new smallest?\n if ($width < $height)\n $min_dim = $width;\n else\n $min_dim = $height;\n\n // which is the orig smallest?\n if ($width_orig < $height_orig)\n $min_orig = $width_orig;\n else\n $min_orig = $height_orig;\n\n // image of the right size\n if ($height_orig == $height && $width_orig == $width) ; // nothing to do\n // if something smaller => scale\n else if ($width_orig < $width) {\n $to_scale = 1;\n $ratio = $width / $width_orig;\n }\n else if ($height_orig < $height) {\n $to_scale = 1;\n $ratio = $height / $height_orig;\n }\n // if both bigger => scale\n else if ($height_orig > $height && $width_orig > $width) {\n $to_scale = 1;\n $ratio_dest = $width / $height;\n $ratio_orig = $width_orig / $height_orig;\n if ($ratio_dest > $ratio_orig)\n $ratio = $width / $width_orig;\n else\n $ratio = $height / $height_orig;\n }\n // one equal one bigger\n else if ( ($width == $width_orig && $height_orig > $height) || ($height == $height_orig && $width_orig > $width) )\n $to_crop = 1;\n // some problem...\n else\n echo \"ALARM\";\n\n // we need to zoom to get the right size\n if ($to_scale == 1) {\n $new_width = $width_orig * $ratio;\n $new_height = $height_orig * $ratio;\n $image_scaled = imagecreatetruecolor($new_width, $new_height);\n // scaling!\n imagecopyresampled($image_scaled, $image, 0, 0, 0, 0, $new_width, $new_height, $width_orig, $height_orig);\n $image = $image_scaled;\n\n if($new_width > $width || $new_height > $height)\n $to_crop = 1;\n }\n else {\n $new_width = $width_orig;\n $new_height = $height_orig;\n }\n\n // we need to crop the image\n if ($to_crop == 1) {\n $image_cropped = imagecreatetruecolor($width, $height);\n\n // find margins for images\n $margin_x = ($new_width - $width) / 2;\n $margin_y = ($new_height - $height) / 2;\n\n // cropping!\n imagecopy($image_cropped, $image, 0, 0, $margin_x, $margin_y, $width, $height);\n $image = $image_cropped;\n }\n\n // Save image\n imagejpeg($image, $img_filename, 95);\n }\n\n // Return image URL\n return Wordless::join_paths(Wordless::theme_temp_path(), basename($img_filename));\n }", "public function test_resize() {\n\n\t\t$file = DIR_TESTDATA . '/images/gradient-square.jpg';\n\n\t\t$imagick_image_editor = new WP_Image_Editor_Imagick( $file );\n\t\t$imagick_image_editor->load();\n\n\t\t$imagick_image_editor->resize( 100, 50 );\n\n\t\t$this->assertEquals( array( 'width' => 50, 'height' => 50 ), $imagick_image_editor->get_size() );\n\t}", "public function resize(array $dimensions) {\n// is there an image resource to work with?\n if (isset($this->_resource)) {\n// does the dimensions array have the appropriate values to work with?\n if (isset($dimensions[\"width\"]) || isset($dimensions[\"height\"])) {\n// has the width value been omitted, while the height value given?\n if (!isset($dimensions[\"width\"]) && isset($dimensions[\"height\"])) {\n// is the height an integer?\n// -> if so, assign the height variable and assign the width variable scaled similarly to the height\n if (is_int($dimensions[\"height\"])) {\n $width = (int) floor($this->_width * ($dimensions[\"height\"] / $this->_height));\n $height = $dimensions[\"height\"];\n }\n }\n// or has the height value been omitted, and the width value given?\n else if (isset($dimensions[\"width\"]) && !isset($dimensions[\"height\"])) {\n// is the width an integer?\n// -> if so, assign the width variable and assign the height variable scaled similarly to the width\n if (is_int($dimensions[\"width\"])) {\n $width = $dimensions[\"width\"];\n $height = (int) floor($this->_height * ($dimensions[\"width\"] / $this->_width));\n }\n }\n// or both values were provided\n else {\n// are both width and height values integers?\n// -> if so, assign the width and height variables\n if (is_int($dimensions[\"width\"]) && is_int($dimensions[\"height\"])) {\n $width = $dimensions[\"width\"];\n $height = $dimensions[\"height\"];\n }\n }\n\n// have the width and height variables been assigned?\n// -> if so, proceed with cropping\n if (isset($width, $height)) {\n// generating the placeholder resource\n $resized_image = $this->newImageResource($width, $height);\n\n// copying the original image's resource into the placeholder and resizing it accordingly\n imagecopyresampled($resized_image, $this->_resource, 0, 0, 0, 0, $width, $height, $this->_width, $this->_height);\n\n// assigning the new image attributes\n $this->_resource = $resized_image;\n $this->_width = $width;\n $this->_height = $height;\n }\n } else {\n trigger_error(\"CAMEMISResizeImage::resize() was not provided the apporpriate arguments (given array must contain \\\"width\\\" and \\\"height\\\" elements)\", E_USER_WARNING);\n }\n } else {\n trigger_error(\"CAMEMISResizeImage::resize() attempting to access a non-existent resource (check if the image was loaded by Image2::__construct())\", E_USER_WARNING);\n }\n\n return $this;\n }", "public function setOriginalImageWidthHeight() {\n \n $checkError = $this->isError();\n if (!$checkError) {\n \n /*\n * get original width and height\n */\n $this->__originalImageWidth = imagesx($this->__image);\n $this->__originalImageHeight = imagesy($this->__image);\n \n }\n \n }", "public function resize()\n {\n foreach ($this->getList() as $image) {\n if (!$image instanceof mtmdImage) {\n continue;\n }\n\n mtmdUtils::output(\n sprintf(\n '\"%s\": Resizing to %dx%d (was %dx%d)...',\n $image->getFileName(),\n $this->getThumbWidth(),\n $this->getThumbHeight(),\n $image->getWidth(),\n $image->getHeight()\n )\n );\n\n $targetPath = $this->getCachedFilePath(dirname($image->getFileName()));\n\n // Prepare target dirs.\n mtmdUtils::mkDir($targetPath, 0755, true);\n // Resize image.\n $image->resizeImage($targetPath, $this->thumbWidth, $this->thumbHeight);\n\n }\n\n }" ]
[ "0.70774007", "0.68458486", "0.6583758", "0.65757143", "0.6547624", "0.6477724", "0.645179", "0.6446837", "0.6428243", "0.6398771", "0.635543", "0.6324176", "0.6318995", "0.63087445", "0.62907344", "0.6288065", "0.6260297", "0.6246836", "0.6209749", "0.6191392", "0.617371", "0.61591953", "0.6155474", "0.6129845", "0.6110328", "0.61087847", "0.61063683", "0.60888547", "0.6072568", "0.60479176", "0.6017889", "0.60173374", "0.6011947", "0.6006848", "0.6005879", "0.6005837", "0.5983751", "0.598065", "0.5967461", "0.59588236", "0.5935859", "0.59315515", "0.5926685", "0.59246886", "0.59143037", "0.59008324", "0.5894513", "0.58825105", "0.5879699", "0.58772594", "0.58757854", "0.58472806", "0.5847075", "0.58405674", "0.58390063", "0.5833267", "0.58213544", "0.5782223", "0.57722163", "0.5756256", "0.574939", "0.57449144", "0.57433194", "0.5740947", "0.5739418", "0.5737087", "0.57363045", "0.57323956", "0.5719014", "0.5715357", "0.57043415", "0.56966287", "0.56921834", "0.569176", "0.5688054", "0.56840014", "0.5679446", "0.56709653", "0.5667855", "0.56661654", "0.5663278", "0.56629395", "0.56613606", "0.56593066", "0.5630761", "0.5629599", "0.5622002", "0.5607559", "0.5597382", "0.55938905", "0.55910033", "0.55815405", "0.5578522", "0.5573139", "0.55677265", "0.55491024", "0.55488604", "0.5541789", "0.55294305", "0.55059725" ]
0.57362384
67
Create the temporary image to copy to
protected function _do_crop($width, $height, $offset_x, $offset_y) { $image = $this->_create($width, $height); // Loads image if not yet loaded $this->_load_image(); // Execute the crop if (imagecopyresampled($image, $this->_image, 0, 0, $offset_x, $offset_y, $width, $height, $width, $height)) { // Swap the new image for the old one imagedestroy($this->_image); $this->_image = $image; // Reset the width and height $this->width = imagesx($image); $this->height = imagesy($image); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function createTemporaryImage()\n {\n $tmpDir = sys_get_temp_dir();\n $fileName = $tmpDir . DIRECTORY_SEPARATOR . 'image_project_unit_test_' . time() . rand() . '.jpg';\n $gd = imagecreatetruecolor(400, 300);\n imagefill($gd, 50, 50, 1);\n\n imagejpeg($gd, $fileName, 100);\n imagedestroy($gd);\n\n return $fileName;\n }", "protected function makeTmpImage($image, $width, $height) {\n $geometry = $width . 'x' . $height;\n $tmp = sys_get_temp_dir() . '/argus_' . getmypid() . '_' . basename($image);\n $this->process->setCommandLine(implode(' ', [\n 'convert',\n '-composite',\n '-size ' . $geometry,\n '-gravity northwest',\n '-crop ' . $geometry . '+0+0',\n 'canvas:none',\n escapeshellarg($image),\n escapeshellarg($tmp)\n ]));\n $this->process->mustRun();\n return $tmp;\n }", "function create($filename=\"\")\n{\nif ($filename) {\n $this->src_image_name = trim($filename);\n}\n$dirname=explode(\"/\",$this->src_image_name);\nif(!file_exists(\"$dirname[0]/$dirname[1]/$dirname[2]/$dirname[3]/\")){\n\t@mkdir(\"$dirname[0]/$dirname[1]/$dirname[2]/$dirname[3]/\", 0755);\n}\nif(stristr(PHP_OS,\"WIN\")){\n\t$this->src_image_name = @iconv(\"utf-8\",\"GBK\",$this->src_image_name);\n\t$this->met_image_name = @iconv(\"utf-8\",\"GBK\",$this->met_image_name);\n}\n$src_image_type = $this->get_type($this->src_image_name);\n$src_image = $this->createImage($src_image_type,$this->src_image_name);\nif (!$src_image) return;\n$src_image_w=ImageSX($src_image);\n$src_image_h=ImageSY($src_image);\n\n\nif ($this->met_image_name){\n $this->met_image_name = strtolower(trim($this->met_image_name));\n $met_image_type = $this->get_type($this->met_image_name);\n $met_image = $this->createImage($met_image_type,$this->met_image_name);\n $met_image_w=ImageSX($met_image);\n $met_image_h=ImageSY($met_image);\n $temp_met_image = $this->getPos($src_image_w,$src_image_h,$this->met_image_pos,$met_image);\n $met_image_x = $temp_met_image[\"dest_x\"];\n $met_image_y = $temp_met_image[\"dest_y\"];\n\t if($this->get_type($this->met_image_name)=='png'){imagecopy($src_image,$met_image,$met_image_x,$met_image_y,0,0,$met_image_w,$met_image_h);}\n\t else{imagecopymerge($src_image,$met_image,$met_image_x,$met_image_y,0,0,$met_image_w,$met_image_h,$this->met_image_transition);}\n}\nif ($this->met_text){\n $temp_met_text = $this->getPos($src_image_w,$src_image_h,$this->met_text_pos);\n $met_text_x = $temp_met_text[\"dest_x\"];\n $met_text_y = $temp_met_text[\"dest_y\"];\n if(preg_match(\"/([a-f0-9][a-f0-9])([a-f0-9][a-f0-9])([a-f0-9][a-f0-9])/i\", $this->met_text_color, $color))\n {\n $red = hexdec($color[1]);\n $green = hexdec($color[2]);\n $blue = hexdec($color[3]);\n $met_text_color = imagecolorallocate($src_image, $red,$green,$blue);\n }else{\n $met_text_color = imagecolorallocate($src_image, 255,255,255);\n }\n imagettftext($src_image, $this->met_text_size, $this->met_text_angle, $met_text_x, $met_text_y, $met_text_color,$this->met_text_font, $this->met_text);\n}\nif(stristr(PHP_OS,\"WIN\")){\n\t$save_files=explode('/',$this->save_file);\n\t$save_files[count($save_files)-1]=@iconv(\"utf-8\",\"GBK\",$save_files[count($save_files)-1]);\n\t$this->save_file=implode('/',$save_files);\n}\nif ($this->save_file)\n{\n switch ($this->get_type($this->save_file)){\n case 'gif':$src_img=ImagePNG($src_image, $this->save_file); break;\n case 'jpeg':$src_img=ImageJPEG($src_image, $this->save_file, $this->jpeg_quality); break;\n case 'png':$src_img=ImagePNG($src_image, $this->save_file); break;\n default:$src_img=ImageJPEG($src_image, $this->save_file, $this->jpeg_quality); break;\n }\n}\nelse\n{\nif ($src_image_type = \"jpg\") $src_image_type=\"jpeg\";\n header(\"Content-type: image/{$src_image_type}\");\n switch ($src_image_type){\n case 'gif':$src_img=ImagePNG($src_image); break;\n case 'jpg':$src_img=ImageJPEG($src_image, \"\", $this->jpeg_quality);break;\n case 'png':$src_img=ImagePNG($src_image);break;\n default:$src_img=ImageJPEG($src_image, \"\", $this->jpeg_quality);break;\n }\n}\nimagedestroy($src_image);\n}", "public function createImage()\n {\n $name = basename($this->absoluteUrl);\n if ($this->fileExists($this->absoluteUrl) && !in_array($name, $this->notAllowedNames)) {\n $mime = @exif_imagetype($this->absoluteUrl);\n if ($mime == IMAGETYPE_JPEG || $mime == IMAGETYPE_PNG || $mime == IMAGETYPE_GIF) {\n if (!file_exists($this->imageDirectory)) {\n mkdir($this->imageDirectory, 0700);\n }\n\n copy($this->absoluteUrl, $this->imageDirectory . DIRECTORY_SEPARATOR . $name);\n }\n }\n }", "protected function loadImage()\n {\n if (!is_resource($this->tmpImage)) {\n $create = $this->createFunctionName;\n $this->tmpImage = $create($this->filePath);\n imagesavealpha($this->tmpImage, true);\n }\n }", "public function createImage()\n {\n if ($this->resize) {\n\n // get the resize dimensions\n $height = (int)array_get($this->resizeDimensions, 'new_height', 320);\n\n $width = (int)array_get($this->resizeDimensions, 'new_width', 240);\n\n if ($this->fit) {\n return Image::make($this->originalPath)->fit($width, $height)\n ->save(base_path() . $this->storageLocation . '/' . $this->uniqueName, $this->imgQuality);\n } else {\n return Image::make($this->originalPath)->resize($width, $height)\n ->save(base_path() . $this->storageLocation . '/' . $this->uniqueName, $this->imgQuality);\n }\n\n } else {\n\n return Image::make($this->originalPath)\n ->save(base_path() . $this->storageLocation . '/' . $this->uniqueName, $this->imgQuality);\n }\n }", "protected function _createImage()\n {\n $this->_height = $this->scale * 60;\n $this->_width = 1.8 * $this->_height;\n $this->_image = imagecreate($this->_width, $this->_height);\n ImageColorAllocate($this->_image, 0xFF, 0xFF, 0xFF);\n }", "private function create_blank_image() {\r\n\t\t$image = imagecreatetruecolor( $this->diameter,$this->diameter );\r\n\r\n\t\t/* we also need a transparent background ... */\r\n\t\timagesavealpha($image, true);\r\n\r\n\t\t/* create a transparent color ... */\r\n\t\t$color = imagecolorallocatealpha($image, 0, 0, 0, 127);\r\n\r\n\t\t/* ... then fill the image with it ... */\r\n\t\timagefill($image, 0, 0, $color);\r\n\r\n\t\t/* nothing to do then ... just save the new image ... */\r\n\t\t$this->cutted_image = $image;\r\n\r\n\t\t/* go back and see what should we do next ..? */\r\n\t\treturn;\r\n\r\n\t}", "function createCopy( $I )\n{\n\t// get width and height\n\t$width = imagesx( $I );\n\t$height = imagesy( $I );\n\t\t\n\t// clone image\n\t$Ires = imageCreateTrueColor($width,$height);\n\timageCopy($Ires,$I,0,0,0,0, $width, $height);\n\t\t\n\t// return image\n\treturn $Ires;\t\t\n}", "public function run() {\r\nif(!($new_image = @imagecreatetruecolor($this->new_width, $this->new_height)))\r\nthrow new Exception(\"Error while the new image was initialized\");\r\n\r\nswitch($this->type) {\r\ncase 1:\r\n$image = imagecreatefromgif($this->src);\r\n$transparent_index = imagecolortransparent($image);\r\n$transparent_color = imagecolorsforindex($image, $transparent_index);\r\n$transparent_index = imagecolorallocate($new_image, $transparent_color['red'], $transparent_color['green'], $transparent_color['blue']);\r\nimagefill($new_image, 0, 0, $transparent_index);\r\nimagecolortransparent($new_image, $transparent_index);\r\nbreak;\r\ncase 2:\r\n$image = imagecreatefromjpeg($this->src);\r\nbreak;\r\ncase 3:\r\n$image = imagecreatefrompng($this->src);\r\nimagealphablending($new_image, false);\r\nimagesavealpha($new_image, true);\r\nbreak;\r\ndefault:\r\nthrow new Exception('<b>Error:</b> The image type was not recognized');\r\nbreak;\r\n}\r\n\r\ntry {\r\nimagecopyresampled($new_image, $image, 0, 0, 0, 0, $this->new_width, $this->new_height, $this->width, $this->height);\r\n}\r\ncatch(Exception $e) {\r\nthrow new Exception(\"<b>Error:</b> The image couldn't be resized\");\r\n}\r\n\r\nswitch($this->type) {\r\ncase 1:\r\nimagegif($new_image, $this->dest);\r\nbreak;\r\ncase 2:\r\nimagejpeg($new_image, $this->dest);\r\nbreak;\r\ncase 3:\r\nimagepng($new_image, $this->dest);\r\nbreak;\r\ndefault:\r\nthrow new Exception('Error while the image was created');\r\nbreak;\r\n}\r\n\r\n$this->releaseMemory($image, $new_image);\r\n}", "function create($filename=\"\")\n{\nif ($filename) {\n $this->src_image_name = trim($filename);\n}\n$dirname=explode(\"/\",$this->src_image_name);\nif(!file_exists(\"$dirname[0]/$dirname[1]/$dirname[2]/$dirname[3]/\")){\n\t@mkdir(\"$dirname[0]/$dirname[1]/$dirname[2]/$dirname[3]/\", 0755);\n}\nif(stristr(PHP_OS,\"WIN\")){\n\t$this->src_image_name = @iconv(\"utf-8\",\"GBK\",$this->src_image_name);\n\t$this->gz_image_name = @iconv(\"utf-8\",\"GBK\",$this->gz_image_name);\n}\n$src_image_type = $this->get_type($this->src_image_name);\n$src_image = $this->createImage($src_image_type,$this->src_image_name);\nif (!$src_image) return;\n$src_image_w=ImageSX($src_image);\n$src_image_h=ImageSY($src_image);\n\n\nif ($this->gz_image_name){\n $this->gz_image_name = strtolower(trim($this->gz_image_name));\n $gz_image_type = $this->get_type($this->gz_image_name);\n $gz_image = $this->createImage($gz_image_type,$this->gz_image_name);\n $gz_image_w=ImageSX($gz_image);\n $gz_image_h=ImageSY($gz_image);\n $temp_gz_image = $this->getPos($src_image_w,$src_image_h,$this->gz_image_pos,$gz_image);\n $gz_image_x = $temp_gz_image[\"dest_x\"];\n $gz_image_y = $temp_gz_image[\"dest_y\"];\n\t if($this->get_type($this->gz_image_name)=='png'){imagecopy($src_image,$gz_image,$gz_image_x,$gz_image_y,0,0,$gz_image_w,$gz_image_h);}\n\t else{imagecopymerge($src_image,$gz_image,$gz_image_x,$gz_image_y,0,0,$gz_image_w,$gz_image_h,$this->gz_image_transition);}\n}\nif ($this->gz_text){\n $temp_gz_text = $this->getPos($src_image_w,$src_image_h,$this->gz_text_pos);\n $gz_text_x = $temp_gz_text[\"dest_x\"];\n $gz_text_y = $temp_gz_text[\"dest_y\"];\n if(preg_match(\"/([a-f0-9][a-f0-9])([a-f0-9][a-f0-9])([a-f0-9][a-f0-9])/i\", $this->gz_text_color, $color))\n {\n $red = hexdec($color[1]);\n $green = hexdec($color[2]);\n $blue = hexdec($color[3]);\n $gz_text_color = imagecolorallocate($src_image, $red,$green,$blue);\n }else{\n $gz_text_color = imagecolorallocate($src_image, 255,255,255);\n }\n imagettftext($src_image, $this->gz_text_size, $this->gz_text_angle, $gz_text_x, $gz_text_y, $gz_text_color,$this->gz_text_font, $this->gz_text);\n}\nif(stristr(PHP_OS,\"WIN\")){\n\t$save_files=explode('/',$this->save_file);\n\t$save_files[count($save_files)-1]=@iconv(\"utf-8\",\"GBK\",$save_files[count($save_files)-1]);\n\t$this->save_file=implode('/',$save_files);\n}\nif ($this->save_file)\n{\n switch ($this->get_type($this->save_file)){\n case 'gif':$src_img=ImagePNG($src_image, $this->save_file); break;\n case 'jpeg':$src_img=ImageJPEG($src_image, $this->save_file, $this->jpeg_quality); break;\n case 'png':$src_img=ImagePNG($src_image, $this->save_file); break;\n default:$src_img=ImageJPEG($src_image, $this->save_file, $this->jpeg_quality); break;\n }\n}\nelse\n{\nif ($src_image_type = \"jpg\") $src_image_type=\"jpeg\";\n header(\"Content-type: image/{$src_image_type}\");\n switch ($src_image_type){\n case 'gif':$src_img=ImagePNG($src_image); break;\n case 'jpg':$src_img=ImageJPEG($src_image, \"\", $this->jpeg_quality);break;\n case 'png':$src_img=ImagePNG($src_image);break;\n default:$src_img=ImageJPEG($src_image, \"\", $this->jpeg_quality);break;\n }\n}\nimagedestroy($src_image);\n}", "public function copyImages();", "protected function createImage(): void\n {\n // create image\n $this->image = @imagecreatetruecolor($this->width, $this->height);\n\n // set mime type\n $this->mimeType = 'image/png';\n\n // set modified date\n $this->modified = time();\n }", "function prepare(&$image) {\r\r\n\r\r\n\t\t// create new temporary object\r\r\n\t\t//\r\r\n\t\t$tmp = new Asido_TMP;\r\r\n\t\t$tmp->source_filename = $image->source();\r\r\n\t\t$tmp->target_filename = $image->target();\r\r\n\r\r\n\t\t// failed opening ?\r\r\n\t\t//\r\r\n\t\tif (!$this->__open($tmp)) {\r\r\n\t\t\ttrigger_error(\r\r\n\t\t\t\t'Unable to open source image',\r\r\n\t\t\t\tE_USER_WARNING\r\r\n\t\t\t\t);\r\r\n\t\t\treturn false;\r\r\n\t\t\t}\r\r\n\t\t\r\r\n\t\treturn $tmp;\r\r\n\t\t}", "function __tmpimage(&$handler, $filename=null) {\n\n\t\tif (!isset($filename)) {\n\t\t\t$filename = $this->__tmpfile();\n\t\t\t}\n\n\t\t// weird ... only works with absolute names\n\t\t//\n\t\tfclose(fopen($filename, 'w'));\n\n\t\t// call `convert`\n\t\t//\n\t\t$cmd = $this->__command(\n\t\t\t'convert',\n \tescapeshellarg(realpath($handler))\n \t\t. ' PNG:'\n\t\t\t\t// ^\n\t\t\t\t// PNG: no pixel losts\n \t\t. escapeshellarg($filename)\n \t);\n\n exec($cmd, $result, $errors);\n\t\tif ($errors) {\n\t\t\treturn false;\n\t\t\t}\n\n\t\treturn $this->prepare(\n\t\t\tnew Asido_Image($filename)\n\t\t\t);\n\t\t}", "private function makeTemporaryFile($imageLocation)\n {\n $imageFile = @fopen($imageLocation, \"r\");\n\n if (!$imageFile) {\n throw new ImageProcessorException(\"Could not open image location for reading: \".error_get_last()[\"message\"], 7);\n }\n\n $temporaryFilePath = $this->temporaryDirectory . \"imageProcessorCache\" . md5($imageLocation);\n\n $temporaryFile = @fopen($temporaryFilePath, \"w\");\n\n if (!$temporaryFile) {\n fclose($imageFile);\n throw new ImageProcessorException(\"Could not create temporary image file: \".error_get_last()[\"message\"], 8);\n }\n\n $copyResult = @stream_copy_to_stream($imageFile, $temporaryFile);\n\n fclose($imageFile);\n fclose($temporaryFile);\n\n if ($copyResult === false) {\n throw new ImageProcessorException(\"Could not copy image to temporary file: \".error_get_last()[\"message\"], 9);\n }\n\n if (!$copyResult) {\n throw new ImageProcessorException(\"The image file is empty.\", 2);\n }\n\n return $temporaryFilePath;\n }", "protected function _load_image()\n {\n if ( ! is_resource($this->_image))\n {\n // Gets create function\n $create = $this->_create_function;\n\n // Open the temporary image\n $this->_image = $create($this->file);\n\n // Preserve transparency when saving\n imagesavealpha($this->_image, TRUE);\n }\n }", "function __tmpfile() {\r\r\n\t\treturn tempnam(-1, null) . '.PNG';\r\r\n\t\t}", "function create_image(){\r\n\t$wmark = imagecreatefrompng('img/stamp.png');\r\n\t//Load jpg image\r\n\t$image = imagecreatefromjpeg('img/image'.rand(1,3).'.jpg');\r\n\t\r\n\t//Get image width/height\r\n\t$width = imagesx($image);\r\n\t$height = imagesy($image);\r\n\t\r\n\t// Set the margins for the stamp and get the height/width of the stamp image\r\n\t$marge_right = 10;\r\n\t$marge_bottom = 10;\r\n\t$sx = imagesx($wmark);\r\n\t$sy = imagesy($wmark);\r\n\t\r\n\t// Copy the stamp image onto our photo using the margin offsets and the photo width to calculate positioning of the stamp. \r\n\timagecopy($image, $wmark, $width-$sx-$marge_right, $height-$sy-$marge_bottom,0,0,$sx,$sy);\r\n\t\r\n\t// Prepare the final image and save to path. If you only pass $image it will output to the browser instead of a file.\r\n\timagepng($image,\"generatedImage.png\");\r\n\t\r\n\t// Output and free memory\r\n\timagedestroy($image);\r\n}", "function make_thumb($src, $dest, $desired_width, $type) {\n//echo \"dest\" . $dest . \"\\n\";\n//echo \"type\" . $type . \"\\n\";\n\n /* read the source image */\n if( 'JPEG' == $type){\n $source_image = imagecreatefromjpeg($src);\n } else { // lazy !\n $source_image = imagecreatefrompng($src);\n }\n $width = imagesx($source_image);\n $height = imagesy($source_image);\n\n /* find the \"desired height\" of this thumbnail, relative to the desired width */\n $desired_height = floor($height * ($desired_width / $width));\n\n /* create a new, \"virtual\" image */\n $virtual_image = imagecreatetruecolor($desired_width, $desired_height);\n\n /* copy source image at a resized size */\n imagecopyresampled($virtual_image, $source_image, 0, 0, 0, 0, $desired_width, $desired_height, $width, $height);\n// header('Content-Type: image/png');\n\n /* create the physical thumbnail image to its destination */\n if( 'JPEG' == $type){\n imagejpeg($virtual_image, $dest);\n } else {\n imagepng($virtual_image, $dest, 9);\n }\n}", "private function generateImage($image, $object) {\n $src = $this->getImageContent($object[\"path\"]);\n $w_src = imagesx($src);\n $h_src = imagesy($src);\n $wr_src = $object[\"width\"];\n $hr_src = $object[\"height\"];\n\n // Create tmp layer\n $tmp = imagecreatetruecolor($wr_src, $hr_src);\n\n imagecopyresampled($tmp, $src, 0, 0, 0, 0, $wr_src, $hr_src, $w_src, $h_src);\n\n $this->imagecopymerge_alpha($image, $tmp, $object[\"left\"], $object[\"top\"], 0, 0, $object[\"opacity\"], $object[\"rotate\"]);\n\n // Destroy temporary image\n imagedestroy($tmp);\n\n return $image;\n }", "private function create_img_stream()\n {\n $this->img = imagecreate(L_IMG_WIDTH,L_IMG_HEIGHT);\n }", "function create_image($source,$sizes){\n // Tony Smith uploaded a big image once (7000x3000pixels) that was 1.1MB as a JPEG compressed,\n // but when inflated out using imagecreatefromjpeg used more memory than there was available!\n // So lets make this nice and large to handle Tony's massive bits\n ini_set('memory_limit', '256M');\n\n // Save parts of source image path\n $path_parts = pathinfo($source);\n\n // Load image and get image size.\n $img = imagecreatefromjpeg($source);\n $width = imagesx($img);\n $height = imagesy($img);\n\n foreach($sizes as $s){\n\n // Create new filename\n $new_name = $path_parts['dirname'].\"/\".$path_parts['filename'].\"_\".$s['suffix'].\".\".$path_parts['extension'];\n\n // Scale to fit the required width\n if ($width > $height) {\n $newwidth = $s['dim'];\n $divisor = $width / $s['dim'];\n $newheight = floor($height/$divisor);\n }else{\n $newheight = $s['dim'];\n $divisor = $height / $s['dim'];\n $newwidth = floor($width/$divisor);\n }\n\n // Create a new temporary image.\n $tmpimg = imagecreatetruecolor($newwidth,$newheight);\n \n // Copy and resize old image into new image.\n imagecopyresampled($tmpimg,$img,0,0,0,0,$newwidth,$newheight,$width,$height);\n\n // Save thumbnail into a file.\n imagejpeg($tmpimg,$new_name,$s['q']);\n\n // release the memory\n imagedestroy($tmpimg);\n\n }\n imagedestroy($img);\n}", "private function createTabImage()\n {\n $filePath = _PS_MODULE_LENGOW_DIR_ . 'views/img/AdminLengow.gif';\n $fileDest = _PS_MODULE_LENGOW_DIR_ . 'AdminLengow.gif';\n if (!file_exists($fileDest) && LengowMain::compareVersion('1.5') == 0) {\n copy($filePath, $fileDest);\n }\n }", "public function generateThumbnail($src, $dst);", "public function create_image(){\n\t\t$md5_hash = md5(rand(0,999));\n\t\t$security_code = substr($md5_hash, 15, 5);\n\t\t$this->Session->write('security_code',$security_code);\n\t\t$width = 80;\n\t\t$height = 22;\n\t\t$image = ImageCreate($width, $height);\n\t\t$black = ImageColorAllocate($image, 37, 170, 226);\n\t\t$white = ImageColorAllocate($image, 255, 255, 255);\n\t\tImageFill($image, 0, 0, $black);\n\t\tImageString($image, 5, 18, 3, $security_code, $white);\n\t\theader(\"Content-Type: image/jpeg\");\n\t\tImageJpeg($image);\n\t\tImageDestroy($image);\n\t}", "function generateThumb($dst_w = 85, $dst_h = 85, $mode) {\n $this->thumbToolkit = ImageToolkit::factory($this->getImagePath ());\n if ($mode == true) {\n $mode = 'crop';\n }\n else {\n $mode = 'ratio';\n }\n $this->thumbToolkit->setDestSize ($dst_w, $dst_h, $mode);\n\n $final = luxbum::getThumbImage ($this->dir, $this->file, $dst_w, $dst_h);\n if (!is_file ($final)) {\n files::createDir ($this->thumbDir);\n $this->thumbToolkit->createThumb ($final);\n }\n return $final;\n }", "function createThumb( $sImgSource, $sImgDestDir, $sImgOutput = false, $iQuality = null, $sOption = null ) { \n \n if( !is_dir( $sImgDestDir ) && $this->checkCorrectFile( $sImgSource, 'jpg|jpeg|gif|png' ) == 0 )\n return null;\n\n if( !is_numeric( $iQuality ) )\n $iQuality = $this->iQuality;\n\n $sImgExt = $this->throwExtOfFile( $sImgSource );\n\n if( $sImgOutput == false )\n $sImgOutput = basename( $sImgSource, '.'.$sImgExt ) . $this->iThumbAdd . '.' . $sImgExt;\n\n $sImgOutput = $this->changeFileName( $sImgOutput );\n\n $sImgBackup = $sImgDestDir.$sImgOutput . \"_backup.jpg\";\n copy( $sImgSource, $sImgBackup );\n $aImgProperties = GetImageSize( $sImgBackup );\n\n if ( !$aImgProperties[2] == 2 ) {\n return null;\n }\n else {\n switch( $sImgExt ) {\n case 'jpg':\n $mImgCreate = ImageCreateFromJPEG( $sImgBackup );\n break;\n case 'jpeg':\n $mImgCreate = ImageCreateFromJPEG( $sImgBackup );\n break;\n case 'png':\n $mImgCreate = ImageCreateFromPNG( $sImgBackup );\n break;\n case 'gif':\n $mImgCreate = ImageCreateFromGIF( $sImgBackup );\n }\n\n $iImgCreateX = ImageSX( $mImgCreate );\n $iImgCreateY = ImageSY( $mImgCreate );\n\n $iScaleX = $this->iThumbX / ( $iImgCreateX );\n $this->iThumbY = $iImgCreateY * $iScaleX;\n\n $iRatio = $this->iThumbX / $this->iThumbY;\n\n if( $iRatio < $this->fRatio ) {\n $this->iThumbY = $this->iThumbX;\n $iScaleY = $this->iThumbY / ( $iImgCreateY );\n $this->iThumbX = $iImgCreateX * $iScaleY;\n }\n\n $this->iThumbX = ( int )( $this->iThumbX );\n $this->iThumbY = ( int )( $this->iThumbY );\n $mImgDest = imagecreatetruecolor( $this->iThumbX, $this->iThumbY );\n unlink( $sImgBackup );\n\n if( function_exists( 'imagecopyresampled' ) )\n $sCreateFunction = 'imagecopyresampled';\n else\n $sCreateFunction = 'imagecopyresized';\n\n if( !$sCreateFunction( $mImgDest, $mImgCreate, 0, 0, 0, 0, $this->iThumbX + 1, $this->iThumbY + 1, $iImgCreateX, $iImgCreateY ) ) {\n imagedestroy( $mImgCreate );\n imagedestroy( $mImgDest );\n return null;\n }\n else {\n imagedestroy( $mImgCreate );\n switch( $sImgExt ) {\n case 'jpg':\n $Image = ImageJPEG( $mImgDest, $sImgDestDir.$sImgOutput, $iQuality );\n break;\n case 'jpeg':\n $Image = ImageJPEG( $mImgDest, $sImgDestDir.$sImgOutput, $iQuality );\n break;\n case 'png':\n $Image = ImagePNG( $mImgDest, $sImgDestDir.$sImgOutput );\n break;\n case 'gif':\n $Image = ImagePNG( $mImgDest, $sImgDestDir.$sImgOutput, $iQuality );\n }\n if ( $Image ) {\n imagedestroy( $mImgDest );\n return $sImgOutput;\n }\n imagedestroy( $mImgDest );\n }\n return null;\n }\n\n }", "private function PrepareImageForCache()\n {\n if($this->verbose) { self::verbose(\"File extension is: {$this->fileExtension}\"); }\n\n switch($this->fileExtension) {\n case 'jpg':\n case 'jpeg':\n $image = imagecreatefromjpeg($this->pathToImage);\n if($this->verbose) { self::verbose(\"Opened the image as a JPEG image.\"); }\n break;\n\n case 'png':\n $image = imagecreatefrompng($this->pathToImage);\n if($this->verbose) { self::verbose(\"Opened the image as a PNG image.\"); }\n break;\n\n default: errorPage('No support for this file extension.');\n }\n return $image;\n }", "protected function createTmpImage($imagePath, $suffix)\n {\n //if a specified file as a overlay exists\n $tmpImage = new ImageMagick();\n $tmpImage->load($imagePath);\n //creates the temp file for the background\n $this->setTmpPaths($tmpImage, $suffix);\n $this->tmpFiles[] = $tmpImage->getOutputPath();\n\n return $tmpImage;\n }", "function makethumbnail($image_name,$src,$dest) {\n global $_CONF, $CONF_SE;\n $do_create = 0;\n if ($image_info = @getimagesize($src)) {\n if ($image_info[2] == 1 || $image_info[2] == 2 || $image_info[2] == 3) {\n $do_create = 1;\n }\n }\n if ($do_create) {\n $dimension = (intval($CONF_SE['auto_thumbnail_dimension'])) ? intval($CONF_SE['auto_thumbnail_dimension']) : 100;\n $resize_type = (intval($CONF_SE['auto_thumbnail_resize_type'])) ? intval($CONF_SE['auto_thumbnail_resize_type']) : 1;\n $quality = (intval($CONF_SE['auto_thumbnail_quality']) && intval($CONF_SE['auto_thumbnail_quality']) <= 100) ? intval($CONF_SE['auto_thumbnail_quality']) : 100;\n\n if (create_thumbnail($src, $dest, $quality, $dimension, $resize_type)) {\n $new_thumb_name = $new_name;\n $chmod = @chmod ($dest,$CONF_SE['image_perms']);\n }\n }\n}", "function copyImage($srcFile, $destFile, $w, $h, $quality = 75) {\n $tmpSrc = pathinfo(strtolower($srcFile));\n $tmpDest = pathinfo(strtolower($destFile));\n $size = getimagesize($srcFile);\n if ($tmpDest['extension'] == \"gif\" || $tmpDest['extension'] == \"jpg\" || $tmpDest['extension'] == \"jpeg\") {\n $destFile = substr_replace($destFile, 'jpg', -3);\n $dest = imagecreatetruecolor($w, $h);\n imageantialias($dest, TRUE);\n } elseif ($tmpDest['extension'] == \"png\") {\n $dest = imagecreatetruecolor($w, $h);\n // Make the background transparent\n imagealphablending($dest, false);\n imagesavealpha($dest, true);\n $transparentindex = imagecolorallocatealpha($dest, 255, 255, 255, 127);\n imagefill($dest, 0, 0, $transparentindex);\n //imageantialias($dest, TRUE);\n } else {\n return false;\n }\n switch ($size[2]) {\n //GIF\n case 1: $src = imagecreatefromgif($srcFile);\n break;\n //JPEG\n case 2: $src = imagecreatefromjpeg($srcFile);\n break;\n //PNG\n case 3: $src = imagecreatefrompng($srcFile);\n break;\n default: return false;\n break;\n }\n imagecopyresampled($dest, $src, 0, 0, 0, 0, $w, $h, $size[0], $size[1]);\n switch ($size[2]) {\n case 1:\n case 2: imagejpeg($dest, $destFile, $quality);\n break;\n case 3: imagepng($dest, $destFile);\n }return $destFile;\n}", "function createImage($type,$img_name){\n if (!$type){\n $type = $this->get_type($img_name);\n }\n\t\t \n switch ($type){\n case 'gif':\n if (function_exists('imagecreatefromgif'))\n $tmp_img=@imagecreatefromgif($img_name);\n break;\n case 'jpg':\n $tmp_img=imagecreatefromjpeg($img_name);\n break;\n case 'png':\n $tmp_img=imagecreatefrompng($img_name);\n break;\n\t\t\t\t case 'jpeg':\n $tmp_img=imagecreatefromjpeg($img_name);\n break;\n default:\n $tmp_img=imagecreatefromstring($img_name);\n break;\n }\n return $tmp_img;\n}", "function createImage($type,$img_name){\n if (!$type){\n $type = $this->get_type($img_name);\n }\n\t\t \n switch ($type){\n case 'gif':\n if (function_exists('imagecreatefromgif'))\n $tmp_img=@imagecreatefromgif($img_name);\n break;\n case 'jpg':\n $tmp_img=imagecreatefromjpeg($img_name);\n break;\n case 'png':\n $tmp_img=imagecreatefrompng($img_name);\n break;\n\t\t\t\t case 'jpeg':\n $tmp_img=imagecreatefromjpeg($img_name);\n break;\n default:\n $tmp_img=imagecreatefromstring($img_name);\n break;\n }\n return $tmp_img;\n}", "function copy(&$tmp, $applied_image, $x, $y) {\r\r\n\r\r\n\t\t// open\r\r\n\t\t//\r\r\n\t\t$ci = new Asido_Image;\r\r\n\t\tif (!@$ci->source($applied_image)) {\r\r\n\t\t\ttrigger_error(\r\r\n\t\t\t\tsprintf(\r\r\n\t\t\t\t\t'The image that is going to '\r\r\n\t\t\t\t\t\t. ' be copied \"%s\" is '\r\r\n\t\t\t\t\t\t. ' either missing or '\r\r\n\t\t\t\t\t\t. ' is not readable',\r\r\n\t\t\t\t\t$applied_image\r\r\n\t\t\t\t\t),\r\r\n\t\t\t\tE_USER_WARNING\r\r\n\t\t\t\t);\r\r\n\t\t\treturn false;\r\r\n\t\t\t}\r\r\n\t\t\r\r\n\t\t$ct = $this->prepare($ci);\r\r\n\r\r\n\t\tif (!$this->__copy($tmp, $ct, $x, $y)) {\r\r\n\t\t\ttrigger_error(\r\r\n\t\t\t\t'Failed to copy the image',\r\r\n\t\t\t\tE_USER_WARNING\r\r\n\t\t\t\t);\r\r\n\t\t\treturn false;\r\r\n\t\t\t}\r\r\n\t\t\r\r\n\t\t$this->__destroy_source($ct);\r\r\n\t\t$this->__destroy_target($ct);\r\r\n\r\r\n\t\treturn true;\r\r\n\t\t}", "function upgrade_profile_image($id, $dir='users') {\n global $CFG;\n\n $im = ImageCreateFromJPEG($CFG->dataroot .'/'. $dir .'/'. $id .'/f1.jpg'); \n\n if (function_exists('ImageCreateTrueColor') and $CFG->gdversion >= 2) {\n $im1 = ImageCreateTrueColor(100,100);\n $im2 = ImageCreateTrueColor(35,35);\n } else {\n $im1 = ImageCreate(100,100);\n $im2 = ImageCreate(35,35);\n }\n \n if (function_exists('ImageCopyResampled') and $CFG->gdversion >= 2) { \n ImageCopyBicubic($im1, $im, 0, 0, 2, 2, 100, 100, 96, 96);\n } else {\n imagecopy($im1, $im, 0, 0, 0, 0, 100, 100);\n $c = ImageColorsForIndex($im1,ImageColorAt($im1,2,2)); \n $color = ImageColorClosest ($im1, $c['red'], $c['green'], $c['blue']); \n ImageSetPixel ($im1, 0, 0, $color); \n $c = ImageColorsForIndex($im1,ImageColorAt($im1,2,97)); \n $color = ImageColorClosest ($im1, $c['red'], $c['green'], $c['blue']); \n ImageSetPixel ($im1, 0, 99, $color); \n $c = ImageColorsForIndex($im1,ImageColorAt($im1,97,2)); \n $color = ImageColorClosest ($im1, $c['red'], $c['green'], $c['blue']); \n ImageSetPixel ($im1, 99, 0, $color); \n $c = ImageColorsForIndex($im1,ImageColorAt($im1,97,97)); \n $color = ImageColorClosest ($im1, $c['red'], $c['green'], $c['blue']); \n ImageSetPixel ($im1, 99, 99, $color); \n for ($x = 1; $x < 99; $x++) { \n $c1 = ImageColorsForIndex($im1,ImageColorAt($im,$x,1)); \n $color = ImageColorClosest ($im, $c1['red'], $c1['green'], $c1['blue']); \n ImageSetPixel ($im1, $x, 0, $color); \n $c2 = ImageColorsForIndex($im1,ImageColorAt($im1,$x,98)); \n $color = ImageColorClosest ($im1, $red, $green, $blue); \n $color = ImageColorClosest ($im, $c2['red'], $c2['green'], $c2['blue']); \n ImageSetPixel ($im1, $x, 99, $color); \n } \n for ($y = 1; $y < 99; $y++) { \n $c3 = ImageColorsForIndex($im1,ImageColorAt($im, 1, $y)); \n $color = ImageColorClosest ($im, $red, $green, $blue); \n $color = ImageColorClosest ($im, $c3['red'], $c3['green'], $c3['blue']); \n ImageSetPixel ($im1, 0, $y, $color); \n $c4 = ImageColorsForIndex($im1,ImageColorAt($im1, 98, $y)); \n $color = ImageColorClosest ($im, $c4['red'], $c4['green'], $c4['blue']); \n ImageSetPixel ($im1, 99, $y, $color); \n } \n } \n ImageCopyBicubic($im2, $im, 0, 0, 2, 2, 35, 35, 96, 96);\n\n if (function_exists('ImageJpeg')) {\n if (ImageJpeg($im1, $CFG->dataroot .'/'. $dir .'/'. $id .'/f1.jpg', 90) and \n ImageJpeg($im2, $CFG->dataroot .'/'. $dir .'/'. $id .'/f2.jpg', 95) ) {\n @chmod($CFG->dataroot .'/'. $dir .'/'. $id .'/f1.jpg', 0666);\n @chmod($CFG->dataroot .'/'. $dir .'/'. $id .'/f2.jpg', 0666);\n return 1;\n }\n } else {\n notify('PHP has not been configured to support JPEG images. Please correct this.');\n }\n return 0;\n}", "function createNewImage($oldType, $oldFile, $newSizeX, $newSizeY, $oldSizeX, $oldSizeY) {\n\n // Load original image\n $fnCreateImage = 'imagecreatefrom' . $oldType;\n $oldImage = $fnCreateImage($oldFile);\n\n // Create new image\n $newImage = imagecreatetruecolor($newSizeX, $newSizeY);\n imagesavealpha($newImage, true);\n imagealphablending($newImage, false);\n imagecopyresampled($newImage, $oldImage, 0, 0, 0, 0, $newSizeX, $newSizeY, $oldSizeX, $oldSizeY);\n\n return $newImage;\n }", "function make_thumb($folder,$src,$dest,$thumb_width) {\n\n\t$source_image = imagecreatefromjpeg($folder.'/'.$src);\n\t$width = imagesx($source_image);\n\t$height = imagesy($source_image);\n\t\n\t$thumb_height = floor($height*($thumb_width/$width));\n\t\n\t$virtual_image = imagecreatetruecolor($thumb_width,$thumb_height);\n\t\n\timagecopyresampled($virtual_image,$source_image,0,0,0,0,$thumb_width,$thumb_height,$width,$height);\n\t\n\timagejpeg($virtual_image,$dest,100);\n\t\n}", "function build_thumbnail($img, $tumb_width, $tumb_height)\n{\n\t$width = imageSX($img);\n\t$height = imageSY($img);\n\n//\t\t\techo sprintf(\" KALL %s %d\",__FILE__,__LINE__);\n\t$target_width = $tumb_width;\n\t$target_height = $tumb_height;\n\t\n\t$target_ratio = $target_width / $target_height;\n\t$img_ratio = $width / $height;\n//\t\t\techo sprintf(\" KALL %s %d\",__FILE__,__LINE__);\n\t\n\t$offx=0;\n\t$offy=0;\n\t$new_width=$width;\n\t$new_height=$height;\n\t\n//\t\t\techo sprintf(\" KALL %s %d\",__FILE__,__LINE__);\n\tif($img_ratio > $target_ratio) {\n\t\t$diff_ratio = $target_ratio / $img_ratio;\n\t\t$new_width = $width * $diff_ratio;\n\t\t$offx = ($width - $new_width) / 2;\n\t}\n//\t\t\techo sprintf(\" KALL %s %d\",__FILE__,__LINE__);\n\tif($img_ratio < $target_ratio){\n\t\t$diff_ratio = $img_ratio / $target_ratio;\n\t\t$new_height = $height * $diff_ratio;\n\t\t$offy = ($height - $new_height) / 2;\n\t}\n//\t\t\techo sprintf(\" KALL %s %d\",__FILE__,__LINE__);\n\n\t$new_img = ImageCreateTrueColor($tumb_width, $tumb_height);\n\n\t// Fill the image black\n//\t\t\techo sprintf(\" KALL %s %d\",__FILE__,__LINE__);\n\tif (!@imagefilledrectangle($new_img, 0, 0, $target_width-1, $target_height-1, 0)) {\n\t\techo \"ERROR\\nCould not fill new image\";\n//\t\texit(0);\n\t}\n//\t\t\techo sprintf(\" KALL %s %d\",__FILE__,__LINE__);\n\n\tif (!@imagecopyresampled($new_img, $img, 0, 0, $offx, $offy, $target_width, $target_height, $new_width, $new_height)) {\n\t\techo \"ERROR\\nCould not resize image\";\n//\t\texit(0);\n\t}\n\n\treturn $new_img;\n}", "function my_merge_image ($first_img_path, $second_img_path){\n $width = 1024;\n $height = 512;\n\n //Create new img from file with true color\n $first_img_path = imagecreatefrompng($first_img_path);\n $im = imagecreatetruecolor($width, $height);\n\n // copy and resize part of an img from the path and \"paste\" them side by side\n imagecopyresampled($im, $first_img_path, 0, 0, 0, 0, 1024, 1024, 1024, 1024);\n $second_img_path = imagecreatefrompng($second_img_path);\n imagecopyresampled($im, $second_img_path, 512, 0, 0, 0, 1024, 1024, 1024, 1024);\n\n //save png img from the given img ($im)\n //imagepng($im, \"final_img.png\");\n}", "function createImg()\n {\n // imagem de origem\n if ($this->ext == \"png\")\n $img_origem= imagecreatefrompng($this->origem);\n\t\telseif ($this->ext == \"gif\")\n $img_origem= imagecreatefromgif($this->origem);\n elseif ($this->ext == \"jpg\" || $this->ext == \"jpeg\")\n $img_origem= imagecreatefromjpeg($this->origem);\n\t\t\telseif ($this->ext == \"jpg\" || $this->ext == \"jpeg\")\n $img_origem= imagecreatefromwbmp($this->origem);\n return $img_origem;\n }", "protected function saveImage()\n {\n if ( $this->initialImage != $this->image )\n {\n $this->deleteOldImage();\n\n $imageHandler= new CImageHandler();\n $imageHandler->load( $this->getTempFolder( TRUE ) . $this->image );\n $imageHandler->save($this->getImagesFolder( TRUE ) . $imageHandler->getBaseFileName() );\n\n $settings = $this->getThumbsSettings();\n\n if ( !empty( $settings ) )\n {\n $imageHandler= new CImageHandler();\n $imageHandler->load( $this->getTempFolder( TRUE ) . $this->image );\n\n foreach( $settings as $prefix => $dimensions )\n {\n list( $width, $height ) = $dimensions;\n $imageHandler\n ->thumb( $width, $height )\n ->save( $this->getImagesFolder( TRUE ) . $prefix . $imageHandler->getBaseFileName() );\n }\n }\n\n @unlink( $this->getTempFolder( TRUE ) . $this->image );\n }\n }", "function create_image($url) {\n $timeparts = explode(\" \",microtime());\n $currenttime = bcadd(($timeparts[0]*1000),bcmul($timeparts[1],1000));\n\n // Gathers the time with current date and puts it into the file name\n $path = \"temp/\";\n $htmlname = $currenttime . \".html\";\n $imagename = $currenttime . \".png\";\n\n // Saves the captured image\n $image = $_POST[\"image\"];\n $ifp = fopen( $path . $imagename, 'wb' );\n $data = explode( ',', $image );\n fwrite( $ifp, base64_decode( $data[ 1 ] ) );\n fclose( $ifp );\n\n // Returns the name for URL\n echo $path . $imagename;\n}", "function make_thumb($src,$dest) {\n try {\n // Create a new SimpleImage object\n $image = new \\claviska\\SimpleImage();\n\n // load file\n $image->fromFile($src);\n // img getMimeType\n $mime = $image->getMimeType();\n $w = $image->getWidth();\n\n // Manipulate it\n // $image->bestFit(200, 300) // proportionally resize to fit inside a 250x400 box\n // $image->flip('x') // flip horizontally\n // $image->colorize('DarkGreen') // tint dark green\n // $image->sharpen()\n // $image->border('darkgray', 1) // add a 2 pixel black border\n // $image->overlay('flag.png', 'bottom right') // add a watermark image\n // $image->toScreen(); // output to the screen\n if ($w > 1000) {\n $image->autoOrient(); // adjust orientation based on exif data\n // $image->resize($resizeWidth); // 1365\n // $image->resize(1024); // 1365\n $image->resize(800); // 1067\n }\n $image->toFile($dest,$mime,$outIMGquality);\n // echo \"mime type: \".$mime;\n } catch(Exception $err) {\n // Handle errors\n echo $err->getMessage();\n }\n}", "function frame(&$tmp, $width, $height, $color=null) {\r\r\n\t\t\r\r\n\t\t// color ?\r\r\n\t\t//\r\r\n\t\tif (!is_a($color, 'Asido_Color')) {\r\r\n\t\t\t$color = new Asido_Color;\r\r\n\t\t\t$color->set(255, 255, 255);\r\r\n\t\t\t}\r\r\n\t\t\r\r\n\t\t// resize it\r\r\n\t\t//\r\r\n\t\tif (!$this->resize($tmp, $width, $height, ASIDO_RESIZE_FIT)) {\r\r\n\t\t\treturn false;\r\r\n\t\t\t}\r\r\n\t\t\r\r\n\t\t// get canvas\r\r\n\t\t//\r\r\n\t\tif (!$t2 = $this->__canvas($width, $height, $color)) {\r\r\n\t\t\ttrigger_error(\r\r\n\t\t\t\tsprintf(\r\r\n\t\t\t\t\t'Unable to get a canvas '\r\r\n\t\t\t\t\t\t. ' with %s pixels '\r\r\n\t\t\t\t\t\t. ' width and %s '\r\r\n\t\t\t\t\t\t. ' pixels height',\r\r\n\t\t\t\t\t$width, $height\r\r\n\t\t\t\t\t),\r\r\n\t\t\t\tE_USER_WARNING\r\r\n\t\t\t\t);\r\r\n\t\t\treturn false;\r\r\n\t\t\t}\r\r\n\t\t\r\r\n\t\t// target\r\r\n\t\t//\r\r\n\t\t$t3 = new Asido_TMP;\r\r\n\t\t$t3->source =& $tmp->target;\r\r\n\t\t$t3->image_width = $tmp->image_width;\r\r\n\t\t$t3->image_height = $tmp->image_height;\r\r\n\t\t\r\r\n\t\t// apply the image\r\r\n\t\t//\r\r\n\t\tif (!$this->__copy(\r\r\n\t\t\t$t2, $t3,\r\r\n\t\t\tround(($t2->image_width - $t3->image_width)/2),\r\r\n\t\t\tround(($t2->image_height - $t3->image_height)/2)\r\r\n\t\t\t)) {\r\r\n\t\t\ttrigger_error(\r\r\n\t\t\t\t'Failed to copy to the passepartout image',\r\r\n\t\t\t\tE_USER_WARNING\r\r\n\t\t\t\t);\r\r\n\t\t\treturn false;\r\r\n\t\t\t}\r\r\n\t\t\r\r\n\t\t// cook the result\r\r\n\t\t//\r\r\n\t\t$this->__destroy_target($tmp);\r\r\n\t\t$tmp->target = $t2->target;\r\r\n\t\t$tmp->image_width = $t2->image_width;\r\r\n\t\t$tmp->image_height = $t2->image_height;\r\r\n\t\t\r\r\n\t\treturn true;\r\r\n\t\t}", "private function createImageResource()\n {\n // We are currently using vips_image_new_from_file(), but we could consider\n // calling vips_jpegload / vips_pngload instead\n $result = /** @scrutinizer ignore-call */ vips_image_new_from_file($this->source, []);\n if ($result === -1) {\n /*throw new ConversionFailedException(\n 'Failed creating new vips image from file: ' . $this->source\n );*/\n $message = /** @scrutinizer ignore-call */ vips_error_buffer();\n throw new ConversionFailedException($message);\n }\n\n if (!is_array($result)) {\n throw new ConversionFailedException(\n 'vips_image_new_from_file did not return an array, which we expected'\n );\n }\n\n if (count($result) != 1) {\n throw new ConversionFailedException(\n 'vips_image_new_from_file did not return an array of length 1 as we expected ' .\n '- length was: ' . count($result)\n );\n }\n\n $im = array_shift($result);\n return $im;\n }", "public function createImage3(){\n $this->triangleCreate(240, 100, 290, 50, 340, 100);\n $this->triangleCreate(40, 300, 90, 250, 140, 300);\n $this->triangleCreate(440, 300, 490, 250, 540, 300);\n $this->createLine(265, 100, 105, 265);\n $this->createLine(315, 100, 475, 265);\n $this->createLine(125, 285, 455, 285);\n $this->generateImage();\n }", "function create_thumb($type, $image){\r\n\techo $source_path=DIR_FS_SITE.'upload/photo/'.$type.'/large/'.$image;\r\n\techo $destination_path=DIR_FS_SITE.'upload/photo/'.$type.'/thumb/'.$image;\r\n\tlist($width, $height) = getimagesize($source_path);\r\n $xscale=$width/THUMB_WIDTH;\r\n $yscale=$height/THUMB_HEIGHT;\r\n \r\n // Recalculate new size with default ratio\r\n if ($yscale>$xscale){\r\n $new_width = round($width * (1/$yscale));\r\n $new_height = round($height * (1/$yscale));\r\n }\r\n else {\r\n $new_width = round($width * (1/$xscale));\r\n $new_height = round($height * (1/$xscale));\r\n }\r\n\r\n // Resize the original image & output\r\n $imageResized = imagecreatetruecolor($new_width, $new_height);\r\n\r\n #check image format and create image\r\n if(strtolower(substr($source_path, -3))=='jpg'):\r\n $imageTmp = imagecreatefromjpeg ($source_path);\r\n elseif(strtolower(substr($source_path, -3))=='gif'):\r\n $imageTmp = imagecreatefromgif($source_path);\r\n elseif(strtolower(substr($source_path, -3))=='png'):\r\n $imageTmp = imagecreatefrompng($source_path);\r\n endif;\r\n\r\n imagecopyresampled($imageResized, $imageTmp, 0, 0, 0, 0, $new_width, $new_height, $width, $height);\r\n output_img($imageResized, image_type_to_mime_type(getimagesize($source_path)), $destination_path);\r\n}", "public function ImageCreateForOffline($img)\n {\n list($width,$height)=getimagesize($img);\n //list($width,$height)=getimagesize(\"images/imagesevice/photoframe_bg.png\");\n $img1 = ImageCreateFromJpeg($img); \n $bg = ImageCreateFromPng(\"images/imagesevice/photoframe_bg.png\"); \n //如果图片是横的 旋转90度\n if($width > $height) {\n $img1 = imagerotate($img1, 270, 0);\n imagecopyresized($bg,$img1,13,150,0,0,720,1075,$height,$width); \n }else{\n imagecopyresized($bg,$img1,13,150,0,0,720,1075,$width,$height); \n }\n \n //$logo = ImageCreateFromPng(\"images/imagesevice/logo.png\"); \n //imagecopyresized($bg,$logo,13,10,0,0,641,29,641,29); \n \n //header(\"content-type: image/jpeg\");\n $fs = new Filesystem();\n if(!$fs->exists($this->_filedir . '/Offline'))\n $fs->mkdir($this->_filedir . '/Offline', 0700);\n $fileName = '/Offline/' . time() . rand(100,999) . '.jpg';\n $hechengImg = $this->_filedir . $fileName;\n ImageJpeg($bg,$hechengImg);\n return $fileName;\n }", "function copyAndCreateThumb( $sDestDir, $mImgSrc, $sImgOutput, $sOption = null ){\n\n // zapamietanie wielkosci dla miniaturek\n $iOldSize = $this->iThumbX;\n\n if( !is_dir( $sDestDir ) )\n return null;\n\n $sImgOutput = $this->throwNameOfFile( $sImgOutput );\n\n $sImgOutput = $this->changeFileName( $sImgOutput );\n\n if( $sOption == 'upload' ){\n if( is_uploaded_file( $mImgSrc['tmp_name'] ) && is_file( $mImgSrc['tmp_name'] ) && filesize( $mImgSrc['tmp_name'] ) > 0 && $this->checkCorrectFile( $mImgSrc['name'], 'jpg|jpeg|gif|png' ) == 1 ){\n $this->sExt = $this->throwExtOfFile( $mImgSrc['name'] );\n $aNewFiles['bFile'] = $this->uploadFile( $mImgSrc, $sDestDir, $sImgOutput.'.'.$this->sExt );\n }\n else\n return null;\n }\n elseif( $sOption == 'copy' ){\n if( is_file( $mImgSrc ) && filesize( $mImgSrc ) > 0 && $this->checkCorrectFile( $mImgSrc, 'jpg|jpeg|gif|png' ) == 1 ){\n $this->sExt = $this->throwExtOfFile( $mImgSrc );\n $aNewFiles['bFile'] = $this->checkIsFile( $sImgOutput.'.'.$this->sExt, $sDestDir, $this->sExt );\n if( !copy( $mImgSrc, $sDestDir.$aNewFiles['bFile'] ) )\n return null;\n }\n else\n return null;\n }\n $sImgPatch = $sDestDir.$aNewFiles['bFile'];\n\n $aNewFiles['bName'] = basename( $aNewFiles['bFile'], '.'.$this->sExt );\n $aNewFiles['sFile'] = $aNewFiles['bName'] . $this->iThumbAdd . '.' . $this->sExt;\n $aImgSize = $this->throwImgSize( $sImgPatch );\n\n if( defined( 'MAX_DIMENSION_OF_IMAGE' ) && ( $aImgSize['width'] > MAX_DIMENSION_OF_IMAGE || $aImgSize ['height'] > MAX_DIMENSION_OF_IMAGE ) ){\n if( $aImgSize['width'] < $this->iMaxForThumbSize && $aImgSize ['height'] < $this->iMaxForThumbSize ){\n $iOldAdd = $this->iThumbAdd;\n $this->setThumbSize( MAX_DIMENSION_OF_IMAGE );\n $this->setThumbAdd( '' );\n $aNewFiles['bFile'] = $this->createThumb( $sImgPatch, $sDestDir, $aNewFiles['bFile'] );\n $this->setThumbSize( $iOldSize );\n $this->setThumbAdd( $iOldAdd );\n }\n else\n return null;\n }\n \n if( $aImgSize['width'] >= $this->iThumbX || $aImgSize['height'] >= $this->iThumbX ){\n if( $aImgSize['width'] < $this->iMaxForThumbSize && $aImgSize ['height'] < $this->iMaxForThumbSize )\n $aNewFiles['sFile'] = $this->createThumb( $sImgPatch, $sDestDir );\n else\n return null;\n }\n else\n copy( $sImgPatch, $sDestDir.$aNewFiles['sFile'] );\n\n $aNewFiles['bWidth'] = $aImgSize['width'];\n $aNewFiles['bHeight'] = $aImgSize['height'];\n $aNewFiles['sWidth'] = $this->iThumbX;\n $aNewFiles['sHeight'] = $this->iThumbY;\n $aNewFiles['sName'] = basename( $aNewFiles['sFile'], '.'.$this->sExt );\n $aNewFiles['ext'] = $this->sExt;\n\n $this->iThumbY = 100;\n $this->setThumbSize( $iOldSize );\n\n return $aNewFiles;\n }", "public function generate($config)\n {\n // phpcs:disable Magento2.Functions.DiscouragedFunction\n $binaryData = '';\n $data = str_split(sha1($config['image-name']), 2);\n foreach ($data as $item) {\n $binaryData .= base_convert($item, 16, 2);\n }\n $binaryData = str_split($binaryData, 1);\n\n $image = imagecreate($config['image-width'], $config['image-height']);\n $bgColor = imagecolorallocate($image, 240, 240, 240);\n // mt_rand() here is not for cryptographic use.\n // phpcs:ignore Magento2.Security.InsecureFunction\n $fgColor = imagecolorallocate($image, mt_rand(0, 230), mt_rand(0, 230), mt_rand(0, 230));\n $colors = [$fgColor, $bgColor];\n imagefilledrectangle($image, 0, 0, $config['image-width'], $config['image-height'], $bgColor);\n\n for ($row = 10; $row < ($config['image-height'] - 10); $row += 10) {\n for ($col = 10; $col < ($config['image-width'] - 10); $col += 10) {\n if (next($binaryData) === false) {\n reset($binaryData);\n }\n\n imagefilledrectangle($image, $row, $col, $row + 10, $col + 10, $colors[current($binaryData)]);\n }\n }\n\n $mediaDirectory = $this->filesystem->getDirectoryWrite(DirectoryList::MEDIA);\n $relativePathToMedia = $mediaDirectory->getRelativePath($this->mediaConfig->getBaseTmpMediaPath());\n $mediaDirectory->create($relativePathToMedia);\n\n $imagePath = $relativePathToMedia . DIRECTORY_SEPARATOR . $config['image-name'];\n $imagePath = preg_replace('|/{2,}|', '/', $imagePath);\n $memory = fopen('php://memory', 'r+');\n if(!imagejpeg($image, $memory)) {\n throw new \\Exception('Could not create picture ' . $imagePath);\n }\n $mediaDirectory->writeFile($imagePath, stream_get_contents($memory, -1, 0));\n fclose($memory);\n imagedestroy($image);\n // phpcs:enable\n\n return $imagePath;\n }", "function createThumb($path1, $path2, $file_type, $new_w, $new_h, $squareSize = ''){\n\t$source_image = FALSE;\n\t\n\tif (preg_match(\"/jpg|JPG|jpeg|JPEG/\", $file_type)) {\n\t\t$source_image = imagecreatefromjpeg($path1);\n\t}\n\telseif (preg_match(\"/png|PNG/\", $file_type)) {\n\t\t\n\t\tif (!$source_image = @imagecreatefrompng($path1)) {\n\t\t\t$source_image = imagecreatefromjpeg($path1);\n\t\t}\n\t}\n\telseif (preg_match(\"/gif|GIF/\", $file_type)) {\n\t\t$source_image = imagecreatefromgif($path1);\n\t}\t\t\n\tif ($source_image == FALSE) {\n\t\t$source_image = imagecreatefromjpeg($path1);\n\t}\n\n\t$orig_w = imageSX($source_image);\n\t$orig_h = imageSY($source_image);\n\t\n\tif ($orig_w < $new_w && $orig_h < $new_h) {\n\t\t$desired_width = $orig_w;\n\t\t$desired_height = $orig_h;\n\t} else {\n\t\t$scale = min($new_w / $orig_w, $new_h / $orig_h);\n\t\t$desired_width = ceil($scale * $orig_w);\n\t\t$desired_height = ceil($scale * $orig_h);\n\t}\n\t\t\t\n\tif ($squareSize != '') {\n\t\t$desired_width = $desired_height = $squareSize;\n\t}\n\n\t/* create a new, \"virtual\" image */\n\t$virtual_image = imagecreatetruecolor($desired_width, $desired_height);\n\t// for PNG background white----------->\n\t$kek = imagecolorallocate($virtual_image, 255, 255, 255);\n\timagefill($virtual_image, 0, 0, $kek);\n\t\n\tif ($squareSize == '') {\n\t\t/* copy source image at a resized size */\n\t\timagecopyresampled($virtual_image, $source_image, 0, 0, 0, 0, $desired_width, $desired_height, $orig_w, $orig_h);\n\t} else {\n\t\t$wm = $orig_w / $squareSize;\n\t\t$hm = $orig_h / $squareSize;\n\t\t$h_height = $squareSize / 2;\n\t\t$w_height = $squareSize / 2;\n\t\t\n\t\tif ($orig_w > $orig_h) {\n\t\t\t$adjusted_width = $orig_w / $hm;\n\t\t\t$half_width = $adjusted_width / 2;\n\t\t\t$int_width = $half_width - $w_height;\n\t\t\timagecopyresampled($virtual_image, $source_image, -$int_width, 0, 0, 0, $adjusted_width, $squareSize, $orig_w, $orig_h);\n\t\t}\n\n\t\telseif (($orig_w <= $orig_h)) {\n\t\t\t$adjusted_height = $orig_h / $wm;\n\t\t\t$half_height = $adjusted_height / 2;\n\t\t\timagecopyresampled($virtual_image, $source_image, 0,0, 0, 0, $squareSize, $adjusted_height, $orig_w, $orig_h);\n\t\t} else {\n\t\t\timagecopyresampled($virtual_image, $source_image, 0, 0, 0, 0, $squareSize, $squareSize, $orig_w, $orig_h);\n\t\t}\n\t}\n\t\n\tif (@imagejpeg($virtual_image, $path2, 90)) {\n\t\timagedestroy($virtual_image);\n\t\timagedestroy($source_image);\n\t\treturn TRUE;\n\t} else {\n\t\treturn FALSE;\n\t}\n}", "function quota_new_image($image) {\n\tglobal $_zp_current_admin_obj;\n\tif (is_object($_zp_current_admin_obj)) {\n\t\t$image->set('owner',$_zp_current_admin_obj->getUser());\n\t}\n\t$image->set('filesize',filesize($image->localpath));\n\t$image->save();\n\treturn $image;\n}", "function create_medium($type, $image){\r\n\techo $source_path=DIR_FS_SITE.'upload/photo/'.$type.'/large/'.$image;\r\n\techo $destination_path=DIR_FS_SITE.'upload/photo/'.$type.'/medium/'.$image;\r\n\tlist($width, $height) = getimagesize($source_path);\r\n $xscale=$width/MEDIUM_WIDTH;\r\n $yscale=$height/MEDIUM_HEIGHT;\r\n \r\n // Recalculate new size with default ratio\r\n if ($yscale>$xscale){\r\n $new_width = round($width * (1/$yscale));\r\n $new_height = round($height * (1/$yscale));\r\n }\r\n else {\r\n $new_width = round($width * (1/$xscale));\r\n $new_height = round($height * (1/$xscale));\r\n }\r\n\r\n #check image format and create image\r\n if(strtolower(substr($source_path, -3))=='jpg'):\r\n $imageTmp = imagecreatefromjpeg ($source_path);\r\n elseif(strtolower(substr($source_path, -3))=='gif'):\r\n $imageTmp = imagecreatefromgif($source_path);\r\n elseif(strtolower(substr($source_path, -3))=='png'):\r\n $imageTmp = imagecreatefrompng($source_path);\r\n endif;\r\n\r\n // Resize the original image & output\r\n $imageResized = imagecreatetruecolor($new_width, $new_height);\r\n # $imageTmp = imagecreatefromjpeg ($source_path);\r\n imagecopyresampled($imageResized, $imageTmp, 0, 0, 0, 0, $new_width, $new_height, $width, $height);\r\n output_img($imageResized, image_type_to_mime_type(getimagesize($source_path)), $destination_path);\r\n}", "public function createImage2(){\n $this->createCircle(100, 100, 50, 50, 0, 360);\n $this->createCircle(400, 100, 50, 50, 0, 360);\n $this->createCircle(110, 200, 50, 50, 0, 360);\n $this->createCircle(250, 300, 50, 50, 0, 360);\n $this->createCircle(390, 200, 50, 50, 0, 360);\n $this->createLine(125, 100, 375, 100);\n $this->createLine(100, 125, 100, 175);\n $this->createLine(400, 125, 400, 175);\n $this->createLine(125, 220, 225, 300);\n $this->createLine(275, 300, 375, 220);\n $this->generateImage();\n }", "private function createWorkingImageResource($pathToSourceFile)\n {\n switch($this->type)\n {\n case 'image/jpg':\n case 'image/jpeg':\n $this->workingImageResource = imagecreatefromjpeg($pathToSourceFile);\n break;\n\n case 'image/png':\n $this->workingImageResource = imagecreatefrompng($pathToSourceFile);\n break;\n }\n }", "function createThumb($path1, $path2, $file_type, $new_w, $new_h, $squareSize = '')\n {\n $source_image = FALSE;\n \n if (preg_match(\"/jpg|JPG|jpeg|JPEG/\", $file_type)) {\n $source_image = imagecreatefromjpeg($path1);\n }\n elseif (preg_match(\"/png|PNG/\", $file_type)) {\n \n if (!$source_image = @imagecreatefrompng($path1)) {\n $source_image = imagecreatefromjpeg($path1);\n }\n }\n elseif (preg_match(\"/gif|GIF/\", $file_type)) {\n $source_image = imagecreatefromgif($path1);\n }\t\t\n if ($source_image == FALSE) {\n $source_image = imagecreatefromjpeg($path1);\n }\n\n $orig_w = imageSX($source_image);\n $orig_h = imageSY($source_image);\n \n if ($orig_w < $new_w && $orig_h < $new_h) {\n $desired_width = $orig_w;\n $desired_height = $orig_h;\n } else {\n $scale = min($new_w / $orig_w, $new_h / $orig_h);\n $desired_width = ceil($scale * $orig_w);\n $desired_height = ceil($scale * $orig_h);\n }\n \n if ($squareSize != '') {\n $desired_width = $desired_height = $squareSize;\n }\n\n /* create a new, \"virtual\" image */\n $virtual_image = imagecreatetruecolor($desired_width, $desired_height);\n // for PNG background white----------->\n $kek = imagecolorallocate($virtual_image, 255, 255, 255);\n imagefill($virtual_image, 0, 0, $kek);\n \n if ($squareSize == '') {\n /* copy source image at a resized size */\n imagecopyresampled($virtual_image, $source_image, 0, 0, 0, 0, $desired_width, $desired_height, $orig_w, $orig_h);\n } else {\n $wm = $orig_w / $squareSize;\n $hm = $orig_h / $squareSize;\n $h_height = $squareSize / 2;\n $w_height = $squareSize / 2;\n \n if ($orig_w > $orig_h) {\n $adjusted_width = $orig_w / $hm;\n $half_width = $adjusted_width / 2;\n $int_width = $half_width - $w_height;\n imagecopyresampled($virtual_image, $source_image, -$int_width, 0, 0, 0, $adjusted_width, $squareSize, $orig_w, $orig_h);\n }\n\n elseif (($orig_w <= $orig_h)) {\n $adjusted_height = $orig_h / $wm;\n $half_height = $adjusted_height / 2;\n imagecopyresampled($virtual_image, $source_image, 0,0, 0, 0, $squareSize, $adjusted_height, $orig_w, $orig_h);\n } else {\n imagecopyresampled($virtual_image, $source_image, 0, 0, 0, 0, $squareSize, $squareSize, $orig_w, $orig_h);\n }\n }\n \n \n $img_size=filesize($virtual_image);\n $quality=90;\n if($img_size>= 2097152)\n {\n $quality= 50;\n }\n else if($img_size<= 2097152 && $img_size>= 1048576)\n {\n $quality= 70;\n }\n\n if (@imagejpeg($virtual_image, $path2, $quality)) {\n imagedestroy($virtual_image);\n imagedestroy($source_image);\n return TRUE;\n } else {\n return FALSE;\n }\n }", "function image_return_write($im, $write_to_abspath)\n{\n $return = $im->writeImage($write_to_abspath);\n $im->clear();\n $im->destroy();\n return $return;\n}", "function createThumbnail($image)\n {\n $width = $height = 200;\n ini_set('memory_limit', '1024M');\n set_time_limit(120);\n $image_src = imagecreatefromjpeg(CONFIG_DIR.'/content/images/uncropped/'.$image['src'])\n or $this->reportError('cms/model/edit_input createThumbnail. Problem with imagecreatefromjpeg');\n $image_dst = imagecreatetruecolor($width, $height)\n or $this->reportError('cms/model/edit_input createThumbnail. Problem with imagecreatetruecolor');\n imagecopyresampled ($image_dst, $image_src, 0, 0, $image['sx1'], $image['sy1'], $width, $height,($image['sx2'] - $image['sx1']), ($image['sy2'] - $image['sy1']))\n or $this->reportError('cms/model/edit_input createThumbnail. Problem with imagecopyresampled');\n imagejpeg($image_dst, CONFIG_DIR.'/content/images/thumbnail/'.$image['src'] , 90)\n or $this->reportError('cms/model/edit_input createThumbnail. Problem with imagejpeg');\n imagedestroy($image_dst);\n }", "private function generateThumbnailGD(){\n\t\t\n\t}", "public function SaveWithImage($strTemporaryFilePath) {\n\t\t\t$arrValues = getimagesize($strTemporaryFilePath);\n\t\t\tif (!$arrValues || !count($arrValues) || !$arrValues[0] || !$arrValues[1] || !$arrValues[2])\n\t\t\t\tthrow new QCallerException('Not a valid image file: ' . $strTemporaryFilePath);\n\n\t\t\t// Update image metadata info\n\t\t\tswitch ($arrValues[2]) {\n\t\t\t\tcase IMAGETYPE_JPEG:\n\t\t\t\t\t$this->intImageFileTypeId = ImageFileType::Jpeg;\n\t\t\t\t\tbreak;\n\t\t\t\tcase IMAGETYPE_PNG:\n\t\t\t\t\t$this->intImageFileTypeId = ImageFileType::Png;\n\t\t\t\t\tbreak;\n\t\t\t\tcase IMAGETYPE_GIF:\n\t\t\t\t\t$this->intImageFileTypeId = ImageFileType::Gif;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new QCallerException('Not a valid image file: ' . $strTemporaryFilePath);\n\t\t\t}\n\n\t\t\t$this->Save();\n\n\t\t\tQApplication::MakeDirectory($this->GetImageFolder(), 0777);\n\t\t\tcopy($strTemporaryFilePath, $this->GetImagePath());\n\t\t\tchmod($this->GetImagePath(), 0666);\n\t\t}", "public function create()\n {\n return $this->imageFactory->create();\n }", "private function create_image( $file_index, $size = null, $type = null, $allowGrowth = false ) {\r\n\t\t\t// create an image resource from the original image\r\n\t\t\tswitch( $this->Files_ready[ $file_index ]['ext'] ) {\r\n\t\t\t\tcase 'jpg': { $image = imagecreatefromjpeg( $this->Files_ready[ $file_index ]['path'] ); } break;\r\n\t\t\t\tcase 'gif': { $image = imagecreatefromgif( $this->Files_ready[ $file_index ]['path'] ); } break;\r\n\t\t\t\tcase 'png': { $image = imagecreatefrompng( $this->Files_ready[ $file_index ]['path'] ); } break;\r\n\t\t\t\tcase 'gd': { $image = imagecreatefromgd( $this->Files_ready[ $file_index ]['path'] ); } break;\r\n\t\t\t\tcase 'gd2': { $image = imagecreatefromgd2( $this->Files_ready[ $file_index ]['path'] ); } break;\r\n\t\t\t\tcase 'bmp': { $image = imagecreatefrombmp( $this->Files_ready[ $file_index ]['path'] ); } break;\r\n\t\t\t\tcase 'wbmp': { $image = imagecreatefromwbmp( $this->Files_ready[ $file_index ]['path'] ); } break;\r\n\t\t\t\tcase 'webp': { $image = imagecreatefromwebp( $this->Files_ready[ $file_index ]['path'] ); } break;\r\n\t\t\t\tcase 'xbm': { $image = imagecreatefromxbm( $this->Files_ready[ $file_index ]['path'] ); } break;\r\n\t\t\t\tdefault: throw new Exception( 'GD extension cannot create an image from this image type (\"' . htmlspecialchars( $this->Files_ready[ $file_index ]['ext'] ) . '\")' );\r\n\t\t\t}\r\n\r\n\t\t\tif ( $size && $type !== null ) {\r\n\t\t\t\t$image_width = imagesx( $image );\r\n\t\t\t\t$image_height = imagesy( $image );\r\n\t\t\t\t\r\n\t\t\t\t// get the settings for the thumb image creation\r\n\t\t\t\t$settings = self::generate_thumbsettings( $image_width, $image_height, $size, $type, $allowGrowth );\r\n\r\n\t\t\t\t// settings return false if the destination $size is bigger than the original image\r\n\t\t\t\tif ( $settings ) {\r\n\t\t\t\t\t// create a new empty image\r\n\t\t\t\t\t$new_image = imagecreatetruecolor( $settings['dst_width'], $settings['dst_height'] );\r\n\t\t\t\t\tif ( $this->Files_ready[ $file_index ]['ext'] !== 'jpg' ) {\r\n\t\t\t\t\t\t// create an alpha canal for the image and set the background to fully transparent\r\n\t\t\t\t\t\timagecolortransparent( $new_image, imagecolorallocatealpha( $new_image, 0, 0, 0, 127 ) );\r\n\t\t\t\t\t\timagealphablending( $new_image, false );\r\n\t\t\t\t\t\timagesavealpha( $new_image, true );\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\timagecopyresampled(\r\n\t\t\t\t\t\t$new_image, $image,\t\t\t\t\t\t\t\t\t//\tdst_image,\tsrc_image,\r\n\t\t\t\t\t\t0, 0,\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//\tdst_x,\t\t\tdst_y,\r\n\t\t\t\t\t\t$settings['x'], $settings['y'],\t\t\t\t\t\t\t\t//\tsrc_x,\t\t\tsrc_y,\r\n\t\t\t\t\t\t$settings['dst_width'], $settings['dst_height'],\t//\tdst_w,\t\t\tdst_h,\r\n\t\t\t\t\t\t$settings['src_width'], $settings['src_height']\t\t//\tsrc_w,\t\t\tsrc_h\r\n\t\t\t\t\t);\r\n\t\t\t\t\t\r\n\t\t\t\t\t// destroy the image ressource to free the ram\r\n\t\t\t\t\timagedestroy( $image );\r\n\t\t\t\t\t\r\n\t\t\t\t\treturn $new_image;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn $image;\r\n\t\t}", "public function output_image()\n {\n if (empty($this->tmp_img)) {\n if ( ! $this->SILENT_MODE) {\n trigger_error('No temporary image for resizing!', E_USER_WARNING);\n }\n return false;\n }\n header('Content-Type: image/' . $this->output_type);\n $this->_set_new_size_auto();\n if ($this->output_width != $this->source_width || $this->output_height != $this->source_height || $this->output_type != $this->source_type) {\n $this->tmp_resampled = imagecreatetruecolor($this->output_width, $this->output_height);\n imagecopyresampled($this->tmp_resampled, $this->tmp_img, 0, 0, 0, 0, $this->output_width, $this->output_height, $this->source_width, $this->source_height);\n }\n $func_name = 'image' . $this->output_type;\n strlen($this->output_type) ? $func_name($this->tmp_resampled) : null;\n return true;\n }", "public function generateBlankImage($config){ \n\t\t$image = imagecreatetruecolor($config['img_width'], $config['img_height']);\n\t\timagesavealpha($image, true);\n\t\t$transparent = imagecolorallocatealpha($image, 0, 0, 0, 127);\n\t\timagefill($image, 0, 0, $transparent);\n\t\t// cache the output\n\t\tob_start();\n\t\timagepng($image);\n\t\t$img = ob_get_contents();\n\t\tob_end_clean();\n\t\t// return the string\n\t\treturn base64_encode($img);\n\t}", "function create_thumb($src, $dest, $desired_width) {\n\t\t$source_image = imagecreatefromjpeg($src);\n\t\t$width = imagesx($source_image);\n\t\t$height = imagesy($source_image);\n\n\t\t/* find the \"desired height\" of this thumbnail, relative to the desired width */\n\t\t$desired_height = floor($height * ($desired_width / $width));\n\n\t\t/* create a new, \"virtual\" image */\n\t\t$virtual_image = imagecreatetruecolor($desired_width, $desired_height);\n\n\t\t/* copy source image at a resized size */\n\t\timagecopyresampled($virtual_image, $source_image, 0, 0, 0, 0, $desired_width, $desired_height, $width, $height);\n\n\t\t/* create the physical thumbnail image to its destination */\n\t\timagejpeg($virtual_image, $dest);\n\t}", "public function save($output_file = '')\n {\n if (empty($this->tmp_img)) {\n if ( ! $this->SILENT_MODE) {\n trigger_error('No temporary image for resizing!', E_USER_WARNING);\n }\n return false;\n }\n $this->_set_new_size_auto();\n // Detect if need to resize image (if something has changed)\n if (\n $this->output_width != $this->source_width\n || $this->output_height != $this->source_height\n || $this->output_type != $this->source_type\n || $this->force_process\n ) {\n $this->tmp_resampled = imagecreatetruecolor($this->output_width, $this->output_height);\n if ( ! $this->tmp_resampled) {\n return false;\n }\n // png transparency\n if ($this->source_type == 'png' && $this->output_type == 'jpeg') {\n $bg_img = imagecreatetruecolor($this->source_width, $this->source_height);\n $bg = imagecolorallocate($bg_img, $this->BACKGROUND_COLOR[0], $this->BACKGROUND_COLOR[1], $this->BACKGROUND_COLOR[2]);\n imagefilledrectangle($bg_img, 0, 0, $this->source_width, $this->source_height, $bg);\n imagecopy($bg_img, $this->tmp_img, 0, 0, 0, 0, $this->source_width, $this->source_height);\n $this->tmp_img = $bg_img;\n }\n imagecopyresampled($this->tmp_resampled, $this->tmp_img, 0, 0, 0, 0, $this->output_width, $this->output_height, $this->source_width, $this->source_height);\n $func_name = 'image' . $this->output_type;\n $thumb_quality = defined('THUMB_QUALITY') ? THUMB_QUALITY : 85;\n if ($this->output_type == 'png') {\n $thumb_quality = $thumb_quality / 10;\n }\n strlen($this->output_type) ? $func_name($this->tmp_resampled, $output_file, $thumb_quality) : null;\n imagedestroy($this->tmp_resampled);\n } else {\n if ($this->source_file != $output_file) {\n $out_dir = dirname($output_file);\n if ( ! file_exists($out_dir)) {\n mkdir($out_dir, 0755, $recursive = true);\n }\n copy($this->source_file, $output_file);\n }\n }\n return true;\n }", "function ImageCreateFromBmp($filename)\n{\n $tmp_name = tempnam(\"/tmp\", \"GD\");\n /*** convert to gd ***/\n if (bmp2gd($filename, $tmp_name))\n {\n /*** create new image ***/\n $img = imagecreatefromgd($tmp_name);\n /*** remove temp file ***/\n unlink($tmp_name);\n /*** return the image ***/\n return $img;\n } else {\n \techo 'not a valid bmp';\n }\n return false;\n}", "public function GetImage($type=NULL){\r\n\t\t$GTemp=$this->GTemp;\r\n\t\tif ($type!=NULL){\r\n\t\t\t$hndl=imagecreatefromjpeg(GTemplate::GetPath($GTemp->id).DS.$type.\".jpg\");\r\n\t\t\t$width=$this->width;\r\n\t\t\t$height=$this->height;\r\n\t\t\t$hndl_dest=imagecreatetruecolor($width,$height);\r\n\t\t\timagecopy($hndl_dest,$hndl,0,0,$this->x1,$this->y1,$this->width,$this->height);\r\n\t\t\treturn $hndl_dest;\r\n\t\t}\r\n\t\t$types=$this->WidgetClass()->Types();\r\n\t\t$hndl=imagecreatefromjpeg(GTemplate::GetPath($GTemp->id).DS.$types[0].\".jpg\");\r\n\t\t$width=(sizeof($types))*($this->width);\r\n\t\t$height=$this->height;\r\n\t\t$hndl_dest=imagecreatetruecolor($width,$height);\r\n\t\timagecopy($hndl_dest,$hndl,0,0,$this->x1,$this->y1,$this->width,$this->height);\r\n\t\t$counter=0;\r\n\t\tif ($types!=''){\r\n\t\t\tforeach ($types as $index => $val){\r\n\t\t\t\tif ($index==0) continue;\r\n\t\t\t\t$counter++;\r\n\t\t\t\timagedestroy($hndl);\r\n\t\t\t\t$hndl=imagecreatefromjpeg(GTemplate::GetPath($GTemp->id).DS.$val.\".jpg\");\r\n\t\t\t\timagecopymerge($hndl_dest,$hndl,($counter)*$this->width,0,\r\n\t\t\t\t\t$this->x1,$this->y1,$this->width,$this->height,100);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn $hndl_dest;\r\n\t}", "function generateImage($source_file, $cache_file, $quality)\n{\n\t$extension = strtolower(pathinfo($source_file, PATHINFO_EXTENSION));\n\n // Check the image dimensions\n $dimensions = GetImageSize($source_file);\n $width = $dimensions[0];\n $height = $dimensions[1];\n\t\n $dst = ImageCreateTrueColor($width, $height); // re-sized image\n\n\tswitch ($extension) {\n case 'png':\n $src = @ImageCreateFromPng($source_file); // original image\n break;\n case 'gif':\n $src = @ImageCreateFromGif($source_file); // original image\n break;\n default:\n $src = @ImageCreateFromJpeg($source_file); // original image\n ImageInterlace($dst, true); // Enable interlancing (progressive JPG, smaller size file)\n break;\n }\n\n if ($extension == 'png') {\n imagealphablending($dst, false);\n imagesavealpha($dst, true);\n $transparent = imagecolorallocatealpha($dst, 255, 255, 255, 127);\n imagefilledrectangle($dst, 0, 0, $width, $height, $transparent);\n }\n\n ImageCopyResampled($dst, $src, 0, 0, 0, 0, $width, $height, $width, $height); // do the resize in memory\n ImageDestroy($src);\n\n\tif(STAMPED)\n {\n $text_color = ImageColorAllocate($dst, 255, 255, 255);\n\t\timagettftext($dst, 40, 0, 10, 50, $text_color, '../font/coolvetica.ttf', 'Qualité : '.$quality);\n }\n\n $cache_dir = dirname($cache_file);\n\n // does the directory exist already?\n if (!is_dir($cache_dir)) {\n if (!mkdir($cache_dir, 0755, true)) {\n // check again if it really doesn't exist to protect against race conditions\n if (!is_dir($cache_dir)) {\n // uh-oh, failed to make that directory\n ImageDestroy($dst);\n sendErrorImage(\"Failed to create cache directory: $cache_dir\");\n }\n }\n }\n\n if (!is_writable($cache_dir)) {\n sendErrorImage(\"The cache directory is not writable: $cache_dir\");\n }\n\t\n // save the new file in the appropriate path, and send a version to the browser\n switch ($extension) {\n case 'png':\n $gotSaved = ImagePng($dst, $cache_file);\n break;\n case 'gif':\n $gotSaved = ImageGif($dst, $cache_file);\n break;\n default:\n $gotSaved = ImageJpeg($dst, $cache_file, $quality);\n break;\n }\n ImageDestroy($dst);\n\t\n if (!$gotSaved && !file_exists($cache_file)) {\t\n\t\tsendErrorImage(\"Failed to create image: $cache_file\");\n }\n\n return $cache_file;\n}", "private function createTemporaryFile()\n {\n return $this->temp[] = tempnam(sys_get_temp_dir(), 'sqon-');\n }", "protected function createTemporaryImage(UploadedFile $image)\n {\n $temporaryImageName = tempnam(_PS_TMP_IMG_DIR_, 'PS');\n\n if (!$temporaryImageName || !move_uploaded_file($image->getPathname(), $temporaryImageName)) {\n throw new ImageUploadException('Failed to create temporary image file');\n }\n\n return $temporaryImageName;\n }", "protected function createTemporaryImage(UploadedFile $image)\n {\n $temporaryImageName = tempnam(_PS_TMP_IMG_DIR_, 'PS');\n\n if (!$temporaryImageName || !move_uploaded_file($image->getPathname(), $temporaryImageName)) {\n throw new ImageUploadException('Failed to create temporary image file');\n }\n\n return $temporaryImageName;\n }", "function __copy(&$tmp_target, &$tmp_source, $destination_x, $destination_y) {\n\n\t\t// call `composite -geometry`\n\t\t//\n\t\t$cmd = $this->__command(\n\t\t\t'composite',\n\t\t\t\" -geometry {$tmp_source->image_width}x{$tmp_source->image_height}+{$destination_x}+{$destination_y} \"\n \t\t. escapeshellarg(realpath($tmp_source->source))\n \t\t. \" \"\n \t\t. escapeshellarg(realpath($tmp_target->target))\n \t\t. \" \"\n \t\t. escapeshellarg(realpath($tmp_target->target))\n \t);\n\n exec($cmd, $result, $errors);\n\t\treturn ($errors == 0);\n\t\t}", "function createThumbImg($aprox)\n {\n // imagem de origem\n $img_origem= $this->createImg();\n\n // obtm as dimenses da imagem original\n $origem_x= ImagesX($img_origem);\n $origem_y= ImagesY($img_origem);\n \n // obtm as dimenses do thumbnail\n $vetor= $this->getThumbXY($origem_x, $origem_y, $aprox);\n $x= $vetor['x'];\n $y= $vetor['y'];\n \n // cria a imagem do thumbnail\n $img_final = ImageCreateTrueColor($x, $y);\n ImageCopyResampled($img_final, $img_origem, 0, 0, 0, 0, $x+1, $y+1, $origem_x, $origem_y);\n // o arquivo gravado\n if ($this->ext == \"png\")\n imagepng($img_final, $this->destino);\n\t\telseif ($this->ext == \"gif\")\n imagegif($img_final, $this->destino);\n elseif ($this->ext == \"jpg\")\n imagejpeg($img_final, $this->destino);\n\t\t\telseif ($this->ext == \"bmp\")\n imagewbmp($img_final, $this->destino);\n }", "function createthumb($name,$filename,$new_w,$new_h) {\n $system=explode(\".\",$name);\n if (preg_match(\"/jpg|jpeg/\", $system[sizeof($system) - 1])) {\n $src_img=imagecreatefromjpeg($name);\n } else return;\n\n $old_x=imageSX($src_img);\n $old_y=imageSY($src_img);\n if ($old_x > $old_y) {\n $thumb_w=$new_w;\n $thumb_h=$old_y*($new_h/$old_x);\n }\n if ($old_x < $old_y) {\n $thumb_w=$old_x*($new_w/$old_y);\n $thumb_h=$new_h;\n }\n if ($old_x == $old_y) {\n $thumb_w=$new_w;\n $thumb_h=$new_h;\n }\n $dst_img=ImageCreateTrueColor($thumb_w,$thumb_h);\n imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y);\n echo imagejpeg($dst_img,$filename);\n\n imagedestroy($dst_img);\n imagedestroy($src_img);\n}", "private function generateThumbnailImagick(){\n\t}", "function createThumbs($imageUrl,$imgName){\n header(\"Content-type: image/jpg\");\n $SourceFile = $imageUrl . $imgName;\n $filename = $imageUrl . 'tn_' . $imgName;\n //letrehozom a thumb kepet\n // Load the image on which watermark is to be applied\n $originalImage = imagecreatefromjpeg($SourceFile);\n // Get original parameters\n list($originalWidth, $originalHeight, $original_type, $original_attr) = getimagesize($SourceFile);\n //eloallitjuk a thumbnailt, aminek a mérete 128*96\n $newWidth = 128;\n $newHeight = 96;\n $blankThumbImage = imagecreatetruecolor($newWidth, $newHeight);\n \n //a feltoltott kep 640*480 vagy 480*640\n //azt feltetelezzuk, hogy mindig ennyi\n //az oldalak aránya 0.75\n //ha 640*480\n if ($originalWidth > $originalHeight) {\n imagecopyresampled($blankThumbImage, $originalImage, 0, 0, 0, 0, $newWidth, $newHeight, $originalWidth, $originalHeight);\n }\n //ha 480*640\n if ($originalWidth < $originalHeight) {\n //levagom a tetejet es az aljat\n $newWidthT = $originalWidth;\n $newHeightT = $originalWidth * 0.75; //360\n $sy = ($originalHeight - $newHeightT) / 2;\n $tempImage = imagecreatetruecolor($newWidthT, $newHeightT);\n imagecopyresized($tempImage, $originalImage, 0, 0, 0, $sy, $newWidthT, $newHeightT , $originalWidth, $newHeightT);\n imagecopyresampled($blankThumbImage, $tempImage, 0, 0, 0, 0, $newWidth, $newHeight, $newWidthT, $newHeightT);\n }\n // elmentem a thumbnailt\n imagejpeg($blankThumbImage, $filename,100); //$SourceFile\n imagedestroy($blankThumbImage);\n \n}", "function make_thumb($folder, $file, $dest, $thumb_width)\n{\t\t\n\t$file_parts = pathinfo($file);\n\t//$filename = strtolower($file_parts['filename']);\n\t$ext = strtolower($file_parts['extension']);\n\t\n\tif(isset($ext) && $ext != '')\n\t{\t\n\t\tswitch($ext)\n\t\t{\n\t\t\tcase \"jpeg\":\t\t\n\t\t\tcase \"jpg\":\n\t\t\t$source_image = imagecreatefromjpeg($folder.'/'.$file);\n\t\t\tfixImageOrientation($folder.'/'.$file);\n\t\t\tbreak;\n\t\t\t\n\t\t\tcase \"png\":\n\t\t\t$source_image = imagecreatefrompng($folder.'/'.$file);\n\t\t\tbreak;\n\t\t\t\n\t\t\tcase \"gif\":\n\t\t\t$source_image = imagecreatefromgif($folder.'/'.$file);\n\t\t\tbreak;\n\t\t}\t\n\t\t\n\t\tif(isset($source_image))\n\t\t{\n\t\t\t$width = imagesx($source_image);\n\t\t\t$height = imagesy($source_image);\n\t\t\t\n\t\t\tif($width < $thumb_width) // if original image is smaller don't resize it\n\t\t\t{\n\t\t\t\t$thumb_width = $width;\n\t\t\t\t$thumb_height = $height;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$thumb_height = floor($height*($thumb_width/$width));\n\t\t\t}\n\t\t\t\n\t\t\t$virtual_image = imagecreatetruecolor($thumb_width,$thumb_height);\n\t\t\t\n\t\t\tif($ext == \"gif\" or $ext == \"png\") // preserve transparency\n\t\t\t{\n\t\t\t\timagecolortransparent($virtual_image, imagecolorallocatealpha($virtual_image, 0, 0, 0, 127));\n\t\t\t\timagealphablending($virtual_image, false);\n\t\t\t\timagesavealpha($virtual_image, true);\n\t\t\t}\n\t\t\t\n\t\t\timagecopyresampled($virtual_image,$source_image,0,0,0,0,$thumb_width,$thumb_height,$width,$height);\n\t\t\t\n\t\t\tswitch($ext)\n\t\t\t{\n\t\t\t\tcase 'jpeg':\t\t\t\t\n\t\t\t\tcase 'jpg': imagejpeg ($virtual_image, $dest);\n\t\t\t\tbreak;\n\t\t\t\t\n\t\t\t\tcase 'gif': imagegif($virtual_image, $dest); \n\t\t\t\tbreak;\n\t\t\t\t\n\t\t\t\tcase 'png': imagepng($virtual_image, $dest); \n\t\t\t\tbreak;\n\n\t\t\t}\n\t\t\t\n\t\t\timagedestroy($virtual_image); \n\t\t\timagedestroy($source_image);\n\t\t\t\n\t\t}\t\n\t\t\n\t}\t\n\t\n}", "function imageUploadThumb($temp_name, $type, $w, $h)\n {\n\n // $name = $_FILES[\"image_upload\"][\"name\"];\n // $size = $_FILES[\"image_upload\"][\"size\"];\n // $ext = end(explode(\".\", $_FILES[\"image_upload\"][\"name\"]));\n $allowed_ext = array(\"png\", \"jpg\", \"jpeg\");\n $random = rand(0, 999999999);\n $extension1 = explode(\".\", $type);\n $extension = end($extension1);\n $new_name = $random . \".\" . $extension;\n $new_image = '';\n // $new_name = md5(rand()) . '.' . $ext;\n $path = '../images/' . $new_name;\n list($width, $height) = getimagesize($temp_name);\n if ($extension == 'png') {\n $new_image = imagecreatefrompng($temp_name);\n }\n if ($extension == 'jpg' || $extension == 'jpeg') {\n $new_image = imagecreatefromjpeg($temp_name);\n }\n $new_width = $w;\n $new_height = $h;\n // $new_height = ($height / $width) * 200;\n $tmp_image = imagecreatetruecolor(\n $new_width,\n $new_height\n );\n imagecopyresampled(\n $tmp_image,\n $new_image,\n 0,\n 0,\n 0,\n 0,\n $new_width,\n $new_height,\n $width,\n $height\n );\n imagejpeg($tmp_image, $path, 100);\n imagedestroy($new_image);\n imagedestroy($tmp_image);\n // $img1 = $image['image']['name'];\n // $type = $image['image']['type'];\n\n // $temp = $image['image']['tmp_name'];\n // if (move_uploaded_file($temp_name, \"../images/$img\")) {\n return $new_name;\n // } else {\n // return false;\n // }\n $this->conn = null;\n }", "protected function doActualConvert()\n {\n/*\n $im = \\Jcupitt\\Vips\\Image::newFromFile($this->source);\n //$im->writeToFile(__DIR__ . '/images/small-vips.webp', [\"Q\" => 10]);\n\n $im->webpsave($this->destination, [\n \"Q\" => 80,\n //'near_lossless' => true\n ]);\n return;*/\n\n $im = $this->createImageResource();\n $options = $this->createParamsForVipsWebPSave();\n $this->webpsave($im, $options);\n }", "private function createImageResource()\n {\n // In case of failure, image will be false\n\n $mimeType = $this->getMimeTypeOfSource();\n\n if ($mimeType == 'image/png') {\n $image = imagecreatefrompng($this->source);\n if ($image === false) {\n throw new ConversionFailedException(\n 'Gd failed when trying to load/create image (imagecreatefrompng() failed)'\n );\n }\n return $image;\n }\n\n if ($mimeType == 'image/jpeg') {\n $image = imagecreatefromjpeg($this->source);\n if ($image === false) {\n throw new ConversionFailedException(\n 'Gd failed when trying to load/create image (imagecreatefromjpeg() failed)'\n );\n }\n return $image;\n }\n\n /*\n throw new InvalidInputException(\n 'Unsupported mime type:' . $mimeType\n );*/\n }", "public function setImage() {\n\t\t$target_dir = UPROOT;\n\t\t$target_name = basename($_FILES['image']['name']);\n\t\t$tmp_name = $_FILES['image']['tmp_name'];\n\t\t$target_file = UPROOT . \"\\\\public\" . \"\\\\img\\\\\" . $target_name;\n\t\t//just in case file already exist ill append time and date\n\t\t$timeStamp = date(\"Y-m-d_H:i:s\");\n\t\t//checking if file with the same name already exists\n\t\t$append = $this->clean($timeStamp);\n\t\tif (file_exists($target_file)) {\n\t\t\t//renaming the new file by exploding it\n\t\t\t$fileName = explode('.', $target_name);\n\t\t\t$target_name = $fileName[0] . '.' . $append . '.' . $fileName[1];\n\t\t\t//reassign the folder path\n\t\t\t$target_file = UPROOT . \"\\\\public\" . \"\\\\img\\\\\" . $target_name;\n\n\t\t}\n\t\t$imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION));\n\t\t$check = getimagesize($tmp_name);\n\t\t$size = $_FILES[\"image\"][\"size\"];\n\t\t$img = [\n\t\t\t'name' => $target_name,\n\t\t\t'fileType' => $imageFileType,\n\t\t\t'tmp_name' => $tmp_name,\n\t\t\t'target_file' => $target_file,\n\t\t\t'check' => $check,\n\t\t\t'size' => $size,\n\t\t];\n\t\treturn $img;\n\t}", "public function saveAsset()\n {\n if(!empty($this->uploadedFile))\n {\n // If file is exist -> remove him\n if(file_exists($this->getFilePath()))\n {\n unlink($this->getFilePath());\n }\n $this->genFilename();\n $imagine = Image::getImagine()->open($this->uploadedFile->tempName);\n }\n else\n {\n if(file_exists($this->getFilePath())) {\n $imagine = Image::getImagine()->open($this->getFilePath());\n } else return false;\n }\n\n $size = $imagine->getSize();\n $box = $this->getImageBox($size);\n\n if (($size->getWidth() <= $box->getWidth() && $size->getHeight() <= $box->getHeight()) || (!$box->getWidth() && !$box->getHeight())) {\n $widthDiff = abs($size->getWidth() - $box->getWidth()) / $size->getWidth();\n $heightDiff = abs($size->getHeight() - $box->getHeight()) / $size->getHeight();\n if($widthDiff > $heightDiff) {\n $resizeBox = new Box($box->getWidth(), $size->getHeight() * $box->getWidth()/$size->getWidth());\n } else {\n $resizeBox = new Box($size->getWidth() * $box->getHeight()/$size->getHeight(), $box->getHeight());\n }\n $imagine->resize($resizeBox);\n\n // var_dump($width);\n // var_dump($height);\n // die;\n // // $imagine->crop($point, $box);\n // $imagine->save($this->getFilePath());\n // return $this->save(false);\n }\n\n $imagine = $imagine->thumbnail($box, ManipulatorInterface::THUMBNAIL_OUTBOUND);\n $imagine->save($this->getFilePath());\n\n // create empty image to preserve aspect ratio of thumbnail\n // $thumb = Image::getImagine()->create($box, new Color('FFF', 100));\n\n // // calculate points\n // $startX = 0;\n // $startY = 0;\n // if ($size->getWidth() < $box->getWidth()) {\n // $startX = ceil($box->getWidth() - $size->getWidth()) / 2;\n // }\n // if ($size->getHeight() < $box->getHeight()) {\n // $startY = ceil($box->getHeight() - $size->getHeight()) / 2;\n // }\n\n // $thumb->paste($img, new Point($startX, $startY));\n // $thumb->save($this->getFilePath());\n\n return $this->save(false);\n }", "function _createThumbnail()\r\n\t{\r\n\t\t$user=$this->auth(PNH_EMPLOYEE);\r\n\t\t$config['image_library']= 'gd';\r\n\t\t$config['source_image']= './resources/employee_assets/image/';\r\n\t\t$config['create_thumb']= TRUE;\r\n\t\t$config['maintain_ratio']= TRUE;\r\n\t\t$config['width']= 75;\r\n\t\t$config['height']=75;\r\n\r\n\t\t$this->image_lib->initialize($config);\r\n\r\n\t\t$this->image_lib->resize();\r\n\r\n\t\tif(!$this->image_lib->resize())\r\n\t\t\techo $this->image_lib->display_errors();\r\n\t}", "protected function getTemporaryImageBasePath()\n\t{\n\t\t$basePath = $this->getImageBasePath();\n\n\t\t$temporaryPath = $basePath . '/'. $this->temporaryPath;\n\n\t\tif (!File::exists($temporaryPath)) {\n\t\t\tFile::makeDirectory($temporaryPath, 0755, true);\n\t\t}\n\n\t\treturn $temporaryPath;\n\t}", "public function dup() {\n return new Image($this);\n }", "public function makeTmpFileFromUpload() {\r\n if (is_uploaded_file($_FILES[$this->_name]['tmp_name'])) {\r\n $this->_tmpFile = $this->_tmpDir . DS . date(\"YmdHis\") . $this->_name . uniqid() . $_FILES[$this->_name]['name'];\r\n move_uploaded_file($_FILES[$this->_name]['tmp_name'], $this->_tmpFile);\r\n } else {\r\n return false;\r\n }\r\n }", "function storeUploadedFile($tmpFilePath){\r\n \r\n // gets the image type, reads first few bytes of image and returns int that represents jpg or png\r\n $imageTypeInt = exif_imagetype($tmpFilePath);\r\n \r\n // takes int and gets image extension\r\n $extension = image_type_to_extension($imageTypeInt);\r\n \r\n // gets the target directory for upload\r\n $target_dir = \"images/properties/\";\r\n \r\n // generates unique name for file based on microseconds of upload time\r\n // second param makes it more unique adds additional characters on end of returned value\r\n //eg \"/images/properties/8872791982.jpg\"\r\n $newImagePath = $target_dir . uniqid(\"prop\", true) . $extension;\r\n \r\n // takes current image path (in tmp folder) and puts it in new location newImagePath\r\n move_uploaded_file($tmpFilePath, $newImagePath);\r\n \r\n return $newImagePath;\r\n}", "function image_thubnil_create(array $FILE) {\n\n $filetmp = $FILE[\"file\"][\"tmp_name\"];\n\n #$filename = $FILE[\"file\"][\"name\"];\n\n #below two are for chanig the name of that image...\n $temp = explode(\".\", $FILE[\"file\"][\"name\"]);\n $filename = round(microtime(true)) . '.' . end($temp);\n\n $filetype = $FILE[\"file\"][\"type\"];\n $filesize = $FILE[\"file\"][\"size\"];\n $fileinfo = getimagesize($FILE[\"file\"][\"tmp_name\"]);\n $filewidth = $fileinfo[0];\n $fileheight = $fileinfo[1];\n $filepath = \"../../admin/assests/photos/\".$filename;\n $filepath_thumb = \"../../admin/assests/photos/thumbs/\".$filename;\n\n if($filetmp == \"\")\n {\n #echo \"please select a photo\";\n set_flush(TRUE, \"col-md-offset-3 col-md-4\", \"info\", \"please select a photo\");\n redirect(ADMIN_FOLDER_NAME.\"/profile/change_profile_picture.php\");\n }\n else\n {\n\n if($filesize > 10097152)\n {\n #echo \"photo > 10mb\";\n set_flush(TRUE, \"col-md-offset-3 col-md-4\", \"info\", \"photo > 10mb\");\n redirect(ADMIN_FOLDER_NAME.\"/profile/change_profile_picture.php\");\n }\n else\n {\n\n if($filetype != \"image/jpeg\" && $filetype != \"image/png\" && $filetype != \"image/gif\")\n {\n #echo \"Please upload jpg / png / gif\";\n set_flush(TRUE, \"col-md-offset-3 col-md-4\", \"info\", \"Please upload jpg / png / gif\");\n $this->redirect(ADMIN_FOLDER_NAME.\"/profile/change_profile_picture.php\");\n\n }\n else\n {\n try{\n move_uploaded_file($filetmp,$filepath);\n } catch(exception $e){\n echo \"image Upload Error \".$e;\n }\n if($filetype == \"image/jpeg\")\n {\n $imagecreate = \"imagecreatefromjpeg\";\n $imageformat = \"imagejpeg\";\n }\n if($filetype == \"image/png\")\n {\n $imagecreate = \"imagecreatefrompng\";\n $imageformat = \"imagepng\";\n }\n if($filetype == \"image/gif\")\n {\n $imagecreate= \"imagecreatefromgif\";\n $imageformat = \"imagegif\";\n }\n\n $new_width = \"400\";\n $new_height = \"400\";\n\n $image_p = imagecreatetruecolor($new_width, $new_height);\n $image = $imagecreate($filepath); //photo folder\n\n imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $filewidth, $fileheight);\n $imageformat($image_p, $filepath_thumb);//thumb folder\n\n /* echo \"<br/>\";\n echo $filename;\n echo \"<br/>\";\n echo $filepath;\n echo \"<br/>\";\n echo $filetype;*/\n\n $img_path =\"assests/photos/thumbs/\".$filename;\n\n #delete the original file...\n\n unlink($filepath);\n\n //echo \"<img src='\".$img_path.\"'>\";\n\n return $img_path;\n }\n\n }\n }\n\n}", "function create_watermark($source_file_path, $output_file_path)\r\n\t{\r\n\t\t$photo \t\t= imagecreatefromjpeg($source_file_path);\r\n\t\t$watermark \t= imagecreatefrompng($this->watermark_file);\r\n\t\t\r\n\t\t/* untuk mengatasi image dengan type png-24*/\r\n\t\timagealphablending($photo, true);\r\n\t\t\r\n\t\t$photo_x \t\t= imagesx($photo);\r\n\t\t$watermark_x \t= imagesx($watermark);\r\n\t\t$photo_y\t\t= imagesy($photo); \r\n\t\t$watermark_y\t= imagesy($watermark);\r\n\t\t\r\n\t\timagecopy($photo, $watermark, (($photo_x/2) - ($watermark_x/2)), (($photo_y/2) - ($watermark_y/2)), 0, 0, $watermark_x, $watermark_y);\r\n\t\timagejpeg($photo, $output_file_path, 100);\r\n\t}", "function imagecompress($source, $destination, $quality) {\r\n $info = getimagesize($source);\r\n if ($info['mime'] == 'image/jpeg')\r\n $image = imagecreatefromjpeg($source);\r\n elseif ($info['mime'] == 'image/gif')\r\n $image = imagecreatefromgif($source);\r\n elseif ($info['mime'] == 'image/png')\r\n $image = imagecreatefrompng($source);\r\n imagejpeg($image, $destination, $quality);\r\n unlink($source);\r\n return $destination;\r\n}", "protected function _create_cached()\n {\n if($this->url_params['c'])\n {\n // Resize to highest width or height with overflow on the larger side\n $this->image->resize($this->url_params['w'], $this->url_params['h'], Image::INVERSE);\n\n // Crop any overflow from the larger side\n $this->image->crop($this->url_params['w'], $this->url_params['h']);\n }\n else\n {\n // Just Resize\n $this->image->resize($this->url_params['w'], $this->url_params['h']);\n }\n\n // Apply any valid watermark params\n $watermarks = Arr::get($this->config, 'watermarks');\n if ( ! empty($watermarks))\n {\n foreach ($watermarks as $key => $watermark)\n {\n if (key_exists($key, $this->url_params))\n {\n $image = Image::factory($watermark['image']);\n $this->image->watermark($image, $watermark['offset_x'], $watermark['offset_y'], $watermark['opacity']);\n }\n }\n }\n\n // Save\n if($this->url_params['q'])\n {\n //Save image with quality param\n $this->image->save($this->cached_file, $this->url_params['q']);\n }\n else\n {\n //Save image with default quality\n $this->image->save($this->cached_file, Arr::get($this->config, 'quality', 80));\n }\n }", "protected function image_create($background = null)\r\n {\r\n // Check for GD2 support\r\n if ( ! \\function_exists('imagegd2') ) \\Core::show_500(\\__('captcha.requires_GD2'));\r\n\r\n // Create a new image (black)\r\n static::$image = \\imagecreatetruecolor(static::$config['width'], static::$config['height']);\r\n\r\n // Use a background image\r\n if ( !empty($background) )\r\n {\r\n /*\r\n // Create the image using the right function for the filetype\r\n $function = '\\\\imagecreatefrom' . static::image_type($filename);\r\n static::$background_image = $function($background);\r\n\r\n // Resize the image if needed\r\n if ( \\imagesx(static::background_image) !== static::$config['width'] || \\imagesy(static::background_image) !== static::$config['height'] )\r\n {\r\n \\imagecopyresampled(static::image, static::background_image, 0, 0, 0, 0, static::$config['width'], static::$config['height'], \\imagesx(static::background_image), \\imagesy(static::background_image));\r\n }\r\n\r\n // Free up resources\r\n \\imagedestroy(static::background_image);\r\n */\r\n }\r\n }", "private function createImage($model)\n {\n\n if ($model->image){\n\t\t\t\t$f = pathinfo($model->image->getName());\t\n\t\t\t\n $path = $_SERVER['DOCUMENT_ROOT'].'/application/uploads/';\n\t\t\t\t$prefix= (string)time();\n\t\t\t\t$name = $prefix.'_'.$f['filename'].'.'.$f['extension'];\n\t\t\t\t\n\t\t\t\t$fileName = $path.$name;\n\t\t\t\t$thumbName = $path.'thumb_'.$name;\n\t\t\t\n $model->image->saveAs($fileName)\t;\n\t\t\t\t$model->image= $name;\n\t\t\t\t$model->save();\n\t\t\t\t$imagevariables=getimagesize($fileName);\n\t\t\t\t$width_ = '112'; $wratio = $imagevariables[0]/$width_;\n\t\t\t\t$height_ = '80'; $hratio = $imagevariables[1]/$height_;\n\t\t\t\t\n\t\t\t\t$new_width = $width_;\n\t\t\t\t$new_height = $height_;\n\t\t\t\tif ($wratio<$hratio)\n\t\t\t\t\t$new_height = NULL;\n\t\t\t\telse\n\t\t\t\t\t$new_width = NULL;\n\t\t\t\t\t\t\t\t\n\t\t\t\t$image = new EasyImage($fileName);\n\t\t\t\t$image->resize($new_width, $new_height);\n\t\t\t\t$image->crop($width_, $height_);\n\t\t\t\t$image->save($thumbName);\n\t\t\t}\n\n\n\n\n }", "public function run() {\n\n // make enough memory available to scale bigger images\n ini_set('memory_limit', $this->thumb->options['memory']);\n \n // create the gd lib image object\n switch($this->thumb->image->mime()) {\n case 'image/jpeg':\n $image = @imagecreatefromjpeg($this->thumb->image->root()); \n break;\n case 'image/png':\n $image = @imagecreatefrompng($this->thumb->image->root()); \n break;\n case 'image/gif':\n $image = @imagecreatefromgif($this->thumb->image->root()); \n break;\n default:\n raise('The image mime type is invalid');\n break;\n } \n\n // check for a valid created image object\n if(!$image) raise('The image could not be created');\n\n // cropping stuff needs a couple more steps \n if($this->thumb->options['crop'] == true) {\n\n // Starting point of crop\n $startX = floor($this->thumb->tmp->width() / 2) - floor($this->thumb->result->width() / 2);\n $startY = floor($this->thumb->tmp->height() / 2) - floor($this->thumb->result->height() / 2);\n \n // Adjust crop size if the image is too small\n if($startX < 0) $startX = 0;\n if($startY < 0) $startY = 0;\n \n // create a temporary resized version of the image first\n $thumb = imagecreatetruecolor($this->thumb->tmp->width(), $this->thumb->tmp->height()); \n $thumb = $this->keepColor($thumb);\n imagecopyresampled($thumb, $image, 0, 0, 0, 0, $this->thumb->tmp->width(), $this->thumb->tmp->height(), $this->thumb->source->width(), $this->thumb->source->height()); \n \n // crop that image afterwards \n $cropped = imagecreatetruecolor($this->thumb->result->width(), $this->thumb->result->height()); \n $cropped = $this->keepColor($cropped);\n imagecopyresampled($cropped, $thumb, 0, 0, $startX, $startY, $this->thumb->tmp->width(), $this->thumb->tmp->height(), $this->thumb->tmp->width(), $this->thumb->tmp->height()); \n imagedestroy($thumb);\n \n // reasign the variable\n $thumb = $cropped;\n\n } else {\n $thumb = imagecreatetruecolor($this->thumb->result->width(), $this->thumb->result->height()); \n $thumb = $this->keepColor($thumb);\n imagecopyresampled($thumb, $image, 0, 0, 0, 0, $this->thumb->result->width(), $this->thumb->result->height(), $this->thumb->source->width(), $this->thumb->source->height()); \n } \n \n // convert the thumbnail to grayscale \n if($this->thumb->options['grayscale']) {\n imagefilter($thumb, IMG_FILTER_GRAYSCALE);\n }\n\n // convert the image to a different format\n if($this->thumb->options['to']) {\n\n switch($this->thumb->options['to']) {\n case 'jpg': \n imagejpeg($thumb, $this->thumb->root(), $this->thumb->options['quality']); \n break;\n case 'png': \n imagepng($thumb, $this->thumb->root(), 0); \n break; \n case 'gif': \n imagegif($thumb, $this->thumb->root()); \n break; \n }\n\n // keep the original file's format\n } else {\n\n switch($this->thumb->image->mime()) {\n case 'image/jpeg': \n imagejpeg($thumb, $this->thumb->root(), $this->thumb->options['quality']); \n break;\n case 'image/png': \n imagepng($thumb, $this->thumb->root(), 0); \n break; \n case 'image/gif': \n imagegif($thumb, $this->thumb->root()); \n break;\n }\n\n }\n\n imagedestroy($thumb);\n \n }", "function pngtojpeg($orgimage, $filename = false){\n\t// take the PNG file, and return the jpeg formatted image URL \n\t// notice: this keeps a replication of the image in the folder. This may become cumbersome over time. \n\t// HOWEVER - these files can also be deleted at any time, they have no requirement of being kept. \n\t\n\tif (exif_imagetype($orgimage) == IMAGETYPE_PNG) {\n\t\t\n\t\tif(!$filename){\n\t\t\t// no file name specified\n\t\t$key = '';\n\t\t$keys = array_merge(range(0, 9), range('a', 'z'));\n\n\t\tfor ($i = 0; $i < 5; $i++) {\n\t\t\t$key .= $keys[array_rand($keys)];\n\t\t}\n\t\n\t\n\t\t$newimgpath = 'tmppng/' . $key . time() . '.jpg';\n\t\t} else {\n\t\t\t// use a predefined file name\n\t\t\t$newimgpath = 'tmppng/' . $filename . '.jpg';\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\t$image = imagecreatefrompng($orgimage);\n\t\t$bg = imagecreatetruecolor(imagesx($image), imagesy($image));\n\t\timagefill($bg, 0, 0, imagecolorallocate($bg, 255, 255, 255));\n\t\timagealphablending($bg, TRUE);\n\t\timagecopy($bg, $image, 0, 0, 0, 0, imagesx($image), imagesy($image));\n\t\timagedestroy($image);\n\t\t$quality = 80; // 0 = worst / smaller file, 100 = better / bigger file \n\t\timagejpeg($bg, $newimgpath, $quality);\n\t\timagedestroy($bg);\n\t\t\n\t\treturn $newimgpath;\n\t\n\t} else {\n\t\t\n\t\treturn $orgimage;\n\t\t\n\t}\n\n}", "public function make_thumb($src, $dest, $desired_width){\r\n $source_image = imagecreatefromjpeg($src);\r\n $width = imagesx($source_image);\r\n $height = imagesy($source_image);\r\n\r\n /* find the \"desired height\" of this thumbnail, relative to the desired width */\r\n $desired_height = floor($height * ($desired_width / $width));\r\n\r\n /* create a new, \"virtual\" image */\r\n $virtual_image = imagecreatetruecolor($desired_width, $desired_height);\r\n\r\n /* copy source image at a resized size */\r\n imagecopyresampled($virtual_image, $source_image, 0, 0, 0, 0, $desired_width, $desired_height, $width, $height);\r\n\r\n /* create the physical thumbnail image to its destination */\r\n imagejpeg($virtual_image, $dest);\r\n }", "function compress($source, $destination) {\n\n // Get the dimensions of the image\n list($img_in_width, $img_in_height) = getimagesize($source);\n\n // Define the output width\n $out_width = 200;\n \n // Define the height based on the aspect ratio\n $out_height = $out_width * $img_in_height / $img_in_width;\n\n // Create an output image\n $img_out = imagecreatetruecolor($out_width, $out_height);\n \n // Load the input image\n $img_in = imagecreatefromjpeg($source);\n \n // Copy the contents of the image to the output, resizing in the process\n imagecopyresampled($img_out, $img_in, 0, 0, 0, 0, $out_width, $out_height, $img_in_width, $img_in_height);\n \n // Save the file as a JPEG image to the destination\n imagejpeg($img_out, $destination);\n}", "protected function buildImage()\n\t{\n\t\t$this->buildFileName = $this->buildFileName();\n\t\t$this->buildCachedFileNamePath = $this->cachePath . '/' . $this->buildFileName;\n\t\t$this->buildCachedFileNameUrl = $this->cacheUrl . '/' . $this->buildFileName;\n\n\t\tif(!file_exists($this->buildCachedFileNamePath)) {\n\t\t\t$this->image = iImage::make($this->mediaFilePath);\n\n\t\t\t$this->image->{$this->method}($this->width, $this->height, $this->closure);\n\n\t\t\t$this->image->save($this->buildCachedFileNamePath, $this->quality);\n\t\t}\n\t}", "public function makeThumbnail() {\n Image::make($this->filePath())->fit(200)->save($this->thumbnailPath());\n }" ]
[ "0.7554619", "0.66591173", "0.64988375", "0.64308274", "0.6373878", "0.6361806", "0.6343417", "0.6313749", "0.6147725", "0.6134345", "0.6097174", "0.6091913", "0.5964198", "0.5941242", "0.59222245", "0.58710253", "0.58621943", "0.5841999", "0.58217776", "0.5809876", "0.5809521", "0.5789804", "0.5788771", "0.5785661", "0.5776225", "0.5773097", "0.5758238", "0.5734769", "0.57284474", "0.5726128", "0.5715063", "0.5707435", "0.5704429", "0.5704429", "0.57042634", "0.5646895", "0.5637731", "0.5635828", "0.56182265", "0.5593829", "0.5584692", "0.55838037", "0.5569371", "0.55649304", "0.5563978", "0.5533083", "0.55302656", "0.5529316", "0.55266374", "0.5513643", "0.55048627", "0.55037737", "0.54948026", "0.5491538", "0.5483453", "0.5478026", "0.54741544", "0.5473145", "0.54705656", "0.5470125", "0.5468846", "0.54565614", "0.5444015", "0.54331696", "0.54256994", "0.5416866", "0.54159987", "0.541474", "0.54110694", "0.54092103", "0.54034746", "0.53964716", "0.53964716", "0.53920615", "0.5372809", "0.53659964", "0.5364304", "0.5360015", "0.53339416", "0.53277344", "0.5324105", "0.5311671", "0.5307542", "0.5299496", "0.5287036", "0.5284519", "0.5264249", "0.5261912", "0.5256832", "0.52567273", "0.5250365", "0.52454203", "0.52408546", "0.52334064", "0.5229424", "0.52219635", "0.52073133", "0.52054226", "0.52035165", "0.520088", "0.51931286" ]
0.0
-1
Create the flipped image
protected function _do_flip($direction) { $flipped = $this->_create($this->width, $this->height); // Loads image if not yet loaded $this->_load_image(); if ($direction === Image::HORIZONTAL) { for ($x = 0; $x < $this->width; $x++) { // Flip each row from top to bottom imagecopy($flipped, $this->_image, $x, 0, $this->width - $x - 1, 0, 1, $this->height); } } else { for ($y = 0; $y < $this->height; $y++) { // Flip each column from left to right imagecopy($flipped, $this->_image, 0, $y, 0, $this->height - $y - 1, $this->width, 1); } } // Swap the new image for the old one imagedestroy($this->_image); $this->_image = $flipped; // Reset the width and height $this->width = imagesx($flipped); $this->height = imagesy($flipped); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function flipVertical() {\n\t\tif(!$this->image) {\n\t\t\ttrigger_error('The image does not exist or is not readable.', E_USER_WARNING);\n\t\t\treturn false;\n\t\t}\n\n\t\t$working_image = imagecreatetruecolor($this->width, $this->height);\n\t\tif(imagecopyresampled($working_image, $this->image, 0, 0, 0, $this->height-1, $this->width, $this->height, $this->width, 0-$this->height)) {\n\t\t\t$this->image = $working_image;\n\t\t} else {\n\t\t\ttrigger_error('Flip vertical failed.', E_USER_WARNING);\n\t\t\treturn false;\n\t\t}\n\t}", "function _flip_image_resource($img, $horz, $vert)\n {\n }", "function imageflip(&$image, $x = 0, $y = 0, $width = null, $height = null)\n {\n if ($width < 1) $width = imagesx($image);\n if ($height < 1) $height = imagesy($image);\n // Truecolor provides better results, if possible.\n if (function_exists('imageistruecolor') && imageistruecolor($image))\n {\n $tmp = imagecreatetruecolor(1, $height);\n }\n else\n {\n $tmp = imagecreate(1, $height);\n }\n\n // My own change to preserve alpha (amarriner)\n imagealphablending($tmp, false);\n imagesavealpha($tmp, true);\n\n $x2 = $x + $width - 1;\n for ($i = (int) floor(($width - 1) / 2); $i >= 0; $i--)\n {\n // Backup right stripe.\n imagecopy($tmp, $image, 0, 0, $x2 - $i, $y, 1, $height);\n // Copy left stripe to the right.\n imagecopy($image, $image, $x2 - $i, $y, $x + $i, $y, 1, $height);\n // Copy backuped right stripe to the left.\n imagecopy($image, $tmp, $x + $i, $y, 0, 0, 1, $height);\n }\n imagedestroy($tmp);\n return true;\n }", "abstract public function flip();", "function imageflip(&$image, $x = 0, $y = 0, $width = null, $height = null) {\n\tif ($width < 1)\n\t\t$width = imagesx($image);\n\tif ($height < 1)\n\t\t$height = imagesy($image);\n\t// Truecolor provides better results, if possible.\n\tif (function_exists('imageistruecolor') && imageistruecolor($image)) {\n\t\t$tmp = imagecreatetruecolor(1, $height);\n\t} else {\n\t\t$tmp = imagecreate(1, $height);\n\t}\n\t$x2 = $x + $width - 1;\n\tfor ($i = (int) floor(($width - 1) / 2); $i >= 0; $i--) {\n\t\t// Backup right stripe.\n\t\timagecopy($tmp, $image, 0, 0, $x2 - $i, $y, 1, $height);\n\t\t// Copy left stripe to the right.\n\t\timagecopy($image, $image, $x2 - $i, $y, $x + $i, $y, 1, $height);\n\t\t// Copy backuped right stripe to the left.\n\t\timagecopy($image, $tmp, $x + $i, $y, 0, 0, 1, $height);\n\t}\n\timagedestroy($tmp);\n\treturn true;\n}", "public function backImage()\r\n {\r\n $wrapper = imagecreatetruecolor(16 * $this->ratio(), 32 * $this->ratio());\r\n $background = imagecolorallocatealpha($wrapper, 255, 255, 255, 127);\r\n imagefill($wrapper, 0, 0, $background);\r\n\r\n imagecopy($wrapper, $this->image, 4 * $this->ratio(), 8 * $this->ratio(), 32 * $this->ratio(),\r\n 20 * $this->ratio(), 8 * $this->ratio(), 12 * $this->ratio());\r\n // Head back\r\n imagecopy($wrapper, $this->image, 4 * $this->ratio(), 0 * $this->ratio(), 24 * $this->ratio(),\r\n 8 * $this->ratio(), 8 * $this->ratio(), 8 * $this->ratio());\r\n // Arms back\r\n $this->imageflip($wrapper, $this->image, 0 * $this->ratio(), 8 * $this->ratio(), 52 * $this->ratio(),\r\n 20 * $this->ratio(), 4 * $this->ratio(), 12 * $this->ratio());\r\n imagecopy($wrapper, $this->image, 12 * $this->ratio(), 8 * $this->ratio(), 52 * $this->ratio(),\r\n 20 * $this->ratio(), 4 * $this->ratio(), 12 * $this->ratio());\r\n // Legs back\r\n $this->imageflip($wrapper, $this->image, 4 * $this->ratio(), 20 * $this->ratio(), 12 * $this->ratio(),\r\n 20 * $this->ratio(), 4 * $this->ratio(), 12 * $this->ratio());\r\n imagecopy($wrapper, $this->image, 8 * $this->ratio(), 20 * $this->ratio(), 12 * $this->ratio(),\r\n 20 * $this->ratio(), 4 * $this->ratio(), 12 * $this->ratio());\r\n // Hat back\r\n imagecopy($wrapper, $this->image, 4 * $this->ratio(), 0 * $this->ratio(), 56 * $this->ratio(),\r\n 8 * $this->ratio(), 8 * $this->ratio(), 8 * $this->ratio());\r\n\r\n return $wrapper;\r\n }", "public function flipHorizontal() {\n\t\tif(!$this->image) {\n\t\t\ttrigger_error('The image does not exist or is not readable.', E_USER_WARNING);\n\t\t\treturn false;\n\t\t}\n\n\t\t$working_image = imagecreatetruecolor($this->width, $this->height);\n\t\tif(imagecopyresampled($working_image, $this->image, 0, 0, $this->width-1, 0, $this->width, $this->height, 0-$this->width, $this->height)) {\n\t\t\t$this->image = $working_image;\n\t\t} else {\n\t\t\ttrigger_error('Flip horizontal failed.', E_USER_WARNING);\n\t\t\treturn false;\n\t\t}\n\t}", "public function flip(): self;", "public function flip()\n {\n $this->resource->flipImage();\n return $this;\n }", "public function frontImage()\r\n {\r\n $wrapper = imagecreatetruecolor(16 * $this->ratio(), 32 * $this->ratio());\r\n $background = imagecolorallocatealpha($wrapper, 255, 255, 255, 127);\r\n imagefill($wrapper, 0, 0, $background);\r\n\r\n imagecopy($wrapper, $this->image, 4 * $this->ratio(), 0 * $this->ratio(), 8 * $this->ratio(),\r\n 8 * $this->ratio(), 8 * $this->ratio(), 8 * $this->ratio());\r\n //arms\r\n imagecopy($wrapper, $this->image, 0 * $this->ratio(), 8 * $this->ratio(), 44 * $this->ratio(),\r\n 20 * $this->ratio(), 4 * $this->ratio(), 12 * $this->ratio());\r\n $this->imageflip($wrapper, $this->image, 12 * $this->ratio(), 8 * $this->ratio(), 44 * $this->ratio(),\r\n 20 * $this->ratio(), 4 * $this->ratio(), 12 * $this->ratio());\r\n //chest\r\n imagecopy($wrapper, $this->image, 4 * $this->ratio(), 8 * $this->ratio(), 20 * $this->ratio(),\r\n 20 * $this->ratio(), 8 * $this->ratio(), 12 * $this->ratio());\r\n //legs\r\n imagecopy($wrapper, $this->image, 4 * $this->ratio(), 20 * $this->ratio(), 4 * $this->ratio(),\r\n 20 * $this->ratio(), 4 * $this->ratio(), 12 * $this->ratio());\r\n $this->imageflip($wrapper, $this->image, 8 * $this->ratio(), 20 * $this->ratio(), 4 * $this->ratio(),\r\n 20 * $this->ratio(), 4 * $this->ratio(), 12 * $this->ratio());\r\n //hat\r\n imagecopy($wrapper, $this->image, 4 * $this->ratio(), 0 * $this->ratio(), 40 * $this->ratio(),\r\n 8 * $this->ratio(), 8 * $this->ratio(), 8 * $this->ratio());\r\n\r\n return $wrapper;\r\n }", "private function imageflip(&$result, &$img, $rx = 0, $ry = 0, $x = 0, $y = 0, $size_x = null, $size_y = null)\r\n {\r\n if ($size_x < 1) {\r\n $size_x = imagesx($img);\r\n }\r\n\r\n if ($size_y < 1) {\r\n $size_y = imagesy($img);\r\n }\r\n\r\n imagecopyresampled($result, $img, $rx, $ry, ($x + $size_x - 1), $y, $size_x, $size_y, 0 - $size_x, $size_y);\r\n }", "public function flip($direction) {\r\n $this->imageFlip = $direction;\r\n return $this;\r\n }", "abstract function flip($direction);", "public function flip(){\n $this->flip = !$this->flip;\n }", "public function test_flip() {\n\n\t\t$file = DIR_TESTDATA . '/images/gradient-square.jpg';\n\n\t\t$imagick_image_editor = new WP_Image_Editor_Imagick( $file );\n\t\t$imagick_image_editor->load();\n\n\t\t$property = new ReflectionProperty( $imagick_image_editor, 'image' );\n\t\t$property->setAccessible( true );\n\n\t\t$color_top_left = $property->getValue( $imagick_image_editor )->getImagePixelColor( 1, 1 )->getColor();\n\n\t\t$imagick_image_editor->flip( true, false );\n\n\t\t$this->assertEquals( $color_top_left, $property->getValue( $imagick_image_editor )->getImagePixelColor( 0, 99 )->getColor() );\n\t}", "public static function flip_iamge(){\n\n}", "public function test_flip() {\n\t\t$file = DIR_TESTDATA . '/images/one-blue-pixel-100x100.png';\n\n\t\t$imagick_image_editor = new WP_Image_Editor_Imagick( $file );\n\t\t$imagick_image_editor->load();\n\n\t\t$property = new ReflectionProperty( $imagick_image_editor, 'image' );\n\t\t$property->setAccessible( true );\n\n\t\t$color_top_left = $property->getValue( $imagick_image_editor )->getImagePixelColor( 0, 0 )->getColor();\n\n\t\t$imagick_image_editor->flip( true, false );\n\n\t\t$this->assertSame( $color_top_left, $property->getValue( $imagick_image_editor )->getImagePixelColor( 0, 99 )->getColor() );\n\t}", "function __flip(&$tmp) {\n\n\t\t// call `convert -flip`\n\t\t//\n\t\t$cmd = $this->__command(\n\t\t\t'convert',\n\t\t\t\" -flip \"\n \t\t\t. escapeshellarg(realpath($tmp->target))\n \t\t\t. \" \"\n \t\t\t. escapeshellarg(realpath($tmp->target))\n \t);\n\n exec($cmd, $result, $errors);\n\t\treturn ($errors == 0);\n\t\t}", "public function flip()\n\t{\n\t\treturn $this->toBase()->flip();\n\t}", "public function flip($dir = 'both') {\n\t\tif(!$this->image) {\n\t\t\ttrigger_error('The image does not exist or is not readable.', E_USER_WARNING);\n\t\t\treturn false;\n\t\t}\n\t\t$dir = substr(strtolower($dir), 0, 1);\n\t\tswitch($dir) {\n\t\t\tdefault:\n\t\t\t\t $res_v = $this->flipVertical();\n\t\t\t\t $res_h = $this->flipHorizontal();\n\t\t\t\t return $res_v && $res_h;\n\t\t\tbreak;\n\t\t\tcase 'v':\n\t\t\t\treturn $this->flipVertical();\n\t\t\tbreak;\n\t\t\tcase 'h':\n\t\t\t\treturn $this->flipHorizontal();\n\t\t\tbreak;\n\t\t}\n\t}", "public function flip()\n {\n return $this->toBase()->flip();\n }", "function image_mirror_gd()\n\t{\t\t\n\t\tif ( ! $src_img = $this->image_create_gd())\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\t\t\n\t\t$width = $this->src_width;\n\t\t$height = $this->src_height;\n\n\t\tif ($this->rotation == 'hor')\n\t\t{\n\t\t\tfor ($i = 0; $i < $height; $i++)\n\t\t\t{\t\t \n\t\t\t\t$left = 0; \n\t\t\t\t$right = $width-1; \n\t\n\t\t\t\twhile ($left < $right)\n\t\t\t\t{ \n\t\t\t\t\t$cl = imagecolorat($src_img, $left, $i); \n\t\t\t\t\t$cr = imagecolorat($src_img, $right, $i);\n\t\t\t\t\t\n\t\t\t\t\timagesetpixel($src_img, $left, $i, $cr); \n\t\t\t\t\timagesetpixel($src_img, $right, $i, $cl); \n\t\t\t\t\t\n\t\t\t\t\t$left++; \n\t\t\t\t\t$right--; \n\t\t\t\t} \n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfor ($i = 0; $i < $width; $i++)\n\t\t\t{\t\t \n\t\t\t\t$top = 0; \n\t\t\t\t$bot = $height-1; \n\t\n\t\t\t\twhile ($top < $bot)\n\t\t\t\t{ \n\t\t\t\t\t$ct = imagecolorat($src_img, $i, $top);\n\t\t\t\t\t$cb = imagecolorat($src_img, $i, $bot);\n\t\t\t\t\t\n\t\t\t\t\timagesetpixel($src_img, $i, $top, $cb); \n\t\t\t\t\timagesetpixel($src_img, $i, $bot, $ct); \n\t\t\t\t\t\n\t\t\t\t\t$top++; \n\t\t\t\t\t$bot--; \n\t\t\t\t} \n\t\t\t}\t\t\n\t\t}\n\t\t\n\t\t/** ---------------------------------\n\t\t/** Save the Image\n\t\t/** ---------------------------------*/\n\t\tif ( ! $this->image_save_gd($src_img))\n\t\t{\t\t\n\t\t\treturn FALSE;\n\t\t}\n\t\t\n\t\t/** ---------------------------------\n\t\t/** Kill the file handles\n\t\t/** ---------------------------------*/\n\t\timagedestroy($src_img);\n\t\t\n\t\t// Set the file to 777\n\t\t@chmod($this->full_dst_path, FILE_WRITE_MODE);\t\t\t\n\t\t\n\t\treturn TRUE;\n\t}", "public function flip(): self\n {\n return Factory::create(array_flip($this->items));\n }", "public function flip($direction);", "public function flip($direction)\n {\n if ($direction !== Image::HORIZONTAL)\n {\n // Flip vertically\n $direction = Image::VERTICAL;\n }\n\n $this->_do_flip($direction);\n\n return $this;\n }", "public function flipHorizontal(): void\n {\n $this->flip(['direction' => 'h']);\n }", "public function flip(): self\n {\n return new static(array_flip($this->array));\n }", "function Flip_On_Front_end( $atts )\n{\n // var_dump( $atts );\n $image = get_post_meta($atts['id'], 'image_url_value', true);\n $backside = get_post_meta($atts['id'], 'description_value', true);\n $flip = get_post_meta($atts['id'], 'transition_value', true);\n $flip_class = '';\n\n if ($flip == 'Left-to-Right' ) {\n\n $flip_class = 'horizontal';\n } elseif ($flip == 'Top-to-bottom' ) { \n\n $flip_class = 'vertical';\n }\n \n \n ?>\n <div class=\"flip-box\" id=\"flip-id\">\n <div class=\"flip-box-inner <?php echo( $flip_class ); ?>\" id=\"inner-id\">\n <div class=\"flip-box-front\">\n <img src=\"<?php echo($image) ?>\" alt=\"Smiley face\" />\n </div>\n <div class=\"flip-box-back\" id=\"inner-back\">\n <div>\n <?php echo $backside; ?>\n </div>\n </div>\n </div>\n </div>\n <?php\n}", "public function createImage3(){\n $this->triangleCreate(240, 100, 290, 50, 340, 100);\n $this->triangleCreate(40, 300, 90, 250, 140, 300);\n $this->triangleCreate(440, 300, 490, 250, 540, 300);\n $this->createLine(265, 100, 105, 265);\n $this->createLine(315, 100, 475, 265);\n $this->createLine(125, 285, 455, 285);\n $this->generateImage();\n }", "public function flipVertical(): void\n {\n $this->flip(['direction' => 'v']);\n }", "public function image_mirror_gd()\n\t{\n\t\tif ( ! $src_img = $this->image_create_gd())\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\n\t\t$width = $this->orig_width;\n\t\t$height = $this->orig_height;\n\n\t\tif ($this->rotation_angle === 'hor')\n\t\t{\n\t\t\tfor ($i = 0; $i < $height; $i++)\n\t\t\t{\n\t\t\t\t$left = 0;\n\t\t\t\t$right = $width - 1;\n\n\t\t\t\twhile ($left < $right)\n\t\t\t\t{\n\t\t\t\t\t$cl = imagecolorat($src_img, $left, $i);\n\t\t\t\t\t$cr = imagecolorat($src_img, $right, $i);\n\n\t\t\t\t\timagesetpixel($src_img, $left, $i, $cr);\n\t\t\t\t\timagesetpixel($src_img, $right, $i, $cl);\n\n\t\t\t\t\t$left++;\n\t\t\t\t\t$right--;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfor ($i = 0; $i < $width; $i++)\n\t\t\t{\n\t\t\t\t$top = 0;\n\t\t\t\t$bottom = $height - 1;\n\n\t\t\t\twhile ($top < $bottom)\n\t\t\t\t{\n\t\t\t\t\t$ct = imagecolorat($src_img, $i, $top);\n\t\t\t\t\t$cb = imagecolorat($src_img, $i, $bottom);\n\n\t\t\t\t\timagesetpixel($src_img, $i, $top, $cb);\n\t\t\t\t\timagesetpixel($src_img, $i, $bottom, $ct);\n\n\t\t\t\t\t$top++;\n\t\t\t\t\t$bottom--;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Show the image\n\t\tif ($this->dynamic_output === TRUE)\n\t\t{\n\t\t\t$this->image_display_gd($src_img);\n\t\t}\n\t\telseif ( ! $this->image_save_gd($src_img)) // ... or save it\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\n\t\t// Kill the file handles\n\t\timagedestroy($src_img);\n\n\t\tchmod($this->full_dst_path, $this->file_permissions);\n\n\t\treturn TRUE;\n\t}", "public function flip()\n {\n return new static(array_flip($this->elements));\n }", "function flip(&$arr, $i) \n{ \n\t$start = 0; \n\twhile ($start < $i) \n\t{ \n\t\t$temp = $arr[$start]; \n\t\t$arr[$start] = $arr[$i]; \n\t\t$arr[$i] = $temp; \n\t\t$start++; \n\t\t$i--; \n\t} \n}", "public function invert();", "function create($filename=\"\")\n{\nif ($filename) {\n $this->src_image_name = trim($filename);\n}\n$dirname=explode(\"/\",$this->src_image_name);\nif(!file_exists(\"$dirname[0]/$dirname[1]/$dirname[2]/$dirname[3]/\")){\n\t@mkdir(\"$dirname[0]/$dirname[1]/$dirname[2]/$dirname[3]/\", 0755);\n}\nif(stristr(PHP_OS,\"WIN\")){\n\t$this->src_image_name = @iconv(\"utf-8\",\"GBK\",$this->src_image_name);\n\t$this->gz_image_name = @iconv(\"utf-8\",\"GBK\",$this->gz_image_name);\n}\n$src_image_type = $this->get_type($this->src_image_name);\n$src_image = $this->createImage($src_image_type,$this->src_image_name);\nif (!$src_image) return;\n$src_image_w=ImageSX($src_image);\n$src_image_h=ImageSY($src_image);\n\n\nif ($this->gz_image_name){\n $this->gz_image_name = strtolower(trim($this->gz_image_name));\n $gz_image_type = $this->get_type($this->gz_image_name);\n $gz_image = $this->createImage($gz_image_type,$this->gz_image_name);\n $gz_image_w=ImageSX($gz_image);\n $gz_image_h=ImageSY($gz_image);\n $temp_gz_image = $this->getPos($src_image_w,$src_image_h,$this->gz_image_pos,$gz_image);\n $gz_image_x = $temp_gz_image[\"dest_x\"];\n $gz_image_y = $temp_gz_image[\"dest_y\"];\n\t if($this->get_type($this->gz_image_name)=='png'){imagecopy($src_image,$gz_image,$gz_image_x,$gz_image_y,0,0,$gz_image_w,$gz_image_h);}\n\t else{imagecopymerge($src_image,$gz_image,$gz_image_x,$gz_image_y,0,0,$gz_image_w,$gz_image_h,$this->gz_image_transition);}\n}\nif ($this->gz_text){\n $temp_gz_text = $this->getPos($src_image_w,$src_image_h,$this->gz_text_pos);\n $gz_text_x = $temp_gz_text[\"dest_x\"];\n $gz_text_y = $temp_gz_text[\"dest_y\"];\n if(preg_match(\"/([a-f0-9][a-f0-9])([a-f0-9][a-f0-9])([a-f0-9][a-f0-9])/i\", $this->gz_text_color, $color))\n {\n $red = hexdec($color[1]);\n $green = hexdec($color[2]);\n $blue = hexdec($color[3]);\n $gz_text_color = imagecolorallocate($src_image, $red,$green,$blue);\n }else{\n $gz_text_color = imagecolorallocate($src_image, 255,255,255);\n }\n imagettftext($src_image, $this->gz_text_size, $this->gz_text_angle, $gz_text_x, $gz_text_y, $gz_text_color,$this->gz_text_font, $this->gz_text);\n}\nif(stristr(PHP_OS,\"WIN\")){\n\t$save_files=explode('/',$this->save_file);\n\t$save_files[count($save_files)-1]=@iconv(\"utf-8\",\"GBK\",$save_files[count($save_files)-1]);\n\t$this->save_file=implode('/',$save_files);\n}\nif ($this->save_file)\n{\n switch ($this->get_type($this->save_file)){\n case 'gif':$src_img=ImagePNG($src_image, $this->save_file); break;\n case 'jpeg':$src_img=ImageJPEG($src_image, $this->save_file, $this->jpeg_quality); break;\n case 'png':$src_img=ImagePNG($src_image, $this->save_file); break;\n default:$src_img=ImageJPEG($src_image, $this->save_file, $this->jpeg_quality); break;\n }\n}\nelse\n{\nif ($src_image_type = \"jpg\") $src_image_type=\"jpeg\";\n header(\"Content-type: image/{$src_image_type}\");\n switch ($src_image_type){\n case 'gif':$src_img=ImagePNG($src_image); break;\n case 'jpg':$src_img=ImageJPEG($src_image, \"\", $this->jpeg_quality);break;\n case 'png':$src_img=ImagePNG($src_image);break;\n default:$src_img=ImageJPEG($src_image, \"\", $this->jpeg_quality);break;\n }\n}\nimagedestroy($src_image);\n}", "public function flip()\n {\n return new static(array_flip($this->items));\n }", "public function createImage2(){\n $this->createCircle(100, 100, 50, 50, 0, 360);\n $this->createCircle(400, 100, 50, 50, 0, 360);\n $this->createCircle(110, 200, 50, 50, 0, 360);\n $this->createCircle(250, 300, 50, 50, 0, 360);\n $this->createCircle(390, 200, 50, 50, 0, 360);\n $this->createLine(125, 100, 375, 100);\n $this->createLine(100, 125, 100, 175);\n $this->createLine(400, 125, 400, 175);\n $this->createLine(125, 220, 225, 300);\n $this->createLine(275, 300, 375, 220);\n $this->generateImage();\n }", "public function flip()\n\t{\n\t\treturn new static(array_flip($this->items));\n\t}", "function flip(&$tmp) {\r\r\n\t\treturn $this->__flip(&$tmp);\r\r\n\t\t}", "protected function _createImage()\n {\n $this->_height = $this->scale * 60;\n $this->_width = 1.8 * $this->_height;\n $this->_image = imagecreate($this->_width, $this->_height);\n ImageColorAllocate($this->_image, 0xFF, 0xFF, 0xFF);\n }", "function create($filename=\"\")\n{\nif ($filename) {\n $this->src_image_name = trim($filename);\n}\n$dirname=explode(\"/\",$this->src_image_name);\nif(!file_exists(\"$dirname[0]/$dirname[1]/$dirname[2]/$dirname[3]/\")){\n\t@mkdir(\"$dirname[0]/$dirname[1]/$dirname[2]/$dirname[3]/\", 0755);\n}\nif(stristr(PHP_OS,\"WIN\")){\n\t$this->src_image_name = @iconv(\"utf-8\",\"GBK\",$this->src_image_name);\n\t$this->met_image_name = @iconv(\"utf-8\",\"GBK\",$this->met_image_name);\n}\n$src_image_type = $this->get_type($this->src_image_name);\n$src_image = $this->createImage($src_image_type,$this->src_image_name);\nif (!$src_image) return;\n$src_image_w=ImageSX($src_image);\n$src_image_h=ImageSY($src_image);\n\n\nif ($this->met_image_name){\n $this->met_image_name = strtolower(trim($this->met_image_name));\n $met_image_type = $this->get_type($this->met_image_name);\n $met_image = $this->createImage($met_image_type,$this->met_image_name);\n $met_image_w=ImageSX($met_image);\n $met_image_h=ImageSY($met_image);\n $temp_met_image = $this->getPos($src_image_w,$src_image_h,$this->met_image_pos,$met_image);\n $met_image_x = $temp_met_image[\"dest_x\"];\n $met_image_y = $temp_met_image[\"dest_y\"];\n\t if($this->get_type($this->met_image_name)=='png'){imagecopy($src_image,$met_image,$met_image_x,$met_image_y,0,0,$met_image_w,$met_image_h);}\n\t else{imagecopymerge($src_image,$met_image,$met_image_x,$met_image_y,0,0,$met_image_w,$met_image_h,$this->met_image_transition);}\n}\nif ($this->met_text){\n $temp_met_text = $this->getPos($src_image_w,$src_image_h,$this->met_text_pos);\n $met_text_x = $temp_met_text[\"dest_x\"];\n $met_text_y = $temp_met_text[\"dest_y\"];\n if(preg_match(\"/([a-f0-9][a-f0-9])([a-f0-9][a-f0-9])([a-f0-9][a-f0-9])/i\", $this->met_text_color, $color))\n {\n $red = hexdec($color[1]);\n $green = hexdec($color[2]);\n $blue = hexdec($color[3]);\n $met_text_color = imagecolorallocate($src_image, $red,$green,$blue);\n }else{\n $met_text_color = imagecolorallocate($src_image, 255,255,255);\n }\n imagettftext($src_image, $this->met_text_size, $this->met_text_angle, $met_text_x, $met_text_y, $met_text_color,$this->met_text_font, $this->met_text);\n}\nif(stristr(PHP_OS,\"WIN\")){\n\t$save_files=explode('/',$this->save_file);\n\t$save_files[count($save_files)-1]=@iconv(\"utf-8\",\"GBK\",$save_files[count($save_files)-1]);\n\t$this->save_file=implode('/',$save_files);\n}\nif ($this->save_file)\n{\n switch ($this->get_type($this->save_file)){\n case 'gif':$src_img=ImagePNG($src_image, $this->save_file); break;\n case 'jpeg':$src_img=ImageJPEG($src_image, $this->save_file, $this->jpeg_quality); break;\n case 'png':$src_img=ImagePNG($src_image, $this->save_file); break;\n default:$src_img=ImageJPEG($src_image, $this->save_file, $this->jpeg_quality); break;\n }\n}\nelse\n{\nif ($src_image_type = \"jpg\") $src_image_type=\"jpeg\";\n header(\"Content-type: image/{$src_image_type}\");\n switch ($src_image_type){\n case 'gif':$src_img=ImagePNG($src_image); break;\n case 'jpg':$src_img=ImageJPEG($src_image, \"\", $this->jpeg_quality);break;\n case 'png':$src_img=ImagePNG($src_image);break;\n default:$src_img=ImageJPEG($src_image, \"\", $this->jpeg_quality);break;\n }\n}\nimagedestroy($src_image);\n}", "public function createImage1(){\n $this->createHexagon(150,75, 50, 200, 150, 325, 275, 325, 350,200, 275, 75);\n $this->createCircle(200, 200, 200, 200, 0, 360);\n $this->createLine(200, 125, 125, 200);\n $this->createLine(200, 125, 275, 200);\n $this->createLine(125, 200, 200, 275);\n $this->createLine(275, 200, 200, 275);\n $this->generateImage();\n }", "public function createRotateFlippedImage($request)\n {\n $returnType = '\\SplFileObject';\n $isBinary = true;\n $hasReturnType = true;\n $request = $this->getHttpRequest($request, 'POST');\n $options = $this->createHttpClientOptions();\n \n try {\n $response = $this->client->send($request, $options);\n return $this->processResponse($request, $response, $hasReturnType, $returnType, $isBinary);\n } catch (RequestException $e) {\n $this->processException($e);\n }\n }", "protected function transform(sfImage $image)\r\n {\r\n $new_img = $image->getAdapter()->getTransparentImage($image->getWidth(), $image->getHeight());\r\n\r\n imagealphablending($new_img, false);\r\n imagesavealpha($new_img, true);\r\n\r\n $opacity = (int)round(127-((127/100)*$this->getOpacity()));\r\n\r\n // imagesavealpha($new_img, true);\r\n $width = $image->getWidth();\r\n $height = $image->getHeight();\r\n\r\n for ($x=0;$x<$width; $x++)\r\n {\r\n for ($y=0;$y<$height; $y++)\r\n {\r\n $rgb = imagecolorat($image->getAdapter()->getHolder(), $x, $y);\r\n $r = ($rgb >> 16) & 0xFF;\r\n $g = ($rgb >> 8) & 0xFF;\r\n $b = $rgb & 0xFF;\r\n $alpha = ($rgb & 0x7F000000) >> 24;\r\n\r\n $new_opacity = ($alpha + ((127-$alpha)/100)*$this->getOpacity());\r\n\r\n $colors[$alpha] = $new_opacity;\r\n\r\n $color = imagecolorallocatealpha($new_img, $r, $g, $b, $new_opacity);\r\n imagesetpixel($new_img,$x, $y, $color);\r\n }\r\n }\r\n\r\n $image->getAdapter()->setHolder($new_img);\r\n\r\n return $image;\r\n }", "function generateThumb($dst_w = 85, $dst_h = 85, $mode) {\n $this->thumbToolkit = ImageToolkit::factory($this->getImagePath ());\n if ($mode == true) {\n $mode = 'crop';\n }\n else {\n $mode = 'ratio';\n }\n $this->thumbToolkit->setDestSize ($dst_w, $dst_h, $mode);\n\n $final = luxbum::getThumbImage ($this->dir, $this->file, $dst_w, $dst_h);\n if (!is_file ($final)) {\n files::createDir ($this->thumbDir);\n $this->thumbToolkit->createThumb ($final);\n }\n return $final;\n }", "function convertImage($file, $out) {\n\t$im=imagecreatefrompng($file);\n\t$of=fopen($out, \"w\");\n\tfor ($y=0; $y<600; $y++) {\n\t\tfor ($x=0; $x<800; $x+=8) {\n\t\t\t$b=0;\n\t\t\tfor ($z=0; $z<8; $z++) {\n\t\t\t\t$b<<=1;\n\t\t\t\t$c=imagecolorat($im, $x+$z, $y);\n\t\t\t\tif ((($c)&0xff)<0x80) $b|=1;\n\t\t\t}\n\t\t\tfprintf($of, \"%c\", $b);\n\t\t}\n\t}\n\timagedestroy($im);\n\tfclose($of);\n}", "function create_image(){\r\n\t$wmark = imagecreatefrompng('img/stamp.png');\r\n\t//Load jpg image\r\n\t$image = imagecreatefromjpeg('img/image'.rand(1,3).'.jpg');\r\n\t\r\n\t//Get image width/height\r\n\t$width = imagesx($image);\r\n\t$height = imagesy($image);\r\n\t\r\n\t// Set the margins for the stamp and get the height/width of the stamp image\r\n\t$marge_right = 10;\r\n\t$marge_bottom = 10;\r\n\t$sx = imagesx($wmark);\r\n\t$sy = imagesy($wmark);\r\n\t\r\n\t// Copy the stamp image onto our photo using the margin offsets and the photo width to calculate positioning of the stamp. \r\n\timagecopy($image, $wmark, $width-$sx-$marge_right, $height-$sy-$marge_bottom,0,0,$sx,$sy);\r\n\t\r\n\t// Prepare the final image and save to path. If you only pass $image it will output to the browser instead of a file.\r\n\timagepng($image,\"generatedImage.png\");\r\n\t\r\n\t// Output and free memory\r\n\timagedestroy($image);\r\n}", "function RotatedImage($file,$x,$y,$w,$h,$angle)\n{\n $this->Rotate($angle,$x,$y);\n $this->Image($file,$x,$y,$w,$h);\n $this->Rotate(0);\n}", "public function Flip()\n {\n return $this->setOption('flip', true);\n }", "function playerPortraitCreate ($base, $player)\r\n{\r\n list($width_orig, $height_orig) = getimagesize($base);\r\n list($width_orig2, $height_orig2) = getimagesize($player);\r\n \r\n // Calculando a proporção\r\n $ratio_orig = $width_orig / $height_orig;\r\n $ratio_orig2 = $width_orig2 / $height_orig2;\r\n /// Largura e altura máximos (máximo, pois como é proporcional, o resultado varia)\r\n // No caso da pergunta, basta usar $_GET['width'] e $_GET['height'], ou só\r\n // $_GET['width'] e adaptar a fórmula de proporção abaixo.\r\n $width = 500;\r\n $height = 500;\r\n $width2 = 100;\r\n $height2 = 100;\r\n if ($width / $height > $ratio_orig) {\r\n $width = $height * $ratio_orig;\r\n } else {\r\n $height = $width / $ratio_orig;\r\n }\r\n if ($width2 / $height2 > $ratio_orig2) {\r\n $width2 = $height2 * $ratio_orig2;\r\n } else {\r\n $height2 = $width2 / $ratio_orig2;\r\n }\r\n // O resize propriamente dito. Na verdade, estamos gerando uma nova imagem.\r\n $extension = explode(\".\", $base);\r\n $extension = $extension[count($extension) - 1];\r\n $image_p = imagecreatetruecolor($width, $height);\r\n $image = NULL;\r\n if ($extension == \"jpg\" || $extension == \"jpeg\") {\r\n $image = imagecreatefromjpeg($base);\r\n } elseif ($extension == \"gif\") {\r\n $image = imagecreatefromgif($base);\r\n } elseif ($extension == \"png\") {\r\n $image = imagecreatefrompng($base);\r\n }\r\n imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);\r\n \r\n $image_player = imagecreatetruecolor($width2, $height2);\r\n $marcadagua = imagecreatefromgif($player);\r\n setTransparency($image_player, $marcadagua);\r\n imagecopyresized($image_player, $marcadagua, 0, 0, 0, 0, $width2, $height2, $width_orig2, $height_orig2);\r\n// imagedestroy($marcadagua);\r\n \r\n //pega o tamanho da imagem principal\r\n $dwidth = imagesx($image_p);\r\n $dheight = imagesy($image_p);\r\n \r\n //pega o tamanho da imagem que vai ser centralizada\r\n $mwidth = imagesx($image_player);\r\n $mheight = imagesy($image_player);\r\n //Calcula a x e y posição pra colocar a imagem no centro da outra\r\n //A função round arredonda os valores\r\n $xPos = round(($dwidth - $mwidth) / 2 - 40);\r\n $yPos = round(($dheight - $mheight) / 2 - 40);\r\n imagecopymerge($image_p, $image_player, $xPos, $yPos, 0, 0, $mwidth, $mheight, 100);\r\n// imagedestroy($image_player);\r\n// imagecopyresampled($image_p, $image_player, $xPos, $yPos, 0, 0, $mwidth, $mheight, 100,100);\r\n return $image_p;\r\n}", "function generatePreview ($dst_w = 650, $dst_h = 485, $mode) {\n $this->previewToolkit = ImageToolkit::factory($this->getImagePath ());\n if ($mode == true) {\n $mode = 'crop';\n }\n else {\n $mode = 'ratio';\n }\n $this->previewToolkit->setDestSize ($dst_w, $dst_h, $mode);\n\n // If the generation is not needed, returns the file path to the original image\n if ($this->_needPreview($this->previewToolkit) == false) {\n return $this->getImagePath ();\n }\n\n $final = luxbum::getPreviewImage($this->dir, $this->file, $dst_w, $dst_h);\n \n // Generate the preview is the preview is not yet generated\n if (!is_file ($final)) {\n files::createDir ($this->previewDir);\n $this->previewToolkit->createThumb ($final);\n }\n \n return $final;\n }", "function ImageCreateFromBMP($filename)\n{\n //Ouverture du fichier en mode binaire\n if (! $f1 = fopen($filename,\"rb\")) return FALSE;\n\n //1 : Chargement des ent�tes FICHIER\n $FILE = unpack(\"vfile_type/Vfile_size/Vreserved/Vbitmap_offset\", fread($f1,14));\n if ($FILE['file_type'] != 19778) return FALSE;\n\n //2 : Chargement des ent�tes BM\n $BMP = unpack('Vheader_size/Vwidth/Vheight/vplanes/vbits_per_pixel'.\n '/Vcompression/Vsize_bitmap/Vhoriz_resolution'.\n '/Vvert_resolution/Vcolors_used/Vcolors_important', fread($f1,40));\n $BMP['colors'] = pow(2,$BMP['bits_per_pixel']);\n if ($BMP['size_bitmap'] == 0) $BMP['size_bitmap'] = $FILE['file_size'] - $FILE['bitmap_offset'];\n $BMP['bytes_per_pixel'] = $BMP['bits_per_pixel']/8;\n $BMP['bytes_per_pixel2'] = ceil($BMP['bytes_per_pixel']);\n $BMP['decal'] = ($BMP['width']*$BMP['bytes_per_pixel']/4);\n $BMP['decal'] -= floor($BMP['width']*$BMP['bytes_per_pixel']/4);\n $BMP['decal'] = 4-(4*$BMP['decal']);\n if ($BMP['decal'] == 4) $BMP['decal'] = 0;\n\n //3 : Chargement des couleurs de la palette\n $PALETTE = array();\n if ($BMP['colors'] < 16777216)\n {\n $PALETTE = unpack('V'.$BMP['colors'], fread($f1,$BMP['colors']*4));\n }\n\n //4 : Cr�ation de l'image\n $IMG = fread($f1,$BMP['size_bitmap']);\n $VIDE = chr(0);\n\n $res = imagecreatetruecolor($BMP['width'],$BMP['height']);\n $P = 0;\n $Y = $BMP['height']-1;\n while ($Y >= 0)\n {\n $X=0;\n while ($X < $BMP['width'])\n {\n if ($BMP['bits_per_pixel'] == 24)\n $COLOR = unpack(\"V\",substr($IMG,$P,3).$VIDE);\n elseif ($BMP['bits_per_pixel'] == 16)\n {\n $COLOR = unpack(\"n\",substr($IMG,$P,2));\n $COLOR[1] = $PALETTE[$COLOR[1]+1];\n }\n elseif ($BMP['bits_per_pixel'] == 8)\n {\n $COLOR = unpack(\"n\",$VIDE.substr($IMG,$P,1));\n $COLOR[1] = $PALETTE[$COLOR[1]+1];\n }\n elseif ($BMP['bits_per_pixel'] == 4)\n {\n $COLOR = unpack(\"n\",$VIDE.substr($IMG,floor($P),1));\n if (($P*2)%2 == 0) $COLOR[1] = ($COLOR[1] >> 4) ; else $COLOR[1] = ($COLOR[1] & 0x0F);\n $COLOR[1] = $PALETTE[$COLOR[1]+1];\n }\n elseif ($BMP['bits_per_pixel'] == 1)\n {\n $COLOR = unpack(\"n\",$VIDE.substr($IMG,floor($P),1));\n if (($P*8)%8 == 0) $COLOR[1] = $COLOR[1] >>7;\n elseif (($P*8)%8 == 1) $COLOR[1] = ($COLOR[1] & 0x40)>>6;\n elseif (($P*8)%8 == 2) $COLOR[1] = ($COLOR[1] & 0x20)>>5;\n elseif (($P*8)%8 == 3) $COLOR[1] = ($COLOR[1] & 0x10)>>4;\n elseif (($P*8)%8 == 4) $COLOR[1] = ($COLOR[1] & 0x8)>>3;\n elseif (($P*8)%8 == 5) $COLOR[1] = ($COLOR[1] & 0x4)>>2;\n elseif (($P*8)%8 == 6) $COLOR[1] = ($COLOR[1] & 0x2)>>1;\n elseif (($P*8)%8 == 7) $COLOR[1] = ($COLOR[1] & 0x1);\n $COLOR[1] = $PALETTE[$COLOR[1]+1];\n }\n else\n return FALSE;\n imagesetpixel($res,$X,$Y,$COLOR[1]);\n $X++;\n $P += $BMP['bytes_per_pixel'];\n }\n $Y--;\n $P+=$BMP['decal'];\n }\n\n //Fermeture du fichier\n fclose($f1);\n\n return $res;\n}", "public static function change_image_type(){\n/**\n*\n*This function change the image type like convert png to jpg or bmp or gif\n*\n*/\npublic static function rotate()\n}", "function _rotateImageGD2($file, $desfile, $degrees, $imgobj) {\r\n // GD can only handle JPG & PNG images\r\n if ($imgobj->_type !== \"jpg\" && $imgobj->_type !== \"jpeg\" && $imgobj->_type !== \"png\" && $imgobj->_type !== \"gif\") {\r\n return false;\r\n }\r\n if ($imgobj->_type == \"gif\" && !function_exists(\"imagecreatefromgif\")) {\r\n \treturn false;\r\n }\r\n if ($imgobj->_type == \"jpg\" || $imgobj->_type == \"jpeg\") {\r\n $src_img = @imagecreatefromjpeg($file);\r\n } else if ($imgobj->_type == \"png\") {\r\n $src_img = @imagecreatefrompng($file);\r\n \t$dst_img = imagecreatetruecolor($imgobj->_size[0],$imgobj->_size[1]);\r\n\t\t\t$img_white = imagecolorallocate($dst_img, 255, 255, 255); // set background to white\r\n\t\t\t$img_return = imagefill($dst_img, 0, 0, $img_white);\r\n\t\t\timagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $imgobj->_size[0], $imgobj->_size[1], $imgobj->_size[0], $imgobj->_size[1]);\r\n\t\t\t$src_img = $dst_img;\r\n } else {\r\n \t$src_img = @imagecreatefromgif($file);\r\n \t$dst_img = imagecreatetruecolor($imgobj->_size[0],$imgobj->_size[1]);\r\n\t\t\t$img_white = imagecolorallocate($dst_img, 255, 255, 255); // set background to white\r\n\t\t\t$img_return = imagefill($dst_img, 0, 0, $img_white);\r\n\t\t\timagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $imgobj->_size[0], $imgobj->_size[1], $imgobj->_size[0], $imgobj->_size[1]);\r\n\t\t\t$src_img = $dst_img;\r\n }\r\n if (!$src_img) {\r\n return false;\r\n }\r\n // The rotation routine...\r\n $dst_img = imagerotate($src_img, $degrees, 0);\r\n if ($imgobj->_type == \"jpg\" || $imgobj->_type == \"jpeg\") {\r\n imagejpeg($dst_img, $desfile, $this->_JPEG_quality);\r\n } else if ($imgobj->_type == \"png\") {\r\n imagepng($dst_img, $desfile);\r\n } else {\r\n \timagegif($dst_img, $desfile);\r\n }\r\n imagedestroy($src_img);\r\n imagedestroy($dst_img);\r\n return true;\r\n }", "function woocommerce_swap_image_product() {\n\tglobal $product, $sh_option;\n\tif( $sh_option['woo-hover-flip-image'] == '1' ) {\n\t\t$attachment_ids = $product->get_gallery_image_ids();\n\t\t$attachment_ids = array_values( $attachment_ids );\n\n\t\tif( ! empty( $attachment_ids['0'] ) ) {\n\t\t\t$secondary_image_id \t= $attachment_ids['0'];\n\t\t\t$secondary_image_alt \t= get_post_meta( $secondary_image_id, '_wp_attachment_image_alt', true );\n\t\t\t$secondary_image_title \t= get_the_title( $secondary_image_id );\n\n\t\t\techo wp_get_attachment_image(\n\t\t\t\t$secondary_image_id,\n\t\t\t\t'shop_catalog',\n\t\t\t\t'',\n\t\t\t\tarray(\n\t\t\t\t\t'class' => 'secondary-image attachment-shop-catalog wp-post-image wp-post-image--secondary',\n\t\t\t\t\t'alt' \t=> $secondary_image_alt,\n\t\t\t\t\t'title' => $secondary_image_title,\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t}\n}", "public function makeImage()\n {\n $x_width = 200;\n $y_width = 125;\n\n $this->image = imagecreatetruecolor(200, 125);\n\n $this->white = imagecolorallocate($this->image, 255, 255, 255);\n $this->black = imagecolorallocate($this->image, 0, 0, 0);\n $this->red = imagecolorallocate($this->image, 255, 0, 0);\n $this->green = imagecolorallocate($this->image, 0, 255, 0);\n $this->grey = imagecolorallocate($this->image, 128, 128, 128);\n\n $this->red = imagecolorallocate($this->image, 231, 0, 0);\n\n $this->yellow = imagecolorallocate($this->image, 255, 239, 0);\n $this->green = imagecolorallocate($this->image, 0, 129, 31);\n\n $this->color_palette = [$this->red, $this->yellow, $this->green];\n\n imagefilledrectangle($this->image, 0, 0, 200, 125, $this->white);\n\n $border = 25;\n\n $lines = [\"e\", \"g\", \"b\", \"d\", \"f\"];\n $i = 0;\n foreach ($lines as $key => $line) {\n $x1 = 0;\n $x2 = $x_width;\n $y1 = $i * 15 + 25;\n $y2 = $y1;\n imageline(\n $this->image,\n $x1 + $border,\n $y1,\n $x2 - $border,\n $y2,\n $this->black\n );\n $i = $i + 1;\n }\n\n imageline(\n $this->image,\n 0 + $border,\n 25,\n 0 + $border,\n 4 * 15 + 25,\n $this->black\n );\n imageline(\n $this->image,\n 200 - $border,\n 25,\n 200 - $border,\n 4 * 15 + 25,\n $this->black\n );\n\n $textcolor = $this->black;\n\n $font = $this->default_font;\n\n $size = 10;\n $angle = 0;\n\n if (!isset($this->bar_count) or $this->bar_count == \"X\") {\n $this->bar_count = 0;\n }\n $count_notation = $this->bar_count + 1;\n\n if (file_exists($font)) {\n if (\n $count_notation != 1 or\n $count_notation == $this->max_bar_count\n ) {\n imagettftext(\n $this->image,\n $size,\n $angle,\n 0 + 10,\n 110,\n $this->black,\n $font,\n $count_notation\n );\n }\n\n if (\n $count_notation + 1 != 1 or\n $count_notation + 1 == $this->max_bar_count + 1\n ) {\n imagettftext(\n $this->image,\n $size,\n $angle,\n 200 - 25,\n 110,\n $this->black,\n $font,\n $count_notation + 1\n );\n }\n }\n }", "public function create_image(){\n\t\t$md5_hash = md5(rand(0,999));\n\t\t$security_code = substr($md5_hash, 15, 5);\n\t\t$this->Session->write('security_code',$security_code);\n\t\t$width = 80;\n\t\t$height = 22;\n\t\t$image = ImageCreate($width, $height);\n\t\t$black = ImageColorAllocate($image, 37, 170, 226);\n\t\t$white = ImageColorAllocate($image, 255, 255, 255);\n\t\tImageFill($image, 0, 0, $black);\n\t\tImageString($image, 5, 18, 3, $security_code, $white);\n\t\theader(\"Content-Type: image/jpeg\");\n\t\tImageJpeg($image);\n\t\tImageDestroy($image);\n\t}", "public function flip()\n {\n $this->items = array_flip($this->items);\n\n return $this;\n }", "public function ImageCreateForOffline($img)\n {\n list($width,$height)=getimagesize($img);\n //list($width,$height)=getimagesize(\"images/imagesevice/photoframe_bg.png\");\n $img1 = ImageCreateFromJpeg($img); \n $bg = ImageCreateFromPng(\"images/imagesevice/photoframe_bg.png\"); \n //如果图片是横的 旋转90度\n if($width > $height) {\n $img1 = imagerotate($img1, 270, 0);\n imagecopyresized($bg,$img1,13,150,0,0,720,1075,$height,$width); \n }else{\n imagecopyresized($bg,$img1,13,150,0,0,720,1075,$width,$height); \n }\n \n //$logo = ImageCreateFromPng(\"images/imagesevice/logo.png\"); \n //imagecopyresized($bg,$logo,13,10,0,0,641,29,641,29); \n \n //header(\"content-type: image/jpeg\");\n $fs = new Filesystem();\n if(!$fs->exists($this->_filedir . '/Offline'))\n $fs->mkdir($this->_filedir . '/Offline', 0700);\n $fileName = '/Offline/' . time() . rand(100,999) . '.jpg';\n $hechengImg = $this->_filedir . $fileName;\n ImageJpeg($bg,$hechengImg);\n return $fileName;\n }", "public function invert() {\n if (isset($this->_resource)) {\n imagefilter($this->_resource, IMG_FILTER_NEGATE);\n } else {\n trigger_error(\"CAMEMISResizeImage::invert() attempting to access a non-existent resource (check if the image was loaded by CAMEMISResizeImage::__construct())\", E_USER_WARNING);\n }\n\n return $this;\n }", "private function create_blank_image() {\r\n\t\t$image = imagecreatetruecolor( $this->diameter,$this->diameter );\r\n\r\n\t\t/* we also need a transparent background ... */\r\n\t\timagesavealpha($image, true);\r\n\r\n\t\t/* create a transparent color ... */\r\n\t\t$color = imagecolorallocatealpha($image, 0, 0, 0, 127);\r\n\r\n\t\t/* ... then fill the image with it ... */\r\n\t\timagefill($image, 0, 0, $color);\r\n\r\n\t\t/* nothing to do then ... just save the new image ... */\r\n\t\t$this->cutted_image = $image;\r\n\r\n\t\t/* go back and see what should we do next ..? */\r\n\t\treturn;\r\n\r\n\t}", "function createThumbImg($aprox)\n {\n // imagem de origem\n $img_origem= $this->createImg();\n\n // obtm as dimenses da imagem original\n $origem_x= ImagesX($img_origem);\n $origem_y= ImagesY($img_origem);\n \n // obtm as dimenses do thumbnail\n $vetor= $this->getThumbXY($origem_x, $origem_y, $aprox);\n $x= $vetor['x'];\n $y= $vetor['y'];\n \n // cria a imagem do thumbnail\n $img_final = ImageCreateTrueColor($x, $y);\n ImageCopyResampled($img_final, $img_origem, 0, 0, 0, 0, $x+1, $y+1, $origem_x, $origem_y);\n // o arquivo gravado\n if ($this->ext == \"png\")\n imagepng($img_final, $this->destino);\n\t\telseif ($this->ext == \"gif\")\n imagegif($img_final, $this->destino);\n elseif ($this->ext == \"jpg\")\n imagejpeg($img_final, $this->destino);\n\t\t\telseif ($this->ext == \"bmp\")\n imagewbmp($img_final, $this->destino);\n }", "function fixImageOrientation($filename) \n{\n\t$exif = @exif_read_data($filename);\n\t \n\tif($exif) \n\t{ \n\t\t//fix the Orientation if EXIF data exists\n\t\tif(!empty($exif['Orientation'])) \n\t\t{\n\t\t\tswitch($exif['Orientation']) \n\t\t\t{\n\t\t\t\tcase 3:\n\t\t\t\t$createdImage = imagerotate($filename,180,0);\n\t\t\t\tbreak;\n\t\t\t\tcase 6:\n\t\t\t\t$createdImage = imagerotate($filename,-90,0);\n\t\t\t\tbreak;\n\t\t\t\tcase 8:\n\t\t\t\t$createdImage = imagerotate($filename,90,0);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t} \n}", "public function generate(Image $image);", "protected function doActualConvert()\n {\n/*\n $im = \\Jcupitt\\Vips\\Image::newFromFile($this->source);\n //$im->writeToFile(__DIR__ . '/images/small-vips.webp', [\"Q\" => 10]);\n\n $im->webpsave($this->destination, [\n \"Q\" => 80,\n //'near_lossless' => true\n ]);\n return;*/\n\n $im = $this->createImageResource();\n $options = $this->createParamsForVipsWebPSave();\n $this->webpsave($im, $options);\n }", "protected function inverse() {\n $this->invert = true;\n return $this;\n }", "function write_translation() {\r\n $this->final_image = cloneImg($this->get_cleaned_image());\r\n foreach ($this->text_blocks as $block) {\r\n $black = imagecolorallocate($this->final_image, 0, 0, 0);\r\n $red = imagecolorallocate($this->final_image, 255, 0, 0);\r\n $green = imagecolorallocate($this->final_image, 0, 255, 0);\r\n $yellow = imagecolorallocate($this->final_image, 255, 255, 0);\r\n \r\n $translation_width=$block->translation_width;\r\n $translation_height=$block->translation_height;\r\n\r\n $block_height=round(distance($block->x4,$block->y4,$block->x1,$block->y1));\r\n $block_width=round(distance($block->x1,$block->y1,$block->x2,$block->y2));\r\n\r\n $Ix=$block->x1+($block_width-$translation_width)/2;\r\n $Iy=$block->y1+$block->translation_top_offset+($block_height-$translation_height)/2 ;\r\n $tmpx=$Ix;\r\n $tmpy=$Iy;\r\n\r\n if ($block->text_angle !=0) {\r\n $insert=rotate($Ix,$Iy, $block->x1,$block->y1,0- $block->text_angle);\r\n $Ix = $insert[0];\r\n $Iy = $insert[1];\r\n }\r\n\r\n imagettftext (\r\n $this->final_image,\r\n $block->font_size,\r\n $block->text_angle,\r\n $Ix,\r\n $Iy,\r\n $black,\r\n $block->font,\r\n $block->formatted_text );\r\n }\r\n\r\n \r\n $this->final_image_path=\"uploads/\".microtime().\".jpg\";\r\n imagewrite($this->final_image,$this->final_image_path,$quality=100);\r\n }", "function create($w,$h) {\n\n if ( $this->vertical ) {\n $this->width = $h;\n $this->height = $w;\n } else {\n $this->width = $w;\n $this->height = $h;\n }\n\n $this->img = imageCreate($this->width,$this->height);\n $this->colorIds = array();\n}", "public function ImageCreateForOnline($name)\n {\n list($width,$height)=getimagesize(\"images/imagesevice/createImg.png\");\n $authimg = imagecreate($width,$height);\n $bg_color = ImageColorAllocate($authimg,68,68,68);\n\n $bg = ImageCreateFromPng(\"images/imagesevice/createImg.png\");\n imagecopyresized($authimg,$bg,0,0,0,0,$width,$height,$width,$height); \n\n $fontfile =\"images/imagesevice/simhei.ttf\";\n putenv('GDFONTPATH=' . realpath($fontfile));\n\n $font_color = ImageColorAllocate($authimg,0,0,0); \n $box = imagettfbbox(25, 0, $fontfile, $name);\n $fontwidth = $box[4]-$box[0];\n ImageTTFText($authimg, 25, 0, ceil(($width-$fontwidth)/2), 830, $font_color, $fontfile, $name);\n\n $font_color = ImageColorAllocate($authimg,68,68,68);\n $dateTime = date(\"Y年m月d日\");\n $boxtime = imagettfbbox(15, 0, $fontfile, $dateTime);\n $datewidth = $boxtime[4]-$boxtime[0];\n ImageTTFText($authimg, 15, 0, ceil(($width-$datewidth)/2), 1175, $font_color, $fontfile, $dateTime);\n //imagestring($authimg, 5, 430, 430, date(\"Y年m月d日\"), $font_color);\n //imagestring($authimg, 5, 230, 730, $name, $font_color);\n $fs = new Filesystem();\n if(!$fs->exists($this->_filedir . '/Online'))\n $fs->mkdir($this->_filedir . '/Online', 0700);\n $fileName = '/Online/' . time() . rand(100,999) . '.png';\n $hechengImg = $this->_filedir . $fileName;\n ImagePNG($authimg,$hechengImg);\n return $fileName;\n }", "public function image_rotate_gd()\n\t{\n\t\t// Create the image handle\n\t\tif ( ! ($src_img = $this->image_create_gd()))\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\n\t\t// Set the background color\n\t\t// This won't work with transparent PNG files so we are\n\t\t// going to have to figure out how to determine the color\n\t\t// of the alpha channel in a future release.\n\n\t\t$white = imagecolorallocate($src_img, 255, 255, 255);\n\n\t\t// Rotate it!\n\t\t$dst_img = imagerotate($src_img, $this->rotation_angle, $white);\n\n\t\t// Show the image\n\t\tif ($this->dynamic_output === TRUE)\n\t\t{\n\t\t\t$this->image_display_gd($dst_img);\n\t\t}\n\t\telseif ( ! $this->image_save_gd($dst_img)) // ... or save it\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\n\t\t// Kill the file handles\n\t\timagedestroy($dst_img);\n\t\timagedestroy($src_img);\n\n\t\tchmod($this->full_dst_path, $this->file_permissions);\n\n\t\treturn TRUE;\n\t}", "function __flip(&$tmp) {\r\r\n\t\tasido::trigger_abstract_error(\r\r\n\t\t\t__CLASS__,\r\r\n\t\t\t__FUNCTION__\r\r\n\t\t\t);\r\r\n\t\t}", "function quasar_image_shadow_down(){\n\treturn '<div class=\"shadow-divider-down\"><img src=\"'.F_WAY.'/images/shadow-divider-down.png\" /></div>';\t\n}", "public function testFlip() {\n $data = array(\n 'true' => true,\n 'false' => false,\n 'null' => null,\n 'zero' => 0,\n 'stringZero' => '0',\n 'empty' => array(),\n 'array' => array(\n 'false' => false,\n 'null' => null,\n 'empty' => array()\n )\n );\n\n $this->assertEquals(array(\n 1 => 'true',\n 0 => 'stringZero',\n 'empty' => array(),\n 'array' => array(\n 'empty' => array()\n )\n ), Hash::flip($data));\n\n $data = array(\n 'foo' => 'bar',\n 1 => 'one',\n 2 => 'two',\n true,\n false,\n null,\n 'key' => 'value',\n 'baz' => 'bar',\n );\n\n $this->assertEquals(array(\n 'bar' => 'baz',\n 'one' => '',\n 'two' => '',\n 1 => '',\n 'value' => 'key'\n ), Hash::flip($data));\n\n $this->assertEquals(array(\n 1 => 'boolean',\n 123 => 'integer',\n 'foobar' => 'strings',\n 1988 => 'numeric',\n 'empty' => array(),\n 'one' => array(\n 1 => 'depth',\n 'two' => array(\n 2 => 'depth',\n 'three' => array(\n 3 => 'depth',\n 1 => 'true',\n 0 => 'zero',\n 'four' => array(\n 'five' => array(\n 'six' => array(\n 'seven' => array(\n 'We can go deeper!' => 'key'\n )\n )\n )\n )\n )\n )\n )\n ), Hash::flip($this->expanded));\n }", "function reverse()\n {\n }", "function wp_imagecreatetruecolor($width, $height)\n {\n }", "function RotatedImage($file,$x,$y,$w,$h,$angle) {\n\t\t$this->Rotate($angle,$x,$y);\n\t\t$this->Image($file,$x,$y,$w,$h);\n\t\t$this->Rotate(0);\n\t}", "function RotatedImage($file,$x,$y,$w,$h,$angle) {\n\t\t$this->Rotate($angle,$x,$y);\n\t\t$this->Image($file,$x,$y,$w,$h);\n\t\t$this->Rotate(0);\n\t}", "protected function _create($width, $height)\n {\n // Create an empty image\n $image = imagecreatetruecolor($width, $height);\n\n // Do not apply alpha blending\n imagealphablending($image, FALSE);\n\n // Save alpha levels\n imagesavealpha($image, TRUE);\n\n return $image;\n }", "public function flip() {\n $h= array_flip($this->_hash);\n if (xp::errorAt(__FILE__, __LINE__ - 1)) {\n $e= new FormatException('hash contains values which are not scalar');\n xp::gc(__FILE__);\n throw $e;\n }\n $this->_hash= $h;\n return TRUE;\n }", "function flipDiagonally($arr) {\n\t $out = array();\n\t foreach ($arr as $key => $subarr) {\n\t foreach ($subarr as $subkey => $subvalue) {\n\t $out[$subkey][$key] = $subvalue;\n\t }\n\t }\n\t return $out;\n\t}", "function fix_orientation($fileandpath) { if(!file_exists($fileandpath))\n return false;\n try {\n @$exif = read_exif_data($fileandpath, 'IFD0');\n }\n catch (Exception $exp) {\n $exif = false;\n }\n // Get all the exif data from the file\n // If we dont get any exif data at all, then we may as well stop now\n if(!$exif || !is_array($exif))\n return false;\n\n // I hate case juggling, so we're using loweercase throughout just in case\n $exif = array_change_key_case($exif, CASE_LOWER);\n\n // If theres no orientation key, then we can give up, the camera hasn't told us the\n // orientation of itself when taking the image, and i'm not writing a script to guess at it!\n if(!array_key_exists('orientation', $exif))\n return false;\n\n // Gets the GD image resource for loaded image\n $img_res = $this->get_image_resource($fileandpath);\n\n // If it failed to load a resource, give up\n if(is_null($img_res))\n return false;\n\n // The meat of the script really, the orientation is supplied as an integer,\n // so we just rotate/flip it back to the correct orientation based on what we\n // are told it currently is\n\n switch($exif['orientation']) {\n\n // Standard/Normal Orientation (no need to do anything, we'll return true as in theory, it was successful)\n case 1: return true; break;\n\n // Correct orientation, but flipped on the horizontal axis (might do it at some point in the future)\n case 2:\n $final_img = $this->imageflip($img_res, IMG_FLIP_HORIZONTAL);\n break;\n\n // Upside-Down\n case 3:\n $final_img = $this->imageflip($img_res, IMG_FLIP_VERTICAL);\n break;\n\n // Upside-Down & Flipped along horizontal axis\n case 4:\n $final_img = $this->imageflip($img_res, IMG_FLIP_BOTH);\n break;\n\n // Turned 90 deg to the left and flipped\n case 5:\n $final_img = imagerotate($img_res, -90, 0);\n $final_img = $this->imageflip($img_res, IMG_FLIP_HORIZONTAL);\n break;\n\n // Turned 90 deg to the left\n case 6:\n $final_img = imagerotate($img_res, -90, 0);\n break;\n\n // Turned 90 deg to the right and flipped\n case 7:\n $final_img = imagerotate($img_res, 90, 0);\n $final_img = $this->imageflip($img_res,IMG_FLIP_HORIZONTAL);\n break;\n\n // Turned 90 deg to the right\n case 8:\n $final_img = imagerotate($img_res, 90, 0);\n break;\n\n }\n if(!isset($final_img))\n return false;\n if (!is_writable($fileandpath)) {\n chmod($fileandpath, 0777);\n }\n unlink($fileandpath);\n\n // Save it and the return the result (true or false)\n $done = $this->save_image_resource($final_img,$fileandpath);\n\n return $done;\n }", "function drawImage($imgHeight, $imgWidth)\n{\n\t# create blank img\n\t$image = imagecreatetruecolor($imgWidth, $imgHeight);\n\n\t# rainbow color scheme\n\t$rGray = imagecolorallocate($image, 119, 119, 119);\n\t$rPink = imagecolorallocate($image, 255, 17, 153);\n\t$rRed = imagecolorallocate($image, 255, 0, 0);\n\t$rOrange = imagecolorallocate($image, 255, 119, 0);\n\t$rYellow = imagecolorallocate($image, 255, 255, 0);\n\t$rGreen = imagecolorallocate($image, 0, 136, 0);\n\t$rBlue = imagecolorallocate($image, 0, 0, 255);\n\t$rIndigo = imagecolorallocate($image, 136, 0, 255);\n\t$rViolet = imagecolorallocate($image, 221, 0, 238);\n\t\n\t# jewel color scheme\n\t$jBrown = imagecolorallocate($image, 136, 68, 17);\n\t$jPink = imagecolorallocate($image, 221, 17, 68);\n\t$jRed = imagecolorallocate($image, 119, 0, 0);\n\t$jOrange = imagecolorallocate($image, 255, 68, 0);\n\t$jYellow = imagecolorallocate($image, 255, 187, 0);\n\t$jGreen = imagecolorallocate($image, 0, 153, 0);\n\t$jBlue = imagecolorallocate($image, 0, 0, 136);\n\t$jIndigo = imagecolorallocate($image, 68, 0, 136);\n\t$jViolet = imagecolorallocate($image, 153, 0, 153);\n\t\n\t# neon color scheme\n\t$nBlack = imagecolorallocate($image, 0, 0, 0);\n\t$nPink = imagecolorallocate($image, 255, 0, 204);\n\t$nRed = imagecolorallocate($image, 255, 0, 51);\n\t$nOrange = imagecolorallocate($image, 255, 51, 0);\n\t$nYellow = imagecolorallocate($image, 204, 255, 51);\n\t$nGreen = imagecolorallocate($image, 0, 255, 0);\n\t$nBlue = imagecolorallocate($image, 0, 85, 255);\n\t$nIndigo = imagecolorallocate($image, 129, 0, 255);\n\t$nViolet = imagecolorallocate($image, 204, 0, 255);\n\n\t# construct array of rainbow colors\n\t$rainbowColorsArray = array(\n\t\t$rGray, $rPink, $rRed, $rOrange, $rYellow, $rGreen, $rBlue, $rIndigo, $rViolet);\n\n\t# construct array of jewel colors\n\t$jewelColorsArray = array(\n\t\t$jBrown, $jPink, $jRed, $jOrange, $jYellow, $jGreen, $jBlue, $jIndigo, $jViolet);\n\n\t# construct array of neon colors\n\t$neonColorsArray = array(\n\t\t$nBlack, $nPink, $nRed, $nOrange, $nYellow, $nGreen, $nBlue, $nIndigo, $nViolet);\n\n\t# figure out which color scheme to use according to user input\n\t$imgColorChoice = $_POST['imgColorChoice'];\n\t\n\tif($imgColorChoice == 1)\n\t{\n\t\t$colorSchemeArray = $rainbowColorsArray;\n\t}\t\t\t\n\telse if($imgColorChoice == 2)\n\t{\n\t\t$colorSchemeArray = $jewelColorsArray;\n\t}\n\telse if($imgColorChoice == 3)\n\t{\n\t\t$colorSchemeArray = $neonColorsArray;\n\t}\n\t\n\t# fill in with background color\n\timagefill($image, 0, 0, $colorSchemeArray[0]);\n\n\t# DRAW GRAPHICS...\n\t# polygons(x2) in center of image\n\t# imagepolygon($image, array(coords of vertices in form x1,y1, x2,y2, etc.),\n\t# \tnumber of vertices, $color)\n\timagepolygon($image, array(\n\t\t100, 400, 600, 100, 700, 300, 150, 600, 100, 400), 4, $colorSchemeArray[1]);\n\timagepolygon($image, array(\n\t\t200, 300, 250, 450, 600, 500, 350, 300, 200, 250), 4, $colorSchemeArray[5]);\n\n\t# blue \"funnel\"\n\t# imageellipse($image, x-coord of ellipse center, y-coord of ellipse center,\n\t# \tellipse width, ellipse height, $color)\n\tfor($i = 0; $i < 100; $i++)\n\t{\n\t\timageellipse($image, ($i*5)+500, $i*10, $i, $i*5, $colorSchemeArray[6]);\n\t}\n\n\t# \"whirlwind\" at bottom\n\t# imagefilledellipse($image, x-coord of ellipse center, y-coord of ellipse center,\n\t# \tellipse width, ellipse height, $color, fill mode)\n\timagefilledellipse($image, 300, 730, 300, 100, $colorSchemeArray[8]);\n\t\n\t# imagefilledarc($image, x-coord of ellipse center, y-coord of ellipse center,\n\t# \tellipse width, ellipse height, start angle, end angle, $color, fill mode)\n\timagefilledarc($image, 300, 705, 250, 75, 90, 360, $colorSchemeArray[4], IMG_ARC_NOFILL);\n\timagefilledarc($image, 325, 705, 250, 75, 300, 45, $colorSchemeArray[2], IMG_ARC_NOFILL);\n\timagefilledarc($image, 330, 725, 225, 60, 0, 330, $colorSchemeArray[6], IMG_ARC_NOFILL);\n\timagefilledarc($image, 325, 680, 225, 55, 0, 300, $colorSchemeArray[1], IMG_ARC_NOFILL);\n\timagefilledarc($image, 320, 700, 225, 55, 50, 180, $colorSchemeArray[7], IMG_ARC_NOFILL);\n\timagefilledarc($image, 275, 730, 200, 70, 270, 180, $colorSchemeArray[5], IMG_ARC_NOFILL);\n\timagefilledarc($image, 335, 650, 175, 50, 0, 300, $colorSchemeArray[3], IMG_ARC_NOFILL);\n\timagefilledarc($image, 340, 670, 175, 55, 250, 60, $colorSchemeArray[4], IMG_ARC_NOFILL);\n\n\t# star polygon\n\t# imagepolygon($image, array(coords of vertices in form x1,y1, x2,y2, etc.),\n\t# \tnumber of vertices, $color)\n\tfor($i = 0; $i < 10; $i++)\n\t{\n\t\timagepolygon($image, array(\n\t\t\t0, 20, \n\t\t\t733-($i*3), ($i*3)+33, \n\t\t\t750-($i*3), ($i*3)+$i, \n\t\t\t766-($i*3), ($i*3)+33, \n\t\t\t800-($i*3), ($i*3)+33, \n\t\t\t775-($i*3), ($i*3)+66, \n\t\t\t800-($i*3), ($i*3)+100, \n\t\t\t755-($i*3), ($i*3)+85, \n\t\t\t780, 800, \n\t\t\t725, ($i*3)+66, \n\t\t\t0, 20), \n\t\t\t10, $colorSchemeArray[5]);\n\t}\n\n\t# interconnected loops\n\t# imagearc($image, x-coord of ellipse center, y-coord of ellipse center,\n\t# \tellipse width, ellipse height, start angle, end angle, $color)\n\tfor($i = 0; $i < 50; $i++)\n\t{\n\t\timagearc($image, 600, 700, ($i+100), ($i+100), 0, 360, $colorSchemeArray[1]);\n\t\timagearc($image, 600, 500, ($i+100), ($i+100), 0, 360, $colorSchemeArray[4]);\n\t\timagearc($image, 600, 600, ($i+100), ($i+100), 0, 360, $colorSchemeArray[5]);\n\t\timagearc($image, 700, 600, ($i+100), ($i+100), 0, 360, $colorSchemeArray[1]);\n\t\timagearc($image, 500, 600, ($i+100), ($i+100), 0, 360, $colorSchemeArray[4]);\t\n\t}\n\n\t# \"beach ball\"\t \n\t# imagefilledarc($image, x-coord of ellipse center, y-coord of ellipse center,\n\t# \tellipse width, ellipse height, start angle, end angle, $color, fill mode)\n\timagefilledarc($image, 110, 110, 200, 200, 0, 50, $colorSchemeArray[2], IMG_ARC_CHORD);\n\timagefilledarc($image, 110, 110, 200, 200, 60, 110, $colorSchemeArray[6], IMG_ARC_CHORD);\n\timagefilledarc($image, 110, 110, 200, 200, 120, 170, $colorSchemeArray[1], IMG_ARC_CHORD);\n\timagefilledarc($image, 110, 110, 200, 200, 180, 230, $colorSchemeArray[5], IMG_ARC_CHORD);\n\timagefilledarc($image, 110, 110, 200, 200, 240, 290, $colorSchemeArray[3], IMG_ARC_CHORD);\n\timagefilledarc($image, 110, 110, 200, 200, 300, 350, $colorSchemeArray[4], IMG_ARC_CHORD);\n\t\n\t# give each segment of \"beach ball\" a \"cutout\"\n\t# imagefilledarc($image, x-coord of ellipse center, y-coord of ellipse center,\n\t# \tellipse width, ellipse height, start angle, end angle, $color, fill mode)\n\timagefilledarc($image, 110, 110, 150, 150, 2, 48, $colorSchemeArray[0], IMG_ARC_CHORD);\n\timagefilledarc($image, 110, 110, 150, 150, 62, 108, $colorSchemeArray[0], IMG_ARC_CHORD);\n\timagefilledarc($image, 110, 110, 150, 150, 122, 168, $colorSchemeArray[0], IMG_ARC_CHORD);\n\timagefilledarc($image, 110, 110, 150, 150, 182, 228, $colorSchemeArray[0], IMG_ARC_CHORD);\n\timagefilledarc($image, 110, 110, 150, 150, 242, 288, $colorSchemeArray[0], IMG_ARC_CHORD);\n\timagefilledarc($image, 110, 110, 150, 150, 302, 348, $colorSchemeArray[0], IMG_ARC_CHORD);\n\n\t# lines fanning out\n\t# imageline($image, x1, y1, x2, y2, $color). \n\t# draws line from coords (x1,y1) to (x2,y2).\n\tfor($i = 0; $i < 70; $i++)\n\t{\n\t\timageline($image, 0, 800, $i*5, $i+500, $colorSchemeArray[7]);\n\t\timageline($image, 300, 500, $i*5, $i+500, $colorSchemeArray[3]);\n\t}\n\n\t# thick crossing lines\n\timagesetthickness($image, 25);\n\n\t# imageline($image, x1, y1, x2, y2, $color). \n\t# draws line from coords (x1,y1) to (x2,y2).\n\timageline($image, 350, 0, 0, 450, $colorSchemeArray[8]);\n\timageline($image, 360, 0, 0, 460, $colorSchemeArray[5]);\n\timageline($image, 380, 0, 0, 480, $colorSchemeArray[2]);\n\n\timageline($image, 0, 400, 450, 0, $colorSchemeArray[1]);\n\timageline($image, 0, 410, 460, 0, $colorSchemeArray[4]);\n\timageline($image, 0, 430, 480, 0, $colorSchemeArray[7]);\n\n\t# save img out to temp directory\n\timagepng($image, \"../temp/tempPNG.png\");\n\n\t# output img according to user-supplied dimensions\n\techo \"\t<img src='../temp/tempPNG.png' alt='artistic expression image' \".\n\t\"height='$imgHeight' width='$imgWidth' />\\n\";\n\n\t# clear buffer of image\n\timagedestroy($image);\n}", "function frameImage($inside = 0, $imagesPath = array(), $imgHeight = 600, $imagesWidth = array(), $imagesAngles = array(), $poleColor = null, $poleWidth = 1, $poleHeight = 1)\n{ \n $rowImagick = new Imagick();\n \n foreach($imagesPath as $imgIndex => $imgPath) {\n $imagick = new Imagick(realpath($imgPath));\n\n $imagick->getImageGeometry();\n $imgGeo = $imagick->getImageGeometry();\n $imgOrgWidth = $imgGeo['width'];\n $imgOrgHeight = $imgGeo['height'];\n $imgWidth = $imagesWidth[$imgIndex];\n\n if(isset($imagesAngles[$imgIndex])) {\n $angleX = ($imagesAngles[$imgIndex]) == 90 ? - ($imagesAngles[$imgIndex] - 10) : - $imagesAngles[$imgIndex];\n } else {\n $angleX = -100;\n }\n $angleY = 0;\n $thetX = deg2rad ($angleX);\n $thetY = deg2rad ($angleY);\n\n $s_x1y1 = array(0, 0); // LEFT BOTTOM\n $s_x2y1 = array($imgWidth, 0); // RIGHT BOTTOM\n $s_x1y2 = array(0, $imgHeight); // LEFT TOP\n $s_x2y2 = array($imgWidth, $imgHeight); // RIGHT TOP\n\n $d_x1y1 = array(\n $s_x1y1[0] * cos($thetX) - $s_x1y1[1] * sin($thetY),\n $s_x1y1[0] * sin($thetX) + $s_x1y1[1] * cos($thetY)\n );\n $d_x2y1 = array(\n $s_x2y1[0] * cos($thetX) - $s_x2y1[1] * sin($thetY),\n $s_x2y1[0] * sin($thetX) + $s_x2y1[1] * cos($thetY)\n );\n $d_x1y2 = array(\n $s_x1y2[0] * cos($thetX) - $s_x1y2[1] * sin($thetY),\n $s_x1y2[0] * sin($thetX) + $s_x1y2[1] * cos($thetY)\n );\n $d_x2y2 = array(\n $s_x2y2[0] * cos($thetX) - $s_x2y2[1] * sin($thetY),\n $s_x2y2[0] * sin($thetX) + $s_x2y2[1] * cos($thetY)\n );\n\n $imageprops = $imagick->getImageGeometry();\n $imagick->setImageBackgroundColor(new ImagickPixel('transparent'));\n $imagick->resizeimage($imgWidth, $imgHeight, \\Imagick::FILTER_LANCZOS, 0, true); \n if($poleColor) {\n $imagick->borderImage($poleColor, $poleWidth, $poleHeight);\n }\n\n $points = array(\n $s_x1y2[0], $s_x1y2[1], # Source Top Left\n $d_x1y2[0], $d_x1y2[1], # Destination Top Left\n $s_x1y1[0], $s_x1y1[1], # Source Bottom Left \n $d_x1y1[0], $d_x1y1[1], # Destination Bottom Left \n $s_x2y1[0], $s_x2y1[1], # Source Bottom Right \n $d_x2y1[0], $d_x2y1[1], # Destination Bottom Right \n $s_x2y2[0], $s_x2y2[1], # Source Top Right \n $d_x2y2[0], $d_x2y2[1] # Destination Top Right \n );\n //echo '<pre>'; print_r($points); die;\n\n $imagick->setImageVirtualPixelMethod(\\Imagick::VIRTUALPIXELMETHOD_BACKGROUND);\n $imagick->distortImage(\\Imagick::DISTORTION_PERSPECTIVE, $points, true);\n //$imagick->scaleImage($imgWidth, $imgHeight, false);\n $rowImagick->addImage($imagick); \n }\n\n $rowImagick->resetIterator();\n $combinedRow = $rowImagick->appendImages(false);\n\n $canvas = generateFinalImage($combinedRow);\n header(\"Content-Type: image/png\");\n echo $canvas->getImageBlob();\n}", "function create_winner_image($player_left, $player_right) {\n $i = imagecreatefrompng(_PWD . '/images/winner.png');\n\n $levelsketch = imagecreatefrompng(_PWD . '/images/levelsketch.png');\n\n // Coordinates for background images in the levelsketch.png file\n // Backgrounds are around 330x190\n $backgrounds = array(\n array(0, 0),\n array(330, 0),\n array(660, 0),\n array(0, 190),\n array(330, 190)\n );\n\n // Coordinates for character images from the char_*.png files\n // Character sprites are 80x80\n $characters = array(\n array(880, 720), // Winner\n array(720, 0) // Loser\n );\n\n // Characters are stored as a hex value on the leaderboards. The process.php script translates them\n // to decimal which is used as the index for this array\n $colors = array(\n 'orange',\n 'red',\n 'green',\n 'blue',\n 'white',\n 'pink',\n 'yellow',\n 'brown',\n 'purple',\n 'black',\n 'cyan',\n 'lime',\n 'dlc1',\n 'dlc2',\n 'dlc3',\n 'dlc4',\n 'dlc5',\n 'dlc6',\n 'dlc7',\n 'dlc8'\n );\n\n $white = imagecolorallocate($i, 255, 255, 255);\n $black = imagecolorallocate($i, 0, 0, 0);\n\n // Get left side player icon\n $icon_left = imagecreatefromjpeg(_PWD . '/images/' . $player_left->steamid . '.jpg');\n list($width_left, $height_left) = getimagesize(_PWD . '/images/' . $player_left->steamid . '.jpg');\n $left_text = ($player_left->score > $player_right->score ? $player_left->hashtag : date('m-d-Y'));\n $left_level = substr($player_left->level, 0, 1) - 1;\n\n imagefilledrectangle($i, 131, 241, 132 + ($width_left / 2), 242 + ($height_left / 2), $white);\n imagecopyresized($i, $icon_left, 132, 242, 0, 0, ($width_left / 2), ($height_left / 2), $width_left, $height_left);\n\n // Place left side character \n $character_coords = ($player_left->score > $player_right->score ? $characters[0] : $characters[1]);\n $character = imagecreatefrompng(_PWD . '/images/char_' . $colors[$player_left->character] . '.png');\n imagecopy($i, $character, 300, 300, $character_coords[0], $character_coords[1], 80, 80);\n imagedestroy($character);\n\n // Copy left player level to image\n imagecopy($i, $levelsketch, 95, 28, $backgrounds[$left_level][0], $backgrounds[$left_level][1], 330, 190);\n\n // Fill out left side of book text\n imagettfstroketext($i, 24.0, 0, 175, 265, $white, $black, 'fonts/Tekton-Bold', $player_left->string, 3);\n imagettfstroketext($i, 20.0, 0, 145, 308, $white, $black, 'fonts/Tekton-Bold', 'Level ' .$player_left->level, 3);\n imagettfstroketext($i, 20.0, 0, 145, 348, $white, $black, 'fonts/Tekton-Bold', $player_left->score, 3);\n imagettftext($i, 16.0, 0, 210, 433, $black, 'fonts/Tekton-Bold', $left_text);\n\n // Get right side player icon\n $icon_right = imagecreatefromjpeg(_PWD . '/images/' . $player_right->steamid . '.jpg');\n list($width_right, $height_right) = getimagesize(_PWD . '/images/' . $player_right->steamid . '.jpg');\n $right_text = ($player_right->score > $player_left->score ? $player_right->hashtag : date('m-d-Y'));\n $right_level = substr($player_right->level, 0, 1) - 1;\n\n imagefilledrectangle($i, 541, 241, 542 + ($width_right / 2), 242 + ($height_right / 2), $white);\n imagecopyresized($i, $icon_right, 542, 242, 0, 0, ($width_right / 2), ($height_right / 2), $width_right, $height_right);\n\n // Place right side character. Have to flip it horizontally. My installed version of PHP doesn't have the \n // native imageflip function so I included one from Stack Overflow here. I modified it slightly to preserve\n // transparency.\n $character_coords = ($player_right->score > $player_left->score ? $characters[0] : $characters[1]);\n $temp = imagecreatetruecolor(80, 80);\n $character = imagecreatefrompng(_PWD . '/images/char_' . $colors[$player_right->character] . '.png');\n imagealphablending($temp, false);\n imagesavealpha($temp, true);\n imagecopy($temp, $character, 0, 0, $character_coords[0], $character_coords[1], 80, 80);\n imageflip($temp, IMG_FLIP_HORIZONTAL);\n imagecopy($i, $temp, 535, 300, 0, 0, 80, 80);\n imagedestroy($temp);\n imagedestroy($character);\n \n // Copy right player level to image\n imagecopy($i, $levelsketch, 485, 28, $backgrounds[$right_level][0], $backgrounds[$right_level][1], 330, 190);\n\n // Fill out right side book text\n imagettfstroketext($i, 24.0, 0, 583, 265, $white, $black, 'fonts/Tekton-Bold', $player_right->string, 3);\n imagettfstroketext($i, 20.0, 0, 678, 308, $white, $black, 'fonts/Tekton-Bold', 'Level ' . $player_right->level, 3);\n imagettfstroketext($i, 20.0, 0, 678, 348, $white, $black, 'fonts/Tekton-Bold', $player_right->score, 3);\n imagettftext($i, 16.0, 0, 610, 433, $black, 'fonts/Tekton-Bold', $right_text);\n\n imagettftext($i, 10.0, 0, 745, 470, $black, 'fonts/Tekton-Bold', '@KlepekVsRemo');\n\n // Preserve transparency\n imagealphablending($i, false);\n imagesavealpha($i, true);\n\n // Save with highest compression and lowest filesize\n // Would like to decrease filesize further, but haven't been able to as yet\n imagepng($i, _PWD . '/images/daily_winner.png', 9, PNG_ALL_FILTERS);\n\n imagedestroy($levelsketch);\n imagedestroy($icon_left);\n imagedestroy($icon_right);\n imagedestroy($i); \n }", "public function generate($cache = true)\n {\n if ($cache)\n {\n $d = $this->cache_get();\n if ($d) return $d;\n }\n\n $src_img = $this->image->load();\n\n // get image info - TODO: error handling\n $size = getimagesize($this->image->file->path);\n $exif = $this->image->get_exif();\n\n $src_width = $size[0];\n $src_height = $size[1];\n $max_width = $this->max_width;\n $max_height = $this->max_height;\n\n // shall be rotated? switch width/height temporarily and rotate after image has been scaled\n $rotation = $exif->get_rotation();\n if ($rotation) {\n $t = $max_height;\n $max_height = $max_width;\n $max_width = $t;\n }\n\n // calculate new size\n if ($src_width / $src_height > $max_width / $max_height) {\n $new_width = $max_width;\n $new_height = round($max_width / $src_width * $src_height);\n } else {\n $new_height = $max_height;\n $new_width = round($max_height / $src_height * $src_width);\n }\n\n // create new image\n $new_img = imagecreatetruecolor($new_width, $new_height);\n\n // copy to new image\n imagecopyresampled($new_img, $src_img, 0, 0, 0, 0, $new_width, $new_height, $src_width, $src_height);\n imagedestroy($src_img);\n\n // rotate?\n if ($rotation) {\n $rotated = imagerotate($new_img, $rotation, 0);\n imagedestroy($new_img);\n $new_img = $rotated;\n\n // switch width/height back\n #$t = $new_height;\n #$new_height = $new_width;\n #$new_width = $t;\n }\n\n // catch output\n ob_start();\n ob_clean();\n imagejpeg($new_img, null, $this->quality);\n imagedestroy($new_img);\n\n $data = ob_get_contents();\n ob_clean();\n\n // save cache\n $this->cache_save($data);\n\n return $data;\n }", "function RotatedImage($file,$x,$y,$w,$h,$angle)\n {\n $this->Rotate($angle,$x,$y);\n $this->Image($file,$x,$y,$w,$h);\n $this->Rotate(0);\n }", "public function toGDImage() {}", "function RotatedImage($file,$x,$y,$w,$h,$angle)\n\t{\n\t $this->Rotate($angle,$x,$y);\n\t $this->Image($file,$x,$y,$w,$h);\n\t $this->Rotate(0);\n\t}", "public function interlace()\n\t{\n\t\t$this->checkImage();\n\t\t$imageX = $this->optimalWidth;\n\t\t$imageY = $this->optimalHeight;\n\n\t\t$black = imagecolorallocate($this->imageResized, 0, 0, 0);\n\t\tfor ($y = 1; $y < $imageY; $y += 2) {\n\t\t\timageline($this->imageResized, 0, $y, $imageX, $y, $black);\n\t\t}\n\n\t\treturn $this;\n\t}", "protected function adjustImageOrientation()\n { \n $exif = @exif_read_data($this->file);\n \n if($exif && isset($exif['Orientation'])) {\n $orientation = $exif['Orientation'];\n \n if($orientation != 1){\n $img = imagecreatefromjpeg($this->file);\n \n $mirror = false;\n $deg = 0;\n \n switch ($orientation) {\n \n case 2:\n $mirror = true;\n break;\n \n case 3:\n $deg = 180;\n break;\n \n case 4:\n $deg = 180;\n $mirror = true; \n break;\n \n case 5:\n $deg = 270;\n $mirror = true; \n break;\n \n case 6:\n $deg = 270;\n break;\n \n case 7:\n $deg = 90;\n $mirror = true; \n break;\n \n case 8:\n $deg = 90;\n break;\n }\n \n if($deg) $img = imagerotate($img, $deg, 0); \n if($mirror) $img = $this->mirrorImage($img);\n \n $this->image = str_replace('.jpg', \"-O$orientation.jpg\", $this->file); \n imagejpeg($img, $this->file, $this->quality);\n }\n }\n }", "public function reversed();", "public function transform(sfImage $image)\r\n {\r\n\r\n // Get the actual image resource\r\n $resource = $image->getAdapter()->getHolder();\r\n\r\n //get the resource dimentions\r\n $width = $image->getWidth();\r\n $height = $image->getHeight();\r\n\r\n $reflection = $image->copy();\r\n\r\n $reflection->flip()->resize($width, $this->reflection_height);\r\n\r\n $r_resource = $reflection->getAdapter()->getHolder();\r\n\r\n $dest_resource = $reflection->getAdapter()->getTransparentImage($width, $height + $this->reflection_height);\r\n\r\n imagecopymerge($dest_resource, $resource, 0, 0, 0 ,0, $width, $height, 100);\r\n\r\n imagecopymerge($dest_resource, $r_resource, 0, $height, 0 ,0, $width, $this->reflection_height, 100);\r\n\r\n // Increments we are going to increase the transparency\r\n $increment = 100 / $this->reflection_height;\r\n\r\n // Overlay line we use to apply the transparency\r\n $line = imagecreatetruecolor($width, 1);\r\n\r\n // Use white as our overlay color\r\n imagefilledrectangle($line, 0, 0, $width, 1, imagecolorallocate($line, 255, 255, 255));\r\n\r\n $tr = $this->start_transparency;\r\n\r\n // Start at the bottom of the original image\r\n for ($i = $height; $i <= $height + $this->reflection_height; $i++)\r\n {\r\n\r\n if ($tr > 100)\r\n {\r\n $tr = 100;\r\n }\r\n\r\n imagecopymerge($dest_resource, $line, 0, $i, 0, 0, $width, 1, $tr);\r\n\r\n $tr += $increment;\r\n\r\n }\r\n\r\n // To set a new resource for the image object\r\n $image->getAdapter()->setHolder($dest_resource);\r\n\r\n return $image;\r\n }", "function createthumb($name,$filename,$new_w,$new_h) {\n $system=explode(\".\",$name);\n if (preg_match(\"/jpg|jpeg/\", $system[sizeof($system) - 1])) {\n $src_img=imagecreatefromjpeg($name);\n } else return;\n\n $old_x=imageSX($src_img);\n $old_y=imageSY($src_img);\n if ($old_x > $old_y) {\n $thumb_w=$new_w;\n $thumb_h=$old_y*($new_h/$old_x);\n }\n if ($old_x < $old_y) {\n $thumb_w=$old_x*($new_w/$old_y);\n $thumb_h=$new_h;\n }\n if ($old_x == $old_y) {\n $thumb_w=$new_w;\n $thumb_h=$new_h;\n }\n $dst_img=ImageCreateTrueColor($thumb_w,$thumb_h);\n imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y);\n echo imagejpeg($dst_img,$filename);\n\n imagedestroy($dst_img);\n imagedestroy($src_img);\n}", "function uds_invert_product_property_matrix($table)\n{\n\t$inverted = array();\n\t\n\tif(empty($table['properties'])) return array();\n\tif(empty($table['products'])) return array();\n\t\n\tforeach($table['properties'] as $name => $type) {\n\t\t$row = array();\n\t\t$row[] = $name;\t\n\t\t\n\t\tforeach($table['products'] as $product) {\n\t\t\tif($type == 'checkbox') {\n\t\t\t\tif($product['properties'][$name] == 'on') {\n\t\t\t\t\t//@since4.0 - now using font-awesome vector image\n\t\t\t\t\t//$row[] = \"<img src='\".UDS_PRICING_URL.\"/images/checkbox.png' alt='' />\";\n\t\t\t\t\t$row[] = \"<i class=\\\"fa fa-check\\\" style=\\\"color:#000;font-size:18px;\\\"></i>\";\n\t\t\t\t} else {\n\t\t\t\t\t$row[] = \"-\";\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$row[] = esc_html($product['properties'][$name]);\n\t\t\t}\n\t\t}\n\t\t$inverted[] = $row;\n\t}\n\t\n\treturn $inverted;\n}", "function createNewImage($oldType, $oldFile, $newSizeX, $newSizeY, $oldSizeX, $oldSizeY) {\n\n // Load original image\n $fnCreateImage = 'imagecreatefrom' . $oldType;\n $oldImage = $fnCreateImage($oldFile);\n\n // Create new image\n $newImage = imagecreatetruecolor($newSizeX, $newSizeY);\n imagesavealpha($newImage, true);\n imagealphablending($newImage, false);\n imagecopyresampled($newImage, $oldImage, 0, 0, 0, 0, $newSizeX, $newSizeY, $oldSizeX, $oldSizeY);\n\n return $newImage;\n }", "public function getImage() {\n $items = $this->getItems();\n shuffle($items); // Randomize order of items to generate different baords each load\n $board_arrangement = $this->arrange($items);\n\n $image = imagecreatetruecolor(IMGSIZE, IMGSIZE);\n $black = imagecolorallocate($image, 0, 0, 0);\n imagefill($image, 0, 0, $black);\n\n return $this->drawImage($image, $board_arrangement, 0, 0, IMGSIZE);\n }", "function imagecreatefrombmp($file)\n{\n global $CurrentBit, $echoMode;\n\n $Data = '';\n $f = fopen($file, \"r\");\n $Header = fread($f, 2);\n\n if ($Header == \"BM\") {\n $Size = freaddword($f);\n $Reserved1 = freadword($f);\n $Reserved2 = freadword($f);\n $FirstByteOfImage = freaddword($f);\n\n $SizeBITMAPINFOHEADER = freaddword($f);\n $Width = freaddword($f);\n $Height = freaddword($f);\n $biPlanes = freadword($f);\n $biBitCount = freadword($f);\n $RLECompression = freaddword($f);\n $WidthxHeight = freaddword($f);\n $biXPelsPerMeter = freaddword($f);\n $biYPelsPerMeter = freaddword($f);\n $NumberOfPalettesUsed = freaddword($f);\n $NumberOfImportantColors = freaddword($f);\n\n if ($biBitCount < 24) {\n $img = imagecreate($Width, $Height);\n $Colors = pow(2, $biBitCount);\n for($p = 0; $p < $Colors; $p ++) {\n $B = freadbyte($f);\n $G = freadbyte($f);\n $R = freadbyte($f);\n $Reserved = freadbyte($f);\n $Palette [] = imagecolorallocate($img, $R, $G, $B);\n }\n\n if ($RLECompression == 0) {\n $Zbytek =(4 - ceil(($Width /(8 / $biBitCount)))% 4) % 4;\n\n for($y = $Height - 1; $y >= 0; $y --) {\n $CurrentBit = 0;\n for($x = 0; $x < $Width; $x ++) {\n $C = freadbits($f, $biBitCount);\n imagesetpixel($img, $x, $y, $Palette [$C]);\n }\n if ($CurrentBit != 0) {\n freadbyte($f);\n }\n for($g = 0; $g < $Zbytek; $g ++) {\n freadbyte($f);\n }\n }\n\n }\n }\n\n if ($RLECompression == 1) //$BI_RLE8\n {\n $y = $Height;\n $pocetb = 0;\n\n while (true) {\n $y--;\n $prefix = freadbyte($f);\n $suffix = freadbyte($f);\n $pocetb += 2;\n\n $echoit = false;\n\n if ($echoit) {\n echo \"Prefix: $prefix Suffix: $suffix<BR>\";\n }\n if (($prefix == 0) and($suffix == 1)) {\n break;\n }\n if (feof($f)) {\n break;\n }\n\n while (!(($prefix == 0) and($suffix == 0))) {\n if ($prefix == 0) {\n $pocet = $suffix;\n $Data .= fread($f, $pocet);\n $pocetb += $pocet;\n if ($pocetb % 2 == 1) {\n freadbyte($f);\n $pocetb ++;\n }\n }\n\n if ($prefix > 0) {\n $pocet = $prefix;\n for($r = 0; $r < $pocet; $r ++) {\n $Data .= chr($suffix);\n }\n }\n $prefix = freadbyte($f);\n $suffix = freadbyte($f);\n $pocetb += 2;\n if ($echoit) {\n echo \"Prefix: $prefix Suffix: $suffix<BR>\";\n }\n }\n\n for($x = 0; $x < strlen($Data); $x ++) {\n imagesetpixel($img, $x, $y, $Palette [ord($Data [$x])]);\n }\n $Data = '';\n\n }\n\n }\n\n if ($RLECompression == 2) //$BI_RLE4\n {\n $y = $Height;\n $pocetb = 0;\n\n /*while (!feof($f))\n echo freadbyte($f).'_'.freadbyte($f).\"<BR>\";*/\n while (true) {\n //break;\n $y --;\n $prefix = freadbyte($f);\n $suffix = freadbyte($f);\n $pocetb += 2;\n\n $echoit = false;\n\n if ($echoit) {\n echo \"Prefix: $prefix Suffix: $suffix<BR>\";\n }\n if (($prefix == 0) and($suffix == 1)) {\n break;\n }\n if (feof($f)) {\n break;\n }\n\n while (!(($prefix == 0) and($suffix == 0))) {\n if ($prefix == 0) {\n $pocet = $suffix;\n\n $CurrentBit = 0;\n for($h = 0; $h < $pocet; $h ++) {\n $Data .= chr(freadbits($f, 4));\n }\n if ($CurrentBit != 0) {\n freadbits($f, 4);\n }\n $pocetb += ceil(($pocet / 2));\n if ($pocetb % 2 == 1) {\n freadbyte($f);\n $pocetb ++;\n }\n }\n\n if ($prefix > 0) {\n $pocet = $prefix;\n $i = 0;\n for($r = 0; $r < $pocet; $r ++) {\n if ($i % 2 == 0) {\n $Data .= chr($suffix % 16);\n } else {\n $Data .= chr(floor($suffix / 16));\n }\n $i ++;\n }\n }\n $prefix = freadbyte($f);\n $suffix = freadbyte($f);\n $pocetb += 2;\n if ($echoit) {\n echo \"Prefix: $prefix Suffix: $suffix<BR>\";\n }\n }\n\n for($x = 0; $x < strlen($Data); $x ++) {\n imagesetpixel($img, $x, $y, $Palette [ord($Data [$x])]);\n }\n $Data = '';\n\n }\n\n }\n\n if ($biBitCount == 24) {\n $img = imagecreatetruecolor($Width, $Height);\n $Zbytek = $Width % 4;\n\n for($y = $Height - 1; $y >= 0; $y --) {\n for($x = 0; $x < $Width; $x ++) {\n $B = freadbyte($f);\n $G = freadbyte($f);\n $R = freadbyte($f);\n $color = imagecolorexact($img, $R, $G, $B);\n if ($color == - 1)\n $color = imagecolorallocate($img, $R, $G, $B);\n imagesetpixel($img, $x, $y, $color);\n }\n for($z = 0; $z < $Zbytek; $z ++) {\n freadbyte($f);\n }\n }\n\n }\n\n return $img;\n\n }\n\n fclose($f);\n\n}", "function create() {\n Comparrot::create();\n}", "public function apply() {\n\t\t$w = $this->getWidth();\n\t\t$h = $this->getHeight();\n\n\t\timagecopyresampled($this->original->getImage(), $this->getImage(), $this->x, $this->y, 0, 0, $w, $h, $w, $h);\n\t}", "function drawImage($filename){\n $img=imagecreatetruecolor(400,300);\n drawFromUserdata($img); //draw on $img\n imagepng($img, $filename); //output the $img to the given $filename as PNG\n imagedestroy($img); //destroy the $img\n }" ]
[ "0.7195381", "0.6903706", "0.6870645", "0.6819707", "0.6819531", "0.6662779", "0.64357245", "0.6301936", "0.61989546", "0.6156402", "0.6132216", "0.5997638", "0.5989538", "0.59817857", "0.5978206", "0.592543", "0.5844693", "0.57515925", "0.5711293", "0.5709704", "0.57010496", "0.5697514", "0.56868196", "0.5657939", "0.5585077", "0.5543021", "0.5521848", "0.552057", "0.5502016", "0.5468395", "0.5437749", "0.5421923", "0.53693247", "0.535245", "0.5312113", "0.53118956", "0.5307522", "0.52819425", "0.52644956", "0.5185123", "0.517316", "0.509102", "0.5089156", "0.5067877", "0.49967763", "0.49961528", "0.49020204", "0.48727518", "0.4869557", "0.48672038", "0.48637083", "0.4862568", "0.48286343", "0.4811962", "0.47706056", "0.47700182", "0.4745273", "0.4744044", "0.4740031", "0.472925", "0.4720795", "0.47198477", "0.47086692", "0.46895176", "0.46785268", "0.46707204", "0.4659163", "0.46587622", "0.4644475", "0.46392697", "0.4636506", "0.46073613", "0.45693985", "0.4562581", "0.45618242", "0.45585686", "0.45585686", "0.45580852", "0.4535133", "0.4525765", "0.45107108", "0.4505378", "0.4503966", "0.45006105", "0.4498431", "0.44981498", "0.44952807", "0.4489965", "0.44798002", "0.4469079", "0.44667026", "0.44649348", "0.44534788", "0.44494635", "0.44376487", "0.44369492", "0.44308588", "0.4429962", "0.44194958", "0.4418295" ]
0.66774774
5
Loads image if not yet loaded
protected function _do_background($r, $g, $b, $opacity) { $this->_load_image(); // Convert an opacity range of 0-100 to 127-0 $opacity = round(abs(($opacity * 127 / 100) - 127)); // Create a new background $background = $this->_create($this->width, $this->height); // Allocate the color $color = imagecolorallocatealpha($background, $r, $g, $b, $opacity); // Fill the image with white imagefilledrectangle($background, 0, 0, $this->width, $this->height, $color); // Alpha blending must be enabled on the background! imagealphablending($background, TRUE); // Copy the image onto a white background to remove all transparency if (imagecopy($background, $this->_image, 0, 0, 0, 0, $this->width, $this->height)) { // Swap the new image for the old one imagedestroy($this->_image); $this->_image = $background; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadImage()\n\t{\n\t\tswitch ($this->type) {\n\t\t\tcase 1:\n\t\t\t\t$this->ImageStream = @imagecreatefromgif($this->sFileLocation);\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\t$this->ImageStream = @imagecreatefromjpeg($this->sFileLocation);\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\t$this->ImageStream = @imagecreatefrompng($this->sFileLocation);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t$this->printError('invalid imagetype');\n\t\t}\n\n\t\tif (!$this->ImageStream) {\n\t\t\t$this->printError('image not loaded');\n\t\t}\n\t}", "public function load_image()\n\t{\n if (file_exists($this->local_file)) {\n $image_size = $this->image_size();\n if (preg_match('/jpeg/', $image_size['mime'])) {\n $file = imagecreatefromjpeg($this->local_file);\n } elseif (preg_match('/gif/', $image_size['mime'])) {\n $file = imagecreatefromgif($this->local_file);\n } elseif (preg_match('/png/', $image_size['mime'])) {\n $file = imagecreatefrompng($this->local_file);\n } else {\n \t$file = null;\n }\n return $file;\n }\n\t}", "private function lazyLoad(): void\n\t{\n\t\tif (empty($this->_resource)) {\n\t\t\tif ($this->_cache && !$this->isCacheExpired()) {\n\t\t\t\t$this->_cacheSkip = true;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t$resource = $this->getImageResource($this->_imagePath, $this->_extension);\n\t\t\t$this->_resource = $resource;\n\t\t}\n\t}", "protected function _load_image()\n {\n if ( ! is_resource($this->_image))\n {\n // Gets create function\n $create = $this->_create_function;\n\n // Open the temporary image\n $this->_image = $create($this->file);\n\n // Preserve transparency when saving\n imagesavealpha($this->_image, TRUE);\n }\n }", "public function load()\n\t{\n\t\tif (!$this->isValidImage()) {\n\t\t\treturn false;\n\t\t}\n\n\t\t$this->image = new SimpleImage();\n\n\t\t$this->image->fromFile($this->source_path);\n\n\t\treturn true;\n\t}", "protected function loadImage()\n {\n if (!is_resource($this->tmpImage)) {\n $create = $this->createFunctionName;\n $this->tmpImage = $create($this->filePath);\n imagesavealpha($this->tmpImage, true);\n }\n }", "function loadFile ($image) {\r\n if ( !$dims=@GetImageSize($image) ) {\r\n trigger_error('Could not find image '.$image);\r\n return false;\r\n }\r\n if ( in_array($dims['mime'],$this->types) ) {\r\n $loader=$this->imgLoaders[$dims['mime']];\r\n $this->source=$loader($image);\r\n $this->sourceWidth=$dims[0];\r\n $this->sourceHeight=$dims[1];\r\n $this->sourceMime=$dims['mime'];\r\n $this->initThumb();\r\n return true;\r\n } else {\r\n trigger_error('Image MIME type '.$dims['mime'].' not supported');\r\n return false;\r\n }\r\n }", "protected function loadImageResource()\n {\n if(empty($this->resource))\n {\n if(($this->worker === NULL || $this->worker === $this::WORKER_IMAGICK) && self::imagickAvailable())\n {\n $this->resource = $this->createImagick($this->image);\n }\n elseif(($this->worker === NULL || $this->worker === $this::WORKER_GD) && self::gdAvailable())\n {\n $this->resource = $this->getGdResource($this->image);\n }\n else\n {\n throw new Exception('Required extensions missing, extension GD or Imagick is required');\n }\n }\n }", "function loadImage($image_data) {\n\t\tif (empty($image_data['name']) && empty($image_data['tmp_name'])) {\n\t\t\treturn '';\n\t\t}\n\t\t\n\t\t$file_name = $this->image_path . DS . $image_data['name'];\n\t\t$file_name_arr = explode('.', $file_name);\n\t\t$file_name_ext = $file_name_arr[count($file_name_arr)-1];\n\t\tunset($file_name_arr[count($file_name_arr)-1]);\n\t\t$file_name_prefix = implode('.' , $file_name_arr);\n\t\t$counter = '';\n\t\t$file_name = $file_name_prefix . $counter . '.' . $file_name_ext;\n\t\t$i = 1;\n\t\twhile (file_exists($file_name)) {\n\t\t\t$counter = '_' . $i;\n\t\t\t$file_name = $file_name_prefix . $counter . '.' . $file_name_ext;\n\t\t\t$i++;\n\t\t}\n\n\t\t$tmp_name = $image_data['tmp_name'];\n\t\t$width = 88;\n\t\t$height = 88;\n\t\t\n\t\t// zmenim velikost obrazku\n\t\tApp::import('Model', 'Image');\n\t\t$this->Image = new Image;\n\t\t\n\t\t\n\t\tif (file_exists($tmp_name)) {\n\t\t\tif ($this->Image->resize($tmp_name, $file_name, $width, $height)) {\n\t\t\t\t$file_name = str_replace($this->image_path . DS, '', $file_name);\n\t\t\t\treturn $file_name;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "protected function loadImages() {\r\n $this->images = new \\App\\Table\\ImagesTable(App::getInstance()->getDb());\r\n }", "public function load_image($https = false)\n {\n return $this->load(\"image\", $https);\n }", "function _load_image_file( $file ) {\n\t\t// Run a cheap check to verify that it is an image file.\n\t\tif ( false === ( $size = getimagesize( $file ) ) )\n\t\t\treturn false;\n\t\t\n\t\tif ( false === ( $file_data = file_get_contents( $file ) ) )\n\t\t\treturn false;\n\t\t\n\t\tif ( false === ( $im = imagecreatefromstring( $file_data ) ) )\n\t\t\treturn false;\n\t\t\n\t\tunset( $file_data );\n\t\t\n\t\t\n\t\treturn $im;\n\t}", "function load_image( $filename = '' )\n\t{\n\t\tif( !is_file( $filename ) )\n\t\t\tthrow new Exception( 'Image Class: could not find image \\''.$filename.'\\'.' );\n\t\t\t\t\t\t\t\t\n\t\t$ext = $this->get_ext( $filename );\n\t\t\n\t\tswitch( $ext )\n\t\t{\n\t\t\tcase 'jpeg':\n\t\t\tcase 'jpg':\n\t\t\t\t$this->im = imagecreatefromjpeg( $filename );\n\t\t\t\tbreak;\n\t\t\tcase 'gif':\n\t\t\t\t$this->im = imagecreatefromgif( $filename );\n\t\t\t\tbreak;\n\t\t\tcase 'png':\n\t\t\t\t$this->im = imagecreatefrompng( $filename );\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new Exception( 'Image Class: An unsupported file format was supplied \\''. $ext . '\\'.' );\n\t\t}\n\t\t\n\t\treturn TRUE;\n\t}", "static private function _getLoader() {\n\t\tif(self::isNull(self::$_loader)) {\n\t\t\tself::$_loader = Loader::getImageLoader(self::webiny()->getConfig()->get('components.image'));\n\t\t}\n\n\t\treturn self::$_loader;\n\t}", "public function load($file){\n\n //kill any previous image that might still be in memory before we load a new one\n if(isset($this->image) && !empty($this->image)){\n imagedestroy($this->image);\n }\n\n //get the parameters of the image\n $image_params = getimagesize($file);\n\n //save the image params to class vars\n list($this->width, $this->height, $this->type, $this->attributes) = $image_params;\n $this->mime_type = $image_params['mime'];\n\n //check that an image type was found\n if(isset($this->type) && !empty($this->type)){\n //find the type of image so it can be loaded into memory\n switch ($this->type) {\n case IMAGETYPE_JPEG:\n $this->image = imagecreatefromjpeg($file);\n break;\n\n case IMAGETYPE_GIF:\n $this->image = imagecreatefromgif($file);\n break;\n\n case IMAGETYPE_PNG:\n $this->image = imagecreatefrompng($file);\n break;\n\n }\n\n if(isset($this->image) && !empty($this->image)){\n return true;\n }else{\n return true;\n }\n }else{\n return false;\n }\n }", "private function loadImages(): void\n {\n if (count($this->images) == 1) {\n $this->addMeta('image', $this->images[0]);\n\n return;\n }\n\n foreach ($this->images as $number => $url) {\n $this->addMeta(\"image{$number}\", $url);\n }\n }", "protected function fetchImage() {\n return null;\n }", "function load($filename)\n {\n $image_info = getimagesize($filename);\n $this->image_type = $image_info[2];\n //crea la imagen JPEG.\n if( $this->image_type == IMAGETYPE_JPEG ) \n {\n $this->image = imagecreatefromjpeg($filename);\n } \n //crea la imagen GIF.\n elseif( $this->image_type == IMAGETYPE_GIF ) \n {\n $this->image = imagecreatefromgif($filename);\n } \n //Crea la imagen PNG\n elseif( $this->image_type == IMAGETYPE_PNG ) \n {\n $this->image = imagecreatefrompng($filename);\n }\n }", "protected function _loadImageResource($source)\n {\n if (empty($source) || !is_readable($source)) {\n return false;\n }\n\n try {\n $result = imagecreatefromstring(file_get_contents($source));\n } catch (Exception $e) {\n _log(\"GD failed to open the file. Details:\\n$e\", Zend_Log::ERR);\n return false;\n }\n\n return $result;\n }", "function logonscreener_image_load($file, $extension) {\n $function = 'imagecreatefrom' . $extension;\n\n if (!function_exists($function) || !($image = $function($file))) {\n logonscreener_log(\"$function() does not exist or it did not return what was expected.\");\n return FALSE;\n }\n\n return $image;\n}", "public function getImage() {}", "function LoadImage($filename)\r\n {\r if (!($from_info = getimagesize($file)))\r\n return false;\r\n\r\n $from_type = $from_info[2];\r\n\r\n $new_img = Array(\r\n 'f' => $filename,\r\n 'w' => $from_info[0],\r\n 'h' => $from_info[1],\r\n );\r\n\r\n $id = false;\r\n if (($this->use_IM && false)\r\n || (($from_type == IMAGETYPE_GIF) && $this->GIF_IM && false))\r\n {\r $id = count($this->images)+1;\r\n $this->images[$id] = Array(0, $filename, 0, $new_img);\r\n }\r\n elseif ($img = $this->_gd_load($filename))\r\n {\r $id = count($this->images)+1;\r\n $this->images[$id] = Array(1, $filename, &$img, $new_img);\r\n }\r\n\r\n return $id;\r\n }", "function loadData ($image,$mime) {\r\n if ( in_array($mime,$this->types) ) {\r\n $this->source=imagecreatefromstring($image);\r\n $this->sourceWidth=imagesx($this->source);\r\n $this->sourceHeight=imagesy($this->source);\r\n $this->sourceMime=$mime;\r\n $this->initThumb();\r\n return true;\r\n } else {\r\n trigger_error('Image MIME type '.$mime.' not supported');\r\n return false;\r\n }\r\n }", "function wp_load_image($file)\n {\n }", "function photonfill_get_lazyload_image( $attachment_id, $img_size, $attr = array() ) {\n\treturn Photonfill()->get_lazyload_image( $attachment_id, $img_size, $attr );\n}", "function image_post_update_image_loading_attribute(?array &$sandbox = NULL): void {\n $image_config_updater = \\Drupal::classResolver(ImageConfigUpdater::class);\n \\Drupal::classResolver(ConfigEntityUpdater::class)->update($sandbox, 'entity_view_display', function (EntityViewDisplayInterface $view_display) use ($image_config_updater): bool {\n return $image_config_updater->processImageLazyLoad($view_display);\n });\n}", "function loadImage($filename) {\n $image = false;\n $imageInfo = getimagesize($filename);\n $imageType = '';\n $imageType = $imageInfo[2];\n if( $imageType == IMAGETYPE_JPEG ) {\n $image = imagecreatefromjpeg($filename);\n } elseif( $imageType == IMAGETYPE_GIF ) {\n $image = imagecreatefromgif($filename);\n } elseif( $imageType == IMAGETYPE_PNG ) {\n $image = imagecreatefrompng($filename);\n }\n return $image ? array('image' => $image, 'imgType' => $imageType, 'imageInfo' => $imageInfo) : array();\n}", "public function loadDefaultImages($field_name)\n {\n if (sfContext::hasInstance())\n {\n return;\n }\n \n print(\"trying to load default images\\n\");\n \n foreach (array('jpg', 'jpeg', 'gif', 'png') as $extension)\n {\n $filename = $this->getImageNameStem($field_name) . '.' . $extension;\n $save_path = 'web/' . $this->getImagePath();\n \n $file_to_load = 'data/images/' . get_class($this->getInvoker()) . '/' . $filename;\n $file_to_save = $save_path . $filename;\n \n// print(\"checking for $file_to_load\\n\");\n \n if (file_exists($file_to_load))\n {\n print('Found ' . $file_to_load . \"... \");\n if (!file_exists($save_path))\n {\n $cmd = \"mkdir -p \" . $save_path;\n shell_exec($cmd);\n print(\"created \" . $save_path . \"\\n\");\n }\n \n if (is_writable($save_path))\n {\n copy($file_to_load, $file_to_save);\n $this->getInvoker()->{$field_name . '_image'} = $filename;\n $this->getInvoker()->save();\n print(\"copied\\n\");\n }\n else\n {\n print(\"Don't have permission to copy to $file_to_save\\n\");\n }\n }\n }\n }", "public function getImage();", "public function getImage();", "public function getImage();", "public function getImage();", "protected function init_default_image() {\n if( file_exists($this->config['default_image']))\n {\n $this->default_image = $this->config['default_image'];\n }\n }", "protected function processImage() {}", "private function PrepareImageForCache()\n {\n if($this->verbose) { self::verbose(\"File extension is: {$this->fileExtension}\"); }\n\n switch($this->fileExtension) {\n case 'jpg':\n case 'jpeg':\n $image = imagecreatefromjpeg($this->pathToImage);\n if($this->verbose) { self::verbose(\"Opened the image as a JPEG image.\"); }\n break;\n\n case 'png':\n $image = imagecreatefrompng($this->pathToImage);\n if($this->verbose) { self::verbose(\"Opened the image as a PNG image.\"); }\n break;\n\n default: errorPage('No support for this file extension.');\n }\n return $image;\n }", "public function load() {\n if ($this->cat === \"url\" && !file_exists($this->sourcepath)) Path::download($this->originalName, $this->sourcepath);\n }", "function image_exist( $img ) \r\n\t\t{\r\n\t\t\tif( @file_get_contents( $img,0,NULL,0,1) ){ return 1; } else{ return 0; }\r\n\t\t\t\r\n\t\t}", "public function isLoaded();", "function wp_img_tag_add_loading_attr($image, $context)\n {\n }", "function load() {\n\n\t}", "function LoadPNG($imgname)\n{\n $im = @imagecreatefrompng($imgname);\n\n /* See if it failed */\n if(!$im)\n {\n /* Create a blank image */\n $im = imagecreatetruecolor (96, 96);\n $bgc = imagecolorallocate ($im, 255, 255, 255);\n $tc = imagecolorallocate ($im, 0, 0, 0);\n\n imagefilledrectangle ($im, 0, 0, 96, 96, $bgc);\n\n /* Output an error message */\n imagestring ($im, 1, 5, 5, 'Mapler.me failed.', $tc);\n imagestring ($im, 1, 5, 20, $imgname, $tc);\n }\n\n return $im;\n}", "function local_image(\n\tstring $filename,\n\tstring|int|null $width = '',\n\tstring|int|null $height = '',\n\t?string $alt = '',\n\t?string $classes = '',\n\t?string $loading = ''\n): string {\n\t$img_tag = '<img src=\"' . esc_attr(Assets\\asset_path('images/' . $filename)) . '\"';\n\tif (!empty($width)) {\n\t\t$img_tag .= ' width=\"' . esc_attr($width) . '\"';\n\t}\n\tif (!empty($height)) {\n\t\t$img_tag .= ' height=\"' . esc_attr($height) . '\"';\n\t}\n\tif (!empty($alt)) {\n\t\t$img_tag .= ' alt=\"' . esc_attr($alt) . '\"';\n\t}\n\tif (!empty($classes)) {\n\t\t$img_tag .= ' class=\"' . esc_attr($classes) . '\"';\n\t}\n\tif (empty($loading)) {\n\t\t$img_tag .= ' loading=\"lazy\"';\n\t} else {\n\t\t$img_tag .= ' loading=\"' . esc_attr($loading) . '\"';\n\t}\n\t$img_tag .= '>';\n\treturn $img_tag;\n}", "function load()\n {\n }", "function &getImage() \n { \n return $this->_isImageResource?$this->_image:false; \n }", "function LoadGif($imgname)\n{\n $im = @imagecreatefromgif($imgname);\n\n /* See if it failed */\n if(!$im)\n {\n /* Create a blank image */\n $im = imagecreatetruecolor (96, 96);\n $bgc = imagecolorallocate ($im, 255, 255, 255);\n $tc = imagecolorallocate ($im, 0, 0, 0);\n\n imagefilledrectangle ($im, 0, 0, 96, 96, $bgc);\n\n /* Output an error message */\n imagestring ($im, 1, 5, 5, 'Mapler.me failed.', $tc);\n imagestring ($im, 1, 5, 20, $imgname, $tc);\n }\n\n return $im;\n}", "function loadfile($sFileName)\n\t{\n\t\t$this->setLocations($sFileName);\n\n\t\tif (file_exists($this->sFileLocation)) {\n\t\t\t$this->initializeImageProperties();\n\t\t\t$this->loadImage();\n\t\t} else {\n\t\t\t$this->printError(\"file $this->sFileLocation not found\");\n\t\t}\n\t}", "public function loadResources() {}", "function getImage();", "protected function fetchIntroImage(){\n $this->imageIntro = $this->getImageTypeFromImages('intro');\n }", "public function load($id)\n\t{\n\t\treturn Image::model()->findByPk($id);\n\t}", "protected function getTestImage($load_expected = TRUE, array $stubs = []) {\n if (!$load_expected && !in_array('load', $stubs)) {\n $stubs = array_merge(['load'], $stubs);\n }\n\n $this->toolkit = $this->getToolkitMock($stubs);\n\n $this->toolkit->expects($this->any())\n ->method('getPluginId')\n ->will($this->returnValue('gd'));\n\n if (!$load_expected) {\n $this->toolkit->expects($this->never())\n ->method('load');\n }\n\n $this->image = new Image($this->toolkit, $this->source);\n\n return $this->image;\n }", "public static function isLoaded();", "public function __load();", "protected function _checkImage() {\n if ( !is_file ( $this->src ) ) {\n $this->src = $this->default_missing_image; \n }\n $image_path_parts = pathinfo ( $this->src );\n $this->_image_name = $image_path_parts['basename'];\n $this->_thumb_filename = $this->attributes['width'] . 'x' . $this->attributes['height'] . '_' . $this->_image_name;\n $this->_thumb_src = $this->thumbs_dir_path . $this->_thumb_filename;\n if ( is_readable ( $this->_thumb_src ) ) {\n $this->_calculated_width = $this->attributes['width'];\n $this->_calculated_height = $this->attributes['height'];\n $this->src = $this->_thumb_src;\n return 'no_thumb_required';\n }\n if ( !$this->_original_image_info = getimagesize ( $this->src ) ) {\n return 'abort';\n } \n if (!in_array ( $this->_original_image_info['mime'], $this->_valid_mime ) ) {\n return 'abort';\n }\n }", "protected function isLoaded(){\n\t\treturn $this->lodaed;\n\t}", "public function test_it_loads_an_image_string_into_a_resource()\n {\n imagepng(imagecreatefromstring($this->imagePath), $this->compareTestSaveLocation);\n imagepng($this->image->getImageResource(), $this->testImageSaveLocation);\n\n $correctImage = file_get_contents($this->compareTestSaveLocation);\n $testImage = file_get_contents($this->testImageSaveLocation);\n\n $this->assertEquals($correctImage, $testImage);\n }", "private function checkImage()\n\t{\n\t\tif (!$this->imageResized) {\n\t\t\t$this->resize($this->width, $this->height);\n\t\t}\n\t}", "public function hasImage(): bool;", "public function load($resource)\n {\n if (strpos($resource, 'http') === 0) {\n $content = $this->loadExternalImage($resource);\n $this->image->readImageBlob($content);\n } else {\n $fullPath = $this->basePath .'/'. $resource;\n $this->image->readImage($fullPath);\n }\n\n return $this->image;\n }", "protected function fetchFirstImageInContent(){\n if(!isset($this->images)){\n return;\n }\n $image = '';\n if(isset($this->images[0]['src'])){\n $image = $this->images[0]['src'];\n }\n $this->imageFirstInContent = $image;\n }", "public function loadImage($imagePath, $width, $height) {\n $fileInfo = pathinfo($imagePath);\n $cacheFileName = $fileInfo['filename'] . '_' . $width . 'x' . $height . '.' . $fileInfo['extension'];\n $cacheFile = $cacheFileName;\n if(file_exists('image/cache/' . $cacheFile)) {\n return new Image($cacheFile, 'image/cache/');\n }\n else {\n return false;\n }\n }", "public function load() { }", "private function loadImage($imageUrl)\n {\n $filename = pathinfo($imageUrl)['basename'];\n //change extension to jpg\n $filename = preg_replace('/\\\\.[^.\\\\s]{3,4}$/', '.jpg', $filename);\n\n $localPath = $this->cacheDir . \"/$filename\";\n\n $image = imagecreatefromstring(file_get_contents($imageUrl));\n imagejpeg($image, $localPath, $this->jpegQuality);\n imagedestroy($image);\n\n return $localPath;\n }", "public function hasImage()\n {\n return !empty($this->image) && file_exists($this->getImagePath());\n }", "public function has_image() {\r\n return ! empty( $this->image );\r\n }", "public function sideload_gallery_image() {\n\t\t\n\t\tcheck_ajax_referer( 'daylife-gallery-add-nonce', 'nonce' );\n\t\t$file_to_load = esc_url_raw( $_POST['image_url'] );\n\t\t$post_id = absint( $_POST['post_id'] );\n\t\t$desc = sanitize_text_field( $_POST['caption'] );\n\t\tif ( $file_to_load ) {\n\t\t\t$image = media_sideload_image( $file_to_load, $post_id, $desc );\n\t\t\tif ( is_wp_error( $image ) ) {\n\t\t\t\techo 'Error transferring image';\n\t\t\t}\n\t\t}\n\t\tdie;\n\n\t}", "public static function load($name) {\n\t $name = str_replace(\"\\\\\", DS, $name);\n\t\t$imagineBase = \\Configure::read('Imagine.base');\n\t\tif (empty($imagineBase)) {\n\t\t\t$imagineBase = \\CakePlugin::path('Imagine') . 'Vendor' . DS . 'Imagine' . DS . 'lib' . DS;\n\t\t}\n\n\t\t$filePath = $imagineBase . $name . '.php';\n\t\tif (file_exists($filePath)) {\n\t\t\trequire_once($filePath);\n\t\t\treturn;\n\t\t}\n\n\t\t$imagineBase = $imagineBase . 'Image' . DS;\n\t\tif (file_exists($imagineBase . $name . '.php')) {\n\t\t\trequire_once($imagineBase . $name . '.php');\n\t\t\treturn;\n\t\t}\n\t}", "protected function getImageResource () {\n $extension = strtolower( strrchr ( $this->source, '.' ) );\n\n // Convert image to resource object according to its type.\n switch ( $extension ) {\n case '.jpg':\n case '.jpeg':\n $img = @imagecreatefromjpeg( $this->source );\n break;\n case '.gif':\n $img = @imagecreatefromgif( $this->source );\n break;\n case '.png':\n $img = @imagecreatefrompng( $this->source );\n break;\n default:\n $img = false;\n break;\n }\n return $img;\n }", "public function load(string $image, bool $lazy = false): bool\n\t{\n\t\t$res = false;\n\n\t\t// Cleanup image url\n\t\t$image = $this->cleanUrl($image);\n\n\t\t// Get mime type of the image\n\t\t$extension = $this->getExtension($image);\n\t\t$mime = self::MIMES[$extension] ?? null;\n\n\t\t// Check if it is a valid image\n\t\tif ($mime && (file_exists($image) || $this->isExternal($image))) {\n\t\t\t$res = true;\n\n\t\t\t// Urlencode if http\n\t\t\tif ($this->isExternal($image)) {\n\t\t\t\t$image = str_replace(['http%3A%2F%2F', 'https%3A%2F%2F', '%2F'], ['http://', 'https://', '/'], urlencode($image));\n\t\t\t}\n\n\t\t\t$this->_extension = $extension;\n\t\t\t$this->_mime = $mime;\n\t\t\t$this->_imagePath = $image;\n\t\t\t$parts = explode('/', $image);\n\t\t\t$this->_imageName = str_replace('.' . $this->_extension, '', end($parts));\n\n\t\t\t// Get image size\n\t\t\tlist($width, $height, $type) = getimagesize($image);\n\t\t\t$this->_oldWidth = $width;\n\t\t\t$this->_oldHeight = $height;\n\t\t\t$this->_imageType = $type;\n\t\t}\n\n\t\tif (!$lazy) {\n\t\t\t$resource = $this->getImageResource($image, $extension);\n\t\t\t$this->_resource = $resource;\n\t\t}\n\n\t\treturn $res;\n\t}", "protected function _checkImage() {\n if ( !is_file ( $this->src ) ) {\n $this->src = $this->default_missing_image; \n }\n $image_path_parts = pathinfo ( $this->src );\n $this->_image_name = $image_path_parts['basename'];\n $this->_thumb_filename = $this->attributes['width'] . 'x' . $this->attributes['height'] . '_' . $this->_image_name;\n $this->_thumb_src = $this->thumbs_dir_path . $this->_thumb_filename;\n if ( is_readable ( $this->_thumb_src ) ) {\n $this->_calculated_width = $this->attributes['width'];\n $this->_calculated_height = $this->attributes['height'];\n $this->src = $this->_thumb_src;\n return 'no_thumb_required';\n }\n if ( KISSIT_MAIN_PRODUCT_WATERMARK_SIZE == 0 ) {\n \tif ( !$this->_original_image_info = getimagesize ( $this->src ) ) {\n \t\treturn 'abort';\n \t} \n \tif (!in_array ( $this->_original_image_info['mime'], $this->_valid_mime ) ) {\n \t\treturn 'abort';\n \t}\n }\n }", "public function load()\n {\n $size = @getimagesize($this->file);\n if (!$size) {\n throw new \\Exception(sprintf('Could not read image size of the file #%s', $this->file));\n }\n $this->type = $size[2];\n if (!is_file($this->file) && !preg_match('|^https?:#|', $this->file)) {\n throw new \\Exception(sprintf('File #%s doesn&#8217;t exist?', $this->file));\n }\n $this->image = @imagecreatefromstring(file_get_contents($this->file));\n if (!is_resource($this->image)) {\n throw new \\Exception(sprintf('File #%s is not an image.', $this->file));\n }\n $this->updateSize($size[0], $size[1]);\n $this->mime_type = $size['mime'];\n\n return $this;\n }", "private function islibraryLoaded(): bool\n {\n if (!extension_loaded('gd') && !extension_loaded('gd2')) {\n return false;\n }\n\n return true;\n }", "public function defaultLoading() {}", "public function isGetImgResourceHookCalledCallback() {}", "public function action_image()\n\t{\n\t\t//Image::load(DOCROOT.'/files/04_2021/79199dcc06baf4cc230262fcbb4d1094.jpg')->preset('mypreset', DOCROOT.'/files/04_2021/ea7e8ed4bc9d6f7c03f5f374e30b183b.png');\n\t\t$image = Image::forge();\n\n\t\t// Or with optional config\n\t\t$image = Image::forge(array(\n\t\t\t\t'quality' => 80\n\t\t));\n\t\t$image->load(DOCROOT.'/files/04_2021/79199dcc06baf4cc230262fcbb4d1094.jpg')\n\t\t\t\t\t->crop_resize(200, 200)\n\t\t\t\t\t->rounded(100)\n\t\t\t\t\t->output();\n\t\t// Upload an image and pass it directly into the Image::load method.\n\t\tUpload::process(array(\n\t\t\t'path' => DOCROOT.DS.'files'\n\t\t));\n\n\t\tif (Upload::is_valid())\n\t\t{\n\t\t\t$data = Upload::get_files(0);\n\n\t\t\t// Using the file upload data, we can force the image's extension\n\t\t\t// via $force_extension\n\t\t\tImage::load($data['file'], false, $data['extension'])\n\t\t\t\t\t->crop_resize(200, 200)\n\t\t\t\t\t->save('image');\n\t\t} \n\t}", "public function init() {\n\t\tif(strstr($this->_detect_uri(),'media/')):\n\t\t\trequire_once(BASEPATH.'libraries/Image_lib'.EXT); \n\t\t\trequire_once(APPPATH.'libraries/MY_Image_lib'.EXT);\n\t\t\tinclude APPPATH.'config/config.php';\n\t\t include APPPATH.'config/images.php';\n \n\t\t\t$this->config = $config;\n\t \t$this->resize();\n \tendif;\n\t}", "public abstract function load();", "public function getDefaultImage();", "public function __load()\r\n {\r\n $this->__initializer__ && $this->__initializer__->__invoke($this, '__load', []);\r\n }", "public function __load()\r\n {\r\n $this->__initializer__ && $this->__initializer__->__invoke($this, '__load', []);\r\n }", "abstract protected function load();", "abstract protected function load();", "abstract protected function load();", "abstract protected function load();", "protected function getImageService() {}", "public function load(){\n\t\tif (is_file($this->_filename) && is_readable($this->_filename)){\n\t\t\t$this->_storage = require($this->_filename);\n\t\t\t$this->_dataAvailable = true;\n\t\t}\n\t}", "public function load()\n {\n }", "public function load()\n {\n }", "public function load()\n {\n }", "public function load()\n {\n }", "public function load()\n {\n }", "public function load_assets() {}", "public function checkIfCanLoad()\r\n\t{\r\n\t\treturn true;\r\n\t}", "public function load_images(Request $request)\n {\n $loggedin_user = Helper::get_logged_in_user();\n $pile = Date_metron::where(\"id\", $request->id)\n ->select('image_one', 'image_one_url', 'image_two', 'image_two_url')\n ->first();\n $data = array();\n $image_one = asset('public/assets/media/users/noimage.jpg');\n $image_two = asset('public/assets/media/users/noimage.jpg');\n if($pile)\n {\n if(!empty($pile['image_one']))\n {\n if(file_exists(base_path().'/public/date_metron/'.$pile['image_one'])) \n $image_one = $pile['image_one_url']; \n }\n if(!empty($pile['image_two']))\n {\n if(file_exists(base_path().'/public/date_metron/'.$pile['image_two'])) \n $image_two = $pile['image_two_url']; \n }\n $data = array('image_one'=>$image_one,'image_two'=>$image_two);\n }\n echo json_encode($data);\n }", "public function load();", "public function load();", "public function load();", "public function load();", "public function load();", "public function load();", "public function load();" ]
[ "0.7510242", "0.7247902", "0.72165185", "0.7079294", "0.7043849", "0.700722", "0.66745865", "0.6577331", "0.6419409", "0.6392677", "0.63886935", "0.6376109", "0.6263727", "0.6214442", "0.6175348", "0.60436434", "0.6040354", "0.6004984", "0.59886205", "0.5982271", "0.5954268", "0.5952835", "0.59271765", "0.59262013", "0.5901122", "0.5864255", "0.5839839", "0.58350706", "0.5819512", "0.5819512", "0.5819512", "0.5819512", "0.57946134", "0.5737924", "0.5736539", "0.5722997", "0.5704368", "0.5668387", "0.56648844", "0.56501573", "0.56417143", "0.5630695", "0.5620876", "0.56098247", "0.5596133", "0.5564544", "0.5560515", "0.556032", "0.5547319", "0.55355096", "0.5523239", "0.55207336", "0.55072606", "0.5503618", "0.55021113", "0.545884", "0.5458092", "0.5456488", "0.54562736", "0.54554224", "0.54530305", "0.544866", "0.5447971", "0.54367375", "0.54328376", "0.54251885", "0.54167724", "0.5416706", "0.54128623", "0.54110634", "0.540739", "0.54061085", "0.5404662", "0.540311", "0.5400652", "0.53992766", "0.53986126", "0.53955466", "0.53882295", "0.53882295", "0.5386068", "0.5386068", "0.5386068", "0.5386068", "0.5382704", "0.5381893", "0.5375721", "0.5375721", "0.5375721", "0.5375204", "0.53735733", "0.53701246", "0.53634447", "0.53594726", "0.535246", "0.535246", "0.535246", "0.535246", "0.535246", "0.535246", "0.535246" ]
0.0
-1
Loads image if not yet loaded
protected function _do_save($file, $quality) { $this->_load_image(); // Get the extension of the file $extension = pathinfo($file, PATHINFO_EXTENSION); // Get the save function and IMAGETYPE list($save, $type) = $this->_save_function($extension, $quality); // Save the image to a file $status = isset($quality) ? $save($this->_image, $file, $quality) : $save($this->_image, $file); if ($status === TRUE AND $type !== $this->type) { // Reset the image type and mime type $this->type = $type; $this->mime = image_type_to_mime_type($type); } return TRUE; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadImage()\n\t{\n\t\tswitch ($this->type) {\n\t\t\tcase 1:\n\t\t\t\t$this->ImageStream = @imagecreatefromgif($this->sFileLocation);\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\t$this->ImageStream = @imagecreatefromjpeg($this->sFileLocation);\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\t$this->ImageStream = @imagecreatefrompng($this->sFileLocation);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t$this->printError('invalid imagetype');\n\t\t}\n\n\t\tif (!$this->ImageStream) {\n\t\t\t$this->printError('image not loaded');\n\t\t}\n\t}", "public function load_image()\n\t{\n if (file_exists($this->local_file)) {\n $image_size = $this->image_size();\n if (preg_match('/jpeg/', $image_size['mime'])) {\n $file = imagecreatefromjpeg($this->local_file);\n } elseif (preg_match('/gif/', $image_size['mime'])) {\n $file = imagecreatefromgif($this->local_file);\n } elseif (preg_match('/png/', $image_size['mime'])) {\n $file = imagecreatefrompng($this->local_file);\n } else {\n \t$file = null;\n }\n return $file;\n }\n\t}", "private function lazyLoad(): void\n\t{\n\t\tif (empty($this->_resource)) {\n\t\t\tif ($this->_cache && !$this->isCacheExpired()) {\n\t\t\t\t$this->_cacheSkip = true;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t$resource = $this->getImageResource($this->_imagePath, $this->_extension);\n\t\t\t$this->_resource = $resource;\n\t\t}\n\t}", "protected function _load_image()\n {\n if ( ! is_resource($this->_image))\n {\n // Gets create function\n $create = $this->_create_function;\n\n // Open the temporary image\n $this->_image = $create($this->file);\n\n // Preserve transparency when saving\n imagesavealpha($this->_image, TRUE);\n }\n }", "public function load()\n\t{\n\t\tif (!$this->isValidImage()) {\n\t\t\treturn false;\n\t\t}\n\n\t\t$this->image = new SimpleImage();\n\n\t\t$this->image->fromFile($this->source_path);\n\n\t\treturn true;\n\t}", "protected function loadImage()\n {\n if (!is_resource($this->tmpImage)) {\n $create = $this->createFunctionName;\n $this->tmpImage = $create($this->filePath);\n imagesavealpha($this->tmpImage, true);\n }\n }", "function loadFile ($image) {\r\n if ( !$dims=@GetImageSize($image) ) {\r\n trigger_error('Could not find image '.$image);\r\n return false;\r\n }\r\n if ( in_array($dims['mime'],$this->types) ) {\r\n $loader=$this->imgLoaders[$dims['mime']];\r\n $this->source=$loader($image);\r\n $this->sourceWidth=$dims[0];\r\n $this->sourceHeight=$dims[1];\r\n $this->sourceMime=$dims['mime'];\r\n $this->initThumb();\r\n return true;\r\n } else {\r\n trigger_error('Image MIME type '.$dims['mime'].' not supported');\r\n return false;\r\n }\r\n }", "protected function loadImageResource()\n {\n if(empty($this->resource))\n {\n if(($this->worker === NULL || $this->worker === $this::WORKER_IMAGICK) && self::imagickAvailable())\n {\n $this->resource = $this->createImagick($this->image);\n }\n elseif(($this->worker === NULL || $this->worker === $this::WORKER_GD) && self::gdAvailable())\n {\n $this->resource = $this->getGdResource($this->image);\n }\n else\n {\n throw new Exception('Required extensions missing, extension GD or Imagick is required');\n }\n }\n }", "function loadImage($image_data) {\n\t\tif (empty($image_data['name']) && empty($image_data['tmp_name'])) {\n\t\t\treturn '';\n\t\t}\n\t\t\n\t\t$file_name = $this->image_path . DS . $image_data['name'];\n\t\t$file_name_arr = explode('.', $file_name);\n\t\t$file_name_ext = $file_name_arr[count($file_name_arr)-1];\n\t\tunset($file_name_arr[count($file_name_arr)-1]);\n\t\t$file_name_prefix = implode('.' , $file_name_arr);\n\t\t$counter = '';\n\t\t$file_name = $file_name_prefix . $counter . '.' . $file_name_ext;\n\t\t$i = 1;\n\t\twhile (file_exists($file_name)) {\n\t\t\t$counter = '_' . $i;\n\t\t\t$file_name = $file_name_prefix . $counter . '.' . $file_name_ext;\n\t\t\t$i++;\n\t\t}\n\n\t\t$tmp_name = $image_data['tmp_name'];\n\t\t$width = 88;\n\t\t$height = 88;\n\t\t\n\t\t// zmenim velikost obrazku\n\t\tApp::import('Model', 'Image');\n\t\t$this->Image = new Image;\n\t\t\n\t\t\n\t\tif (file_exists($tmp_name)) {\n\t\t\tif ($this->Image->resize($tmp_name, $file_name, $width, $height)) {\n\t\t\t\t$file_name = str_replace($this->image_path . DS, '', $file_name);\n\t\t\t\treturn $file_name;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "protected function loadImages() {\r\n $this->images = new \\App\\Table\\ImagesTable(App::getInstance()->getDb());\r\n }", "public function load_image($https = false)\n {\n return $this->load(\"image\", $https);\n }", "function _load_image_file( $file ) {\n\t\t// Run a cheap check to verify that it is an image file.\n\t\tif ( false === ( $size = getimagesize( $file ) ) )\n\t\t\treturn false;\n\t\t\n\t\tif ( false === ( $file_data = file_get_contents( $file ) ) )\n\t\t\treturn false;\n\t\t\n\t\tif ( false === ( $im = imagecreatefromstring( $file_data ) ) )\n\t\t\treturn false;\n\t\t\n\t\tunset( $file_data );\n\t\t\n\t\t\n\t\treturn $im;\n\t}", "function load_image( $filename = '' )\n\t{\n\t\tif( !is_file( $filename ) )\n\t\t\tthrow new Exception( 'Image Class: could not find image \\''.$filename.'\\'.' );\n\t\t\t\t\t\t\t\t\n\t\t$ext = $this->get_ext( $filename );\n\t\t\n\t\tswitch( $ext )\n\t\t{\n\t\t\tcase 'jpeg':\n\t\t\tcase 'jpg':\n\t\t\t\t$this->im = imagecreatefromjpeg( $filename );\n\t\t\t\tbreak;\n\t\t\tcase 'gif':\n\t\t\t\t$this->im = imagecreatefromgif( $filename );\n\t\t\t\tbreak;\n\t\t\tcase 'png':\n\t\t\t\t$this->im = imagecreatefrompng( $filename );\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new Exception( 'Image Class: An unsupported file format was supplied \\''. $ext . '\\'.' );\n\t\t}\n\t\t\n\t\treturn TRUE;\n\t}", "static private function _getLoader() {\n\t\tif(self::isNull(self::$_loader)) {\n\t\t\tself::$_loader = Loader::getImageLoader(self::webiny()->getConfig()->get('components.image'));\n\t\t}\n\n\t\treturn self::$_loader;\n\t}", "public function load($file){\n\n //kill any previous image that might still be in memory before we load a new one\n if(isset($this->image) && !empty($this->image)){\n imagedestroy($this->image);\n }\n\n //get the parameters of the image\n $image_params = getimagesize($file);\n\n //save the image params to class vars\n list($this->width, $this->height, $this->type, $this->attributes) = $image_params;\n $this->mime_type = $image_params['mime'];\n\n //check that an image type was found\n if(isset($this->type) && !empty($this->type)){\n //find the type of image so it can be loaded into memory\n switch ($this->type) {\n case IMAGETYPE_JPEG:\n $this->image = imagecreatefromjpeg($file);\n break;\n\n case IMAGETYPE_GIF:\n $this->image = imagecreatefromgif($file);\n break;\n\n case IMAGETYPE_PNG:\n $this->image = imagecreatefrompng($file);\n break;\n\n }\n\n if(isset($this->image) && !empty($this->image)){\n return true;\n }else{\n return true;\n }\n }else{\n return false;\n }\n }", "private function loadImages(): void\n {\n if (count($this->images) == 1) {\n $this->addMeta('image', $this->images[0]);\n\n return;\n }\n\n foreach ($this->images as $number => $url) {\n $this->addMeta(\"image{$number}\", $url);\n }\n }", "protected function fetchImage() {\n return null;\n }", "function load($filename)\n {\n $image_info = getimagesize($filename);\n $this->image_type = $image_info[2];\n //crea la imagen JPEG.\n if( $this->image_type == IMAGETYPE_JPEG ) \n {\n $this->image = imagecreatefromjpeg($filename);\n } \n //crea la imagen GIF.\n elseif( $this->image_type == IMAGETYPE_GIF ) \n {\n $this->image = imagecreatefromgif($filename);\n } \n //Crea la imagen PNG\n elseif( $this->image_type == IMAGETYPE_PNG ) \n {\n $this->image = imagecreatefrompng($filename);\n }\n }", "protected function _loadImageResource($source)\n {\n if (empty($source) || !is_readable($source)) {\n return false;\n }\n\n try {\n $result = imagecreatefromstring(file_get_contents($source));\n } catch (Exception $e) {\n _log(\"GD failed to open the file. Details:\\n$e\", Zend_Log::ERR);\n return false;\n }\n\n return $result;\n }", "function logonscreener_image_load($file, $extension) {\n $function = 'imagecreatefrom' . $extension;\n\n if (!function_exists($function) || !($image = $function($file))) {\n logonscreener_log(\"$function() does not exist or it did not return what was expected.\");\n return FALSE;\n }\n\n return $image;\n}", "public function getImage() {}", "function LoadImage($filename)\r\n {\r if (!($from_info = getimagesize($file)))\r\n return false;\r\n\r\n $from_type = $from_info[2];\r\n\r\n $new_img = Array(\r\n 'f' => $filename,\r\n 'w' => $from_info[0],\r\n 'h' => $from_info[1],\r\n );\r\n\r\n $id = false;\r\n if (($this->use_IM && false)\r\n || (($from_type == IMAGETYPE_GIF) && $this->GIF_IM && false))\r\n {\r $id = count($this->images)+1;\r\n $this->images[$id] = Array(0, $filename, 0, $new_img);\r\n }\r\n elseif ($img = $this->_gd_load($filename))\r\n {\r $id = count($this->images)+1;\r\n $this->images[$id] = Array(1, $filename, &$img, $new_img);\r\n }\r\n\r\n return $id;\r\n }", "function loadData ($image,$mime) {\r\n if ( in_array($mime,$this->types) ) {\r\n $this->source=imagecreatefromstring($image);\r\n $this->sourceWidth=imagesx($this->source);\r\n $this->sourceHeight=imagesy($this->source);\r\n $this->sourceMime=$mime;\r\n $this->initThumb();\r\n return true;\r\n } else {\r\n trigger_error('Image MIME type '.$mime.' not supported');\r\n return false;\r\n }\r\n }", "function wp_load_image($file)\n {\n }", "function photonfill_get_lazyload_image( $attachment_id, $img_size, $attr = array() ) {\n\treturn Photonfill()->get_lazyload_image( $attachment_id, $img_size, $attr );\n}", "function image_post_update_image_loading_attribute(?array &$sandbox = NULL): void {\n $image_config_updater = \\Drupal::classResolver(ImageConfigUpdater::class);\n \\Drupal::classResolver(ConfigEntityUpdater::class)->update($sandbox, 'entity_view_display', function (EntityViewDisplayInterface $view_display) use ($image_config_updater): bool {\n return $image_config_updater->processImageLazyLoad($view_display);\n });\n}", "function loadImage($filename) {\n $image = false;\n $imageInfo = getimagesize($filename);\n $imageType = '';\n $imageType = $imageInfo[2];\n if( $imageType == IMAGETYPE_JPEG ) {\n $image = imagecreatefromjpeg($filename);\n } elseif( $imageType == IMAGETYPE_GIF ) {\n $image = imagecreatefromgif($filename);\n } elseif( $imageType == IMAGETYPE_PNG ) {\n $image = imagecreatefrompng($filename);\n }\n return $image ? array('image' => $image, 'imgType' => $imageType, 'imageInfo' => $imageInfo) : array();\n}", "public function loadDefaultImages($field_name)\n {\n if (sfContext::hasInstance())\n {\n return;\n }\n \n print(\"trying to load default images\\n\");\n \n foreach (array('jpg', 'jpeg', 'gif', 'png') as $extension)\n {\n $filename = $this->getImageNameStem($field_name) . '.' . $extension;\n $save_path = 'web/' . $this->getImagePath();\n \n $file_to_load = 'data/images/' . get_class($this->getInvoker()) . '/' . $filename;\n $file_to_save = $save_path . $filename;\n \n// print(\"checking for $file_to_load\\n\");\n \n if (file_exists($file_to_load))\n {\n print('Found ' . $file_to_load . \"... \");\n if (!file_exists($save_path))\n {\n $cmd = \"mkdir -p \" . $save_path;\n shell_exec($cmd);\n print(\"created \" . $save_path . \"\\n\");\n }\n \n if (is_writable($save_path))\n {\n copy($file_to_load, $file_to_save);\n $this->getInvoker()->{$field_name . '_image'} = $filename;\n $this->getInvoker()->save();\n print(\"copied\\n\");\n }\n else\n {\n print(\"Don't have permission to copy to $file_to_save\\n\");\n }\n }\n }\n }", "public function getImage();", "public function getImage();", "public function getImage();", "public function getImage();", "protected function init_default_image() {\n if( file_exists($this->config['default_image']))\n {\n $this->default_image = $this->config['default_image'];\n }\n }", "protected function processImage() {}", "private function PrepareImageForCache()\n {\n if($this->verbose) { self::verbose(\"File extension is: {$this->fileExtension}\"); }\n\n switch($this->fileExtension) {\n case 'jpg':\n case 'jpeg':\n $image = imagecreatefromjpeg($this->pathToImage);\n if($this->verbose) { self::verbose(\"Opened the image as a JPEG image.\"); }\n break;\n\n case 'png':\n $image = imagecreatefrompng($this->pathToImage);\n if($this->verbose) { self::verbose(\"Opened the image as a PNG image.\"); }\n break;\n\n default: errorPage('No support for this file extension.');\n }\n return $image;\n }", "public function load() {\n if ($this->cat === \"url\" && !file_exists($this->sourcepath)) Path::download($this->originalName, $this->sourcepath);\n }", "function image_exist( $img ) \r\n\t\t{\r\n\t\t\tif( @file_get_contents( $img,0,NULL,0,1) ){ return 1; } else{ return 0; }\r\n\t\t\t\r\n\t\t}", "public function isLoaded();", "function wp_img_tag_add_loading_attr($image, $context)\n {\n }", "function load() {\n\n\t}", "function LoadPNG($imgname)\n{\n $im = @imagecreatefrompng($imgname);\n\n /* See if it failed */\n if(!$im)\n {\n /* Create a blank image */\n $im = imagecreatetruecolor (96, 96);\n $bgc = imagecolorallocate ($im, 255, 255, 255);\n $tc = imagecolorallocate ($im, 0, 0, 0);\n\n imagefilledrectangle ($im, 0, 0, 96, 96, $bgc);\n\n /* Output an error message */\n imagestring ($im, 1, 5, 5, 'Mapler.me failed.', $tc);\n imagestring ($im, 1, 5, 20, $imgname, $tc);\n }\n\n return $im;\n}", "function local_image(\n\tstring $filename,\n\tstring|int|null $width = '',\n\tstring|int|null $height = '',\n\t?string $alt = '',\n\t?string $classes = '',\n\t?string $loading = ''\n): string {\n\t$img_tag = '<img src=\"' . esc_attr(Assets\\asset_path('images/' . $filename)) . '\"';\n\tif (!empty($width)) {\n\t\t$img_tag .= ' width=\"' . esc_attr($width) . '\"';\n\t}\n\tif (!empty($height)) {\n\t\t$img_tag .= ' height=\"' . esc_attr($height) . '\"';\n\t}\n\tif (!empty($alt)) {\n\t\t$img_tag .= ' alt=\"' . esc_attr($alt) . '\"';\n\t}\n\tif (!empty($classes)) {\n\t\t$img_tag .= ' class=\"' . esc_attr($classes) . '\"';\n\t}\n\tif (empty($loading)) {\n\t\t$img_tag .= ' loading=\"lazy\"';\n\t} else {\n\t\t$img_tag .= ' loading=\"' . esc_attr($loading) . '\"';\n\t}\n\t$img_tag .= '>';\n\treturn $img_tag;\n}", "function load()\n {\n }", "function &getImage() \n { \n return $this->_isImageResource?$this->_image:false; \n }", "function LoadGif($imgname)\n{\n $im = @imagecreatefromgif($imgname);\n\n /* See if it failed */\n if(!$im)\n {\n /* Create a blank image */\n $im = imagecreatetruecolor (96, 96);\n $bgc = imagecolorallocate ($im, 255, 255, 255);\n $tc = imagecolorallocate ($im, 0, 0, 0);\n\n imagefilledrectangle ($im, 0, 0, 96, 96, $bgc);\n\n /* Output an error message */\n imagestring ($im, 1, 5, 5, 'Mapler.me failed.', $tc);\n imagestring ($im, 1, 5, 20, $imgname, $tc);\n }\n\n return $im;\n}", "function loadfile($sFileName)\n\t{\n\t\t$this->setLocations($sFileName);\n\n\t\tif (file_exists($this->sFileLocation)) {\n\t\t\t$this->initializeImageProperties();\n\t\t\t$this->loadImage();\n\t\t} else {\n\t\t\t$this->printError(\"file $this->sFileLocation not found\");\n\t\t}\n\t}", "public function loadResources() {}", "function getImage();", "protected function fetchIntroImage(){\n $this->imageIntro = $this->getImageTypeFromImages('intro');\n }", "public function load($id)\n\t{\n\t\treturn Image::model()->findByPk($id);\n\t}", "protected function getTestImage($load_expected = TRUE, array $stubs = []) {\n if (!$load_expected && !in_array('load', $stubs)) {\n $stubs = array_merge(['load'], $stubs);\n }\n\n $this->toolkit = $this->getToolkitMock($stubs);\n\n $this->toolkit->expects($this->any())\n ->method('getPluginId')\n ->will($this->returnValue('gd'));\n\n if (!$load_expected) {\n $this->toolkit->expects($this->never())\n ->method('load');\n }\n\n $this->image = new Image($this->toolkit, $this->source);\n\n return $this->image;\n }", "public static function isLoaded();", "public function __load();", "protected function _checkImage() {\n if ( !is_file ( $this->src ) ) {\n $this->src = $this->default_missing_image; \n }\n $image_path_parts = pathinfo ( $this->src );\n $this->_image_name = $image_path_parts['basename'];\n $this->_thumb_filename = $this->attributes['width'] . 'x' . $this->attributes['height'] . '_' . $this->_image_name;\n $this->_thumb_src = $this->thumbs_dir_path . $this->_thumb_filename;\n if ( is_readable ( $this->_thumb_src ) ) {\n $this->_calculated_width = $this->attributes['width'];\n $this->_calculated_height = $this->attributes['height'];\n $this->src = $this->_thumb_src;\n return 'no_thumb_required';\n }\n if ( !$this->_original_image_info = getimagesize ( $this->src ) ) {\n return 'abort';\n } \n if (!in_array ( $this->_original_image_info['mime'], $this->_valid_mime ) ) {\n return 'abort';\n }\n }", "protected function isLoaded(){\n\t\treturn $this->lodaed;\n\t}", "public function test_it_loads_an_image_string_into_a_resource()\n {\n imagepng(imagecreatefromstring($this->imagePath), $this->compareTestSaveLocation);\n imagepng($this->image->getImageResource(), $this->testImageSaveLocation);\n\n $correctImage = file_get_contents($this->compareTestSaveLocation);\n $testImage = file_get_contents($this->testImageSaveLocation);\n\n $this->assertEquals($correctImage, $testImage);\n }", "private function checkImage()\n\t{\n\t\tif (!$this->imageResized) {\n\t\t\t$this->resize($this->width, $this->height);\n\t\t}\n\t}", "public function hasImage(): bool;", "public function load($resource)\n {\n if (strpos($resource, 'http') === 0) {\n $content = $this->loadExternalImage($resource);\n $this->image->readImageBlob($content);\n } else {\n $fullPath = $this->basePath .'/'. $resource;\n $this->image->readImage($fullPath);\n }\n\n return $this->image;\n }", "protected function fetchFirstImageInContent(){\n if(!isset($this->images)){\n return;\n }\n $image = '';\n if(isset($this->images[0]['src'])){\n $image = $this->images[0]['src'];\n }\n $this->imageFirstInContent = $image;\n }", "public function loadImage($imagePath, $width, $height) {\n $fileInfo = pathinfo($imagePath);\n $cacheFileName = $fileInfo['filename'] . '_' . $width . 'x' . $height . '.' . $fileInfo['extension'];\n $cacheFile = $cacheFileName;\n if(file_exists('image/cache/' . $cacheFile)) {\n return new Image($cacheFile, 'image/cache/');\n }\n else {\n return false;\n }\n }", "public function load() { }", "private function loadImage($imageUrl)\n {\n $filename = pathinfo($imageUrl)['basename'];\n //change extension to jpg\n $filename = preg_replace('/\\\\.[^.\\\\s]{3,4}$/', '.jpg', $filename);\n\n $localPath = $this->cacheDir . \"/$filename\";\n\n $image = imagecreatefromstring(file_get_contents($imageUrl));\n imagejpeg($image, $localPath, $this->jpegQuality);\n imagedestroy($image);\n\n return $localPath;\n }", "public function hasImage()\n {\n return !empty($this->image) && file_exists($this->getImagePath());\n }", "public function has_image() {\r\n return ! empty( $this->image );\r\n }", "public function sideload_gallery_image() {\n\t\t\n\t\tcheck_ajax_referer( 'daylife-gallery-add-nonce', 'nonce' );\n\t\t$file_to_load = esc_url_raw( $_POST['image_url'] );\n\t\t$post_id = absint( $_POST['post_id'] );\n\t\t$desc = sanitize_text_field( $_POST['caption'] );\n\t\tif ( $file_to_load ) {\n\t\t\t$image = media_sideload_image( $file_to_load, $post_id, $desc );\n\t\t\tif ( is_wp_error( $image ) ) {\n\t\t\t\techo 'Error transferring image';\n\t\t\t}\n\t\t}\n\t\tdie;\n\n\t}", "public static function load($name) {\n\t $name = str_replace(\"\\\\\", DS, $name);\n\t\t$imagineBase = \\Configure::read('Imagine.base');\n\t\tif (empty($imagineBase)) {\n\t\t\t$imagineBase = \\CakePlugin::path('Imagine') . 'Vendor' . DS . 'Imagine' . DS . 'lib' . DS;\n\t\t}\n\n\t\t$filePath = $imagineBase . $name . '.php';\n\t\tif (file_exists($filePath)) {\n\t\t\trequire_once($filePath);\n\t\t\treturn;\n\t\t}\n\n\t\t$imagineBase = $imagineBase . 'Image' . DS;\n\t\tif (file_exists($imagineBase . $name . '.php')) {\n\t\t\trequire_once($imagineBase . $name . '.php');\n\t\t\treturn;\n\t\t}\n\t}", "protected function getImageResource () {\n $extension = strtolower( strrchr ( $this->source, '.' ) );\n\n // Convert image to resource object according to its type.\n switch ( $extension ) {\n case '.jpg':\n case '.jpeg':\n $img = @imagecreatefromjpeg( $this->source );\n break;\n case '.gif':\n $img = @imagecreatefromgif( $this->source );\n break;\n case '.png':\n $img = @imagecreatefrompng( $this->source );\n break;\n default:\n $img = false;\n break;\n }\n return $img;\n }", "public function load(string $image, bool $lazy = false): bool\n\t{\n\t\t$res = false;\n\n\t\t// Cleanup image url\n\t\t$image = $this->cleanUrl($image);\n\n\t\t// Get mime type of the image\n\t\t$extension = $this->getExtension($image);\n\t\t$mime = self::MIMES[$extension] ?? null;\n\n\t\t// Check if it is a valid image\n\t\tif ($mime && (file_exists($image) || $this->isExternal($image))) {\n\t\t\t$res = true;\n\n\t\t\t// Urlencode if http\n\t\t\tif ($this->isExternal($image)) {\n\t\t\t\t$image = str_replace(['http%3A%2F%2F', 'https%3A%2F%2F', '%2F'], ['http://', 'https://', '/'], urlencode($image));\n\t\t\t}\n\n\t\t\t$this->_extension = $extension;\n\t\t\t$this->_mime = $mime;\n\t\t\t$this->_imagePath = $image;\n\t\t\t$parts = explode('/', $image);\n\t\t\t$this->_imageName = str_replace('.' . $this->_extension, '', end($parts));\n\n\t\t\t// Get image size\n\t\t\tlist($width, $height, $type) = getimagesize($image);\n\t\t\t$this->_oldWidth = $width;\n\t\t\t$this->_oldHeight = $height;\n\t\t\t$this->_imageType = $type;\n\t\t}\n\n\t\tif (!$lazy) {\n\t\t\t$resource = $this->getImageResource($image, $extension);\n\t\t\t$this->_resource = $resource;\n\t\t}\n\n\t\treturn $res;\n\t}", "protected function _checkImage() {\n if ( !is_file ( $this->src ) ) {\n $this->src = $this->default_missing_image; \n }\n $image_path_parts = pathinfo ( $this->src );\n $this->_image_name = $image_path_parts['basename'];\n $this->_thumb_filename = $this->attributes['width'] . 'x' . $this->attributes['height'] . '_' . $this->_image_name;\n $this->_thumb_src = $this->thumbs_dir_path . $this->_thumb_filename;\n if ( is_readable ( $this->_thumb_src ) ) {\n $this->_calculated_width = $this->attributes['width'];\n $this->_calculated_height = $this->attributes['height'];\n $this->src = $this->_thumb_src;\n return 'no_thumb_required';\n }\n if ( KISSIT_MAIN_PRODUCT_WATERMARK_SIZE == 0 ) {\n \tif ( !$this->_original_image_info = getimagesize ( $this->src ) ) {\n \t\treturn 'abort';\n \t} \n \tif (!in_array ( $this->_original_image_info['mime'], $this->_valid_mime ) ) {\n \t\treturn 'abort';\n \t}\n }\n }", "public function load()\n {\n $size = @getimagesize($this->file);\n if (!$size) {\n throw new \\Exception(sprintf('Could not read image size of the file #%s', $this->file));\n }\n $this->type = $size[2];\n if (!is_file($this->file) && !preg_match('|^https?:#|', $this->file)) {\n throw new \\Exception(sprintf('File #%s doesn&#8217;t exist?', $this->file));\n }\n $this->image = @imagecreatefromstring(file_get_contents($this->file));\n if (!is_resource($this->image)) {\n throw new \\Exception(sprintf('File #%s is not an image.', $this->file));\n }\n $this->updateSize($size[0], $size[1]);\n $this->mime_type = $size['mime'];\n\n return $this;\n }", "private function islibraryLoaded(): bool\n {\n if (!extension_loaded('gd') && !extension_loaded('gd2')) {\n return false;\n }\n\n return true;\n }", "public function defaultLoading() {}", "public function isGetImgResourceHookCalledCallback() {}", "public function action_image()\n\t{\n\t\t//Image::load(DOCROOT.'/files/04_2021/79199dcc06baf4cc230262fcbb4d1094.jpg')->preset('mypreset', DOCROOT.'/files/04_2021/ea7e8ed4bc9d6f7c03f5f374e30b183b.png');\n\t\t$image = Image::forge();\n\n\t\t// Or with optional config\n\t\t$image = Image::forge(array(\n\t\t\t\t'quality' => 80\n\t\t));\n\t\t$image->load(DOCROOT.'/files/04_2021/79199dcc06baf4cc230262fcbb4d1094.jpg')\n\t\t\t\t\t->crop_resize(200, 200)\n\t\t\t\t\t->rounded(100)\n\t\t\t\t\t->output();\n\t\t// Upload an image and pass it directly into the Image::load method.\n\t\tUpload::process(array(\n\t\t\t'path' => DOCROOT.DS.'files'\n\t\t));\n\n\t\tif (Upload::is_valid())\n\t\t{\n\t\t\t$data = Upload::get_files(0);\n\n\t\t\t// Using the file upload data, we can force the image's extension\n\t\t\t// via $force_extension\n\t\t\tImage::load($data['file'], false, $data['extension'])\n\t\t\t\t\t->crop_resize(200, 200)\n\t\t\t\t\t->save('image');\n\t\t} \n\t}", "public function init() {\n\t\tif(strstr($this->_detect_uri(),'media/')):\n\t\t\trequire_once(BASEPATH.'libraries/Image_lib'.EXT); \n\t\t\trequire_once(APPPATH.'libraries/MY_Image_lib'.EXT);\n\t\t\tinclude APPPATH.'config/config.php';\n\t\t include APPPATH.'config/images.php';\n \n\t\t\t$this->config = $config;\n\t \t$this->resize();\n \tendif;\n\t}", "public abstract function load();", "public function getDefaultImage();", "public function __load()\r\n {\r\n $this->__initializer__ && $this->__initializer__->__invoke($this, '__load', []);\r\n }", "public function __load()\r\n {\r\n $this->__initializer__ && $this->__initializer__->__invoke($this, '__load', []);\r\n }", "abstract protected function load();", "abstract protected function load();", "abstract protected function load();", "abstract protected function load();", "protected function getImageService() {}", "public function load(){\n\t\tif (is_file($this->_filename) && is_readable($this->_filename)){\n\t\t\t$this->_storage = require($this->_filename);\n\t\t\t$this->_dataAvailable = true;\n\t\t}\n\t}", "public function load()\n {\n }", "public function load()\n {\n }", "public function load()\n {\n }", "public function load()\n {\n }", "public function load()\n {\n }", "public function load_assets() {}", "public function checkIfCanLoad()\r\n\t{\r\n\t\treturn true;\r\n\t}", "public function load_images(Request $request)\n {\n $loggedin_user = Helper::get_logged_in_user();\n $pile = Date_metron::where(\"id\", $request->id)\n ->select('image_one', 'image_one_url', 'image_two', 'image_two_url')\n ->first();\n $data = array();\n $image_one = asset('public/assets/media/users/noimage.jpg');\n $image_two = asset('public/assets/media/users/noimage.jpg');\n if($pile)\n {\n if(!empty($pile['image_one']))\n {\n if(file_exists(base_path().'/public/date_metron/'.$pile['image_one'])) \n $image_one = $pile['image_one_url']; \n }\n if(!empty($pile['image_two']))\n {\n if(file_exists(base_path().'/public/date_metron/'.$pile['image_two'])) \n $image_two = $pile['image_two_url']; \n }\n $data = array('image_one'=>$image_one,'image_two'=>$image_two);\n }\n echo json_encode($data);\n }", "public function load();", "public function load();", "public function load();", "public function load();", "public function load();", "public function load();", "public function load();" ]
[ "0.7510242", "0.7247902", "0.72165185", "0.7079294", "0.7043849", "0.700722", "0.66745865", "0.6577331", "0.6419409", "0.6392677", "0.63886935", "0.6376109", "0.6263727", "0.6214442", "0.6175348", "0.60436434", "0.6040354", "0.6004984", "0.59886205", "0.5982271", "0.5954268", "0.5952835", "0.59271765", "0.59262013", "0.5901122", "0.5864255", "0.5839839", "0.58350706", "0.5819512", "0.5819512", "0.5819512", "0.5819512", "0.57946134", "0.5737924", "0.5736539", "0.5722997", "0.5704368", "0.5668387", "0.56648844", "0.56501573", "0.56417143", "0.5630695", "0.5620876", "0.56098247", "0.5596133", "0.5564544", "0.5560515", "0.556032", "0.5547319", "0.55355096", "0.5523239", "0.55207336", "0.55072606", "0.5503618", "0.55021113", "0.545884", "0.5458092", "0.5456488", "0.54562736", "0.54554224", "0.54530305", "0.544866", "0.5447971", "0.54367375", "0.54328376", "0.54251885", "0.54167724", "0.5416706", "0.54128623", "0.54110634", "0.540739", "0.54061085", "0.5404662", "0.540311", "0.5400652", "0.53992766", "0.53986126", "0.53955466", "0.53882295", "0.53882295", "0.5386068", "0.5386068", "0.5386068", "0.5386068", "0.5382704", "0.5381893", "0.5375721", "0.5375721", "0.5375721", "0.5375204", "0.53735733", "0.53701246", "0.53634447", "0.53594726", "0.535246", "0.535246", "0.535246", "0.535246", "0.535246", "0.535246", "0.535246" ]
0.0
-1
Loads image if not yet loaded
protected function _do_render($type, $quality) { $this->_load_image(); // Get the save function and IMAGETYPE list($save, $type) = $this->_save_function($type, $quality); // Capture the output ob_start(); // Render the image $status = isset($quality) ? $save($this->_image, NULL, $quality) : $save($this->_image, NULL); if ($status === TRUE AND $type !== $this->type) { // Reset the image type and mime type $this->type = $type; $this->mime = image_type_to_mime_type($type); } return ob_get_clean(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadImage()\n\t{\n\t\tswitch ($this->type) {\n\t\t\tcase 1:\n\t\t\t\t$this->ImageStream = @imagecreatefromgif($this->sFileLocation);\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\t$this->ImageStream = @imagecreatefromjpeg($this->sFileLocation);\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\t$this->ImageStream = @imagecreatefrompng($this->sFileLocation);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t$this->printError('invalid imagetype');\n\t\t}\n\n\t\tif (!$this->ImageStream) {\n\t\t\t$this->printError('image not loaded');\n\t\t}\n\t}", "public function load_image()\n\t{\n if (file_exists($this->local_file)) {\n $image_size = $this->image_size();\n if (preg_match('/jpeg/', $image_size['mime'])) {\n $file = imagecreatefromjpeg($this->local_file);\n } elseif (preg_match('/gif/', $image_size['mime'])) {\n $file = imagecreatefromgif($this->local_file);\n } elseif (preg_match('/png/', $image_size['mime'])) {\n $file = imagecreatefrompng($this->local_file);\n } else {\n \t$file = null;\n }\n return $file;\n }\n\t}", "private function lazyLoad(): void\n\t{\n\t\tif (empty($this->_resource)) {\n\t\t\tif ($this->_cache && !$this->isCacheExpired()) {\n\t\t\t\t$this->_cacheSkip = true;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t$resource = $this->getImageResource($this->_imagePath, $this->_extension);\n\t\t\t$this->_resource = $resource;\n\t\t}\n\t}", "protected function _load_image()\n {\n if ( ! is_resource($this->_image))\n {\n // Gets create function\n $create = $this->_create_function;\n\n // Open the temporary image\n $this->_image = $create($this->file);\n\n // Preserve transparency when saving\n imagesavealpha($this->_image, TRUE);\n }\n }", "public function load()\n\t{\n\t\tif (!$this->isValidImage()) {\n\t\t\treturn false;\n\t\t}\n\n\t\t$this->image = new SimpleImage();\n\n\t\t$this->image->fromFile($this->source_path);\n\n\t\treturn true;\n\t}", "protected function loadImage()\n {\n if (!is_resource($this->tmpImage)) {\n $create = $this->createFunctionName;\n $this->tmpImage = $create($this->filePath);\n imagesavealpha($this->tmpImage, true);\n }\n }", "function loadFile ($image) {\r\n if ( !$dims=@GetImageSize($image) ) {\r\n trigger_error('Could not find image '.$image);\r\n return false;\r\n }\r\n if ( in_array($dims['mime'],$this->types) ) {\r\n $loader=$this->imgLoaders[$dims['mime']];\r\n $this->source=$loader($image);\r\n $this->sourceWidth=$dims[0];\r\n $this->sourceHeight=$dims[1];\r\n $this->sourceMime=$dims['mime'];\r\n $this->initThumb();\r\n return true;\r\n } else {\r\n trigger_error('Image MIME type '.$dims['mime'].' not supported');\r\n return false;\r\n }\r\n }", "protected function loadImageResource()\n {\n if(empty($this->resource))\n {\n if(($this->worker === NULL || $this->worker === $this::WORKER_IMAGICK) && self::imagickAvailable())\n {\n $this->resource = $this->createImagick($this->image);\n }\n elseif(($this->worker === NULL || $this->worker === $this::WORKER_GD) && self::gdAvailable())\n {\n $this->resource = $this->getGdResource($this->image);\n }\n else\n {\n throw new Exception('Required extensions missing, extension GD or Imagick is required');\n }\n }\n }", "function loadImage($image_data) {\n\t\tif (empty($image_data['name']) && empty($image_data['tmp_name'])) {\n\t\t\treturn '';\n\t\t}\n\t\t\n\t\t$file_name = $this->image_path . DS . $image_data['name'];\n\t\t$file_name_arr = explode('.', $file_name);\n\t\t$file_name_ext = $file_name_arr[count($file_name_arr)-1];\n\t\tunset($file_name_arr[count($file_name_arr)-1]);\n\t\t$file_name_prefix = implode('.' , $file_name_arr);\n\t\t$counter = '';\n\t\t$file_name = $file_name_prefix . $counter . '.' . $file_name_ext;\n\t\t$i = 1;\n\t\twhile (file_exists($file_name)) {\n\t\t\t$counter = '_' . $i;\n\t\t\t$file_name = $file_name_prefix . $counter . '.' . $file_name_ext;\n\t\t\t$i++;\n\t\t}\n\n\t\t$tmp_name = $image_data['tmp_name'];\n\t\t$width = 88;\n\t\t$height = 88;\n\t\t\n\t\t// zmenim velikost obrazku\n\t\tApp::import('Model', 'Image');\n\t\t$this->Image = new Image;\n\t\t\n\t\t\n\t\tif (file_exists($tmp_name)) {\n\t\t\tif ($this->Image->resize($tmp_name, $file_name, $width, $height)) {\n\t\t\t\t$file_name = str_replace($this->image_path . DS, '', $file_name);\n\t\t\t\treturn $file_name;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "protected function loadImages() {\r\n $this->images = new \\App\\Table\\ImagesTable(App::getInstance()->getDb());\r\n }", "public function load_image($https = false)\n {\n return $this->load(\"image\", $https);\n }", "function _load_image_file( $file ) {\n\t\t// Run a cheap check to verify that it is an image file.\n\t\tif ( false === ( $size = getimagesize( $file ) ) )\n\t\t\treturn false;\n\t\t\n\t\tif ( false === ( $file_data = file_get_contents( $file ) ) )\n\t\t\treturn false;\n\t\t\n\t\tif ( false === ( $im = imagecreatefromstring( $file_data ) ) )\n\t\t\treturn false;\n\t\t\n\t\tunset( $file_data );\n\t\t\n\t\t\n\t\treturn $im;\n\t}", "function load_image( $filename = '' )\n\t{\n\t\tif( !is_file( $filename ) )\n\t\t\tthrow new Exception( 'Image Class: could not find image \\''.$filename.'\\'.' );\n\t\t\t\t\t\t\t\t\n\t\t$ext = $this->get_ext( $filename );\n\t\t\n\t\tswitch( $ext )\n\t\t{\n\t\t\tcase 'jpeg':\n\t\t\tcase 'jpg':\n\t\t\t\t$this->im = imagecreatefromjpeg( $filename );\n\t\t\t\tbreak;\n\t\t\tcase 'gif':\n\t\t\t\t$this->im = imagecreatefromgif( $filename );\n\t\t\t\tbreak;\n\t\t\tcase 'png':\n\t\t\t\t$this->im = imagecreatefrompng( $filename );\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new Exception( 'Image Class: An unsupported file format was supplied \\''. $ext . '\\'.' );\n\t\t}\n\t\t\n\t\treturn TRUE;\n\t}", "static private function _getLoader() {\n\t\tif(self::isNull(self::$_loader)) {\n\t\t\tself::$_loader = Loader::getImageLoader(self::webiny()->getConfig()->get('components.image'));\n\t\t}\n\n\t\treturn self::$_loader;\n\t}", "public function load($file){\n\n //kill any previous image that might still be in memory before we load a new one\n if(isset($this->image) && !empty($this->image)){\n imagedestroy($this->image);\n }\n\n //get the parameters of the image\n $image_params = getimagesize($file);\n\n //save the image params to class vars\n list($this->width, $this->height, $this->type, $this->attributes) = $image_params;\n $this->mime_type = $image_params['mime'];\n\n //check that an image type was found\n if(isset($this->type) && !empty($this->type)){\n //find the type of image so it can be loaded into memory\n switch ($this->type) {\n case IMAGETYPE_JPEG:\n $this->image = imagecreatefromjpeg($file);\n break;\n\n case IMAGETYPE_GIF:\n $this->image = imagecreatefromgif($file);\n break;\n\n case IMAGETYPE_PNG:\n $this->image = imagecreatefrompng($file);\n break;\n\n }\n\n if(isset($this->image) && !empty($this->image)){\n return true;\n }else{\n return true;\n }\n }else{\n return false;\n }\n }", "private function loadImages(): void\n {\n if (count($this->images) == 1) {\n $this->addMeta('image', $this->images[0]);\n\n return;\n }\n\n foreach ($this->images as $number => $url) {\n $this->addMeta(\"image{$number}\", $url);\n }\n }", "protected function fetchImage() {\n return null;\n }", "function load($filename)\n {\n $image_info = getimagesize($filename);\n $this->image_type = $image_info[2];\n //crea la imagen JPEG.\n if( $this->image_type == IMAGETYPE_JPEG ) \n {\n $this->image = imagecreatefromjpeg($filename);\n } \n //crea la imagen GIF.\n elseif( $this->image_type == IMAGETYPE_GIF ) \n {\n $this->image = imagecreatefromgif($filename);\n } \n //Crea la imagen PNG\n elseif( $this->image_type == IMAGETYPE_PNG ) \n {\n $this->image = imagecreatefrompng($filename);\n }\n }", "protected function _loadImageResource($source)\n {\n if (empty($source) || !is_readable($source)) {\n return false;\n }\n\n try {\n $result = imagecreatefromstring(file_get_contents($source));\n } catch (Exception $e) {\n _log(\"GD failed to open the file. Details:\\n$e\", Zend_Log::ERR);\n return false;\n }\n\n return $result;\n }", "function logonscreener_image_load($file, $extension) {\n $function = 'imagecreatefrom' . $extension;\n\n if (!function_exists($function) || !($image = $function($file))) {\n logonscreener_log(\"$function() does not exist or it did not return what was expected.\");\n return FALSE;\n }\n\n return $image;\n}", "public function getImage() {}", "function LoadImage($filename)\r\n {\r if (!($from_info = getimagesize($file)))\r\n return false;\r\n\r\n $from_type = $from_info[2];\r\n\r\n $new_img = Array(\r\n 'f' => $filename,\r\n 'w' => $from_info[0],\r\n 'h' => $from_info[1],\r\n );\r\n\r\n $id = false;\r\n if (($this->use_IM && false)\r\n || (($from_type == IMAGETYPE_GIF) && $this->GIF_IM && false))\r\n {\r $id = count($this->images)+1;\r\n $this->images[$id] = Array(0, $filename, 0, $new_img);\r\n }\r\n elseif ($img = $this->_gd_load($filename))\r\n {\r $id = count($this->images)+1;\r\n $this->images[$id] = Array(1, $filename, &$img, $new_img);\r\n }\r\n\r\n return $id;\r\n }", "function loadData ($image,$mime) {\r\n if ( in_array($mime,$this->types) ) {\r\n $this->source=imagecreatefromstring($image);\r\n $this->sourceWidth=imagesx($this->source);\r\n $this->sourceHeight=imagesy($this->source);\r\n $this->sourceMime=$mime;\r\n $this->initThumb();\r\n return true;\r\n } else {\r\n trigger_error('Image MIME type '.$mime.' not supported');\r\n return false;\r\n }\r\n }", "function wp_load_image($file)\n {\n }", "function photonfill_get_lazyload_image( $attachment_id, $img_size, $attr = array() ) {\n\treturn Photonfill()->get_lazyload_image( $attachment_id, $img_size, $attr );\n}", "function image_post_update_image_loading_attribute(?array &$sandbox = NULL): void {\n $image_config_updater = \\Drupal::classResolver(ImageConfigUpdater::class);\n \\Drupal::classResolver(ConfigEntityUpdater::class)->update($sandbox, 'entity_view_display', function (EntityViewDisplayInterface $view_display) use ($image_config_updater): bool {\n return $image_config_updater->processImageLazyLoad($view_display);\n });\n}", "function loadImage($filename) {\n $image = false;\n $imageInfo = getimagesize($filename);\n $imageType = '';\n $imageType = $imageInfo[2];\n if( $imageType == IMAGETYPE_JPEG ) {\n $image = imagecreatefromjpeg($filename);\n } elseif( $imageType == IMAGETYPE_GIF ) {\n $image = imagecreatefromgif($filename);\n } elseif( $imageType == IMAGETYPE_PNG ) {\n $image = imagecreatefrompng($filename);\n }\n return $image ? array('image' => $image, 'imgType' => $imageType, 'imageInfo' => $imageInfo) : array();\n}", "public function loadDefaultImages($field_name)\n {\n if (sfContext::hasInstance())\n {\n return;\n }\n \n print(\"trying to load default images\\n\");\n \n foreach (array('jpg', 'jpeg', 'gif', 'png') as $extension)\n {\n $filename = $this->getImageNameStem($field_name) . '.' . $extension;\n $save_path = 'web/' . $this->getImagePath();\n \n $file_to_load = 'data/images/' . get_class($this->getInvoker()) . '/' . $filename;\n $file_to_save = $save_path . $filename;\n \n// print(\"checking for $file_to_load\\n\");\n \n if (file_exists($file_to_load))\n {\n print('Found ' . $file_to_load . \"... \");\n if (!file_exists($save_path))\n {\n $cmd = \"mkdir -p \" . $save_path;\n shell_exec($cmd);\n print(\"created \" . $save_path . \"\\n\");\n }\n \n if (is_writable($save_path))\n {\n copy($file_to_load, $file_to_save);\n $this->getInvoker()->{$field_name . '_image'} = $filename;\n $this->getInvoker()->save();\n print(\"copied\\n\");\n }\n else\n {\n print(\"Don't have permission to copy to $file_to_save\\n\");\n }\n }\n }\n }", "public function getImage();", "public function getImage();", "public function getImage();", "public function getImage();", "protected function init_default_image() {\n if( file_exists($this->config['default_image']))\n {\n $this->default_image = $this->config['default_image'];\n }\n }", "protected function processImage() {}", "private function PrepareImageForCache()\n {\n if($this->verbose) { self::verbose(\"File extension is: {$this->fileExtension}\"); }\n\n switch($this->fileExtension) {\n case 'jpg':\n case 'jpeg':\n $image = imagecreatefromjpeg($this->pathToImage);\n if($this->verbose) { self::verbose(\"Opened the image as a JPEG image.\"); }\n break;\n\n case 'png':\n $image = imagecreatefrompng($this->pathToImage);\n if($this->verbose) { self::verbose(\"Opened the image as a PNG image.\"); }\n break;\n\n default: errorPage('No support for this file extension.');\n }\n return $image;\n }", "public function load() {\n if ($this->cat === \"url\" && !file_exists($this->sourcepath)) Path::download($this->originalName, $this->sourcepath);\n }", "function image_exist( $img ) \r\n\t\t{\r\n\t\t\tif( @file_get_contents( $img,0,NULL,0,1) ){ return 1; } else{ return 0; }\r\n\t\t\t\r\n\t\t}", "public function isLoaded();", "function wp_img_tag_add_loading_attr($image, $context)\n {\n }", "function load() {\n\n\t}", "function LoadPNG($imgname)\n{\n $im = @imagecreatefrompng($imgname);\n\n /* See if it failed */\n if(!$im)\n {\n /* Create a blank image */\n $im = imagecreatetruecolor (96, 96);\n $bgc = imagecolorallocate ($im, 255, 255, 255);\n $tc = imagecolorallocate ($im, 0, 0, 0);\n\n imagefilledrectangle ($im, 0, 0, 96, 96, $bgc);\n\n /* Output an error message */\n imagestring ($im, 1, 5, 5, 'Mapler.me failed.', $tc);\n imagestring ($im, 1, 5, 20, $imgname, $tc);\n }\n\n return $im;\n}", "function local_image(\n\tstring $filename,\n\tstring|int|null $width = '',\n\tstring|int|null $height = '',\n\t?string $alt = '',\n\t?string $classes = '',\n\t?string $loading = ''\n): string {\n\t$img_tag = '<img src=\"' . esc_attr(Assets\\asset_path('images/' . $filename)) . '\"';\n\tif (!empty($width)) {\n\t\t$img_tag .= ' width=\"' . esc_attr($width) . '\"';\n\t}\n\tif (!empty($height)) {\n\t\t$img_tag .= ' height=\"' . esc_attr($height) . '\"';\n\t}\n\tif (!empty($alt)) {\n\t\t$img_tag .= ' alt=\"' . esc_attr($alt) . '\"';\n\t}\n\tif (!empty($classes)) {\n\t\t$img_tag .= ' class=\"' . esc_attr($classes) . '\"';\n\t}\n\tif (empty($loading)) {\n\t\t$img_tag .= ' loading=\"lazy\"';\n\t} else {\n\t\t$img_tag .= ' loading=\"' . esc_attr($loading) . '\"';\n\t}\n\t$img_tag .= '>';\n\treturn $img_tag;\n}", "function load()\n {\n }", "function &getImage() \n { \n return $this->_isImageResource?$this->_image:false; \n }", "function LoadGif($imgname)\n{\n $im = @imagecreatefromgif($imgname);\n\n /* See if it failed */\n if(!$im)\n {\n /* Create a blank image */\n $im = imagecreatetruecolor (96, 96);\n $bgc = imagecolorallocate ($im, 255, 255, 255);\n $tc = imagecolorallocate ($im, 0, 0, 0);\n\n imagefilledrectangle ($im, 0, 0, 96, 96, $bgc);\n\n /* Output an error message */\n imagestring ($im, 1, 5, 5, 'Mapler.me failed.', $tc);\n imagestring ($im, 1, 5, 20, $imgname, $tc);\n }\n\n return $im;\n}", "function loadfile($sFileName)\n\t{\n\t\t$this->setLocations($sFileName);\n\n\t\tif (file_exists($this->sFileLocation)) {\n\t\t\t$this->initializeImageProperties();\n\t\t\t$this->loadImage();\n\t\t} else {\n\t\t\t$this->printError(\"file $this->sFileLocation not found\");\n\t\t}\n\t}", "public function loadResources() {}", "function getImage();", "protected function fetchIntroImage(){\n $this->imageIntro = $this->getImageTypeFromImages('intro');\n }", "public function load($id)\n\t{\n\t\treturn Image::model()->findByPk($id);\n\t}", "protected function getTestImage($load_expected = TRUE, array $stubs = []) {\n if (!$load_expected && !in_array('load', $stubs)) {\n $stubs = array_merge(['load'], $stubs);\n }\n\n $this->toolkit = $this->getToolkitMock($stubs);\n\n $this->toolkit->expects($this->any())\n ->method('getPluginId')\n ->will($this->returnValue('gd'));\n\n if (!$load_expected) {\n $this->toolkit->expects($this->never())\n ->method('load');\n }\n\n $this->image = new Image($this->toolkit, $this->source);\n\n return $this->image;\n }", "public static function isLoaded();", "public function __load();", "protected function _checkImage() {\n if ( !is_file ( $this->src ) ) {\n $this->src = $this->default_missing_image; \n }\n $image_path_parts = pathinfo ( $this->src );\n $this->_image_name = $image_path_parts['basename'];\n $this->_thumb_filename = $this->attributes['width'] . 'x' . $this->attributes['height'] . '_' . $this->_image_name;\n $this->_thumb_src = $this->thumbs_dir_path . $this->_thumb_filename;\n if ( is_readable ( $this->_thumb_src ) ) {\n $this->_calculated_width = $this->attributes['width'];\n $this->_calculated_height = $this->attributes['height'];\n $this->src = $this->_thumb_src;\n return 'no_thumb_required';\n }\n if ( !$this->_original_image_info = getimagesize ( $this->src ) ) {\n return 'abort';\n } \n if (!in_array ( $this->_original_image_info['mime'], $this->_valid_mime ) ) {\n return 'abort';\n }\n }", "protected function isLoaded(){\n\t\treturn $this->lodaed;\n\t}", "public function test_it_loads_an_image_string_into_a_resource()\n {\n imagepng(imagecreatefromstring($this->imagePath), $this->compareTestSaveLocation);\n imagepng($this->image->getImageResource(), $this->testImageSaveLocation);\n\n $correctImage = file_get_contents($this->compareTestSaveLocation);\n $testImage = file_get_contents($this->testImageSaveLocation);\n\n $this->assertEquals($correctImage, $testImage);\n }", "private function checkImage()\n\t{\n\t\tif (!$this->imageResized) {\n\t\t\t$this->resize($this->width, $this->height);\n\t\t}\n\t}", "public function hasImage(): bool;", "public function load($resource)\n {\n if (strpos($resource, 'http') === 0) {\n $content = $this->loadExternalImage($resource);\n $this->image->readImageBlob($content);\n } else {\n $fullPath = $this->basePath .'/'. $resource;\n $this->image->readImage($fullPath);\n }\n\n return $this->image;\n }", "protected function fetchFirstImageInContent(){\n if(!isset($this->images)){\n return;\n }\n $image = '';\n if(isset($this->images[0]['src'])){\n $image = $this->images[0]['src'];\n }\n $this->imageFirstInContent = $image;\n }", "public function loadImage($imagePath, $width, $height) {\n $fileInfo = pathinfo($imagePath);\n $cacheFileName = $fileInfo['filename'] . '_' . $width . 'x' . $height . '.' . $fileInfo['extension'];\n $cacheFile = $cacheFileName;\n if(file_exists('image/cache/' . $cacheFile)) {\n return new Image($cacheFile, 'image/cache/');\n }\n else {\n return false;\n }\n }", "public function load() { }", "private function loadImage($imageUrl)\n {\n $filename = pathinfo($imageUrl)['basename'];\n //change extension to jpg\n $filename = preg_replace('/\\\\.[^.\\\\s]{3,4}$/', '.jpg', $filename);\n\n $localPath = $this->cacheDir . \"/$filename\";\n\n $image = imagecreatefromstring(file_get_contents($imageUrl));\n imagejpeg($image, $localPath, $this->jpegQuality);\n imagedestroy($image);\n\n return $localPath;\n }", "public function hasImage()\n {\n return !empty($this->image) && file_exists($this->getImagePath());\n }", "public function has_image() {\r\n return ! empty( $this->image );\r\n }", "public function sideload_gallery_image() {\n\t\t\n\t\tcheck_ajax_referer( 'daylife-gallery-add-nonce', 'nonce' );\n\t\t$file_to_load = esc_url_raw( $_POST['image_url'] );\n\t\t$post_id = absint( $_POST['post_id'] );\n\t\t$desc = sanitize_text_field( $_POST['caption'] );\n\t\tif ( $file_to_load ) {\n\t\t\t$image = media_sideload_image( $file_to_load, $post_id, $desc );\n\t\t\tif ( is_wp_error( $image ) ) {\n\t\t\t\techo 'Error transferring image';\n\t\t\t}\n\t\t}\n\t\tdie;\n\n\t}", "public static function load($name) {\n\t $name = str_replace(\"\\\\\", DS, $name);\n\t\t$imagineBase = \\Configure::read('Imagine.base');\n\t\tif (empty($imagineBase)) {\n\t\t\t$imagineBase = \\CakePlugin::path('Imagine') . 'Vendor' . DS . 'Imagine' . DS . 'lib' . DS;\n\t\t}\n\n\t\t$filePath = $imagineBase . $name . '.php';\n\t\tif (file_exists($filePath)) {\n\t\t\trequire_once($filePath);\n\t\t\treturn;\n\t\t}\n\n\t\t$imagineBase = $imagineBase . 'Image' . DS;\n\t\tif (file_exists($imagineBase . $name . '.php')) {\n\t\t\trequire_once($imagineBase . $name . '.php');\n\t\t\treturn;\n\t\t}\n\t}", "protected function getImageResource () {\n $extension = strtolower( strrchr ( $this->source, '.' ) );\n\n // Convert image to resource object according to its type.\n switch ( $extension ) {\n case '.jpg':\n case '.jpeg':\n $img = @imagecreatefromjpeg( $this->source );\n break;\n case '.gif':\n $img = @imagecreatefromgif( $this->source );\n break;\n case '.png':\n $img = @imagecreatefrompng( $this->source );\n break;\n default:\n $img = false;\n break;\n }\n return $img;\n }", "public function load(string $image, bool $lazy = false): bool\n\t{\n\t\t$res = false;\n\n\t\t// Cleanup image url\n\t\t$image = $this->cleanUrl($image);\n\n\t\t// Get mime type of the image\n\t\t$extension = $this->getExtension($image);\n\t\t$mime = self::MIMES[$extension] ?? null;\n\n\t\t// Check if it is a valid image\n\t\tif ($mime && (file_exists($image) || $this->isExternal($image))) {\n\t\t\t$res = true;\n\n\t\t\t// Urlencode if http\n\t\t\tif ($this->isExternal($image)) {\n\t\t\t\t$image = str_replace(['http%3A%2F%2F', 'https%3A%2F%2F', '%2F'], ['http://', 'https://', '/'], urlencode($image));\n\t\t\t}\n\n\t\t\t$this->_extension = $extension;\n\t\t\t$this->_mime = $mime;\n\t\t\t$this->_imagePath = $image;\n\t\t\t$parts = explode('/', $image);\n\t\t\t$this->_imageName = str_replace('.' . $this->_extension, '', end($parts));\n\n\t\t\t// Get image size\n\t\t\tlist($width, $height, $type) = getimagesize($image);\n\t\t\t$this->_oldWidth = $width;\n\t\t\t$this->_oldHeight = $height;\n\t\t\t$this->_imageType = $type;\n\t\t}\n\n\t\tif (!$lazy) {\n\t\t\t$resource = $this->getImageResource($image, $extension);\n\t\t\t$this->_resource = $resource;\n\t\t}\n\n\t\treturn $res;\n\t}", "protected function _checkImage() {\n if ( !is_file ( $this->src ) ) {\n $this->src = $this->default_missing_image; \n }\n $image_path_parts = pathinfo ( $this->src );\n $this->_image_name = $image_path_parts['basename'];\n $this->_thumb_filename = $this->attributes['width'] . 'x' . $this->attributes['height'] . '_' . $this->_image_name;\n $this->_thumb_src = $this->thumbs_dir_path . $this->_thumb_filename;\n if ( is_readable ( $this->_thumb_src ) ) {\n $this->_calculated_width = $this->attributes['width'];\n $this->_calculated_height = $this->attributes['height'];\n $this->src = $this->_thumb_src;\n return 'no_thumb_required';\n }\n if ( KISSIT_MAIN_PRODUCT_WATERMARK_SIZE == 0 ) {\n \tif ( !$this->_original_image_info = getimagesize ( $this->src ) ) {\n \t\treturn 'abort';\n \t} \n \tif (!in_array ( $this->_original_image_info['mime'], $this->_valid_mime ) ) {\n \t\treturn 'abort';\n \t}\n }\n }", "public function load()\n {\n $size = @getimagesize($this->file);\n if (!$size) {\n throw new \\Exception(sprintf('Could not read image size of the file #%s', $this->file));\n }\n $this->type = $size[2];\n if (!is_file($this->file) && !preg_match('|^https?:#|', $this->file)) {\n throw new \\Exception(sprintf('File #%s doesn&#8217;t exist?', $this->file));\n }\n $this->image = @imagecreatefromstring(file_get_contents($this->file));\n if (!is_resource($this->image)) {\n throw new \\Exception(sprintf('File #%s is not an image.', $this->file));\n }\n $this->updateSize($size[0], $size[1]);\n $this->mime_type = $size['mime'];\n\n return $this;\n }", "private function islibraryLoaded(): bool\n {\n if (!extension_loaded('gd') && !extension_loaded('gd2')) {\n return false;\n }\n\n return true;\n }", "public function defaultLoading() {}", "public function isGetImgResourceHookCalledCallback() {}", "public function action_image()\n\t{\n\t\t//Image::load(DOCROOT.'/files/04_2021/79199dcc06baf4cc230262fcbb4d1094.jpg')->preset('mypreset', DOCROOT.'/files/04_2021/ea7e8ed4bc9d6f7c03f5f374e30b183b.png');\n\t\t$image = Image::forge();\n\n\t\t// Or with optional config\n\t\t$image = Image::forge(array(\n\t\t\t\t'quality' => 80\n\t\t));\n\t\t$image->load(DOCROOT.'/files/04_2021/79199dcc06baf4cc230262fcbb4d1094.jpg')\n\t\t\t\t\t->crop_resize(200, 200)\n\t\t\t\t\t->rounded(100)\n\t\t\t\t\t->output();\n\t\t// Upload an image and pass it directly into the Image::load method.\n\t\tUpload::process(array(\n\t\t\t'path' => DOCROOT.DS.'files'\n\t\t));\n\n\t\tif (Upload::is_valid())\n\t\t{\n\t\t\t$data = Upload::get_files(0);\n\n\t\t\t// Using the file upload data, we can force the image's extension\n\t\t\t// via $force_extension\n\t\t\tImage::load($data['file'], false, $data['extension'])\n\t\t\t\t\t->crop_resize(200, 200)\n\t\t\t\t\t->save('image');\n\t\t} \n\t}", "public function init() {\n\t\tif(strstr($this->_detect_uri(),'media/')):\n\t\t\trequire_once(BASEPATH.'libraries/Image_lib'.EXT); \n\t\t\trequire_once(APPPATH.'libraries/MY_Image_lib'.EXT);\n\t\t\tinclude APPPATH.'config/config.php';\n\t\t include APPPATH.'config/images.php';\n \n\t\t\t$this->config = $config;\n\t \t$this->resize();\n \tendif;\n\t}", "public abstract function load();", "public function getDefaultImage();", "public function __load()\r\n {\r\n $this->__initializer__ && $this->__initializer__->__invoke($this, '__load', []);\r\n }", "public function __load()\r\n {\r\n $this->__initializer__ && $this->__initializer__->__invoke($this, '__load', []);\r\n }", "abstract protected function load();", "abstract protected function load();", "abstract protected function load();", "abstract protected function load();", "protected function getImageService() {}", "public function load(){\n\t\tif (is_file($this->_filename) && is_readable($this->_filename)){\n\t\t\t$this->_storage = require($this->_filename);\n\t\t\t$this->_dataAvailable = true;\n\t\t}\n\t}", "public function load()\n {\n }", "public function load()\n {\n }", "public function load()\n {\n }", "public function load()\n {\n }", "public function load()\n {\n }", "public function load_assets() {}", "public function checkIfCanLoad()\r\n\t{\r\n\t\treturn true;\r\n\t}", "public function load_images(Request $request)\n {\n $loggedin_user = Helper::get_logged_in_user();\n $pile = Date_metron::where(\"id\", $request->id)\n ->select('image_one', 'image_one_url', 'image_two', 'image_two_url')\n ->first();\n $data = array();\n $image_one = asset('public/assets/media/users/noimage.jpg');\n $image_two = asset('public/assets/media/users/noimage.jpg');\n if($pile)\n {\n if(!empty($pile['image_one']))\n {\n if(file_exists(base_path().'/public/date_metron/'.$pile['image_one'])) \n $image_one = $pile['image_one_url']; \n }\n if(!empty($pile['image_two']))\n {\n if(file_exists(base_path().'/public/date_metron/'.$pile['image_two'])) \n $image_two = $pile['image_two_url']; \n }\n $data = array('image_one'=>$image_one,'image_two'=>$image_two);\n }\n echo json_encode($data);\n }", "public function load();", "public function load();", "public function load();", "public function load();", "public function load();", "public function load();", "public function load();" ]
[ "0.7510242", "0.7247902", "0.72165185", "0.7079294", "0.7043849", "0.700722", "0.66745865", "0.6577331", "0.6419409", "0.6392677", "0.63886935", "0.6376109", "0.6263727", "0.6214442", "0.6175348", "0.60436434", "0.6040354", "0.6004984", "0.59886205", "0.5982271", "0.5954268", "0.5952835", "0.59271765", "0.59262013", "0.5901122", "0.5864255", "0.5839839", "0.58350706", "0.5819512", "0.5819512", "0.5819512", "0.5819512", "0.57946134", "0.5737924", "0.5736539", "0.5722997", "0.5704368", "0.5668387", "0.56648844", "0.56501573", "0.56417143", "0.5630695", "0.5620876", "0.56098247", "0.5596133", "0.5564544", "0.5560515", "0.556032", "0.5547319", "0.55355096", "0.5523239", "0.55207336", "0.55072606", "0.5503618", "0.55021113", "0.545884", "0.5458092", "0.5456488", "0.54562736", "0.54554224", "0.54530305", "0.544866", "0.5447971", "0.54367375", "0.54328376", "0.54251885", "0.54167724", "0.5416706", "0.54128623", "0.54110634", "0.540739", "0.54061085", "0.5404662", "0.540311", "0.5400652", "0.53992766", "0.53986126", "0.53955466", "0.53882295", "0.53882295", "0.5386068", "0.5386068", "0.5386068", "0.5386068", "0.5382704", "0.5381893", "0.5375721", "0.5375721", "0.5375721", "0.5375204", "0.53735733", "0.53701246", "0.53634447", "0.53594726", "0.535246", "0.535246", "0.535246", "0.535246", "0.535246", "0.535246", "0.535246" ]
0.0
-1
Get the GD saving function and image type for this extension. Also normalizes the quality setting
protected function _save_function($extension, & $quality) { switch (strtolower($extension)) { case 'jpg': case 'jpeg': // Save a JPG file $save = 'imagejpeg'; $type = IMAGETYPE_JPEG; break; case 'gif': // Save a GIF file $save = 'imagegif'; $type = IMAGETYPE_GIF; // GIFs do not a quality setting $quality = NULL; break; case 'png': // Save a PNG file $save = 'imagepng'; $type = IMAGETYPE_PNG; // Use a compression level of 9 (does not affect quality!) $quality = 9; break; default: throw new Exception('Installed GD does not support :type images', array(':type' => $extension)); break; } return array($save, $type); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getGDType(){\n \t\treturn isset($GLOBALS[\"GDIMAGE_TYPE\"][strtolower($this->Extension)]) ? $GLOBALS[\"GDIMAGE_TYPE\"][strtolower($this->Extension)] : \"jpg\";\n\t}", "function getGDType(){\n\t\treturn isset(we_base_imageEdit::$GDIMAGE_TYPE[strtolower($this->Extension)]) ? we_base_imageEdit::$GDIMAGE_TYPE[strtolower($this->Extension)] : 'jpg';\n\t}", "public function getFormat()\n {\n if ($this->quality !== null || $this->progressive) {\n return 'jpg';\n }\n\n return $this->format;\n }", "public function getExt()\n {\n $type = $this->getType();\n if ($type === 'style') {\n return 'css';\n } elseif ($type === 'script') {\n return 'js';\n } elseif ($type === 'image') {\n return pathinfo($this->getSourcePath(), PATHINFO_EXTENSION);\n }\n }", "Function getFileType(){\n\t\t$it = $this->info['origSize'][2];\n\t\tswitch($it){\n\t\t\tcase IMAGETYPE_GIF: $r = \"gif\"; break;\n\t\t\tcase IMAGETYPE_JPEG: $r = \"jpg\"; break;\n\t\t\tcase IMAGETYPE_PNG: $r = \"png\"; break;\n\t\t\tcase IMAGETYPE_BMP: $r = \"bmp\"; break;\n\t\t\tcase IMAGETYPE_WBMP: $r = \"wbmp\"; break;\n\t\t\tcase IMAGETYPE_WEBP: $r = \"webp\"; break;\n\t\t\tdefault:\n\t\t\t\t$r = false;\n\t\t\t\tbreak;\n\t\t}\n\t\t\n\t\treturn $r;\n\t}", "function save_image($source, $destination, $image_type, $quality){\n switch(strtolower($image_type)){//determine mime type\n case 'image/png':\n imagepng($source, $destination); return true; //save png file\n break;\n case 'image/gif':\n imagegif($source, $destination); return true; //save gif file\n break;\n case 'image/jpeg': case 'image/pjpeg':\n imagejpeg($source, $destination, $quality); return true; //save jpeg file\n break;\n default: return false;\n }\n}", "function ImageExt($filename){\n \n $size = getimagesize($filename);\nif($size==FALSE){\n $er=''; \n\n}else{\n $ext=explode(\"/\", $size['mime']);\n $er=$ext[1]; \n}\nreturn $er;\n}", "public function filter_jpeg_quality(){\n\t return self::jpeg_quality;\n }", "public function getSaveAlpha()\n {\n return $this->PNGIsSaveAlpha;\n }", "public static function get_extension() {\n\t\tif ($_FILES[\"images\"][\"type\"][0] == \"image/jpeg\") {\n\t\t\t$extension = '.jpeg';\n\t\t} else if ($_FILES[\"images\"][\"type\"][0] == \"image/png\") {\n\t\t\t$extension = '.png';\n\t\t} \n\t\tglobal $firephp;\n\t\t$firephp->log('The extension is:');\n\t\t$firephp->log($extension);\n\t\treturn $extension;\n\t}", "function image_save_gd($resource)\n\t{\t\n\t\tswitch ($this->image_type)\n\t\t{\n\t\t\tcase 1 :\n\t\t\t\t\t\tif ( ! function_exists('imagegif'))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$this->set_error(array('imglib_unsupported_imagecreate', 'imglib_gif_not_supported'));\n\t\t\t\t\t\t\treturn FALSE;\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t@imagegif($resource, $this->full_dst_path);\n\t\t\t\tbreak;\n\t\t\tcase 2\t:\n\t\t\t\t\t\tif ( ! function_exists('imagejpeg'))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$this->set_error(array('imglib_unsupported_imagecreate', 'imglib_jpg_not_supported'));\n\t\t\t\t\t\t\treturn FALSE;\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t@touch($this->full_dst_path); // PHP 4.4.1 bug #35060 - workaround\n\t\t\t\t\t\t@imagejpeg($resource, $this->full_dst_path, $this->quality);\n\t\t\t\tbreak;\n\t\t\tcase 3\t:\n\t\t\t\t\t\tif ( ! function_exists('imagepng'))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$this->set_error(array('imglib_unsupported_imagecreate', 'imglib_png_not_supported'));\n\t\t\t\t\t\t\treturn FALSE;\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\t@imagepng($resource, $this->full_dst_path);\n\t\t\t\tbreak;\n\t\t\tdefault\t\t:\n\t\t\t\t\t\t\t$this->set_error(array('imglib_unsupported_imagecreate'));\n\t\t\t\t\t\t\treturn FALSE;\t\t\n\t\t\t\tbreak;\t\t\n\t\t}\n\t\n\t\treturn TRUE;\n\t}", "public function save() {\n \n $checkError = $this->isError();\n if (!$checkError) {\n \n $ext = $this->getImageExt();\n $quality = $this->__imageQuality;\n $dirSavePath = dirname($this->__imageSavePath);\n \n if (empty($this->__imageSavePath) || !is_dir($dirSavePath)) {\n $this->setError(__d('cloggy','Image save path not configured or maybe not exists.'));\n } else { \n \n /*\n * create resized image\n */\n switch($ext) {\n \n case 'jpg':\n case 'jpeg':\n\n if (imagetypes() & IMG_JPG) {\n @imagejpeg($this->__imageResized,$this->__imageSavePath,$quality); \n }\n\n break;\n\n case 'gif':\n\n if (imagetypes() & IMG_GIF) {\n @imagegif($this->__imageResized,$this->__imageSavePath); \n }\n\n break;\n\n case 'png':\n\n $scaleQuality = round($this->__imageQuality/100) * 9;\n $invertScaleQuality = 9 - $scaleQuality;\n\n if (imagetypes() & IMG_PNG) {\n @imagepng($this->__imageResized,$this->__imageSavePath,$invertScaleQuality); \n }\n\n break;\n\n } \n \n } \n \n /*\n * destroy resized image\n */\n if ($this->__imageResized) {\n \n //destroy resized image\n imagedestroy($this->__imageResized);\n \n } \n \n }\n \n }", "function image_mimetype($extension) {\n\t$extension = trim(strtolower(str_replace('.','',$extension)));\n\tif ($extension == \"gif\") {\n\t\treturn 'image/gif';\n\t} elseif ($extension == \"png\") {\n\t\treturn 'image/png';\n\t} else {\n\t\treturn 'image/jpeg';\n\t}\n}", "function save($filename, $type, $quality) {\r\n return null; //PEAR::raiseError(\"No Save method exists\", true);\r\n }", "function GetImageExtension($imagetype){\n if(empty($imagetype)) return false;\n switch($imagetype){\n case 'image/bmp':return '.bmp';\n case 'image/gif':return '.gif';\n case 'image/jpeg':return '.jpg';\n case 'image/png':return '.png';\n default: return false;\n }}", "function gd_edit_image_support($mime_type)\n {\n }", "function saveResizedImage($format,$imgData,$resizedFilename){\n \tswitch( $format ){\n\t\tcase 1:\n\t\timagegif($imgData, $resizedFilename);\n\t\tbreak;\n\t\tcase 2:\n\t\timagejpeg($imgData, $resizedFilename, 75);\n\t\tbreak;\n\t\tcase 3:\n\t\timagepng($imgData, $resizedFilename, 1);\n\t}\n}", "function changer_formats($type)\n{\n $format = \"\";\n \n switch ($type)\n {\n case 'image/png':\n $format = '.png';\n break;\n case 'image/jpeg':\n $format = '.jpg';\n break;\n case 'image/gif':\n $format = '.gif';\n break;\n case 'image/bmp':\n $format = '.bmp';\n break;\n case 'image/vnd.microsoft.icon':\n $format = '.ico';\n break;\n case 'image/tiff':\n $format = '.tif';\n break;\n case 'image/svg+xml':\n $format = '.svg';\n break;\n }\n \n return $format;\n}", "public function save(array $options = []) {\n/* if (preg_match('/image/', $this->mime_type)) {\n $this->isImage = true;\n $manager = new ImageManager(array('driver' => 'gd'));\n $image = Storage::disk('public')->get($this->myFile);\n $imageOrig = $manager->make($image); \n //Get width and height of the image\n $this->img_width = $imageOrig->width();\n $this->img_height = $imageOrig->height();\n }*/\n parent::save($options);\n $this->createThumbs();\n }", "public function getQuality();", "public function getQuality();", "public function getSupportedImageExt() {\n return $this->__supportedImageExtension;\n }", "public function getImageFormat() : string\n\t{\n\t\tif(is_null($this->imageFormat)) {\n\t\t\t// default format\n\t\t\treturn LabelImageFormat::PNG;\n\t\t}\n\t\t\n\t\treturn $this->imageFormat;\n\t}", "function pretty_filetype($ext)\n{\n\tswitch ($ext)\n\t{\n\t\tcase \"png\": $extn=\"PNG Image\"; break;\n\t\tcase \"jpg\": $extn=\"JPEG Image\"; break;\n\t\tcase \"jpeg\": $extn=\"JPEG Image\"; break;\n\t\tcase \"svg\": $extn=\"SVG Image\"; break;\n\t\tcase \"gif\": $extn=\"GIF Image\"; break;\n\t\tcase \"ico\": $extn=\"Windows Icon\"; break;\n\n\t\tcase \"txt\": $extn=\"Text File\"; break;\n\t\tcase \"log\": $extn=\"Log File\"; break;\n\t\tcase \"htm\": $extn=\"HTML File\"; break;\n\t\tcase \"html\": $extn=\"HTML File\"; break;\n\t\tcase \"xhtml\": $extn=\"HTML File\"; break;\n\t\tcase \"shtml\": $extn=\"HTML File\"; break;\n\t\tcase \"php\": $extn=\"PHP Script\"; break;\n\t\tcase \"js\": $extn=\"Javascript File\"; break;\n\t\tcase \"css\": $extn=\"Stylesheet\"; break;\n\n\t\tcase \"pdf\": $extn=\"PDF Document\"; break;\n\t\tcase \"xls\": $extn=\"Spreadsheet\"; break;\n\t\tcase \"xlsx\": $extn=\"Spreadsheet\"; break;\n\t\tcase \"doc\": $extn=\"Microsoft Word Document\"; break;\n\t\tcase \"docx\": $extn=\"Microsoft Word Document\"; break;\n\n\t\tcase \"zip\": $extn=\"ZIP Archive\"; break;\n\t\tcase \"htaccess\": $extn=\"Apache Config File\"; break;\n\t\tcase \"exe\": $extn=\"Windows Executable\"; break;\n\n\t\tdefault:\n\t\tif($ext!=\"\")\n\t\t{\n\t\t\t$extn=strtoupper($ext).\" File\";\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$extn=\"Unknown\";\n\t\t}\n\t}\n\n\treturn $extn;\n}", "function saveImage()\n\t{\n\n\t\tif (!$this->ImageStream) {\n\t\t\t$this->printError('image not loaded');\n\t\t}\n\n\t\tswitch ($this->type) {\n\t\t\tcase 1:\n\t\t\t\t/* store a interlaced gif image */\n\t\t\t\tif ($this->interlace === true) {\n\t\t\t\t\timageinterlace($this->ImageStream, 1);\n\t\t\t\t}\n\n\t\t\t\timagegif($this->ImageStream, $this->sFileLocation);\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\t/* store a progressive jpeg image (with default quality value)*/\n\t\t\t\tif ($this->interlace === true) {\n\t\t\t\t\timageinterlace($this->ImageStream, 1);\n\t\t\t\t}\n\n\t\t\t\timagejpeg($this->ImageStream, $this->sFileLocation, $this->jpegquality);\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\t/* store a png image */\n\t\t\t\timagepng($this->ImageStream, $this->sFileLocation);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t$this->printError('invalid imagetype');\n\n\t\t\t\tif (!file_exists($this->sFileLocation)) {\n\t\t\t\t\t$this->printError('file not stored');\n\t\t\t\t}\n\t\t}\n\t}", "function mimeType ($s_extension) {\n\t//you can pass a full filename if you want to be lazy (saves extra code elsewhere)\n\tswitch (pathinfo (strtolower ($s_extension), PATHINFO_EXTENSION)) {\n\t\t//images\n\t\tcase 'gif':\t\t\t\treturn 'image/gif';\t\t\tbreak;\n\t\tcase 'jpg': case 'jpeg': \t\treturn 'image/jpeg';\t\t\tbreak;\n\t\tcase 'png':\t\t\t\treturn 'image/png';\t\t\tbreak;\n\t\t//code\n\t\tcase 'asp':\t\t\t\treturn 'text/asp';\t\t\tbreak;\n\t\tcase 'css':\t\t\t\treturn 'text/css';\t\t\tbreak;\n\t\tcase 'html':\t\t\t\treturn 'text/html';\t\t\tbreak;\n\t\tcase 'js':\t\t\t\treturn 'application/javascript';\tbreak;\n\t\tcase 'php':\t\t\t\treturn 'application/x-httpd-php';\tbreak;\n\t\t//documents\n\t\tcase 'pdf':\t\t\t\treturn 'application/pdf';\t\tbreak;\n\t\tcase 'txt': case 'do': case 'log':\treturn 'text/plain';\t\t\tbreak;\n\t\tcase 'rem':\t\t\t\treturn 'text/remarkable';\t\tbreak;\n\t\t//downloads\n\t\tcase 'exe': case 'dmg':\t\t\treturn 'application/octet-stream';\tbreak;\n\t\tcase 'sh':\t\t\t\treturn 'application/x-sh';\t\tbreak;\n\t\tcase 'zip':\t\t\t\treturn 'application/zip';\t\tbreak;\n\t\t//media\n\t\tcase 'mp3':\t\t\t\treturn 'audio/mpeg';\t\t\tbreak;\n\t\tcase 'oga':\t\t\t\treturn 'audio/ogg';\t\t\tbreak;\n\t\tcase 'ogv':\t\t\t\treturn 'video/ogg';\t\t\tbreak;\n\t\t//fonts\n\t\tcase 'ttf':\t\t\t\treturn 'font/ttf';\t\t\tbreak;\n\t\tcase 'otf':\t\t\t\treturn 'font/otf';\t\t\tbreak;\n\t\tcase 'woff':\t\t\t\treturn 'font/x-woff';\t\t\tbreak;\n\t\tdefault:\t\t\t\treturn 'application/octet-stream';\tbreak;\n\t}\n}", "public function handler_wp_editor_set_quality( $quality, $mime_type = '' )\n\t\t{\n\t\t\treturn apply_filters( 'avf_wp_editor_set_quality', $this->config['default_jpeg_quality'], $quality, $mime_type );\n\t\t}", "function getTypeMime () {\n if ($this->thumbToolkit == null) {\n return '';\n }\n return $this->thumbToolkit->getTypeMime();\n }", "function getImageType($extension = NULL) {\n\t\tif(isset($extension)) {\n\t\t\t$result = NULL;\t\t\t\n\t\t\t$imageExtensions = array(\"image/jpeg\", \"image/jpg\", \"image/png\", \"image/pjpeg\", \"image/x-png\", \"image/gif\");\n\t\t\tforeach($imageExtensions as $ext) {\n\t\t\t\tif($extension == $ext) {\n\t\t\t\t\t$result = substr($extension, 6);\n\t\t\t\t\treturn \".\".$result;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn $result;\n\t\t} else {\n\t\t\treturn NULL;\n\t\t}\n\t}", "public function image_save_gd($resource)\n\t{\n\t\tswitch ($this->image_type)\n\t\t{\n\t\t\tcase 1:\n\t\t\t\tif ( ! function_exists('imagegif'))\n\t\t\t\t{\n\t\t\t\t\t$this->set_error(array('imglib_unsupported_imagecreate', 'imglib_gif_not_supported'));\n\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\n\t\t\t\tif ( ! @imagegif($resource, $this->full_dst_path))\n\t\t\t\t{\n\t\t\t\t\t$this->set_error('imglib_save_failed');\n\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\tif ( ! function_exists('imagejpeg'))\n\t\t\t\t{\n\t\t\t\t\t$this->set_error(array('imglib_unsupported_imagecreate', 'imglib_jpg_not_supported'));\n\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\n\t\t\t\tif ( ! @imagejpeg($resource, $this->full_dst_path, $this->quality))\n\t\t\t\t{\n\t\t\t\t\t$this->set_error('imglib_save_failed');\n\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\tif ( ! function_exists('imagepng'))\n\t\t\t\t{\n\t\t\t\t\t$this->set_error(array('imglib_unsupported_imagecreate', 'imglib_png_not_supported'));\n\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\n\t\t\t\tif ( ! @imagepng($resource, $this->full_dst_path))\n\t\t\t\t{\n\t\t\t\t\t$this->set_error('imglib_save_failed');\n\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t$this->set_error(array('imglib_unsupported_imagecreate'));\n\t\t\t\treturn FALSE;\n\t\t\tbreak;\n\t\t}\n\n\t\treturn TRUE;\n\t}", "function save_image($source, $destination, $image_type, $quality){\n\tswitch(strtolower($image_type)){//determine mime type\n\t\tcase 'image/png':\n\t\t\timagepng($source, $destination); return true; //save png file\n\t\t\tbreak;\n\t\tcase 'image/gif':\n\t\t\timagegif($source, $destination); return true; //save gif file\n\t\t\tbreak;\n\t\tcase 'image/jpeg': case 'image/pjpeg':\n\t\t\timagejpeg($source, $destination, $quality); return true; //save jpeg file\n\t\t\tbreak;\n\t\tdefault: return false;\n\t}\n}", "function GetImageExtension($imagetype){\n if(empty($imagetype)) return false;\n switch($imagetype){\n case 'image/bmp': return '.bmp';\n case 'image/gif': return '.gif';\n case 'image/jpeg': return '.jpg';\n case 'image/png': return '.png';\n default: return false;\n }\n}", "function get_image_size($image) {\n if($image = getimagesize($image)) {\n $image[2] = image_type_to_extension($image[2],false);\n if($image[2] == 'jpeg') {\n $image[2] = 'jpg';\n }\n return $image;\n } else {\n return false;\n }\n}", "public function getMimeType() {\r\n\t\t// hard coding\r\n\t\treturn \"image/jpeg\";\r\n\t}", "function GetImageExtension($imagetype){\n \n if(empty($imagetype)) return false;\n \n switch($imagetype){\n case 'image/bmp': return '.bmp';\n case 'image/gif': return '.gif';\n case 'image/jpeg': return '.jpg';\n case 'image/png': return '.png';\n default: return false;\n }\n }", "public function customJpegQuality() {\n\t\treturn 80;\n\t}", "private function generateThumbnailGD(){\n\t\t\n\t}", "function save( $format = 'jpg', $filename = NULL, $jpegquality = 100 )\n\t{\n\t\t//if no filename, set up OB to cpature the output\n\t\tif( $filename == NULL )\n\t\t{\n\t\t\t$do_return = true;\n\t\t\tob_start();\n\t\t}\n\t\t\n\t\t//save the image based on supplied format\n\t\tswitch( $format )\n\t\t{\n\t\t\tcase 'jpg':\n\t\t\tcase 'jpeg':\n\t\t\t\t$result = imagejpeg( $this->im, $filename, $jpegquality );\n\t\t\t\tbreak;\n\t\t\tcase 'gif':\n\t\t\t\t$result = imagegif( $this->im, $filename );\n\t\t\t\tbreak;\n\t\t\tcase 'png':\n\t\t\t\t$result = imagepng( $this->im, $filename );\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tif( $do_return ) { ob_end_clean(); }\n\t\t\t\tthrow new Exception( 'Image Class: Invalid save format \\''.$format.'\\'' );\n\t\t}\n\t\t\n\t\t//return the image data as needed\n\t\tif( $do_return )\n\t\t{\n\t\t\t$data = ob_get_flush();\n\t\t\treturn $data;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn $result;\n\t\t}\n\t}", "function gd_support(){\n \t\treturn in_array($this->getGDType(), we_image_edit::supported_image_types());\n \t}", "function getFileType()\n {\n try\n {\n list($this->m_Width, $this->m_height, $this->m_type, $this->m_attr) = getimagesize($this->m_ImagePath);\n return $this->m_type;\n }\n catch (Exception $ex)\n {\n return 0;\n }\n }", "function getFormatFilename()\n\n\t{\n\n\t\tglobal $config;\n\n\t\tglobal $config;\n\n\n\n\t\t$bitrate = $this->bitrate;\n\n\t\tfor ($i=0;$i<count($config['audioFormats']);$i++)\n\n\t\t\tif (abs($config['audioFormats'][$i]['bitrate'] - $this->bitrate) < $config['bitrateTolerance'])\n\n\t\t\t\t$bitrate = $config['audioFormats'][$i]['bitrate'];\n\n\t\treturn round($bitrate) . 'kbps_' . $this->channels . 'chn_' . $this->samplerate . 'Hz.' . $this->format;\n\n\t}", "protected function save()\n {\n switch ($this->image_info['mime']) {\n \n case 'image/gif':\n imagegif($this->image, $this->getPath(true));\n break;\n \n case 'image/jpeg':\n imagejpeg($this->image, $this->getPath(true), $this->quality);\n break;\n \n case 'image/jpg':\n imagejpeg($this->image, $this->getPath(true), $this->quality);\n break;\n \n case 'image/png':\n imagepng($this->image, $this->getPath(true), round($this->quality / 10));\n break;\n \n default:\n $_errors[] = $this->image_info['mime'] . ' images are not supported';\n return $this->errorHandler();\n break;\n }\n \n chmod($this->getPath(true), 0777);\n }", "protected function get_default_quality($mime_type)\n {\n }", "function image_type_to_common_extension($imagetype, $include_dot = true) {\n\t$replace = array(\n\t\t'jpeg' => 'jpg',\n\t\t'tiff' => 'tif',\n\t);\n\t$ext = image_type_to_extension($imagetype, $include_dot);\n\treturn isset($replace[$ext]) ? $replace[$ext] : $ext;\n}", "function gd_support(){\n\t\treturn in_array($this->getGDType(), we_base_imageEdit::supported_image_types());\n\t}", "public function testSaveWithSimilarFormat(): void\n {\n $file = $this->getThumbCreatorInstance()->resize(200)->save(['format' => 'jpeg']);\n $this->assertFileExtension('jpg', $file);\n\n $this->skipIfDriverIs('gd');\n $file = $this->getThumbCreatorInstance()->resize(200)->save(['format' => 'tif']);\n $this->assertFileExtension('tiff', $file);\n\n //Using the `target` option with an invalid file\n $this->expectException(NotSupportedException::class);\n $this->getThumbCreatorInstanceWithSave('', ['target' => 'image.txt']);\n }", "public function testSaveWithQualityImageEquals(): void\n {\n $thumb = $this->getThumbCreatorInstance()->resize(200)->save(['quality' => 10]);\n $this->assertImageFileEquals('resize_w200_h200_quality_10.jpg', $thumb);\n }", "function _file_get_type($file) {\n $ext = file_ext($file);\n if (preg_match(\"/$ext/i\", get_setting(\"image_ext\")))\n return IMAGE;\n if (preg_match(\"/$ext/i\", get_setting(\"audio_ext\")))\n return AUDIO;\n if (preg_match(\"/$ext/i\", get_setting(\"video_ext\")))\n return VIDEO;\n if (preg_match(\"/$ext/i\", get_setting(\"document_ext\")))\n return DOCUMENT;\n if (preg_match(\"/$ext/i\", get_setting(\"archive_ext\")))\n return ARCHIVE;\n }", "public function handler_wp_jpeg_quality( $quality, $context = '' )\n\t\t{\n\t\t\treturn apply_filters( 'avf_jpeg_quality', $this->config['default_jpeg_quality'], $quality, $context );\n\t\t}", "protected function saveImage($extension, & $quality)\n {\n if (!$extension) {\n $extension = image_type_to_extension($this->fileExtension, false);\n }\n\n switch (strtolower($extension)) {\n case 'jpg':\n case 'jpeg':\n $save = 'imagejpeg';\n $type = IMAGETYPE_JPEG;\n break;\n case 'gif':\n $save = 'imagegif';\n $type = IMAGETYPE_GIF;\n $quality = NULL;\n break;\n case 'png':\n $save = 'imagepng';\n $type = IMAGETYPE_PNG;\n $quality = 9;\n break;\n default:\n throw new Exception('Type not supported');\n break;\n }\n\n return [$save, $type];\n }", "function extension2fileType( $extension )\n{\n $file_types = '' ; # initialize\n switch ( strtolower( $extension ) )\n {\n case '.jpg':\n case '.jpeg':\n $file_types = 'image/pjpeg,image/jpeg' ;\n break ;\n case '.gif':\n $file_types = 'image/gif' ;\n break ;\n case '.png':\n $file_types = 'image/x-png' ;\n break ;\n case '.doc':\n $file_types = 'application/msword' ;\n break ;\n case '.zip':\n $file_types = 'application/x-zip-compressed' ;\n break ;\n case '.pdf':\n $file_types = 'application/pdf' ;\n break ;\n case '.xls':\n $file_types = 'application/vnd.ms-excel' ;\n break ;\n case '.mp3':\n $file_types = 'audio/mpeg' ;\n break ;\n case '.txt':\n $file_types = 'text/plain' ;\n break ;\n case '.htm':\n case '.html':\n $file_types = 'text/html' ;\n break ;\n case '.wma':\n $file_types = 'audio/x-ms-wma' ;\n break ;\n default:\n $file_types = 'image/pjpeg,image/jpeg' ; # default to .jpg\n }\n return $file_types ; # return matching file type!\n}", "public function get_quality()\n {\n }", "private function get_signature_image_options() {\n\t\t$width = $this->get_signature_image_width();\n\t\t$height = $this->get_signature_image_height();\n\n\t\t$options = array( 'bgColour' => 'transparent' );\n\n\t\tif ( is_numeric( $height ) ) {\n\t\t\t$options['imageSize'] = array( (int) $width, (int) $height );\n\t\t\t$options['drawMultiplier'] = apply_filters( 'frm_sig_multiplier', 5, $this->field );\n\t\t}\n\n\t\treturn apply_filters( 'frm_sig_output_options', $options, array( 'field' => $this->field ) );\n\t}", "function _testGD() {\r\n $gd = array();\r\n $GDfuncList = get_extension_funcs('gd');\r\n ob_start();\r\n @phpinfo(INFO_MODULES);\r\n $output=ob_get_contents();\r\n ob_end_clean();\r\n $matches[1]='';\r\n if (preg_match(\"/GD Version[ \\t]*(<[^>]+>[ \\t]*)+([^<>]+)/s\",$output,$matches)) {\r\n $gdversion = $matches[2];\r\n }\r\n if ($GDfuncList) {\r\n if (in_array('imagegd2', $GDfuncList)) {\r\n $gd['gd2'] = $gdversion;\r\n } else {\r\n $gd['gd1'] = $gdversion;\r\n }\r\n }\r\n return $gd;\r\n }", "function afterImport(){\n\n\t\t$f=$this->getPath();\n\t\t\n\t\t$gd_info=getimagesize($f);\n\t}", "public function save($filename, $type = false, $quality = 75) {\n\n // Check if we have been sent a file type.\n if (!$type) {\n\n // Attempt to detect the file type from the filename extention.\n $type = substr($filename, -3, 3);\n }\n\n // Detect which type of image we are being asked to output.\n switch (strtolower($type)) {\n case \"png\":\n $result = imagepng($this->current, $filename);\n break;\n case \"gif\":\n $result = imagegif($this->current, $filename);\n break;\n case \"wbmp\":\n $result = imagewbmp($this->current, $filename);\n break;\n case \"xbm\":\n $result = imagexbm($this->current, $filename);\n break;\n case \"jpg\":\n case \"jpeg\":\n default:\n \timageinterlace($this->current, 1);\n $result = imagejpeg($this->current, $filename, $quality);\n break;\n }\n\n // Report on our success.\n return $result;\n }", "protected function verifyFormatCompatiblity()\n {\n $gdInfo = gd_info();\n\n switch ($this->format) {\n case 'GIF':\n $isCompatible = $gdInfo['GIF Create Support'];\n break;\n case 'JPG':\n case 'JPEG':\n $isCompatible = (isset($gdInfo['JPG Support']) || isset($gdInfo['JPEG Support'])) ? true : false;\n $this->format = 'JPEG';\n break;\n case 'PNG':\n case 'XBM':\n case 'XPM':\n case 'WBMP':\n $isCompatible = $gdInfo[$this->format . ' Support'];\n break;\n default:\n $isCompatible = false;\n break;\n }\n\n if (!$isCompatible) {\n $isCompatible = $gdInfo['JPEG Support'];\n\n if (!$isCompatible) {\n throw $this->triggerError(sprintf('Your GD installation does not support \"%s\" image types!', $this->format));\n }\n }\n }", "function wp_get_default_extension_for_mime_type($mime_type)\n {\n }", "function get_file_extension($filename){\n if(strpos($filename, \"jpeg\")){\n $ext = \"jpeg\";\n }\n else if(strpos($filename, \"png\")){\n $ext = \"png\";\n }\n else if(strpos($filename, \"gif\")){\n $ext = \"gif\";\n }\n else{\n $ext = \"jpg\";\n }\n return $ext;\n }", "public function getUsableExtension()\n {\n return $this->isJavascript() ? 'js' : 'css';\n }", "function testCompatible(){\n\t\tif($this->$imageAsset[\"type\"] == \"image/jpeg\" || $_FILES[\"image_upload_box\"][\"type\"] == \"image/pjpeg\"){\t\n\t\t\t$this->imgType = 'jpg';\n\t\t}\t\t\n\t\t// if uploaded image was GIF\n\t\tif($this->$imageAsset[\"type\"] == \"image/gif\"){\t\n\t\t\t$this->imgType = 'gif';\n\t\t}\t\n\t\t// if uploaded image was PNG\n\t\tif($this->$imageAsset[\"type\"] == \"image/x-png\"){\n\t\t\t$this->imgType = 'png';\n\t\t}\n\t\telse {\n\t\t\t$this->imgType = 'invalid';\n\t\t}\n\t\t\n\t}", "function convertImage($originalImage, $outputImage, $quality)\n{ $exploded = explode('.',$originalImage);\n $ext = $exploded[count($exploded) - 1]; \n\n if (preg_match('/jpg|jpeg/i',$ext))\n $imageTmp=imagecreatefromjpeg($originalImage);\n else if (preg_match('/png/i',$ext))\n $imageTmp=imagecreatefrompng($originalImage);\n else if (preg_match('/gif/i',$ext))\n $imageTmp=imagecreatefromgif($originalImage);\n else if (preg_match('/bmp/i',$ext))\n $imageTmp=imagecreatefrombmp($originalImage);\n else\n return 0;\n\n // quality is a value from 0 (worst) to 100 (best)\n imagejpeg($imageTmp, $outputImage, $quality);\n imagedestroy($imageTmp);\n\n return 1;\n}", "private function createImageFromType($ext) {\n\t\tswitch($ext) {\n\t\t\tcase 'bmp': $img = imagecreatefromwbmp($this->src); break;\n\t\t\tcase 'gif': $img = imagecreatefromgif($this->src); break;\n\t\t\tcase 'jpg': $img = imagecreatefromjpeg($this->src); break;\n\t\t\tcase 'jpeg': $img = imagecreatefromjpeg($this->src); break;\n\t\t\tcase 'png': $img = imagecreatefrompng($this->src); break;\n\t\t\tcase 'webp': \n\t\t\t\tif( function_exists('imagecreatefromwebp') )\n\t\t\t\t\t$img = imagecreatefromwebp($this->src); \n\t\t\t\telse\n\t\t\t\t\t$img = null;\n\t\t\t\tbreak;\n\t\t}\n\t\treturn $img;\n\t}", "function image_write_function ( $type ) {\r\n\t\tglobal $IMAGE_TYPE_WRITEFUNCTION;\r\n\t\tif ( empty($IMAGE_TYPE_WRITEFUNCTION[$type]) )\r\n\t\t\treturn false;\r\n\t\treturn $IMAGE_TYPE_WRITEFUNCTION[$type];\r\n\t}", "function getImageType()\n {\n return is_null($this->_sImageType) ? NULL : (string) $this->_sImageType;\n }", "private static function _imageDriver(): string\n {\n $imagesService = Craft::$app->getImages();\n\n if ($imagesService->getIsGd()) {\n $driverName = 'GD';\n } else {\n $driverName = 'Imagick';\n }\n\n return $driverName . ' ' . $imagesService->getVersion();\n }", "function getMimeType() ;", "function OutputImage ($im, $format, $quality)\n{\n switch ($format)\n {\n case \"JPEG\": \n ImageJPEG ($im, \"\", $quality);\n break;\n case \"PNG\":\n ImagePNG ($im);\n break;\n case \"GIF\":\n ImageGIF ($im);\n break;\n }\n}", "protected function determineFormat()\n {\n if ($this->isDataStream === true) {\n $this->format = 'STRING';\n\n return;\n }\n $formatInfo = getimagesize($this->filename);\n\n // non-image files will return false\n if ($formatInfo === false) {\n if ($this->remoteImage) {\n $this->setError('Could not determine format of remote image: ' . $this->filename);\n }\n else {\n $this->setError(sprintf('File \"%s\" is not a valid image!', $this->filename));\n }\n\n return;\n }\n\n $mimeType = isset($formatInfo['mime']) ? $formatInfo['mime'] : null;\n\n if (!empty($mimeType)) {\n $tmp = explode('/', $mimeType);\n $format = strtoupper(end($tmp));\n }\n else {\n $this->setError('Image format is not supported: ' . $mimeType);\n\n return;\n }\n\n if ($format == 'JPG' || $format == 'JPEG') {\n $this->format = 'JPEG';\n }\n else {\n $this->format = $format;\n }\n }", "public function getImageDefaultFileExtension(): string\n {\n return $this->imageDefaultFileExtension;\n }", "function zthemename_save_image_filter( $image_meta, $image_id ) {\n\n if ( ! isset( $image_meta ) || ! get_post( $image_id ) ) {\n return $image_meta;\n }\n \n // get image name\n $path = get_attached_file( $image_id );\n\n $basename = pathinfo( $path, PATHINFO_BASENAME );\n $dirname = pathinfo( $path, PATHINFO_DIRNAME ); \n\n $image_meta[ 'sizes' ][ 'full' ] = array(\n 'file' => $basename,\n 'width' => $image_meta[ 'width' ],\n 'height' => $image_meta[ 'height' ],\n 'mime-type' => get_post_mime_type( $image_id )\n );\n\n foreach( $image_meta[ 'sizes' ] as $size => &$data ) {\n\n // these need to be seperate, causes issues otherwise...\n $mimetype = (string) $data[ 'mime-type' ];\n $child = path_join( $dirname, wp_basename( $data[ 'file' ] ) );\n\n if ( ! file_exists( $child ) ) {\n continue;\n }\n\n if ( 'image/jpeg' == $mimetype || 'image/png' == $mimetype ) {\n // if image is new, and size is full, open file and compress it. wp doesnt do the original by default...\n if ( 'full' == $size ) {\n $editor = wp_get_image_editor( $child );\n $editor->save( $child, $mimetype );\n unset( $editor );\n }\n\n if ( class_exists( 'Imagick' ) ) {\n $imagick = new Imagick( $child );\n\n // set interlacing if not set... \n if ( imagick::INTERLACE_PLANE !== $imagick->getInterlaceScheme() ) {\n $imagick->setInterlaceScheme( imagick::INTERLACE_PLANE );\n $imagick->writeImage();\n }\n\n $imagick->clear();\n $imagick->destroy();\n unset( $imagick );\n }\n }\n }\n unset( $image_meta[ 'sizes' ][ 'full' ] );\n\n return $image_meta;\n }", "function jpeg_quality_callback($arg)\n{\n\treturn (int)100;\n}", "public function getFileExtension(){\n\n if($this->isPhoto()){\n return \"jpg\";\n }\n\n if($this->isVideo()){\n return \"mp4\";\n }\n\n return \"bin\";\n\n }", "function saveImageObjectToFile($objImage, $imageType, $fileName, $quality)\n\t{\n\t\t$filePath = dirname($fileName);\n\t\tif (!is_dir($filePath))\n\t\t\tmkdir($filePath, 0777, true);\n\t\t\n\t\t// If the file already exists\n\t\tif(is_file($fileName))\n\t\t\t@unlink($fileName);\n\n\t\t\t\t\n\t\tswitch ($imageType)\n\t\t{\n\t\t\tcase 1: $res = @imagegif($objImage,$fileName); break;\n\t\t\tcase 2: $res = @imagejpeg($objImage,$fileName,intval($quality*100)); break;\n\t\t\tcase 3: $res = @imagepng($objImage,$fileName,intval($quality*9)); break;\n\t\t}\n\t\t\t\t\n\t\tif (!$res)\n\t\t\t$this->lastError = 'error_saving_image_file';\n\t\t\n\t\tchmod($fileName, 0777);\n\t\t\n\t\treturn $res;\n\t}", "public function getMediaType()\n {\n return Mage::getStoreConfig('quickview/media/active', Mage::app()->getStore());\n }", "function getExtension() ;", "function getQuality() {return $this->_quality;}", "function OutputImage ($im, $format, $quality) \n{ \n\tswitch ($format) \n\t{ \n\t\tcase \"JPEG\": \n\t\t\tImageJPEG ($im, NULL, $quality); \n\t\t\tbreak; \n\t\tcase \"PNG\": \n\t\t\tImagePNG ($im); \n\t\t\tbreak; \n\t\tcase \"GIF\": \n\t\t\tImageGIF ($im); \n\t\t\tbreak; \n\t} \n}", "public function getSupportedFormat()\n {\n $gdInfo = gd_info();\n $support = array();\n\n foreach ($gdInfo as $key => $info) {\n if (is_bool($info) && $info === true) {\n $tmp = explode(' ', $key);\n $format = $tmp[0];\n if (($format != 'FreeType' || $format != 'T1Lib') && !in_array($format, $support)) {\n $support[] = $format;\n }\n }\n }\n\n return $support;\n }", "function get_image_file_types() {\n return array( \n 'gif',\n 'jpg',\n 'jpeg',\n 'png',\n 'wbmp',\n );\n }", "public function preferredFormats(): ?array\n {\n return [\n 'jpg',\n ];\n }", "public function getImageMimeType(): string\n {\n return $this->imageMimeType;\n }", "function gdVersion($user_ver = 0)\n{\n if (! extension_loaded('gd')) { return; }\n static $gd_ver = 0;\n // Just accept the specified setting if it's 1.\n if ($user_ver == 1) { $gd_ver = 1; return 1; }\n // Use the static variable if function was called previously.\n if ($user_ver !=2 && $gd_ver > 0 ) { return $gd_ver; }\n // Use the gd_info() function if possible.\n if (function_exists('gd_info')) {\n $ver_info = gd_info();\n preg_match('/\\d/', $ver_info['GD Version'], $match);\n $gd_ver = $match[0];\n return $match[0];\n }\n // If phpinfo() is disabled use a specified / fail-safe choice...\n if (preg_match('/phpinfo/', ini_get('disable_functions'))) {\n if ($user_ver == 2) {\n $gd_ver = 2;\n return 2;\n } else {\n $gd_ver = 1;\n return 1;\n }\n }\n // ...otherwise use phpinfo().\n ob_start();\n phpinfo(8);\n $info = ob_get_contents();\n ob_end_clean();\n $info = stristr($info, 'gd version');\n preg_match('/\\d/', $info, $match);\n $gd_ver = $match[0];\n return $match[0];\n}", "function image_resize()\n\t{\n\t\t$protocol = 'image_process_'.$this->resize_protocol;\n\t\t\n\t\tif (substr($protocol, -3) == 'gd2')\n\t\t{\n\t\t\t$protocol = 'image_process_gd';\n\t\t}\n\t\t\n\t\treturn $this->$protocol('resize');\n\t}", "function small($sfp,$w='',$h='',$scale=true) {\n if(empty($sfp)){\n echo iCMS_FS_URL.'1x1.gif';\n return;\n }\n if(strpos($sfp,'_')!==false){\n if(preg_match('|.+\\d+x\\d+\\.jpg$|is', $sfp)!=0){\n echo $sfp;\n return;\n }\n }\n $uri = parse_url(iCMS_FS_URL);\n if(stripos($sfp,$uri['host']) === false){\n echo $sfp;\n return;\n }\n\n if(empty(iCMS::$config['thumb']['size'])){\n echo $sfp;\n return;\n }\n\n $size_map = explode(\"\\n\", iCMS::$config['thumb']['size']);\n $size_map = array_map('trim', $size_map);\n $size_map = array_flip($size_map);\n $size = $w.'x'.$h;\n if(!isset($size_map[$size])){\n echo $sfp;\n return;\n }\n\n if(iCMS::$config['FS']['yun']['enable']){\n if(iCMS::$config['FS']['yun']['sdk']['QiNiuYun']['Bucket']){\n echo $sfp.'?imageView2/1/w/'.$w.'/h/'.$h;\n return;\n }\n if(iCMS::$config['FS']['yun']['sdk']['TencentYun']['Bucket']){\n echo $sfp.'?imageView2/2/w/'.$w.'/h/'.$h;\n return;\n }\n }\n echo $sfp.'_'.$size.'.jpg';\n}", "function exif_imagetype ( $image_location ) {\r\n\t\t$image_size = getimagesize($image_location);\r\n\t\tif ( !$image_size )\r\n\t\t\treturn $image_size;\r\n\t\t$image_type = $image_size[2];\r\n\t\treturn $image_type;\r\n\t}", "private function get_type_img()\n {\n $this->multi_byte_string_to_array();\n foreach($this->strings as $char)\n {\n $this->init_img();\n $this->create_img($char);\n }\n }", "public static function supportedFormats()\n {\n return [\n 'avif' => 'image/avif',\n 'gif' => 'image/gif',\n 'jpg' => 'image/jpeg',\n 'pjpg' => 'image/jpeg',\n 'png' => 'image/png',\n 'webp' => 'image/webp',\n 'tiff' => 'image/tiff',\n ];\n }", "public static function change_image_type(){\n/**\n*\n*This function change the image type like convert png to jpg or bmp or gif\n*\n*/\npublic static function rotate()\n}", "public function save($file=null, $quality=null);", "private function processQualityOption()\n {\n $options = $this->options;\n $source = $this->source;\n\n $q = $options['quality'];\n if ($q == 'auto') {\n if (($this->/** @scrutinizer ignore-call */getMimeTypeOfSource() == 'image/jpeg')) {\n $q = JpegQualityDetector::detectQualityOfJpg($source);\n if (is_null($q)) {\n $q = $options['default-quality'];\n $this->/** @scrutinizer ignore-call */logLn(\n 'Quality of source could not be established (Imagick or GraphicsMagick is required)' .\n ' - Using default instead (' . $options['default-quality'] . ').'\n );\n\n $this->qualityCouldNotBeDetected = true;\n } else {\n if ($q > $options['max-quality']) {\n $this->logLn(\n 'Quality of source is ' . $q . '. ' .\n 'This is higher than max-quality, so using max-quality instead (' .\n $options['max-quality'] . ')'\n );\n } else {\n $this->logLn('Quality set to same as source: ' . $q);\n }\n }\n $q = min($q, $options['max-quality']);\n } else {\n //$q = $options['default-quality'];\n $q = min($options['default-quality'], $options['max-quality']);\n $this->logLn('Quality: ' . $q . '. ');\n }\n } else {\n $this->logLn(\n 'Quality: ' . $q . '. '\n );\n if (($this->getMimeTypeOfSource() == 'image/jpeg')) {\n $this->logLn(\n 'Consider setting quality to \"auto\" instead. It is generally a better idea'\n );\n }\n }\n $this->calculatedQuality = $q;\n }", "public function getExtension( bool $lowAndSimple = FALSE ): string\n\t{\n\t\tif( $this->upload->error === 4 )\n\t\t\tthrow new RuntimeException( 'No image uploaded' );\n\t\t$extension\t= pathinfo( $this->upload->name, PATHINFO_EXTENSION );\n\t\tif( $lowAndSimple ){\n\t\t\t$extension\t\t= strtolower( $extension );\n\t\t\t$extension\t\t= preg_replace( \"/^(jpe|jpeg)$/i\", 'jpg', $extension );\n\t\t}\n\t\treturn $extension;\n\t}", "protected function _coverPhotoStorageExtension()\n\t{\n\t\treturn 'core_Profile';\n\t}", "function save($filename, $image_type=IMAGETYPE_JPEG, $compression=75, $permissions=null) \n {\n //salva imagen tipo JPEG\n if( $image_type == IMAGETYPE_JPEG )\n {\n imagejpeg($this->image,$filename,$compression);\n } \n //Salva imagen GIF.\n elseif( $image_type == IMAGETYPE_GIF ) \n {\n imagegif($this->image,$filename); \n } \n //Salva imagen PNG\n //Necesita una imagen transparente.\n elseif( $image_type == IMAGETYPE_PNG ) \n { \n imagealphablending($this->image, false);\n imagesavealpha($this->image,true);\n imagepng($this->image,$filename);\n } \n if( $permissions != null) \n {\n chmod($filename,$permissions);\n }\n }", "private function saveGdImage( $dst_img, $filepath, $type ) {\n\t\t$successSaving = false;\n\t\tswitch ( $type ) {\n\t\t\tcase IMAGETYPE_JPEG:\n\t\t\t\t$successSaving = imagejpeg( $dst_img,$filepath,$this->jpg_quality );\n\t\t\t\tbreak;\n\t\t\tcase IMAGETYPE_PNG:\n\t\t\t\t$successSaving = imagepng( $dst_img,$filepath );\n\t\t\t\tbreak;\n\t\t\tcase IMAGETYPE_GIF:\n\t\t\t\t$successSaving = imagegif( $dst_img,$filepath );\n\t\t\t\tbreak;\n\t\t\tcase IMAGETYPE_BMP:\n\t\t\t\t$successSaving = imagewbmp( $dst_img,$filepath );\n\t\t\t\tbreak;\n\t\t}\n\n\t\treturn($successSaving);\n\t}", "public function getType(){\n if ($this->isImage())\n return 'img';\n if ($this->isDoc())\n return 'doc';\n if ($this->isVid())\n return 'vid';\n if ($this->isAudio())\n return 'audio';\n return ''; \n }", "static function graphic_library() {\n\n\t\t$ngg_options = get_option('ngg_options');\n\n\t\tif ( $ngg_options['graphicLibrary'] == 'im')\n\t\t\treturn NGGALLERY_ABSPATH . '/lib/imagemagick.inc.php';\n\t\telse\n\t\t\treturn NGGALLERY_ABSPATH . '/lib/gd.thumbnail.inc.php';\n\n\t}", "public function ImageQuality($file_quality){\r\n $this->proc_filequality=$file_quality;\r\n }", "public function save($file = NULL, $quality = NULL, $type = NULL)\n {\n if (!is_null($file)) {\n $parts = explode(DIRECTORY_SEPARATOR, $file);\n $name = array_pop($parts);\n $this->name = $name;\n $this->full_path = $file;\n }\n\n if (is_null($quality) && !is_null($this->quality)) {\n $quality = $this->quality;\n }\n\n if ($type === NULL) {\n switch (strtolower($ext = pathinfo($file, PATHINFO_EXTENSION))) {\n case 'jpg':\n case 'jpeg':\n $type = self::JPEG;\n break;\n case 'png':\n $type = self::PNG;\n break;\n case 'gif':\n $type = self::GIF;\n break;\n default:\n throw new InvalidArgumentException(\"Unsupported file extension '$ext'.\");\n }\n }\n\n switch ($type) {\n case self::JPEG:\n if ($file === null) {\n $quality = null;\n } else {\n $quality = $quality === NULL ? 85 : max(0, min(100, (int)$quality));\n }\n return imagejpeg($this->getImageResource(), $file, $quality);\n\n case self::PNG:\n if ($file === null) {\n $quality = null;\n } else {\n $quality = $quality === NULL ? 9 : max(0, min(9, (int)$quality));\n }\n return imagepng($this->getImageResource(), $file, $quality);\n\n case self::GIF:\n return imagegif($this->getImageResource(), $file);\n\n default:\n throw new InvalidArgumentException(\"Unsupported image type '$type'.\");\n }\n }", "public function getFormat($fileExtension);" ]
[ "0.73923534", "0.71739316", "0.66663194", "0.60201335", "0.5980345", "0.59768635", "0.5898809", "0.5890547", "0.58843863", "0.5835049", "0.5814651", "0.5807202", "0.5803945", "0.57777286", "0.57446337", "0.5733839", "0.571005", "0.56993294", "0.56830055", "0.56557226", "0.56557226", "0.5634379", "0.5633742", "0.56290936", "0.56260335", "0.5621848", "0.5618478", "0.56041217", "0.5591958", "0.5585649", "0.5581668", "0.5564059", "0.5560132", "0.5558133", "0.55562663", "0.55464494", "0.553671", "0.5535634", "0.55333036", "0.5518125", "0.5517756", "0.55036765", "0.5480095", "0.546805", "0.5447353", "0.5438688", "0.5437476", "0.54309005", "0.5422205", "0.54159504", "0.54159194", "0.54064023", "0.53823847", "0.5373841", "0.53699565", "0.5333271", "0.53297865", "0.53251207", "0.5324233", "0.5315392", "0.53139174", "0.5310176", "0.5307912", "0.5291234", "0.5284524", "0.52820075", "0.5277568", "0.5277525", "0.527744", "0.5267566", "0.5267349", "0.5260985", "0.52586067", "0.5253391", "0.5251565", "0.52513796", "0.5245629", "0.5245415", "0.52379906", "0.5232948", "0.5232457", "0.5230714", "0.52252007", "0.5224804", "0.5221453", "0.5218284", "0.5215258", "0.5215165", "0.5213617", "0.52104515", "0.5205371", "0.52020276", "0.52009314", "0.5197379", "0.5191111", "0.5183424", "0.51831686", "0.5174436", "0.51654917", "0.51627606" ]
0.6354834
3
Create an empty image with the given width and height.
protected function _create($width, $height) { // Create an empty image $image = imagecreatetruecolor($width, $height); // Do not apply alpha blending imagealphablending($image, FALSE); // Save alpha levels imagesavealpha($image, TRUE); return $image; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function create_blank_image() {\r\n\t\t$image = imagecreatetruecolor( $this->diameter,$this->diameter );\r\n\r\n\t\t/* we also need a transparent background ... */\r\n\t\timagesavealpha($image, true);\r\n\r\n\t\t/* create a transparent color ... */\r\n\t\t$color = imagecolorallocatealpha($image, 0, 0, 0, 127);\r\n\r\n\t\t/* ... then fill the image with it ... */\r\n\t\timagefill($image, 0, 0, $color);\r\n\r\n\t\t/* nothing to do then ... just save the new image ... */\r\n\t\t$this->cutted_image = $image;\r\n\r\n\t\t/* go back and see what should we do next ..? */\r\n\t\treturn;\r\n\r\n\t}", "public function generateDummyImage($width, $height)\n {\n try {\n $width = (int)$width;\n $height = (int)$height;\n\n $image = imagecreatetruecolor($width, $height);\n $gray = imagecolorallocate($image, 0xBB, 0xBB, 0xBB);\n\n imagefilledrectangle($image, 0, 0, $width, $height, $gray);\n imagepng($image);\n imagedestroy($image);\n\n return response(null, 200, ['Content-type' => 'image/png']);\n } catch (\\Exception $e) {\n return response()->json(['error' => $e->getMessage()], 404);\n }\n }", "function new_image( $w = 0, $h = 0 )\n\t{\n\t\t$this->im = imagecreatetruecolor( $w, $h );\n\t\treturn TRUE;\n\t}", "protected function _createImage()\n {\n $this->_height = $this->scale * 60;\n $this->_width = 1.8 * $this->_height;\n $this->_image = imagecreate($this->_width, $this->_height);\n ImageColorAllocate($this->_image, 0xFF, 0xFF, 0xFF);\n }", "function create($w,$h) {\n\n if ( $this->vertical ) {\n $this->width = $h;\n $this->height = $w;\n } else {\n $this->width = $w;\n $this->height = $h;\n }\n\n $this->img = imageCreate($this->width,$this->height);\n $this->colorIds = array();\n}", "function wp_imagecreatetruecolor($width, $height)\n {\n }", "protected function createImage(): void\n {\n // create image\n $this->image = @imagecreatetruecolor($this->width, $this->height);\n\n // set mime type\n $this->mimeType = 'image/png';\n\n // set modified date\n $this->modified = time();\n }", "public function generateBlankImage($config){ \n\t\t$image = imagecreatetruecolor($config['img_width'], $config['img_height']);\n\t\timagesavealpha($image, true);\n\t\t$transparent = imagecolorallocatealpha($image, 0, 0, 0, 127);\n\t\timagefill($image, 0, 0, $transparent);\n\t\t// cache the output\n\t\tob_start();\n\t\timagepng($image);\n\t\t$img = ob_get_contents();\n\t\tob_end_clean();\n\t\t// return the string\n\t\treturn base64_encode($img);\n\t}", "private function create_img_stream()\n {\n $this->img = imagecreate(L_IMG_WIDTH,L_IMG_HEIGHT);\n }", "protected function createImage($width, $height)\n {\n $image = imagecreatetruecolor($width, $height);\n imagealphablending($image, false);\n imagesavealpha($image, true);\n\n return $image;\n }", "public function createRectangle()\n {\n imagefilledrectangle($this->image, 0, 0, $this->width, $this->height, imagecolorallocate($this->image, 255, 255, 255));\n }", "public static function create()\n\t{\n\t\tswitch (func_num_args()) {\n\t\t\tcase 0:\n\t\t\t\treturn new Image();\n\t\t\tcase 1:\n\t\t\t\treturn new Image(func_get_arg(0));\n\t\t\tcase 2:\n\t\t\t\treturn new Image(func_get_arg(0), func_get_arg(1));\n\t\t\tcase 3:\n\t\t\t\treturn new Image(func_get_arg(0), func_get_arg(1), func_get_arg(2));\n\t\t\tcase 4:\n\t\t\t\treturn new Image(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3));\n\t\t\tcase 5:\n\t\t\t\treturn new Image(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4));\n\t\t\tcase 6:\n\t\t\t\treturn new Image(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5));\n\t\t\tcase 7:\n\t\t\t\treturn new Image(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6));\n\t\t\tcase 8:\n\t\t\t\treturn new Image(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6), func_get_arg(7));\n\t\t\tdefault:\n\t\t\t\tthrow new \\InvalidArgumentException('More than 8 arguments supplied, please be reasonable.');\n\t\t}\n\t}", "public static function Image()\n\t{\n\t\treturn new Image;\n\t}", "private function createNewTransparentImage($width, $height)\n {\n $image = imagecreatetruecolor($width, $height);\n imagesavealpha($image, true);\n imagefill($image, 0, 0, imagecolorallocatealpha($image, 0, 0, 0, 127));\n\n return $image;\n }", "private function imageCreateTransparent($width, $height) \n\t{ \n\t\t// Create the blank image with black:\n\t $clearImage = imagecreatetruecolor($width, $height);\n\t imagesavealpha($clearImage, true);\n\n\t // Select the color black to replace as transparent:\n\t $transparent = imagecolorallocatealpha($clearImage, 0, 0, 0, 127);\n\t \n\t // Run the function to tranform black to clear:\n\t imagefill($clearImage, 0, 0, $transparent);\n\t return $clearImage;\n\t}", "private function newImageResource($width, $height) {\n $new_image = imagecreatetruecolor($width, $height);\n\n// handling images with alpha channel information\n switch ($this->_mimetype) {\n case \"image/png\":\n// integer representation of the color black (rgb: 0,0,0)\n $background = imagecolorallocate($new_image, 0, 0, 0);\n// removing the black from the placeholder\n imagecolortransparent($new_image, $background);\n\n// turning off alpha blending (to ensure alpha channel information is preserved, rather than removed (blending with the rest of the image in the form of black))\n imagealphablending($new_image, false);\n\n// turning on alpha channel information saving (to ensure the full range of transparency is preserved)\n imagesavealpha($new_image, true);\n\n break;\n case \"image/gif\":\n// integer representation of the color black (rgb: 0,0,0)\n $background = imagecolorallocate($new_image, 0, 0, 0);\n// removing the black from the placeholder\n imagecolortransparent($new_image, $background);\n\n break;\n }\n\n return $new_image;\n }", "public function create($width = null, $height = null, $name = null)\n {\n if ((null !== $width) && (null !== $height)) {\n $this->width = $width;\n $this->height = $height;\n }\n\n if (null !== $name) {\n $this->name = $name;\n }\n\n if (null === $this->resource) {\n $this->resource = new \\Imagick();\n }\n\n $this->resource->newImage($this->width, $this->height, new \\ImagickPixel('white'));\n\n if (null !== $this->name) {\n $extension = strtolower(substr($this->name, (strrpos($this->name, '.') + 1)));\n if (!empty($extension)) {\n $this->resource->setImageFormat($extension);\n $this->format = $extension;\n }\n }\n\n return $this;\n }", "private function transparentImage($width, $height)\n {\n $img = imagecreatetruecolor($width, $height);\n imagealphablending($img, false);\n imagesavealpha($img, true);\n $backgr = imagecolorallocatealpha($img, 255, 255, 255, 127);\n imagefilledrectangle($img, 0, 0, $width, $height, $backgr);\n return $img;\n }", "function someImage($width, $height, $options = []);", "public function createImage()\n {\n if ($this->resize) {\n\n // get the resize dimensions\n $height = (int)array_get($this->resizeDimensions, 'new_height', 320);\n\n $width = (int)array_get($this->resizeDimensions, 'new_width', 240);\n\n if ($this->fit) {\n return Image::make($this->originalPath)->fit($width, $height)\n ->save(base_path() . $this->storageLocation . '/' . $this->uniqueName, $this->imgQuality);\n } else {\n return Image::make($this->originalPath)->resize($width, $height)\n ->save(base_path() . $this->storageLocation . '/' . $this->uniqueName, $this->imgQuality);\n }\n\n } else {\n\n return Image::make($this->originalPath)\n ->save(base_path() . $this->storageLocation . '/' . $this->uniqueName, $this->imgQuality);\n }\n }", "public function getImage(int $width = 300, int $height = 300)\n {\n // Créé une ressource en mémoire\n $img = imagecreate($width, $height);\n imagecolorallocate($img, rand(0, 255),rand(0, 255),rand(0, 255));\n $randColor = imagecolorallocate($img, rand(0, 255),rand(0, 255),rand(0, 255));\n $randColor2 = imagecolorallocatealpha($img, rand(0, 255),rand(0, 255),rand(0, 255), rand(0,126));\n imagefilledrectangle($img,25,25,275,275, $randColor);\n imagefilledpolygon($img, array(\n 150, 25,\n 200, 100,\n 275, 100,\n 225, 175,\n 275, 275,\n 150, 225,\n 25, 275,\n 75, 175,\n 25, 100,\n 100, 100\n ), 10, $randColor2);\n\n // Créé un fichier jpeg à partir de la ressource\n ob_start();\n imagepng($img);\n $png = ob_get_clean();\n return $png;\n }", "public function create (\r\n $width, \r\n $height, \r\n string $bgcolor = '#fafafa', \r\n string $color = '#cdcdcd',\r\n string $text = null\r\n ) { \r\n $image = imagecreatetruecolor($width, $height);\r\n $image = $this->paintImage($image, $bgcolor);\r\n $color = $this->painImageText($image, $color); \r\n\r\n // Check whether there is globally set font size or not.\r\n $fontSize = isset($this->fontSize) ? $this->fontSize : $this->setFontSize($width, $height);\r\n $image = $this->typeOnImage($image, $fontSize, $color, $text);\r\n \r\n return $image;\r\n }", "function __construct( $filename ) {\n\n if ( !file_exists( $filename ) ) {\n Magic::alert( \"You are trying to create a new image from $filename. But it seems $filename does not exist. Check that you are pointing to the right file in the right folder.\" );\n }\n // extract image information\n $info = getimagesize( $filename );\n $this->width = $info[0];\n $this->height = $info[1];\n $this->mimetype = $info['mime'];\n\n if ( $this->mimetype == 'image/jpeg' ) {\n $this->image = imagecreatefromjpeg( $filename );\n } elseif ( $this->mimetype == 'image/gif' ) {\n $this->image = imagecreatefromgif( $filename );\n } elseif ( $this->mimetype == 'image/png' ) {\n $this->image = imagecreatefrompng( $filename );\n }\n }", "static function img($filename, $arguments=false) {\n\t\t$arguments = self::arguments($arguments);\n\n\t\t//compute size\n\t\tif (empty($arguments['width']) || empty($arguments['height'])) {\n\n\t\t}\n\n\t\t$arguments['src'] = $filename;\n\t\tunset($arguments['maxwidth'], $arguments['maxheight']);\n\t\treturn self::tag('img', $arguments);\n\t}", "public function testDimensionsNoResize()\n {\n $dimensions = Dimensions::create(\n 400,\n 400,\n 200,\n 200,\n ElcodiMediaImageResizeTypes::NO_RESIZE\n );\n\n $this->assertEquals(0, $dimensions->getSrcX());\n $this->assertEquals(0, $dimensions->getSrcY());\n $this->assertEquals(400, $dimensions->getSrcWidth());\n $this->assertEquals(400, $dimensions->getSrcHeight());\n\n $this->assertEquals(0, $dimensions->getDstX());\n $this->assertEquals(0, $dimensions->getDstY());\n $this->assertEquals(400, $dimensions->getDstWidth());\n $this->assertEquals(400, $dimensions->getDstHeight());\n $this->assertEquals(400, $dimensions->getDstFrameX());\n $this->assertEquals(400, $dimensions->getDstFrameY());\n }", "public static function getInstanceByCreate(int $width, int $height): Image\n {\n $instance = new self();\n\n // set image dimensions\n $instance->width = (int) $width;\n $instance->height = (int) $height;\n\n $instance->createImage();\n\n return $instance;\n }", "public function create($src, $width = null, $height = null, $no_crop = null, $keep_canvas_size = null, $public = null, $dynamic_output = null) {\n\n if (is_array($src)) {\n\n $src = array_only($src, array('src', 'width', 'w', 'height', 'h', 'no_crop', 'keep_canvas_size', 'dynamic_output'));\n\n if (isset($src['width'])) {\n $width = $src['width'];\n } elseif (isset($src['w'])) {\n $width = $src['w'];\n } else {\n $width = $width;\n }\n\n if (isset($src['height'])) {\n $height = $src['height'];\n } elseif (isset($src['h'])) {\n $height = $src['h'];\n } else {\n $height = $height;\n }\n\n $no_crop = isset($src['no_crop']) ? $src['no_crop'] : $no_crop;\n $keep_canvas_size = isset($src['keep_canvas_size']) ? $src['keep_canvas_size'] : $keep_canvas_size;\n $public = isset($src['public']) ? $src['public'] : $public;\n $dynamic_output = isset($src['dynamic_output']) ? $src['dynamic_output'] : $dynamic_output;\n\n // The following assignment is to be at the last place within this block.\n $src = isset($src['src']) ? $src['src'] : null;\n }\n\n $public = !empty($public);\n $dynamic_output = !empty($dynamic_output);\n\n // Sanitaze the source URL.\n if ($this->_check_path($src) === false) {\n\n if ($dynamic_output) {\n $this->_display_error(500);\n }\n\n return false;\n }\n\n // Calcualate the image path from the provided source URL.\n\n $src_path = $this->image_base_path.str_replace($this->image_base_url, '', $src);\n\n if (!is_file($src_path)) {\n\n if ($dynamic_output) {\n $this->_display_error(404);\n }\n\n return false;\n }\n\n $src_path = $this->_get_absolute_filename($src_path);\n\n if ($src_path === false || !is_file($src_path)) {\n\n if ($dynamic_output) {\n $this->_display_error(404);\n }\n\n return false;\n }\n\n // Get the name of a subdirectory that should contain the image's thumbnails.\n $image_cache_subdirectory = $this->_create_path_hash($src_path);\n $image_cache_path = ($public ? $this->image_public_cache_path : $this->image_cache_path).$image_cache_subdirectory.'/';\n\n // Get the image base name and file extension.\n $src_name_parts = $this->ci->image_lib->explode_name($src_path);\n $name = pathinfo($src_name_parts['name'], PATHINFO_BASENAME);\n $ext = $src_name_parts['ext'];\n\n // Expose the image default parameters.\n extract($this->_get_image_defaults());\n\n // Prepare the input parameters.\n\n $w = (string) $width;\n $h = (string) $height;\n\n $no_crop = !empty($no_crop);\n $no_crop_saved = $no_crop;\n\n if ($force_crop) {\n $no_crop = false;\n }\n\n $keep_canvas_size = !empty($keep_canvas_size);\n\n // Determine whether dynamic input is enabled.\n\n if ($dynamic_output) {\n\n $dynamic_output_enabled = false;\n\n foreach ($this->enable_dynamic_output as & $d_location) {\n\n if (strpos($src_path, $d_location) === 0) {\n $dynamic_output_enabled = true;\n }\n }\n\n unset($d_location);\n\n if (!$dynamic_output_enabled) {\n $this->_display_error(403);\n }\n }\n\n // Check whether the image is valid one.\n\n $prop = $this->ci->image_lib->get_image_properties($src_path, true);\n\n if ($prop === false) {\n\n if ($dynamic_output) {\n $this->_display_error(500);\n }\n\n return false;\n }\n\n $mime_type = $prop['mime_type'];\n $image_type = $prop['image_type'];\n $src_size = filesize($src_path);\n\n // The image seems to be valid, so create the corresponding\n // subdirectory that should contain the image's thumbnails.\n file_exists($image_cache_path) OR @mkdir($image_cache_path, DIR_WRITE_MODE, TRUE);\n\n // Determine whether a watermark should be put.\n\n $has_watermark = false;\n\n foreach ($this->enable_watermark as & $wm_location) {\n\n if (strpos($src_path, $wm_location) === 0) {\n $has_watermark = true;\n }\n }\n\n unset($wm_location);\n\n // Determine kind of Image_lib's resizing operation is to be executed.\n\n $resize_operation = null;\n\n if ($w > 0) {\n\n $resize_operation = 'fit_width';\n $w = (int) $w;\n\n } else {\n\n $w = '';\n }\n\n if ($h > 0) {\n\n $resize_operation = $resize_operation == 'fit_width'\n ? ($no_crop ? ($keep_canvas_size ? 'fit_canvas' : 'fit_inner') : 'fit')\n : 'fit_height';\n\n $h = (int) $h;\n\n } else {\n\n $h = '';\n }\n\n if ($resize_operation == '') {\n\n $w = (int) $prop['width'];\n $h = (int) $prop['height'];\n\n $resize_operation = $keep_canvas_size ? 'fit_canvas' : 'fit_inner';\n }\n\n // Based on the real file name and the relevant parameters the thumbnail's\n // filename (a hash) is to be created. Let us determine these parameters.\n\n $parameters = compact(\n 'src_path',\n 'src_size',\n 'resize_operation',\n 'w',\n 'h',\n 'no_crop',\n 'force_crop',\n 'keep_canvas_size',\n 'has_watermark'\n );\n\n if ($keep_canvas_size) {\n\n $parameters = array_merge($parameters, compact(\n 'bg_r',\n 'bg_g',\n 'bg_b',\n 'bg_alpha'\n ));\n }\n\n if ($has_watermark) {\n\n $wm_parameters = compact(\n 'wm_enabled_min_w',\n 'wm_enabled_min_h',\n 'wm_type',\n 'wm_padding',\n 'wm_vrt_alignment',\n 'wm_hor_alignment',\n 'wm_hor_offset',\n 'wm_vrt_offset'\n );\n\n if ($wm_type == 'text') {\n\n $wm_parameters = array_merge($wm_parameters, compact(\n 'wm_text',\n 'wm_font_path',\n 'wm_font_size',\n 'wm_font_color',\n 'wm_shadow_color',\n 'wm_shadow_distance'\n ));\n\n } elseif ($wm_type == 'overlay') {\n\n $wm_parameters = array_merge($wm_parameters, compact(\n 'wm_overlay_path',\n 'wm_opacity',\n 'wm_x_transp',\n 'wm_y_transp'\n ));\n }\n\n $parameters = array_merge($parameters, $wm_parameters);\n }\n\n // Determine the destination file.\n //$cached_image_name = sha1(serialize($parameters)).$ext;\n $cached_image_name = sha1(serialize($parameters)).'-'.url_title($name, '-', true, true, $this->ci->config->default_language()).$ext; // SEO-friendly, hopefully.\n $cached_image_file = $image_cache_path.$cached_image_name;\n\n // If the destination file does not exist - create it.\n\n if (!is_file($cached_image_file)) {\n\n // Resize the image and write it to destination file.\n\n $config = array();\n $config['source_image'] = $src_path;\n $config['dynamic_output'] = false;\n $config['new_image'] = $cached_image_file;\n $config['maintain_ratio'] = true;\n $config['create_thumb'] = false;\n $config['width'] = $w;\n $config['height'] = $h;\n $config['quality'] = 100;\n\n if (!$this->ci->image_lib->initialize($config)) {\n\n if ($dynamic_output) {\n $this->_display_error(500);\n }\n\n return false;\n }\n\n if ($resize_operation == 'fit_inner' || $resize_operation == 'fit_canvas') {\n $this->ci->image_lib->resize();\n } else {\n $this->ci->image_lib->fit();\n }\n\n $this->ci->image_lib->clear();\n\n // If the canvas size is to be preserved - add background with the\n // given width and height and place the image at the center.\n\n if ($resize_operation == 'fit_canvas') {\n\n $backgrund_image = @ tempnam(sys_get_temp_dir(), 'imp');\n\n if ($backgrund_image === false) {\n\n @ unlink($cached_image_file);\n\n if ($dynamic_output) {\n $this->_display_error(500);\n }\n\n return false;\n }\n\n $img = imagecreatetruecolor($w, $h);\n imagesavealpha($img, true);\n $bg = imagecolorallocatealpha($img, $bg_r, $bg_g, $bg_b, $bg_alpha);\n imagefill($img, 0, 0, $bg);\n\n $this->ci->image_lib->image_type = $image_type;\n $this->ci->image_lib->full_dst_path = $backgrund_image;\n $this->ci->image_lib->quality = 100;\n\n if (!$this->ci->image_lib->image_save_gd($img)) {\n\n @ unlink($backgrund_image);\n @ unlink($cached_image_file);\n\n if ($dynamic_output) {\n $this->_display_error(500);\n }\n\n return false;\n }\n\n $this->ci->image_lib->clear();\n\n $config = array();\n $config['source_image'] = $backgrund_image;\n $config['wm_type'] = 'overlay';\n $config['wm_overlay_path'] = $cached_image_file;\n $config['wm_opacity'] = 100;\n $config['wm_hor_alignment'] = 'center';\n $config['wm_vrt_alignment'] = 'middle';\n $config['wm_x_transp'] = false;\n $config['wm_y_transp'] = false;\n $config['dynamic_output'] = false;\n $config['new_image'] = $cached_image_file;\n $config['quality'] = 100;\n\n if (!$this->ci->image_lib->initialize($config)) {\n\n @ unlink($backgrund_image);\n @ unlink($cached_image_file);\n\n if ($dynamic_output) {\n $this->_display_error(500);\n }\n\n return false;\n }\n\n if (!$this->ci->image_lib->watermark()) {\n\n @ unlink($backgrund_image);\n @ unlink($cached_image_file);\n\n if ($dynamic_output) {\n $this->_display_error(500);\n }\n\n return false;\n }\n\n @ unlink($backgrund_image);\n $this->ci->image_lib->clear();\n }\n\n // If a watermark is needed, place it.\n\n if ($has_watermark) {\n\n $prop_resized = $this->ci->image_lib->get_image_properties($cached_image_file, true);\n\n if ($prop_resized === false) {\n\n @ unlink($cached_image_file);\n\n if ($dynamic_output) {\n $this->_display_error(500);\n }\n\n return false;\n }\n\n if ($prop_resized['width'] < $wm_enabled_min_w || $prop_resized['height'] < $wm_enabled_min_h) {\n $has_watermark = false;\n }\n\n if ($has_watermark) {\n\n $config = array();\n $config['source_image'] = $cached_image_file;\n $config['dynamic_output'] = false;\n $config['new_image'] = $cached_image_file;\n $config['quality'] = 100;\n $config = array_merge($config, $wm_parameters);\n\n if (!$this->ci->image_lib->initialize($config)) {\n\n @ unlink($cached_image_file);\n\n if ($dynamic_output) {\n $this->_display_error(500);\n }\n\n return false;\n }\n\n if (!$this->ci->image_lib->watermark()) {\n\n @ unlink($cached_image_file);\n\n if ($dynamic_output) {\n $this->_display_error(500);\n }\n\n return false;\n }\n\n $this->ci->image_lib->clear();\n }\n }\n }\n\n // Output or return the result.\n\n if ($dynamic_output) {\n $this->_display_graphic_file($cached_image_file, $mime_type, $cached_image_name);\n }\n\n if ($public) {\n\n return array(\n 'path' => $cached_image_file,\n 'url' => $this->image_public_cache_url.$image_cache_subdirectory.'/'.pathinfo($cached_image_file, PATHINFO_BASENAME),\n );\n }\n\n $uri = 'thumbnail';\n\n $url = http_build_url(default_base_url($uri), array(\n 'query' => http_build_query(array(\n 'src' => $src,\n 'w' => $width,\n 'h' => $height,\n 'no_crop' => $no_crop_saved ? 0 : 1,\n 'keep_canvas_size' => $keep_canvas_size ? 0 : 1\n )\n )\n ), HTTP_URL_JOIN_QUERY);\n\n return array(\n 'path' => $cached_image_file,\n 'url' => $url,\n );\n }", "public function create_image(){\n\t\t$md5_hash = md5(rand(0,999));\n\t\t$security_code = substr($md5_hash, 15, 5);\n\t\t$this->Session->write('security_code',$security_code);\n\t\t$width = 80;\n\t\t$height = 22;\n\t\t$image = ImageCreate($width, $height);\n\t\t$black = ImageColorAllocate($image, 37, 170, 226);\n\t\t$white = ImageColorAllocate($image, 255, 255, 255);\n\t\tImageFill($image, 0, 0, $black);\n\t\tImageString($image, 5, 18, 3, $security_code, $white);\n\t\theader(\"Content-Type: image/jpeg\");\n\t\tImageJpeg($image);\n\t\tImageDestroy($image);\n\t}", "public function createImage1(){\n $this->createHexagon(150,75, 50, 200, 150, 325, 275, 325, 350,200, 275, 75);\n $this->createCircle(200, 200, 200, 200, 0, 360);\n $this->createLine(200, 125, 125, 200);\n $this->createLine(200, 125, 275, 200);\n $this->createLine(125, 200, 200, 275);\n $this->createLine(275, 200, 200, 275);\n $this->generateImage();\n }", "public static function init(int $width, int $height, string $title) {}", "protected function _createImage($width, $height, $backgroundColor = null) {\n $img = imagecreatetruecolor($width, $height);\n if(false === $img) {\n return false;\n }\n if(false === imagesavealpha($img, true)) {\n return false;\n }\n // imagealphablending($img, false);\n if(!is_numeric($backgroundColor)) {\n $backgroundColor = imagecolorallocatealpha($img, 0, 0, 0, 127);\n if(false === $backgroundColor) {\n return false;\n }\n }\n if(false === imagefill($img, 0, 0, $backgroundColor)) {\n return false;\n }\n return $img;\n }", "public function __construct($name)\n {\n $this->name = $name;\n $this->image = imagecreatetruecolor($this->width, $this->height);\n $this->createRectangle();\n }", "public function image();", "public function image();", "public static function fromNew($width, $height, $color = 'transparent') {\n\t\t$image = imagecreatetruecolor($width, $height);\n\n\t\t// Use PNG for dynamically created images because it's lossless and supports transparency\n\t\t$mimeType = 'image/png';\n\n\t\t$color = ImageColorPalette::allocateColor($image, $color);\n\t\t// Fill the image with color\n\t\timagesetthickness($image, 1);\n \timagefilledrectangle($image, 0, 0, $width, $height, $color);\n\t imagefill($image, 0, 0, $color);\n\n\t\treturn array('image'=>$image, 'mimeType'=>$mimeType,'exif'=>null);\n\t}", "public function createImage2(){\n $this->createCircle(100, 100, 50, 50, 0, 360);\n $this->createCircle(400, 100, 50, 50, 0, 360);\n $this->createCircle(110, 200, 50, 50, 0, 360);\n $this->createCircle(250, 300, 50, 50, 0, 360);\n $this->createCircle(390, 200, 50, 50, 0, 360);\n $this->createLine(125, 100, 375, 100);\n $this->createLine(100, 125, 100, 175);\n $this->createLine(400, 125, 400, 175);\n $this->createLine(125, 220, 225, 300);\n $this->createLine(275, 300, 375, 220);\n $this->generateImage();\n }", "function createImage($width=135,$height=45)\r\n\t{\r\n\t\theader(\"Content-type:image/jpeg\");\r\n\r\n\t\t// create an image \r\n\t\t$im=imagecreate($width,$height);\r\n\r\n\t\t// white background\r\n\t\t$black=imagecolorallocate($im,0,0,0);\r\n\r\n\r\n\t\t// black text and grid\r\n\t\t$white=imagecolorallocate($im,255,255,255);\r\n $other=imagecolorallocate($im,0,0,255);\r\n\t\t// get a random number to start drawing out grid from\r\n\t\t$num=rand(0,5);\r\n\r\n\t\t// draw vertical bars\r\n\t\tfor($i=$num;$i<=$width;$i+=10)\r\n\t\t\timageline($im,$i,0,$i,45,$other);\r\n\r\n\t\t// draw horizontal bars\r\n\t\tfor($i=$num;$i<=$height+10;$i+=10)\r\n\t\t\timageline($im,0,$i,135,$i,$other);\r\n\r\n\t\t// generate a random string\r\n\t\t$string=substr(strtolower(md5(uniqid(rand(),1))),0,7);\r\n\t\t\r\n\t\t$string=str_replace('2','a',$string);\r\n\t\t$string=str_replace('l','p',$string);\r\n\t\t$string=str_replace('1','h',$string);\r\n\t\t$string=str_replace('0','y',$string);\r\n\t\t$string=str_replace('o','y',$string);\r\n\r\n\t\t// place this string into the image\r\n\t\t$font = imageloadfont('anticlimax.gdf'); \r\n\r\n imagestring($im,$font,10,10,$string, $white);\r\n\t\t// create the image and send to browser\r\n\t\timagejpeg($im);\r\n\t\t// destroy the image\r\n\t\timagedestroy($im);\r\n\r\n\t\t// return the random text generated\r\n\t\treturn $this->text=$string;\r\n\t}", "public function create()\n {\n return $this->imageFactory->create();\n }", "abstract public function createImage(\n string $src,\n string $title = ''\n ): Image;", "private function _prepare_image($width, $height, $background_color = '#FFFFFF') {\r\n\r\n // create a blank image\r\n $identifier = imagecreatetruecolor((int)$width <= 0 ? 1 : (int)$width, (int)$height <= 0 ? 1 : (int)$height);\r\n\r\n // if we are creating a transparent image, and image type supports transparency\r\n if ($background_color === -1 && $this->target_type !== 'jpg') {\r\n\r\n // disable blending\r\n imagealphablending($identifier, false);\r\n\r\n // allocate a transparent color\r\n $background_color = imagecolorallocatealpha($identifier, 0, 0, 0, 127);\r\n\r\n // we also need to set this for saving GIFs\r\n imagecolortransparent($identifier, $background_color);\r\n\r\n // save full alpha channel information\r\n imagesavealpha($identifier, true);\r\n\r\n // if we are not creating a transparent image\r\n } else {\r\n\r\n // convert hex color to rgb\r\n $background_color = $this->_hex2rgb($background_color);\r\n\r\n // prepare the background color\r\n $background_color = imagecolorallocate($identifier, $background_color['r'], $background_color['g'], $background_color['b']);\r\n\r\n }\r\n\r\n // fill the image with the background color\r\n imagefill($identifier, 0, 0, $background_color);\r\n\r\n // return the image's identifier\r\n return $identifier;\r\n\r\n }", "public function runFillResize(Image $image, int $width, int $height) : Image\n\t{\n\t\t\n\t\treturn $this->runMaxResize($image, $width, $height)->resizeCanvas($width, $height, 'center');\n\t}", "function drawImage($imgHeight, $imgWidth)\n{\n\t# create blank img\n\t$image = imagecreatetruecolor($imgWidth, $imgHeight);\n\n\t# rainbow color scheme\n\t$rGray = imagecolorallocate($image, 119, 119, 119);\n\t$rPink = imagecolorallocate($image, 255, 17, 153);\n\t$rRed = imagecolorallocate($image, 255, 0, 0);\n\t$rOrange = imagecolorallocate($image, 255, 119, 0);\n\t$rYellow = imagecolorallocate($image, 255, 255, 0);\n\t$rGreen = imagecolorallocate($image, 0, 136, 0);\n\t$rBlue = imagecolorallocate($image, 0, 0, 255);\n\t$rIndigo = imagecolorallocate($image, 136, 0, 255);\n\t$rViolet = imagecolorallocate($image, 221, 0, 238);\n\t\n\t# jewel color scheme\n\t$jBrown = imagecolorallocate($image, 136, 68, 17);\n\t$jPink = imagecolorallocate($image, 221, 17, 68);\n\t$jRed = imagecolorallocate($image, 119, 0, 0);\n\t$jOrange = imagecolorallocate($image, 255, 68, 0);\n\t$jYellow = imagecolorallocate($image, 255, 187, 0);\n\t$jGreen = imagecolorallocate($image, 0, 153, 0);\n\t$jBlue = imagecolorallocate($image, 0, 0, 136);\n\t$jIndigo = imagecolorallocate($image, 68, 0, 136);\n\t$jViolet = imagecolorallocate($image, 153, 0, 153);\n\t\n\t# neon color scheme\n\t$nBlack = imagecolorallocate($image, 0, 0, 0);\n\t$nPink = imagecolorallocate($image, 255, 0, 204);\n\t$nRed = imagecolorallocate($image, 255, 0, 51);\n\t$nOrange = imagecolorallocate($image, 255, 51, 0);\n\t$nYellow = imagecolorallocate($image, 204, 255, 51);\n\t$nGreen = imagecolorallocate($image, 0, 255, 0);\n\t$nBlue = imagecolorallocate($image, 0, 85, 255);\n\t$nIndigo = imagecolorallocate($image, 129, 0, 255);\n\t$nViolet = imagecolorallocate($image, 204, 0, 255);\n\n\t# construct array of rainbow colors\n\t$rainbowColorsArray = array(\n\t\t$rGray, $rPink, $rRed, $rOrange, $rYellow, $rGreen, $rBlue, $rIndigo, $rViolet);\n\n\t# construct array of jewel colors\n\t$jewelColorsArray = array(\n\t\t$jBrown, $jPink, $jRed, $jOrange, $jYellow, $jGreen, $jBlue, $jIndigo, $jViolet);\n\n\t# construct array of neon colors\n\t$neonColorsArray = array(\n\t\t$nBlack, $nPink, $nRed, $nOrange, $nYellow, $nGreen, $nBlue, $nIndigo, $nViolet);\n\n\t# figure out which color scheme to use according to user input\n\t$imgColorChoice = $_POST['imgColorChoice'];\n\t\n\tif($imgColorChoice == 1)\n\t{\n\t\t$colorSchemeArray = $rainbowColorsArray;\n\t}\t\t\t\n\telse if($imgColorChoice == 2)\n\t{\n\t\t$colorSchemeArray = $jewelColorsArray;\n\t}\n\telse if($imgColorChoice == 3)\n\t{\n\t\t$colorSchemeArray = $neonColorsArray;\n\t}\n\t\n\t# fill in with background color\n\timagefill($image, 0, 0, $colorSchemeArray[0]);\n\n\t# DRAW GRAPHICS...\n\t# polygons(x2) in center of image\n\t# imagepolygon($image, array(coords of vertices in form x1,y1, x2,y2, etc.),\n\t# \tnumber of vertices, $color)\n\timagepolygon($image, array(\n\t\t100, 400, 600, 100, 700, 300, 150, 600, 100, 400), 4, $colorSchemeArray[1]);\n\timagepolygon($image, array(\n\t\t200, 300, 250, 450, 600, 500, 350, 300, 200, 250), 4, $colorSchemeArray[5]);\n\n\t# blue \"funnel\"\n\t# imageellipse($image, x-coord of ellipse center, y-coord of ellipse center,\n\t# \tellipse width, ellipse height, $color)\n\tfor($i = 0; $i < 100; $i++)\n\t{\n\t\timageellipse($image, ($i*5)+500, $i*10, $i, $i*5, $colorSchemeArray[6]);\n\t}\n\n\t# \"whirlwind\" at bottom\n\t# imagefilledellipse($image, x-coord of ellipse center, y-coord of ellipse center,\n\t# \tellipse width, ellipse height, $color, fill mode)\n\timagefilledellipse($image, 300, 730, 300, 100, $colorSchemeArray[8]);\n\t\n\t# imagefilledarc($image, x-coord of ellipse center, y-coord of ellipse center,\n\t# \tellipse width, ellipse height, start angle, end angle, $color, fill mode)\n\timagefilledarc($image, 300, 705, 250, 75, 90, 360, $colorSchemeArray[4], IMG_ARC_NOFILL);\n\timagefilledarc($image, 325, 705, 250, 75, 300, 45, $colorSchemeArray[2], IMG_ARC_NOFILL);\n\timagefilledarc($image, 330, 725, 225, 60, 0, 330, $colorSchemeArray[6], IMG_ARC_NOFILL);\n\timagefilledarc($image, 325, 680, 225, 55, 0, 300, $colorSchemeArray[1], IMG_ARC_NOFILL);\n\timagefilledarc($image, 320, 700, 225, 55, 50, 180, $colorSchemeArray[7], IMG_ARC_NOFILL);\n\timagefilledarc($image, 275, 730, 200, 70, 270, 180, $colorSchemeArray[5], IMG_ARC_NOFILL);\n\timagefilledarc($image, 335, 650, 175, 50, 0, 300, $colorSchemeArray[3], IMG_ARC_NOFILL);\n\timagefilledarc($image, 340, 670, 175, 55, 250, 60, $colorSchemeArray[4], IMG_ARC_NOFILL);\n\n\t# star polygon\n\t# imagepolygon($image, array(coords of vertices in form x1,y1, x2,y2, etc.),\n\t# \tnumber of vertices, $color)\n\tfor($i = 0; $i < 10; $i++)\n\t{\n\t\timagepolygon($image, array(\n\t\t\t0, 20, \n\t\t\t733-($i*3), ($i*3)+33, \n\t\t\t750-($i*3), ($i*3)+$i, \n\t\t\t766-($i*3), ($i*3)+33, \n\t\t\t800-($i*3), ($i*3)+33, \n\t\t\t775-($i*3), ($i*3)+66, \n\t\t\t800-($i*3), ($i*3)+100, \n\t\t\t755-($i*3), ($i*3)+85, \n\t\t\t780, 800, \n\t\t\t725, ($i*3)+66, \n\t\t\t0, 20), \n\t\t\t10, $colorSchemeArray[5]);\n\t}\n\n\t# interconnected loops\n\t# imagearc($image, x-coord of ellipse center, y-coord of ellipse center,\n\t# \tellipse width, ellipse height, start angle, end angle, $color)\n\tfor($i = 0; $i < 50; $i++)\n\t{\n\t\timagearc($image, 600, 700, ($i+100), ($i+100), 0, 360, $colorSchemeArray[1]);\n\t\timagearc($image, 600, 500, ($i+100), ($i+100), 0, 360, $colorSchemeArray[4]);\n\t\timagearc($image, 600, 600, ($i+100), ($i+100), 0, 360, $colorSchemeArray[5]);\n\t\timagearc($image, 700, 600, ($i+100), ($i+100), 0, 360, $colorSchemeArray[1]);\n\t\timagearc($image, 500, 600, ($i+100), ($i+100), 0, 360, $colorSchemeArray[4]);\t\n\t}\n\n\t# \"beach ball\"\t \n\t# imagefilledarc($image, x-coord of ellipse center, y-coord of ellipse center,\n\t# \tellipse width, ellipse height, start angle, end angle, $color, fill mode)\n\timagefilledarc($image, 110, 110, 200, 200, 0, 50, $colorSchemeArray[2], IMG_ARC_CHORD);\n\timagefilledarc($image, 110, 110, 200, 200, 60, 110, $colorSchemeArray[6], IMG_ARC_CHORD);\n\timagefilledarc($image, 110, 110, 200, 200, 120, 170, $colorSchemeArray[1], IMG_ARC_CHORD);\n\timagefilledarc($image, 110, 110, 200, 200, 180, 230, $colorSchemeArray[5], IMG_ARC_CHORD);\n\timagefilledarc($image, 110, 110, 200, 200, 240, 290, $colorSchemeArray[3], IMG_ARC_CHORD);\n\timagefilledarc($image, 110, 110, 200, 200, 300, 350, $colorSchemeArray[4], IMG_ARC_CHORD);\n\t\n\t# give each segment of \"beach ball\" a \"cutout\"\n\t# imagefilledarc($image, x-coord of ellipse center, y-coord of ellipse center,\n\t# \tellipse width, ellipse height, start angle, end angle, $color, fill mode)\n\timagefilledarc($image, 110, 110, 150, 150, 2, 48, $colorSchemeArray[0], IMG_ARC_CHORD);\n\timagefilledarc($image, 110, 110, 150, 150, 62, 108, $colorSchemeArray[0], IMG_ARC_CHORD);\n\timagefilledarc($image, 110, 110, 150, 150, 122, 168, $colorSchemeArray[0], IMG_ARC_CHORD);\n\timagefilledarc($image, 110, 110, 150, 150, 182, 228, $colorSchemeArray[0], IMG_ARC_CHORD);\n\timagefilledarc($image, 110, 110, 150, 150, 242, 288, $colorSchemeArray[0], IMG_ARC_CHORD);\n\timagefilledarc($image, 110, 110, 150, 150, 302, 348, $colorSchemeArray[0], IMG_ARC_CHORD);\n\n\t# lines fanning out\n\t# imageline($image, x1, y1, x2, y2, $color). \n\t# draws line from coords (x1,y1) to (x2,y2).\n\tfor($i = 0; $i < 70; $i++)\n\t{\n\t\timageline($image, 0, 800, $i*5, $i+500, $colorSchemeArray[7]);\n\t\timageline($image, 300, 500, $i*5, $i+500, $colorSchemeArray[3]);\n\t}\n\n\t# thick crossing lines\n\timagesetthickness($image, 25);\n\n\t# imageline($image, x1, y1, x2, y2, $color). \n\t# draws line from coords (x1,y1) to (x2,y2).\n\timageline($image, 350, 0, 0, 450, $colorSchemeArray[8]);\n\timageline($image, 360, 0, 0, 460, $colorSchemeArray[5]);\n\timageline($image, 380, 0, 0, 480, $colorSchemeArray[2]);\n\n\timageline($image, 0, 400, 450, 0, $colorSchemeArray[1]);\n\timageline($image, 0, 410, 460, 0, $colorSchemeArray[4]);\n\timageline($image, 0, 430, 480, 0, $colorSchemeArray[7]);\n\n\t# save img out to temp directory\n\timagepng($image, \"../temp/tempPNG.png\");\n\n\t# output img according to user-supplied dimensions\n\techo \"\t<img src='../temp/tempPNG.png' alt='artistic expression image' \".\n\t\"height='$imgHeight' width='$imgWidth' />\\n\";\n\n\t# clear buffer of image\n\timagedestroy($image);\n}", "public function createImage()\n {\n $name = basename($this->absoluteUrl);\n if ($this->fileExists($this->absoluteUrl) && !in_array($name, $this->notAllowedNames)) {\n $mime = @exif_imagetype($this->absoluteUrl);\n if ($mime == IMAGETYPE_JPEG || $mime == IMAGETYPE_PNG || $mime == IMAGETYPE_GIF) {\n if (!file_exists($this->imageDirectory)) {\n mkdir($this->imageDirectory, 0700);\n }\n\n copy($this->absoluteUrl, $this->imageDirectory . DIRECTORY_SEPARATOR . $name);\n }\n }\n }", "function add_image_size($name, $width = 0, $height = 0, $crop = \\false)\n {\n }", "public function makeImage()\n {\n $x_width = 200;\n $y_width = 125;\n\n $this->image = imagecreatetruecolor(200, 125);\n\n $this->white = imagecolorallocate($this->image, 255, 255, 255);\n $this->black = imagecolorallocate($this->image, 0, 0, 0);\n $this->red = imagecolorallocate($this->image, 255, 0, 0);\n $this->green = imagecolorallocate($this->image, 0, 255, 0);\n $this->grey = imagecolorallocate($this->image, 128, 128, 128);\n\n $this->red = imagecolorallocate($this->image, 231, 0, 0);\n\n $this->yellow = imagecolorallocate($this->image, 255, 239, 0);\n $this->green = imagecolorallocate($this->image, 0, 129, 31);\n\n $this->color_palette = [$this->red, $this->yellow, $this->green];\n\n imagefilledrectangle($this->image, 0, 0, 200, 125, $this->white);\n\n $border = 25;\n\n $lines = [\"e\", \"g\", \"b\", \"d\", \"f\"];\n $i = 0;\n foreach ($lines as $key => $line) {\n $x1 = 0;\n $x2 = $x_width;\n $y1 = $i * 15 + 25;\n $y2 = $y1;\n imageline(\n $this->image,\n $x1 + $border,\n $y1,\n $x2 - $border,\n $y2,\n $this->black\n );\n $i = $i + 1;\n }\n\n imageline(\n $this->image,\n 0 + $border,\n 25,\n 0 + $border,\n 4 * 15 + 25,\n $this->black\n );\n imageline(\n $this->image,\n 200 - $border,\n 25,\n 200 - $border,\n 4 * 15 + 25,\n $this->black\n );\n\n $textcolor = $this->black;\n\n $font = $this->default_font;\n\n $size = 10;\n $angle = 0;\n\n if (!isset($this->bar_count) or $this->bar_count == \"X\") {\n $this->bar_count = 0;\n }\n $count_notation = $this->bar_count + 1;\n\n if (file_exists($font)) {\n if (\n $count_notation != 1 or\n $count_notation == $this->max_bar_count\n ) {\n imagettftext(\n $this->image,\n $size,\n $angle,\n 0 + 10,\n 110,\n $this->black,\n $font,\n $count_notation\n );\n }\n\n if (\n $count_notation + 1 != 1 or\n $count_notation + 1 == $this->max_bar_count + 1\n ) {\n imagettftext(\n $this->image,\n $size,\n $angle,\n 200 - 25,\n 110,\n $this->black,\n $font,\n $count_notation + 1\n );\n }\n }\n }", "function create_image($url,$width,$height) {\n\t\t$base = wp_upload_dir();\n\t\t$file_path = str_replace($base['baseurl'],$base['basedir'],$url);\n\t\t\n\t\t$image = wp_get_image_editor($file_path);\n\t\t\n\t\tif(!is_wp_error($image)) {\n\t\t\t$image->resize($width,$height,true);\n\t\t\t$image->save($this->get_image($file_path,$width,$height,false));\n\t\t}\n\t}", "public function getDefaultImage();", "public static function createEmpty(): self\n {\n return new self(null);\n }", "protected function setUp() {\n $this->imageHelper = binaraImageHelper::instance();\n $this->image = imagecreate(100, 100);\n $this->black = imagecolorallocate($this->image, 0, 0, 0);\n }", "private function makeImageSize(): void\n {\n list($width, $height) = getimagesize($this->getUrl());\n $size = array('height' => $height, 'width' => $width );\n\n $this->width = $size['width'];\n $this->height = $size['height'];\n }", "public function createImage3(){\n $this->triangleCreate(240, 100, 290, 50, 340, 100);\n $this->triangleCreate(40, 300, 90, 250, 140, 300);\n $this->triangleCreate(440, 300, 490, 250, 540, 300);\n $this->createLine(265, 100, 105, 265);\n $this->createLine(315, 100, 475, 265);\n $this->createLine(125, 285, 455, 285);\n $this->generateImage();\n }", "public function run()\n {\n $image = new Image([\n \"path\" => \"placeholder_light.png\",\n \"alt\" => \"A placeholder image in light colors.\",\n \"description\" => \"The placeholder image with some light color.\",\n ]);\n $image->save();\n \n $image = new Image([\n \"path\" => \"placeholder_small_light.png\",\n \"alt\" => \"A small placeholder image in light colors.\",\n \"description\" => \"The small placeholder image with some light color.\",\n ]);\n $image->save();\n \n $image = new Image([\n \"path\" => \"placeholder_square_light.jpg\",\n \"alt\" => \"A square placeholder image in light colors.\",\n \"description\" => \"The square placeholder image with some light color.\",\n ]);\n $image->save();\n \n $image = new Image([\n \"path\" => \"placeholder_wide_dark.png\",\n \"alt\" => \"A wide placeholder image in dark colors.\",\n \"description\" => \"The wide placeholder image with some dark color.\",\n ]);\n $image->save();\n \n $image = new Image([\n \"path\" => \"placeholder_wide_light.png\",\n \"alt\" => \"A wide placeholder image in light colors.\",\n \"description\" => \"The wide placeholder image with some light color.\",\n ]);\n $image->save();\n }", "public function full()\n {\n if (null !== $this->_image) {\n return $this->_createImgTag($this->_image->full);\n }\n }", "public function __construct($width = null, $height = null)\n {\n $this->width = is_numeric($width) ? (int) $width : $this->width;\n $this->height = is_numeric($height) ? (int) $height : $this->height;\n }", "private function createModel()\n\t{\n\t\treturn new Image();\t\t\n\t}", "public function generate(Image $image);", "public function create()\n {\n return view('image.create');\n }", "public function wrapper($width, $height)\r\n {\r\n $wrapper = imagecreatetruecolor($width, $height);\r\n imagesavealpha($wrapper, true);\r\n $background = imagecolorallocatealpha($wrapper, 255, 255, 255, 127);\r\n imagefill($wrapper, 0, 0, $background);\r\n\r\n return $wrapper;\r\n }", "private function createImageKeepTransparency($width, $height) {\n $img = imagecreatetruecolor($width, $height);\n imagealphablending($img, false);\n imagesavealpha($img, true); \n return $img;\n }", "public function drawDimensions() {\n\t\tset_image_header();\n\n\t\t$this->selectTriggers();\n\t\t$this->calcDimentions();\n\n\t\tif (function_exists('imagecolorexactalpha') && function_exists('imagecreatetruecolor')\n\t\t\t\t&& @imagecreatetruecolor(1, 1)\n\t\t) {\n\t\t\t$this->im = imagecreatetruecolor(1, 1);\n\t\t}\n\t\telse {\n\t\t\t$this->im = imagecreate(1, 1);\n\t\t}\n\n\t\t$this->initColors();\n\n\t\timageOut($this->im);\n\t}", "public function __construct($file)\n {\n try\n {\n // Get the real path to the file\n $file = realpath($file);\n\n // Get the image information\n $info = getimagesize($file);\n }\n catch (Exception $e)\n {\n // Ignore all errors while reading the image\n }\n\n if (empty($file) OR empty($info))\n {\n // throw new Exception('Not an image or invalid image: :file',\n // array(':file' => Kohana::debug_path($file)));\n return '';\n }\n\n // Store the image information\n $this->file = $file;\n $this->width = $info[0];\n $this->height = $info[1];\n $this->type = $info[2];\n $this->mime = image_type_to_mime_type($this->type);\n\n // Set the image creation function name\n switch ($this->type)\n {\n case IMAGETYPE_JPEG:\n $create = 'imagecreatefromjpeg';\n break;\n case IMAGETYPE_GIF:\n $create = 'imagecreatefromgif';\n break;\n case IMAGETYPE_PNG:\n $create = 'imagecreatefrompng';\n break;\n }\n\n if ( ! isset($create) OR ! function_exists($create))\n {\n // throw new Exception('Installed GD does not support :type images',\n // array(':type' => image_type_to_extension($this->type, FALSE)));\n }\n\n // Save function for future use\n $this->_create_function = $create;\n\n // Save filename for lazy loading\n $this->_image = $this->file;\n }", "static function create($width, $height, $bgColor = null) {\n\t\treturn self::_getLoader()->create($width, $height, $bgColor);\n\t}", "function imageresize($im, $width, $height) {\n list($w, $h) = [imagesx($im), imagesy($im)];\n $res = newTransparentImage($w + $width, $h + $height);\n imagecopy($res, $im, 0, 0, 0, 0, $w, $h);\n imagedestroy($im);\n return $res;\n}", "public function __construct()\n\t{\n\t\t$this->digit=4;\n\t\t$this->picHeight=22;\n\t\t$this->picWidth=$this->digit*15;\n\t\t$this->border=1;//1 have border 0 no boder\n\t\t$this->fontSize=30;\n\t\t$this->alpha='';//\"abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWSYZ\";\n\t\t$this->number=\"0123456789\";\n\t\tsrand((double)microtime()*1000000);//Initialize random number\n\t\t//header(\"Content-type:image/png\");\n\t}", "abstract public function __construct(string $name, int $width, int $height, array $images);", "protected function createEmpty(Game $game, $row, $col)\n {\n }", "public function make_image(){\n // configure with favored image driver (gd by default)\n Image::configure(array('driver' => 'gd'));\n\n // and you are ready to go ...\n\n $image = Image::make('http://localhost/laravel_1/public/tears.jpg');\n $image->resize(100, null, function ($constraint) {\n $constraint->aspectRatio();\n });\n $image->save('tears_1.jpg');\n\n return 'done';\n }", "function _createThumbnail()\r\n\t{\r\n\t\t$user=$this->auth(PNH_EMPLOYEE);\r\n\t\t$config['image_library']= 'gd';\r\n\t\t$config['source_image']= './resources/employee_assets/image/';\r\n\t\t$config['create_thumb']= TRUE;\r\n\t\t$config['maintain_ratio']= TRUE;\r\n\t\t$config['width']= 75;\r\n\t\t$config['height']=75;\r\n\r\n\t\t$this->image_lib->initialize($config);\r\n\r\n\t\t$this->image_lib->resize();\r\n\r\n\t\tif(!$this->image_lib->resize())\r\n\t\t\techo $this->image_lib->display_errors();\r\n\t}", "public function fill($width = null, $height = null, $gravity = null)\n {\n return $this->resize(Fill::fill($width, $height, $gravity));\n }", "public function runFillMaxResize(Image $image, $width, $height) : Image\n {\n\t\treturn $this->runContainResize($image, $width, $height)->resizeCanvas($width, $height, 'center');\n }", "function someImageUrl($width, $height, $options = []);", "function resize_square($size){\n\n //container for new image\n $new_image = imagecreatetruecolor($size, $size);\n\n\n if($this->width > $this->height){\n $this->resize_by_height($size);\n\n imagecolortransparent($new_image, imagecolorallocate($new_image, 0, 0, 0));\n imagealphablending($new_image, false);\n imagesavealpha($new_image, true);\n imagecopy($new_image, $this->image, 0, 0, ($this->get_width() - $size) / 2, 0, $size, $size);\n }else{\n $this->resize_by_width($size);\n\n imagecolortransparent($new_image, imagecolorallocate($new_image, 0, 0, 0));\n imagealphablending($new_image, false);\n imagesavealpha($new_image, true);\n imagecopy($new_image, $this->image, 0, 0, 0, ($this->get_height() - $size) / 2, $size, $size);\n }\n\n $this->image = $new_image;\n\n //reset sizes\n $this->width = $size;\n $this->height = $size;\n\n return true;\n }", "function build_thumbnail($img, $tumb_width, $tumb_height)\n{\n\t$width = imageSX($img);\n\t$height = imageSY($img);\n\n//\t\t\techo sprintf(\" KALL %s %d\",__FILE__,__LINE__);\n\t$target_width = $tumb_width;\n\t$target_height = $tumb_height;\n\t\n\t$target_ratio = $target_width / $target_height;\n\t$img_ratio = $width / $height;\n//\t\t\techo sprintf(\" KALL %s %d\",__FILE__,__LINE__);\n\t\n\t$offx=0;\n\t$offy=0;\n\t$new_width=$width;\n\t$new_height=$height;\n\t\n//\t\t\techo sprintf(\" KALL %s %d\",__FILE__,__LINE__);\n\tif($img_ratio > $target_ratio) {\n\t\t$diff_ratio = $target_ratio / $img_ratio;\n\t\t$new_width = $width * $diff_ratio;\n\t\t$offx = ($width - $new_width) / 2;\n\t}\n//\t\t\techo sprintf(\" KALL %s %d\",__FILE__,__LINE__);\n\tif($img_ratio < $target_ratio){\n\t\t$diff_ratio = $img_ratio / $target_ratio;\n\t\t$new_height = $height * $diff_ratio;\n\t\t$offy = ($height - $new_height) / 2;\n\t}\n//\t\t\techo sprintf(\" KALL %s %d\",__FILE__,__LINE__);\n\n\t$new_img = ImageCreateTrueColor($tumb_width, $tumb_height);\n\n\t// Fill the image black\n//\t\t\techo sprintf(\" KALL %s %d\",__FILE__,__LINE__);\n\tif (!@imagefilledrectangle($new_img, 0, 0, $target_width-1, $target_height-1, 0)) {\n\t\techo \"ERROR\\nCould not fill new image\";\n//\t\texit(0);\n\t}\n//\t\t\techo sprintf(\" KALL %s %d\",__FILE__,__LINE__);\n\n\tif (!@imagecopyresampled($new_img, $img, 0, 0, $offx, $offy, $target_width, $target_height, $new_width, $new_height)) {\n\t\techo \"ERROR\\nCould not resize image\";\n//\t\texit(0);\n\t}\n\n\treturn $new_img;\n}", "private function createImage($i)\n\t{\n\t\t$mime = $this->mimeType($i);\n \n\t\tif($mime[2] == 'jpg')\n\t\t{\n\t\t\treturn imagecreatefromjpeg ($i);\n\t\t}else if ($mime[2] == 'png') \n\t\t{\n\t\t\treturn imagecreatefrompng ($i);\n\t\t} \n\t\telse \n\t\t{\n\t\t\treturn false; \n\t\t} \n\t}", "public function __construct($height, $width){\n $this->height = $height;\n $this->width = $width; \n}", "function GDImage($im, $x=null, $y=null, $w=0, $h=0, $link=''){\n\t\t\tob_start();\n\t\t\timagepng($im);\n\t\t\t$data = ob_get_clean();\n\t\t\t$this->MemImage($data, $x, $y, $w, $h, $link);\n\t\t}", "public function sizeImg($width, $height, $crop = true);", "function drawPNG($w, $h, $thumb_w = 0, $thumb_h = 0)\n {\n if ($w < 1) {\n $w = 1;\n }\n if ($h < 1) {\n $h = 1;\n }\n\n $im = $this->drawIm($w, $h);\n $im = $this->convertToThumbnail($im, $thumb_w, $thumb_h);\n\n //- Output PNG data\n\n header('Content-type: image/png');\n imagepng($im);\n\n imagedestroy($im);\n }", "private function createImageKeepTransparency($width, $height) {\n $img = imagecreatetruecolor($width, $height);\n imagealphablending($img, false);\n imagesavealpha($img, true);\n return $img;\n }", "public function create()\n {\n //\n return view('image.create');\n\n }", "protected function make_image($filename, $callback, $arguments)\n {\n }", "protected function make_image($filename, $callback, $arguments)\n {\n }", "function miniatura($image, $w, $h) {\r\n $tam = getimagesize($image);\r\n $x = (($tam[0] / 2) - ($w / 2));\r\n $y = (($tam[1] / 2) - ($h / 2));\r\n $img = imagecreatefromjpeg($image);\r\n\r\n if(($w <= $tam[0]) && ($h <= $tam[1])) {\r\n $mini = imagecreate($w, $h);\r\n imagecopyresized($mini, $img, 0, 0, $x, $y, $w, $h, $w, $h);\r\n return imagejpeg($mini);\r\n imagedestroy($mini);\r\n }else {\r\n return imagejpeg($img);\r\n }\r\n imagedestroy($img);\r\n }", "function Create($sFilename = '') {\n if (!function_exists('imagecreate') || !function_exists(\"image$this->sFileType\") || ($this->vBackgroundImages != '' && !function_exists('imagecreatetruecolor'))) {\n return false;\n }\n \n // get background image if specified and copy to CAPTCHA\n if (is_array($this->vBackgroundImages) || $this->vBackgroundImages != '') {\n // create new image\n $this->oImage = imagecreatetruecolor($this->iWidth, $this->iHeight);\n \n // create background image\n if (is_array($this->vBackgroundImages)) {\n $iRandImage = array_rand($this->vBackgroundImages);\n $oBackgroundImage = imagecreatefromjpeg($this->vBackgroundImages[$iRandImage]);\n } else {\n $oBackgroundImage = imagecreatefromjpeg($this->vBackgroundImages);\n }\n \n // copy background image\n imagecopy($this->oImage, $oBackgroundImage, 0, 0, 0, 0, $this->iWidth, $this->iHeight);\n \n // free memory used to create background image\n imagedestroy($oBackgroundImage);\n } else {\n // create new image\n $this->oImage = imagecreate($this->iWidth, $this->iHeight);\n }\n \n // allocate white background colour\n imagecolorallocate($this->oImage, 0, 0, 0);\n \n // check for owner text\n if ($this->sOwnerText != '') {\n $this->DrawOwnerText();\n }\n \n // check for background image before drawing lines\n if (!is_array($this->vBackgroundImages) && $this->vBackgroundImages == '') {\n $this->DrawLines();\n }\n \n $this->GenerateCode();\n $this->DrawCharacters();\n \n // write out image to file or browser\n $this->WriteFile($sFilename);\n \n // free memory used in creating image\n imagedestroy($this->oImage);\n \n return true;\n }", "public static function create($width, $height, $image = null)\n {\n return new Adapter\\Gd($width, $height, $image);\n }", "abstract public function createImage($instance_id, ImageSchema $image_schema);", "public function testDimensionsInsetFillWhite()\n {\n $dimensions = Dimensions::create(\n 400,\n 400,\n 300,\n 150,\n ElcodiMediaImageResizeTypes::INSET_FILL_WHITE\n );\n\n $this->assertEquals(0, $dimensions->getSrcX());\n $this->assertEquals(0, $dimensions->getSrcY());\n $this->assertEquals(400, $dimensions->getSrcWidth());\n $this->assertEquals(400, $dimensions->getSrcHeight());\n\n $this->assertEquals(75, $dimensions->getDstX());\n $this->assertEquals(0, $dimensions->getDstY());\n $this->assertEquals(150, $dimensions->getDstWidth());\n $this->assertEquals(150, $dimensions->getDstHeight());\n $this->assertEquals(300, $dimensions->getDstFrameX());\n $this->assertEquals(150, $dimensions->getDstFrameY());\n }", "function create_image($source,$sizes){\n // Tony Smith uploaded a big image once (7000x3000pixels) that was 1.1MB as a JPEG compressed,\n // but when inflated out using imagecreatefromjpeg used more memory than there was available!\n // So lets make this nice and large to handle Tony's massive bits\n ini_set('memory_limit', '256M');\n\n // Save parts of source image path\n $path_parts = pathinfo($source);\n\n // Load image and get image size.\n $img = imagecreatefromjpeg($source);\n $width = imagesx($img);\n $height = imagesy($img);\n\n foreach($sizes as $s){\n\n // Create new filename\n $new_name = $path_parts['dirname'].\"/\".$path_parts['filename'].\"_\".$s['suffix'].\".\".$path_parts['extension'];\n\n // Scale to fit the required width\n if ($width > $height) {\n $newwidth = $s['dim'];\n $divisor = $width / $s['dim'];\n $newheight = floor($height/$divisor);\n }else{\n $newheight = $s['dim'];\n $divisor = $height / $s['dim'];\n $newwidth = floor($width/$divisor);\n }\n\n // Create a new temporary image.\n $tmpimg = imagecreatetruecolor($newwidth,$newheight);\n \n // Copy and resize old image into new image.\n imagecopyresampled($tmpimg,$img,0,0,0,0,$newwidth,$newheight,$width,$height);\n\n // Save thumbnail into a file.\n imagejpeg($tmpimg,$new_name,$s['q']);\n\n // release the memory\n imagedestroy($tmpimg);\n\n }\n imagedestroy($img);\n}", "public function createThumbnail($path, $width, $height)\n {\n $img = Image::make($path)->resize($width, $height, function ($constraint) {\n $constraint->aspectRatio();\n });\n $img->save($path);\n }", "function createThumbnail($image)\n {\n $width = $height = 200;\n ini_set('memory_limit', '1024M');\n set_time_limit(120);\n $image_src = imagecreatefromjpeg(CONFIG_DIR.'/content/images/uncropped/'.$image['src'])\n or $this->reportError('cms/model/edit_input createThumbnail. Problem with imagecreatefromjpeg');\n $image_dst = imagecreatetruecolor($width, $height)\n or $this->reportError('cms/model/edit_input createThumbnail. Problem with imagecreatetruecolor');\n imagecopyresampled ($image_dst, $image_src, 0, 0, $image['sx1'], $image['sy1'], $width, $height,($image['sx2'] - $image['sx1']), ($image['sy2'] - $image['sy1']))\n or $this->reportError('cms/model/edit_input createThumbnail. Problem with imagecopyresampled');\n imagejpeg($image_dst, CONFIG_DIR.'/content/images/thumbnail/'.$image['src'] , 90)\n or $this->reportError('cms/model/edit_input createThumbnail. Problem with imagejpeg');\n imagedestroy($image_dst);\n }", "function resize( $width, $height ) {\n $new_image = imagecreatetruecolor( $width, $height );\n if ( $this->mimetype == 'image/gif' || $this->mimetype == 'image/png' ) {\n $current_transparent = imagecolortransparent( $this->image );\n if ( $current_transparent != -1 ) {\n $transparent_color = imagecolorsforindex( $this->image, $current_transparent );\n $current_transparent = imagecolorallocate( $new_image, $transparent_color['red'], $transparent_color['green'], $transparent_color['blue'] );\n imagefill( $new_image, 0, 0, $current_transparent );\n imagecolortransparent( $new_image, $current_transparent );\n } elseif ( $this->mimetype == 'image/png' ) {\n imagealphablending( $new_image, false );\n $color = imagecolorallocatealpha( $new_image, 0, 0, 0, 127 );\n imagefill( $new_image, 0, 0, $color );\n imagesavealpha( $new_image, true );\n }\n }\n imagecopyresampled( $new_image, $this->image, 0, 0, 0, 0, $width, $height, $this->width, $this->height );\n $this->image = $new_image;\n return $this;\n }", "public static function createImage( $site, $filename, $contentType, $width, $height )\n {\n $daImage = BeMaverick_Da_Image::getInstance();\n \n $imageId = $daImage->createImage( $filename, $contentType, $width, $height );\n\n return self::getInstance( $site, $imageId );\n }", "protected function makeTmpImage($image, $width, $height) {\n $geometry = $width . 'x' . $height;\n $tmp = sys_get_temp_dir() . '/argus_' . getmypid() . '_' . basename($image);\n $this->process->setCommandLine(implode(' ', [\n 'convert',\n '-composite',\n '-size ' . $geometry,\n '-gravity northwest',\n '-crop ' . $geometry . '+0+0',\n 'canvas:none',\n escapeshellarg($image),\n escapeshellarg($tmp)\n ]));\n $this->process->mustRun();\n return $tmp;\n }", "private function outputEmptyImageCode() {\n\t\techo 'empty image';\n\t\texit();\n\t}", "function createEmpty()\n\t{\n\t\t$data = array();\n\t\t$data['MexcGallery']['publishing_status'] = 'draft';\n\t\t\n\t\t$this->create();\n\t\treturn $this->save($data, false);\n\t}", "function load($filename)\n {\n $image_info = getimagesize($filename);\n $this->image_type = $image_info[2];\n //crea la imagen JPEG.\n if( $this->image_type == IMAGETYPE_JPEG ) \n {\n $this->image = imagecreatefromjpeg($filename);\n } \n //crea la imagen GIF.\n elseif( $this->image_type == IMAGETYPE_GIF ) \n {\n $this->image = imagecreatefromgif($filename);\n } \n //Crea la imagen PNG\n elseif( $this->image_type == IMAGETYPE_PNG ) \n {\n $this->image = imagecreatefrompng($filename);\n }\n }", "public function createImage()\n\t{\n\t\t$now = Carbon::now()->timestamp;\n\n\t\t$image = new Ot_Images();\n\t\t$image->spherical_id = $now;\n\t\t$image->title = Input::get('title');\n\t\t$pathUpload = 'uploads/images';\n\t\tif (Input::hasFile('image_url')) {\n\t\t\t$img = Input::file('image_url');\n\t\t\t$name = $now . '-' . $img->getClientOriginalName();\n\t\t\tImage::make($img->getRealPath())->resize(180, 90)->save($pathUpload . '/thumb/' . $name);\n\t\t\t$img->move($pathUpload, $name);\n\n\t\t\t$image->image_url = $name;\n\t\t}\n\t\t$image->description = Input::get('description');\n\t\tif (Input::get('is_public') == true) {\n\t\t\t$image->is_public = 1;\n\t\t} else {\n\t\t\t$image->is_public = 0;\n\t\t}\n\t\t$image->created_by = Auth::user()->name;\n\t\t$image->updated_by = Auth::user()->name;\n\t\t$image->view_url = \"/image/\" . $now;\n\t\t$image->save();\n\n\t\treturn Redirect::to('admincp/image/new');\n\t}", "function drawImage($filename){\n $img=imagecreatetruecolor(400,300);\n drawFromUserdata($img); //draw on $img\n imagepng($img, $filename); //output the $img to the given $filename as PNG\n imagedestroy($img); //destroy the $img\n }", "public function createIndex($width = null, $height = null, $name = null)\n {\n if ((null !== $width) && (null !== $height)) {\n $this->width = $width;\n $this->height = $height;\n }\n\n if (null !== $name) {\n $this->name = $name;\n }\n\n if (null === $this->resource) {\n $this->resource = new \\Imagick();\n }\n\n $this->resource->newImage($this->width, $this->height, new \\ImagickPixel('white'));\n\n if (null !== $this->name) {\n $extension = strtolower(substr($this->name, (strrpos($this->name, '.') + 1)));\n if (!empty($extension)) {\n $this->resource->setImageFormat($extension);\n $this->format = $extension;\n }\n }\n\n $this->resource->setImageType(\\Imagick::IMGTYPE_PALETTE);\n $this->indexed = true;\n\n return $this;\n }", "public function setDimensions($width, $height) {}" ]
[ "0.7229427", "0.6914227", "0.68399566", "0.6764752", "0.6508632", "0.63181525", "0.62752", "0.61417097", "0.6137881", "0.61121744", "0.5987968", "0.5931884", "0.5836678", "0.58366257", "0.582283", "0.5764109", "0.5719337", "0.5707742", "0.5653852", "0.56410766", "0.5611552", "0.5600863", "0.5574801", "0.5569362", "0.5548167", "0.55406594", "0.54983306", "0.54859954", "0.5440024", "0.54225785", "0.5417343", "0.5384283", "0.5371474", "0.5371474", "0.53712314", "0.53684944", "0.5364482", "0.5336164", "0.53341275", "0.53249925", "0.5308467", "0.5296842", "0.526281", "0.525942", "0.5251612", "0.5246285", "0.5225013", "0.52057815", "0.51709265", "0.51650447", "0.5157488", "0.5133492", "0.512154", "0.51145166", "0.507746", "0.5076165", "0.5067362", "0.50658107", "0.50648844", "0.5064085", "0.5062204", "0.50542367", "0.50283337", "0.5024884", "0.5018456", "0.5016859", "0.50137985", "0.5013399", "0.50071657", "0.5006048", "0.49926803", "0.4991674", "0.49744317", "0.49652943", "0.49554563", "0.49516195", "0.49462926", "0.49382618", "0.49298528", "0.49281716", "0.49277183", "0.4926994", "0.49085245", "0.49080852", "0.4890577", "0.48753187", "0.48705798", "0.4866181", "0.48497877", "0.4844464", "0.4833035", "0.48323837", "0.48131278", "0.48112625", "0.4803389", "0.47879782", "0.47850525", "0.4785033", "0.47844687", "0.47784346" ]
0.6868188
2
Create a custom Monolog instance.
public function __invoke(array $config) { $logger = new Logger('slack_deduplicated'); $slackHandler = new SlackWebhookHandler( $config['url'], $config['channel'] ?? null, $config['username'] ?? 'Laravel', $config['attachment'] ?? true, $config['emoji'] ?? ':boom:', $config['short'] ?? false, $config['context'] ?? true, Logger::DEBUG, $config['bubble'] ?? true, $config['exclude_fields'] ?? [] ); $logger->pushHandler(new DeduplicationHandler( $slackHandler, storage_path('logs/duplicates.log'), Logger::DEBUG, $config['time'] ?? 3600, true )); return $logger; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function __construct()\n {\n $this->log = new Monolog('');\n $this->log->pushProcessor(new PsrLogMessageProcessor);\n\n $config = array_merge([\n 'type' => 'daily',\n 'level' => 'debug',\n 'max_files' => 5,\n 'app_file' => 'app.log',\n 'cli_file' => 'cli.log',\n 'permission' => 0664,\n ], config('logger', []));\n\n $file = storage_path('logs/' . $config[is_console() ? 'cli_file' : 'app_file']);\n $levels = $this->log->getLevels();\n $level = $levels[strtoupper($config['level'])];\n $format = \"[%datetime%] %level_name%: %message% %context%\\n\";\n\n switch ($config['type']) {\n case 'single':\n $this->log->pushHandler(\n $handler = new StreamHandler($file, $level, true, $config['permission'], false)\n );\n\n $handler->setFormatter(new LineFormatter($format, null, true, true));\n break;\n case 'daily':\n $this->log->pushHandler(\n $handler = new RotatingFileHandler($file, $config['max_files'], $level, true, $config['permission'], false)\n );\n $handler->setFormatter(new LineFormatter($format, null, true, true));\n break;\n case 'syslog':\n $this->log->pushHandler(\n new SyslogHandler(config('app.name', 'Pletfix'), LOG_USER, $level)\n );\n break;\n case 'errorlog':\n $this->log->pushHandler(\n $handler = new ErrorLogHandler(ErrorLogHandler::OPERATING_SYSTEM, $level)\n );\n $handler->setFormatter(new LineFormatter($format, null, true, true));\n break;\n default:\n throw new RuntimeException('Invalid log type in configuration \"app.log\".');\n }\n }", "function __construct()\n {\n $this->mylog = new mylog;\n }", "public function __invoke(array $config)\n {\n return new Logger(...);\n }", "public function __invoke(array $config)\n {\n return new Logger('log', [new TelegramHandler($config['token'], $config['channel'])]);\n }", "public function __invoke(array $config)\n {\n $logger = new Logger('log-rhythm');\n $logger->pushHandler(new LogRhythmHandler());\n $logger->pushProcessor(new LogRhythmProcessor());\n return $logger;\n }", "public function __invoke(array $config)\n {\n return new Logger($config['log_name']);\n }", "function createLogger($class);", "public function __invoke(array $config)\n {\n return new Logger(\n env('APP_NAME'),\n [\n new MeticulousLoggerHandler(),\n ]\n );\n }", "public static function newInstance() {\n $class = self::class;\n $void_log = new $class();\n return $void_log;\n }", "public function __invoke(array $config)\n {\n $logger = new Logger(env('APP_NAME'));\n\n // Client ip processor.\n $logger->pushProcessor(new ClientIpProcessor());\n\n // Base URL processor.\n $logger->pushProcessor(new BaseUrlProcessor());\n\n // Lowercase level name processor.\n $logger->pushProcessor(new LowerCaseLevelNameProcessor());\n\n // Timestamp processor.\n $logger->pushProcessor(new TimestampProcessor());\n\n // UID processor.\n $logger->pushProcessor(new UidProcessor());\n\n // Syslog handler.\n $handler = new SyslogHandler(\n 'openingsuren',\n defined('LOG_LOCAL4') ? LOG_LOCAL4 : 160,\n 'debug',\n true,\n LOG_ODELAY\n );\n\n // Format parseable for kibana.\n $formatter = new LineFormatter(\n '%extra.base_url%'\n . '|%timestamp%'\n . '|laravel'\n . '|%level_name%'\n . '|%extra.client_ip%'\n . '|%extra.base_url%%extra.url%'\n . '|%extra.referrer%'\n . '|%extra.uid%'\n . '||%message%'\n );\n $handler->setFormatter($formatter);\n\n // Set the handler.\n $logger->setHandlers([$handler]);\n\n return $logger;\n }", "public function __construct(){\n Logger::configure('../../loggingconfiguration.xml');\n // Fetch a logger, it will inherit settings from the root logger\n $this->log = Logger::getLogger(__CLASS__);\n }", "protected function getLoggerService()\n {\n $this->services['logger'] = $instance = new \\Symfony\\Bridge\\Monolog\\Logger('app');\n\n $instance->useMicrosecondTimestamps(true);\n $instance->pushHandler($this->get('monolog.handler.console'));\n $instance->pushHandler($this->get('monolog.handler.main'));\n\n return $instance;\n }", "public function createImportLog()\n {\n $class = $this->getClass();\n $ImportLog = new $class;\n\n return $ImportLog;\n }", "final public function __construct() {\n $this->_logger = new public_logger();\n }", "public function __construct()\n {\n $log_enhancer_channel_name = config('logging.bkstar123_log_enhancer.channel_name');\n $this->customLogger = Log::channel($log_enhancer_channel_name);\n }", "private function logger()\n {\n $msgLog = new Logger('RequestResponseLogs');\n $msgLog->pushHandler(new StreamHandler(storage_path('logs/amadeus.log'), Logger::INFO));\n return $msgLog;\n }", "public function __invoke(array $config) {\n $seaslog = new Seaslog();\n return new Logger($seaslog, $config);\n }", "public function create($type = 'default')\r\n {\r\n switch ($this->loggerAlias) {\r\n case self::LOGGER_ALIAS_FILE:\r\n $this->logger = $this->fileFactory->create(\r\n [\r\n 'logFileName' => $type,\r\n 'logAll' => $this->logAll,\r\n 'logCallStack' => $this->logCallStack,\r\n ]\r\n );\r\n break;\r\n default:\r\n $this->logger = $this->fileFactory->create();\r\n break;\r\n }\r\n\r\n return $this->logger;\r\n }", "protected function newLog($action = ''): Logging\\LogInterface{\n return new Logging\\DefaultLog($action);\n }", "public function __construct(){\n $logger = new Logger(Client::LOGS_PATH);\n $logger->addLine(\"Client class instance created\", true);\n unset($logger);\n }", "function __construct()\r\n\t{\r\n\t\tparent::__construct();\r\n\t\t$this->log = Logger::getInstance();\r\n\t}", "function __construct() {\r\n\t\tparent::__construct();\r\n\t\t$this->log = Logger::getInstance();\r\n\t}", "protected function newEventLogger()\n {\n return new EventLogger(static::getLogger());\n }", "public function getLogger()\n {\n $log_name = 'importer';\n $logger = CustomLog::create( $this->getLog(), $log_name );\n return $logger;\n }", "protected static function instantiateLogger(string $name): MonologLogger\n {\n $filter = (int) FILTER_VALIDATE_BOOL;\n\n $debugEnvValueString = getenv('GENUG_DEBUG', true) ?: Preset::GENUG_DEBUG->value;\n /** @var null|bool */\n $isDebugOrNullOnFailure = filter_var($debugEnvValueString, $filter, FILTER_NULL_ON_FAILURE);\n\n $debugLogFilePath = getenv('GENUG_DEBUG_LOGFILE', true) ?: Preset::GENUG_DEBUG_LOGFILE->value;\n\n $logger = new MonologLogger($name);\n $level = Level::Warning;\n if ((bool) $isDebugOrNullOnFailure) {\n $level = Level::Debug;\n }\n $logger->pushHandler(new StreamHandler('php://stderr', $level));\n\n if ((bool) $isDebugOrNullOnFailure) {\n $logger->pushHandler(new StreamHandler(dirname(__DIR__).'/'.$debugLogFilePath, Level::Debug));\n }\n return $logger;\n }", "protected function newEventLogger(): Logger\n {\n return new Logger($this->logger);\n }", "protected function createMockedLoggerAndLogManager() {}", "public function __construct(){\n $this->clientLog = new Logger('client');\n $this->clientLog->pushHandler(new StreamHandler(storage_path('logs/client.log')), Logger::INFO);\n }", "protected function createLogDriver()\n {\n return new LogTransport($this->app->make('log')->getMonolog());\n }", "private function __construct()\n {\n $levels = Conf::inst()->get('log.levels');\n $this->levels = $this->levelNames = array();\n foreach ($levels as $key => $name) {\n $this->levels[$name] = $key;\n $this->levelNames[] = $name;\n }\n\n $loggingLevel = Conf::inst()->get('log.level');\n $this->loggingLevel = $this->levels[$loggingLevel];\n $this->file = fopen(__DIR__ . \"/../log/\" . Conf::inst()->get('log.file'), \"a\");\n }", "protected function getMonolog_Logger_PhpService()\n {\n $this->services['monolog.logger.php'] = $instance = new \\Symfony\\Bridge\\Monolog\\Logger('php');\n\n $instance->pushHandler($this->get('monolog.handler.console'));\n $instance->pushHandler($this->get('monolog.handler.main'));\n\n return $instance;\n }", "function make_console_logger() {\n\t\t\n\t\t$conf = array('name' => 'console_log');\n\t\t$this->loggers['console'] = owa_coreAPI::supportClassFactory( 'base', 'logConsole', $conf );\t\n\t}", "public function init()\n {\n if ($this->packer == null) {\n $this->packer = new MsgpackOrJsonPacker();\n } else if (!($this->packer instanceof \\Fluent\\Logger\\PackerInterface)) {\n $this->packer = Yii::createComponent($this->packer);\n }\n $this->_logger = new FluentLogger($this->host, $this->port, $this->options, $this->packer);\n }", "static public function get_instance( )\n\t{\n\t\tif (is_null(self::$_instance)) {\n\t\t\tself::$_instance = new Log( );\n\t\t}\n\n\t\treturn self::$_instance;\n\t}", "protected function getMonolog_Logger_TranslationService()\n {\n $this->services['monolog.logger.translation'] = $instance = new \\Symfony\\Bridge\\Monolog\\Logger('translation');\n\n $instance->pushHandler($this->get('monolog.handler.console'));\n $instance->pushHandler($this->get('monolog.handler.main'));\n\n return $instance;\n }", "public function __construct() {\n $get_arguments = func_get_args();\n $number_of_arguments = func_num_args();\n\n if($number_of_arguments == 1){\n $this->logger = $get_arguments[0];\n }\n }", "public static function initialize()\n {\n container()->forgetInstance(ILogger::class);\n container()->instance(ILogger::class, container()->make(ILoggerManagerInterface::class)->newLogger(SwooleMaster::getConfig()->getLogDir(), sprintf(SwooleMaster::getTopic() . sprintf(\"-tasker#%d\", self::$id))));\n }", "function make_file_logger() {\n\t\t\n\t\t$path = owa_coreAPI::getSetting('base', 'error_log_file');\n\t\t//instantiate a a log file\n\t\t$conf = array('name' => 'debug_log', 'file_path' => $path);\n\t\t$this->loggers['file'] = owa_coreAPI::supportClassFactory( 'base', 'logFile', $conf );\n\t}", "protected static function configureInstance()\n\t{\n\t\t$logger = new Logger('Default');\n\t\t$logger->pushHandler(new StreamHandler(__DIR__.'/../../logs/app.log', Logger::DEBUG));\n\n\t\tself::$instance = $logger;\n\t}", "public static function init()\n {\n $output = \"[%datetime%] %channel% %level_name% > %message%\\n\\n\";\n $formatter = new LineFormatter($output, null, true);\n\n $stream = new StreamHandler('../debug/main.log');\n\n $stream->setFormatter($formatter);\n\n self::$logger['main'] = new \\Monolog\\Logger('Main');\n self::$logger['main']->pushHandler($stream);\n\n self::$logger['db'] = self::$logger['main']->withName('Database');\n self::$logger['auth'] = self::$logger['main']->withName('Auth');\n self::$logger['upload'] = self::$logger['main']->withName('Uploader');\n\n // self::$logger['exception']\n // = self::$logger['main']->withName('Unhandled');\n // ErrorHandler::register(self::$logger['exception']);\n }", "function app_log(): Logger\n{\n return app(\"app_logger\");\n}", "public static function create() :DownloadLog\n {\n return new DownloadLog();\n }", "protected function registerLogger(Royalcms $royalcms)\n\t{\n\t\t$royalcms->instance('log', $log = new Writer(\n\t\t\tnew Monolog($royalcms->environment()), $royalcms['events'])\n\t\t);\n\n\t\treturn $log;\n\t}", "protected function newLog() : \\Closure {\n return function(string $action, string $level = 'warning') : logging\\LogInterface {\n $log = new logging\\ApiLog($action, $level);\n $log->addHandler('stream', 'json', $this->getStreamConfig($action));\n return $log;\n };\n }", "private function setupLog()\n {\n $path = JFactory::getConfig()->get('log_path');\n\n $fileName = 'ecr_log.php';\n $entry = '';\n\n if('preserve' == JFactory::getApplication()->input->get('logMode')\n && JFile::exists($path.'/'.$fileName)\n )\n {\n $entry = '----------------------------------------------';\n }\n else if(JFile::exists($path.'/'.$fileName))\n {\n JFile::delete($path.'/'.$fileName);\n }\n\n JLog::addLogger(\n array(\n 'text_file' => $fileName\n , 'text_entry_format' => '{DATETIME}\t{PRIORITY}\t{MESSAGE}'\n , 'text_file_no_php' => true\n )\n , JLog::INFO | JLog::ERROR\n );\n\n if('' != $entry)\n JLog::add($entry);\n\n return $this;\n }", "function createLogHelper($className) {\n // TODO: Bring startLogger and pauseLogger static calls to here\n if (strstr($className, '__ref')) {\n return;\n }\n\n // XXX: Expensive call (hell, hasn't stopped me yet)\n if (DEBUG == true) {\n $dbg = debug_backtrace();\n $lineNumber = $dbg[1]['line'];\n $fileName = $dbg[1]['file'];\n debugMsg(\"Intercepting new $className on line $lineNumber of $fileName\");\n }\n\n $destClassName = \"__ref\".$className;\n \n // Get a list of methods to be transplanted from original class\n $srcOriginal = sourceArray($className);\n\n\n // \n injectMethodLogger($className, $srcOriginal);\n\n // Create a '__ref' prefixed class that resembles the old one\n // Possible replacement? class_alias($className, $destClassName);\n //transplantMethods($destClassName, $srcOriginal);\n\n // Bind the logging __call() method to the class with the original name.\n // Each call will be dispatched to the '__ref' prefixed object.\n // Additionally, remove all the original methods so that __call() is invoked.\n //setLoggerMethods($className, $destClassName, $srcOriginal);\n debugMsg(\"Creating new $className object\\n\");\n}", "public function __construct() {\n $this->init(); \n $this->log = new FunnelLog('konnektive');\n }", "public function __construct(\\Monolog\\Logger $logger)\n {\n $this->_logger = $logger;\n }", "public function __construct()\n {\n $this->loggerMap = new HashMap('<string, \\Slf4p\\Logger>');\n }", "protected function initLogFileObject() {\n return new ErrorLogFile();\n }", "public function __construct()\n {\n self::$_logger = new Zend_Log(\n new Zend_Log_Writer_Stream(\n APPLICATION_PATH . '/../var/logs/system.log'\n )\n );\n }", "function Moxiecode_Logger() {\n\t\t$this->_path = \"\";\n\t\t$this->_filename = \"{level}.log\";\n\t\t$this->setMaxSize(\"100k\");\n\t\t$this->_maxFiles = 10;\n\t\t$this->_level = MC_LOGGER_DEBUG;\n\t\t$this->_format = \"[{time}] [{level}] {message}\";\n\t}", "public function __construct()\n {\n parent::__construct();\n\n // static::setLoggetLevel(); //日志等级 INFO\n static::loggerInit();\n }", "protected function setupLogger()\n {\n $this->log = new Logger('philip');\n if (isset($this->config['debug']) && $this->config['debug'] == true) {\n $log_path = isset($this->config['log']) ? $this->config['log'] : false;\n\n if (!$log_path) {\n throw new \\Exception(\"If debug is enabled, you must supply a log file location.\");\n }\n\n try {\n $format = \"[%datetime% - %level_name%]: %message%\";\n $handler = new StreamHandler($log_path, Logger::DEBUG);\n $handler->setFormatter(new LineFormatter($format));\n $this->log->pushHandler($handler);\n } catch (\\Exception $e) {\n throw \\Exception(\"Unable to open/read log file.\");\n }\n } else {\n $this->log->pushHandler(new NullHandler());\n }\n }", "public function __construct()\n {\n parent::__construct();\n \\Log::useDailyFiles(storage_path().'/logs/cron123.log');\n\n\t\t$this->logger = \\Log::getMonolog();\n\n\t\t\n }", "public function __construct(Log $logger)\n\t{\n\t\t$this->logger = $logger;\n\t}", "protected function createEntity()\n {\n return (new LogRecord());\n }", "public static function instance( $name ) {\n\n if( !isset( self::$instance[ $name ] ) ) {\n self::$instance[ $name ] = new Log( $name );\n }\n\n return self::$instance[ $name ];\n }", "public function __createLog($monolog_req, $monolog_response = array()) {\n $applane_service = $this->container->get('appalne_integration.callapplaneservice');\n $handler = $this->container->get('monolog.logger.connect_app_log');\n $applane_service->writeAllLogs($handler, $monolog_req, $monolog_response);\n return true;\n }", "function __construct() {\n parent::__construct();\n $this->load->model(\"LoggerModel\");\n }", "protected function getMonolog_Logger_RouterService()\n {\n $this->services['monolog.logger.router'] = $instance = new \\Symfony\\Bridge\\Monolog\\Logger('router');\n\n $instance->pushHandler($this->get('monolog.handler.console'));\n $instance->pushHandler($this->get('monolog.handler.main'));\n\n return $instance;\n }", "protected function _initLog()\n {\n }", "function wmMonologSyslogConfigFactory( $level ) {\n\treturn array(\n\t\t'class' => 'MWLoggerMonologSyslogHandler',\n\t\t'args' => array(\n\t\t\t'mediawiki', // syslog appname\n\t\t\t'10.68.16.134', // deployment-logstash1.eqiad.wmflabs\n\t\t\t10514, // logstash syslog listener port\n\t\t\tLOG_USER, // syslog facility\n\t\t\t$level, // minimum log level to pass to logstash\n\t\t),\n\t\t'formatter' => 'logstash',\n\t);\n}", "public static function create($type = \"file\", $filter = \"full+h\", $path = \"logs/debug.log\", $default_log = true) {\n /* Register the error handler. */\n ErrorHandler::create();\n switch ($type) {\n case \"file\":\n self::$logger = new FileLogger($filter, $path, $default_log);\n break;\n default:\n throw new \\Exception(\"Unrecognized log type.\");\n }\n return new self();\n }", "public function create($target, stubLogger $logger);", "public function __construct()\n {\n $this->setDefaultLogger(new NullLogger());\n }", "protected function createLogFile() {}", "protected function getMonolog_Logger_CacheService()\n {\n $this->services['monolog.logger.cache'] = $instance = new \\Symfony\\Bridge\\Monolog\\Logger('cache');\n\n $instance->pushHandler($this->get('monolog.handler.console'));\n $instance->pushHandler($this->get('monolog.handler.main'));\n\n return $instance;\n }", "abstract public function load_logger();", "public function __construct($logLocation = null)\n {\n $this->log = new Logger('Push');\n\n if ($logLocation == null) {\n\n $logLocation = __DIR__ . \"/../log.txt\";\n }\n\n if (!is_file($logLocation)) {\n\n fopen($logLocation, 'a');\n }\n\n if ($logLocation != null) {\n\n $this->log->pushHandler(new StreamHandler($logLocation), Logger::WARNING);\n }\n }", "public function log1p() : self\n {\n return $this->map('log1p');\n }", "private function __construct() {\n \n trace('***** Creating new '.__CLASS__.' object. *****');\n \n }", "protected function log_manager() {\n\t\treturn tribe( 'logger' );\n\t}", "public static function configureMonologUsing($callback){\n return \\Illuminate\\Foundation\\Application::configureMonologUsing($callback);\n }", "public function __invoke(array $config)\n {\n return (new Manager($config, [CloudWatch::class]))->logger();\n }", "public function __construct()\n {\n $this->log = new Log($this->logFileName);\n $this->middleware('auth');\n }", "public static function staticConstructor() {\n static::$loggingUtils = new LoggingUtils();\n }", "public static function getMonolog(){\n\t\treturn \\Illuminate\\Log\\Writer::getMonolog();\n\t}", "public static function getInstance()\n {\n // the class exists\n $class = __CLASS__;\n sfFlexibleLogger::$logger = new $class();\n sfFlexibleLogger::$logger->initialize();\n\n return sfFlexibleLogger::$logger;\n }", "public static function getInstance()\r\n \t{\r\n \t\t$logger = ConfService::getLogDriverImpl();\r\n \t\treturn $logger;\r\n \t}", "private static function _initLog()\n {\n if (!empty(self::$config->log->servers)) {\n $servers = self::$config->log->servers->toArray();\n } else {\n $servers = self::LOG_SERVERS;\n }\n\n if (php_sapi_name() == 'cli') {\n $extra = [\n 'command' => implode(' ', $_SERVER['argv']),\n 'mem' => memory_get_usage(true),\n ];\n } elseif (isset($_REQUEST['udid'])) {\n //for app request\n $extra = [\n 'h' => $_SERVER['HTTP_HOST'] ?? '',\n 'uri' => $_SERVER['REQUEST_URI'] ?? '',\n 'v' => $_REQUEST['v'] ?? '',\n 'd' => $_REQUEST['udid'] ?? '',\n 't' => $_REQUEST['mytoken'] ?? $_REQUEST['mytoken_sid'] ?? '',\n 'os' => $_REQUEST['device_os'] ?? '',\n 'm' => $_REQUEST['device_model'] ?? '',\n 'p' => $_REQUEST['platform'] ?? '',\n 'l' => $_REQUEST['language'] ?? '',\n 'real_ip' => \\Util::getClientIp(),\n ];\n } else {\n //pc or other ?\n $extra = [\n 'h' => $_SERVER['HTTP_HOST'] ?? '',\n 'uri' => $_SERVER['REQUEST_URI'] ?? '',\n 'v' => $_REQUEST['v'] ?? '',\n 't' => $_REQUEST['mytoken'] ?? $_REQUEST['mytoken_sid'] ?? '',\n 'p' => $_REQUEST['platform'] ?? '',\n 'l' => $_REQUEST['language'] ?? '',\n 'ua' => $_SERVER['HTTP_USER_AGENT'] ?? '',\n 'real_ip' => \\Util::getClientIp(),\n ];\n }\n\n if (\\Yaf\\ENVIRON != 'product') {\n \\Log::setLogFile(self::$config->log->path);\n }\n\n LoggerHandler::setServers($servers);\n LoggerHandler::setEnv(\\YAF\\ENVIRON);\n LoggerHandler::setExtra($extra);\n LoggerHandler::setUniqueId($_REQUEST['preRequestId'] ?? self::$request->header('preRequestId'));\n }", "public function __construct( $logger ) {\n\t\t$this->logger = $logger;\n\t\tparent::__construct();\n\t}", "protected function getMonolog_Logger_RequestService()\n {\n $this->services['monolog.logger.request'] = $instance = new \\Symfony\\Bridge\\Monolog\\Logger('request');\n\n $instance->pushHandler($this->get('monolog.handler.console'));\n $instance->pushHandler($this->get('monolog.handler.main'));\n\n return $instance;\n }", "private function initLogger()\n {\n $objectManager = ObjectManager::getInstance();\n if ($this->klevuLoggerFQCN && !($this->logger instanceof $this->klevuLoggerFQCN)) {\n $this->logger = $objectManager->get($this->klevuLoggerFQCN);\n }\n\n if (!($this->logger instanceof LoggerInterface)) {\n $this->logger = $objectManager->get(LoggerInterface::class);\n }\n }", "public function __construct(Log $log)\n {\n $this->log = $log;\n }", "private function initLogger()\n {\n\n // Check logir exists\n if (!file_exists(LOGDIR)) {\n Throw new FrameworkException(sprintf('Logdir does not exist. Please create \"%s\" and make sure it is writable.', LOGDIR));\n }\n\n // Check logdir to be writable\n if (!is_writable(LOGDIR)) {\n Throw new FrameworkException(sprintf('Logdir \"%s\" is not writable. Please set proper accessrights', LOGDIR));\n }\n\n $this->di->mapFactory('core.logger', '\\Core\\Logger\\Logger');\n\n /* @var $logger \\Core\\Logger\\Logger */\n $this->logger = $this->di->get('core.logger');\n $this->logger->registerStream(new \\Core\\Logger\\Streams\\FileStream(LOGDIR . '/core.log'));\n\n $this->di->mapValue('core.logger.default', $this->logger);\n }", "public function __construct(Log $log)\n {\n parent::__construct();\n $this->log = $log;\n }", "public function __construct(Log $log)\n {\n parent::__construct();\n $this->log = $log;\n }", "public function __construct()\n {\n // The __CLASS__ constant holds the class name, in our case \"errMailService\".\n // Therefore this creates a logger named \"errMailService\" (which we configured in the config file)\n $this->log = Logger::getLogger(__CLASS__);\n }", "protected function initLogger(): void\n {\n $customPath = $this->context->getConfigurationService()->getLogPath();\n $severity = $this->context->getConfigurationService()->getLogSeverity();\n\n Logger::resetErrors();\n $this->logger = Logger::getInstance(__CLASS__, $customPath, $severity);\n }", "private function createDefaultLogger(): LoggerInterface\n {\n $logger = new Logger();\n\n $writer = new Stream('php://stdout');\n $writer->setFormatter(new Simple('%message%'));\n $logger->addWriter($writer);\n\n return new PsrLoggerAdapter($logger);\n }", "protected function _getLogger()\n {\n if ($this->_logger === null) {\n $this->_logger = new Zend_Log();\n $writer = new Zend_Log_Writer_Stream(STDOUT, 'a');\n $formatter = new Zend_Log_Formatter_Simple('%priorityName%: %message%' . PHP_EOL);\n $writer->setFormatter($formatter);\n if (!$this->getArg('debug')) {\n $writer->addFilter(Zend_Log::INFO);\n } else {\n $writer->addFilter(Zend_Log::DEBUG);\n }\n $this->_logger->addWriter(\n $writer\n );\n }\n\n return $this->_logger;\n }", "function write(){\n\n\n\t\t// Create the logger\n\t\t$logger = new Logger('my_logger');\n\t\t// Now add some handlers\n\t\t$logger->pushHandler(new StreamHandler(__DIR__.'/log/my_app.log', Logger::DEBUG));\n\t\t\n\t\t$log = $logger->pushHandler(new FirePHPHandler());\n\n\n\t\treturn $log;\n\n\n }", "public function getObject() {\n return Log::getInstance();\n }", "public function __construct() {\n\t\t\t$this->SetKey('N2f-LoggerProcessor')->SetVersion('1.0');\n\n\t\t\treturn;\n\t\t}", "public function createRecord(\n $loggerNamespace,\n $loggerClass,\n $loggerMethod,\n $namespace,\n $class,\n $method,\n $level,\n $filename,\n $lineno,\n $msg,\n array $args,\n \\Exception $exception = null\n );", "public function log($_msg,$_opt=array()){\r\n return (new Object())->log($_msg,$_opt);\r\n }", "public function __construct() {\n global $log;\n\n // create a log channel\n $this->logger = new \\Monolog\\Logger('Neo4JUtil');\n $this->logger->pushHandler($log);\n\n if (\\snac\\Config::$USE_NEO4J) {\n $this->connector = \\GraphAware\\Neo4j\\Client\\ClientBuilder::create()\n ->addConnection('bolt', \\snac\\Config::$NEO4J_BOLT_URI)\n ->build();\n }\n $this->logger->addDebug(\"Created neo4j client\");\n }", "protected function addLog() {\n\t\t$oLog = PHP_Beautifier_Common::getLog();\n\t\t$oLogConsole = Log::factory('console', '', 'php_beautifier', array(\n\t\t\t\t'stream' => STDERR,\n\t\t\t), PEAR_LOG_DEBUG);\n\t\t$oLog->addChild($oLogConsole);\n\t}", "public function __construct( WP_Logging $wp_logger )\n {\n //set database handler //\n $this->handler = $wp_logger;\n\n //filter for WP_Logging to add Zend\\Log priorities //\n add_filter( 'wp_log_types', array( $this, 'add_logger_priorities' ) );\n\n //enable prunning/deletion of old logs via wordpress cron //\n add_filter( 'wp_logging_should_we_prune', array( $this, 'activate_pruning' ), 10 );\n }" ]
[ "0.7079103", "0.669472", "0.6669259", "0.6624679", "0.66114056", "0.6527272", "0.6469319", "0.6383948", "0.63522387", "0.6308052", "0.6270581", "0.6255487", "0.6176386", "0.61563534", "0.6154256", "0.61280835", "0.61105025", "0.61007816", "0.6093689", "0.6065181", "0.60369456", "0.6028689", "0.601675", "0.60099596", "0.5999835", "0.59786594", "0.59650534", "0.5940446", "0.59197444", "0.59015846", "0.58928686", "0.5888076", "0.5868291", "0.5790076", "0.578805", "0.576017", "0.57554305", "0.5755188", "0.5751342", "0.5741696", "0.57258636", "0.57059664", "0.5699125", "0.5695021", "0.56906503", "0.56811225", "0.5676862", "0.56753784", "0.5665012", "0.5647372", "0.5639327", "0.561379", "0.5586461", "0.55840987", "0.5579307", "0.5567876", "0.5564953", "0.5563111", "0.55261487", "0.5521339", "0.55191195", "0.55158144", "0.5512494", "0.5511539", "0.55046505", "0.5500511", "0.5484257", "0.54587066", "0.54553264", "0.54550624", "0.5454588", "0.5441506", "0.54359376", "0.5429935", "0.5421211", "0.5416627", "0.54112214", "0.5408379", "0.5399392", "0.53993386", "0.53821373", "0.5380044", "0.53697306", "0.53674096", "0.5362122", "0.53540593", "0.5354033", "0.5354033", "0.5342606", "0.533925", "0.5322504", "0.5317372", "0.53171957", "0.53165466", "0.53151774", "0.5308887", "0.53038996", "0.5278273", "0.52758753", "0.5268472" ]
0.5293467
97
filter Returns FALSE to accept the message, TRUE to block it.
public function filter(Record $record);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function shouldReceive()\n {\n }", "public static function shouldReceive()\n {\n }", "public static function shouldReceive()\n {\n }", "public static function shouldReceive()\n {\n }", "public function accept()\n {\n return true;\n }", "public function getIsAccepted(): bool;", "public function isBlocking(): bool\n {\n return $this->pluck('blocking');\n }", "public function isBlocking(): bool\n {\n return $this->pluck('blocking');\n }", "public function getAccepted();", "public function accept($event)\n {\n return preg_match($this->_regexp, $event['message']) > 0;\n }", "public function accept(){\n \n }", "public function hasBlockedUserFilter()\n {\n return $this->blocked_user_filter !== null;\n }", "function accept($condition) {\n\n if($this->accepted = is_null($condition->sms_delivered) === true) {\n $messages = $condition->getUndeliveredMessages();\n $message = end($messages);\n if($this->accepted = $this->is_sms_error($message['message_provider_error']) === true){\n $this->data = $message->message_provider_error;\n }\n }\n\n return $this->accepted;\n }", "public function accept();", "function welcome_user_msg_filter($text)\n {\n }", "protected abstract function filter();", "public function allowMessage()\n {\n $this->_data['Mensaje'] = 1;\n }", "function filter_block_content($text, $allowed_html = 'post', $allowed_protocols = array())\n {\n }", "private function _hardFilter()\n\t {\n\t\t$check = true;\n\n\t\t$blackxml = new SimpleXMLElement(file_get_contents(__DIR__ . \"/storage/blacklist.xml\"));\n\n\t\tforeach ($blackxml->patterns->pattern as $pattern)\n\t\t {\n\t\t\tif (isset($this->name) === true)\n\t\t\t {\n\t\t\t\tif (preg_match((string) $pattern, $this->name) > 0)\n\t\t\t\t {\n\t\t\t\t\t$check = false;\n\t\t\t\t\tbreak;\n\t\t\t\t } //end if\n\n\t\t\t } //end if\n\n\t\t\tif (preg_match((string) $pattern, $this->description) > 0)\n\t\t\t {\n\t\t\t\t$check = false;\n\t\t\t\tbreak;\n\t\t\t } //end if\n\n\t\t } //end foreach\n\n\t\tif ($check !== false)\n\t\t {\n\t\t\tforeach ($blackxml->words->word as $word)\n\t\t\t {\n\t\t\t\tif (isset($this->name) === true)\n\t\t\t\t {\n\t\t\t\t\tif (preg_match(\"/\" . (string) $word . \"/ui\", $this->name) > 0)\n\t\t\t\t\t {\n\t\t\t\t\t\t$check = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t } //end if\n\n\t\t\t\t } //end if\n\n\t\t\t } //end foreach\n\n\t\t } //end if\n\n\t\tif ($check === false)\n\t\t {\n\t\t\t$whitexml = new SimpleXMLElement(file_get_contents(__DIR__ . \"/storage/whitelist.xml\"));\n\n\t\t\tforeach ($whitexml->patterns->pattern as $pattern)\n\t\t\t {\n\t\t\t\tif (preg_match((string) $pattern, $this->description) > 0)\n\t\t\t\t {\n\t\t\t\t\t$check = true;\n\t\t\t\t\tbreak;\n\t\t\t\t } //end if\n\n\t\t\t } //end foreach\n\n\t\t } //end if\n\n\t\treturn $check;\n\t }", "public function isBlocked() : bool {\n return $this->delivery_status === WebhookEvent::EVENT_BLOCKED;\n }", "public function isBlocked()\n {\n if ($this->status == 2) {\n return true;\n } else {\n return false;\n }\n }", "public function isReceiving()\n {\n return ( $this->_stateManager->getState() === self::STATE_RECEIVING );\n }", "public function isBlocking()\n\t{\n\t\treturn $this->blocking;\n\t}", "public function isAccepted()\n {\n return !empty($this->acceptee_id);\n }", "public function filter() {\r\n\t\t$this->resource->filter();\r\n\t}", "function is_ok()\n\t{\n\t\t$this->message = $this->sock_read();\n\n\t\tif($this->message == \"\" || preg_match('/^5/',$this->message) )\n\t\t{\n\t\t\treturn 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn 1;\n\t\t}\n\t}", "private function _checkMessageFor()\n {\n return;\n \n $dbh = $this->_connectToDb();\n \n $stmt = $dbh->query(\"SELECT message, when, from FROM messages WHERE LOWER(nick) = '\". strtolower(trim($this->_data->nick)) .\"' AND seen = 0 ORDER BY id DESC LIMIT 1\");\n \n $row = $stmt->fetch(PDO::FETCH_OBJ);\n\n if (isset($row->when)) {\n\n $this->_privmessage(\n 'I have a message for you from '. $row->from,\n $this->_data->nick\n );\n $this->_privmessage(\n 'Message begin: '. $row->message .' :: Message End',\n $this->_data->nick\n );\n $this->_privmessage(\n 'Send: '. $row->when,\n $this->_data->nick\n );\n }\n }", "protected function _filterBlock($block)\n {\n if (!$this->getAllowedBlocks()) {\n return true;\n }\n if (in_array((string)$block->getAttribute('name'), $this->getAllowedBlocks())) {\n return true;\n }\n return false;\n }", "public function filter();", "public function ethNewBlockFilter(): Promise\n {\n return $this->callEndpoint('eth_newBlockFilter', 73, \\int::class);\n }", "function filter_block_kses($block, $allowed_html, $allowed_protocols = array())\n {\n }", "public function isMessage(): bool\n {\n return $this->code >= CODE_CONTINUE &&\n $this->code < CODE_OK;\n }", "public function receive()\n {\n\n $source = $this->getValue();\n\n return true;\n }", "public function reject()\n {\n $this->channel->basic_reject(\n $this->tag(),\n true\n );\n }", "public function getIsBlocked();", "public function discard()\n {\n $this->channel->basic_reject(\n $this->tag(),\n false\n );\n }", "public function filterable()\n {\n return true;\n }", "function _filter_block_content_callback($matches)\n {\n }", "public function broadcastWhen() {\n $return = false;\n $ids_to_broadcast = [$this->message->userId, $this->message->receiverUserId];\n if (in_array($this->message->userId, $ids_to_broadcast) || in_array($this->message->receiverUserId, $ids_to_broadcast)) $return = true;\n return $return;\n }", "public function isAccepted_as_talk() {\n\t\t$this->getAccepted_as_talk();\n\t}", "public function hasFilter(): bool;", "public function harSending() {\n try {\n $this->getSending();\n return true;\n } catch( Exception $e ) {\n if( $e->getCode() == 144001 ) {\n return false;\n }\n throw $e;\n }\n }", "function block($ip_address, $filter, $event) {\n\t\t//define the global variables\n\t\tglobal $firewall_path, $firewall_name;\n\n\t\t//invalid ip address\n\t\tif (!filter_var($ip_address, FILTER_VALIDATE_IP)) {\n\t\t\treturn false;\n\t\t}\n\n\t\t//run the block command for iptables\n\t\tif ($firewall_name == 'iptables') {\n\t\t\t//example: iptables -I INPUT -s 127.0.0.1 -j DROP\n\t\t\t$command = $firewall_path.'/./iptables -I '.$filter.' -s '.$ip_address.' -j DROP';\n\t\t\t$result = shell($command);\n\t\t}\n\n\t\t//run the block command for pf\n\t\tif ($firewall_name == 'pf') {\n\t\t\t//example: pfctl -t sip-auth-ip -T add 127.0.0.5/32\n\t\t\t$command = $firewall_path.'/pfctl -t '.$filter.' -T add '.$ip_address.'/32';\n\t\t\t$result = shell($command);\n\t\t}\n\n\t\t//log the blocked ip address to the syslog\n\t\topenlog(\"fusionpbx\", LOG_PID | LOG_PERROR, LOG_AUTH);\n\t\tsyslog(LOG_WARNING, \"fusionpbx: blocked: [ip_address: \".$ip_address.\", filter: \".$filter.\", to-user: \".$event['to-user'].\", to-host: \".$event['to-host'].\", line: \".__line__.\"]\");\n\t\tcloselog();\n\n\t\t//log the blocked ip address to the database\n\t\t$array['event_guard_logs'][0]['event_guard_log_uuid'] = uuid();\n\t\t$array['event_guard_logs'][0]['hostname'] = gethostname();\n\t\t$array['event_guard_logs'][0]['log_date'] = 'now()';\n\t\t$array['event_guard_logs'][0]['filter'] = $filter;\n\t\t$array['event_guard_logs'][0]['ip_address'] = $ip_address;\n\t\t$array['event_guard_logs'][0]['extension'] = $event['to-user'].'@'.$event['to-host'];\n\t\t$array['event_guard_logs'][0]['user_agent'] = $event['user-agent'];\n\t\t$array['event_guard_logs'][0]['log_status'] = 'blocked';\n\t\t$p = new permissions;\n\t\t$p->add('event_guard_log_add', 'temp');\n\t\t$database = new database;\n\t\t$database->app_name = 'event guard';\n\t\t$database->app_uuid = 'c5b86612-1514-40cb-8e2c-3f01a8f6f637';\n\t\t$database->save($array);\n\t\t$p->delete('event_guard_log_add', 'temp');\n\t\tunset($database, $array);\n\n\t\t//send debug information to the console\n\t\tif ($debug) {\n\t\t\techo \"blocked address \".$ip_address .\", line \".__line__.\"\\n\";\n\t\t}\n\n\t\t//unset the array\n\t\tunset($event);\n\t}", "public function users_register_check_blocked($h)\n {\n $this->ssType = $h->getSetting('stop_spam_type');\n \n // get user info:\n //$username = $h->currentUser->name;\n $username = ''; // dont check on username as it is too narrow a filter\n $email = $h->currentUser->email;\n $ip = $h->cage->server->testIp('REMOTE_ADDR');\n \n // If any variable is empty or the IP is \"localhost\", skip using this plugin.\n if (!$email || !$ip || ($ip == '127.0.0.1')) { return false; }\n\n // Include our StopSpam class:\n require_once(PLUGINS . 'stop_spam/libs/StopSpam.php');\n $spam = new StopSpamFunctions();\n \n $json = $spam->checkSpammers($username, $email, $ip); \n $flags = $spam->flagSpam($h, $json);\n \n if ($flags) { \n // store flags - used when type is \"go_pending\"\n $h->vars['reg_flags'] = $flags;\n \n // if type is \"block_reg\", provide a way to tell the Users plugin:\n if ($this->ssType == 'block_reg') {\n $h->vars['block'] = true;\n }\n } \n else \n {\n // safe user, do nothing...\n }\n\n }", "public function isFilterable(): bool;", "public function isSent() {}", "public function validateInboundMessage(){\n\t\t$hashData = $this->timestamp . \"\" . $this->token;\n\t\t$computedSignature = hash_hmac(\"sha256\",$hashData , $this->MGAPIKEY);\n\t\t$providedSignature = $this->signature;\n\t\tif ($computedSignature == $providedSignature){\n\t\t\tif($this->validateSender()){\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "public function receive()\n {\n if ( $this->isReceiving() ) {\n $this->dispatchErrorEvent( self::ALREADY_RECEIVING_ERR_CODE );\n return false;\n }\n \n $this->_initFaxEnvDetection();\n if ( $this->_options[self::OPT_DETECT_FAX_TONE] ) {\n $this->_initFaxToneDetection();\n } else {\n $this->_waitAudioReinvite();\n }\n \n $this->_stateManager->setState( self::STATE_RECEIVING );\n $this->dispatchEvent( new Streamwide_Engine_Events_Event( Streamwide_Engine_Events_Event::FAX_RECEIVING_REQUESTED ) );\n return true;\n }", "public function block() {\n $friendship_relation_exists = $this->micro_relation_exists($this->from, $this->to, \"F\");\n $exists = $this->micro_relation_exists($this->from, $this->to, \"B\");\n\n if($friendship_relation_exists) {\n // Unblock\n if($exists) {\n $this->db->query(\"DELETE FROM user_relation WHERE `from` = ? AND `to` = ? AND `status` = ?\"\n ,array(\n $this->from,\n $this->to,\n \"B\"\n ));\n // Block\n } else {\n $this->db->query(\"INSERT INTO user_relation (`from`, `to`, `status`, `since`) \n VALUES (?, ?, ?, ?)\", array(\n $this->from,\n $this->to,\n \"B\",\n date(\"Y/m/d h:i:s\")\n ));\n }\n\n return true;\n }\n\n return false;\n }", "public function is_blocked_to(Character $character)\n {\n return false;\n }", "public function isAccepted()\n {\n return $this->accepted;\n }", "public function filter(){\n try {\n // Sparql11query.g:220:3: ( FILTER constraint ) \n // Sparql11query.g:221:3: FILTER constraint \n {\n $this->match($this->input,$this->getToken('FILTER'),self::$FOLLOW_FILTER_in_filter760); \n $this->pushFollow(self::$FOLLOW_constraint_in_filter762);\n $this->constraint();\n\n $this->state->_fsp--;\n\n\n }\n\n }\n catch (RecognitionException $re) {\n $this->reportError($re);\n $this->recover($this->input,$re);\n }\n catch(Exception $e) {\n throw $e;\n }\n \n return ;\n }", "public function requireFilterSubmit_result()\n\t{\n\t\treturn false;\n\t}", "public function test_get_user_messages_filtered(): void\n {\n $request = GroupRequest::ofUserName(self::DEFAULT_GROUP_DEEPLINK);\n $this->resolve($request, function (?int $groupId, ?int $accessHash) {\n $count = 0;\n $handler = function (?MessageModel $message = null) use (&$count) {\n if ($message) {\n $this->assertEquals('qweq', $message->getText());\n $count++;\n }\n };\n $client = new GroupMessagesScenario(\n new GroupId($groupId, $accessHash),\n $this->clientGenerator,\n new OptionalDateRange(time()),\n $handler,\n self::USERNAME\n );\n $client->setTimeout(self::TIMEOUT);\n $client->startActions();\n $this->assertEquals(0, $count);\n });\n }", "private function validateSender(){\n\t\tglobal $ENABLE_SECURITY;\n\t\tif(in_array($this->sender, $this->validSenders) || $ENABLE_SECURITY == false){\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "public function blockUser($messageId) {\n $res = parent::put('message/block?messageID=' . $messageId, $this->auth_token);\n\n if ($res === false) {\n return false;\n }\n\n return $res->status;\n }", "public function isSent() {\n\treturn $this->status != self::$WAITING;\n }", "protected function scanFilter()\n {\n return $this->scanInput('/^:(\\w+)/', 'filter');\n }", "public function process()\n\t{\n\t\t$bFriendIsSelected = false;\n\t\tif (($iUserId = $this->request()->getInt('to')))\n\t\t{\n\t\t\t$aUser = Phpfox::getService('user')->getUser($iUserId, Phpfox::getUserField());\t\t\t\n\t\t\tif (isset($aUser['user_id']))\n\t\t\t{\n\t\t\t\t//if (!Phpfox::getService('user.privacy')->hasAccess($aUser['user_id'], 'mail.send_message'))\n\t\t\t\tif (!Phpfox::getService('mail')->canMessageUser($aUser['user_id']))\n\t\t\t\t{\n\t\t\t\t\treturn Phpfox_Error::display(Phpfox::getPhrase('mail.unable_to_send_a_private_message_to_this_user_at_the_moment'));\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t$bFriendIsSelected = true;\n\t\t\t\t\n\t\t\t\t$this->template()->assign('aUser', $aUser);\n\t\t\t}\t\t\t\n\t\t}\n\t\tif (Phpfox::getParam('mail.spam_check_messages') && Phpfox::isSpammer())\n\t\t{\n\t\t\treturn Phpfox_Error::display(Phpfox::getPhrase('mail.currently_your_account_is_marked_as_a_spammer'));\n\t\t}\n\t\t\n\t\t$aValidation = array(\n\t\t\t'subject' => Phpfox::getPhrase('mail.provide_subject_for_your_message'),\n\t\t\t'message' => Phpfox::getPhrase('mail.provide_message')\n\t\t);\t\t\n\n\t\t$oValid = Phpfox::getLib('validator')->set(array(\n\t\t\t\t'sFormName' => 'js_form', \n\t\t\t\t'aParams' => $aValidation\n\t\t\t)\n\t\t);\n\t\t\n\t\tif ($aVals = $this->request()->getArray('val'))\n\t\t{\t\t\t\n\t\t\t// Lets make sure they are actually trying to send someone a message.\t\t\t\n\t\t\tif (((!isset($aVals['to'])) || (isset($aVals['to']) && !count($aVals['to']))) && (!isset($aVals['copy_to_self']) || $aVals['copy_to_self'] != 1))\n\t\t\t{\n\t\t\t\tPhpfox_Error::set(Phpfox::getPhrase('mail.select_a_member_to_send_a_message_to'));\n\t\t\t}\n\t\t\t\t\t\t\n\t\t\tif ($oValid->isValid($aVals))\n\t\t\t{\t\t\t\t\n\t\t\t\tif (Phpfox::getParam('mail.mail_hash_check'))\n\t\t\t\t{\n\t\t\t\t\tPhpfox::getLib('spam.hash', array(\n\t\t\t\t\t\t\t\t'table' => 'mail_hash',\n\t\t\t\t\t\t\t\t'total' => Phpfox::getParam('mail.total_mail_messages_to_check'),\n\t\t\t\t\t\t\t\t'time' => Phpfox::getParam('mail.total_minutes_to_wait_for_pm'),\n\t\t\t\t\t\t\t\t'content' => $aVals['message']\n\t\t\t\t\t\t\t)\t\t\t\t\n\t\t\t\t\t\t)->isSpam();\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (Phpfox::getParam('mail.spam_check_messages'))\n\t\t\t\t{\n\t\t\t\t\tif (Phpfox::getLib('spam')->check(array(\n\t\t\t\t\t\t\t\t'action' => 'isSpam',\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t'params' => array(\n\t\t\t\t\t\t\t\t\t'module' => 'comment',\n\t\t\t\t\t\t\t\t\t'content' => Phpfox::getLib('parse.input')->prepare($aVals['message'])\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t\t{\n\t\t\t\t\t\tPhpfox_Error::set(Phpfox::getPhrase('mail.this_message_feels_like_spam_try_again'));\n\t\t\t\t\t}\n\t\t\t\t}\t\t\t\t\n\t\t\t\t\n\t\t\t\tif (Phpfox_Error::isPassed())\n\t\t\t\t{\n\t\t\t\t\t$aIds = Phpfox::getService('mail.process')->add($aVals);\n\t\t\t\t\t\n\t\t\t\t\t$this->url()->send('mail.view' , array('id' => $aIds[0]));\n\t\t\t\t}\n\t\t\t}\n\t\t}\t\t\t\n\t\t\n\t\t$this->template()->assign(array(\n\t\t\t\t'bMobileInboxIsActive' => true,\t\t\t\n\t\t\t\t'bFriendIsSelected' => $bFriendIsSelected,\t\n\t\t\t\t'aMobileSubMenus' => array(\n\t\t\t\t\t$this->url()->makeUrl('mail') => Phpfox::getPhrase('mail.mobile_messages'),\n\t\t\t\t\t$this->url()->makeUrl('mail', 'sent') => Phpfox::getPhrase('mail.sent'),\n\t\t\t\t\t$this->url()->makeUrl('mail', 'compose') => Phpfox::getPhrase('mail.compose')\n\t\t\t\t),\n\t\t\t\t'sActiveMobileSubMenu' => $this->url()->makeUrl('mail', 'compose')\n\t\t\t)\n\t\t);\t\t\n\t}", "public function accept(): bool\n {\n return (!$this->isFile() || preg_match($this->regex, $this->getFilename()));\n }", "public function getStillWanted() {\n $wanted = Event::fireReturn($this->getEventID(), $this->type, $this->filter, 'ping');\n if ($wanted || count($wanted)) {\n return true;\n }\n return false;\n }", "public function isBlocked()\n {\n return $this->getStatus() == self::STATUS_BLOCKED;\n }", "function mFILTER(){\n try {\n $_type = Erfurt_Sparql_Parser_Sparql11_Update_Tokenizer11::$FILTER;\n $_channel = Erfurt_Sparql_Parser_Sparql11_Update_Tokenizer11::$DEFAULT_TOKEN_CHANNEL;\n // Tokenizer11.g:211:3: ( 'filter' ) \n // Tokenizer11.g:212:3: 'filter' \n {\n $this->matchString(\"filter\"); \n\n\n }\n\n $this->state->type = $_type;\n $this->state->channel = $_channel;\n }\n catch(Exception $e){\n throw $e;\n }\n }", "function is_blocked($ip_address) {\n\t\t//define the global variables\n\t\tglobal $firewall_path, $firewall_name;\n\n\t\t//invalid ip address\n\t\tif (!filter_var($ip_address, FILTER_VALIDATE_IP)) {\n\t\t\treturn false;\n\t\t}\n\n\t\t//determine whether to return true or false\n\t\tif ($firewall_name == 'iptables') {\n\t\t\t//check to see if the address is blocked\n\t\t\t$command = $firewall_path.'/./iptables -L -n --line-numbers | grep '.$ip_address;\n\t\t\t$result = shell($command);\n\t\t\tif (strlen($result) > 3) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\telseif ($firewall_name == 'pf') {\n\t\t\t//check to see if the address is blocked\n\t\t\t$command = $firewall_path.'/pfctl -t \".$filter.\" -Ts | grep '.$ip_address;\n\t\t\t$result = shell($command);\n\t\t\tif (strlen($result) > 3) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\treturn false;\n\t\t}\n\t}", "public function isMessage() {\n return (bool) !empty($this->message);\n }", "public function isMessage() {\n return (bool) !empty($this->message);\n }", "public function isMessage() {\n return (bool) !empty($this->message);\n }", "public function isMessage() {\n return (bool) !empty($this->message);\n }", "function allow_interactive_filters() {\n return FALSE;\n }", "public function isRespond()\n {\n return null !== $this->accepted;\n }", "public function GetAccept ();", "public function accepting_input()\n {\n $accepting_statuses = ['init', 'running', 'waiting'];\n return in_array($this->status, $accepting_statuses);\n }", "function wcfmgs_group_manager_notification_filter( $group_manager_filter ) {\r\n \t\r\n \tif( !wcfm_is_vendor() ) {\r\n \t\t$is_marketplace = wcfm_is_marketplace();\r\n\t\t\tif( $is_marketplace ) {\r\n\t\t\t\t$allow_vendors = $this->wcfmgs_group_manager_allow_vendors_list( array(0), $is_marketplace );\r\n\t\t\t\t$group_manager_filter = \" AND ( `author_id` IN (\" . implode( ',', $allow_vendors ) . \")\" . \" OR `message_to` = -1 OR `message_to` IN (\" . implode( ',', $allow_vendors ) . \")\" . \" )\";\r\n\t\t\t}\r\n \t}\r\n \t\r\n \treturn $group_manager_filter;\r\n }", "public function isNotReceived()\n\t{\n\t\tif($this->test_status_id == Test::NOT_RECEIVED)\n\t\t\treturn true;\n\t\telse \n\t\t\treturn false;\n\t}", "function filter( $params)\n\t{\n\t\treturn true;\n\t}", "public function checkByFilter(Filter $filter, Message $message)\n {\n return $this->check($filter->getCriteria(), $message);\n }", "public function filterPromoted(): self;", "public function match() {\r\n\t\treturn false;\r\n\t}", "public function isValid() {\n return $this->isAccepted();\n }", "public function match($message);", "protected abstract function receive();", "function ok()\r\n {\r\n \tif (!$this->_socket || !is_resource($this->_socket)) {\r\n \t\treturn FALSE;\r\n \t}\r\n \t\r\n \t$response = $this->getresp();\r\n\t\tforeach ($response as $v)\r\n\t\t{\r\n\t\t\tif (!empty($v) && !preg_match(\"/^[123]/\", $v)) return false;\r\n\t\t}\r\n\t\treturn true;\r\n\t\t/*\r\n\t\tif (ereg(\"^[123]\", $response)) {\r\n \t\treturn TRUE;\r\n \t} else {\r\n \t\treturn FALSE;\r\n \t}*/\r\n }", "public function isMessage() {\n return (bool) !empty(self::$message);\n }", "public function receive();", "public function filterValidEmailsProvider() {}", "public function authorized()\n {\n return $this->accepted && ! $this->test_mode;\n }", "function canHandleRequest() ;", "protected function receiveMailgun() {\n if (hash_hmac('sha256', $request->input('timestamp').$request->input('token'), config('services.mailgun.secret')) !== $request->input('signature')) {\n return response('Rejected', 406);\n }\n\n $message = strip_tags($request->input('body-plain'));\n\n $this->saveEmail($request->input('from'), $message, $request->input('to'), null, 'mailgun');\n\n return response('Accepted', 200);\n }", "public function isReceiveType()\n {\n return $this->type_id == TransferType::RECEIVE;\n }", "public function isBlocked() {\n return $this->user !== null && $this->user->blocked;\n }", "function filter($value)\n\t{\n\t\treturn (boolean)$this->callback->invokeArgs(array($value));\n\t}", "public function isMessage() {\n return (bool) (!empty(self::$message));\n }", "public function getIsBlock();", "public function acceptedIf(string|int|float $message): self\n {\n return $this->addMessage(new AcceptedIf($message));\n }", "public function isSpam();", "public function filtering();", "protected function sendMessageFilter($ct,$u)\n {\n $content = array(\n \"en\" => $ct\n );\n\n $fields = array(\n 'app_id' => env('ONESIGNAL_KEY'),\n 'filters' => $u,\n 'data' => array(\"foo\" => \"bar\"),\n 'contents' => $content\n );\n\n $fields = json_encode($fields);\n// print(\"\\nJSON sent:\\n\");\n// print($fields);\n\n $ch = curl_init();\n curl_setopt($ch, CURLOPT_URL, \"https://onesignal.com/api/v1/notifications\");\n curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json; charset=utf-8',\n 'Authorization: Basic '.env('ONESIGNAL_API')));\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);\n curl_setopt($ch, CURLOPT_HEADER, FALSE);\n curl_setopt($ch, CURLOPT_POST, TRUE);\n curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);\n curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);\n\n $response = curl_exec($ch);\n curl_close($ch);\n\n return $response;\n }", "public function process()\n\t{\n\t\t$this->status = 1;\n\t\tif (($ip = \\App\\RequestUtil::getRemoteIP(true)) && ($blackList = \\App\\Mail\\Rbl::findIp($ip))) {\n\t\t\tforeach ($blackList as $row) {\n\t\t\t\tif (1 !== (int) $row['status'] && (\\App\\Mail\\Rbl::LIST_TYPE_BLACK_LIST === (int) $row['type']) || (\\App\\Mail\\Rbl::LIST_TYPE_PUBLIC_BLACK_LIST === (int) $row['type'])) {\n\t\t\t\t\t$this->status = 0;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (!$this->status) {\n\t\t\t\t$this->description = \\App\\Language::translate('LBL_BLACK_LIST_ALERT', 'OSSMail');\n\t\t\t}\n\t\t}\n\t}", "abstract public function accept(string $text): bool;", "public function isFinishSend(): bool;", "public function wasReceiver() {\n return $this->friend['uuidReceiver'] == $this->uuid;\n }" ]
[ "0.6195605", "0.6195605", "0.6195605", "0.6195605", "0.59890264", "0.57204306", "0.56514686", "0.56514686", "0.56456274", "0.5576791", "0.54758006", "0.5474054", "0.5439187", "0.5437542", "0.54011244", "0.5356302", "0.5345653", "0.53178", "0.53154445", "0.53024834", "0.5290654", "0.5272442", "0.5257334", "0.52509797", "0.5241194", "0.5235089", "0.52339315", "0.52203566", "0.5189859", "0.5188324", "0.5182508", "0.51756656", "0.5169873", "0.5166676", "0.5157744", "0.5155739", "0.51422936", "0.5130808", "0.5117963", "0.5113511", "0.5112859", "0.5089214", "0.5086682", "0.5076957", "0.50426054", "0.50355995", "0.5033395", "0.50326216", "0.5029578", "0.50166595", "0.50155634", "0.5013487", "0.4997406", "0.4995955", "0.49928612", "0.49665987", "0.49514934", "0.49397734", "0.49369186", "0.4936146", "0.4930918", "0.49302626", "0.49228668", "0.49028605", "0.48960266", "0.48960266", "0.48960266", "0.48960266", "0.48856995", "0.48769557", "0.4874955", "0.48734242", "0.4870882", "0.48666486", "0.48661673", "0.4865393", "0.48433408", "0.48368627", "0.48272562", "0.48267007", "0.48180294", "0.48117808", "0.4803504", "0.47872502", "0.47805804", "0.47742534", "0.47631928", "0.47615197", "0.47569096", "0.47533745", "0.47500497", "0.47485816", "0.47485352", "0.47479638", "0.47400886", "0.47307876", "0.4728982", "0.47273117", "0.4726878", "0.4718841", "0.4715054" ]
0.0
-1
Gets the supplied form submission data mapped to a dto.
public function mapFormSubmissionToDto(array $submission) { $formData = $this->getStagedForm()->process($submission); return new ObjectActionParameter( $formData[IObjectAction::OBJECT_FIELD_NAME], new ArrayDataObject($formData) ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getSubmissionData($submission_id, $form_id) {\n \n }", "public function getSubmissionData()\n {\n return $this->data;\n }", "public function getSubmissionData()\n {\n return $this->data;\n }", "public function getSubmissionData()\n {\n return $this->data;\n }", "public function getSubmissionData()\n {\n return $this->data;\n }", "public function get_data()\n {\n return $this->form_data;\n }", "public function getSubmissionData()\r\n {\r\n return $this->data;\r\n }", "public function getDto()\n {\n return $this->dto;\n }", "public function getSubmittedData()\n\t{\n\t\t//Check we have received the Formisimo tracking data from the submission\n\t\t$data = isset($this->data['formisimo-tracking'])\n\t\t\t? $this->data['formisimo-tracking']\n\t\t\t: array(); //Default to empty array\n\n\t\treturn ! is_array($data)\n\t\t\t? (array) json_decode($data, true) //cast array in case json_decode fails\n\t\t\t: $data; //Just return the array\n\t}", "public function getFormData()\n {\n return $this->form->getData();\n }", "public function getWebformSubmission() {\n return $this->submission;\n }", "public function getSubmission() {\n\t\t$submission = $this->getRequest()->param('ID');\n\t\t\n\t\tif ($submission) {\n\t\t\treturn SubmittedForm::get()->filter('uid', $submission)->First();\n\t\t}\n\n\t\treturn null;\n\t}", "public function submission()\n {\n return Submission::where('assignment_id', $this->attributes['id'])->where('user_id', Auth::user()->id)->first();\n }", "function submit($data, $form, $request) {\n\t\treturn $this->processForm($data, $form, $request, \"\");\n\t}", "function submit($data, $form, $request) {\n\t\treturn $this->processForm($data, $form, $request, \"\");\n\t}", "public function getFormData()\n {\n return $this->_getApi()->getFormFields($this->_getOrder(), $this->getRequest()->getParams());\n }", "public static function getPostData() {\n\n $DataObj = new stdClass();\n\n foreach ($_POST as $name => $value)\n $DataObj->$name = $value;\n\n return $DataObj;\n }", "public function getFormValues()\n {\n $validator = App::make(SubmitForm::class);\n return $validator->getSubmissions();\n }", "public function get_data() {\n $data = parent::get_data();\n\n if (!empty($data)) {\n $data->settings = $this->tool->form_build_settings($data);\n }\n\n return $data;\n }", "public function getFormEntry()\n {\n return $this->form->getEntry();\n }", "protected function getFormData() {\n\t\treturn $this->stripNonPrintables(json_decode($this->request->postVar('Details'), true));\n\t}", "function getSubmittedBy() {\n\t\treturn $this->data_array['submitted_by'];\n\t}", "function getSubmittedBy() {\n\t\treturn $this->data_array['submitted_by'];\n\t}", "function process($data, $form) {\n\t\t// submitted form object\n\t\t$submittedForm = new SubmittedForm();\n\t\t$submittedForm->SubmittedByID = ($id = Member::currentUserID()) ? $id : 0;\n\t\t$submittedForm->ParentID = $this->ID;\n\t\t$submittedForm->Recipient = $this->EmailTo;\n\t\tif(!$this->DisableSaveSubmissions) $submittedForm->write();\n\t\t\n\t\t// email values\n\t\t$values = array();\n\t\t$recipientAddresses = array();\n\t\t$sendCopy = false;\n $attachments = array();\n\n\t\t$submittedFields = new DataObjectSet();\n\t\t\n\t\tforeach($this->Fields() as $field) {\n\t\t\t// don't show fields that shouldn't be shown\n\t\t\tif(!$field->showInReports()) continue;\n\t\t\t\n\t\t\t$submittedField = $field->getSubmittedFormField();\n\t\t\t$submittedField->ParentID = $submittedForm->ID;\n\t\t\t$submittedField->Name = $field->Name;\n\t\t\t$submittedField->Title = $field->Title;\n\t\t\t\t\t\n\t\t\tif($field->hasMethod('getValueFromData')) {\n\t\t\t\t$submittedField->Value = $field->getValueFromData($data);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif(isset($data[$field->Name])) $submittedField->Value = $data[$field->Name];\n\t\t\t}\n\n\t\t\tif(!empty($data[$field->Name])){\n\t\t\t\tif(in_array(\"EditableFileField\", $field->getClassAncestry())) {\n\t\t\t\t\tif(isset($_FILES[$field->Name])) {\n\t\t\t\t\t\t\n\t\t\t\t\t\t// create the file from post data\n\t\t\t\t\t\t$upload = new Upload();\n\t\t\t\t\t\t$file = new File();\n\t\t\t\t\t\t$upload->loadIntoFile($_FILES[$field->Name], $file);\n\n\t\t\t\t\t\t// write file to form field\n\t\t\t\t\t\t$submittedField->UploadedFileID = $file->ID;\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Attach the file if its less than 1MB, provide a link if its over.\n\t\t\t\t\t\tif($file->getAbsoluteSize() < 1024*1024*1){\n\t\t\t\t\t\t\t$attachments[] = $file;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\t\t\t\t\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(!$this->DisableSaveSubmissions) $submittedField->write();\n\t\t\t\n\t\t\t$submittedFields->push($submittedField);\n\t\t}\t\n\t\t$emailData = array(\n\t\t\t\"Sender\" => Member::currentUser(),\n\t\t\t\"Fields\" => $submittedFields\n\t\t);\n\n\t\t// email users on submit. All have their own custom options. \n\t\tif($this->EmailRecipients()) {\n\t\t\t$email = new UserDefinedForm_SubmittedFormEmail($submittedFields); \n\t\t\t$email->populateTemplate($emailData);\n\t\t\tif($attachments){\n\t\t\t\tforeach($attachments as $file){\n\t\t\t\t\t// bug with double decorated fields, valid ones should have an ID.\n\t\t\t\t\tif($file->ID != 0) {\n\t\t\t\t\t\t$email->attachFile($file->Filename,$file->Filename, $file->getFileType());\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tforeach($this->EmailRecipients() as $recipient) {\n\t\t\t\t$email->populateTemplate($recipient);\n\t\t\t\t$email->populateTemplate($emailData);\n\t\t\t\t$email->setFrom($recipient->EmailFrom);\n\t\t\t\t$email->setBody($recipient->EmailBody);\n\t\t\t\t$email->setSubject($recipient->EmailSubject);\n\t\t\t\t$email->setTo($recipient->EmailAddress);\n\t\t\t\t\n\t\t\t\t// check to see if they are a dynamic sender. eg based on a email field a user selected\n\t\t\t\tif($recipient->SendEmailFromField()) {\n\t\t\t\t\t$submittedFormField = $submittedFields->find('Name', $recipient->SendEmailFromField()->Name);\n\t\t\t\t\tif($submittedFormField) {\n\t\t\t\t\t\t$email->setFrom($submittedFormField->Value);\t\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// check to see if they are a dynamic reciever eg based on a dropdown field a user selected\n\t\t\t\tif($recipient->SendEmailToField()) {\n\t\t\t\t\t$submittedFormField = $submittedFields->find('Name', $recipient->SendEmailToField()->Name);\n\t\t\t\t\t\n\t\t\t\t\tif($submittedFormField) {\n\t\t\t\t\t\t$email->setTo($submittedFormField->Value);\t\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif($recipient->SendPlain) {\n\t\t\t\t\t$body = strip_tags($recipient->EmailBody) . \"\\n \";\n\t\t\t\t\tif(isset($emailData['Fields']) && !$recipient->HideFormData) {\n\t\t\t\t\t\tforeach($emailData['Fields'] as $Field) {\n\t\t\t\t\t\t\t$body .= $Field->Title .' - '. $Field->Value .' \\n';\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t$email->setBody($body);\n\t\t\t\t\t$email->sendPlain();\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t$email->send();\t\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\t\n\t\treturn Director::redirect($this->Link() . 'finished?referrer=' . urlencode($data['Referrer']));\n\t}", "public function getDto()\r\n {\r\n $data = $this->toArray();\r\n\r\n $dto = new Pandamp_Modules_Misc_Poll_Dto();\r\n foreach ($data as $key => $value) {\r\n if (property_exists($dto, $key)) {\r\n $dto->$key = $value;\r\n }\r\n }\r\n\r\n return $dto;\r\n }", "protected function getWebformUserData(WebformSubmissionInterface $webform_submission) {\n $webform_data = $webform_submission->getData();\n $user_field_mapping = $this->configuration['user_field_mapping'];\n\n $user_field_data = [];\n foreach ($user_field_mapping as $webform_key => $user_field) {\n // Grab the value from the webform element and assign it to the correct\n // user field key.\n $user_field_data[$user_field] = $webform_data[$webform_key];\n }\n\n return $user_field_data;\n }", "public function get_post_data() {\n\t\treturn $this->post;\n\t}", "protected function loadFormData()\n {\n $data = JFactory::getApplication()->getUserState('com_labgeneagrogene.requests.data', array());\n\n if (empty($data)) {\n $id = JFactory::getApplication()->input->get('id');\n $data = $this->getData($id);\n }\n\n return $data;\n }", "public function getSubmission($form_id, $submission_id)\n {\n $db = Core::$db;\n\n // confirm the form is valid\n if (!Forms::checkFormExists($form_id)) {\n return self::processError(405);\n }\n\n if (!is_numeric($submission_id)) {\n return self::processError(406);\n }\n\n // get the form submission info\n $db->query(\"\n SELECT *\n FROM {PREFIX}form_{$form_id}\n WHERE submission_id = :submission_id\n \");\n $db->bind(\"submission_id\", $submission_id);\n $db->execute();\n\n return $db->fetch();\n }", "public function getFormData()\n {\n $data = $this->getData('form_data');\n if ($data === null) {\n $formData = $this->_customerSession->getCustomerFormData(true);\n $data = new \\Magento\\Framework\\DataObject();\n if ($formData) {\n $data->addData($formData);\n $linkedinProfile = ['linkedin_profile' => $this->_customerSession->getLinkedinProfile()];\n $data->addData($linkedinProfile);\n $data->setCustomerData(1);\n }\n if (isset($data['region_id'])) {\n $data['region_id'] = (int)$data['region_id'];\n }\n $this->setData('form_data', $data);\n }\n return $data;\n }", "public function getData()\n {\n return Post::find(request()->id);\n }", "protected function loadFormData()\n\t{\n\t\t// Check the session for previously entered form data.\n\t\t$data = JFactory::getApplication()->getUserState('com_projectfork.edit.project.data', array());\n\n\t\tif(empty($data)) $data = $this->getItem();\n\n\t\treturn $data;\n\t}", "public function getDataObject()\r\n {\r\n return $this->getElement()->getForm()->getDataObject();\r\n }", "public function getData()\n\t{\n if ( is_string($this->_data) ) {\n return $this->_data; \n }\n\t\telse \n return $this->_internal_request->to_postdata();\n\t}", "public function get_submitted_values_for_step_parameters() {\n $report = $this->workflow->get_report_instance();\n $report->require_dependencies();\n $report->init_filter($report->id);\n $filters = $report->get_filters();\n //Check for report filter\n if (isset($report->filter)) {\n $report_filter = $report->filter;\n } else {\n $report_filter = null;\n }\n $form = new scheduling_form_step_parameters(null, array('page' => $this, 'filterobject' => $report_filter));\n\n $data = $form->get_data(false);\n // get rid of irrelevant data\n unset($data->MAX_FILE_SIZE);\n unset($data->_wfid);\n unset($data->_step);\n unset($data->action);\n unset($data->_next_step);\n\n if (isset($report_filter) && isset($data)) {\n // Remove any false parameters\n $parameters = $data;\n\n // Use this object to find our parameter settings\n $filter_object = $report_filter;\n $filter_object_fields = $filter_object->_fields;\n // Merge in any secondary filterings here...\n if (isset($filter_object->secondary_filterings)) {\n foreach ($filter_object->secondary_filterings as $key => $secondary_filtering) {\n $filter_object_fields = array_merge($filter_object_fields, $secondary_filtering->_fields);\n }\n }\n\n if (!empty($filter_object_fields)) {\n $fields = $filter_object_fields;\n foreach($filter_object_fields as $fname=>$field) {\n $sub_data = $field->check_data($parameters);\n if ($sub_data === false) {\n // unset any filter that comes back from check_data as false\n unset($data->$fname);\n }\n }\n }\n }\n return $data;\n }", "public function getForm(object $parameters, object $data, object $headers): object\n {\n $this->checkParameters(['uuid'], $parameters);\n\n // Get form from DB\n $data->form = Form::whereUuid($parameters->uuid)->with('template', 'state')->first();\n\n return $data;\n }", "public function getObject() {\n return $this->form->getObject();\n }", "protected function loadFormData() \r\n\t{\r\n\t\t// Check the session for previously entered form data.\r\n\t\t$data = JFactory::getApplication()->getUserState('com_ktbtracker.edit.' . $this->getName() . '.data', array());\r\n\t\t\r\n\t\t// Attempt to get the record from the database\r\n\t\tif (empty($data)) {\r\n\t\t\t$data = $this->getItem();\r\n\t\t}\r\n\t\t\r\n\t\treturn $data;\r\n\t}", "public function get_post_data() {\n\t\tforeach($this->form_fields as $form_field_key => $form_field_value) {\n\t\t\tif ($form_field_value['type'] == \"select_card_types\") {\n\t\t\t\t$form_field_key_select_card_types = $this->plugin_id . $this->id . \"_\" . $form_field_key;\n\t\t\t\t$select_card_types_values = array();\n\t\t\t\t$_POST[$form_field_key_select_card_types] = $select_card_types_values;\n\t\t\t}\n\t\t}\n\n\t\tif ( ! empty( $this->data ) && is_array( $this->data ) ) {\n\t\t\treturn $this->data;\n\t\t}\n\t\treturn $_POST;\n\t}", "public function getFormdata() {\n $formdata = array();\n\n foreach($this->elements as $element) {\n $key = $element['object']->getName();\n $value = $element['object']->getSubmittedValue();\n\n $formdata[$key] = $value;\n }\n\n return $formdata;\n }", "public function getPost()\n {\n $request = $this->getRequest();\n return $request->getPost();\n }", "public function getSubmittedValue();", "public function getSubmittedValue();", "public function get()\n {\n $object = $this->_object;\n $this->_object = $this->_form;\n return $object;\n }", "private function getFormisimoData()\n\t{\n\t\t//Get the data submitted by the tracking widget script\n\t\t$submitted = $this->getSubmittedData();\n\n\t\t/*\n\t\t * We flip the required array so we can compare\n\t\t * keys with the submitted data keys.\n\t\t */\n\t\t$required = array_flip($this->required);\n\n\t\t/*\n\t\t * Check whether the submitted data contains all of the required data.\n\t\t * The $diff will let us know data is missing.\n\t\t */\n\t\t$diff = array_diff_key($required, $submitted);\n\n\t\t/*\n\t\t * If difference is not empty then we are missing some of the\n\t\t * required data so stop execution and log the submitted data so we can debug.\n\t\t */\n\t\tif ( ! empty($diff))\n\t\t{\n\t\t\tthrow new Exception('Required Data Missing. Data: ' . json_encode($submitted));\n\t\t}\n\n\t\t/*\n\t\t * Just to be safe we will remove any extra data included\n\t\t * in the submitted data that is not required. This is an extra\n\t\t * security measure to ensure we are not accidently passing any rogue\n\t\t * data through to Formisimo\n\t\t */\n\t\t$data = array_intersect_key($submitted, $required);\n\n\t\t/*\n\t\t * Add the conversion key to the data\n\t\t * as Formisimo do in their conversion script\n\t\t */\n\t\t$data['conversion'] = true;\n\t\treturn $data;\n\t}", "protected function loadFormData() \n\t{\n\t\t$data = JFactory::getApplication()->getUserState('com_squadmanagement.edit.war.data', array());\n\t\tif (empty($data)) \n\t\t{\n\t\t\t$data = $this->getItem();\n\t\t}\n\t\treturn $data;\n\t}", "protected function loadFormData() {\n $data = $this->getData();\n\n return $data;\n }", "function getData($data = null){\r\n\t\treturn $this->fields->getData($data);\r\n\t}", "protected function loadFormData() \r\n\t{\r\n\t\t// Check the session for previously entered form data.\r\n\t\t$data = JFactory::getApplication()->getUserState('com_bigbluebutton.edit.meeting.data', array());\r\n\r\n\t\tif (empty($data))\r\n\t\t{\r\n\t\t\t$data = $this->getItem();\r\n\t\t}\r\n\r\n\t\treturn $data;\r\n\t}", "function getFormData($data, $include_dynamic=false)\n {\n $static_mapped_form_fields = $this->getMappedFormFields($include_dynamic); // get non-dynamic form fields\n $unique_data = array_intersect_key((array)$data, array_flip($static_mapped_form_fields));\n return $unique_data;\n }", "public function getSubmissionArray($submission, $form) {\n $form_fields = $this->CI->form_m->getFormFields($form->form_id);\n// preVarDump($form_fields);\n foreach ($form_fields as $key => $field) {\n if ($field->field_type == 'textbox' || $field->field_type == 'textarea' || $field->field_type == 'datepicker') {\n $return_array[] = array(\n 'label' => $field->field_label,\n 'value' => $submission[$field->field_name],\n );\n } else if ($field->field_type == 'radios' || $field->field_type == 'checkboxes' || $field->field_type == 'select') {\n foreach ($field->options as $option) {\n if ($option->option_value == $submission[$field->field_name]) {\n $return_array[] = array(\n 'label' => $field->field_label,\n 'value' => $option->option_name,\n );\n }\n }\n }\n }\n \n \n\n return $return_array;\n }", "private function get_submitters_data()\n {\n $publication = DataManager::retrieve_by_id(\n ContentObjectPublication::class_name(), \n $this->get_publication_id());\n \n // Users\n $this->users = DataManager::get_publication_target_users_by_publication_id(\n $this->get_publication_id());\n // Course groups\n $this->course_groups = DataManager::retrieve_publication_target_course_groups(\n $this->get_publication_id(), \n $publication->get_course_id())->as_array();\n // Platform groups\n $this->platform_groups = DataManager::retrieve_publication_target_platform_groups(\n $this->get_publication_id(), \n $publication->get_course_id())->as_array();\n }", "protected function getCreateFeeDtoData($formData)\n {\n return [\n 'invoicedDate' => $formData['fee-details']['createdDate'],\n 'feeType' => $formData['fee-details']['feeType'],\n 'licence' => $this->params()->fromRoute('licence'),\n 'busReg' => $this->params()->fromRoute('busRegId'),\n ];\n }", "function getFromPost() {\r\n\t\t\r\n\t\t//Event Page variables.\r\n\t\t$this->name = $_POST['eventName'];\r\n\t\t$this->date = $_POST['eventDate'];\r\n\t\t$this->time = $_POST['eventTime'];\r\n\t\t$this->time_before = $_POST['time_before'];\r\n\t\t$this->freq = $_POST['frequency'];\r\n\t\t$this->notif_method = $_POST['method'];\r\n\t}", "protected function loadFormData()\n\t{\n\t\t// Check the session for previously entered form data.\n\t\t$data = JFactory::getApplication()->getUserState('com_solidres.edit.tariff.data', array());\n\n\t\tif (empty($data))\n {\n\t\t\t$data = $this->getItem();\n\t\t}\n\n\t\treturn $data;\n\t}", "public function user_submission_data($submission_id){\n $this->db->select('user_form_info_text.user_form_info_text_id,user_form_info_text.form_field_id')\n ->from('user_form_info_text user_form_info_text')\n ->where('user_form_info_text.submission_id',$submission_id);\n $res = $this->db->get();\n return $res->result_array();\n }", "public function getRespectSubmittedDataValue() {}", "function get_post_data() {\n\t\tif (empty($this->post)) :\n\t\t\t$this->post = get_post( $this->id );\n\t\tendif;\n\t\t\n\t\treturn $this->post;\n\t}", "function fetchFormSubmissions ($formId, $field_mappings) {\n global $wpdb;\n $table_name = $wpdb->prefix . \"dx_forms_data\";\n $dbResults = $wpdb->get_results( \"SELECT * FROM $table_name WHERE form_id = '$formId'\" );\n \n // loop through all form submissions (i.e., messages)\n foreach ($dbResults as $row) {\n // pretty print date\n echo date(\"F j, Y. g:i A\",strtotime($row->timestamp));\n echo \"<br>\";\n \n // print form data in \"field : value\" format\n $formData = json_decode($row->data);\n foreach ($formData as $column => $value) {\n // ignore if field is left blank by user\n if (!$value) {\n continue;\n }\n // column name is fetched from field mappings; else marked as \"missing\"\n $column_name = isset($field_mappings[$column]) ? $field_mappings[$column] : '<em>(missing field name)</em>';\n echo($column_name . \" : \" . $value . \"<br>\");\n }\n\n echo \"<hr>\";\n }\n }", "protected function loadFormData() {\r\n\t\t// Check the session for previously entered form data.\r\n\t\t$data = JFactory::getApplication()->getUserState('com_flexicontent.edit.'.$this->getName().'.data', array());\r\n\r\n\t\tif (empty($data)) {\r\n\t\t\t$data = $this->getItem();\r\n\t\t}\r\n\r\n\t\treturn $data;\r\n\t}", "public function WidgetSubmissionForm()\n {\n $formSectionData = new DataObject();\n $formSectionData->Form = $this->AddForm($this->extensionType);\n $formSectionData->Content = $this->dataRecord->AddContent;\n return $formSectionData;\n }", "public function formdata()\n {\n return Formdata::getinstance();\n }", "public function getData()\n {\n return $this->validator->getData();\n }", "protected function loadFormData()\n\t\t{\n\t\t\t\t// Check the session for previously entered form data.\n\t\t\t\t$data = JFactory::getApplication()->getUserState('com_helloworld.edit.' . $this->context . '.data', array());\n\t\t\t\tif (empty($data))\n\t\t\t\t{\n\t\t\t\t\t\t$data = $this->getItem();\n\t\t\t\t}\n\t\t\t\treturn $data;\n\t\t}", "protected function getFeeTypeDtoData()\n {\n return [\n 'busReg' => $this->getFromRoute('busRegId'),\n 'licence' => $this->params()->fromRoute('licence')\n ];\n }", "public function get_df() {\n return \\mod_dataform_dataform::instance($this->dataid);\n }", "protected function loadFormData()\n\t{\n\t\t$data = $this->getData(); \n \n return $data;\n\t}", "function getFromPost()\r\n {\r\n $CI = &get_instance();\r\n $note = new Note;\r\n //correct form?\r\n if ($CI->input->post('formname')!='note') {\r\n return null;\r\n }\r\n //get basic data\r\n $note->note_id = $CI->input->post('note_id');\r\n $note->text = $CI->input->post('text');\r\n $note->pub_id = $CI->input->post('pub_id');\r\n $note->user_id = $CI->input->post('user_id');\r\n\r\n return $note;\r\n }", "protected function loadFormData(){\n\t\t\n\t\t// Check the session for previously entered form data.\n\t\t$data = JFactory::getApplication()->getUserState('com_egoi.edit.egoi.data', array());\n\t\tif (empty($data)) {\n\t\t\t$data = $this->getItem();\n\t\t}\n\n\t\treturn $data;\n\t}", "public function getFormValues()\n {\n return array(\n 'title' => $this->issue['subject'],\n 'reference' => $this->issue['id'],\n 'date_started' => $this->issue['start_date'],\n 'description' => $this->issue['description']\n );\n }", "protected function loadFormData()\n\t{\n\t\t$data = $this->getData();\n\n\t\t$this->preprocessData('com_volunteers.registration', $data);\n\n\t\treturn $data;\n\t}", "protected function loadFormData()\n\t{\n\t\t$data = JFactory::getApplication()->getUserState('com_judges.edit.judge.data', array());\n\n\t\tif (empty($data)) {\n\t\t\t$data \t\t\t\t\t\t= $this->getItem();\n\t\t}\n\n\t\treturn $data;\n\t}", "public static function mapFromForm(array $data)\n {\n if (isset($data['exception-details']['teamOrUser']) && $data['exception-details']['teamOrUser'] === 'user') {\n $commandData = [\n 'user' => $data['user-printer']['user'],\n 'subCategory' => $data['user-printer']['subCategoryUser'],\n 'printer' => $data['user-printer']['printer']\n ];\n } else {\n $commandData = [\n 'subCategory' => $data['team-printer']['subCategoryTeam'],\n 'printer' => $data['team-printer']['printer']\n ];\n }\n if (isset($data['exception-details']['id'])) {\n $commandData['id'] = $data['exception-details']['id'];\n $commandData['version'] = $data['exception-details']['version'];\n }\n if (isset($data['exception-details']['team'])) {\n $commandData['team'] = $data['exception-details']['team'];\n }\n return $commandData;\n }", "public function getPostSubmission() {\n\t\treturn ($this->postSubmission);\n\t}", "public function get($form_id) {\n if ($response = $this->podio->request('/form/'.$form_id)) {\n return json_decode($response->getBody(), TRUE);\n }\n }", "protected function loadFormData()\n\t{\n\t\t// get data which the user previously entered into the form\n\t\t// the context 'com_u3abooking.edit.booking.data' is set in FormController\n\t\t$data = Factory::getApplication()->getUserState(\n\t\t\t'com_u3abooking.edit.booking.data',\n\t\t\tarray()\n\t\t);\n\t\tif (empty($data))\n\t\t{\n\t\t\t$data = $this->getItem();\n\t\t}\n\n\t\treturn $data;\n\t}", "public function getDatasetSubmission(): ?DatasetSubmission\n {\n return $this->datasetSubmission;\n }", "public function retrieveFormFields()\n {\n return $this->start()->uri(\"/api/form/field\")\n ->get()\n ->go();\n }", "public function getSubmission()\n {\n $input = Input::all();\n $submissionId = isset($input['submissionId']) ? $input['submissionId'] : '';\n $pvsId = isset($input['pvsId']) ? $input['pvsId'] : '-1';\n\n if ($submissionId && $pvsId) {\n\n // Return a 200 with dummy json content\n $data = $this->getData();\n $status = 200;\n\n return (new Response($data, $status))->header('Content-Type', 'application/json');\n\n } else {\n\n // Return a 400 error\n $status = 400;\n $data = ['description' => 'Missing parameter'];\n\n return (new Response($data, $status))->header('Content-Type', 'application/json');\n }\n }", "public function getData()\n\t{\n\t\treturn $this->value ? $this->value : $this->input;\n\t}", "protected function loadFormData()\n\t{\n\t\t// Check the session for previously entered form data.\n\t\t$data = JFactory::getApplication()->getUserState('com_joaktree.edit.location.data', array());\n\n\t\tif (empty($data)) {\t\t\n\t\t\t$data = $this->getItem();\n\t\t\t$data->resultValue2 = $data->resultValue;\n\t\t}\n\n\t\treturn $data;\n\t}", "public function get_data($method=\"POST\", $exclude=NULL)\n {\n if ($method == 'POST')\n {\n foreach(get_object_vars($this) as $name => $obj) \n {\n if ($obj != NULL) \n {\n #corregir para agregar esclusiones\n #if (!in_array($obj->name, $exclude) AND isset($_POST[$obj->name]))\n if (isset($_POST[$obj->name]))\n {\n $obj->value = $_POST[$obj->name];\n }\n }\n } \n } \n else #get \n {\n\n }\n\n }", "public function getFormInObject()\n {\n $sExKey = null;\n\n if ($this->_iIdEntity > 0 && $this->_sSynchronizeEntity !== null && count($_POST) < 1) {\n\n $sModelName = str_replace('Entity', 'Model', $this->_sSynchronizeEntity);\n $oModel = new $sModelName;\n\n $oEntity = new $this->_sSynchronizeEntity;\n $sPrimaryKey = LibEntity::getPrimaryKeyNameWithoutMapping($oEntity);\n $sMethodName = 'findOneBy'.$sPrimaryKey;\n $oCompleteEntity = call_user_func_array(array(&$oModel, $sMethodName), array($this->_iIdEntity));\n\n if (is_object($oCompleteEntity)) {\n\n foreach ($this->_aElement as $sKey => $sValue) {\n\n\t\t\t\t\tif ($sValue instanceof \\Venus\\lib\\Form\\Input && $sValue->getType() == 'submit') {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t\n if ($sValue instanceof \\Venus\\lib\\Form\\Radio) {\n\n $sExKey = $sKey;\n $sKey = substr($sKey, 0, -6);\n }\n\n if ($sValue instanceof Form) {\n\n ;\n } else {\n\n $sMethodNameInEntity = 'get_'.$sKey;\n\t\t\t\t\t\tif (method_exists($oCompleteEntity, $sMethodNameInEntity)) {\n\t\t\t\t\t\t\t$mValue = $oCompleteEntity->$sMethodNameInEntity();\n\t\t\t\t\t\t}\n\n if ($sValue instanceof \\Venus\\lib\\Form\\Radio && method_exists($this->_aElement[$sExKey], 'setValueChecked')) {\n\n $this->_aElement[$sExKey]->setValueChecked($mValue);\n } else if (isset($mValue) && method_exists($this->_aElement[$sKey], 'setValue')) {\n\n $this->_aElement[$sKey]->setValue($mValue);\n }\n }\n }\n }\n }\n\n $oForm = new \\StdClass();\n $oForm->start = '<form name=\"form'.$this->_iFormNumber.'\" method=\"post\" enctype=\"multipart/form-data\"><input type=\"hidden\" value=\"1\" name=\"validform'.$this->_iFormNumber.'\">';\n $oForm->form = array();\n\n foreach ($this->_aElement as $sKey => $sValue) {\n\n if ($sValue instanceof Container) {\n\n $oForm->form[$sKey] = $sValue;\n } else {\n\n $oForm->form[$sKey] = $sValue->fetch();\n }\n }\n\n $oForm->end = '</form>';\n\n return $oForm;\n }", "public function getPostFields()\n {\n return $this->invokeWrappedIfEntityEnclosed(__FUNCTION__, func_get_args());\n }", "protected function getPostData(Request $request) {\n\t\tif (!isset($this->postData)) {\n\t\t\t$body = $request->Body;\n\t\t\t/** @var array $postVars */\n\t\t\t$postVars = $request->Post();\n\n\t\t\tif (isset($postVars['model'])) {\n\t\t\t\t$this->postData = json_decode($postVars['model'], true);\n\t\t\t} elseif (!empty($postVars)) {\n\t\t\t\t$this->postData = $postVars;\n\t\t\t} elseif (strlen($body) > 0) {\n\t\t\t\t$this->postData = json_decode($body, true);\n\t\t\t} else {\n\t\t\t\t$this->postData = [];\n\t\t\t}\n\t\t}\n\t\treturn $this->postData;\n\t}", "private function getCommentSessionValuesFromForm()\n {\n $comment = [\n 'content' => $this->request->getPost('content'),\n 'name' => $this->request->getPost('name'),\n 'web' => $this->request->getPost('web'),\n 'mail' => $this->request->getPost('mail'),\n 'timestamp' => time(),\n 'ip' => $this->request->getServer('REMOTE_ADDR'),\n 'id' => $this->request->getPost('id'),\n 'gravatar' => 'http://www.gravatar.com/avatar/' . md5(strtolower(trim($this->request->getPost('mail')))) . '.jpg',\n 'pageKey' => $this->request->getPost('pageKey'),\n ];\n return $comment;\n }", "protected function loadFormData() {\n\t\t// Check the session for previously entered form data.\n\t\t$data = JFactory::getApplication()->getUserState('com_cp.edit.cptourismtype.data', array());\n\n\t\tif (empty($data)) {\n\t\t\t$data = $this->getItem();\n\t\t}\n\n\t\treturn $data;\n\t}", "public function get_submitted_edit_form_data()\n\t{\n\t\t$this->credits = $_POST['credits'];\n\t\t$this->levelID = $_POST['level'];\t\n\t}", "public function toFormData()\n {\n $data = $this->toArray();\n return $data;\n }", "public function toFormData()\n {\n $data = $this->toArray();\n return $data;\n }", "public function getFormData()\n {\n return $_POST;\n }", "protected function loadFormData(){\n // Check the session for previously entered form data.\n $data = JFactory::getApplication()->getUserState($this->option.'.edit.profile.data', array());\n \n if(empty($data)){\n $data = $this->getItem();\n }\n \n return $data;\n }", "public function getFormInput()\n {\n $values = $this->getFormValues();\n\n return $values->all();\n }", "public function getPostData() {\n \t\n \t// Return POST\n \treturn $this->oPostData;\n }", "protected function loadFormData() {\n // Check the session for previously entered form data.\n $data = JFactory::getApplication()->getUserState('com_easysdi_processing.edit.order.data', array());\n\n if (empty($data)) {\n $data = $this->getItem();\n }\n\n return $data;\n }", "public function transform(DTO $dto)\n {\n return [\n 'order_number' => $this->formatter->format(\n Formatter::FIELDSET_ORDER,\n 'order_number',\n $dto->getOrder()->getIncrementId()\n ),\n 'order_date' => $this->formatter->format(\n Formatter::FIELDSET_ORDER,\n 'order_date',\n $dto->getOrder()->getCreatedAt()\n ),\n 'status' => $this->formatter->format(\n Formatter::FIELDSET_ORDER,\n 'status',\n $this->getOrderStatus($dto->getOrder())\n ),\n 'currency_code' => $this->formatter->format(\n Formatter::FIELDSET_ORDER,\n 'currency_code',\n $dto->getOrder()->getOrderCurrencyCode()\n ),\n 'is_shoprunner_eligible' => $this->getAttributeValue(\n Formatter::FIELDSET_ORDER,\n $this->configAttributes->getAttrShopRunnerEligible(),\n $dto,\n null,\n 'is_shoprunner_eligible'\n )\n ];\n }", "protected function loadFormData()\n {\n // Check the session for previously entered form data.\n $app = JFactory::getApplication();\n $data = $app->getUserState('com_jtransport.config.data', array());\n\n if (empty($data))\n {\n $data = $this->getItem();\n }\n\n return $data;\n }", "public function getPostRequest(): ParameterBag { return $this->post; }", "protected function loadFormData()\n {\n $data = $this->getData();\n $this->preprocessData('com_ketshop.registration', $data);\n\n return $data;\n }", "private function getPostData() {\n\t\t$data = null;\n\t\t\n\t\t// Get from the POST global first\n\t\tif (empty($_POST)) {\n\t\t\t// For API calls we need to look at php://input\n\t\t\tif (!empty(file_get_contents('php://input'))) {\n\t\t\t\t$data = @json_decode(file_get_contents('php://input'), true);\n\t\t\t\tif ($data === false || $data === null) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\t//TODO: What is this for? isn't 'php://input' always empty at this point?\n\t\t\t\t$dataStr = file_get_contents('php://input');\n\t\t\t\tparse_str($dataStr, $data);\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t$data = $_POST;\n\t\t}\n\t\t\n\t\t// Normalize boolean values\n\t\tforeach ($data as $name => &$value) {\n\t\t\tif ($value === 'true') {\n\t\t\t\t$value = true;\n\t\t\t}\n\t\t\telse if ($value === 'false') {\n\t\t\t\t$value = false;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn $data;\n\t}" ]
[ "0.6403062", "0.6137485", "0.6137485", "0.6137485", "0.6137485", "0.6114024", "0.6100388", "0.60034484", "0.5717522", "0.56829906", "0.56637377", "0.5591791", "0.55847156", "0.5516104", "0.5516104", "0.5483597", "0.5465517", "0.5428606", "0.54221725", "0.5412459", "0.5406923", "0.5390214", "0.5390214", "0.5380567", "0.5380172", "0.5354156", "0.53481704", "0.5342069", "0.53295344", "0.5319742", "0.5310289", "0.52885336", "0.52786434", "0.527539", "0.52682805", "0.5263219", "0.525091", "0.52278656", "0.52157295", "0.52066493", "0.5198891", "0.51772606", "0.51772606", "0.5165044", "0.5162984", "0.51507294", "0.51448584", "0.5140748", "0.5129419", "0.51235145", "0.5102558", "0.5098865", "0.50837636", "0.5080714", "0.5077767", "0.5068209", "0.5065731", "0.5057302", "0.504084", "0.5038414", "0.5036953", "0.50347286", "0.50293446", "0.50151956", "0.50091505", "0.50052035", "0.50049305", "0.49945396", "0.49906704", "0.49883327", "0.49580362", "0.49535307", "0.49442765", "0.4939222", "0.4938255", "0.49330586", "0.4924294", "0.49154878", "0.49087048", "0.4905442", "0.49019653", "0.4899658", "0.48803008", "0.48756424", "0.48745716", "0.48704585", "0.48624328", "0.48568144", "0.4852743", "0.4852743", "0.48506033", "0.48411798", "0.48367918", "0.48343784", "0.4828419", "0.48073262", "0.480367", "0.48007303", "0.4800079", "0.47911054" ]
0.62813884
1
Get all the inputs.
public function postRegisterUser() { $userdata = array( 'fullname' => Input::get('fullname'), 'email' => Input::get('email'), 'password' => Input::get('password') ); // Declare the rules for the form validation. $rules = array( 'fullname' => 'Required', 'email' => 'Required', 'password' => 'Required' ); // Validate the inputs. $validator = Validator::make($userdata, $rules); // Check if the form validates with success. if ($validator->passes()) { $user = User::where('email' , '=', $userdata['email'])->first(); if($user == null) { $user = new User; $user->fullname = $userdata['fullname']; $user->email = $userdata['email']; $user->password = Hash::make($userdata['password']); $user->save(); if ( Auth::attempt($userdata ) ) { return Redirect::to(''); } } else { return Redirect::to('register')->withErrors(array('email' => 'Email already has an account'))->withInput(Input::except('password')); } } //something went wrong return Redirect::to('register')->withErrors($validator)->withInput(Input::except('password')); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getInputs()\n {\n return $this->inputs;\n }", "public function getInputs()\n {\n return array();\n }", "protected function inputs()\n {\n return [];\n }", "public function inputs()\n {\n return $this->inputs;\n }", "public function getInputs()\r\n {\r\n $this->inputs = $this->getReflection('inputs');\r\n }", "public function inputs();", "public function getInputsArray()\n\t{\n\t return $this->arrInputs;\n\t}", "protected function getInputs(Request $request)\n {\n $inputs = $request->all();\n return $inputs;\n }", "public function getInputValues()\n {\n return $this->input_values;\n }", "public function all(): array\n {\n return $this->getInputSource()->all() + $this->query->all();\n }", "public function getInputValues();", "abstract protected function inputs(): array;", "public function input()\n\t{\n\t\treturn $this->parameters;\n\t}", "public function all()\r\n {\r\n return $this->parameters;\r\n }", "public function getInputs($asString = false);", "public function getArray() : array {\n\t\treturn $this->input;\n\t}", "public function getInputFields() {\n\t\treturn $this->inputFields;\n\t}", "public static function getInputs(?ModelInterface $model = null): array;", "public static function all()\n {\n return $_REQUEST;\n }", "public static function all(): array\n\t{\n\t\treturn $_REQUEST;\n\t}", "public function all()\n {\n return $this->params;\n }", "private function getAllInputParameters () {\n// \t\t$params = $this->getInputParameters();\n\t\t$params = array();\n\t\t$catalogId = $this->session->getCourseCatalogId();\n\t\tif (!$catalogId->isEqual($this->session->getCombinedCatalogId()))\n\t\t\t$params[':catalog_id'] = $this->session->getCatalogDatabaseId($catalogId);\n\t\t\n\t\t$params[':subj_code'] = $this->session->getSubjectFromCourseId($this->courseId);\n\t\t$params[':crse_numb'] = $this->session->getNumberFromCourseId($this->courseId);\n\t\t\n\t\treturn $params;\n\t}", "public function get_input()\n {\n }", "public static function get_input_fields()\n {\n }", "public static function get_input_fields()\n {\n }", "public static function get_input_fields()\n {\n }", "public static function get_input_fields()\n {\n }", "public static function get_input_fields()\n {\n }", "public static function get_input_fields()\n {\n }", "public static function get_input_fields()\n {\n }", "public static function get_input_fields()\n {\n }", "public static function get_input_fields()\n {\n }", "public static function get_input_fields()\n {\n }", "public static function get_input_fields()\n {\n }", "public static function get_input_fields()\n {\n }", "public static function get_input_fields()\n {\n }", "function getParameters() {\n\t\treturn $this->inputParameters;\n\t}", "public function getFormInput()\n {\n $values = $this->getFormValues();\n\n return $values->all();\n }", "public static function all() {\n\t\tswitch($_SERVER['REQUEST_METHOD']) {\n\t\t\tcase 'GET':\n\t\t\t\treturn $_GET;\n\t\t\t\tbreak;\n\n\t\t\tcase 'POST':\n\t\t\t\treturn $_POST;\n\t\t\t\tbreak;\n\n\t\t\tcase 'PUT':\n\t\t\tcase 'DELETE':\n\t\t\t\treturn static::getInputVars();\n\t\t\t\tbreak;\n\t\t}\n\t}", "public function getInputIndexes()\n {\n return $this->input_indexes;\n }", "public static function getRegisterInputs()\n\t{\n\t\treturn Input::newCollection([\n\t\t\t['login', 'Login', 'text'],\n\t\t\t['password', 'Password', 'password']\n\t\t]);\n\t}", "public function getValues(): array\n {\n $values = [];\n foreach ($this->getInputNames() as $name) {\n $values[$name] = $this->$name;\n }\n return $values;\n }", "protected function inputSources()\n {\n if ($this->allowMultipleSources) {\n $sources = $this->sources;\n } else {\n $sources = [$this->source];\n }\n\n return $sources;\n }", "public function getGetValues()\n {\n // Define the check for params\n $get_check_array = array(\n // Action\n 'action' => array('filter' => FILTER_SANITIZE_STRING),\n // Id of current row\n 'vraagId' => array('filter' => FILTER_VALIDATE_INT)\n );\n // Get filtered input:\n $inputs = filter_input_array(INPUT_GET, $get_check_array);\n // RTS\n return $inputs;\n }", "public function getInputData()\n {\n return array_only($this->inputData, [\n 'title', 'description', 'tags', 'categories', 'code'\n ]);\n }", "public function getFormInputs($table = null)\n {\n return (null == $table)? $this->forminputs : $this->forminputs[$table];\n }", "function getInputValues();", "public function getInputPaths ()\n {\n return $this->paths;\n }", "function getRawInputValues();", "public function getUserInputs(array $inputs) : array\n {\n return $this->inputs = $inputs;\n }", "public function all(): array;", "public function all(): array;", "public function all(): array;", "public function all(): array;", "public function all(): array;", "public function all(): array;", "public function all(): array;", "public function all(): array;", "public function all(): array;", "public function all(): array;", "public function all(): array;", "public function all(): array;", "public function all(): array;", "public function all(): array;", "public function all(): array;", "public function all(): array;", "public static function getInput(){\n $inputs = [];\n\n if ($_SERVER['REQUEST_METHOD'] == 'POST'){\n\n $args = [\n 'wpmg' => [\n 'filter' => FILTER_SANITIZE_STRING,\n 'flags' => FILTER_REQUIRE_ARRAY\n ]\n ];\n\n $inputs = filter_input_array(INPUT_POST, $args);\n }\n\n if ($_SERVER['REQUEST_METHOD'] == 'GET'){\n $inputs['pg'] = filter_input(INPUT_GET, 'pg', FILTER_VALIDATE_INT);\n\n\n $tax_type = get_query_var('wpmg_tax_type');\n $tax_value = get_query_var('wpmg_tax_value');\n\n if($tax_type && $tax_value){\n $inputs['wpmg']['tax'][$tax_type] = $tax_value;\n }\n\n\n }\n\n\n return $inputs;\n }", "private static function getRawInputs(): array\n {\n $inputParams = [];\n\n if (in_array(self::$__method, ['PUT', 'PATCH', 'DELETE'])) {\n\n $input = file_get_contents('php://input');\n\n if (self::$server->contentType()) {\n switch (self::$server->contentType()) {\n case 'application/x-www-form-urlencoded':\n parse_str($input, $inputParams);\n break;\n case 'application/json':\n $inputParams = json_decode($input);\n break;\n default :\n $inputParams = parse_raw_http_request($input);\n break;\n }\n }\n }\n\n return (array) $inputParams;\n }", "public function all(){\n return call_user_func_array($this->fetchStaticClassName() . '::' . __FUNCTION__, func_get_args());\n }", "public static function allGet()\n {\n try {\n $form = [];\n foreach ($_GET as $name => $value) {\n $form[htmlspecialchars($name)] = htmlspecialchars($value);\n }\n return $form;\n } catch (Exception $e) {\n die($e);\n }\n }", "function getServiceInputs() {\n $res = $this->db->where('deleted', 0)->order_by('nome', 'ASC')->get('insumos');\n return $res->result();\n }", "public function getInputList()\n {\n return [\n new InputArgument(\n self::SMS_PHONE_NUMBER,\n InputArgument::REQUIRED,\n 'SMS telephone number'\n ),\n new InputArgument(\n self::SMS_TEXT_MESSGAE,\n InputArgument::REQUIRED,\n 'SMS text message'\n )\n ];\n }", "protected function inputData() : array\n {\n return factory(Employee::class)->make()\n ->makeVisible('password')\n ->toArray();\n }", "public static function getLoginInputs()\n\t{\n\t\treturn Input::newCollection([\n\t\t\t['login', 'login', 'text'],\n\t\t\t['password', 'password', 'password']\n\t\t]);\n\t}", "public function all(): array\n {\n return array_merge(\n $this->post->all(),\n $this->query->all(),\n $this->attributes->all()\n );\n }", "public function getInputNames();", "public function all()\n\t{\n\t\treturn $this->getArray();\n\t}", "public function inputs(bool $lowerCaseKeys = false) : array\n {\n return $lowerCaseKeys ? $this->inputLowerCaseKeys : $this->input;\n }", "private static function input()\n {\n $files = ['Input'];\n $folder = static::$root.'Http'.'/';\n\n self::call($files, $folder);\n\n Input::register();\n }", "public function getInputData()\n {\n return array_only($this->inputData, ['online_room_id']);\n }", "public function all()\n\t{\n\t\t$queries = [];\n\n\t\tforeach( $this->request->all() as $key => $value )\n\t\t{\n\t\t\t$queries[$key] = new Inquiry($key, $value);\n\t\t}\n\n\t\treturn $queries;\n\t}", "public function all() {\n\t\treturn $this->data;\n\t}", "function all () {\n return $this -> data;\n }", "public function get_all(){\n return get_object_vars($this);\n }", "public function all()\n\t{\n\t\treturn $this->data;\n\t}", "public function all()\n\t{\n\t\treturn $this->data;\n\t}", "public function all()\n\t{\n\t\treturn $this->data;\n\t}", "public function all() : array;", "public function all()\n {\n return $this->data;\n }", "public function all()\n {\n return $this->data;\n }", "public function all()\n {\n return $this->data;\n }", "final public function GetValidInputs() { return $this->valid; }", "public function processcontact()\n\t{\n\t\t$input = Request::all();\n\n\t\treturn $input;\n\t}", "public static function all()\n {\n return array_merge(self::$__request, self::$__files);\n }", "public final function get_all()\n {\n }", "public function all()\n {\n return $this->values;\n }", "protected function getArguments()\n {\n return array(\n array('all', InputArgument::OPTIONAL, 'Run all the jobs?'),\n );\n }", "public function getData()\n {\n return $this->parameters->all();\n }", "public function getInputData()\n {\n return $this->env['INPUT'];\n }", "public function get_all () {\r\n\t\treturn $this->_data;\r\n\t}", "public function arguments() : array\n {\n return $this->input->getArguments();\n }" ]
[ "0.7965205", "0.79228604", "0.782545", "0.7811779", "0.77420044", "0.75788087", "0.7366298", "0.695331", "0.6941443", "0.6918222", "0.6666754", "0.66185474", "0.6595184", "0.6554888", "0.64162755", "0.6367297", "0.63620645", "0.6359621", "0.62736595", "0.6265544", "0.624815", "0.62419146", "0.6238721", "0.6238353", "0.6238353", "0.6238353", "0.6238353", "0.6238353", "0.6238353", "0.6238353", "0.6238353", "0.6238353", "0.6238353", "0.6238353", "0.6238353", "0.6238353", "0.6236475", "0.6224922", "0.619027", "0.61506855", "0.61341214", "0.6132395", "0.6122031", "0.61152804", "0.61137193", "0.6101278", "0.6098764", "0.6078111", "0.6077246", "0.6049798", "0.60471594", "0.60471594", "0.60471594", "0.60471594", "0.60471594", "0.60471594", "0.60471594", "0.60471594", "0.60471594", "0.60471594", "0.60471594", "0.60471594", "0.60471594", "0.60471594", "0.60471594", "0.60471594", "0.604194", "0.60253245", "0.59650695", "0.594287", "0.59244084", "0.5920484", "0.5901917", "0.5900846", "0.58874637", "0.58871764", "0.5857777", "0.5842023", "0.5820709", "0.58187324", "0.5813844", "0.5811699", "0.58012134", "0.5799267", "0.57965636", "0.57965636", "0.57965636", "0.57664275", "0.576607", "0.576607", "0.576607", "0.57636", "0.5762279", "0.57620656", "0.5759909", "0.5755013", "0.5748857", "0.5745936", "0.57383883", "0.5733691", "0.5726828" ]
0.0
-1
Get URL from internal cache if exists.
protected function getUrlFromCache($cacheKey, $route, $params) { if (!empty($this->_ruleCache[$cacheKey])) { foreach ($this->_ruleCache[$cacheKey] as $rule) { /* @var $rule UrlRule */ if (($url = $rule->createUrl($this, $route, $params)) !== false) { return $url; } } } else { $this->_ruleCache[$cacheKey] = []; } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function getURLcache($url){\n\n\t\t$urlContent = false;\n\t\t$cacheFile = PATH_site.'typo3temp/t3m_'.md5($_SERVER['HTTP_HOST'] . $url);\n\t\tif( !file_exists($cacheFile) || filemtime($cacheFile) < (time()-(3600*24*3)) ){\n\t\t\t$urlContent = trim(t3lib_div::getURL($url));\n\t\t\tif( !empty($urlContent) ){\n\t\t\t\t$encK = $this->getencryptionKey(strlen($urlContent));\n\t\t\t\t/* echo \"Wrote Cache $cacheFile<br>\\n\"; */\n\t\t\t\tt3lib_div::writeFile($cacheFile,($urlContent ^ $encK) ); /* hihihi ;-) */\n\n\t\t\t}else{ return false; }\n\t\t}else{\n\t\t\t/* echo \"Read Cache $cacheFile<br>\\n\"; */\n\t\t\t$urlContent = implode('',file($cacheFile));\n\t\t\t$encK = $this->getencryptionKey(strlen($urlContent));\n\t\t\t$urlContent = ($urlContent ^ $encK);\n\t\t}\n\t\treturn $urlContent;\n\t}", "function \nget_php_net ()\n{\n $st = @stat (CACHEFILE);\n if ($st === false) { // fallthrough and download it\n\treturn download_url ();\n }\n\n if (CACHETIME < (time() - $st['mtime'])) {\n\treturn get_cached_data ();\n }\n\n\n return download_url ();\n}", "public function getCache($url){\n\t\t$hash = md5($url);\n\n\t\treturn apc_fetch($hash);\n\t}", "function _cache_get ($cache_name = \"\") {\n\t\tif (empty($cache_name)) {\n\t\t\treturn false;\n\t\t}\n\t\t$cache_file_path = $this->_prepare_cache_path($cache_name);\n\t\treturn $this->_get_cache_file($cache_file_path);\n\t}", "public function getFromCache() {}", "function get ($url) {\n $this->ERROR = \"\";\n $cache_file = $this->file_name( $url );\n \n if ( ! file_exists( $cache_file ) ) {\n $this->debug( \n \"Cache doesn't contain: $url (cache file: $cache_file)\"\n );\n return 0;\n }\n \n $fp = @fopen($cache_file, 'r');\n if ( ! $fp ) {\n $this->error(\n \"Failed to open cache file for reading: $cache_file\"\n );\n return 0;\n }\n \n if ($filesize = filesize($cache_file) ) {\n \t$data = fread( $fp, filesize($cache_file) );\n \t$rss = $this->unserialize( $data );\n \n \treturn $rss;\n \t}\n \t\n \treturn 0;\n }", "public static function getCache() {\n\n if (Config::get('app.cache') != 0 && !Auth::check()) { //\n $page = (Paginator::getCurrentPage() > 1 ? Paginator::getCurrentPage() : '');\n $key = 'route-' . Str::slug(Request::fullurl()) . $page;\n\n if (Cache::has($key)) {\n die(Cache::get($key));\n }\n }\n }", "public function getUrl($format = null, $secure = false)\n {\n $format = $this->getFormat($format);\n $cached_name = $this->cache->getName($this->path, $format);\n\n if (! $format->no_cache\n && $this->cache->has($cached_name)\n && $this->cache->newerThan($cached_name, filemtime($this->path))\n ) {\n return $this->getCachedUrl($cached_name, $format, $secure);\n } else {\n return $this->getResizedUrl($cached_name, $format, $secure);\n }\n }", "public function get($cache_name);", "public function cacheUrl(string $url)\n {\n return $this->cache->remember(\"cdn.{$url}\", $this->cacheExpiry, function () use ($url) {\n return $this->rewriteUrl($url);\n });\n }", "public static function getCache() {}", "function getRemote( $the_url, $cache_lifetime=60 )\n\t\t{\n\t\t\t$request_alias = 'aiowaff_' . md5($the_url);\n\t\t\t$from_cache = get_option( $request_alias );\n\t\t\t\n\t\t\tif( $from_cache != false ){\n\t\t\t\tif( time() < ( $from_cache['when'] + ($cache_lifetime * 60) )){\n\t\t\t\t\treturn $from_cache['data'];\n\t\t\t\t}\n\t\t\t}\n\t\t\t$response = wp_remote_get( $the_url, array('user-agent' => \"Mozilla/5.0 (Windows NT 6.2; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0\", 'timeout' => 10) ); \n\t\t\t\n\t\t\t// If there's error\n if ( is_wp_error( $response ) ){\n \treturn array(\n\t\t\t\t\t'status' => 'invalid'\n\t\t\t\t);\n }\n \t$body = wp_remote_retrieve_body( $response );\n\t\t\t\n\t\t\t$response_data = json_decode( $body, true );\n\t\t\t\n\t\t\t// overwrite the cache data \n\t\t\tupdate_option( $request_alias, array(\n\t\t\t\t'when' => time(),\n\t\t\t\t'data' => $response_data\n\t\t\t) );\n\t\t\t\t\n\t return $response_data;\n\t\t}", "function cached($url = false, $cache_timeout = 15) {\n\t\tif(!$url) {\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\t$cache_file = $this->cachefile($url);\n\t\t\n\t\t$cache_timeout = $cache_timeout * 60;\n\t\t\n\t\t$cache_exists = file_exists($cache_file);\n\t\t\n\t\tif($cache_exists) {\n\t\t\t$cache_valid = (filemtime($cache_file)+$cache_timeout > time());\n\t\t} else {\n\t\t\t$cache_valid = false;\n\t\t}\n\t\t\n\t\tif($cache_exists && $cache_valid) {\n\t\t\t$cache_data = trim(file_get_contents($cache_file));\n\t\t\t$cache_object = @json_decode($cache_data);\n\t\t\tif($cache_data && $cache_object) {\n\t\t\t\treturn $cache_object;\n\t\t\t}\n\t\t} else if($cache_exists && !$cache_valid) {\n\t\t\tunlink($cache_file);\n\t\t}\n\t\t\n\t\treturn false;\n\t}", "private function getNextNotCrawledUrl(): ?Url\n {\n return $this->search->urls()\n ->notCrawled()\n ->first();\n }", "public function getCache();", "static public function getFromUrl(){\n $args = func_get_args();\n\n $cacheIsExpired = true; // By default we assume no cache then never expire (then cache always expire !)\n\n $cache = static::getCache();\n if( !is_null($cache) && isset($args[0]) && is_string($args[0]) ){ // Cache defined ?\n $cacheIsExpired = $cache->setRequest($args[0])->isExpired();\n }\n\n set_error_handler(array('\\Draeli\\RssBridge\\Utils', 'set_error_handler'));\n\n $argsLng = count($args);\n\n if( $cacheIsExpired ){\n if( !isset($args[1]) ){\n $args[1] = false;\n }\n\n if( !isset($args[2]) ){\n $randVersion = rand(23, 30) . '.' . rand(0, 9);\n\n // http://www.php.net/manual/fr/context.http.php\n // http://en.wikipedia.org/wiki/List_of_HTTP_header_fields\n $context = stream_context_create(array(\n 'http' => array(\n 'header' =>\n 'Accept-Charset: utf-8' . \"\\r\\n\" . \n 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:' . $randVersion . ') Gecko/' . date('Ymd') . ' Firefox/' . $randVersion . \"\\r\\n\", // À la bourrin ! :)\n )\n ));\n $args[2] = $context;\n }\n\n $argsFileGetContens = $argsLng > 5 ? array_slice($args, 0, 5) : $args;\n /*\n Note : il est possible d'utilisater les options de context, cf. http://www.php.net/manual/fr/context.http.php + http://fr2.php.net/manual/en/function.file-get-contents.php\n */\n $sourceHtml = call_user_func_array('\\file_get_contents', $argsFileGetContens );\n }\n else{ // Cache not expired, we reload stuff\n $sourceHtml = $cache->loadData();\n }\n\n if( $sourceHtml === false ){\n throw new \\Exception('No data to load from this URL');\n }\n\n $argsStrGetContens = $argsLng > 5 ? array_slice($args, 5) : array();\n array_unshift($argsStrGetContens, $sourceHtml);\n\n $result = call_user_func_array( array('\\Sunra\\PhpSimple\\HtmlDomParser', 'str_get_html'), $argsStrGetContens);\n // $result = call_user_func_array( array('\\Sunra\\PhpSimple\\HtmlDomParser', 'file_get_html'), $args );\n restore_error_handler ();\n\n if( !is_null($cache) ){ // Cache expired or not exist, we refresh cache\n $cache->saveData($sourceHtml);\n }\n\n return $result;\n }", "public function getCache($url, $data = []){\n \t$this->_setData($data);\n \t$this->cacheredis \t= $this->redis->hGet(\"api/$url\",$this->dataredis );\n \t#$this->common->debug(\"api/$url\",FALSE);\n \t#$this->common->debug($this->dataredis);\n \tif( $this->cacheredis){\n \t\treturn $this->cacheredis;\n \t}else{\n \t\treturn FALSE;\n \t}\n }", "function InPlaceCache_checkCache($hash)\r\n{\r\n\tglobal $gInPlaceCacheIP;\r\n\t\r\n\t$path[3] = $gInPlaceCacheIP . '/' . $hash[0];\r\n\t$path[2] = $path[3] . '/' . substr($hash,1,2);\r\n\t$path[1] = $path[2] . '/' . $hash;\r\n\t\r\n\t$path[0] = file_exists($path[1]);\r\n\r\n\treturn $path;\r\n}", "function safe_scrape_cached($url){\n\n\t\t$cache = cache::factory();\n\n\t\t$cached = $cache->get($url);\n\t\tif (isset($cached) && $cached !== false) {\n\t\t\treturn $cached;\n\t\t}else{\n\t\t\t$page = safe_scrape($url);\n\t\t $cache->set($url, $page, \"safe_scrape\");\t\n\t\t\treturn $page;\n\t\t}\n\t\t\n\t}", "public function getCache()\r\n {\r\n if ($this->exists('cache')) {\r\n return ROOT . $this->get('cache');\r\n }\r\n else\r\n return ROOT . '/cache';\r\n }", "function getCacheFileContent($url, $cacheTime) {\n $fileName = sha1($url);\n $file = Gear_Cache::getFullfile($fileName, $cacheTime);\n if ($file) {\n return $file;\n } else {\n $file = file_get_contents($url);\n Gear_Cache::setFullFile($fileName, $file);\n return $file;\n }\n}", "public function getUrl()\n {\n if($this->storage)\n {\n $this->save();\n\n return $this->storage->getUrl($this);\n }\n\n return NULL;\n }", "public function getCachedReturnUrl()\n {\n $key = 'oauth_return_url_'.$this->request->input('oauth_token');\n\n // If we have no return url stored, redirect back to root page\n $url = $this->cache->get($key, Config::get('hosts.app'));\n\n return $url;\n }", "public static function internalCacheUrlencode($url)\n {\n \t// update all external image URL to internal for better CDN caching\n \t// replace \"/\" to \"@@@\", because laravel path matching will be failed\n \t$url = urlencode(str_replace(\"/\", \"@@@\", $url));\n \t$url = \"http://\".env(\"DOMAINNAME\").\"/imgcache/\".$url;\n \treturn $url;\n }", "public static function getWebsiteURL(){\n if(Cache::isStored('website_url'))return Cache::get('website_url'); \n $row = getDatabase()->queryFirstRow(\"SELECT `value` FROM `settings` WHERE `setting` = 'website_url'\");\n $url = $row['value'];\n #http:// prefix\n if(!is_numeric(strpos($url, \"http://\"))){\n $url = 'http://' . $url;\n }\n #/ suffix\n if(substr($url, -1) != '/'){\n $url .= '/';\n }\n Cache::store('website_url', $url);\n return $url;\n }", "function getImage($url, $maxImageSize = 50000)\n{\n $imageFile = CACHE.'/'.basename($url);\n \n // is cached image missing or > 24 hours old?\n if(!file_exists($imageFile) ||\n ((mktime() - filemtime($imageFile)) > 24*60*60))\n {\n // get image\n $fp = fopen($url, 'rb');\n if(!$fp)\n die ('Sorry, could not download image.');\n $image = fread($fp, $maxImageSize);\n if(!$image)\n die ('Sorry, could not download image.');\n fclose($fp);\n\n // store image\n $fp = fopen($imageFile, 'wb');\n if(!$fp||(fwrite($fp, $image)==-1))\n {\n die ('Sorry, could not store image file');\n }\n fclose($fp);\n }\n return $imageFile;\n}", "static function for_url($url) {\n\t\t$obj = DataObject::get_one('SvnInfoCache', \"URL = '\" . Convert::raw2sql($url) . \"'\");\n\t\t\n\t\tif(!$obj) {\n\t\t\t$obj = new SvnInfoCache();\n\t\t\t$obj->URL = $url;\n\t\t\t$obj->write();\n\t\t}\n\t\t\n\t\treturn $obj;\n\t}", "function cacheImage($url) {\r\n\t\ttry {\r\n\t\t\t$cacheDir = dirname(__FILE__) . '/img/cache/';\r\n if (!file_exists($cacheDir)) {\r\n mkdir($cacheDir, 0777, true);\r\n }\r\n \t$cached_filename = md5($url);\r\n\t\t\t$files = glob($cacheDir . '*.{jpg,jpeg,png,gif}', GLOB_BRACE);\r\n\t\t\t$now = time();\r\n\t\t\tforeach ($files as $file) {\r\n\t\t\t\tif (is_file($file)) {\r\n\t\t\t\t\tif ($now - filemtime($file) >= 60 * 60 * 24 * 5) { // 5 days\r\n\t\t\t\t\t\tunlink($file);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tforeach($files as $file) {\r\n\t\t\t\t$fileName = explode('.',basename($file));\r\n\t\t\t\tif ($fileName[0] == $cached_filename) {\r\n\t\t\t\t $path = getRelativePath(dirname(__FILE__),$file);\r\n\t\t\t\t\t return $path;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t$image = file_get_contents($url);\r\n\t\t\tif ($image) {\r\n\t\t\t\t$tempName = $cacheDir . $cached_filename;\r\n\t\t\t\tfile_put_contents($tempName,$image);\r\n\t\t\t\t$imageData = getimagesize($tempName);\r\n\t\t\t\t$extension = image_type_to_extension($imageData[2]);\r\n\t\t\t\tif($extension) {\r\n\t\t\t\t\t$filenameOut = $cacheDir . $cached_filename . $extension;\r\n\t\t\t\t\t$result = file_put_contents($filenameOut, $image);\r\n\t\t\t\t\tif ($result) {\r\n\t\t\t\t\t\trename($tempName,$filenameOut);\r\n\t\t\t\t\t\treturn getRelativePath(dirname(__FILE__),$filenameOut);\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tunset($tempName);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} catch (\\Exception $e) {\r\n\t\t\twrite_log('Exception: ' . $e->getMessage());\r\n\t\t}\r\n\t\treturn $url;\r\n\t}", "public function get_cache_filename($url)\n {\n }", "function cache_get( $key ) {\n\t\t\n\t\tif ( !extension_loaded('apc') || (ini_get('apc.enabled') != 1) ) {\n\t\t\tif ( isset( $this->cache[ $key ] ) ) {\n\t\t\t\treturn $this->cache[ $key ];\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\treturn apc_fetch( $key );\n\t\t}\n\n\t\treturn false;\n\n\t}", "protected static function getCacheIdentifier() {}", "public function cacheGet() {\n }", "protected function getUrl()\n {\n if (!empty($this->info['url'])) {\n return $this->info['url'];\n }\n }", "public function getUrl()\n {\n if (array_key_exists(\"url\", $this->_propDict)) {\n return $this->_propDict[\"url\"];\n } else {\n return null;\n }\n }", "public abstract function getURL();", "public function get_url();", "function cachefile($url = false) {\n\t\tif(!$url) {\n\t\t\t$url = uniqid();\n\t\t}\n\t\t\n\t\t$request_hash = sha1($url);\n\t\t\n\t\t$tmp_path = sys_get_temp_dir();\n\t\t\n\t\t$cache_name = 'wmjapi-' . $this->token_hash . '-' \n\t\t\t. sha1($url) . '.json';\n\t\t\n\t\tif(substr($tmp_path, -1) !== '/') {\n\t\t\t$tmp_path = $tmp_path . '/';\n\t\t}\n\t\t\n\t\t$cache_file = $tmp_path . $cache_name;\n\t\t\n\t\treturn $cache_file;\n\t}", "private function get_cache() {\n exit(file_get_contents($this->cache_file));\n }", "private static function getCache()\n\t{\n\t\t// Initialiase variables.\n\t\t$file = JPATH_CACHE . '/twitter';\n\n\t\tif (JFile::exists($file))\n\t\t{\n\t\t\treturn unserialize(JFile::read($file));\n\t\t}\n\n\t\treturn false;\n\t}", "function get_url()\n {\n }", "protected function getFromCache()\n {\n return $this->cache->get($this->getCacheKey());\n }", "public function getUrlKey(): ?string;", "public function fetch(RequestInterface $request) {\n /** @var int|null $maxAge */\n $maxAge = NULL;\n\n if ($request->hasHeader('Cache-Control')) {\n $reqCacheControl = new KeyValueHttpHeader($request->getHeader('Cache-Control'));\n if ($reqCacheControl->has('no-cache')) {\n // Can't return cache.\n return NULL;\n }\n\n $maxAge = $reqCacheControl->get('max-age', NULL);\n }\n elseif ($request->hasHeader('Pragma')) {\n $pragma = new KeyValueHttpHeader($request->getHeader('Pragma'));\n if ($pragma->has('no-cache')) {\n // Can't return cache.\n return NULL;\n }\n }\n\n $cache = $this->storage->fetch($this->getCacheKey($request));\n if ($cache !== NULL) {\n $varyHeaders = $cache->getVaryHeaders();\n\n // Vary headers exist from a previous response, check if we have a cache\n // that matches those headers.\n if (!$varyHeaders->isEmpty()) {\n $cache = $this->storage->fetch($this->getCacheKey($request, $varyHeaders));\n\n if (!$cache) {\n return NULL;\n }\n }\n\n // This is where the original method checks the original request URL.\n if ($maxAge !== NULL) {\n if ($cache->getAge() > $maxAge) {\n // Cache entry is too old for the request requirements!\n return NULL;\n }\n }\n\n if (!$cache->isVaryEquals($request)) {\n return NULL;\n }\n }\n\n return $cache;\n }", "function get_cache($key) {\n return $this->get_cache_dir() . $key . '.cache';\n }", "public static function getCache() {\n\t\treturn null;\n\t}", "public function getURL();", "public function getURL();", "public function url() {\n\n if(isset($this->cache['url'])) return $this->cache['url'];\n\n // Kirby is trying to remove the home folder name from the url\n if($this->isHomePage()) {\n // return the base url\n return $this->cache['url'] = $this->site->url();\n } else if($this->parent->isHomePage()) {\n return $this->cache['url'] = $this->site->url() . '/' . $this->parent->uid . '/' . $this->uid;\n } else {\n $purl = $this->parent->url();\n return $this->cache['url'] = $purl == '/' ? '/' . $this->uid : $this->parent->url() . '/' . $this->uid;\n }\n\n }", "function check_cache ( $url ) {\n $this->ERROR = \"\";\n $filename = $this->file_name( $url );\n \n if ( file_exists( $filename ) ) {\n // find how long ago the file was added to the cache\n // and whether that is longer then MAX_AGE\n $mtime = filemtime( $filename );\n $age = time() - $mtime;\n if ( $this->MAX_AGE > $age ) {\n // object exists and is current\n return 'HIT';\n }\n else {\n // object exists but is old\n return 'STALE';\n }\n }\n else {\n // object does not exist\n return 'MISS';\n }\n }", "public function for_url( $url ) {\n\t\t$url_parts = \\wp_parse_url( $url );\n\t\t$site_parts = \\wp_parse_url( \\site_url() );\n\t\tif ( $url_parts['host'] !== $site_parts['host'] ) {\n\t\t\treturn false;\n\t\t}\n\t\t// Ensure the scheme is consistent with values in the DB.\n\t\t$url = $site_parts['scheme'] . '://' . $url_parts['host'] . $url_parts['path'];\n\n\t\tif ( $this->is_date_archive_url( $url ) ) {\n\t\t\t$indexable = $this->repository->find_for_date_archive();\n\t\t}\n\t\telse {\n\t\t\t$indexable = $this->repository->find_by_permalink( $url );\n\t\t}\n\n\t\t// If we still don't have an indexable abort, the WP globals could be anything so we can't use the unknown indexable.\n\t\tif ( ! $indexable ) {\n\t\t\treturn false;\n\t\t}\n\t\t$page_type = $this->indexable_helper->get_page_type_for_indexable( $indexable );\n\n\t\tif ( $page_type === false ) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn $this->build_meta( $this->context_memoizer->get( $indexable, $page_type ) );\n\t}", "function get($name, $key=null) {\n if (isset($this->cache[$name]) && $key) {\n //error_log(\"Get from cache: '$name' key: '$key'\");\n return $this->cache[$name][$key];\n }\n return false;\n }", "public function getUrl(string $sKey = null): string;", "protected function getCache($key = null) {\n if (!$key) {\n $key = \"data\";\n }\n $fullKey = \"cache-\".$this->getID().\"-{$key}\";\n\n $found = false;\n $cached = \\apcu_fetch($fullKey, $found);\n if ($found) {\n return $cached;\n }\n return false;\n }", "private function getEntry($liveURL = \"\") {\n\n\t\t// Strip out blacklisted params\n\t\tforeach ($this->blacklist as $part)\n\t\t\t$liveURL = preg_replace(\"/[\\?&]$part=[^&\\s]*/\", \"\", $liveURL);\n\n\t\t// Open the index file\n\t\t$indexFile = fopen($this->cache_folder . \"/\" . $this->cache_index, \"r\");\n\t\tif(empty($indexFile))\n\t\t\treturn null;\n\n\t\t// Iterate through the index\n\t\t$entry = null;\n\t\tdo {\n\t\t\t// Fetch an entry\n\t\t\t$entry = fgets($indexFile);\n\t\t\tif(empty($entry)) continue; // skip blanks\n\n\t\t\t// Get the live URL from the entry\n\t\t\t$URLs = explode($this->cache_index_delimiter, $entry);\n\t\t\tif(count($URLs) < 2) continue; // skip blanks/corrupt entries\n\t\t\t$potentialLiveURL = trim($URLs[0]);\n\t\t\t$potentialLocalURL = trim($URLs[1]);\n\n\t\t\t// Does it match?\n\t\t\tif($potentialLiveURL === $liveURL){\n\t\t\t\t// Yes! Gracefully shut the file and return the corresponding local filepath\n\t\t\t\tfclose($indexFile);\n\t\t\t\treturn $potentialLocalURL; // return the local filepath\n\t\t\t}\n\t\t\t// Else continue searching\n\n\t\t} while($entry !== false);\n\n\t\t// Done, but without a match!\n\t\tfclose($indexFile);\n\t\treturn null; // notify of no match\n\t}", "function getCache() {\n\t\tif ( !$this->postID )\n\t\t\treturn false;\n\t\t\t\n\t\t$sql = \"SELECT cached_result FROM $this->cacheTable WHERE post_id = '\" . $this->db->escape( $this->postID ) . \"'\";\n\t\t\t\n\t\t$results = $this->db->get_results( $sql );\n\t\t\n\t\tif ( !$results[0] )\n\t\t\treturn false;\n\t\t\t\n\t\treturn $results[0]->cached_result;\n\t}", "function fetch_url($url, $expiry = CACHE_EXPIRY_TIMESPAN, $post_params = null) {\n global $cookie;\n global $calendar_url;\n\n if ($post_params) {\n $post = array();\n foreach ($post_params as $key => $value) {\n $post []= $key.'='.htmlentities($value);\n }\n $post = implode('&', $post);\n } else {\n $post = '';\n }\n\n $cache_path = CACHE_PATH.md5($calendar_url).md5($url.$post);\n echo 'Fetching '.$url.'...memory: '.memory_get_usage().'...';\n if (file_exists($cache_path) &&\n filemtime($cache_path) >= time() - $expiry) {\n echo 'from cache.'.\"\\n\";\n $data = file_get_contents($cache_path);\n } else {\n echo 'from web...';\n\n $ch = curl_init($url);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);\n //curl_setopt($ch, CURLOPT_VERBOSE, true);\n curl_setopt($ch, CURLOPT_COOKIE, $cookie);\n curl_setopt($ch, CURLOPT_USERAGENT, 'UWDataSpider/1.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.7)');\n if ($post_params) {\n curl_setopt($ch, CURLOPT_POST, count($post_params));\n curl_setopt($ch, CURLOPT_POSTFIELDS, $post);\n }\n $data = curl_exec($ch);\n\n/*\n $context = stream_context_create(array(\n 'http' => array(\n 'method'=>\"GET\",\n 'header'=>\"Accept-language: en-us,en;q=0.5\\r\\n\".\n \"Referrer: http://uwdata.ca\\r\\n\".\n \"User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7\\r\\n\"\n )\n ));\n $data = file_get_contents($url, 0, $context);*/\n if ($data) {\n file_put_contents($cache_path, $data);\n }\n echo 'done.'.\"\\n\";\n }\n return $data;\n}", "public function getUrl(): ?string;", "public function getUrl(): ?string;", "public function getUrl(): ?string;", "public static function getThisUrl() {}", "static public function getCache($key)\n {\n if (getenv('AMTEL_CACHE') == 'redis') {\n return Cache::store('redis')->get($key);\n }\n }", "abstract public function get_url_read();", "function _get_cache_file ($cache_file = \"\") {\n\t\tif (empty($cache_file)) {\n\t\t\treturn null;\n\t\t}\n\t\tif ($this->USE_MEMCACHED) {\n//\t\t\t$cache_key = basename($cache_file);\n//\t\t\t$data = $this->MC_OBJ->get($cache_key);\n// TODO\n\t\t// Common (files-based) cache code\n\t\t} else {\n\t\t\tclearstatcache();\n\t\t\tif (!file_exists($cache_file)) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\t// Delete expired cache files\n\t\t\t$last_modified = filemtime($cache_file);\n\t\t\t$TTL = $this->CACHE_TTL;\n\t\t\tif ($last_modified < (time() - $TTL)) {\n\t\t\t\tunlink($cache_file);\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\t// Get data from file\n\t\t\t$data = [];\n\t\t\tif (DEBUG_MODE) {\n\t\t\t\t$_time_start = microtime(true);\n\t\t\t}\n\t\t\t// Try to include file\n\t\t\tinclude ($cache_file);\n/*\t\t\t@eval(\"?> \".file_get_contents($cache_file).\" <?php\"); */\n\t\t\tif (DEBUG_MODE) {\n\t\t\t\t$GLOBALS['include_files_exec_time'][strtolower(str_replace(DIRECTORY_SEPARATOR, \"/\", $cache_file))] = (microtime(true) - $_time_start);\n\t\t\t}\n\t\t}\n\t\treturn $data;\n\t}", "public function getURL ();", "public function getUrl() {\n if ($this->hasUrl()) {\n return $this->_getData('url');\n }\n $uri = $this->getUrlKey() . $this->getUrlSuffix();\n return $this->_getUrl($uri);\n }", "public function getObjFromCache($key);", "function getCacheFileUrl($eventData)\n {\n global $serendipity;\n\n $cache_filename = $this->getCacheFileName($eventData);\n if (!isset($cache_filename)) {\n return null;\n }\n return $serendipity['baseURL'] . '/' . PATH_SMARTY_COMPILE . '/serendipity_event_gravatar/' . $cache_filename;\n }", "abstract public function getCache( $cacheID = '', $unserialize = true );", "protected function loadFromCache() {}", "public function ___noCacheURL($http = false) {\n\t\treturn ($http ? $this->httpUrl() : $this->url()) . '?nc=' . $this->filemtime();\n\t}", "abstract protected function getCacheServerLocation(Request $request);", "public static function get_from_url()\n\t{\n\t\t//获取域内url get参数的解码后url\n\t\tif($url = sf\\getGPC('url', 'g'))\n\t\t{\n\t\t\t$url = sf\\decrypt_url($url);\n\t\t\t$from = parse_url(urldecode(rtrim($url, '?'))); \n\t\t\t\n\t\t\t//若url参数与当前文件同域则为登录/登录状态查询\n\t\t\tif($from['host'] == $_SERVER['HTTP_HOST'])\n\t\t\t{\n\t\t\t\treturn sf\\build_url($from);\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "public function getCache() {\n $viewer = Engine_Api::_()->user()->getViewer();\n $viewer_id = $viewer->getIdentity();\n\n $isCacheEnabled = $this->isCacheEnabled();\n if (empty($isCacheEnabled))\n return false;\n\n $cacheName = $this->_cacheName();\n if (empty($cacheName))\n return null;\n $cache = Zend_Registry::get('Zend_Cache');\n\n try {\n $getCache = $cache->load($cacheName);\n } catch (Exception $e) {\n return null;\n }\n if (!empty($getCache))\n return $getCache;\n\n return null;\n }", "private function _get_cache($key){\n if(is_file(_ENVATO_TMP_DIR.'cache-'.basename($key))){\n return @unserialize(file_get_contents(_ENVATO_TMP_DIR.'cache-'.basename($key)));\n }\n return false;\n }", "abstract public function getUrl();", "public static function hasDefaultCache();", "public function get($key)\n {\n $_params = $this->buildParams(['id' => $this->prefix . $key]);\n\n try {\n $_response = $this->client->get($_params);\n\n if (array_get($_response, 'found', false)) {\n return array_get($_response, '_source.cache_value');\n }\n } catch (Missing404Exception $_ex) {\n // Not found\n }\n\n return null;\n }", "public function getCache()\n {\n if ($this->cache && $this->cacheExists()) {\n return(file_get_contents($this->getCacheFile()));\n } else {\n return(false);\n }\n }", "protected function load_cache(){\r\n\t\tstatic $cached = null;\r\n\t\t\r\n\t\tif(!$cached){\r\n\t\t\t\r\n\t\t\tif($this->_cfg->get('sfversion') == 'auto'){\r\n\t\t\t\t// get version from sourceforge/cache\r\n\t\t\t\tif (!$this->is_cached()) $this->update_cache();\r\n\t\t\t\t$cached = (object)include($this->get_cache());\r\n\t\t\t}else{\r\n\t\t\t\t// use predefined version from config\r\n\t\t\t\t$cached = (object)$this->_cfg->get('sfversion');\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\treturn $cached;\r\n\t}", "function wp_cache_get( $key, $group = '', $force = false, &$found = null ) {\n\t\treturn false;\n\t}", "function getUrl();", "public function getImageCachePath()\n {\n return $this->getSettingArray()[\"image_cache_path\"];\n }", "private function getEmptyCacheUrl() : string\n {\n if ($this->showAdminMenu()) {\n return \\wp_nonce_url(\n \\add_query_arg(\n [\n 'page' => self::MENU_SLUG,\n 'rest_cache_empty' => '1',\n ],\n \\admin_url('options-general.php')\n ),\n 'rest_cache_options',\n self::NONCE_NAME\n );\n }\n\n return \\wp_nonce_url(\n \\add_query_arg(\n [\n 'action' => self::ADMIN_ACTION,\n 'rest_cache_empty' => '1',\n ],\n \\admin_url('admin.php')\n ),\n 'rest_cache_options',\n self::NONCE_NAME\n );\n }", "public static function Get(string $short_url): ?string\n {\n return Cache::get($short_url);\n }", "public static function getCacheFile() {\n\t\t$cache = false;\n\t\t$can_be_cached = PageCache::canBeCached();\n\t\tif ($can_be_cached) {\n\t\t\t// Before checking cache, lets check cache reffreshment triggers (specific prices)\n\t\t\tPageCacheDAO::triggerReffreshment();\n\n\t\t\t$controller = Dispatcher::getInstance()->getController();\n\t\t\t$cache_life = 60 * ((int)Configuration::get('pagecache_'.$controller.'_timeout'));\n\t\t\t$cache_file = PageCache::_getCacheFilepath();\n\n\t\t\tif (Tools::getIsset('delpagecache') && file_exists($cache_file)) {\n\t\t\t\tunlink($cache_file);\n\t\t\t}\n\n\t\t\t$pseudo_uri = self::getPseudoRequestURI();\n\t\t\t$filemtime = @filemtime($cache_file);\n\t\t\tif ($filemtime && ($cache_life < 0 or (microtime(true) - $filemtime < $cache_life))) {\n\t\t\t\tif (Configuration::get('pagecache_stats')) {\n\t\t\t\t\tPageCacheDAO::incrementCountHit($pseudo_uri);\n\t\t\t\t}\n\t\t\t\t$cache = $cache_file;\n\t\t\t}\n\n\t\t\t// Store cache used in a readable cookie (0=no cache; 1=server cache; 2=browser cache)\n\t\t\tif (self::isDisplayStats()) {\n\t\t\t\t$cache_type = 0;\n\t\t\t\tif ($cache) {\n\t\t\t\t\t$cache_type = 1;\n\t\t\t\t}\n\t\t\t\tif (PHP_VERSION_ID <= 50200) /* PHP version > 5.2.0 */\n\t\t\t\t\tsetcookie('pc_type_' . md5($pseudo_uri), $cache_type, time()+60*60*1, '/', null, 0);\n\t\t\t\telse\n\t\t\t\t\tsetcookie('pc_type_' . md5($pseudo_uri), $cache_type, time()+60*60*1, '/', null, 0, false);\n\t\t\t}\n\t\t}\n\t\tif (Configuration::get('pagecache_logs') > 1) {\n\t\t\t// Log debug\n\t\t\t$controller = Dispatcher::getInstance()->getController();\n\t\t\t$is_ajax = Tools::getIsset('ajax') ? 'true' : 'false';\n\t\t\t$is_get = strcmp($_SERVER['REQUEST_METHOD'], 'GET') == 0 ? 'true' : 'false';\n\t\t\t$ctrl_enabled = Configuration::get('pagecache_'.$controller) ? 'true' : 'false';\n\t\t\t$is_debug = !Configuration::get('pagecache_debug') || Tools::getValue('dbgpagecache') !== false ? 'false' : 'true';\n\t\t\t$token_ok = (int)(Configuration::get('PS_TOKEN_ENABLE')) != 1 ? 'true' : 'false';\n\t\t\t$is_logout = Tools::getValue('logout') === false && Tools::getValue('mylogout') === false ? 'false' : 'true';\n\t\t\t$can_be_cached = $can_be_cached ? 'true' : 'false';\n\t\t\t$cache_life = 60 * ((int)Configuration::get('pagecache_'.$controller.'_timeout'));\n\t\t\t$cache_file = PageCache::_getCacheFilepath();\n\t\t\t$exists = file_exists($cache_file) ? 'true' : 'false';\n\t\t\t$date_infos = '';\n\t\t\tif (file_exists($cache_file)) {\n\t\t\t\t$now = date(\"d/m/Y H:i:s\", microtime(true));\n\t\t\t\t$last_date = date(\"d/m/Y H:i:s\", filemtime($cache_file));\n\t\t\t\t$date_infos = \"now=$now file=$last_date\";\n\t\t\t}\n\t\t\tLogger::addLog(\"PageCache | cache | !is_ajax($is_ajax) && is_get($is_get) && ctrl_enabled($ctrl_enabled) \".\n\t\t\t\t\"&& !is_debug($is_debug) && token_ok($token_ok) && !is_logout($is_logout) = $can_be_cached \".\n\t\t\t\t\"controller=$controller cache_life=$cache_life cache_file=$cache_file exists=$exists $date_infos\", 1, null, null, null, true);\n\t\t}\n\t\treturn $cache;\n\t}", "public function getUrl(): string;", "public function getUrl(): string;", "public function getUrl(): string;", "public function getUrlAttribute() \n {\n if (!empty($this->path)) {\n return Storage::disk('s3')->temporaryUrl(\n $this->path, now()->addSeconds(config('constants.expire_link_duration'))\n );\n }\n return null;\n }", "private function getHash($url){\r\n return $url;\r\n }", "function fetch_rss ($url, $cache_age) {\n \t// initialize constants\n \tinit();\n \n \tif ( !isset($url) ) {\n \t\t// error(\"fetch_rss called without a url\");\n \t\treturn false;\n \t}\n \n \t// if cache is disabled\n \tif ( !MAGPIE_CACHE_ON ) {\n \t\t// fetch file, and parse it\n \t\t$resp = _fetch_remote_file( $url );\n \t\tif ( is_success( $resp->status ) ) {\n \t\t\treturn _response_to_rss( $resp );\n \t\t}\n \t\telse {\n \t\t\t// error(\"Failed to fetch $url and cache is off\");\n \t\t\treturn false;\n \t\t}\n \t}\n \t// else cache is ON\n \telse {\n \t\t// Flow\n \t\t// 1. check cache\n \t\t// 2. if there is a hit, make sure its fresh\n \t\t// 3. if cached obj fails freshness check, fetch remote\n \t\t// 4. if remote fails, return stale object, or error\n \n $cache_age = isset($cache_age) ? $cache_age : MAGPIE_CACHE_AGE;\n \n \t\t$cache = new RSSCache( MAGPIE_CACHE_DIR, $cache_age);\n \n \t\tif (MAGPIE_DEBUG and $cache->ERROR) {\n \t\t\tdebug($cache->ERROR, E_USER_WARNING);\n \t\t}\n \n \t\t$cache_status \t = 0;\t\t// response of check_cache\n \t\t$request_headers = array(); // HTTP headers to send with fetch\n \t\t$rss \t\t\t = 0;\t\t// parsed RSS object\n \t\t$errormsg\t\t = 0;\t\t// errors, if any\n \n \t\tif (!$cache->ERROR) {\n \t\t\t// return cache HIT, MISS, or STALE\n \t\t\t$cache_status = $cache->check_cache( $url );\n \t\t}\n \n \t\t// if object cached, and cache is fresh, return cached obj\n \t\tif ( $cache_status == 'HIT' ) {\n \t\t\t$rss = $cache->get( $url );\n \t\t\t\n \t\t\tif ( isset($rss) and $rss ) {\n \t\t\t\n $rss->from_cache = 1;\n \t\t\t\tif ( MAGPIE_DEBUG > 1) {\n \t\t\t\t debug(\"MagpieRSS: Cache HIT\", E_USER_NOTICE);\n }\n \n \t\t\t\treturn $rss;\n \t\t\t}\n \t\t}\n\n \t\t// else attempt a conditional get\n \n \t\t// setup headers\n \t\tif ( $cache_status == 'STALE' ) {\n \t\t\t$rss = $cache->get( $url );\n \t\t\tif ( $rss->etag and $rss->last_modified ) {\n \t\t\t\t$request_headers['If-None-Match'] = $rss->etag;\n \t\t\t\t$request_headers['If-Last-Modified'] = $rss->last_modified;\n \t\t\t}\n \t\t}\n \t\t\n\n \n \t\t$resp = _fetch_remote_file( $url, $request_headers );\n \n \t\tif (isset($resp) and $resp) {\n \t\t\tif ($resp->status == '304' ) {\n \t\t\t\t// we have the most current copy\n \t\t\t\tif ( MAGPIE_DEBUG > 1) {\n \t\t\t\t\tdebug(\"Got 304 for $url\");\n \t\t\t\t}\n \t\t\t\t// reset cache on 304 (at minutillo insistent prodding)\n \t\t\t\t$cache->set($url, $rss);\n \t\t\t\treturn $rss;\n \t\t\t}\n \t\t\telseif ( is_success( $resp->status ) ) {\n \t\t\t\t$rss = _response_to_rss( $resp );\n \t\t\t\tif ( $rss ) {\n \t\t\t\t\tif (MAGPIE_DEBUG > 1) {\n \t\t\t\t\t\tdebug(\"Fetch successful\");\n \t\t\t\t\t}\n \t\t\t\t\t// add object to cache\n \t\t\t\t\t$cache->set( $url, $rss );\n \t\t\t\t\treturn $rss;\n \t\t\t\t}\n \t\t\t}\n \t\t\telse {\n \t\t\t\t$errormsg = \"Failed to fetch $url. \";\n \t\t\t\tif ( $resp->error ) {\n \t\t\t\t\t# compensate for Snoopy's annoying habbit to tacking\n \t\t\t\t\t# on '\\n'\n \t\t\t\t\t$http_error = substr($resp->error, 0, -2);\n \t\t\t\t\t$errormsg .= \"(HTTP Error: $http_error)\";\n \t\t\t\t}\n \t\t\t\telse {\n \t\t\t\t\t$errormsg .= \"(HTTP Response: \" . $resp->response_code .')';\n \t\t\t\t}\n \t\t\t}\n \t\t}\n \t\telse {\n \t\t\t$errormsg = \"Unable to retrieve RSS file for unknown reasons.\";\n \t\t}\n \n \t\t// else fetch failed\n \n \t\t// attempt to return cached object\n \t\tif ($rss) {\n \t\t\tif ( MAGPIE_DEBUG ) {\n \t\t\t\tdebug(\"Returning STALE object for $url\");\n \t\t\t}\n \t\t\treturn $rss;\n \t\t}\n \n \t\t// else we totally failed\n \t\t// error( $errormsg );\n \n \t\treturn false;\n \n \t} // end if ( !MAGPIE_CACHE_ON ) {\n }", "public function testUseCdnsWithNonCachableUrl()\n {\n $_SERVER['REQUEST_URI'] = '/foo/bar';\n CMS::config()->noncacheable = [\n '/foo/bar'\n ];\n\n $this->assertEquals(\n 'http://url_without_using_cdn',\n $this->object->useCdns('http://url_without_using_cdn', false)\n );\n }", "function get_base_url($https = null, $zone_for = null)\n{\n if ($https === null) { // If we don't know, we go by what the current page is\n global $CURRENTLY_HTTPS_CACHE;\n $https = $CURRENTLY_HTTPS_CACHE;\n if ($https === null) {\n require_code('urls');\n if (running_script('index')) {\n if (!addon_installed('ssl')) {\n $https = tacit_https();\n } else {\n $https = ((tacit_https()) || (function_exists('is_page_https')) && (function_exists('get_zone_name')) && (is_page_https(get_zone_name(), get_page_name())));\n }\n } else {\n $https = function_exists('tacit_https') && tacit_https();\n }\n $CURRENTLY_HTTPS_CACHE = $https;\n }\n }\n\n global $BASE_URL_HTTP_CACHE, $BASE_URL_HTTPS_CACHE, $VIRTUALISED_ZONES_CACHE;\n\n if ($VIRTUALISED_ZONES_CACHE === null) {\n require_code('zones');\n get_zone_name();\n }\n\n if (($BASE_URL_HTTP_CACHE !== null) && (!$https) && ((!$VIRTUALISED_ZONES_CACHE) || ($zone_for === null))) {\n return $BASE_URL_HTTP_CACHE . (empty($zone_for) ? '' : ('/' . $zone_for));\n }\n if (($BASE_URL_HTTPS_CACHE !== null) && ($https) && ((!$VIRTUALISED_ZONES_CACHE) || ($zone_for === null))) {\n return $BASE_URL_HTTPS_CACHE . (empty($zone_for) ? '' : ('/' . $zone_for));\n }\n\n global $SITE_INFO;\n if ((!isset($SITE_INFO)) || (empty($SITE_INFO['base_url']))) { // Try and autodetect the base URL if it's not configured\n $domain = get_domain();\n $script_name_path = dirname(isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : (isset($_ENV['SCRIPT_NAME']) ? $_ENV['SCRIPT_NAME'] : ''));\n if (($GLOBALS['RELATIVE_PATH'] === '') || (strpos($script_name_path, $GLOBALS['RELATIVE_PATH']) !== false)) {\n $script_name_path = preg_replace('#/' . preg_quote($GLOBALS['RELATIVE_PATH'], '#') . '$#', '', $script_name_path);\n } else {\n $cnt = substr_count($GLOBALS['RELATIVE_PATH'], '/');\n for ($i = 0; $i <= $cnt; $i++) {\n $script_name_path = dirname($script_name_path);\n }\n }\n $SITE_INFO['base_url'] = (tacit_https() ? 'https://' : 'http://') . $domain . str_replace('%2F', '/', rawurlencode($script_name_path));\n }\n\n // Lookup\n $base_url = $SITE_INFO['base_url'];\n global $CURRENT_SHARE_USER;\n if ($CURRENT_SHARE_USER !== null) {\n // Put in access domain, in case there is a custom domain attached to the site\n $domain = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : (isset($_ENV['HTTP_HOST']) ? $_ENV['HTTP_HOST'] : '');\n $base_url = preg_replace('#^http(s)?://([\\w]+\\.)?' . preg_quote($SITE_INFO['custom_share_domain'], '#') . '#', 'http$1://' . $domain, $base_url);\n }\n $found_mapping = false;\n if ($VIRTUALISED_ZONES_CACHE) { // Special searching if we are doing a complex zone scheme\n $zone_doing = ($zone_for === null) ? '' : str_replace('/', '', $zone_for);\n\n if (!empty($SITE_INFO['ZONE_MAPPING_' . $zone_doing])) {\n $domain = $SITE_INFO['ZONE_MAPPING_' . $zone_doing][0];\n $path = $SITE_INFO['ZONE_MAPPING_' . $zone_doing][1];\n $base_url = ((strpos($base_url, 'https://') === false) ? 'http://' : 'https://') . $domain;\n if ($path !== '') {\n $base_url .= '/' . $path;\n }\n $found_mapping = true;\n }\n }\n\n // Work out correct variant\n if ($https) {\n $base_url = 'https://' . preg_replace('#^\\w*://#', '', $base_url);\n if ((!$VIRTUALISED_ZONES_CACHE) || ($zone_for === null)) {\n $BASE_URL_HTTPS_CACHE = $base_url;\n }\n } elseif ((!$VIRTUALISED_ZONES_CACHE) || ($zone_for === null)) {\n $BASE_URL_HTTP_CACHE = $base_url;\n }\n\n if (!$found_mapping) { // Scope inside the correct zone\n $base_url .= (empty($zone_for) ? '' : ('/' . $zone_for));\n }\n\n // Done\n return $base_url;\n}", "private function build_cache_key_for_url( $url ) {\n\t\treturn 'g_url_details_response_' . md5( $url );\n\t}", "function get_cache_URI($set_uri = null){\n $CFG =& load_class('Config');\n $URI =& load_class('URI');\n\n $set_uri = (isset($set_uri)) ? $set_uri : $URI->uri_string;\n\n $cache_path = ($CFG->item('cache_path') == '') ? BASEPATH.'cache/' : $CFG->item('cache_path');\n\n if ( ! is_dir($cache_path) OR ! is_writable($cache_path))\n {\n return FALSE;\n }\n\n /*\n * Build the file path. The file name is an MD5 hash of the full URI\n *\n * NOTE: if you use .htaccess to remove your \"index.php\" file in the url\n * you might have to prepend a slash to the submitted$set_uri in order to \n * get it working.\n */\n $uri = $CFG->item('base_url').\n $CFG->item('index_page').\n $set_uri;\n\n return array('path'=>$cache_path, 'uri'=>$uri);\n }", "private function getUrl(){\r\n\t\tif ($GLOBALS['TSFE']->absRefPrefix) {\r\n\t\t\t$this->url = $GLOBALS['TSFE']->absRefPrefix;\r\n\t\t\treturn true;\r\n\t\t} else if ($GLOBALS['TSFE']->config['config']['baseURL']) {\r\n\t\t\t$this->url = $GLOBALS['TSFE']->config['config']['baseURL'];\r\n\t\t\treturn true;\r\n\t\t} else {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}", "public function getFromCache($key, $default_return=null){\n $cached_response= Cache::get($key);\n return (bool)$cached_response ? $cached_response : $default_return;\n }", "public function fetchFile($liveURL = \"\", $cacheExpiryTime = -1, $liveFetchFunction = null) {\n\n\t\t// First, check if a local copy exists in the cache\n\t\t$fileContents = null;\n\t\t$localFilepath = $this->getEntry($liveURL);\n\t\tif(!empty($localFilepath)) {\n\n\t\t\t// Yes, it exists. Is it expired?\n\t\t\t$fileStats = stat($localFilepath);\n\t\t\t$cacheExpiryDeadline = $fileStats[\"ctime\"] + $cacheExpiryTime * 60 * 1000; // add the expiry duration to the creation time\n\t\t\tif($cacheExpiryTime>=0 && $cacheExpiryDeadline <= time()) {\n\n\t\t\t\t// Yes, expired. Delete the entry and start afresh\n\t\t\t\t$this->removeEntry($liveURL, $localFilepath);\n\t\t\t\tunlink($localFilepath); // physically remove the file\n\n\t\t\t\t// Download afresh and return the contents\n\t\t\t\treturn $this->fetchLiveFile($liveURL, $liveFetchFunction);\n\n\t\t\t} else {\n\t\t\t\t// No, not expired. Read and return from cache\n\t\t\t\treturn file_get_contents($localFilepath);\n\t\t\t}\n\n\t\t} else {\n\t\t\t// No, there's no cached copy\n\t\t\t// Download afresh and return the contents\n\t\t\treturn $this->fetchLiveFile($liveURL, $liveFetchFunction);\n\t\t}\n\t}", "public function get($url)\n {\n if (isset($this->entries[$url])) {\n return $this->entries[$url];\n } else {\n return null;\n }\n }", "public function getCache() {\n\t\tif (file_exists($this->cache_file)) {\n\t\t\t$cache_contents = file_get_contents($this->cache_file);\n\t\t\treturn $cache_contents;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}" ]
[ "0.6388731", "0.6384673", "0.63411176", "0.62882966", "0.62544155", "0.6218115", "0.61667085", "0.61021096", "0.6101198", "0.6083538", "0.60320854", "0.6018289", "0.600961", "0.59426427", "0.59359604", "0.59247637", "0.5896218", "0.5884583", "0.5879206", "0.5811783", "0.5788009", "0.5787178", "0.57631284", "0.573767", "0.57291746", "0.57236546", "0.57182384", "0.57067955", "0.56671095", "0.5648584", "0.56476164", "0.56428885", "0.5640096", "0.56180674", "0.56145084", "0.56118494", "0.5601884", "0.55899435", "0.5583187", "0.5566469", "0.55597657", "0.5555225", "0.5538425", "0.55309796", "0.55282485", "0.552305", "0.552305", "0.5521478", "0.5512844", "0.55094516", "0.55074686", "0.5505435", "0.5492556", "0.5487429", "0.5487279", "0.547729", "0.5471829", "0.5471829", "0.5471829", "0.5468595", "0.54616076", "0.5460952", "0.5455139", "0.5450803", "0.5450343", "0.5444998", "0.5440232", "0.5432816", "0.54322743", "0.54306763", "0.54304945", "0.5427437", "0.54225534", "0.5412797", "0.54121983", "0.5411053", "0.541066", "0.54058635", "0.5404327", "0.5403021", "0.53967243", "0.53959453", "0.5393542", "0.5391967", "0.53878355", "0.537784", "0.537784", "0.537784", "0.5373461", "0.53674793", "0.5361624", "0.5356771", "0.53564095", "0.53552264", "0.5355215", "0.53522104", "0.53466797", "0.53455305", "0.53439724", "0.5343366" ]
0.61447453
7
Store rule (e.g. [[UrlRule]]) to internal cache.
protected function setRuleToCache($cacheKey, UrlRuleInterface $rule) { $this->_ruleCache[$cacheKey][] = $rule; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function saveCache(): void\n {\n //====================================================================//\n // Safety Check\n if (!isset($this->cacheItem) || !isset($this->cache) || empty($this->cache)) {\n return;\n }\n //====================================================================//\n // Save Links are In Cache\n $this->cacheItem->set($this->cache);\n $this->cacheAdapter->save($this->cacheItem);\n }", "protected function saveToCache() {}", "public function addRule(bnfRule $rule){\n\t\t$this->rules[] = $rule;\t\t\n\t}", "public function appendRule( $filter )\n {\n $this->rules[] = $filter;\n $this->clearCache();\n }", "function saveRulesToFile() {\n\t\tglobal $sugar_config;\n\n\t\t$file = $this->rulesCache.\"/{$this->user->id}.php\";\n\t\t$GLOBALS['log']->info(\"SUGARROUTING: Saving rules file [ {$file} ]\");\n\t\twrite_array_to_file('routingRules', $this->rules, $file);\n\t}", "public function add_rule( WP_Autoload_Rule $rule );", "protected function cacheSave() {\n $data = array();\n foreach ($this->properties as $prop) {\n $data[$prop] = $this->$prop;\n }\n //cache_set($this->id, $data, 'cache');\n }", "protected function addRule( phpucInputRule $rule )\n {\n $this->rules[] = $rule;\n }", "public static function add_rule(ACL_Rule $rule)\n\t{\n\t\t// Check if the rule is valid, if not throw an exception\n\t\tif ( ! $rule->valid())\n\t\t\tthrow new ACL_Exception('The ACL Rule was invalid and could not be added.');\n\n\t\t// Find the rule's key and add it to the array of rules\n\t\t$key = $rule->key();\n\t\tself::$_rules[$key] = $rule;\n\t}", "abstract public function addRule(ValidationRule$rule);", "public function addRule(Rule $rule): Manager\n {\n $this->rules[] = $rule;\n return $this;\n }", "public function addRule(RuleIface $rule);", "function save_mod_rewrite_rules()\n {\n }", "static function addRule(\\CharlotteDunois\\Validation\\RuleInterface $rule) {\n if(static::$rulesets === null) {\n static::initRules();\n }\n \n $class = \\get_class($rule);\n $arrname = \\explode('\\\\', $class);\n $name = \\array_pop($arrname);\n \n $rname = \\str_replace('rule', '', \\mb_strtolower($name));\n static::$rulesets[$rname] = $rule;\n \n if(\\mb_stripos($name, 'rule') !== false) {\n static::$typeRules[] = $rname;\n }\n }", "protected function _rule($rule, array $options = array()) {\n\t\t$this->rule = new $rule($options);\n\t\treturn $this->rule;\n\t}", "public function addRule(RuleIface $rule)\n {\n $this->rules[] = $rule;\n }", "public function saveToCacheForever();", "public function add_rule($key, $rule, $error = NULL, $name = NULL) {\n\t\t$this->rules[] = (object) array('key' => $key, 'rule' => $rule, 'error_msg' => $error, 'name' => $name);\n\t}", "function iis7_save_url_rewrite_rules()\n {\n }", "public function addRule(Rule $rule)\n {\n $this->rules[] = $rule;\n return $this;\n }", "public function saving(MActivityRule $model)\n\t{\n\t\t// 檢查 Rule 格式\n\t\tif ($model->rule == '') {\n\t\t\tthrow new \\Exception(\"规格不可为空. ({$model->name})\");\n\t\t}\n\t\t$activity_class = '\\App\\Activities\\Activity' . $model->activity_id;\n\t\tif (! class_exists($activity_class)) {\n\t\t\tthrow new \\Exception(\"未知的活动. (activity_id: {$model->activity_id})\");\n\t\t}\n\t\tif (! preg_match($activity_class::RULE_PATTERN, $model->rule)) {\n\t\t\tthrow new \\Exception(\"规则格式不符. ({$model->name})\");\n\t\t}\n\t}", "public function append(callable $rule)\n {\n $this->rules[] = $rule;\n }", "public function add(Rule $rule)\n {\n $this->rules[] = $rule;\n\n return true;\n }", "function hm_add_rewrite_rule( $rule, $query, $template = null, $args = array() ) {\n\n\tglobal $hm_rewrite_rules;\n\n\t$hm_rewrite_rules[ $rule ] = array( $rule, $query, $template, wp_parse_args( $args ) );\n\n}", "public function saved(MActivityRule $model)\n\t{\n\t}", "function set ($url, $rss) {\n $this->ERROR = \"\";\n $cache_file = $this->file_name( $url );\n $fp = @fopen( $cache_file, 'w' );\n \n if ( ! $fp ) {\n $this->error(\n \"Cache unable to open file for writing: $cache_file\"\n );\n return 0;\n }\n \n \n $data = $this->serialize( $rss );\n fwrite( $fp, $data );\n fclose( $fp );\n \n return $cache_file;\n }", "private function storeCacheSetting()\n {\n Cache::forever('setting', $this->setting->getKeyValueToStoreCache());\n }", "public static function addRule(\\GraphQL\\Validator\\Rules\\ValidationRule $rule)\n {\n }", "public function addRule($rule, $db){\r\n $sql = \"INSERT INTO rules(rule) values (:rule)\";\r\n $pdostm = $db->prepare($sql);\r\n $pdostm->bindParam(':rule', $rule);\r\n\r\n $count = $pdostm->execute();\r\n return $count;\r\n }", "public function addRule(RuleInterface $rule)\r\n\t{\r\n\t\t$this->rules[] = $rule;\r\n\t\t$this->dirty = true;\r\n\t\treturn $this;\r\n\t}", "function iis7_add_rewrite_rule($filename, $rewrite_rule)\n {\n }", "public static function save_cache() {\n if (self::$_cache_invalid) {\n if (@file_put_contents(self::$_path_cache_file\n , serialize(self::$_abs_file_paths))) {\n error_log('failed to write absolute file path cache to: ' . self::$_path_cache_file);\n }\n }\n }", "public function store($ob)\n {\n global $session;\n\n switch ($type = $ob->obType()) {\n case self::ACTION_BLACKLIST:\n $name = 'Blacklist';\n break;\n\n case self::ACTION_VACATION:\n $name = 'Vacation';\n break;\n\n case self::ACTION_WHITELIST:\n $name = 'Whitelist';\n break;\n\n case self::ACTION_FORWARD:\n $name = 'Forward';\n break;\n\n case self::ACTION_SPAM:\n $name = 'Spam Filter';\n break;\n\n default:\n $name = null;\n break;\n }\n\n if (!is_null($name) &&\n ($filters = $this->retrieve(self::ACTION_FILTERS)) &&\n ($filters->findRuleId($type) === null)) {\n $filters->addRule(array('action' => $type, 'name' => $name));\n $this->store($filters);\n }\n\n $this->_store($ob);\n $this->_cache[$type] = $ob;\n\n $session->set('ingo', 'change', time());\n }", "function addRule($key, $type, $arg = null)\n {\n $this->rules[] = array(\n 'key' => $key,\n 'type' => $type,\n 'arg' => $arg\n );\n }", "public function addRule($name, $rule) {\n\t\t$this->checkRule($name, $rule);\n\n\t\tforeach ($this->_inputs as $key => $input) {\n\t\t\tif ($input['name'] == $name) {\n\t\t\t\t$this->_inputs[$key]['rule'][] = $rule;\n\t\t\t}\n\t\t}\n\t}", "public function saveToCache(){\r\n\t\t$n = \"hotspot_\" . $this->id;\r\n\r\n\t\t\\CacheHandler::setToCache($n,$this,20*60);\r\n\t}", "public function addRuleSet(RuleSet $rule)\n {\n $this->ruleSets[] = $rule;\n }", "public static function add_rewrite_rule()\n {\n }", "protected function register_rewrite_rules() {\n\t\tif ( ! empty( $this->rules ) ) {\n\t\t\tforeach ( $this->rules as $value ) {\n\t\t\t\tadd_rewrite_rule( $value['regex'], $value['replace'], $value['type'] );\n\t\t\t}\n\t\t}\n\t}", "public function cache()\n {\n\n $route = Route::requireRoueFiiles();\n if (file_put_contents($this->cacheFile, serialize($route))) {\n echo 'OK';\n } else {\n echo 'ERROR';\n }\n }", "function addRuleToBlacklist($type, $rule) {\n if (!in_array($type, array('handle', 'email', 'password'))) {\n return FALSE;\n }\n\n $rule = $this->convertToSqlLikeValue($rule);\n\n // Now check whether this rule already exists\n $sql = \"SELECT COUNT(*)\n FROM %s\n WHERE blacklist_type = '%s'\n AND blacklist_match = '%s'\";\n $sqlParams = array($this->tableBlacklist, $type, $rule);\n $amount = 0;\n if ($res = $this->databaseQueryFmt($sql, $sqlParams)) {\n if ($count = $res->fetchField()) {\n $amount = $count;\n }\n }\n if ($amount > 0) {\n return FALSE;\n }\n // Checks passed, so add the rule\n $data = array(\n 'blacklist_type' => $type,\n 'blacklist_match' => $rule\n );\n $success = $this->databaseInsertRecord(\n $this->tableBlacklist, 'blacklist_id', $data\n );\n return $success;\n }", "public function addRule(string $field, IValidationRule $rule): void;", "public function clearCache()\n\t{\n\t\tYii::app()->cache->delete('customurlrules');\n\t}", "public function clearCache()\n\t{\n\t\tYii::app()->cache->delete('customurlrules');\n\t}", "public function setRule($rule) {\n\t\t$this->rule = $rule;\n\n\t\tif (!isset($this->rules[$rule])) {\n\t\t\t$this->rules[$rule] = [\n\t\t\t\t'constraints' => [],\n\t\t\t\t'filters' => [],\n\t\t\t\t'is_valid' => true\n\t\t\t];\n\t\t}\n\n\t\treturn $this;\n\t}", "public function add($name, $rule = null) {\n\t\t$this->_rules = Set::merge($this->_rules, is_array($name) ? $name : array($name => $rule));\n\t}", "private function addRule($column, $rule)\n {\n if (!array_key_exists($column, $this->rules)) {\n $this->rules[$column] = '';\n }\n\n $this->rules[$column] .= '|' . $rule;\n $this->rules[$column] = trim($this->rules[$column], '|');\n }", "protected function _afterSave(AbstractModel $rule)\n {\n if ($rule->hasWebsiteIds()) {\n $websiteIds = $rule->getWebsiteIds();\n if (!is_array($websiteIds)) {\n $websiteIds = explode(',', (string)$websiteIds);\n }\n $this->bindRuleToEntity($rule->getId(), $websiteIds, 'website');\n }\n\n if ($rule->hasData('store_templates')) {\n $this->_saveStoreData($rule);\n }\n\n parent::_afterSave($rule);\n return $this;\n }", "public function add_rule($selector)\n {\n }", "protected function fill($rule)\n {\n foreach ($rule as $key => $value) {\n $this->setAttribute($key, $value);\n }\n }", "public function saveCache()\n {\n if($this->isCacheExists()){\n if($this->isUpdateRequired()){\n $this->updateCache();\n }\n } else {\n $this->packData()->writeFile();\n }\n }", "public function __set($rule, $value)\n {\n if( isset($this->rules[$rule]) )\n {\n if( 'integer' == $this->rules[$rule]['type'] && is_int($value) )\n return $this->rules[$rule]['value'] = $value;\n\n if( 'boolean' == $this->rules[$rule]['type'] && is_bool($value) )\n return $this->rules[$rule]['value'] = $value;\n }\n return false;\n }", "public function getRule();", "protected function writeCache($url, $result)\n {\n $filename = $this->getCacheFilename($url);\n $cache_dir = dirname($filename);\n if (!@mkdir($cache_dir) && !is_dir($cache_dir)) {\n // TODO log error or throw exception\n return;\n }\n file_put_contents($filename, $result);\n }", "public function addRule(RuleInterface $rule)\n {\n $ruleClass = get_class($rule);\n $name = $ruleClass::getName();\n\n if ($target = $rule->getValidationTarget()) {\n $this->rules[$name][$target] = $rule;\n } else {\n $this->rules[$name][] = $rule;\n }\n }", "function preflightCache() {\n\t\t$moduleDir = (isset($this->bean->module_dir) && !empty($this->bean->module_dir)) ? $this->bean->module_dir : \"General\";\n\t\t$this->rulesCache = sugar_cached(\"routing/{$moduleDir}\");\n\n\t\tif(!file_exists($this->rulesCache)) {\n\t\t\tmkdir_recursive($this->rulesCache);\n\t\t}\n\t}", "public function cache() {\r\n\t\t$this->resource->cache();\r\n\t}", "function rewrite_rules($wp_rewrite) {\n $new_rules = array(\n 'hcard_url/(.+)' => 'index.php?hcard_url=' . $wp_rewrite->preg_index(1)\n );\n $wp_rewrite->rules = $new_rules + $wp_rewrite->rules;\n }", "public function __construct($rule)\n {\n $this->rule = $rule;\n }", "public function setCache($url,$data){\n\t\t$hash = md5($url);\n\t\treturn apc_add($hash, $data, $this->expire_time);;\n\t}", "public function store($key,$var,$ttl);", "private function addRule($type, Rule $newRule = null)\n {\n if (!$newRule) {\n return;\n }\n\n $this->rules->add($newRule, $type);\n }", "public function add(RuleElement\\Element $element) {\n $this->elements[] = $element;\n\n return $this;\n }", "public function updateRule($id, \\Watchdog\\Entities\\Rule $rule)\n {\n\t\tif (isset($this->rules[$id]) && $this->rules[$id] instanceof \\Watchdog\\Entities\\Rule) {\n\t\t\t$this->rules[$id] = $rule;\n\t\t\t\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\treturn false;\n\t}", "private function _cacheStore($method, $url, $params, $response, $headers)\n\t {\n\t\t$cachecontrol = $this->httpheader(\"Cache-Control\");\n\t\tif ($cachecontrol !== \"no-cache\" && $cachecontrol !== \"no-store\")\n\t\t {\n\t\t\t$expires = $this->httpheader(\"Expires\");\n\t\t\tif (preg_match(\"/max-age=(?P<maxage>\\d+)/\", $cachecontrol, $m) > 0)\n\t\t\t {\n\t\t\t\t$ttl = $m[\"maxage\"];\n\t\t\t }\n\t\t\telse if ($expires !== false)\n\t\t\t {\n\t\t\t\ttry\n\t\t\t\t {\n\t\t\t\t\t$now = new DateTime(\"now\");\n\t\t\t\t\t$expiry = new DateTime($expires);\n\t\t\t\t\t$ttl = ($expiry->getTimestamp() - $now->getTimestamp());\n\t\t\t\t\tif ($ttl < 0)\n\t\t\t\t\t {\n\t\t\t\t\t\t$ttl = 0;\n\t\t\t\t\t }\n\t\t\t\t }\n\t\t\t\tcatch (Exception $e)\n\t\t\t\t {\n\t\t\t\t\t$ttl = 0;\n\t\t\t\t }\n\t\t\t }\n\t\t\telse\n\t\t\t {\n\t\t\t\t$now = new DateTime(\"now\");\n\t\t\t\t$expiry = clone $now;\n\t\t\t\t$interval = new DateInterval(\"P1Y\");\n\t\t\t\t$expiry->add($interval);\n\t\t\t\t$ttl = ($expiry->getTimestamp() - $now->getTimestamp());\n\t\t\t } //end if\n\n\t\t\tif ($ttl > 0)\n\t\t\t {\n\t\t\t\t$this->_db->execBinaryBlob(\n\t\t\t\t \"INSERT INTO `HTTPcache` SET \" .\n\t\t\t\t \"`method` = \" . $this->_db->sqlText($method) . \", \" .\n\t\t\t\t \"`url` = \" . $this->_db->sqlText($url) . \", \" .\n\t\t\t\t \"`params` = \" . $this->_db->sqlText($params) . \", \" .\n\t\t\t\t \"`response` = ?, \" .\n\t\t\t\t \"`headers` = ?, \" .\n\t\t\t\t \"`datetime` = NOW(), \" .\n\t\t\t\t \"`expiry` = DATE_ADD(NOW(), INTERVAL \" . $ttl . \" SECOND)\",\n\t\t\t\t array(\n\t\t\t\t bzcompress($response),\n\t\t\t\t bzcompress(serialize($headers)),\n\t\t\t\t )\n\t\t\t\t);\n\t\t\t }\n\t\t } //end if\n\t }", "public function addRule(FormRule $formRule){\n\t\tif(is_a($formRule,'FormRule')===false){\n\t\t\tFormItBuilder::throwError('Form rule \"'.$formRule.'\" is not a valid FormRule type. Recommend using FormRuleType constants to define rule type.');\n\t\t}else{\n\t\t\t$this->_rules[]=$formRule;\n\t\t}\n\t}", "public function rule(array $rule){\n\n\t\t$this->rule = $rule;\n\n\t\treturn $this;\n\t}", "public function addRule($pName, $rule) {\n if (!$this->isValidPropertyName($pName)) {\n throw new Exceptions\\InvalidArgument(\"Property name can't be empty\");\n }\n if (!empty($this->propertiesNames[$pName])) {\n $pID = $this->propertiesNames[$pName];\n $property = $this->properties[$pID];\n } else {\n $property = new Target\\Property($pName);\n $pID = $property->getID();\n $this->properties[$pID] = $property;\n $this->propertiesNames[$pName] = $pID;\n }\n return $property->attachRule($rule);\n }", "private function addRule( $rule_name, $field, $value )\n {\n if ( !isset ( $this->rules[$field] ))\n $this->rules[$field] = array( );\n if ( is_array( $value ))\n array_shift( $value );\n // remove the first element becaust it's contains the rule name.\n $this->rules[$field][$rule_name] = $value;\n }", "public function setAssetRules(JAsset $asset)\n {\n\t\tif ($this->getRules() instanceof \\JAccessRules)\n\t\t{\n $rules = $this->getRules();\n }\n else\n {\n // set the asset record's rules property to an empty object\n $rules = new Registry();\n }\n\n // Use Asset's method for setting rules\n $asset->setRules( json_encode($rules) );\n\n return $this;\n }", "function store_into_cache($key, $val, $ttl = CACHE_TTL){\n\tglobal $SYSTEM_SHOW_CACHE_METRICS, $TAG;\n\n\t$key = \"$TAG:$key\";\n\n\t$timer_bgn = microtime(true);\n\n\tif ( function_exists('apc_store') ) {\n\t\tapc_store($key, $val, $ttl);\n\t} else {\n\t\t$redis = conn_redis();\n\t\t$redis->setex($key, $ttl, json_encode($val, JSON_NUMERIC_CHECK));\n\t}\n\n\t$timer_end = microtime(true);\n\tif ($SYSTEM_SHOW_CACHE_METRICS)\n\t\telog(\"time took caching for key: $key: \" . ($timer_end - $timer_bgn));\n\n\treturn $val;\n}", "public function getRule(): RuleInterface\n {\n return $this->rule;\n }", "protected function setValidationRule($field_name, $rule_str) {\n\n //separate the rule to get the ones that have association with the db\n $rules = explode(\":\", $rule_str);\n\n if(in_array($rules[0], ['exists', 'unique'])) {\n\n //set the keyword\n $rule_keyword = $rules[0];\n\n //set the table\n $db_table = $rules[1];\n\n //set the validation rule\n $rule = Rule::$rule_keyword($db_table);\n\n if($rule_keyword == 'unique' && !empty($this->model_instance)) \n $rule = $rule->ignore($this->model_instance);\n\n $this->validation_rules[$field_name][] = $rule;\n\n } else {\n\n $this->validation_rules[$field_name][] = $rule_str;\n\n }\n\n }", "public function updateRule($id, $rule, $db){\r\n $sql = \"UPDATE rules SET \r\n rule = :rule\r\n WHERE id = :id\";\r\n\r\n $pdostm = $db->prepare($sql);\r\n\r\n $pdostm->bindParam(':rule', $rule);\r\n $pdostm->bindParam(':id', $id);\r\n\r\n $count = $pdostm->execute();\r\n return $count;\r\n }", "public function saveInCache($category){\n $categoryIds = [];\n $categoryPages = [];\n\n // Throw an exception if a client or server error occurred, if no error occured throw() returns the response\n array_push($categoryPages, Http::get('https://swapi.dev/api/' . $category)->throw()->json());\n\n $i = 0;\n // Request the next page as long as there is one, and add it to the $categoryPages array.\n while($categoryPages[$i]['next']) {\n array_push($categoryPages, Http::get($categoryPages[$i]['next'])->throw()->json());\n $i++;\n }\n\n /**\n * For each entry in each page save the response with it's url as key in the cache.\n * Also save an array of all valid resource ids, which can later be used to access all resources via url.\n */\n foreach($categoryPages as $page) {\n foreach($page['results'] as $result) {\n Cache::put($result['url'], $result);\n array_push($categoryIds, filter_var($result['url'], FILTER_SANITIZE_NUMBER_INT));\n }\n }\n Cache::put($category . 'Ids', $categoryIds);\n }", "public function cache() {\n if(!array_key_exists($this->steamId64, self::$steamIds)) {\n self::$steamIds[$this->steamId64] = $this;\n if(!empty($this->customUrl) &&\n !array_key_exists($this->customUrl, self::$steamIds)) {\n self::$steamIds[$this->customUrl] = $this;\n }\n }\n }", "public function addRule(array $rule, $overwrite = false)\n {\n if($overwrite)\n {\n array_merge($this->rules, $rule);\n }\n else\n {\n $val = '';\n if(array_key_exists(key($rule), $this->rules))\n {\n $val = $this->rules[key($rule)].'|';\n }\n $this->rules[key($rule)] = $val.$rule[key($rule)];\n }\n \n return $this;\n }", "public function storeCache() {\n\t\tif ($this->cacheFilePath) {\n\t\t\tfile_put_contents($this->cacheFilePath, serialize($this->classFileIndex));\n\t\t}\n\t}", "protected function addRule($perm, $rule)\n {\n $rule['mask'] = $perm;\n\n $this->rules[] = $rule;\n\n return $this;\n }", "public function rules()\n\t{\n if($this->route('id'))\n {\n return $this->update();\n }\n\n return $this->store();\n\t}", "protected static function replaceWithRule($rule, $output)\n {\n foreach ($rule as $data) {\n $from = \"~\".json_decode('\"'.$data[\"from\"].'\"').\"~u\";\n $to = json_decode('\"'.$data[\"to\"].'\"');\n $output = preg_replace($from, $to, $output);\n }\n return $output;\n }", "static public function add_rewrite_rules(){\n\t global $wp,$wp_rewrite; \n\t $wp->add_query_var( 'profile' );\n\n\t foreach( AT_Route::fronted() as $key=>$params ){\n\t\t\t$wp_rewrite->add_rule('^' .$key, 'index.php?profile=true', 'top');\n\t\t\tforeach ( $params['regular_expressions'] as $key => $expression ) {\n\t\t\t\t$wp_rewrite->add_rule('^' .$key . $expression, 'index.php?profile=true', 'top');\n\t\t\t}\n\n\t }\n\n\t $wp_rewrite->flush_rules();\n\t}", "protected function cacheModel()\n {\n $xmlObject = $this->getSimpleXmlObject();\n if ($xmlObject === null) {\n return;\n }\n\n $this->cache = $this->convertItem($xmlObject);\n }", "protected function _storeParse(Library\\CommandInterface $command)\n {\n $identifier = $command->url->toString(Library\\HttpUrl::PATH);\n\n $this->_parse_routes[$identifier] = clone $command->result;\n }", "public function loadFromCache() {\n parent::loadFromCache();\n $this->historyLinks = $this->data;\n }", "public function attachRule($rule_object)\n {\n if(!($rule_object instanceof UQLRule))\n return false;\n\n $rule_object->rules_error_flag = false;\n\n $this->rules_objects_list[$rule_object->getTableName()] = $rule_object;\n return true;\n }", "function loadRules() {\n\t\tglobal $sugar_config;\n\n\t\t$this->preflightCache();\n\n\t\t$file = $this->rulesCache.\"/{$this->user->id}.php\";\n\n\t\t$routingRules = array();\n\n if (file_exists($file)) {\n include FileLoader::validateFilePath($file); // force include locally\n }\n\n\t\t$this->rules = $routingRules;\n\t}", "protected function createRuleObject($rule, $key, $value): RuleInterface\n {\n if ($rule === $key) {\n return new $key($value);\n }\n\n return new $value();\n }", "public function set($key, $ttl, $data)\r\r\n\t{\r\r\n\t\t$this->set_count++;\r\r\n\r\r\n\t\tif ($ttl != CPF_CACHE_TIME_NEVER)\r\r\n\t\t{\r\r\n\t\t\t$this->_storage->set($key, $ttl, $data);\r\r\n\t\t}\r\r\n\t\telse\r\r\n\t\t{\r\r\n\t\t\t$this->_storage->remove($key);\r\r\n\t\t}\r\r\n\t}", "public function testSetRule()\n {\n /** @var \\Magento\\SalesRule\\Model\\Rule|\\PHPUnit_Framework_MockObject_MockObject $ruleMock */\n $ruleMock = $this->createPartialMock(\\Magento\\SalesRule\\Model\\Rule::class, ['getId', '__wakeup']);\n $ruleMock->expects($this->once())->method('getId');\n\n $this->assertEquals($this->couponModel, $this->couponModel->setRule($ruleMock));\n }", "public function addRule(PublicApiRuleInterface $rule)\n {\n $this->rules[$rule->getModelClass()][$rule->getModelType()] = $rule;\n return $this;\n }", "public function getRule()\n {\n return $this -> rule;\n }", "public function getRule()\n\t{\n\t\treturn $this->rule;\n\t}", "public function addGameRule($data)\n {\n $this->load->library('s3');\n $base = \"https://d23kds0bwk71uo.cloudfront.net/\" .getenv(\"ENV\"). \"/game_rules/\";\n //Save the file first\n $cur_file = $data['serial_number'] . \".txt\";\n $filename = rand(1, 10000000);\n $fh = fopen(\"/tmp/\" . $filename, \"w\");\n fwrite($fh, $data['text']);\n fclose($fh);\n\n try{\n $this->s3->putObjectFile(\"/tmp/\" . $filename, 'kizzang-legal', getenv(\"ENV\"). '/game_rules/' . $cur_file, 'public-read');\n } catch (Exception $ex) {\n log_message(\"error\", $ex->getMessage());\n return false;\n } \n \n //Time to put it into the DB\n $rec = array();\n $rec['serialNumber'] = $data['serial_number'];\n $rec['gameType'] = $data['game_type'];\n $rec['ruleURL'] = $base . $cur_file;\n $rec['name'] = $data['name'];\n $rec['startDate'] = $data['startDate'];\n $rec['endDate'] = $data['endDate'];\n $rs = $this->db->query(\"Select * from GameRules where serialNumber = ?\", array($data['serial_number']));\n if($rs->num_rows())\n {\n $this->db->where('serialNumber', $data['serial_number']);\n $this->db->update('GameRules', $rec);\n }\n else\n {\n $this->db->insert(\"GameRules\", $rec);\n }\n admin_model::addAudit($this->db->last_query(), \"admin_model\", \"addGameRules\");\n //Invalidate file \n //$this->invalidateCloudfrontFiles(\"kizzang-legal\", array(ENV . '/game_rules/' . $cur_file));\n return true; \n }", "public function save($key, $data, $ttl=0)\n\t{\n\n\t\t$success = $this->_cache->set($key, $data, $ttl);\n\t\treturn $success;\n\n\t}", "private function _saveCache($buffer)\r\n {\r\n // build the hash for this object\r\n $hash = md5($buffer);\r\n \r\n // save to the cache\r\n file_put_contents(\"{$this->_config['paths']['cache']}/{$hash}\", $buffer);\r\n }", "function updateCharRule($obj, $rule, $value) {\n\t\t$sql = \"UPDATE `char_rules` SET `value`=$value WHERE `objFK`=$obj AND `rule`=$rule and `charFK`=$this->uid LIMIT 1\";\n\t\t$this->mysqli->query($sql);\n\t\tif ($this->mysqli->affected_rows==0) {\n\t\t\tif ($this->getCharRule($obj, $rule)>-1) return -2;//The status was already the same\n\t\t\t\n\t\t\t$sql = \"INSERT INTO `char_rules` (`uid`, `objFK`, `charFK`, `rule`, `value`) VALUES (NULL, '$obj', '$this->uid', '$rule', '$value')\";\n\t\t\t$this->mysqli->query($sql);\n\t\t\t$result = $this->mysqli->insert_id;\n\t\t\tif ($result) return 1;//insert success\n\t\t\telse return -1;\n\t\t}\n\t\treturn 2;//update success\n\t}", "public function addRules($rules)\r\n {\r\n $this->_rules = $rules;\r\n }", "function insertRule($name, $tgt = null)\n {\n $name = ucwords(strtolower($name));\n if (! is_null($tgt)) {\n $tgt = ucwords(strtolower($tgt));\n }\n \n // does the rule name to be inserted already exist?\n if (in_array($name, $this->rules)) {\n // yes, return\n return null;\n }\n \n // the target name is not null, and not '', but does not exist\n // in the list of rules. this means we're trying to insert after\n // a target key, but the target key isn't there.\n if (! is_null($tgt) && $tgt != '' &&\n ! in_array($tgt, $this->rules)) {\n return false;\n }\n \n // if $tgt is null, insert at the end. We know this is at the\n // end (instead of resetting an existing rule) becuase we exited\n // at the top of this method if the rule was already in place.\n if (is_null($tgt)) {\n $this->rules[] = $name;\n return true;\n }\n \n // save a copy of the current rules, then reset the rule set\n // so we can insert in the proper place later.\n // where to insert the rule?\n if ($tgt == '') {\n // insert at the beginning\n array_unshift($this->rules, $name);\n return true;\n }\n \n // insert after the named rule\n $tmp = $this->rules;\n $this->rules = array();\n \n foreach ($tmp as $val) {\n $this->rules[] = $val;\n if ($val == $tgt) {\n $this->rules[] = $name;\n }\n }\n \n return true;\n \n }", "function drush_rules_export($rule) {\n\n // The $rule argument could refer to a Reaction Rule or a Rules Component.\n $config = \\Drupal::service('config.storage')->read('rules.reaction.' . $rule);\n if (empty($config)) {\n $config = \\Drupal::service('config.storage')->read('rules.component.' . $rule);\n if (empty($config)) {\n return drush_set_error('', dt('Could not find a Reaction Rule or a Rules Component named \"!rule-name\".', ['!rule-name' => $rule]));\n }\n }\n\n drush_print(Yaml::encode($config), 0, NULL, FALSE);\n drush_log(dt('The rule \"!name\" has been exported.', ['!name' => $rule]), 'success');\n}" ]
[ "0.5680179", "0.55724484", "0.55054665", "0.5440866", "0.54273087", "0.538548", "0.5383786", "0.53703", "0.5359271", "0.53575253", "0.53458375", "0.5341233", "0.53408355", "0.53124565", "0.5282261", "0.52774346", "0.52530915", "0.5242294", "0.52031064", "0.5185662", "0.51528126", "0.515059", "0.5133889", "0.51202947", "0.51146185", "0.51046664", "0.50630987", "0.50474805", "0.50421715", "0.5036526", "0.50365007", "0.5014375", "0.5002408", "0.49995902", "0.49942684", "0.49807262", "0.49667418", "0.4958076", "0.4942931", "0.4929115", "0.49074057", "0.4869907", "0.48610708", "0.48610708", "0.4854926", "0.4848582", "0.48482466", "0.4829598", "0.4816845", "0.4808526", "0.47920546", "0.47883058", "0.478489", "0.47654268", "0.47639632", "0.4758618", "0.475801", "0.47438213", "0.47400874", "0.47327408", "0.47291404", "0.470908", "0.470902", "0.47065058", "0.4698197", "0.4690568", "0.46838194", "0.4671003", "0.46572816", "0.46555865", "0.46529645", "0.46359786", "0.4632569", "0.46290004", "0.46160635", "0.4612524", "0.46080595", "0.46068847", "0.4604171", "0.4587286", "0.45808074", "0.45800474", "0.45653766", "0.45524073", "0.45453602", "0.45426655", "0.45420206", "0.45408514", "0.4538749", "0.45184582", "0.4512695", "0.4512497", "0.45031574", "0.45015138", "0.44928282", "0.4484939", "0.44838062", "0.44799653", "0.44739437", "0.44692692" ]
0.712807
0
Procura no banco todos os clientes retornando um array
public function actionLista() { $model = Cliente::findall(); // Criação do provider para uso no grid view if ($model) { $provider = new ArrayDataProvider([ 'allModels' => $model, 'sort' => [ // 'attributes' => ['cpf_cliente', 'nome', 'telefone'], ], 'pagination' => [ 'pageSize' => 10, ], ]); } else $provider = null; return $this->render('cliente/lista', ['dataProvider' => $provider]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function listarClientes(){\n $this->bd->getConeccion();\n $sql = \"SELECT * FROM CLIENTE\";\n $registros = $this->bd->executeQueryReturnData($sql); \n $this->bd->cerrarConeccion(); \n $clientes = array(); \n \n foreach ($registros as $cliente) {\n $cliente = new Cliente($cliente['id'],$cliente['dni'],$cliente['Nombre'],$cliente['Apellido'],$cliente['Correo'],$cliente['Telefono']);\n array_push($clientes, $cliente);\n }\n \n return $clientes; \n }", "public function listaCliente() {\n\n return $clientes; // array de clientes\n }", "public function get_all()\n {\n $conn = db();\n \n $clientes = [];\n \n $consulta = \"SELECT * FROM cliente\";\n try{\n \n $stmt = $conn->query($consulta);\n \n }catch(PDOException $ex){\n console_log($ex->getMessage());\n }\n\n while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {\n $clientes[] = [\n 'id' => $row['id'],\n 'username' => $row['username'],\n 'passwd' => $row['passwd'],\n 'nombre' => $row['nombre'],\n 'apellidos' => $row['apellidos'],\n 'email' => $row['email'],\n 'domicilio' => $row['domicilio'],\n 'fechaCreacion' => $row['fechaCreacion'],\n 'fechaModificacion' => $row['fechaModificacion'],\n 'Cesta_id' => $row['Cesta_id']\n ];\n }\n return $clientes;\n \n }", "private function lista_clientes()\n {\n\n $lista_clientes = Cliente::where('status', 1)\n ->orderBy('nome')\n ->get();\n\n return $lista_clientes;\n }", "public function getAllClients(){\n\t\t$sql = \"SELECT * FROM cliente;\";\n\t\treturn $this->Model->getData($sql);\n\t}", "function Listar_Clientes()\n\t {\n\t\tlog_message('INFO','#TRAZA| CLIENTES | Listar_Clientes() >> ');\n\t\t$data['list'] = $this->Clientes->Listar_Clientes();\n return $data;\n\t }", "public function ListarClientes()\n{\n\tself::SetNames();\n\t$sql = \" select * from clientes \";\n\tforeach ($this->dbh->query($sql) as $row)\n\t{\n\t\t$this->p[] = $row;\n\t}\n\treturn $this->p;\n\t$this->dbh=null;\n}", "public function getAllCliente() {\n try {\n $sql = \"SELECT * FROM cliente\";\n $stm = $this->pdo->prepare($sql);\n $stm->execute();\n $dados = $stm->fetchAll(PDO::FETCH_OBJ);\n return $dados;\n } catch (PDOException $erro) {\n echo \"<script>alert('Erro na linha: {$erro->getLine()}')</script>\";\n }\n }", "public static function traerTodosLosClientes()\n {\n $objetoAccesoDato = AccesoDatos::dameUnObjetoAcceso();\n $consulta = $objetoAccesoDato->RetornarConsulta(\"SELECT * \n FROM usuarios AS u, clientes AS c \n WHERE u.id_usuario=c.id_usuario\");\n \n $consulta->execute();\n $consulta = $consulta->fetchAll(PDO::FETCH_ASSOC);\n return json_encode($consulta);\n }", "public function listClients(){\n $mysql= $this->database->databaseConnect();\n $sql = 'SELECT * FROM client';\n $query = mysqli_query($mysql, $sql) or die(mysqli_connect_error());\n $this->database->databaseClose();\n\n while($row = mysqli_fetch_assoc($query)){\n $this->clients[] = $row;\n }\n\n return $this->clients;\n }", "public function &getListaClienti() {\n $clienti = array();\n $query = \"select * from clienti\";\n \n $mysqli = Db::getInstance()->connectDb();\n if (!isset($mysqli)) {\n error_log(\"[getListaClienti] impossibile inizializzare il database\");\n $mysqli->close();\n return $clienti;\n }\n $result = $mysqli->query($query);\n if ($mysqli->errno > 0) {\n error_log(\"[getListaClienti] impossibile eseguire la query\");\n $mysqli->close();\n return $clienti;\n }\n\n while ($row = $result->fetch_array()) {\n $clienti[] = self::creaClienteDaArray($row);\n }\n\n return $clienti;\n }", "public function getAllClients() {\n // On récupère tout le contenu de la table clients\n $queryResult = $this->database->query('SELECT * FROM clients'); \n $allClientsData = $queryResult->fetchAll(PDO::FETCH_OBJ);\n return $allClientsData;\n }", "function leerClientes(){\n \n try{\n $stmt = $this->dbh->prepare(\"SELECT c.idClienteTg, c.NombreCte,c.RFCCte, c.direccion, c.ciudad,c.estado, c.email, c.telefono, c.numTg,r.nombreReferencia FROM referencias r join tarjetas_clientes c on r.idreferencia=c.referenciaId where c.status=1\");\n // Especificamos el fetch mode antes de llamar a fetch()\n $stmt->execute();\n $clientes = $stmt->fetchAll(PDO::FETCH_NUM);\n } catch (PDOException $e){\n $clientes=array(\"status\"=>\"0\",\"mensaje\"=>$e->getMessage());\n }\n \n return $clientes;\n }", "public function CarregaClientes() {\n\t\t$clientes = new Model_Wpr_Clientes_ClientesIntegracao ();\n\t\t\n\t\treturn $clientes->carregaClientes ();\n\t}", "public function consultarCliente(){\n //$conexao = $c->conexao();\n\n $sql = \"SELECT * FROM tbclientes order by nome; \";\n $sql = $this->conexao->query($sql);\n\n $dados = array();\n\n while ($row = $sql->fetch_array()) { \n $dado = array();\n $dado['reg'] = $row[\"reg\"];\n $dado['nome'] = $row[\"nome\"];\n $dado['nomeFantasia'] = $row[\"nomefantasia\"];\n $dado['rg'] = $row[\"rg\"];\n $dado['cpf'] = $row[\"cpf\"];\n $dado['cnpj'] = $row[\"cnpj\"];\n $dado['telefone'] = $row[\"telefone\"];\n $dado['dt_nascimento'] = $row[\"dt_nascimento\"];\n $dado['habilitado'] = $row[\"habilitado\"];\n $dados[] = $dado;\n } \n\n return $dados; \n \n }", "function read_client(){\n $client = array();\n \n $sql = \"SELECT * FROM client ORDER BY id_client ASC\";\n \n $res = $this->pdo->query($sql);\n\n if(!$res){\n $this->message = \"impossible d'afficher les clients\";\n return false;\n }\n while($resultats = $res->fetch(PDO::FETCH_OBJ)){\n \t$client[$resultats->id_client] = $resultats;\n\t\t}\n return $client;\n }", "public function lista() {\n $sql = \"SELECT * FROM cliente\";\n $qry = $this->db->query($sql); // query do pdo com acesso ao bd\n\n //return $qry->fetchAll(); // retorna todos os registros\n return $qry->fetchAll(\\PDO::FETCH_OBJ); // retorna todos os registros a nível de objeto\n }", "public function listadoPedidos(){\n $pedido=new Pedido();\n\n //Conseguimos todos los usuarios\n $allPedido=$pedido->getAll();\n print_r(json_encode($allPedido));\n //echo $allClientes\n }", "public function client_getAll(){\n $array = array();\n if( $stmt = $this->connection->prepare(\"SELECT * FROM clients;\") ){\n $stmt->execute();\n $stmt->bind_result($id, $type, $name, $company, $address, $email, $phone);\n \n $results = array();\n while( $stmt->fetch() ){\n $Client = new Client($id, $type, $name, $company, $address, $email, $phone);\n $results[] = $Client;\n } \n \n $stmt->close();\n return $results;\n }\n return null;\n }", "public function getAllClient() {\n $qb = $this ->createQueryBuilder('p')\n ->select('p')\n ->where('p.estEmploye = 0')\n ->orderBy('p.nom');\n return $qb->getQuery()->getResult();\n }", "public function listar_clientes(){\n\t\t$sql=\"SELECT idpersona, tipo_persona, nombre, tipo_documento, num_documento, contacto, direccion, telefono, email FROM persona\n\t\tWHERE tipo_persona LIKE 'Cliente'\";\n\t\treturn ejecutarConsulta($sql);\n\t}", "public function getClientes()\n {\n return $this->clientes;\n }", "public function getClientes()\n {\n return $this->clientes;\n }", "public function get_clientes()\n\t{\n\t\treturn $this->db->get(\"clientes\");\n\t}", "public function fetchClients(){\n $sql = $this->db->query(\"SELECT id,dni_c,nombre_c,apellidos_c,telefono FROM cliente WHERE activo=1 ORDER BY apellidos_c\");\n $list_db = $sql->fetchAll(PDO::FETCH_ASSOC);\n\n if($list_db != NULL) {\n return $list_db;\n } else {\n return NULL;\n }\n }", "public function consultarClientes() {\n\n $conexion = new conexion();\n $sql = \"select nit, nombre from cliente_general where estado = 'A' group by nit,nombre order by nombre\";\n $resulConsulta = $conexion->consultar($sql);\n\n return $resulConsulta;\n }", "function leerCreditos(){\n \n try{\n $stmt = $this->dbh->prepare(\"SELECT c.idcredito, t.NombreCte,c.tipoContrato, c.montoTotal, c.plazo,c.mensualidad, c.interes,\"\n . \" c.metodoPago, c.observaciones, c.status FROM tarjetas_clientes t join credito c on t.idClienteTg=c.cteId where c.status=1 or c.status=3\");\n // Especificamos el fetch mode antes de llamar a fetch()\n $stmt->execute();\n $clientes = $stmt->fetchAll(PDO::FETCH_NUM);\n } catch (PDOException $e){\n $clientes=array(\"status\"=>\"0\",\"mensaje\"=>$e->getMessage());\n }\n \n return $clientes;\n }", "public static function getAll()\n {\n $consulta = \"SELECT * FROM clientes\";\n try {\n // Preparar sentencia\n $comando = Database::getInstance()->getDb()->prepare($consulta);\n // Ejecutar sentencia preparada\n $comando->execute();\n\n return $comando->fetchAll(PDO::FETCH_ASSOC);\n\n } catch (PDOException $e) {\n return false;\n }\n }", "function _ConsultarClientes()\n\t\t{\n\t\t\t$query='\n\t\t\t\tSELECT\n\t\t\t\tclientes.id,\n\t\t\t\tclientes.nb_cliente,\n\t\t\t\tclientes.nb_apellidos,\n\t\t\t\tclientes.de_email,\n\t\t\t\tclientes.num_celular,\n\t\t\t\tusuarios.nb_nombre as \"Ins_nombre\", \n\t\t\t\tusuarios.nb_apellidos as \"Ins_apellido\" \n\t\t\t\tFROM sgclientes clientes\n\t\t\t\tleft join sgusuarios usuarios on clientes.id_usuario_registro=usuarios.id\n\t\t\t\twhere clientes.sn_activo=1\n\t\t\t\tORDER BY clientes.id ASC\n\t\t\t\n\t\t\t';\n\t\t\t$clientes = $this->EjecutarTransaccionAllNoParams($query);\n\t\t\treturn $clientes;\n\t\t}", "public static function obtenerClientes()\n {\n $consulta = \"SELECT * FROM clientes ORDER BY nombre ASC\";\n try {\n // Preparar sentencia\n $comando = Database::getInstance()->getDb()->prepare($consulta);\n // Ejecutar sentencia preparada\n $comando->execute();\n\n return $comando->fetchAll(PDO::FETCH_ASSOC);\n\n } catch (PDOException $e) {\n return false;\n }\n }", "function getClients($conn){\n\t\n\t$sql = \"SELECT * FROM client\";\n\t\n\t$sth = $conn->prepare($sql);\n\t$sth->execute();\n\t\n\t$rows = array();\n\t\n\twhile($r = $sth->fetch(PDO::FETCH_ASSOC)) {\n\t\t$rows[] = $r;\n\t}\n\treturn $rows;\n\t\n}", "function obtenerClientes(){\n $query = $this->connect()->query('SELECT * FROM cliente');\n return $query;\n }", "public function ctlBuscaClientes(){\n\n\t\t$respuesta = Datos::mdlClientes(\"clientes\");\n\n\t\tforeach ($respuesta as $row => $item){\n\t\t\techo '<option value=\"'.$item[\"nombre\"].'\">'.$item[\"nombre\"].'</option>';\n\t\t}\n\t}", "public function queryAll(){\r\n\t\t$sql = 'SELECT * FROM clientes';\r\n\t\t$sqlQuery = new SqlQuery($sql);\r\n\t\treturn $this->getList($sqlQuery);\r\n\t}", "function listadoClientes(){\n\t\t\t\n\t\t\t//SQL\n\t\t\t$query = \"SELECT * FROM users ORDER BY rol,id DESC;\";\n\t\t\t$rst = $this->db->enviarQuery($query,'R');\n\t\t\t\n\t\t\tif(@$rst[0]['id'] != \"\"){\n\t\t\t\treturn $rst;\n\t\t\t}else{\n\t\t\t\treturn array(\"ErrorStatus\"=>true);\n\t\t\t}\n\t\t}", "public function get_Clients() \n\t{\n\t\t$query = '';\n\t\t$result = '';\n\t\t$clients = array();\n\n\t\tswitch( $this->db_link->getDriver() )\n\t\t{\n\t\t\tcase 'sqlite':\n\t\t\tcase 'mysql':\n\t\t\tcase 'pgsql':\n\t\t\t\t$query = \"SELECT Client.ClientId, Client.Name FROM Client \";\n\t\t\t\tif( $this->bwcfg->get_Param( 'show_inactive_clients' ) )\n\t\t\t\t\t$query .= \"WHERE FileRetention > '0' AND JobRetention > '0' \"; \n\t\t\t\t$query .= \"ORDER BY Client.Name;\";\n\t\t\tbreak;\n\t\t}\n\n\t\t$result = $this->db_link->runQuery($query);\n\t\t\t\n\t\tforeach( $result->fetchAll() as $client )\n\t\t\t$clients[ $client['clientid'] ] = $client['name'];\n\t\t\t\t\n\t\treturn $clients;\t\t\n\t}", "public function listarTodos(){\r\n\t\tinclude(\"../config/conexao.php\");\r\n\t\t$sql = 'SELECT * FROM cliente';\r\n\t\t$consulta = $pdo->prepare($sql);\r\n\t\t$consulta->execute();\r\n\t\treturn ($consulta->fetchAll(PDO::FETCH_ASSOC));\r\n\t}", "public function getClientList()\n {\n $clients = $this->find('all')\n ->select(['id', 'salutation', 'name'])\n ->where(['role' => 'client'])\n ->order(['name' => 'ASC']);\n $retval = [];\n foreach ($clients as $client) {\n $retval[$client->id] = $client->full_name;\n }\n\n return $retval;\n }", "public function cbo_cliente(){\n $data = array();\n $query = $this->db->get('cliente');\n if ($query->num_rows() > 0) {\n foreach ($query->result_array() as $row){\n $data[] = $row;\n }\n }\n $query->free_result();\n return $data;\n }", "public function buscarTodos() {\r\n global $conn;\r\n $qry = $conn->query(\"SELECT * FROM conta\");\r\n $items = array();\r\n while($linha = $qry->fetch()) {\r\n $items[] = new Conta($linha[\"saldo\"], $linha[\"numero\"], $linha[\"cpf\"],$linha[\"cnpj\"]);\r\n }\r\n return $items;\r\n }", "public function listClient()\n\t {\n\t\t$tab = array();\n\t\t\t$rqt = mysql_query(\"SELECT * FROM clients\");\n\t\t\twhile($data = mysql_fetch_assoc($rqt))\n\t\t\t\t$tab[] = $data;\n\t\t\treturn $tab;\n\t }", "function afficherclients(){\r\n\t\t$sql=\"SElECT * From clients\";\r\n\t\t$db = config::getConnexion();\r\n\t\ttry{\r\n\t\t$liste=$db->query($sql);\r\n\t\treturn $liste;\r\n\t\t}\r\n catch (Exception $e){\r\n die('Erreur: '.$e->getMessage());\r\n }\t\r\n\t}", "public function listarc()\n\t{\n\t\t$sql=\"SELECT * FROM persona WHERE tipo_persona = 'Cliente';\";\n\t\treturn ejecutarConsulta($sql);\n\t}", "function GetAll()\n {\n $ids = array();\n $sql = \"SELECT id FROM client_os ORDER BY name\";\n $query = pdo_query($sql);\n while($query_array = pdo_fetch_array($query))\n {\n $ids[] = $query_array['id'];\n }\n return $ids; \n }", "public function getAllClient() {\n\t\t$this->db->select('*');\n\t\t$this->db->from('tbl_client');\n\n\t\t$result = $this->db->get();\n\n\t\treturn $result->result();\n\t}", "public function getAllClients($db){\n \n $sql = \"SELECT * FROM client_registrations\";\n\n $pst = $db->prepare($sql);\n $pst->execute();\n\n $Clients = $pst->fetchAll(PDO::FETCH_OBJ);\n\n\n return $Clients;\n }", "public function allclients(){\n $allclient= DB::table('client')->get();\n if($allclient->isEmpty()){\n $reply = Array();\n $reply['responsetype'] = \"fail\";\n $reply['message']=\"Failed to load clients\";\n \n return response()->json($reply);\n }\n\n return response()->json($allclient);\n }", "public function BuscarClientesAbonos() \n{\n\tself::SetNames();\n\t$sql =\"SELECT \n\tventas.idventa, ventas.codventa, ventas.totalpago, ventas.fechavencecredito, ventas.statusventa, ventas.fechaventa, abonoscreditos.fechaabono, SUM(abonoscreditos.montoabono) as abonototal, clientes.codcliente, clientes.cedcliente, clientes.nomcliente, clientes.tlfcliente, clientes.emailcliente, cajas.nrocaja\n\tFROM\n\t(ventas LEFT JOIN abonoscreditos ON ventas.codventa=abonoscreditos.codventa) LEFT JOIN clientes ON \n\tclientes.codcliente=ventas.codcliente LEFT JOIN cajas ON ventas.codcaja = cajas.codcaja WHERE ventas.codcliente = ? AND ventas.tipopagove ='CREDITO' GROUP BY ventas.codventa\";\n\t$stmt = $this->dbh->prepare($sql);\n\t$stmt->execute( array($_GET[\"codcliente\"]) );\n\t$stmt->execute();\n\t$num = $stmt->rowCount();\n\tif($num==0)\n\t{\n\t\techo \"<div class='alert alert-danger'>\";\n\t\techo \"<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>\";\n\t\techo \"<center><span class='fa fa-info-circle'></span> NO EXISTEN CREDITOS DE VENTAS PARA EL CLIENTE INGRESADO</center>\";\n\t\techo \"</div>\";\n\t\texit;\n\t}\n\telse\n\t{\n\t\twhile($row = $stmt->fetch(PDO::FETCH_ASSOC))\n\t\t\t{\n\t\t\t\t$this->p[]=$row;\n\t\t\t}\n\t\t\treturn $this->p;\n\t\t\t$this->dbh=null;\n\t\t}\n\t}", "public static function all(){\n\t\t$bdd = new DBcnx();\n\t\t\treturn $bdd->allClient();\n\t}", "public function clients() {\n\t\treturn $this->clients_model->getClients($this->compID);\n\t}", "function consultarCliente (){\n\t\t$x = $this->pdo->prepare('SELECT * FROM cliente');\n\t\t$x->execute();\n\t\treturn $x->fetchALL(PDO::FETCH_OBJ);\n\t}", "public function getClients()\n {\n try\n {\n return response()->json(['success' => true, 'data' => ClienteFacade::getAll()], 200);\n }\n catch (HttpException $httpException)\n {\n return response()->json(['success' => false, 'error_message' => $httpException->getMessage()], $httpException->getCode());\n }\n }", "public function index()\n {\n $cm_clientes = CmCliente::with(\"contrato.cliente\", \"cmmac\", 'orden_trabajo', \"estado_cm\")->get();\n return $cm_clientes;\n }", "public function getAllDocumentsClientsRobot() {\n $sql = \"SELECT DISTINCT NUMERO_IDENT_CLIENTE FROM archivo_organizado\";\n $result = $this->_db->prepare($sql);\n $result->execute();\n\n if(!is_null($result->errorInfo()[2]))\n return array('error' => $result->errorInfo()[2]);\n else\n return $result->fetchAll(PDO::FETCH_COLUMN);\n }", "function listarCliente(){\n\t\t$this->procedimiento='rec.ft_cliente_sel';\n\t\t$this->transaccion='REC_CLI_SEL';\n\t\t$this->tipo_procedimiento='SEL';//tipo de transaccion\n\t\t\t\t\n\t\t//Definicion de la lista del resultado del query\n\t\t$this->captura('id_cliente','int4');\n\t\t$this->captura('genero','varchar');\n\t\t$this->captura('ci','varchar');\n\t\t$this->captura('email','varchar');\n\t\t$this->captura('email2','varchar');\n\t\t$this->captura('direccion','varchar');\n\t\t$this->captura('celular','varchar');\n\t\t$this->captura('nombre','varchar');\n\t\t$this->captura('lugar_expedicion','varchar');\n\t\t$this->captura('apellido_paterno','varchar');\n\t\t$this->captura('telefono','varchar');\n\t\t$this->captura('ciudad_residencia','varchar');\n\t\t$this->captura('id_pais_residencia','int4');\n\t\t$this->captura('nacionalidad','varchar');\n\t\t$this->captura('barrio_zona','varchar');\n\t\t$this->captura('estado_reg','varchar');\n\t\t$this->captura('apellido_materno','varchar');\n\t\t$this->captura('id_usuario_ai','int4');\n\t\t$this->captura('fecha_reg','timestamp');\n\t\t$this->captura('usuario_ai','varchar');\n\t\t$this->captura('id_usuario_reg','int4');\n\t\t$this->captura('fecha_mod','timestamp');\n\t\t$this->captura('id_usuario_mod','int4');\n\t\t$this->captura('usr_reg','varchar');\n\t\t$this->captura('usr_mod','varchar');\n\n $this->captura('nombre_completo1','text');\n $this->captura('nombre_completo2','text');\n\t\t$this->captura('pais_residencia','varchar');\n\t\t//$this->captura('nombre','varchar');\n\n\n\n\n\t\t\n\t\t//Ejecuta la instruccion\n\t\t$this->armarConsulta();\n\t\t$this->ejecutarConsulta();\n\t\t\n\t\t//Devuelve la respuesta\n\t\treturn $this->respuesta;\n\t}", "public static function readAllClienteAbierto ($id) {\n\t\ttry {\n\t\t\t$objetoAccesoDato = AccesoDatos::dameUnObjetoAcceso(); \n\t\t\t$consulta = $objetoAccesoDato->RetornarConsulta(\n\t\t\t\t\"SELECT p.idPedidoItem, p.idCliente, p.idPedido, p.idArticulo, p.cantidad, a.descripcion_corta, a.stock, p.precio_lista\n\t\t\t\tFROM articulos a, pedidos_item p\n\t\t\t\tWHERE a.id_articulo = p.idArticulo \n\t\t\t\tAND p.idCliente = $id \n\t\t\t\tAND p.idPedido = -1\"\n\t\t\t);\n\t\t\t$consulta->execute();\n\t\t\t\t\t\n\t\t\t$ret = $consulta->fetchAll(PDO::FETCH_CLASS, \"pedido_item\");\n\t\t} catch (Exception $e) {\n\t\t\t$mensaje = $e->getMessage();\n\t\t\t$respuesta = array(\"Estado\" => \"ERROR\", \"Mensaje\" => \"$mensaje\");\n\t\t} finally {\n\t\t\treturn $ret;\n\t\t}\t\t\n\t}", "public function get_clients(){\n\t\treturn $this->clients;\n\t}", "function getComentarios(){\n $this->bd->setConsulta(\"select * from comentario\");\n $comentario = array();\n $i=0;\n while ($fila = $this->bd->getFila()){\n $comentario[$i] = new Comentario($fila[\"id\"], $fila[\"descripcion\"],$fila[\"fechacreacion\"],$fila[\"idEntrada\"],$fila[\"idUsuario\"]);\n $i++;\n }\n return $comentario;\n }", "public function seleccionarTodosEuno() {\n\n $planConsulta = \"SELECT c.IdContacto,c.ConNombres,c.ConApellidos,c.ConCorreo,r.Idrolcontacto,r.Nomrol\";\n $planConsulta .= \" FROM contacto c\";\n $planConsulta .= \" JOIN rolcontacto r ON c.rolcontacto_Idrolcontacto=r.Idrolcontacto \";\n $planConsulta .= \" WHERE c.Estado = 1 \";\n $planConsulta .= \" ORDER BY c.IdContacto ASC \";\n\n $registrosContactos = $this->conexion->prepare($planConsulta);\n $registrosContactos->execute(); //Ejecución de la consulta \n\n $listadoRegistrosContacto = array();\n\n while ($registro = $registrosContactos->fetch(PDO::FETCH_OBJ)) {\n $listadoRegistrosContacto[] = $registro;\n }\n\n $this->cierreBd();\n\n return $listadoRegistrosContacto;\n }", "public static function getClientById($id):array{\n $client = Clients::findOrFail($id)->toArray();\n\n return $client;\n }", "public function getComercios(){\n\t\t$sql = \"SELECT ID_comercio, nombre, correo, telefono, responsable, FK_ID_estado_comercio FROM comercio ORDER BY nombre\";\n\t\t$params = array(null);\n\t\treturn Database::getRows($sql, $params);\n\t}", "function get_cyberlux_clientes($co_cli=''){\n\t\t$sQuery=\"SELECT cli_des,co_cli FROM clientes WHERE 1 = 1 \";\n\t\tif($co_cli) {\t$sQuery.=\"AND co_cli = '$co_cli' \";\t}\n\t\t\n\t//\tdie($sQuery);\n\t\t$result=mssql_query($sQuery) or die(mssql_min_error_severity());\n\t\t$i=0;\n\t\twhile($row=mssql_fetch_array($result)){\n\t\t\tforeach($row as $key=>$value){\n\t\t\t\t$res_array[$i][$key]=$value;\n\t\t\t}\n\t\t\t$i++;\n\t\t}\n\t\treturn($res_array);\n\t\t\t\n\t}", "protected function getClients(){\n $clients = array();\n\n $user = User::getInstance();\n\n $uid = $user->getId();\n $mac = $user->getMac();\n\n if ($mac){\n RESTClient::$from = $mac;\n }elseif ($uid){\n RESTClient::$from = $uid;\n }else{\n RESTClient::$from = $this->stb->mac;\n }\n\n RESTClient::setAccessToken($this->createAccessToken());\n\n foreach ($this->storages as $name => $storage){\n $clients[$name] = new RESTClient('http://'.$storage['storage_ip'].'/stalker_portal/storage/rest.php?q=');\n }\n return $clients;\n }", "public function run()\n {\n $clientes = [\n [\n 'nome' => 'Claudianus Boast',\n 'email' => '[email protected]',\n 'telefone' => '19957645371',\n 'estado' => 'São Paulo',\n 'cidade' => 'Araraquara',\n 'data_nascimento' => '1993-06-07',\n 'created_at' => date('Y-m-d h:i:s'),\n ],\n [\n 'nome' => 'Loni Jennions',\n 'email' => '[email protected]',\n 'telefone' => '19905613161',\n 'estado' => 'São Paulo',\n 'cidade' => 'Limeira',\n 'data_nascimento' => '1985-05-09',\n 'created_at' => date('Y-m-d h:i:s'),\n ],\n [\n 'nome' => 'Margi Gilhouley',\n 'email' => '[email protected]',\n 'telefone' => '19966290104',\n 'estado' => 'São Paulo',\n 'cidade' => 'Araraquara',\n 'data_nascimento' => '1984-09-13',\n 'created_at' => date('Y-m-d h:i:s'),\n ],\n [\n 'nome' => 'Lexy Sprulls',\n 'email' => '[email protected]',\n 'telefone' => '19976121601',\n 'estado' => 'São Paulo',\n 'cidade' => 'Rio Claro',\n 'data_nascimento' => '1999-10-19',\n 'created_at' => date('Y-m-d h:i:s'),\n ],\n [\n 'nome' => 'Marie Shatliff',\n 'email' => '[email protected]',\n 'telefone' => '19966290104',\n 'estado' => 'São Paulo',\n 'cidade' => 'Rio Claro',\n 'data_nascimento' => '1990-07-20',\n 'created_at' => date('Y-m-d h:i:s'),\n ],\n [\n 'nome' => 'Graig Mouncey',\n 'email' => '[email protected]',\n 'telefone' => '(19) 941806149',\n 'estado' => 'São Paulo',\n 'cidade' => 'Araraquara',\n 'data_nascimento' => '1990-03-27',\n 'created_at' => date('Y-m-d h:i:s'),\n ],\n [\n 'nome' => 'Laurice Liger',\n 'email' => '[email protected]',\n 'telefone' => '3597174095',\n 'estado' => 'Minas Gerais',\n 'cidade' => 'Areado',\n 'data_nascimento' => '1992-10-25',\n 'created_at' => date('Y-m-d h:i:s'),\n ],\n [\n 'nome' => 'Kendrick Sooper',\n 'email' => '[email protected]',\n 'telefone' => '31944324086',\n 'estado' => 'Minas Gerais',\n 'cidade' => 'Belo Horizonte',\n 'data_nascimento' => '1981-06-02',\n 'created_at' => date('Y-m-d h:i:s'),\n ],\n [\n 'nome' => 'Gordon Levington',\n 'email' => '[email protected]',\n 'telefone' => '31922405868',\n 'estado' => 'Minas Gerais',\n 'cidade' => 'Belo Horizonte',\n 'data_nascimento' => '1993-11-25',\n 'created_at' => date('Y-m-d h:i:s'),\n ],\n [\n 'nome' => 'Noam Scolland',\n 'email' => '[email protected]',\n 'telefone' => '35996817669',\n 'estado' => 'Minas Gerais',\n 'cidade' => 'Areado',\n 'data_nascimento' => '1999-12-31',\n 'created_at' => date('Y-m-d h:i:s'),\n ],\n [\n 'nome' => 'Lindon Skehens',\n 'email' => '[email protected]',\n 'telefone' => '35967671104',\n 'estado' => 'Minas Gerais',\n 'cidade' => 'Areado',\n 'data_nascimento' => '1985-01-10',\n 'created_at' => date('Y-m-d h:i:s'),\n ],\n [\n 'nome' => 'Kimbra Rase',\n 'email' => '[email protected]',\n 'telefone' => '35999428030',\n 'estado' => 'Minas Gerais',\n 'cidade' => 'Areado',\n 'data_nascimento' => '1999-05-05',\n 'created_at' => date('Y-m-d h:i:s'),\n ],\n [\n 'nome' => 'Lorenzo Fisk',\n 'email' => '[email protected]',\n 'telefone' => '31912695467',\n 'estado' => 'Minas Gerais',\n 'cidade' => 'Belo Horizonte',\n 'data_nascimento' => '1985-12-22',\n 'created_at' => date('Y-m-d h:i:s'),\n ],\n [\n 'nome' => 'Bourke Flavelle',\n 'email' => '[email protected]',\n 'telefone' => '35959386145',\n 'estado' => 'Minas Gerais',\n 'cidade' => 'Itapeva',\n 'data_nascimento' => '1984-04-10',\n 'created_at' => date('Y-m-d h:i:s'),\n ],\n [\n 'nome' => 'Curran McSharry',\n 'email' => '[email protected]',\n 'telefone' => '35902916131',\n 'estado' => 'Minas Gerais',\n 'cidade' => 'Itapeva',\n 'data_nascimento' => '1983-01-15',\n 'created_at' => date('Y-m-d h:i:s'),\n ],\n [\n 'nome' => 'Aveline Dowtry',\n 'email' => '[email protected]',\n 'telefone' => '31945227500',\n 'estado' => 'Minas Gerais',\n 'cidade' => 'Belo Horizonte',\n 'data_nascimento' => '1994-12-23',\n 'created_at' => date('Y-m-d h:i:s'),\n ],\n [\n 'nome' => 'John Sebastian',\n 'email' => '[email protected]',\n 'telefone' => '31907366740',\n 'estado' => 'Minas Gerais',\n 'cidade' => 'Belo Horizonte',\n 'data_nascimento' => '1998-04-06',\n 'created_at' => date('Y-m-d h:i:s'),\n ],\n [\n 'nome' => 'Reynolds Greenan',\n 'email' => '[email protected]',\n 'telefone' => '35923551410',\n 'estado' => 'Minas Gerais',\n 'cidade' => 'Itapeva',\n 'data_nascimento' => '1985-07-19',\n 'created_at' => date('Y-m-d h:i:s'),\n ],\n ];\n DB::table('clientes')->insert($clientes);\n }", "public function index()\n {\n return Cliente::all();\n }", "public function getClients()\n {\n return $this->clients;\n }", "public function getClients()\n {\n return $this->clients;\n }", "public function actionSincronizarCliente()\n\t{\n\t\t$usuario = $this->validateUsuario();\n\t\t\n\t\t$condition = ['ativo' => ProjetoCanvas::ATIVO, 'id_usuario' => $usuario->id];\n\t\t$projetosCanvas = ProjetoCanvas::findAll($condition);\n\t\t\n\t\t$projetosCanvasArr = [];\n\t\t\n\t\tif(count($projetosCanvas)) {\n\t\t\tforeach($projetosCanvas as $projetoCanvas) {\n\t\t\t\t$projetosCanvasArr[] = [\n\t\t\t\t\t\t'id' => $projetoCanvas->id,\n\t\t\t\t\t\t'nome' => $projetoCanvas->nome,\n\t\t\t\t\t\t'descricao' => $projetoCanvas->descricao,\n\t\t\t\t\t\t'itens' => $projetoCanvas->getItens()\n\t\t\t\t];\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn $projetosCanvasArr;\n\t}", "function getClientes(){\n\n $i=0;\n $this->db->select('cliente.id_cliente,\n cliente.nombre,\n cliente.apellido');\n $this->db->from('cliente');\n $query = $this->db->get();\n\n foreach ($query->result() as $row){\n\n $clientes[$i]['value'] = $row->id_cliente;\n $clientes[$i]['label'] = $row->apellido . ', ' . $row->nombre;\n $i++;\n }\n return $clientes;\n }", "public function clients()\n {\n return $this->morphedByMany(Client::class, 'model', 'authorizables')\n ->withPivot('user_id')\n ->withTimestamps();\n }", "public function listar(){\n\n $sql = \"SELECT * FROM buro_credito\";\n\n return $this->mysql->getRows($sql);\n\n }", "public function index(){\n $this->getClientes();\n $cli=Cliente::all();\n foreach ($cli as $cl) {\n $this->getPendientes($cl->idcliente);\n }\n $clientes = DB::table('clientes as c')->join('facturas as f', 'f.idcliente', '=', 'c.idcliente')\n ->select('cedula', 'nombres', 'apellidos', DB::raw('sum(saldo) as saldo'))\n ->where('saldo', '>', 0)\n ->groupBy('cedula', 'nombres', 'apellidos')\n ->havingRaw('sum(saldo) > 0')\n ->orderBy('apellidos')->get();\n return $clientes;\n }", "public function getAll() {\n $sql = \"SELECT * FROM contatos\";\n $sql = $this->pdo->query($sql);\n\n if($sql->rowCount() > 0 ) {\n return $sql->fetchAll();\n } else {\n return array();\n }\n }", "function getListaComentarios(){\n $mysqli = Conectar();\n\n $res = $mysqli->query(\"Select id_evento, id_comentario, nick, fecha, hora, comentario From comentarios Order By id_evento\") ;\n $listaEventos = getLista();\n $eventos = array();\n \n for($i = 0 ; $i<count($listaEventos) ; $i++){\n $nombreEvento = $listaEventos[$i]['nick'];\n $eventos[$listaEventos[$i]['id_evento']] = $nombreEvento;\n }\n\n\n $comentarios = array() ;\n $contador = 0 ;\n \n while($row = $res->fetch_assoc()){\n $comentario = array('id_comentario' => $row['id_comentario'], 'id_evento' => $eventos[$row['id_evento']] ,'nick' => $row['nick'], 'fecha' => date('d-m-Y',strtotime($row['fecha'])), 'hora' => $row['hora'], 'comentario' => $row['comentario']) ;\n array_push($comentarios,$comentario) ;\n $contador = $contador + 1 ;\n }\n\n return $comentarios ;\n }", "public function getCotizaciones() {\n $sql = \"SELECT cot_odt.id_odt, cot_odt.num_odt, cot_odt.id_modelo, cot_odt.tiraje, cot_odt.fecha_odt\n , cot_odt.hora_odt, modelos_cajas.nombre as nombre_caja\n , clientes.nombre as nombre_cliente\n FROM cot_odt\n join modelos_cajas on cot_odt.id_modelo = modelos_cajas.id_modelo\n join clientes on cot_odt.id_cliente = clientes.id_cliente\n WHERE cot_odt.status = 'A' order by cot_odt.fecha_odt desc, cot_odt.hora_odt desc\";\n\n $query = $this->db->prepare($sql);\n\n $query->execute();\n\n $result = array();\n\n while ($row = $query->fetch(PDO::FETCH_ASSOC)) {\n\n $result[] = $row;\n }\n\n return $result;\n\n }", "public function clientsIfAdmin() : array\n {\n return Credentials::isAdmin()\n ? $this->selects(['id', 'client_name'])\n : [];\n }", "function listarClienteLibro()\n {\n $this->procedimiento='rec.ft_cliente_sel';\n $this->transaccion='REC_RELIBRO_SEL';\n $this->tipo_procedimiento='SEL';//tipo de transaccion\n\n $this->setParametro('id_oficina_registro_incidente','id_oficina_registro_incidente','integer');\n $this->setParametro('fecha_ini','fecha_ini','date');\n $this->setParametro('fecha_fin','fecha_fin','date');\n $this->setCount(false);\n\n $this->captura('id_reclamo','int4');\n $this->captura('nro_frd','varchar');\n $this->captura('correlativo_preimpreso_frd','int4');\n $this->captura('fecha_hora_incidente','timestamp');\n $this->captura('fecha_hora_recepcion','timestamp');\n $this->captura('fecha_hora_recepcion_sac','date');\n $this->captura('detalle_incidente','text');\n $this->captura('nombre','text');\n $this->captura('celular','varchar');\n $this->captura('telefono','varchar');\n $this->captura('nombre_incidente','varchar');\n $this->captura('sub_incidente','varchar');\n\n //Ejecuta la instruccion\n $this->armarConsulta();\n\t\t//var_dump($this->respuesta); exit;\n $this->ejecutarConsulta();\n //var_dump($this->respuesta); exit;\n //Devuelve la respuesta\n return $this->respuesta;\n\n }", "function obtenerComentarios($idpincho){\n\t\t$comentario = new Comentarios();\n\t\treturn $comentario->listarPorPincho($idpincho);\n\t}", "function altaCliente ($cliente){\r\n $this->clientes[] = $cliente; /// Este es el ejemplo de altaCliente que ha echo Jesús.\r\n }", "public function clientList()\n {\n return $this->getParent()->channelGroupClientList($this->getId());\n }", "public function showAllServices($client_id){\n $dummie = array(\n array(\n \"client_id\" => 3123123,\n \"audit_date\" => \"2016-11-10\",\n \"address\" => \"Insurgentes 213\",\n \"documents\" => [],\n \"order_type\" => 3,\n \"status\" => 2,\n \"courier_id\" => 16791721),\n array(\n \"client_id\" => 432243,\n \"audit_date\" => \"2016-12-10\",\n \"address\" => \"Aldama 213\",\n \"documents\" => [],\n \"order_type\" => 1,\n \"status\" => 1,\n \"courier_id\" => 16791721\n )\n );\n\n return response()->json($dummie);\n }", "public static function TopClientes()\n {\n $consulta = \"SELECT * FROM clientes WHERE status=1 ORDER BY nombre ASC\";\n try {\n // Preparar sentencia\n $comando = Database::getInstance()->getDb()->prepare($consulta);\n // Ejecutar sentencia preparada\n $comando->execute();\n\n return $comando->fetchAll(PDO::FETCH_ASSOC);\n\n } catch (PDOException $e) {\n return false;\n }\n }", "public static function mostrarClientes($valor){\n\n\t\t$conexion = Conexion::conectar();\n\n\t\tif($valor == null){\n\n\t\t\t$stmt = $conexion->prepare(\"CALL mostrarClientes();\");\n\n\t\t\t$stmt->execute();\n\n\t\t\treturn $stmt->fetchAll();\n\n\t\t}else{\n\n\t\t\t$stmt = $conexion->prepare(\"CALL mostrar1Cliente(:ci);\");\n\n\t\t\t$stmt->bindParam(\":ci\", $valor,PDO::PARAM_STR);\n\n\t\t\t$stmt->execute();\n\n\t\t\t$respuesta = $stmt->fetch();\n\n\t\t\treturn $respuesta;\n\n\t\t}\n\n\t\tConexion::desconectar($conexion);\n\t\tunset($stmt);\n\t\t\n\t\n\t}", "function obtener_Cercas($usuario,$connection){\n\t$query_cercas = \"SELECT id FROM id_cercas WHERE user='$usuario'\";\n\t$resultado1 = $connection->query($query_cercas);\n\t$devuelto = array();\n\twhile ($row1 = $resultado1->fetch_assoc()){\n\t\tforeach($row1 as $row){\n\t\tarray_push($devuelto,$row);\n\t}\n\t}\n\n\treturn($devuelto);\n}", "function getClientList()\n\t{\n\t\t//Update Client List\n\t\t$this->Client_List = null;\n\t\t$assigned_clients_rows = returnRowsDeveloperAssignments($this->getUsername(), 'Client');\n\t\tforeach($assigned_clients_rows as $assigned_client)\n\t\t\t$this->Client_List[] = new Client( $assigned_client['ClientProjectTask'] );\n\t\t\n\t\treturn $this->Client_List;\n\t}", "public function index()\n\t{\n\t\t$clientes = $this->clientesRepository->all();\n\n\t\treturn $this->sendResponse($clientes->toArray(), \"Clientes retrieved successfully\");\n\t}", "public function carregarDadosAnunciante($idCliente) {\n $sql = new Sql($this->_dbAdapter);\n $select = $sql->select();\n $select->from(array('a' => 'tb_anunciante'))\n ->join(array('b' => 'tb_cliente'), 'a.ID_CLIENTE = b.ID_CLIENTE')\n ->join(array('c' => 'tb_cidade'), 'a.ID_CIDADE = c.ID_CIDADE')\n ->where(array(\n 'a.ID_CLIENTE' => (int) $idCliente\n ))->order('a.ID_ANUNCIANTE ASC');\n $statement = $sql->prepareStatementForSqlObject($select);\n $stmt = $statement->execute();\n $array = array();\n foreach ($stmt as $banner) {\n $array['idAnunciante'] = $banner['ID_ANUNCIANTE'];\n $array['stAnunciante'] = $banner['ST_ANUNCIANTE'];\n $array['noArtistico'] = $banner['NO_ARTISTICO'];\n $array['nuTelefone'] = $banner['NU_TELEFONE'];\n $array['sgUf'] = $banner['SG_UF'];\n $array['noCidade'] = $banner['NO_CIDADE'];\n }\n return $array;\n }", "public function client_list()\n {\n return ClientList::latest()->paginate(10);\n }", "public function getContacts()\n {\n // Perform query\n $this->connect();\n $result = $this->conn -> query(\"SELECT * FROM contatti ORDER BY nome\");\n if($result==false){\n echo \"getItems fallita\";\n $this->disconnect();\n return false;\n }\n $rows = array();\n while ($row = $result->fetch_assoc()) {\n $rows[] = $row;\n }\n $this->disconnect();\n return $rows;\n }", "public function get_clientes_by_id($id)\n {\n \n $this->db->select('*');\n $this->db->from('clientes');\n $this->db->where('id', $id);\n $query = $this->db->get();\n\n return $query->result_array(); \n }", "public function getClientData(int $client): array{\n $this->checkNotConnected();\n if(!$this->ckClientEx($client)) throw new ClientNotFound(\"There's no client #$client\", 1);\n $qr = $this->connection->query(\"SELECT * FROM tb_clients WHERE cd_client = $client;\");\n if($qr === false) die($this->connection->error);\n return $qr->fetch_array();\n }", "public function getClientsAction()\n {\n $this->throwIfClientNot('backend');\n $clientManager = $this->get(\n 'fos_oauth_server.client_manager.default'\n );\n\n $class = $clientManager->getClass();\n\n return $this->getDoctrine()->getRepository($class)->findAll();\n }", "public function listar_anunciosByUser($id_cliente){\n return $this->anunciosDAO->selectAllByUser($id_cliente);\n }", "public function getComentarios()\n\t\t{\n\t\t\t $this->limpiarVariables();\n\t\t\t $this->conexion = new Conexion();\n\t\t\t $registros[]=array();\n\t\t\t $this->queryComentarios=\"select * from contacto\";\n\t\t\t $resultado=$this->conexion->consultar( $this->queryComentarios );\n\t\t\t \n\t\t\t \n\t\t\t return $resultado;\n\t\t}", "public function ConsultarClientes() {\n if ($this->ValidarConexionALaBaseDeDatos()){\n $response = $this->HacerConsultaALaBaseDeDatos();\n } else {\n $response[\"respuesta\"] = \"error\";\n $response[\"mensaje\"] = \"Falló la conexión con la base de datos\";\n }\n return $response;\n }", "public function getItems()\n {\n // Perform query\n $this->connect();\n $result = $this->conn -> query(\"SELECT * FROM contatti JOIN telefoni ON contatti.id = telefoni.raccordo ORDER BY contatti.id DESC\");\n if($result==false){\n echo \"operazione fallita\";\n $this->disconnect();\n return false;\n }\n // echo \"<br>Returned rows are: \" . $result -> num_rows;\n // echo \"<br>\";\n $rows = array();\n while ($row = $result->fetch_assoc()) {\n $rows[] = $row;\n }\n $this->disconnect();\n return $rows;\n }", "public function listar_anuncios_interessadosByUser(){\n if(!isset($_SESSION))session_start();\n\n $cliente = unserialize($_SESSION['cliente']);\n\n return $this->anunciosDAO->selectAllInteresadosByUser($cliente->getId());\n }", "public function ClientesPorId()\n{\n\tself::SetNames();\n\t$sql = \" select * from clientes where codcliente = ? \";\n\t$stmt = $this->dbh->prepare($sql);\n\t$stmt->execute( array(base64_decode($_GET[\"codcliente\"])) );\n\t$num = $stmt->rowCount();\n\tif($num==0)\n\t{\n\t\techo \"\";\n\t}\n\telse\n\t{\n\t\tif($row = $stmt->fetch(PDO::FETCH_ASSOC))\n\t\t\t{\n\t\t\t\t$this->p[] = $row;\n\t\t\t}\n\t\t\treturn $this->p;\n\t\t\t$this->dbh=null;\n\t\t}\n\t}", "public function getAll() {\n\n $query = $this->db->prepare('SELECT * FROM comentario ORDER BY puntaje');\n $query->execute();\n return $query->fetchAll(PDO::FETCH_OBJ);\n }", "public function todosComentarios(){\n\t\t$comments_inf = [];\n\t\t$num=1;\n\t\t$sql_query = \"SELECT * FROM comentarios;\";\n\t\tif($result = $this->connection->query($sql_query))\n\t\t{\n\t\t\twhile($row = $result->fetch_assoc()){\n\t\t\t\t$comment_row = [\n\t\t\t\t\t\"num\"=>$num,\n\t\t\t\t\t\"id\" => $row[\"Id\"],\n\t\t\t\t\t\"name\" => $row[\"Nombre\"],\n\t\t\t\t\t\"date\" => $row[\"Fecha\"],\n\t\t\t\t\t\"time\" => $row[\"Hora\"],\n\t\t\t\t\t\"email\" => $row[\"Email\"],\n\t\t\t\t\t\"description\" => $row[\"Descripcion\"],\n\t\t\t\t\t\"ip\" => $row[\"IP\"],\n\t\t\t\t\t\"idEvento\" => $row[\"Id_Eventos\"]\n\t\t\t\t];\n\t\t\t\tarray_push($comments_inf,$comment_row);\n\t\t\t\t$num++;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\techo(\"Error al consultar comentarios en BD\");\n\t\t}\n\t\treturn $comments_inf;\n\t}", "public function seleccionarTodos() {\n\n $planConsulta = \"SELECT c.IdContacto,c.ConNombres,c.ConApellidos,c.ConCorreo,r.Idrolcontacto,r.Nomrol\";\n $planConsulta .= \" FROM contacto c\";\n $planConsulta .= \" JOIN rolcontacto r ON c.rolcontacto_Idrolcontacto=r.Idrolcontacto \";\n $planConsulta .= \" ORDER BY c.IdContacto ASC \";\n\n $registrosContactos = $this->conexion->prepare($planConsulta);\n $registrosContactos->execute(); //Ejecución de la consulta \n\n $listadoRegistrosContacto = array();\n\n while ($registro = $registrosContactos->fetch(PDO::FETCH_OBJ)) {\n $listadoRegistrosContacto[] = $registro;\n }\n\n $this->cierreBd();\n\n return $listadoRegistrosContacto;\n }" ]
[ "0.8366002", "0.82650477", "0.81932837", "0.79748905", "0.79659253", "0.7963666", "0.79495156", "0.79322773", "0.79175144", "0.7793616", "0.7793473", "0.7745171", "0.7701065", "0.76985186", "0.7695293", "0.7630131", "0.7537953", "0.7458199", "0.74571985", "0.74463844", "0.7417499", "0.740338", "0.740338", "0.7382006", "0.73554885", "0.73489004", "0.73324084", "0.7313701", "0.7298658", "0.72931", "0.72854453", "0.72555184", "0.7238466", "0.7231992", "0.722239", "0.7190442", "0.71764386", "0.71694833", "0.7139733", "0.71338624", "0.70853525", "0.708446", "0.70306426", "0.6952462", "0.69473535", "0.6933809", "0.68954945", "0.68549806", "0.6850824", "0.68458676", "0.6842079", "0.68378675", "0.6810745", "0.6808213", "0.6801672", "0.68003815", "0.67992496", "0.67686677", "0.6745529", "0.6740825", "0.6734713", "0.672901", "0.67274433", "0.67252856", "0.67060226", "0.67053056", "0.67053056", "0.6696664", "0.66792387", "0.6669522", "0.66676617", "0.66584104", "0.66417074", "0.6615677", "0.66097975", "0.6599772", "0.65769404", "0.65751237", "0.65726405", "0.65643215", "0.6562946", "0.65608555", "0.65479636", "0.65456355", "0.6543813", "0.65432", "0.65412295", "0.6539511", "0.6521287", "0.6513143", "0.65054977", "0.6503361", "0.64970225", "0.6489986", "0.6486604", "0.64864284", "0.6481767", "0.64640546", "0.64499164", "0.6447105", "0.64467317" ]
0.0
-1
Determine if the user is authorized to make this request.
public function authorize() { return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function authorize()\n {\n if ($this->user() !== null) {\n return true;\n }\n return false;\n }", "public function authorize()\n {\n return $this->user() !== null;\n }", "public function authorize()\n {\n return $this->user() !== null;\n }", "public function authorize()\n {\n return $this->user() != null;\n }", "public function authorize(): bool\n {\n return $this->user() !== null;\n }", "public function authorize(): bool\n {\n return $this->isUserAuthorised();\n }", "public function authorize()\n {\n return !is_null($this->user());\n }", "public function authorize()\n {\n return request()->user() != null;\n }", "public function authorize()\n\t{\n\t\t// if user is updating his profile or a user is an admin\n\t\tif( $this->user()->isSuperAdmin() || !$this->route('user') ){\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "public function authorize()\n {\n // this was my best guess\n return $this->user()->id === $this->route('user')->id;\n }", "public function isAuthorized()\n {\n return $this->cookieHelper->requestCookieExists('auth');\n }", "public function authorize()\n {\n return !empty(Auth::user()) && ($this->user()->isAnAdmin() || $this->user()->hasRole('user'));\n }", "public function authorize()\n {\n $originAccount = Account::find($this->get('origin_account_id'));\n return $originAccount->user_id == auth()->id();\n }", "public function authorize()\n {\n switch ($this->method()) {\n case 'GET':\n case 'POST':\n case 'PUT':\n case 'PATCH':\n case 'DELETE':\n default:\n return $this->user()->type == 'App\\\\Staff' ? true : false;\n break;\n }\n\n return false;\n }", "public function authorize()\n {\n if($this->user()->role == \"admin\" || $this->user()->id == $this->request->get('author_id')) return true;\n else return false;\n }", "public function authorize()\n {\n if(\\Auth::guest())\n {\n return false;\n } else {\n // Action 1 - Check if authenticated user is a superadmin\n if(\\Auth::User()->hasRole('superadmin'))\n return true;\n\n // Action 2 - Find UUID from request and compare to authenticated user\n $user = User::where('uuid', $this->user_uuid)->firstOrFail();\n if($user->id == \\Auth::User()->id)\n return true;\n\n // Action 3 - Fail request\n return false;\n }\n }", "public function authorize()\n {\n $this->model = $this->route('user');\n\n $this->model = is_null($this->model) ? User::class : $this->model;\n\n return $this->isAuthorized();\n }", "public function isAuthorized(): bool\n {\n // TODO: implement authorization check\n\n return true;\n }", "public function isAuthorized() {}", "public function authorize()\n {\n return request()->loggedin_role === 1;\n }", "public function authorize()\n {\n $this->model = $this->route('user');\n\n if ($this->isEdit() && !is_null($this->model)) {\n if (!user()->hasPermissionTo('Administrations::admin.user') && $this->model->id != user()->id) {\n return false;\n }\n }\n\n $this->model = is_null($this->model) ? User::class : $this->model;\n\n return $this->isAuthorized();\n }", "public function authorize()\n {\n $accessor = $this->user();\n\n return $accessor->isAdmin() || $accessor->hasKey('post-users');\n }", "public function authorize()\n {\n $user = \\Auth::getUser();\n\n return $user->user_type == 1;\n }", "public function authorize()\n {\n return auth()->check() ? true : false;\n }", "public function authorize()\n {\n return auth()->check() ? true : false;\n }", "public function authorize()\n {\n /**\n * @var User $user\n * @var Document $document\n */\n $user = Auth::user();\n $document = $this->route('document');\n\n return (int)$user->id === (int)$document->user_id;\n }", "public function authorize()\n {\n switch (true) {\n case $this->wantsToList():\n case $this->wantsToShow():\n if ($this->hasRoles(['owner', 'administrator'])) {\n return true;\n }\n break;\n case $this->wantsToStore():\n case $this->wantsToUpdate():\n case $this->wantsToDestroy():\n if ($this->hasRoles(['owner'])) {\n return true;\n }\n break;\n }\n\n return false;\n }", "public function authorize()\n {\n $user = JWTAuth::parseToken()->authenticate();\n $organisation = Organization::findOrFail($this->route('organizations'));\n return $organisation->admin_id == $user->id;\n }", "public function authorize()\n {\n if($this->user()->isAdmin())\n return true;\n\n return false;\n }", "function isAuthorized()\n {\n $authorized = parent::isAuthorized();\n return $authorized;\n }", "public function authorize()\n {\n $user = auth('web')->user();\n if ($user && $user->active) {\n return true;\n }\n\n return false;\n }", "public function authorize()\n {\n $this->user = User::query()->find($this->route()->parameter('user'));\n $this->merge(['verified' => $this->get('verified') ? 1 : 0]);\n\n return true;\n }", "public function authorize()\n {\n $user = request()->user('api');\n return $user->isSenior();\n }", "public function authorize()\n {\n return is_client_or_staff();\n }", "public function isAuthorized() {\n\t\treturn true;\n\t}", "public function authorize()\n {\n switch ($this->method()) {\n case 'POST':\n return true;\n case 'GET':\n default:\n {\n return false;\n }\n }\n }", "public function authorize()\n {\n switch ($this->method()) {\n case 'POST':\n return true;\n case 'GET':\n default:\n {\n return false;\n }\n }\n }", "public function authorize()\n {\n //Check if user is authorized to access this page\n if($this->user()->authorizeRoles(['admin'])) {\n return true;\n } else {\n return false;\n }\n }", "public function isAuthorized()\n\t{\n\t\t$sessionVal = Yii::$app->session->get($this->sessionParam);\n\t\treturn (!empty($sessionVal));\n\t}", "public function authorize() {\n\n return auth()->user() && auth()->user()->username === $this->user->username;\n }", "public function authorize()\n {\n return session('storefront_key') || request()->session()->has('api_credential');\n }", "public function authorize()\n {\n if ($this->user()->isAdmin($this->route('organization'))) {\n return true;\n }\n\n return false;\n\n }", "public function authorize()\n {\n return $this->user() && $this->user()->role === Constants::USER_ROLE_ADMIN;\n }", "public function authorized()\n {\n return $this->accepted && ! $this->test_mode;\n }", "public function authorize()\n {\n if (!auth()->check()) {\n return false;\n }\n return true;\n }", "public function hasAuthorized() {\n return $this->_has(1);\n }", "public function authorize()\n {\n $resource = Resource::find($this->route('id'));\n\n if (!$resource) {\n return true;\n }\n\n return $resource && $this->user()->can('access', $resource);\n }", "public function authorize()\n {\n /*\n if ($this->loan_id && is_numeric($this->loan_id) && $loan = Loan::whereId($this->loan_id)->first()) {\n // loan_id belongs to requesting user\n return $loan && $this->user()->id == $loan->user_id;\n }\n */\n return true; // let rules handle it\n }", "public function authorize()\n {\n //TODO Authorice Request (without Controller)\n return auth()->user()->role_id === 1;\n }", "public function authorize(): bool\n {\n return $this->user()->id === $this->article->user->id;\n }", "public function authorize()\n {\n return $this->user()->rol == 'admin' ? true : false;\n }", "public function isAuth()\n {\n return $this->session->hasAuthorisation();\n }", "public function authorize()\n {\n if(Auth::user())\n {\n return true;\n }\n else\n {\n return false;\n }\n }", "public function authorize()\n {\n //Check if user is authorized to access this page\n if($this->user()->authorizeRoles(['admin', 'hrmanager', 'hruser'])) {\n return true;\n } else {\n return false;\n }\n }", "public function authorize()\n {\n return \\Auth::check() ? true : false;\n }", "public function authorize()\n\t{\n\t\treturn true; //no user checking\n\t}", "public function authorize()\n {\n return $this->user()->id === $this->route('report')->user_id;\n }", "public function authorize()\n {\n return $this->user()->id === $this->route('report')->user_id;\n }", "public function authorize()\n {\n return !empty(Auth::user());\n }", "public function authorize()\n {\n return $this->groupHasUser() || $this->hasSeller();\n }", "public function authorize()\n\t{\n\t\t//@todo check with perissions\n\t\treturn (request()->user()->user_type == ADMIN_USER);\n\t}", "public function authorize()\n\t{\n\t\t//@todo check with perissions\n\t\treturn (request()->user()->user_type == ADMIN_USER);\n\t}", "public function isAuthorized() {\n\t\t\n\t}", "public function authorize()\n {\n if(Auth::check())\n {\n return (Auth::user()->has_world_admin_access);\n }\n return false;\n }", "public function authorize()\n {\n if (!\\Auth::guest()) {\n $user = \\Auth::getUser();\n if ($user->type == User::USER_TYPE_ADMIN) {\n return true;\n }\n }\n\n return false;\n }", "public function authorize()\n {\n if (auth()->user()->is_admin) {\n return true;\n }\n return false;\n }", "public function authorize()\n {\n if ($this->user()->is_admin){\n return true;\n }\n else if ($this->method == \"PUT\"){\n if ($this->user()->id == $this->input('id')){\n return true;\n }\n }\n return false;\n }", "public function authorize(): bool\n {\n return parent::authorize() && (int)$this->playList->user_id === auth()->user()->id;\n }", "public function authorize() {\n\t\treturn $this->user()->is_admin;\n\t}", "public function authorize()\n {\n if (Auth::check()) {\n \n return true;\n \n }\n return false;\n }", "public function authorize()\n {\n $user = Auth::user();\n return $user && $user->rol == 'admin';\n }", "public function authorize()\n\t{\n\t\t// Nutzern akzeptiert werden\n\t\tif(Auth::check())\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "public function authorize()\n {\n // TODO: Check if has business\n return session()->has('id');\n }", "public function authorize()\n {\n if (auth()->check() && auth()->user()->isAdmin()) {\n return true;\n }\n\n return false;\n }", "public function authorize()\n {\n return $this->auth->check();\n }", "public function authorize() {\n\t\t$user = \\Auth::user();\n\n\t\tif ( $user->isAdmin() ) {\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}", "public function authorize()\n {\n if (auth()->user()->isAdmin() || auth()->user()->isCustomer()) {\n return true;\n }\n return false;\n }", "public function authorize()\n {\n return $this->container['auth']->check();\n }", "function isAuthorized($request) {\n return true;\n }", "public function authorize()\n {\n return Auth::guest() || isMember();\n }", "public function authorize()\n {\n return auth()->user() && auth()->user()->isCeo();\n }", "public function authorize(): bool\n {\n $deckId = $this->request->get('deck_id');\n $userId = Deck::whereKey($deckId)->value('user_id');\n\n return $userId === user()->id;\n }", "public function authorize()\n {\n return Auth::check() && Auth::user()->is_contractor;\n }", "public function authorize()\n {\n return TRUE;\n }", "public function authorize()\n {\n $user = User::find($this->id);\n\n if (!$user) {\n $user = User::where('no_ahli', $this->no_ahli)->first();\n }\n if ($user && $user->id == auth()->user()->id) return true;\n if (auth()->user()->is('admin')) return true;\n\n return false;\n }", "public function authorize()\n {\n # if it's false, it will rejected\n return true;\n }", "public function authorize()\n {\n $isValid = auth()->user()->is($this->route('task')->attempt->checklist->owner);\n\n return $isValid;\n }", "public function authorize()\n {\n $user = Auth::user();\n\n return ($user->getRole() == 'admin');\n }", "public function is_authorized() {\n\t\t$authorized = true;\n\t\tif ( $this->is_access_token_expired() ) {\n\t\t\t$authorized = false;\n\t\t}\n\n\t\treturn $authorized;\n\t}", "public function authorize()\n {\n $user = User::findOrFail($this->route('id'));\n\n return $user->hasRole('admin') || $user->hasRole('teacher');\n }", "public function authorize()\n {\n $project = \\App\\Project::find($this->request->get('project'));\n return $project && $project->isManager($this->user()->name);\n }", "public function isAuthorized() {\n\t\treturn (bool)$this->_storage->hasData();\n\t}", "public function authorize()\n {\n $idExpense = $this->input('expense');\n $expense = Expense::find($idExpense);\n\n return $expense && $this->user()->id == $expense->user_id;\n }", "public function authorize()\n {\n // User system not implemented\n return true;\n }", "public function authorize() : bool\n {\n // TODO check request to xhr in middleware\n return true;\n }", "public function authorize()\n {\n $organizationId = (string) $this->route('id');\n\n $this->organization = Organization::findByUuidOrFail($organizationId);\n\n return $this->user()->can('show', [Organization::class, $this->organization]);\n }", "public function authorize()\n {\n $user = $this->findFromUrl('user');\n return $this->user()->can('update', $user);\n }", "public function authorize()\n {\n $user = Auth::user();\n $orderElement = OrderElement::find($this->input(\"order_element_id\"));\n $order = $orderElement->order;\n\n if ($user->id == $order->user_id) {\n return true;\n } else {\n return false;\n }\n }", "public function authorize()\n {\n $current_user = auth()->user();\n $convention = Convention::find($this->route('convention_id'));\n\n // Use ClientPolicy here to authorize before checking the fields\n return $current_user->can('store', Convention::class)\n || $current_user->can('update', $convention);\n }", "public function authorize()\n {\n if (session()->has('user'))\n {\n $participantController = new ParticipantController();\n\n return !$participantController->isParticipating($this->input('id_user'), $this->input('id_event'));\n }\n else\n {\n return false;\n }\n }", "public function authorize()\n {\n return (Auth::user()->allowSuperAdminAccess || Auth::user()->allowAdminAccess);\n }" ]
[ "0.8401071", "0.8377486", "0.8377486", "0.8344406", "0.8253731", "0.824795", "0.8213121", "0.8146598", "0.81115526", "0.8083369", "0.7991986", "0.79907674", "0.79836637", "0.79604936", "0.79516214", "0.79494005", "0.79265946", "0.7915068", "0.79001635", "0.7894822", "0.7891453", "0.7890965", "0.7862504", "0.78414804", "0.78414804", "0.7837965", "0.78248763", "0.7812292", "0.7809632", "0.77928597", "0.7788316", "0.7781619", "0.77815884", "0.7763308", "0.7754035", "0.7717961", "0.7717961", "0.77171147", "0.77138597", "0.7705001", "0.7693082", "0.7692783", "0.76915383", "0.76909506", "0.76733255", "0.7667128", "0.7665592", "0.7656238", "0.7650853", "0.764326", "0.76431626", "0.76431614", "0.7635147", "0.76311624", "0.76294273", "0.7627076", "0.76207024", "0.76207024", "0.76139116", "0.76036394", "0.76035625", "0.76035625", "0.76032084", "0.7602515", "0.76007926", "0.75971127", "0.7588128", "0.7586303", "0.7581912", "0.7563037", "0.7554785", "0.75526226", "0.755171", "0.75436753", "0.75432944", "0.7540682", "0.7538806", "0.75280696", "0.751548", "0.75149626", "0.7501161", "0.74959517", "0.74956346", "0.74911124", "0.7489147", "0.74858016", "0.748033", "0.7478443", "0.7472642", "0.7472576", "0.7465409", "0.7464371", "0.74630046", "0.7462218", "0.7461453", "0.7449168", "0.74399257", "0.74358094", "0.7433247", "0.7432659", "0.74248093" ]
0.0
-1
Get The error messages
public function messages() { return [ 'name.required' => 'Sie müssen einen Hotelnamen angeben!', 'description.required' => 'Sie müssen einen Beschreibung angeben!', 'stars.required' => 'Sie müssen die Anzahl Sterne angeben!', 'street.required' => 'Sie müssen eine Strasse angeben!', 'postalcode.required' => 'Sie müssen eine Postleitzahl angeben!', 'area.required' => 'Sie müssen einen Ort angeben!', 'phone.required' => 'Sie müssen eine Telefonnummer angeben!', 'phone.regex' => 'Sie müssen eine gültige Telefonnummer angeben!', 'fax.required' => 'Sie müssen eine Faxnummer angeben!', 'fax.regex' => 'Sie müssen eine gültige Faxnummer angeben!', 'email.required' => 'Sie müssen eine E-Mail Adresse angeben!', 'email.email' => 'Sie müssen eine gültige E-Mail Adresse angeben!', ]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getErrorMessages() {}", "public function get_error_messages();", "public function getErrorMessages() {\n\t\t$errorMessages = '';\n\t\tforeach ($this->errorMessages as $index => $error) {\n\t\t\t$errorMessages .= \"[Error:\" . $index . '] ' . $error . \"\\n<br />\";\n\t\t}\n\t\treturn $errorMessages;\n\t}", "public function getErrorMessages(){\n return $this->arr_msg; \n }", "public function getErrorMessages()\n {\n return $this->errorMessages;\n }", "public function getMessages()\n {\n return $this->_errorMessages;\n }", "public function getError(): array\n {\n return $this->errorMessages;\n }", "public function getErrors()\n {\n $sErrMsg = '';\n if (count($this->aErrors) > 1) {\n foreach ($this->aErrors as $sError) {\n $sErrMsg .= $sError . \"\\r\\n\";\n }\n }\n\n return $sErrMsg;\n }", "public function get_errors() {\n\t\treturn $this->errors->get_error_messages();\n\t}", "private function getErrorMessages() {\n\t\tif (empty($this->errorMessages)) {\n\t\t\treturn '';\n\t\t}\n\n\t\t$this->template->setMarker(\n\t\t\t'message_no_permissions',\n\t\t\t$this->doc->spacer(5) .\n\t\t\t\t$GLOBALS['LANG']->getLL('message_no_permission')\n\n\t\t);\n\t\t$errorList = implode('</li>' . LF . '<li>', $this->errorMessages);\n\t\t$this->template->setMarker('error_list', '<li>' . $errorList .'</li>');\n\n\t\treturn $this->template->getSubpart('IMPORT_ERRORS');\n\t}", "public function getErrors()\n {\n return $this->getInputFilter()->getMessages();\n }", "public function getErrorMessages() : array\n {\n return $this->errors_messages;\n }", "public function getErrors();", "public function getErrors();", "public function getErrors();", "public function getErrors();", "function getErrors()\n {\n $errMsg = '';\n foreach ($this->errors as $error) {\n $errMsg .= $error;\n $errMsg .= '<br/>';\n }\n return $errMsg;\n }", "public function getErrorMessages()\n {\n $translator = Mage::helper('importexport');\n $messages = array();\n\n foreach ($this->_errors as $errorCode => $errorRows) {\n if (isset($this->_messageTemplates[$errorCode])) {\n $errorCode = $translator->__($this->_messageTemplates[$errorCode]);\n }\n foreach ($errorRows as $errorRowData) {\n $key = $errorRowData[1] ? sprintf($errorCode, $errorRowData[1]) : $errorCode;\n $messages[$key][] = $errorRowData[0];\n }\n }\n return $messages;\n }", "public function getValidationErrorMessages() {}", "public function get_errors() {\n $res = array();\n foreach($this->errors as $error) {\n $res[] = $error->errormsg;\n }\n return $res;\n }", "function getErrors();", "public function getErrors()\n\t{\n\t\treturn $this->_errorMessage;\n\t}", "public function getErrorMessagesList(){\n \t$errors = $this->getMessages();\n \tif(count($errors)){\n \t\t$result = [];\n \t\tforeach ($errors as $elementName => $elementErrors){\n \t\t\tforeach ($elementErrors as $errorMsg){\n \t\t\t\t$result[] = $errorMsg;\n \t\t\t}\n \t\t}\n \t\treturn $result;\n \t}\n \treturn null;\n }", "public function getErrorMessage()\n {\n return $this->validator->errors()->all();\n }", "public function allError() {\n return $this->errorMsg;\n }", "public function get_errors() { return $this->errortext; }", "public function errors()\n {\n return $this->getRules()->getMessageBag()->all();\n }", "public function getErrors(): array\n {\n return Logger::getErrorMessages();\n }", "protected function validationErrorMessages()\n {\n return [];\n }", "protected function validationErrorMessages()\n {\n return [];\n }", "public function errors()\n {\n return $this->provider->getMessageBag();\n }", "public function getMessages() {\n return libxml_get_last_error();\n }", "public function getError() {\n\t\t$error = array();\n\t\t$error['message'] = $this->err_message;\n\t\t$error['code'] = $this->err_code;\n\t\treturn $error;\n\t}", "function getErrors()\n\t{\n\t\treturn [];\n\t}", "public function getErrors(): array\n {\n return $this->getInputFilter()->getMessages();\n }", "public function getError()\n {\n $errors = self::$errors;\n self::$errors = array();\n return $errors;\n }", "public function getMessage()\n {\n return $this->_error;\n }", "public function getErrors()\n {\n return $this->messageBag->all();\n }", "public function get_errors() {\n\n\t\t$output = '';\n\t\t\n\t\t$errors = $this->errors;\n\t\t\n\t\tif ($errors) {\n\t\t\t$items = '';\n\t\t\tforeach ($errors as $e) {\n\t\t\t\t$items .= '<li>'.$e.'</li>' .\"\\n\";\n\t\t\t}\n\t\t\t$output = '<ul>'.\"\\n\".$items.'</ul>'.\"\\n\";\n\t\t}\n\t\telse {\n\t\t\t$output = __('There were no errors.', CCTM_TXTDOMAIN);\n\t\t}\n\t\treturn sprintf('<h2>%s</h2><div class=\"summarize-posts-errors\">%s</div>'\n\t\t\t, __('Errors', CCTM_TXTDOMAIN)\n\t\t\t, $output);\n\t}", "public function getValidationMessages();", "public function errorMessages() {\n if(empty($this->errors)) {\n return;\n }\n \n $message = 'The following errors have occured: <ul>';\n foreach($this->errors as $error) {\n $message .= \"<li>$error</li>\";\n }\n $message .= '</ul>';\n\n return '<div class=\"error\">'.$message.'</div>';\n }", "private function getErrors() {\n \n $inError = $this->getInErrorWords();\n $errors = array();\n $length = count($inError);\n if ($length === 0) {\n return $errors;\n }\n $error = null;\n $currentErrorType = null;\n for ($i = 0; $i <= $length; $i++) {\n \n if ($i === $length) {\n $errors[] = $error;\n break;\n }\n \n if (!isset($currentErrorType) || $currentErrorType === $inError[$i]['error']) {\n $message = (isset($error) ? $error['message'] . ' ' : '') . $inError[$i]['word'];\n }\n else {\n $errors[] = $error;\n $message = $inError[$i]['word'];\n }\n \n $currentErrorType = $inError[$i]['error'];\n $error = array(\n 'error' => $currentErrorType,\n 'message' => (isset($error) ? $error['message'] . ' ' : '') . $inError[$i]['word']\n );\n }\n return $errors;\n }", "private function errorMessages()\n {\n return [\n 'name.unique' => 'A category with the same name exists',\n ];\n }", "public function errorMessages()\n {\n return [\n self::RULE_REQUIRED => 'This field is required',\n self::RULE_EMAIL => 'This field must be a valid email address',\n self::RULE_MIN => 'Min length of this field must be {min}',\n self::RULE_MAX => 'Max length of this field must be {max}',\n self::RULE_MATCH => 'This field must be the same as {match}',\n self::RULE_UNIQUE => 'Record with this {field} already exists'\n ];\n }", "public function getErrorMessage();", "public function getErrorMessage();", "static public function getErrors()\n\t{\n\t\treturn static::$aErrors;\n\t}", "public function getAllMessage()\n {\n $messages = [];\n foreach (array_keys($this->errors) as $key) {\n $messages[$key] = $this->getMessage($key);\n }\n return $messages;\n }", "public function errors()\n {\n // return new \\ArrayList($this->errorList.values());\n }", "public function messages() \n {\n return[\n 'name.required' => ['code' => 'ERROR-1', 'title' => 'Unprocessable Entity'],\n 'price.required' => ['code' => 'ERROR-1', 'title' => 'Unprocessable Entity'],\n 'price.numeric' => ['code' => 'ERROR-1', 'title' => 'Unprocessable Entity'],\n 'price.major' => ['code' => 'ERROR-1', 'title' => 'Unprocessable Entity']\n ];\n }", "public function messages()\n {\n return [\n 'name.required' => 'Email is required!',\n 'year.required' => 'Year is required!',\n 'artist_id.required' => 'Artist is required!'\n ];\n }", "public function errors()\n {\n return $this->validation->messages()->messages();\n }", "public function getErrors(){\r\n return $this->_errors['error'];\r\n }", "private function errorMessages()\n {\n return [\n 'question_category_id.required' => 'Atleast one question-category '.\n 'is required',\n ];\n }", "public function get_clear_error_msgs()\n {\n $msgs = array();\n foreach ($this->errors as $e) {\n $msgs[$e['field']][$e['rule']] = $this->get_validation_error_msg($e['field'], $e['rule'], $e['value']);\n\n }\n return $msgs;\n }", "public function errors()\n\t{\n\t\treturn $this->_errors['errors'];\n\t}", "public function errors()\n\t{\n\t\treturn $this->_errors['errors'];\n\t}", "public function messages()\n {\n return [\n 'style.required' => 'Please the style is required',\n 'service.required' => 'Please select service type',\n 'session.required' => 'Please select session'\n ];\n }", "public function get_list_errors()\n\t{\n\t\treturn $this->errors;\n\t}", "function get_error_message() {\n return $this->error_msg;\n }", "function get_error_messages($code = '') {\n\t\tif ( empty($code) ) {\n\t\t\t$all_messages = array();\n\t\t\tforeach ( $this->errors as $code => $messages )\n\t\t\t\t$all_messages = array_merge($all_messages, $messages);\n\n\t\t\treturn $all_messages;\n\t\t}\n\n\t\tif ( isset($this->errors[$code]) )\n\t\t\treturn $this->errors[$code];\n\t\telse\n\t\t\treturn array();\n\t}", "public function messages()\n {\n /*\n return [\n 'bio.required' => 'Bio is required',\n 'state.required' => 'State is required',\n 'city.required' => 'City name is required',\n 'postalcode.required' => 'Postal Code is required',\n 'gender.required' => 'Gender is required',\n 'seeking_gender.requred' => 'Gender you are searching for is required',\n ];\n */\n }", "public function messages()\n {\n return [\n 'query.required' => \"La valeur de la recherche est obligatoire.\",\n ];\n }", "public function errorMessages() : array\n {\n return [\n self::RULE_REQUIRED => 'Required.',\n self::RULE_EMAIL => 'Must be a valid email address.',\n self::RULE_MIN => 'Must be at least {min} characters.',\n self::RULE_MAX => 'Must be less than {max} characters.',\n self::RULE_MATCH => 'Must match {match}.',\n self::RULE_UNIQUE => '{column} is already in use.'\n ];\n }", "public function errors()\n {\n $_output = '';\n foreach ($this->errors as $error)\n {\n $errorLang = $this->lang->line($error) ? $this->lang->line($error) : '##' . $error . '##';\n $_output .= $this->error_start_delimiter . $errorLang . $this->error_end_delimiter;\n }\n\n return $_output;\n }", "public function getErrorMessage()\r\n {\r\n return $this->error_message;\r\n }", "public function messages()\n {\n return [\n 'title.required' => 'A title is required',\n 'title.max' => 'Title is too long',\n 'image.required' => 'An image is required',\n ];\n }", "public function getErrorMessage()\n {\n return $this->error_message;\n }", "public function getErrorLines()\n {\n return array('Something went wrong... ಠ_ಠ');\n }", "public function messages()\n {\n return VALIDATION_MESSAGE;\n }", "public function messages()\n {\n return VALIDATION_MESSAGE;\n }", "public function getError()\n {\n if (empty($this->error) != true){\n end($this->error); //Pointer to the end\n $key = key($this->error); //Get the key of last element\n $ret = array( \"code\" => $key, \"description\" => $this->error[$key] );\n reset($this->error);\n }else{\n $ret = array( \"code\" => \"get_error\", \"description\" => \"No are errors to show\" );\n }\n \n return $ret;\n }", "public function messages()\n {\n return [\n 'name.required' => 'A name is required.',\n 'color.required' => 'Please select a color.'\n ];\n }", "public function errorMessage()\n\t{\n\t\treturn $this->_source->errorMessage();\n\t}", "abstract public function getMsgError();", "public function getError()\r\n\t\t{\r\n\t\t\treturn $this->_errores;\r\n\t\t}", "public function getErrors() {\n\n if (!$this->errors || count($this->errors === 0)) {\n return '';\n }\n $html = '';\n $pattern = '<li>%s</li>';\n $html .= '<ul>';\n\n foreach ($this->errors as $error) {\n $html .= sprintf($pattern, $error);\n }\n $html .= '</ul>';\n return sprintf($this->getWrapperPattern(self::ERRORS), $html);\n }", "function get_errors()\n {\n }", "public function getErrMsg()\n {\n return $this->get(self::ERRMSG);\n }", "public function messages()\n {\n return [\n 'document.required' => 'Nome do documento é requerido mas não foi informado',\n 'status.required' => 'Status é requerido mas não foi informado',\n ];\n }", "public function getErrors() {\r\n return $this->pdocrudErrCtrl->getErrors();\r\n }", "public function getMsgError() {\r\n return $this->msg_error;\r\n }", "function get_errors() {\n\t\treturn $this->errors;\n\t}", "public function get_errors()\n {\n return $this->errors;\n }", "public function get_errors()\n {\n return $this->errors;\n }", "public function get_errors()\n {\n return $this->errors;\n }", "public function getErrors()\n {\n return self::$errors;\n }", "public function messages()\n {\n return [\n 'curp.required' => 'Falta la C.U.R.P.',\n 'curp.unique' => 'Esta C.U.R.P. ya existe',\n 'curp.min' => 'C.U.R.P. incorrecta',\n 'curp.max' => 'C.U.R.P. incorrecta',\n 'nombre1.required' => 'Falta el nombre',\n 'nombre1.min' => 'Nombre incorrecto',\n 'nombre1.max' => 'Nombre incorrecto',\n 'apellido1.required' => 'Falta el apellido',\n 'apellido1.min' => 'Apellido incorrecto',\n 'apellido1.max' => 'Apellido incorrecto',\n 'fechanacimiento.required' => 'Falta la fecha de nac.',\n 'genero.required' => 'Obligatorio'\n ];\n }", "public function message()\n {\n return $this->errorText;\n }", "private function getErrorMessages(): array\n {\n return [\n 'notEmpty' => 'Campo {{name}} obligatorio',\n 'date' => '{{name}} debe tener una fecha valida. Ejemplo de formato: {{format}}\\'',\n 'intVal' => '',\n 'between' => '',\n 'in' => '',\n 'floatVal' => '',\n 'length' => '',\n 'stringType' => '',\n 'objectType' => '',\n 'cantidadRegistros' => 'dsfsdfsd',\n 'periodo.notEmpty' => 'Campo Periodo: es obligatorio',\n 'periodo' => 'Campo Periodo: Debe tener el formato AAAAMM, donde AAAA indica el año y MM el mes en números',\n 'orden.notEmpty' => 'Campo Orden: es obligatorio',\n 'orden' => 'Campo Orden: Debe ser igual a 1 ó 2.',\n 'codigoComprobante.notEmpty' => 'Campo Codigo de Comprobante: es obligatorio',\n 'codigoComprobante' => 'Campo Codigo de Comprobante: Debe debe estar comprendido entre 1 y 9998.',\n 'numeroComprobante.notEmpty' => 'Campo Numero de Comprobante: es obligatorio',\n 'numeroComprobante' => 'Campo Numero de Comprobante: Debe debe estar comprendido entre 1 y 99999999.',\n 'puntoVenta.notEmpty' => 'Punto de venta: es obligatorio',\n 'puntoVenta' => 'Punto de venta: Debe debe estar comprendido entre 1 y 9998.',\n ];\n }", "public function errorMessage() {\n\t\t\treturn $this->strError; \n\t\t}", "public function messages()\n {\n return [\n 'code_area.required' => 'Code area cannot be blank',\n 'name.required' => 'Name area cannot be blank'\n ];\n }", "public function messages()\n {\n return [\n 'code_day.required' => 'Code day must required!',\n 'name.required' => 'Name must required!',\n ];\n }", "public function messages() {\n\t\treturn [\n\t\t\t'form_submit.in' => trans('exception.something_wrong.message'),\n\t\t\t'date_from.date_format' => trans('report::content-user-report.errors.date_format'),\n\t\t\t'date_to.date_format' => trans('report::content-user-report.errors.date_format')\n\t\t];\n\t}", "public function getErrorList() {\n\t\treturn array();\n\n\t}", "public function get_errors(){\n\n\t\treturn $this->errors;\n\n\t}", "public function get_error_objects() {\n return $this->errors;\n }", "function getErrorMsg() {\n\t\treturn $this->errorMsg;\n\t}", "public function messages()\n {\n return [\n 'truck_id.required' => 'The truck field is required.',\n 'truck_id.exists' => 'Invalid data.',\n 'account_id.required' => 'The supplier field is required.',\n 'account_id.exists' => 'Invalid data.'\n ];\n }", "public function get_errors() {\n\t\treturn $this->errors;\n\t}", "public function messages()\n {\n return [\n 'logo.dimensions' => 'Invalid logo - should be minimum 226*48',\n 'favicon.dimensions' => 'Invalid icon - should be 16*16',\n 'logo.required' => 'The logo field is required in seo settings.',\n 'favicon.required' => 'The favicon field is required in seo settings.',\n 'from_name.required' => 'The from name field is required in mail settings.',\n 'from_email.required' => 'The from email field is required in mail settings.',\n ];\n }" ]
[ "0.8909136", "0.87320673", "0.8414456", "0.8338383", "0.8225785", "0.81918263", "0.8106275", "0.8084946", "0.8044304", "0.79884386", "0.796195", "0.7904297", "0.7883454", "0.7883454", "0.7883454", "0.7883454", "0.7879226", "0.78183746", "0.78084075", "0.77935994", "0.7774201", "0.7764848", "0.7752799", "0.7734341", "0.77281475", "0.7708812", "0.7671225", "0.7669923", "0.76606005", "0.76606005", "0.763432", "0.7620157", "0.7586779", "0.7574846", "0.75595933", "0.7552699", "0.754627", "0.75328887", "0.75253695", "0.7525211", "0.7519184", "0.7514937", "0.7513577", "0.75015754", "0.7493506", "0.7493506", "0.7487524", "0.74687535", "0.74577266", "0.7455081", "0.74412984", "0.7410714", "0.7408251", "0.7406713", "0.74040264", "0.7398023", "0.7398023", "0.7396394", "0.73884034", "0.7388321", "0.73799497", "0.7375744", "0.7375002", "0.7374392", "0.7354474", "0.73500896", "0.7341564", "0.7337185", "0.7335698", "0.73338526", "0.73338526", "0.73326606", "0.7326597", "0.7326323", "0.73224944", "0.73195094", "0.73114395", "0.73109263", "0.7309348", "0.73087204", "0.73036057", "0.7298225", "0.7298196", "0.72954106", "0.72954106", "0.72954106", "0.72946155", "0.7293239", "0.7292986", "0.7291976", "0.72864974", "0.72838044", "0.728315", "0.72817594", "0.72794366", "0.7279105", "0.72761333", "0.7275217", "0.72551847", "0.7250151", "0.7248839" ]
0.0
-1
Get the validation rules that apply to the request.
public function rules() { return [ 'name' => 'required', 'description' => 'required', 'stars' => 'required|integer|between:1,5', 'street' => 'required', 'postalcode' => 'required', 'area' => 'required', 'phone' => ['required', 'regex:/^(?=.*[0-9])[ +()0-9]+$/' ], 'fax' => ['required', 'regex:/^(?=.*[0-9])[ +()0-9]+$/' ], 'email' => 'required|email', 'managers' => '' ]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function rules()\n {\n $commons = [\n\n ];\n return get_request_rules($this, $commons);\n }", "public function getRules()\n {\n return $this->validator->getRules();\n }", "public function getValidationRules()\n {\n $rules = [];\n\n // Get the schema\n $schema = $this->getSchema();\n\n return $schema->getRules($this);\n }", "public function rules()\n {\n return $this->validationRules;\n }", "public function rules()\n {\n $rules = [];\n switch ($this->getMethod()):\n case \"POST\":\n $rules = [\n 'course_id' => 'required|numeric',\n 'questions' => 'required|array',\n ];\n break;\n case \"PUT\":\n $rules = [\n 'id' => 'required|numeric',\n 'course_id' => 'required|numeric',\n 'questions' => 'required|array',\n ];\n break;\n case \"DELETE\":\n $rules = [\n 'id' => 'required|numeric'\n ];\n break;\n endswitch;\n return $rules;\n }", "public static function getRules()\n {\n return (new static)->getValidationRules();\n }", "public function getRules()\n {\n return $this->validation_rules;\n }", "public function getValidationRules()\n {\n return [];\n }", "public function getValidationRules() {\n return [\n 'email' => 'required|email',\n 'name' => 'required|min:3',\n 'password' => 'required',\n ];\n }", "public function rules()\n {\n if($this->isMethod('post')){\n return $this->post_rules();\n }\n if($this->isMethod('put')){\n return $this->put_rules();\n }\n }", "public function rules()\n {\n $rules = [];\n\n // Validation request for stripe keys for stripe if stripe status in active\n if($this->has('stripe_status')){\n $rules[\"api_key\"] = \"required\";\n $rules[\"api_secret\"] = \"required\";\n $rules[\"webhook_key\"] = \"required\";\n }\n\n if($this->has('razorpay_status')){\n $rules[\"razorpay_key\"] = \"required\";\n $rules[\"razorpay_secret\"] = \"required\";\n $rules[\"razorpay_webhook_secret\"] = \"required\";\n }\n\n // Validation request for paypal keys for paypal if paypal status in active\n if($this->has('paypal_status')){\n $rules[\"paypal_client_id\"] = \"required\";\n $rules[\"paypal_secret\"] = \"required\";\n $rules[\"paypal_mode\"] = \"required_if:paypal_status,on|in:sandbox,live\";\n }\n\n\n return $rules;\n }", "protected function getValidationRules()\n {\n $rules = [\n 'title' => 'required|min:3|max:255',\n ];\n\n return $rules;\n }", "public function getRules()\n\t{\n\t\t$rules['user_id'] = ['required', 'exists:' . app()->make(User::class)->getTable() . ',id'];\n\t\t$rules['org_id'] = ['required', 'exists:' . app()->make(Org::class)->getTable() . ',id'];\n\t\t$rules['role'] = ['required', 'string', 'in:' . implode(',', Static::ROLES)];\n\t\t$rules['scopes'] = ['nullable', 'array'];\n\t\t$rules['ended_at'] = ['nullable', 'date'];\n\t\t$rules['photo_url'] = ['nullable', 'string'];\n\n\t\treturn $rules;\n\t}", "public function rules()\n {\n switch ($this->method()) {\n case 'POST':\n return [\n 'username' => 'required|max:255',\n 'user_id' => 'required',\n 'mobile' => 'required|regex:/^1[34578][0-9]{9}$/',\n 'birthday' => 'required',\n 'cycle_id' => 'required',\n 'expired_at' => 'required',\n 'card_price' => 'required',\n ];\n case 'PUT':\n return [\n 'username' => 'required|max:255',\n 'user_id' => 'required',\n 'mobile' => 'required|regex:/^1[34578][0-9]{9}$/',\n 'birthday' => 'required',\n 'cycle_id' => 'required',\n 'expired_at' => 'required',\n 'card_price' => 'required',\n ];\n }\n }", "public function rules()\n {\n\n switch ($this->method()) {\n case 'GET':\n case 'POST':\n $rules = [\n 'name' => 'required|max:255',\n 'email' => 'required|email|max:255|unique:users',\n 'password' => 'required|min:6|confirmed',\n 'password_confirmation' => 'min:6|same:password',\n 'role_id' => 'required'\n ];\n break;\n case 'PUT':\n case 'PATCH':\n $rules = [\n 'name' => 'required|max:255',\n 'email' => 'required|email|max:255|unique:users,email,'.$this->id,\n ];\n break;\n\n default:\n $rules = [\n 'name' => 'required|max:255',\n 'email' => 'required|email|max:255|unique:users,email,'.$this->id,\n ];\n break;\n }\n return $rules;\n }", "public function rules()\n {\n return $this->rules;\n }", "public function rules()\n {\n return $this->rules;\n }", "public function rules()\n {\n return $this->rules;\n }", "public function rules()\n {\n return $this->rules;\n }", "public function rules()\n {\n return $this->rules;\n }", "public function rules()\n {\n return $this->rules;\n }", "public function rules()\n {\n switch($this->method()) {\n case 'GET':\n return [];\n case 'POST':\n return [\n 'name' => 'required|max:50',\n 'company' => 'required|max:100',\n 'position' => 'required|max:50',\n 'email' => 'required|email|max:150',\n 'phone' => 'required|max:25',\n 'description' => 'nullable|max:500',\n ];\n case 'PUT':\n case 'PATCH':\n return [\n 'name' => 'required|max:50',\n 'company' => 'required|max:100',\n 'position' => 'required|max:50',\n 'email' => 'required|email|max:150',\n 'phone' => 'required|max:25',\n 'description' => 'nullable|max:500',\n ];\n case 'DELETE':\n return [];\n default:break;\n }\n \n }", "public function rules($request) {\n $function = explode(\"@\", $request->route()[1]['uses'])[1];\n return $this->getRouteValidateRule($this->rules, $function);\n // // 获取请求验证的函数名\n // // ltrim(strstr($a,'@'),'@')\n // if (count(explode(\"@\", Request::route()->getActionName())) >= 2) {\n // $actionFunctionName = explode(\"@\", Request::route()->getActionName()) [1];\n // }\n\n // // 取配置并返回\n // if (isset($this->rules[$actionFunctionName])) {\n // if (is_array($this->rules[$actionFunctionName])) {\n // return $this->rules[$actionFunctionName];\n // }\n // else {\n // return $this->rules[$this->rules[$actionFunctionName]];\n // }\n // }\n // else {\n // return [];\n // }\n }", "function getValidationRules() {\n\t\treturn array(\n\t\t\t'_MovieID' => array(\n\t\t\t\t'number' => array(),\n\t\t\t),\n\t\t\t'_UserID' => array(\n\t\t\t\t'number' => array(),\n\t\t\t),\n\t\t\t'_CountryID' => array(\n\t\t\t\t'number' => array(),\n\t\t\t),\n\t\t\t'_BroadCastDate' => array(\n\t\t\t\t'dateTime' => array(),\n\t\t\t),\n\t\t\t'_CreatedDate' => array(\n\t\t\t\t'dateTime' => array(),\n\t\t\t),\n\t\t);\n\t}", "public function rules()\n {\n if ($this->method() === 'POST') {\n return $this->rulesForCreating();\n }\n\n return $this->rulesForUpdating();\n }", "public function rules()\n {\n $validation = [];\n if ($this->method() == \"POST\") {\n $validation = [\n 'name' => 'required|unique:users',\n 'email' => 'required|unique:users|email',\n 'password' => 'required|min:6|confirmed',\n 'password_confirmation' => 'required|min:6',\n 'roles' => 'required',\n ];\n } elseif ($this->method() == \"PUT\") {\n $validation = [\n 'name' => 'required|unique:users,name,' . $this->route()->parameter('id') . ',id',\n 'email' => 'required|unique:users,email,' . $this->route()->parameter('id') . ',id|email',\n 'roles' => 'required',\n ];\n\n if ($this->request->get('change_password') == true) {\n $validation['password'] = 'required|min:6|confirmed';\n $validation['password_confirmation'] = 'required|min:6';\n }\n }\n\n return $validation;\n }", "public function rules()\n {\n $data = $this->request->all();\n $rules['username'] = 'required|email';\n $rules['password'] = 'required'; \n\n return $rules;\n }", "protected function getValidationRules()\n {\n $class = $this->model;\n\n return $class::$rules;\n }", "public function rules()\n {\n $rules = $this->rules;\n\n $rules['fee'] = 'required|integer';\n $rules['phone'] = 'required|min:8|max:20';\n $rules['facebook'] = 'required|url';\n $rules['youtube'] = 'required|url';\n $rules['web'] = 'url';\n\n $rules['requestgender'] = 'required';\n $rules['serviceaddress'] = 'required|max:150';\n $rules['servicetime'] = 'required|max:150';\n $rules['language'] = 'required|max:150';\n $rules['bust'] = 'required|max:100|integer';\n $rules['waistline'] = 'required|max:100|integer';\n $rules['hips'] = 'required|max:100|integer';\n $rules['motto'] = 'max:50';\n\n return $rules;\n }", "protected function getValidRules()\n {\n return $this->validRules;\n }", "public function rules()\n {\n switch($this->method())\n {\n case 'GET':\n case 'DELETE':\n {\n return [];\n }\n case 'POST':\n case 'PUT':\n {\n return [\n 'name' => 'required',\n ];\n }\n default:break;\n }\n }", "public function rules()\n {\n switch ($this->method()) {\n case 'GET':\n case 'POST':\n {\n return [\n 'mobile' => ['required','max:11','min:11'],\n 'code' => ['required','max:6','min:6'],\n 'avatar' => ['required'],\n 'wx_oauth' => ['required'],\n 'password' => ['nullable','min:6','max:20']\n ];\n }\n case 'PUT':\n case 'PATCH':\n case 'DELETE':\n default: {\n return [];\n }\n }\n }", "public function rules()\n {\n switch ($this->getRequestMethod()) {\n case 'index':\n return [\n 'full_name' => 'nullable|string',\n 'phone' => 'nullable|string',\n ];\n break;\n case 'store':\n return [\n 'crm_resource_id' => 'required|exists:crm_resources,id',\n 'channel' => 'required|in:' . get_validate_in_string(CrmResourceCallLog::$channel),\n 'call_status' => 'required|in:' . get_validate_in_string(CrmResourceCallLog::$call_statuses),\n ];\n break;\n default:\n return [];\n break;\n }\n }", "public function rules()\n {\n //With password\n if(request('password') || request('password_confirmation')) {\n return array_merge($this->passwordRules(), $this->defaultRules());\n }\n //Without password\n return $this->defaultRules();\n }", "public function rules()\n {\n $rules = [\n '_token' => 'required'\n ];\n\n foreach($this->request->get('emails') as $key => $val) {\n $rules['emails.'.$key] = 'required|email';\n }\n\n return $rules;\n }", "function getValidationRules() {\n\t\treturn array(\n\t\t\t'_ID' => array(\n\t\t\t\t'number' => array(),\n\t\t\t),\n\t\t\t'_CoverImageID' => array(\n\t\t\t\t'number' => array(),\n\t\t\t),\n\t\t\t'_TrackID' => array(\n\t\t\t\t'number' => array(),\n\t\t\t),\n\t\t\t'_Status' => array(\n\t\t\t\t'number' => array(),\n\t\t\t),\n\t\t\t'_Rank' => array(\n\t\t\t\t'number' => array(),\n\t\t\t),\n\t\t\t'_CreateDate' => array(\n\t\t\t\t'dateTime' => array(),\n\t\t\t),\n\t\t);\n\t}", "public function rules()\n { \n return $this->rules;\n }", "public function getValidationRules()\n {\n if (method_exists($this, 'rules')) {\n return $this->rules();\n }\n\n $table = $this->getTable();\n $cacheKey = 'validate.' . $table;\n\n if (config('validate.cache') && Cache::has($cacheKey)) {\n return Cache::get($cacheKey);\n }\n\n // Get table info for model and generate rules\n $manager = DB::connection()->getDoctrineSchemaManager();\n $details = $manager->listTableDetails($table);\n $foreignKeys = $manager->listTableForeignKeys($table);\n\n $this->generateRules($details, $foreignKeys);\n\n if (config('validate.cache')) {\n Cache::forever($cacheKey, $this->rules);\n }\n\n return $this->rules;\n }", "public function getValidationRules()\n {\n $rules = $this->getBasicValidationRules();\n\n if (in_array($this->type, ['char', 'string', 'text', 'enum'])) {\n $rules[] = 'string';\n if (in_array($this->type, ['char', 'string']) && isset($this->arguments[0])) {\n $rules[] = 'max:' . $this->arguments[0];\n }\n } elseif (in_array($this->type, ['timestamp', 'date', 'dateTime', 'dateTimeTz'])) {\n $rules[] = 'date';\n } elseif (str_contains(strtolower($this->type), 'integer')) {\n $rules[] = 'integer';\n } elseif (str_contains(strtolower($this->type), 'decimal')) {\n $rules[] = 'numeric';\n } elseif (in_array($this->type, ['boolean'])) {\n $rules[] = 'boolean';\n } elseif ($this->type == 'enum' && count($this->arguments)) {\n $rules[] = 'in:' . join(',', $this->arguments);\n }\n\n return [$this->name => join('|', $rules)];\n }", "public function rules()\n {\n $rules = [];\n if ($this->isMethod('post')) {\n $rules = [\n 'vacancy_name' => 'required|string|min:4|max:20',\n 'workers_amount' => 'required|integer|min:1|max:10',\n 'organization_id'=> 'required|integer|exists:organizations,id',\n 'salary' => 'required|integer|min:1|max:10000000',\n ];\n } elseif ($this->isMethod('put')) {\n $rules = [\n 'vacancy_name' => 'required|string|min:4|max:20',\n 'workers_amount' => 'required|integer|min:1|max:10',\n 'organization_id'=> 'required|integer|exists:organizations,id',\n 'salary' => 'required|integer|min:1|max:10000000',\n ];\n }\n return $rules;\n }", "public function validationRules()\n {\n return [];\n }", "public function rules()\n {\n $rules = $this->rules;\n if(Request::isMethod('PATCH')){\n $rules['mg_name'] = 'required|min:2,max:16';\n }\n return $rules;\n }", "function getValidationRules() {\n\t\treturn array(\n\t\t\t'_ID' => array(\n\t\t\t\t'number' => array(),\n\t\t\t),\n\t\t\t'_EventID' => array(\n\t\t\t\t'number' => array(),\n\t\t\t),\n\t\t\t'_SourceID' => array(\n\t\t\t\t'number' => array(),\n\t\t\t),\n\t\t\t'_UserID' => array(\n\t\t\t\t'number' => array(),\n\t\t\t),\n\t\t\t'_HasEvent' => array(\n\t\t\t\t'inArray' => array('values' => array(self::HASEVENT_0, self::HASEVENT_1),),\n\t\t\t),\n\t\t);\n\t}", "public function rules()\n {\n $rules = [];\n switch ($this->method()){\n case 'GET':\n $rules['mobile'] = ['required', 'regex:/^1[3456789]\\d{9}$/'];\n break;\n case 'POST':\n if($this->route()->getActionMethod() == 'sms') {\n $rules['area_code'] = ['digits_between:1,6'];\n if(in_array($this->get('type'), ['signup', 'reset_pay_pwd'])) {\n $rules['mobile'] = ['required', 'digits_between:5,20'];\n if($this->get('type') == 'signup' && !$this->get('area_code')) {\n $this->error('请选择区号');\n }\n }\n $rules['type'] = ['required', Rule::in(\\App\\Models\\Captcha::getSmsType())];\n }\n break;\n }\n return $rules;\n }", "public function rules()\n {\n if ($this->isMethod('post')) {\n return $this->createRules();\n } elseif ($this->isMethod('put')) {\n return $this->updateRules();\n }\n }", "public function rules()\n {\n $rules = [\n 'first_name' => ['required'],\n 'birthdate' => ['required', 'date', 'before:today'],\n ];\n\n if (is_international_session()) {\n $rules['email'] = ['required', 'email'];\n }\n\n if (should_collect_international_phone()) {\n $rules['phone'] = ['phone'];\n }\n\n if (is_domestic_session()) {\n $rules['phone'] = ['required', 'phone'];\n }\n\n return $rules;\n }", "public function rules()\n {\n dd($this->request->get('answer'));\n foreach ($this->request->get('answer') as $key => $val)\n {\n $rules['answer.'.$key] = 'required';\n }\n\n return $rules;\n }", "public function rules()\n {\n return static::$rules;\n }", "function getRules() {\n\t\t$fields = $this->getFields();\n\t\t$allRules = array();\n\n\t\tforeach ($fields as $field) {\n\t\t\t$fieldRules = $field->getValidationRules();\n\t\t\t$allRules[$field->getName()] = $fieldRules;\n\t\t}\n\n\t\treturn $allRules;\n\t}", "public static function getValidationRules(): array\n {\n return [\n 'name' => 'required|string|min:1|max:255',\n 'version' => 'required|float',\n 'type' => 'required|string',\n ];\n }", "public function rules()\n {\n $rules = [\n 'name' => 'required',\n 'phone' => 'required|numeric',\n 'subject' => 'required',\n 'message' => 'required',\n 'email' => 'required|email',\n ];\n\n return $rules;\n }", "public function getValidationRules(): array\n {\n return [\n 'email_address' => 'required|email',\n 'email_type' => 'nullable|in:html,text',\n 'status' => 'required|in:subscribed,unsubscribed,cleaned,pending',\n 'merge_fields' => 'nullable|array',\n 'interests' => 'nullable|array',\n 'language' => 'nullable|string',\n 'vip' => 'nullable|boolean',\n 'location' => 'nullable|array',\n 'location.latitude' => ['regex:/^[-]?(([0-8]?[0-9])\\.(\\d+))|(90(\\.0+)?)$/'], \n 'location.longitude' => ['regex:/^[-]?((((1[0-7][0-9])|([0-9]?[0-9]))\\.(\\d+))|180(\\.0+)?)$/'],\n 'marketing_permissions' => 'nullable|array',\n 'tags' => 'nullable|array'\n ];\n }", "protected function getValidationRules()\n {\n return [\n 'first_name' => 'required|max:255',\n 'last_name' => 'required|max:255',\n 'email' => 'required|email|max:255',\n 'new_password' => 'required_with:current_password|confirmed|regex:' . config('security.password_policy'),\n ];\n }", "public function rules()\n {\n // get 直接放行\n if( request()->isMethod('get') ){\n return []; // 规则为空\n }\n\n // 只在post的时候做验证\n return [\n 'username' => 'required|min:2|max:10', \n 'password' => 'required|min:2|max:10', \n 'email' => 'required|min:2|max:10|email', \n 'phoneNumber' => 'required|min:2|max:10', \n\n ];\n }", "public function rules()\n {\n\n $rules = [\n 'id_tecnico_mantenimiento' => 'required',\n 'id_equipo_mantenimiento' => 'required'\n ];\n\n if ($this->request->has('status')) {\n $rules['status'] = 'required';\n }\n\n if ($this->request->has('log_mantenimiento')) {\n $rules['log_mantenimiento'] = 'required';\n }\n\n return $rules;\n }", "public function rules()\n {\n $this->buildRules();\n return $this->rules;\n }", "public function rules()\n {\n $rules = [];\n\n if ($this->isUpdate() || $this->isStore()) {\n $rules = array_merge($rules, [\n 'name' => 'required|string',\n 'email' => 'email',\n 'password' => 'confirmed|min:6',\n\n ]);\n }\n\n if ($this->isStore()) {\n $rules = array_merge($rules, [\n\n ]);\n }\n\n if ($this->isUpdate()) {\n $rules = array_merge($rules, [\n ]);\n }\n\n return $rules;\n }", "public function rules()\n {\n switch (true) {\n case $this->wantsToList():\n $rules = $this->listRules;\n break;\n case $this->wantsToStore():\n $rules = $this->storeRules;\n break;\n case $this->wantsToUpdate():\n $this->storeRules['email'] = 'required|email|between:5,100|unique:users,email,' . $this->route('administrators');\n\n $rules = $this->storeRules;\n break;\n default:\n $rules = [];\n }\n\n return $rules;\n }", "public function rules()\n {\n if($this->isMethod('post')) {\n return $this->storeRules();\n }\n else if($this->isMethod('put') || $this->isMethod('patch')){\n return $this->updateRules();\n }\n }", "abstract protected function getValidationRules();", "public function rules()\n\t{\n\t\treturn ModelHelper::getRules($this);\n\t}", "public function rules()\n {\n switch ($this->method()) {\n case 'POST':\n return $this->getPostRules();\n case 'PUT':\n return $this->getPutRules();\n }\n }", "public function rules()\n {\n $rules = [\n 'name' => 'required|string|min:2',\n 'email' => \"required|email|unique:users,email, {$this->request->get('user_id')}\",\n 'role_id' => 'required|numeric',\n 'group_id' => 'required|numeric',\n ];\n\n if ($this->request->has('password')){\n $rules['password'] = 'required|min:6';\n }\n\n return $rules;\n }", "public function rules()\n {\n if($this->method() == 'POST')\n {\n return [\n 'reason'=>'required',\n 'date_from'=>'required',\n 'date_to'=>'required',\n 'attachment'=>'required',\n ];\n }\n }", "public function rules()\n {\n $method = $this->method();\n if ($this->get('_method', null) !== null) {\n $method = $this->get('_method');\n }\n // $this->offsetUnset('_method');\n switch ($method) {\n case 'DELETE':\n case 'GET':\n break; \n case 'POST':\n $mailRules = \\Config::get('database.default').'.users';\n break;\n case 'PUT':\n $user = $this->authService->authJWTUserForm();\n $mailRules = \\Config::get('database.default').'.users,email,'.$user->getKey();\n break;\n case 'PATCH':\n break;\n default:\n break;\n }\n \n return [\n 'name' => 'required|string|max:256',\n 'email' => 'required|string|email|max:255|unique:'.$mailRules,\n 'password' => 'required|string|min:3',\n ];\n }", "public function rules() {\n $rule = [\n 'value' => 'bail|required',\n ];\n if ($this->getMethod() == 'POST') {\n $rule += ['type' => 'bail|required'];\n }\n return $rule;\n }", "public function rules()\n {\n switch ($this->method()) {\n case 'GET':\n case 'DELETE': {\n return [];\n }\n case 'POST': {\n return [\n 'from' => 'required|max:100',\n 'to' => 'required|max:500',\n 'day' => 'required|max:500',\n ];\n }\n case 'PUT':\n case 'PATCH': {\n return [\n 'from' => 'required|max:100',\n 'to' => 'required|max:500',\n 'day' => 'required|max:500',\n ];\n }\n default:\n break;\n }\n\n return [\n //\n ];\n }", "public function rules()\n {\n switch ($this->method()) {\n case 'GET':\n case 'DELETE': {\n return [];\n }\n case 'POST':\n case 'PUT':\n case 'PATCH': {\n return [\n 'name' => 'required|string|max:255',\n 'iso_code_2' => 'required|string|size:2',\n 'iso_code_3' => 'required|string|size:3',\n ];\n }\n default:\n return [];\n }\n }", "public function rules()\n {\n switch ($this->method()) {\n case 'GET':\n case 'DELETE':\n return [];\n case 'POST':\n return [\n 'name' => 'required|string',\n 'lastName' => 'string',\n 'gender' => 'boolean',\n 'avatar' => 'sometimes|mimes:jpg,png,jpeg|max:3048'\n ];\n case 'PUT':\n case 'PATCH':\n return [\n 'oldPassword' => 'required|string',\n 'newPassword' => 'required|string',\n ];\n default:\n break;\n }\n }", "public function rules()\n {\n switch ($this->method()) {\n case 'GET':\n case 'DELETE':\n {\n return [\n 'validation' => [\n 'accepted'\n ]\n ];\n }\n case 'POST':\n {\n return [\n 'title' => [\n 'required',\n 'string',\n 'min:3',\n 'max:250'\n ],\n 'body' => [\n 'required',\n 'string',\n 'min:3',\n 'max:250000'\n ],\n 'online' => [\n 'required',\n ],\n 'indexable' => [\n 'required',\n ],\n 'published_at' => [\n 'required',\n ],\n 'published_at_time' => [\n 'required',\n ],\n 'unpublished_at' => [\n 'nullable',\n ],\n 'unpublished_time' => [\n 'nullable',\n ],\n ];\n }\n case 'PUT':\n {\n return [\n 'title' => [\n 'required',\n 'string',\n 'min:3',\n 'max:250'\n ],\n 'body' => [\n 'required',\n 'string',\n 'min:3',\n 'max:250000'\n ],\n 'online' => [\n 'required',\n ],\n 'indexable' => [\n 'required',\n ],\n 'published_at' => [\n 'required',\n ],\n 'unpublished_at' => [\n 'nullable',\n ],\n ];\n }\n case 'PATCH':\n {\n return [];\n }\n default:\n break;\n }\n }", "public function rules()\n {\n if (in_array($this->method(), ['PUT', 'PATCH'])) {\n $user = User::findOrFail(\\Request::input('id'))->first();\n\n array_forget($this->rules, 'email');\n $this->rules = array_add($this->rules, 'email', 'required|email|max:255|unique:users,email,' . $user->id);\n }\n\n return $this->rules;\n }", "public function rules()\n {\n $method = explode('@', $this->route()->getActionName())[1];\n return $this->get_rules_arr($method);\n }", "public function rules()\n {\n $rules = parent::rules();\n $extra_rules = [];\n $rules = array_merge($rules, $extra_rules);\n return $rules;\n }", "public function rules()\n {\n\t\tswitch($this->method()) {\n\t\t\tcase 'POST':\n\t\t\t\t{\n\t\t\t\t\treturn [\n\t\t\t\t\t\t'field_id' => 'integer|required',\n\t\t\t\t\t\t'label' => 'string|required',\n\t\t\t\t\t\t'value' => 'alpha_dash|required',\n\t\t\t\t\t\t'selected' => 'boolean',\n\t\t\t\t\t\t'actif' => 'boolean',\n\t\t\t\t\t];\n\t\t\t\t}\n\t\t\tcase 'PUT':\n\t\t\t\t{\n\t\t\t\t\treturn [\n\t\t\t\t\t\t'field_id' => 'integer|required',\n\t\t\t\t\t\t'label' => 'string|required',\n\t\t\t\t\t\t'value' => 'alpha_dash|required',\n\t\t\t\t\t\t'selected' => 'boolean',\n\t\t\t\t\t\t'actif' => 'boolean',\n\t\t\t\t\t];\n\t\t\t\t}\n\t\t\tdefault:break;\n\t\t}\n }", "public function rules()\n {\n $this->sanitize();\n return [\n 'event_id' => 'required',\n 'member_id' => 'required',\n 'guild_pts' => 'required',\n 'position' => 'required',\n 'solo_pts' => 'required',\n 'league_id' => 'required',\n 'solo_rank' => 'required',\n 'global_rank' => 'required',\n ];\n }", "public function rules()\n {\n $this->rules['email'] = ['required', 'min:6', 'max:60', 'email'];\n $this->rules['password'] = ['required', 'min:6', 'max:60'];\n\n return $this->rules;\n }", "public function getValidatorRules()\n {\n if ($validator = $this->getValidator()) {\n return $validator->getRulesForField($this->owner);\n }\n \n return [];\n }", "public function getValidationRules() : array;", "public function rules()\n {\n switch ($this->route()->getActionMethod()) {\n case 'login': {\n if ($this->request->has('access_token')) {\n return [\n 'access_token' => 'required',\n 'driver' => 'required|in:facebook,github,google',\n ];\n }\n return [\n 'email' => 'required|email',\n 'password' => 'required|min:6',\n ];\n }\n case 'register': {\n return [\n 'email' => 'required|email|unique:users,email',\n 'password' => 'required|min:6',\n 'name' => 'required',\n ];\n }\n default: return [];\n }\n }", "public function rules()\n {\n Validator::extend('mail_address_available', function($attribute, $value, $parameters, $validator){\n return MailAddressSpec::isAvailable($value);\n });\n Validator::extend('password_available', function($attribute, $value, $parameters, $validator){\n return PassWordSpec::isAvailable($value);\n });\n\n return [\n 'mail_address' => [\n 'required',\n 'mail_address_available'\n ],\n 'password' => [\n 'required',\n 'password_available',\n ],\n ];\n }", "public function rules()\n {\n switch (strtolower($this->method())) {\n case 'get':\n return $this->getMethodRules();\n case 'post':\n return $this->postMethodRules();\n case 'put':\n return $this->putMethodRules();\n case 'patch':\n return $this->patchMethodRules();\n case 'delete':\n return $this->deleteMethodRules();\n }\n }", "public function rules()\n {\n /**\n * This is the original way, expecting post params for each user value\n */\n return [\n 'firstName' => 'required|min:2|max:255',\n 'lastName' => 'required|min:2|max:255',\n 'phone' => 'min:9|max:25',\n 'gender' => 'in:M,V',\n 'dateOfBirth' => 'before:today|after:1890-01-01',\n 'email' => 'email|min:12|max:255',\n ];\n }", "public function getValidationRules(): array {\n\t\t$result = [];\n\t\t\n\t\tforeach ($this->getSections() as $section) {\n\t\t\t$result = array_merge($result, $section->getValidationRules());\n\t\t}\n\t\t\n\t\treturn $result;\n\t}", "public function rules()\n\t{\n\t\t$rule = [];\n\t\tif(Request::path() == 'api/utility/upload-image'){\n\t\t\t$rule = [\n\t\t\t\t'imagePath' => 'required',\n\t\t\t];\n\t\t}else if(Request::path() == 'api/utility/check-transaction'){\n\t\t\t$rule = [\n\t\t\t\t'countNumber' => 'required',\n\t\t\t];\n\t\t}\n\t\treturn $rule;\n\t}", "public function rules()\n {\n $rules = array();\n return $rules;\n }", "public function rules()\n {\n $this->setValidator($this->operation_type);\n return $this->validator;\n }", "public function rules()\n {\n switch($this->method()){\n case 'POST':\n return [\n 'name' => 'required',\n 'app_id' => 'required',\n 'account_id' => 'required',\n 'start_at' => 'required',\n 'end_at' => 'required',\n 'content' => 'required',\n ];\n break;\n default:\n return [];\n break;\n }\n\n }", "public function rules()\n {\n $rules = [\n 'users' => 'required|array',\n ];\n\n foreach($this->request->get('users') as $key => $user) {\n $rules['users.'. $key . '.name'] = 'required|string|min:3|max:255';\n $rules['users.'. $key . '.phone'] = 'required|regex:/^[0-9\\+\\s]+$/|min:10|max:17';\n $rules['users.'. $key . '.country'] = 'required|string|min:2:max:3';\n }\n\n return $rules;\n }", "protected function get_validation_rules()\n {\n }", "public function rules()\n {\n $rules = [\n 'mail_driver' => 'required',\n 'mail_name' => 'required',\n 'mail_email' => 'required',\n ];\n\n $newRules = [];\n\n if($this->mail_driver == 'smtp') {\n $newRules = [\n 'mail_host' => 'required',\n 'mail_port' => 'required|numeric',\n 'mail_username' => 'required',\n 'mail_password' => 'required',\n 'mail_encryption' => 'required',\n ];\n }\n\n return array_merge($rules, $newRules);\n }", "public function rules()\n {\n $rules['name'] = 'required';\n $rules['poa'] = 'required';\n $rules['background'] = 'required';\n $rules['tester_name'] = 'required';\n $rules['location'] = 'required';\n $rules['end_recruit_date'] = 'required';\n $rules['time_taken'] = 'required';\n $rules['payment'] = 'required';\n $rules['objective'] = 'required';\n $rules['method_desc'] = 'required';\n $rules['health_condition'] = 'required';\n $rules['required_applicant'] = 'required|integer';\n $rules['applicant'] = 'nullable';\n $rules['datetime'] = 'required';\n\n return $rules;\n }", "public function rules()\n {\n switch($this->method()) {\n\n case 'PUT':\n {\n return [\n 'company_name' => 'required',\n 'status' => 'required|integer',\n 'notify_url' => 'required',\n 'name' => 'required'\n ];\n }\n case 'POST':\n {\n return [\n 'company_name' => 'required',\n 'status' => 'required|integer',\n 'notify_url' => 'required',\n 'name' => 'required'\n ];\n }\n default:\n return [];\n }\n\n }", "public function rules()\n {\n $rules['name'] = 'required';\n $rules['poa'] = 'required';\n $rules['background'] = 'required';\n $rules['tester_name'] = 'required';\n\n return $rules;\n }", "public function rules()\n {\n switch(Route::currentRouteName()){\n case 'adminBinding' :\n return [\n 'order_id' => 'required|integer',\n 'money' => 'required|numeric',\n ];\n case 'adminUnbinding' :\n return [\n 'order_id' => 'required|integer',\n 'pivot_id' => 'required|integer',\n ];\n case 'adminReceiptSave' :\n case 'adminReceiptUpdate' :\n return [\n 'customer_id' => 'required',\n 'receiptcorp' => 'required',\n 'account' => 'required',\n 'account_id' => 'required',\n 'bank' => 'required',\n 'currency_id' => 'required',\n 'advance_amount' => 'required|numeric',\n 'picture' => 'required',\n 'business_type' => 'required|in:1,2,3,4,5',\n 'exchange_type' => 'required_unless:currency_id,354|in:1,2',\n 'expected_received_at' => 'required|date_format:Y-m-d',\n ];\n case 'adminReceiptExchange' :\n return [\n 'rate' => 'required|numeric',\n ];\n default :\n return [];\n }\n }", "public function rules()\n {\n $rules = [];\n $method = $this->getMethod();\n switch ($method) {\n case 'GET':\n if (Route::currentRouteName() === 'schoolActivity.getSchoolActivity') {\n $rules = [\n ];\n }\n break;\n }\n return $rules;\n }", "public function rules()\n {\n $rules = new Collection();\n\n if (!$this->user() or !$this->user()->addresses()->count()) {\n $rules = $rules->merge($this->addressRules('billing'));\n if ($this->has('different_shipping_address')) {\n $rules = $rules->merge($this->addressRules('shipping'));\n }\n\n return $rules->toArray();\n }\n\n return $rules->merge([\n 'billing_address_id' => 'required|numeric',\n 'shipping_address_id' => 'required|numeric',\n ])->toArray();\n }", "public function rules(): array\n {\n switch ($this->method()) {\n case 'POST':\n return $this->__rules() + $this->__post();\n case 'PUT':\n return $this->__rules() + $this->__put();\n default:\n return [];\n }\n }", "public function rules(Request $request)\n {\n return Qc::$rules;\n }", "public function defineValidationRules()\n {\n return [];\n }", "public function rules()\n {\n switch ($this->method()) {\n case 'POST':\n return [\n 'user_name' => 'nullable|string',\n 'excel' => 'nullable|file|mimes:xlsx',\n 'category' => 'required|int|in:' . implode(',', array_keys(UserMessage::$categories)),\n 'content' => 'required|string|max:500',\n 'member_status' => 'required|int|in:' . implode(',', array_keys(User::$statuses)),\n ];\n break;\n }\n }", "public function rules()\n {\n return [\n 'lead_id' => [\n 'required', 'string',\n ],\n 'api_version' => [\n 'required', 'string',\n ],\n 'form_id' => [\n 'required', 'int',\n ],\n 'campaign_id' => [\n 'required', 'int',\n ],\n 'google_key' => [\n 'required', 'string', new GoogleKeyRule,\n ],\n ];\n }" ]
[ "0.83426684", "0.8012867", "0.79357", "0.7925642", "0.7922824", "0.79036003", "0.785905", "0.77895427", "0.77832615", "0.7762324", "0.77367616", "0.7732319", "0.7709478", "0.7691477", "0.76847756", "0.7682022", "0.7682022", "0.7682022", "0.7682022", "0.7682022", "0.7682022", "0.7675238", "0.76745033", "0.7665319", "0.76570827", "0.764131", "0.7629555", "0.7629431", "0.7617311", "0.7609077", "0.76070553", "0.7602018", "0.759865", "0.7597791", "0.75919396", "0.7590118", "0.75871897", "0.75797164", "0.7555521", "0.755503", "0.75503516", "0.75458753", "0.75403965", "0.75360876", "0.7535538", "0.75300974", "0.7518105", "0.75145686", "0.75076634", "0.7506042", "0.75051844", "0.7498838", "0.7495001", "0.7494829", "0.74931705", "0.7490103", "0.7489394", "0.7489037", "0.7485875", "0.74857", "0.7478841", "0.74781114", "0.74692464", "0.74632394", "0.7461548", "0.74611425", "0.74590236", "0.74544203", "0.7453257", "0.7452147", "0.74498093", "0.7447976", "0.7441319", "0.7440709", "0.7435135", "0.7434774", "0.74325204", "0.74295586", "0.74287397", "0.74233043", "0.7418827", "0.74155605", "0.7413598", "0.7413494", "0.74120796", "0.740962", "0.74052715", "0.74039626", "0.7403312", "0.7400803", "0.7390036", "0.7383104", "0.73728377", "0.73704565", "0.73687065", "0.73608035", "0.7355335", "0.73462147", "0.7344126", "0.73427063", "0.7334932" ]
0.0
-1
fnoction qui supprime un visiteur de la bdd
function suppMembre($id) { $this->db->where('id', $id); $this->db->delete('membres'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abstract public function hidupkan();", "function eliminar($bd);", "public function nadar()\n {\n }", "function chnodesp($numero){\n\t\t$dbnumero = $this->db->escape($numero);\n\t\t$fdespacha= $this->datasis->dameval(\"SELECT fdespacha FROM sfac WHERE numero=${dbnumero}\");\n\t\tif(empty($fdespacha)){\n\t\t\treturn true;\n\t\t}\n\t\t$this->validation->set_message('chnodesp', \"La factura ${numero} ya esta marcada como despachada el día \".dbdate_to_human($fdespacha).\".\");\n\t\treturn false;\n\t}", "function personnaliser_bandeau_haut_debut($flux){\n\tif (defined('_PERSO_BANDEAU_HAUT_DEBUT'))\n\t\treturn afficher_noisettes(_PERSO_BANDEAU_HAUT_DEBUT, $flux, false);\n}", "function hideExhibit(){\n\t\t$this->setVisible('0');\n\t\t$res = requete_sql(\"UPDATE exhibit SET visible = '\".$this->visible.\"' WHERE id = '\".$this->id.\"' \");\n\t\tif ($res) {\n\t\t\treturn TRUE;\n\t\t}\n\t\telse{\n\t\t\treturn FALSE;\n\t\t}\n\t}", "public function isVisitante(){ return false; }", "public function getNegocio();", "public function bernafas()\n \t{\n \t\techo 'Bernafas menggunakan hidung, '.PHP_EOL;\n \t}", "function chdespacha($numero){\n\t\t$dbnumero = $this->db->escape($numero);\n\t\t$fdespacha= $this->datasis->dameval(\"SELECT fdespacha FROM sfac WHERE numero=${dbnumero}\");\n\t\tif(empty($fdespacha)){\n\t\t\t$this->validation->set_message('chdespacha', \"La factura ${numero} no esta marcada como despachada.\");\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "public function banear ($nom)\n {\n if ($this->nom == \"Pere\") echo \"<b class='color'>Pere ha estat banejat</b>\";\n\n }", "public function AggiornaPrezzi(){\n\t}", "function getTablaDisponibilidadDetalladaFlexible() {\n\t\t$this->extra[\"variable\"] = 'true';\n\t\techo $this->getTablaDisponibilidadDetallada();\n\t}", "public function getInvisibleFlag() {}", "function no_devenir_star($pseudo){\n\t\tglobal $bdd;\n\n\t\t$req = $bdd->query(\"UPDATE `utilisateur` SET `devenir_star` = FALSE WHERE `pseudo` = '$pseudo'\");\n\t\t\n\t\t$req->closeCursor();\n\t}", "function hitungDenda(){\n\n return 0;\n }", "function personnaliser_pied_debut($flux){\n\tif (defined('_PERSO_PIED_DEBUT'))\n\t\treturn afficher_noisettes(_PERSO_PIED_DEBUT, $flux, false);\n}", "function isHidden();", "public function hideExtraField()\n {\n $this->houses=false;\n $this->jobs_training=false;\n $this->motorcycles =false;\n $this->cars = false;\n $this->offices=false;\n $this->lands_plots=false;\n return;\n }", "public function isHidden();", "public function isHidden();", "public function isHidden();", "public function isHidden();", "function baja_de_interinos($id_desig,$fec){\n $bandera=false;\n $sql=\"select id_designacion from reserva_ocupada_por\"\n . \" where id_reserva=\".$id_desig;\n $res= toba::db('designa')->consultar($sql);\n if(count($res)>0){\n $cadena_desig=implode(\",\",$res[0]);\n $fecha = date($fec);\n $nuevafecha = strtotime ( '-1 day' , strtotime ( $fecha ) ) ;\n $nuevafecha = date ( 'Y-m-j' , $nuevafecha );\n $sql=\"update designacion set nro_540=null, hasta='\".$nuevafecha.\"' where id_designacion in(\".$cadena_desig.\")\";\n toba::db('designa')->consultar($sql);\n $bandera=true;\n }\n return $bandera;\n }", "public function detalheAction () {\n // Título da tela (action)\n $this->view->telaTitle = 'Visualizar Exercício Orçamentário';\n\n // Identifica o parâmetro da chave primária a ser buscada\n $chavePrimaria = $this->_getParam('cod');\n\n if ($chavePrimaria) {\n // Busca registro específico\n $negocio = new $this->_classeNegocio ();\n $registro = $negocio->retornaRegistro($chavePrimaria);\n\n if ($registro) {\n // Exibe os dados do registro\n $this->view->dados = $registro;\n } else {\n $this->registroNaoEncontrado();\n }\n } else {\n $this->codigoNaoInformado();\n }\n }", "public function getHidden(): bool;", "public function getHiddenFlag() {}", "public function opcionesDesplegable();", "function afficher() {\r\n \r\n if($this->getEtat()){\r\n echo \"0\";\r\n }else{\r\n \r\n echo \"&nbsp\";\r\n }\r\n \r\n }", "public function DBEliminar()\n {\n $oDbl = $this->getoDbl();\n $nom_tabla = $this->getNomTabla();\n if (($oDbl->exec(\"DELETE FROM $nom_tabla WHERE id_activ='$this->iid_activ' AND id_asignatura='$this->iid_asignatura' AND id_nom=$this->iid_nom\")) === false) {\n $sClauError = 'Matricula.eliminar';\n $_SESSION['oGestorErrores']->addErrorAppLastError($oDbl, $sClauError, __LINE__, __FILE__);\n return false;\n }\n return true;\n }", "function cinotif_desabonner_auteur($objet, $id_objet='') {\n\t$return = '';\n\t$id_auteur = cinotif_id_auteur();\n\t$id_abonne = cinotif_id_abonne($id_auteur, '');\n\t\n\tif ($objet AND $id_abonne){\n\t\tif ($objet=='site') {\n\t\t\t$where = \"id_abonne=\".$id_abonne;\n\t\t} else {\n\t\t\t$tableau_id_evenement = cinotif_ids_evenement($objet, $id_objet);\t\t\t\t\n\t\t\t$in = sql_in('id_evenement',$tableau_id_evenement);\n\t\t\t$where = \"id_abonne=\".$id_abonne.\" AND \".$in;\n\t\t}\n\t\t\n\t\t$return = sql_delete(\"spip_cinotif_abonnements\", $where);\n\t\tcinotif_suppr_evenements_sans_abonnement();\t\t\n\t\tcinotif_suppr_abonnes_sans_abonnement();\n\t}\n\n\treturn $return;\n}", "public function v_cambiar_detalles(){\n\t\tif($this -> e_fragmento === '' && $this -> e_personaje === '' && $this -> e_tarea === '' && $this -> e_leyenda === '' && $this -> e_id === ''){\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "function personnaliser_bandeau_bas_debut($flux){\n\tif (defined('_PERSO_BANDEAU_BAS_DEBUT'))\n\t\treturn afficher_noisettes(_PERSO_BANDEAU_BAS_DEBUT, $flux, false);\n}", "public function DBEliminar()\n {\n $oDbl = $this->getoDbl();\n $nom_tabla = $this->getNomTabla();\n if (($oDbl->exec(\"DELETE FROM $nom_tabla WHERE nivel_stgr='$this->inivel_stgr'\")) === false) {\n $sClauError = 'NivelStgr.eliminar';\n $_SESSION['oGestorErrores']->addErrorAppLastError($oDbl, $sClauError, __LINE__, __FILE__);\n return false;\n }\n return true;\n }", "function control_suplente($desde,$hasta,$id_desig_suplente){\n //busco todas las licencias de la designacion que ingresa\n //novedades vigentes en el periodo\n $anio=date(\"Y\", strtotime($desde)); \n $pdia = dt_mocovi_periodo_presupuestario::primer_dia_periodo_anio($anio);\n $udia = dt_mocovi_periodo_presupuestario::ultimo_dia_periodo_anio($anio);\n $sql=\"SELECT distinct t_n.desde,t_n.hasta \n FROM novedad t_n\n WHERE t_n.id_designacion=$id_desig_suplente\n and t_n.tipo_nov in (2,3,5)\n and t_n.desde<='\".$udia.\"' and t_n.hasta>='\".$pdia.\"'\"\n . \" ORDER BY t_n.desde,t_n.hasta\"; \n $licencias=toba::db('designa')->consultar($sql);\n $i=0;$seguir=true;$long=count($licencias);$primera=true;\n while(($i<$long) and $seguir){\n if($primera){\n $a=$licencias[$i]['desde'];\n $b=$licencias[$i]['hasta'];\n $primera=false;\n }else{\n if($desde>=$licencias[$i]['desde']){\n $a=$licencias[$i]['desde'];\n $b=$licencias[$i]['hasta'];\n }\n if($hasta<=$licencias[$i]['hasta']){\n $seguir=false;\n }\n \n if(($licencias[$i]['desde']==date(\"Y-m-d\",strtotime($b.\"+ 1 days\"))) or ($licencias[$i]['desde']==$b)){\n $b=$licencias[$i]['hasta'];\n }\n }\n $i++;\n }\n if($long>0){\n if($desde>=$a and $hasta<=$b){\n return true;\n }else{\n return false;\n }\n }else{//no tiene novedades\n return false;\n }\n\n// $sql=\"select * from designacion t_d\"\n// . \" INNER JOIN novedad t_n ON (t_d.id_designacion=t_n.id_designacion and t_n.tipo_nov in (2,3,5) )\"\n// . \" where t_d.id_designacion=$id_desig_suplente\"\n// . \" and '\".$desde.\"'>=t_n.desde and '\".$hasta.\"'<=t_n.hasta\";\n// $res=toba::db('designa')->consultar($sql);\n// if(count($res)>0){\n// return true;\n// }else{\n// return false;\n// }\n }", "final function velcom(){\n }", "public function suprDiplomePossede()\n {\n //sécurité :\n $action = 'deleteFolderInformation';\n $error = AccessControll::checkRight($action);\n if ( empty($error) ){ //ok\n //on réccupère l'id à supr (clée primaire)\n $id = $this->request->getGetAttribute('id');\n //ajout d'une entrée dans le fichier de log\n $data = DossierManager::getPossedeByClef($id);\n $auth = AuthenticationManager::getInstance();\n $username = $auth->getMatricule();\n $type = 'possedeDiplome';\n self::logDeletedInformation($data, $username, $type);\n //on supprime (retourne le matricule)\n $matricule = DossierManager::suprDiplomePossedeById($id);\n //on réaffiche le dossier actualisé\n $dossier = DossierManager::getOneFromId($matricule);\n $prez = self::afficheDossierComplet($dossier);\n $this->response->setPart('contenu', $prez);\n } else{\n header(\"location: index.php\");\n die($error);\n }\n }", "public function dohvati_najaktuelnije_ideje()\n {\n $ideje= $this->findAll();\n usort($ideje,function ($i1,$i2)\n {\n //proveriti je l' ovo tranzitivno, idejno jeste, samo da li sam napravio gresku\n $dat1= strtotime($i1->DatumEvaluacije); \n $dat2= strtotime($i2->DatumEvaluacije); \n $danas= strtotime(date(\"Y-m-d H:i:s\"));\n if ($dat1==$dat2)\n {\n return 0;\n }\n if ($dat1>$danas)\n {\n if ($dat2<$danas)//dat2 nije aktuelno, jer je vec proslo, a d1 jeste te ide ispred\n {\n return -1;\n }\n else//oba tek treba da se dogode aktuelnije je ono sto ce pre da se dogodi\n {\n if ($dat1<$dat2)\n {\n return -1;\n }\n else\n {\n return 1;\n }\n }\n }\n else//dat1 nije aktuelno\n {\n if ($dat2>$danas)//dat2 ide ispred\n {\n return 1;\n }\n else//nijedan nije aktuelan zato zelimo da bude ispred onaj sa vecim datumom jer je on blizi sadasnjosti\n {\n if ($dat1<$dat2)\n {\n return 1;\n }\n else \n {\n return -1;\n \n }\n }\n \n }\n });\n return $ideje;\n \n }", "public function isplata($iznos){\n\n $stanjesalimitom=$this->stanje+$this->limit;\n\n if($iznos<=$stanjesalimitom){\n // $novostanje=$stanjesalimitom-$iznos;\n //echo \"Vas iznos je isplacen<br>\";\n // echo \"Novo stanje na racunu je: \".$novostanje;\n if($iznos>$this->stanje){\n // ovde je kontrolno logika ako klijent ulazi u minus\n $zaduzenje=$iznos-$this->stanje;\n $this->limit-=$zaduzenje;\n $this->stanje=0;\n echo \"Vas iznos je isplacen<br>\";\n echo \"Usli ste u dozvoljeni minus, Vas limit iznosi jos: \".$this->limit;\n\n }else{\n // ako trazi manji iznos od stanja koje ima na racunu\n $this->stanje-=$iznos;\n echo \"Vas iznos je isplacen, novo stanje je: \".$this->stanje;\n }\n\n }else{\n echo \"Nemate dovoljno sredstava na racunu\";\n }\n\n\n\n}", "public function negados(): void\n {\n $dados['title'] = 'Negados';\n $dados['procedimentos'] = $this->Procedimentos->porPaciente(['negado_por !=' => NULL]);\n\n $this->view('regulacao/procedimentos/Negados_view', $dados);\n }", "function motivoDeAnulacionDesin(){\n\t\t$sql = \"SELECT * FROM motivo_movimiento WHERE tipo_motivo='ANULACIÓNDS' and status='1'\";\n\t\treturn $this->ejecuta($sql);\n\t}", "public function DBEliminar()\n {\n $oDbl = $this->getoDbl();\n $nom_tabla = $this->getNomTabla();\n if (($oDblSt = $oDbl->exec(\"DELETE FROM $nom_tabla WHERE id_situacion='$this->iid_situacion'\")) === false) {\n $sClauError = 'Nota.eliminar';\n $_SESSION['oGestorErrores']->addErrorAppLastError($oDbl, $sClauError, __LINE__, __FILE__);\n return false;\n }\n return true;\n }", "public function liberar() {}", "public function getJadwalDimulai();", "function delete_desa($id)\n\t{\n\t\t//--> hapus data desa\n\t\t$this->db->delete('sub_instansi', array('id' => $id));\n\n \t\treturn true;\n\t}", "function personnaliser_bandeau_haut_fin($flux){\n\tif (defined('_PERSO_BANDEAU_HAUT_FIN'))\n\t\treturn afficher_noisettes(_PERSO_BANDEAU_HAUT_FIN, $flux, false);\n}", "public static function reject(){\n if(ModelBenevole::isOrga($_SESSION['login'], $_GET['IDFestival'])){\n ModelBenevole::reject($_GET['IDBenevole'], $_GET['IDFestival']); //appel au modèle pour gerer la BD\n $controller = 'benevole';\n $view = 'demandesorga';\n $pagetitle = 'Liste des demandes Organisateur';\n require_once (File::build_path(array('view','view.php'))); //\"redirige\" vers la vue\n }else{\n $controller = 'benevole';\n $view = 'error';\n $pagetitle = 'Vous n\\'avez pas les droits ';\n }\n }", "public function DBEliminar()\n {\n $oDbl = $this->getoDbl();\n $nom_tabla = $this->getNomTabla();\n if (($oDblSt = $oDbl->exec(\"DELETE FROM $nom_tabla WHERE dl='$this->iid_dl' \")) === false) {\n $sClauError = 'Delegacion.eliminar';\n $_SESSION['oGestorErrores']->addErrorAppLastError($oDbl, $sClauError, __LINE__, __FILE__);\n return false;\n }\n return true;\n }", "function refuseDix($nombre)\n{\n if ($nombre == 10){\n return 'ko'; // si le nombre est 10, l'exécution de la fonction s'arrête\n }\n return 'ok';\n}", "abstract public function getPasiekimai();", "function motivoDeAnulacionDev(){\n\t\t$sql = \"SELECT * FROM motivo_movimiento WHERE tipo_motivo='ANULACIÓNDV' and status='1'\";\n\t\treturn $this->ejecuta($sql);\n\t}", "public function DBEliminar()\n {\n $oDbl = $this->getoDbl();\n $nom_tabla = $this->getNomTabla();\n if (($oDblSt = $oDbl->exec(\"DELETE FROM $nom_tabla WHERE id_nom=$this->iid_nom AND id_nivel='$this->iid_nivel'\")) === false) {\n $sClauError = 'PersonaNota.eliminar';\n $_SESSION['oGestorErrores']->addErrorAppLastError($oDbl, $sClauError, __LINE__, __FILE__);\n return false;\n }\n return true;\n }", "function palabraDescubierta($coleccionLetras){\n \n /*>>> Completar el cuerpo de la función, respetando lo indicado en la documentacion <<<*/\n}", "function isHidden()\r\n\t{\r\n\t\t$db\t\t\t\t=& JFactory::getDBO();\r\n\t\tif ($db != $this->getDb()) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn parent::isHidden();\r\n\t}", "static function get_dep_habilitada()\n {\n $dni = toba::usuario()->get_parametro(a);\n\n if($dni)\n {\n //--- obtengo la secretaria (estado null por si tiene mas de una entrada en la tabla) ---//\n $sql = \"select n_heredera from public.per_neike where documento = $dni and estado is null\";\n $rs = toba::db()->consultar($sql);\n // '201704030530410'; //-- Mesa de E y S --\n // '201704030534000'; //-- Procuracion --\n\t // '201704030531200'; //-- Gestion --\n /** Obtengo el c01depresu que comienza con 2017 de esa n_heredera, ya q es la q tengo en mi tabla 'dependencias_habilitadas'\n y así poder comparar y determinar a q dependencia pertenece ese empleado **/\n $sql2 = \"select c01depresu from public.scm001_her\n Where n_heredera = '\".$rs[0]['n_heredera'].\"' and c01depresu ilike '20170403%'\";\n $rs2 = toba::db()->consultar($sql2);\n // $rs2[0]['c01depresu'] = '201704030530410';\n /** Busco la posicion 12 en n_heredera q es donde empieza a cambiar la numeracion de una dep a la otra por si el usuario\n se encuentra en una subdependencia, corto ahí la n_heredera y completo con ceros, ya q así está en dep_habilitadas --------*/\n $valor = substr($rs2[0]['c01depresu'],0,12); //-- me devuelve hasta la posicion 12 de la n_heredera --//\n if($valor == '201704030531')\n { //-- se trata de de la dir. de gestion --//\n $rs[0]['n_heredera'] = str_pad(substr($rs2[0]['c01depresu'],0,13),15,'0',STR_PAD_RIGHT);\n }elseif($valor == '201704030534')\n { //-- se trata de de la dir. de procuracion --//\n $rs[0]['n_heredera'] = str_pad(substr($rs2[0]['c01depresu'],0,12),15,'0',STR_PAD_RIGHT);\n }elseif($valor == '201704030530')\n { //-- se trata de del dpto. mesa de e y s, no tiene subdependencias --//\n $rs[0]['n_heredera'] = $rs2[0]['c01depresu'];\n }\n if(((substr($rs2[0]['c01depresu'],0,11)) == '20170403053') AND count($rs2) > 0)\n {\n $sql1 = \"Select id_dep, c01leyen, estado\n From tribunal.dependencias_habilitadas\n Where c01depresu = '\".$rs2[0]['c01depresu'].\"'\";\n $rs1 = toba::db()->consultar($sql1); //-- el resultado es un único registro --//\n\n if(count($rs1) > 0)\n {\n if($rs1[0]['estado'] == 'Activo')\n {\n if($rs1[0]['id_dep'] == 1)\n {\n if(toba::perfil_de_datos()->posee_dimension('gestion','staf') == 1)\n {\n return $rs1[0];\n }\n elseif(toba::perfil_de_datos()->posee_dimension('procuracion','staf') == 1 OR\n toba::perfil_de_datos()->posee_dimension('mesa','staf') == 1)\n { \n throw new toba_error('El Perfil de Datos asignado es incorrecto. Comun&iacute;quese con el administrador. Gracias.');\n }\n }\n elseif($rs1[0]['id_dep'] == 2){\n if(toba::perfil_de_datos()->posee_dimension('gestion','staf') == 1 OR\n toba::perfil_de_datos()->posee_dimension('mesa','staf') == 1)\n {\n throw new toba_error('El Perfil de Datos asignado es incorrecto. Comun&iacute;quese con el administrador. Gracias.');\n }\n elseif(toba::perfil_de_datos()->posee_dimension('procuracion','staf') == 1)\n {\n return $rs1[0];\n }\n }\n elseif($rs1[0]['id_dep'] == 3){\n if(toba::perfil_de_datos()->posee_dimension('gestion','staf') == 1 OR\n toba::perfil_de_datos()->posee_dimension('procuracion','staf') == 1)\n {\n throw new toba_error('El Perfil de Datos asignado es incorrecto. Comun&iacute;quese con el administrador. Gracias.');\n }\n elseif(toba::perfil_de_datos()->posee_dimension('mesa','staf') == 1)\n {\n return $rs1[0];\n }\n }\n }else{\n throw new toba_error('La Dependencia fu&eacute; dada de Baja');\n }\n\n }else{ //-- no pertenece a ninguna de las dep_habilitadas --//\n throw new toba_error('Usuario inv&aacute;lido');\n }\n }else{\n throw new toba_error('Usuario inv&aacute;lido');\n }\n }else{\n throw new toba_error('Solicitar al administrador agregue el par&aacute;metro DNI para poder acceder');\n }\n }", "public function isNotNumbered(){\n return $this->type === self::UP || $this->getFreeSeating();\n }", "private function verrouPoser(){\n\t\t$verrou['etat'] = '';\n\t\tself::verrouSupprimer();\n\t\tif($this->formulaire['cle'] != ''){\n\t\t\t$verrou = self::verrouRechercher();\n\t\t\tif(empty($verrou)){\n\t\t\t\t$verrou = self::verrouInserer();\n\t\t\t\t$verrou['etat'] = 'ok';\n\t\t\t}else{\n\t\t\t\t$verrou['etat'] = 'nok';\n\t\t\t\t$verrou['message'] = \"L'enregistrement \".$verrou['ad_ve_cle'].\" est actuellement verrouillé par \".$verrou['ad_ve_nom'].\" depuis le \".$verrou['ad_ve_date'].\".\\nLes modifications, enregistrement et suppression sont donc impossibles sur cet enregistrement.\";\n\t\t\t}//end if\n\t\t}//end if\n\t\treturn $verrou;\n\t}", "public function voirsolde()\n {\n echo \"le solde du compte est de $this->solde \";\n }", "public function isHidden()\r\n\t{\r\n\t\treturn false;\r\n\t}", "function virustotalscan_deactivate()\r\n{\r\n global $db;\r\n // se sterg setarile din baza de date\r\n $db->query(\"DELETE FROM \".TABLE_PREFIX.\"settinggroups WHERE name = 'virustotalscan_group'\");\r\n \t$db->query(\"DELETE FROM \".TABLE_PREFIX.\"settings WHERE name LIKE 'virustotalscan_setting_%'\");\r\n // se actualizeaza toate setarile\r\n\trebuild_settings();\r\n // daca tabela \"virustotalscan_log\" exista in baza de date atunci se sterge!\r\n\tif ($db->table_exists('virustotalscan_log'))\r\n $db->drop_table('virustotalscan_log');\r\n // se sterge din baza de date stil-urile adaugate\r\n $db->delete_query('templates', 'title = \"virustotalscan_url_css\"'); \r\n}", "public function getDetalle();", "public function imprimeDisponibilidade():string{\n return $retVal = ($this->disponibilidade) ? \"Disponível\" : \"Ocupado\" ;\n }", "public function cantinfce($id_biopsia){\n $stmt=$this->objPDO->prepare(\"SELECT bio.num_biopsia,pac.dni,(pac.nombre||' '||pac.a_paterno||' '||pac.a_materno)as paciente,(((select now()::date - pac.fecha_nacimiento::date)/365)||' '||' años') as edad,\n (case when pac.sexo='1' then 'FEMENINO' when pac.sexo='0' then 'MASCULINO' end) as sexo,('DISTRITO DE '||ub.distrito) as procedencia,dp.dep_descr as servicio,\n bio.diag_inicial as diagnostico,bio.medico_tratante,bio.observacion,(ep.emp_nombres||' '||ep.emp_appaterno||' '||ep.emp_apmaterno) as patologo,ep.emp_colegiatura,\n ((EXTRACT (DAY FROM bio.fecha_biopsia))||'/'||(EXTRACT (MONTH FROM bio.fecha_biopsia))||'/'||(EXTRACT (YEAR FROM bio.fecha_biopsia))) AS fecha_biopsia,\n ((EXTRACT (DAY FROM pq.fecha_informe))||'/'||(EXTRACT (MONTH FROM pq.fecha_informe))||'/'||(EXTRACT (YEAR FROM pq.fecha_informe))) AS fecha_informe\n from sisanatom.biopsia bio inner join sisemer.paciente pac on bio.id_paciente=pac.id_paciente left join sisemer.ubigeo ub on pac.id_ubigeo=ub.id_ubigeo\n inner join dependencias dp ON bio.dep_id=dp.dep_id inner join sisanatom.detalle_bioce pq ON bio.id_biopsia=pq.id_biopsia\n inner join empleados ep ON bio.patologo_responsable=ep.emp_id\n where bio.id_biopsia=:id_biopsia\");\n $stmt->execute(array('id_biopsia'=>$id_biopsia));\n $mydiag=$stmt->rowCount();\n return $mydiag;\n }", "public function partidos_cancha()\n\t{\n\t\tif($this->moguardia->isloged(true) and $torneo > 0)\n\t\t{\n\t\t\t$this->load->view('torneos/partidos_cancha');\n\t\t}\n\t}", "public function boleta()\n\t{\n\t\t//\n\t}", "function bestillingAvBrod($type, $antall, $tidspunkt){\r\n //Kunden får oversikt over alle brøene som er tilgjengelig\r\n\r\n //kunden får oversikt over hvor mange brød man kan bestillinger\r\n\r\n //Kunden velger tidspunkt nå brød skal hentes.\r\n\r\n //Informasjon sendes mot database i tabellen som man trenger.\r\n }", "function ocupa_reserva($id_desig){\n $sql=\"select * from reserva_ocupada_por where id_designacion=\".$id_desig;\n $res= toba::db('designa')->consultar($sql);\n if(count($res)>0){\n return true;\n }else{\n return false;\n }\n }", "public function neVoliPredvidjanje()\n {\n $korisnik= $this->session->get(\"korisnik\");\n $predvidjanjeId= $this->request->uri->getSegment(3); //slobodno promeniti nacin dohvatanja, poenta je da mi treba predvidjanje koje je voljeno\n $voliModel=new VoliModel();\n if ($voliModel->vec_voli($korisnik->IdK, $predvidjanjeId))\n {\n return redirect()->to( $_SERVER['HTTP_REFERER']);\n }\n else\n {\n $predvidjanjeModel=new PredvidjanjeModel();\n $predvidjanjeModel->voli($predvidjanjeId, false);\n $posl_id=$voliModel->poslednji_vestackiId();\n $voliModel->voli($korisnik->IdK, $predvidjanjeId, $posl_id+1);\n }\n return redirect()->to( $_SERVER['HTTP_REFERER']);\n }", "function niveau ($niveauCode, $niveauTexte)\n{\n if ($niveauCode = 1){\n \n }\n \n }", "function acesso_negado() {\n\t\t$this->output->set_template(\"blank\");\n $this->load->view('erros/acesso_negado');\n }", "public function toggleDisponibilidade():bool{\n $this->disponibilidade = ($this->disponibilidade) ? FALSE : TRUE ;\n return $this->disponibilidade;\n }", "function wiki_shown_hidden($post){\n\t\t\n\t\t$status = get_post_meta($post->ID,'wiki-contributons-status',true);\n\t\t\n\t?>\t\n\t\tTo hide the table check the box &nbsp;\n\t\t\n\t\t<input type=\"checkbox\" value=\"hide\" name=\"wiki-tabel-shownorhide\" <?php checked('hide',$status); ?> /> \n\t\n\t<?php\t\n\t}", "public function isHidden()\r\n {\r\n return false;\r\n }", "public function isHidden()\r\n {\r\n return false;\r\n }", "public function isHidden()\r\n {\r\n return false;\r\n }", "public function isHidden(): bool\n {\n return false;\n }", "public function mort()\n\t{\n\t\tif ( $this->vie <= 0 ) {\n\t\t\techo $this->nom . \" est mort <br>\";\n\t\t} else {\n\t\t\techo $this->nom . \" est vivant ! <br>\";\n\t\t}\n\t}", "private function negarDetalleSolicitud()\r\n {\r\n $result = false;\r\n $modelInscripcion = self::findInscripcionSucursal();\r\n if ( $modelInscripcion !== null ) {\r\n if ( $modelInscripcion['id_contribuyente'] == $this->_model->id_contribuyente ) {\r\n $result = self::updateSolicitudInscripcion($modelInscripcion);\r\n } else {\r\n self::setErrors(Yii::t('backend', 'Error in the ID of taxpayer'));\r\n }\r\n }\r\n\r\n return $result;\r\n }", "public function extra_voor_verp()\n\t{\n\t}", "private function eliminarCita(){\n $query = \"UPDATE \" . $this->table . \" SET estado = 'Inactivo' WHERE CitaId = '\" . $this->idcita . \"'\";\n $resp = parent::nonQuery($query);\n if($resp >= 1 ){\n return $resp;\n }else{\n return 0;\n }\n }", "public static function vice_datovych_schranek()\n {\n return Settings::get('isds_allow_more_boxes', false);\n }", "public function getDirectriz()\n {\n $dir = false;\n if (self::getCod() === '110000') $dir='Enseñanzas Técnicas';\n if (self::getCod() === '120000') $dir='Enseñanzas Técnicas';\n if (self::getCod() === '210000') $dir='Enseñanzas Técnicas';\n if (self::getCod() === '220000') $dir='Ciencias Experimentales';\n if (self::getCod() === '230000') $dir='Ciencias Experimentales';\n if (self::getCod() === '240000') $dir='Ciencias de la Salud';\n if (self::getCod() === '250000') $dir='Ciencias Experimentales';\n if (self::getCod() === '310000') $dir='Ciencias Experimentales';\n if (self::getCod() === '320000') $dir='Ciencias de la Salud';\n if (self::getCod() === '330000') $dir='Enseñanzas Técnicas';\n if (self::getCod() === '510000') $dir='Ciencias Sociales y Jurídicas';\n if (self::getCod() === '520000') $dir='Ciencias Sociales y Jurídicas';\n if (self::getCod() === '530000') $dir='Ciencias Sociales y Jurídicas';\n if (self::getCod() === '540000') $dir='Ciencias Sociales y Jurídicas';\n if (self::getCod() === '550000') $dir='Humanidades';\n if (self::getCod() === '560000') $dir='Ciencias Sociales y Jurídicas';\n if (self::getCod() === '570000') $dir='Humanidades';\n if (self::getCod() === '580000') $dir='Humanidades';\n if (self::getCod() === '590000') $dir='Ciencias Sociales y Jurídicas';\n if (self::getCod() === '610000') $dir='Ciencias de la Salud';\n if (self::getCod() === '620000') $dir='Humanidades';\n if (self::getCod() === '630000') $dir='Ciencias Sociales y Jurídicas';\n if (self::getCod() === '710000') $dir='Humanidades';\n if (self::getCod() === '720000') $dir='Humanidades';\n return $dir;\n }", "public function tratarDados(){\r\n\t\r\n\t\r\n }", "function provera($broj) {\r\n if ($broj <= 1) {\r\n throw new Exception(\"Broj mora biti veci od 1\");\r\n }\r\n}", "public function getNoViewFlag() {}", "function ler($nome) {\n $x = 1;\n\t while($x < $this->bd[0][0] && !$this->str_igual($nome, $this->bd[$x][2])) {$x++;}\n if($x >= $this->bd[0][0]) {return 0;}\n //comecando a setar tudo\n $this->id = $this->bd[$x][0];\n $this->maximo = $this->bd[$x][1];\n $this->nome = $this->bd[$x][2];\n $this->categoria = $this->bd[$x][3];\n $this->tipo = $this->bd[$x][4];\n $this->atributo = $this->bd[$x][5];\n $this->specie = $this->bd[$x][6];\n $this->lv = $this->bd[$x][7];\n $this->atk = $this->bd[$x][8];\n $this->def = $this->bd[$x][9];\n $this->preco = $this->bd[$x][10];\n $this->descricao = $this->bd[$x][11];\n $this->img = '../imgs/cards/'.$this->id.'.png';\nreturn 1;\n }", "public function CambiarLikeDislike()\n\t{\n\t\t$this->que_bda = \"UPDATE like_comentario SET\n\t\t\t\t\t\t\t\t\t\t\t\ttip_lik_vid = 'D'\n\t\t\t\t\t\t\t\t\t\t\tWHERE \n\t\t\t\t\t\t\t\t\t\t\t\tcod_lik_vid = '$this->cod_lik_vid';\";\n\t\t// echo json_encode($this->que_bda);\n\t\treturn $this->run();\n\t}", "function affiche_dossier($cnx, $T, $formulaire=TRUE, $selectionneur=TRUE, $modification=FALSE, $boutons=FALSE)\n{\n\t// pour éviter plusieurs jointures supplémentaires pour l'affichage des pays d'un dossier\n\t// et pour tenir compte du fait que ces pays ne sont pas toujours renseignés\n\t$statiquePays = statiquePays($cnx) ;\n\n\twhile ( list($key, $val) = each($T) ) {\n\t\t$T[$key] = sans_balise($val) ;\n\t}\n\n\tglobal $SECTION_CANDIDATURE ;\n\tglobal $ETAT_DOSSIER_IMG_CLASS;\n\tglobal $ETAT_DOSSIER;\n\tglobal $SITUATION ;\n\tglobal $IDENTITE ;\n\n\n\tif ( isset($_SESSION[\"authentification\"]) AND ($_SESSION[\"authentification\"] == \"oui\") )\n\t{\n\t\techo \"<div style='float: left; width: 50%;'>\\n\" ;\n\t\techo \"<div class='apercu'>\\n\" ;\n\t}\n\techo \"<div class='dossier_candidature'>\\n\" ;\n\t\n\techo \"<h1>\" ;\n\techo \"<span style='font-size: smaller;'>\" ;\n\tif ( $T[\"genre\"] == \"Homme\" ) {\n\t\techo \"Monsieur\" ;\n\t}\n\telse if ( $T[\"genre\"] == \"Femme\" ) {\n\t\techo \"Madame\" ;\n\t}\n\techo \"</span> \" ;\n\techo \" <span class='majuscules'><em>\" ;\n\techo strtoupper($T[\"nom\"]) ;\n\techo \"</em></span> \" ;\n\techo ucwords(strtolower($T[\"prenom\"])) ;\n\techo \"</h1>\\n\" ;\n\n\n\n//\techo \"<div style='float:right'>\\n\" ;\n\n\t/*\n\tif ( $selectionneur ) {\n\t\techo \"<tr>\\n\" ;\n\t\techo \"<th><span class='chp'>&Eacute;tat du dossier&nbsp;:</span></th>\\n\" ;\n\t\techo \"<td><span class='\".$etat_dossier_img_class[$T[\"etat_dossier\"]].\"'>\" ;\n\t\techo \"<strong>\".$T[\"etat_dossier\"].\"</strong>\" ;\n\t\tif ( ($T[\"etat_dossier\"]==\"En attente\") AND ($T[\"classement\"]!=\"\") ) {\n\t\t\techo \" (<strong>\".$T[\"classement\"].\"</strong>)\" ;\n\t\t}\n\t\techo \"</span>\" ;\n\t\t// Imputation\n\t\tif ( isset($T[\"id_imputation1\"]) AND ($T[\"id_imputation1\"] != \"\") ) {\n\t\t\techo \" <strong class='paye'>\".LABEL_INSCRIT.\"</strong>\" ;\n\t\t}\n\t\tif ( isset($T[\"diplome\"]) AND ($T[\"diplome\"] == \"Oui\") ) {\n\t\t\techo \" <span class='diplome'>\".LABEL_DIPLOME.\" \".$T[\"anneed\"].\"</span>\" ;\n\t\t}\n\t\techo \"</td>\\n\" ;\n\t\techo \"</tr>\\n\" ;\n\t}\n\t*/\n\n\t// Lors du premier enregistrement du formulaire, la date d'inscription n'est pas affichée\n\t// mais elle est bien enregistrée.\n\t// Une requete pour l'afficher serait superflue.\n\tif ( isset($T[\"date_inscrip\"]) )\n\t{\n\t\techo \"<table class='donnees' style='margin: 0;'>\\n\" ;\n\t\techo \"<tr>\\n\" ;\n\t\techo \"<th><span class='chp'>Pré-inscription&nbsp;:</span></th>\\n\" ;\n\t\techo \"<td> <span class='s'>le</span> \".mysql2date($T[\"date_inscrip\"]) ;\n\t\tif ( $T[\"date_inscrip\"] != $T[\"date_maj\"] ) {\n\t\t\techo \", <span class='s'>mise à jour le</span> \".mysql2date($T[\"date_maj\"]) ;\n\t\t}\n\t\techo \"</td>\\n\" ;\n\t\techo \"</tr>\\n\" ;\n\n\t\tif ( isset($_SESSION[\"authentification\"]) AND ($_SESSION[\"authentification\"] == \"oui\") )\n\t\t{\n\t\t\tif ( isset($T[\"id_imputation\"]) AND ($T[\"id_imputation\"] != \"\") ) {\n\t\t\t\techo \"<tr>\\n\" ;\n\t\t\t\techo \"<th><span class='chp'>Inscription&nbsp;:</span></th>\\n\" ;\n\t\t\t\techo \"<td> <span class='s'>le</span> \".mysql2date($T[\"date_imput\"]) ;\n\t\t\t\tif ( $T[\"date_imput\"] != $T[\"date_maj_imput\"] ) {\n\t\t\t\t\techo \", <span class='s'>mise à jour le</span> \".mysql2date($T[\"date_maj_imput\"]) ;\n\t\t\t\t}\n\t\t\t\techo \" - <strong class='paye'>\".LABEL_INSCRIT.\"</strong>\" ;\n\t\t\t\tif ( $T[\"etat_dossier\"] != \"0\" ) {\n\t\t\t\t\techo \" - \" ;\n\t\t\t\t\techo \"<span class='\".$ETAT_DOSSIER_IMG_CLASS[$T[\"etat_dossier\"]].\"'>\" ;\n\t\t\t\t\techo $ETAT_DOSSIER[$T[\"etat_dossier\"]] .\"</span>\" ;\n\t\t\t\t}\n\t\t\t\techo \"</td>\\n\" ;\n\t\t\t\techo \"</tr>\\n\" ;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif ( $T[\"date_imput\"] != \"\" ) {\n\t\t\t\techo \"<tr>\\n\" ;\n\t\t\t\techo \"<th><span class='chp'>Inscription&nbsp;:</span></th>\\n\" ;\n\t\t\t\techo \"<td> <span class='s'>le</span> \".mysql2date($T[\"date_imput\"]) ;\n\t\t\t\techo \"</td>\\n\" ;\n\t\t\t\techo \"</tr>\\n\" ;\n\t\t\t}\n\t\t}\n\t\t?></table><?php\n\t}\n\n\n\tif ( $T[\"idmooc\"] == \"1\" )\n\t{\n\t\techo \"<h2>\".$SECTION_CANDIDATURE[\"1\"].\"</h2>\\n\" ;\n\t\t?><table class='donnees'><?php\n\t\taffiche_tr(\"id_mooc\", $T) ;\n\t\t?></table><?php\n\t}\n\t\n\t\n\techo \"<h2>\".$SECTION_CANDIDATURE[\"2\"].\"</h2>\\n\" ;\n\t// Traitement de la date de naissance en cas d'affichage à partir d'un POST\n\tif ( isset($T[\"naissance\"]) AND ($T[\"naissance\"] != \"\") ) {\n\t\t$tab[\"naissance\"] = mysql2datealpha($T[\"naissance\"]) ;\n\t}\n\telse {\n\t\t$tab[\"naissance\"] = mysql2datealpha($T[\"annee_n\"] .\"-\". $T[\"mois_n\"] .\"-\". $T[\"jour_n\"]) ;\n\t}\n\t// id_mooc et informations personnelles\n\tif ( $boutons ) {\n\t\techo \"<div style='float: right;'><strong>\" ;\n\t\techo \"<input class='b' type='submit' name='submit' value='Envoyer un courriel' \" ;\n\t\techo \"title='Envoyer un (nouveau) courriel contenant\nvotre numéro de dossier et votre mot de passe\nà \".$T[\"email\"].\"' \" ;\n\t\techo \"style='cursor: help;' />\";\n\t\techo \"</strong></div>\" ;\n\t}\n\t?><table class='donnees'><?php\n\techo \"<tr>\\n\\t<th><span class='chp'>\" . intitule_champ(\"email\") . \"&nbsp;:</span></th>\\n \" ;\n\t\techo \"\\t<td>\" ;\n\t\techo \"<strong><a href='mailto:\".$T[\"email\"].\"'>\".$T[\"email\"].\"</a></strong>\" ;\n\t\techo \"</td>\\n</tr>\\n\" ;\n\taffiche_tr(\"naissance\", $tab, TRUE) ;\n\taffiche_tr(\"lieu_naissance\", $T, TRUE) ;\n\techo \"<tr>\\n\\t<th><span class='chp'>\" . intitule_champ(\"pays_naissance\") . \"&nbsp;:</span></th>\\n \" ;\n\t\techo \"\\t<td>\" . refPays($T[\"pays_naissance\"], $statiquePays) . \"</td>\\n</tr>\\n\" ;\n\techo \"<tr>\\n\\t<th><span class='chp'>\" . intitule_champ(\"pays_nationalite\") . \"&nbsp;:</span></th>\\n \" ;\n\t\techo \"\\t<td>\" . refPays($T[\"pays_nationalite\"], $statiquePays) . \"</td>\\n</tr>\\n\" ;\n\techo \"<tr>\\n\\t<th><span class='chp'>\" . intitule_champ(\"pays_residence\") . \"&nbsp;:</span></th>\\n \" ;\n\t\techo \"\\t<td>\" . refPays($T[\"pays_residence\"], $statiquePays) . \"</td>\\n</tr>\\n\" ;\n\techo \"<tr>\\n\\t<th><span class='chp'>\" . intitule_champ(\"situation_actu\") . \"&nbsp;:</span></th>\\n \" ;\n\t\techo \"\\t<td>\" . $SITUATION[$T[\"situation_actu\"]] ;\n\t\tif ( $T[\"sit_autre\"] != \"\" ) {\n\t\t\techo \"<br />\" . $T[\"sit_autre\"] ;\n\t\t}\n\t\techo \"</td>\\n</tr>\\n\" ;\n\t?></table><?php\n\t\n\tif ( $T[\"identite\"] == \"1\" )\n\t{\n\t\techo \"<h2>\".$SECTION_CANDIDATURE[\"3\"].\"</h2>\\n\" ;\n\t\tif ( isset($T[\"ident_date\"]) AND ($T[\"ident_date\"] != \"\") ) {\n\t\t\t$tab[\"ident_date\"] = mysql2datealpha($T[\"ident_date\"]) ;\n\t\t}\n\t\telse {\n\t\t\t$tab[\"ident_date\"] = mysql2datealpha($T[\"annee_ident\"] .\"-\". $T[\"mois_ident\"] .\"-\". $T[\"jour_ident\"]) ;\n\t\t}\n\t\t?><table class='donnees'><?php\n\t\techo \"<tr>\\n\\t<th><span class='chp'>\" . intitule_champ(\"ident_nature\") . \"&nbsp;:</span></th>\\n \" ;\n\t\t\techo \"\\t<td>\" . $IDENTITE[$T[\"ident_nature\"]] ;\n\t\t\tif ( $T[\"ident_autre\"] != \"\" ) {\n\t\t\t\techo \"<br />\" . $T[\"ident_autre\"] ;\n\t\t\t}\n\t\t\techo \"</td>\\n</tr>\\n\" ;\n\t\taffiche_tr(\"ident_numero\", $T) ;\n\t\taffiche_tr(\"ident_date\", $tab) ;\n\t\taffiche_tr(\"ident_lieu\", $T) ;\n\t\t?></table><?php\n\t}\n\t\n\t/*\n\tinclude(\"../candidature/questions.php\") ;\n\tif ( $nombre_questions > 0 )\n\t{\n\t\techo \"<h2>\".$SECTION_CANDIDATURE[\"9\"].\"</h2>\\n\" ;\n\n\t\t$req = \"SELECT * FROM reponse WHERE id_dossier=\".$T[\"id_dossier\"].\"\n\t\t\tORDER BY id_question\" ;\n\t\n\t\t//echo $req ;\n\t\t$res = mysqli_query($cnx, $req) ;\n\t\n\t\t$i = 1 ;\n\t\tforeach($Questions as $question)\n\t\t{\n\t\t\t$ligne = mysqli_fetch_assoc($res) ;\n\t\t\techo \"<p><span class='chp'>\" ;\n\t\t\techo $question[\"texte_quest\"] ;\n\t\t\techo \"</span><br />\" ;\n\t\t\techo nl2br($ligne[\"texte_rep\"]) ;\n\t\t\techo \"</p>\\n\" ;\n\t\t}\n\t}\n\t*/\n\t\n\tif ( $T[\"pj\"] == \"1\" )\n\t{\n\t\techo \"<h2>\".$SECTION_CANDIDATURE[\"fichiers\"].\"</h2>\\n\" ;\n\t\n\t\tif ( $boutons)\n\t\t{\n\t\t\techo \"<div style='float: right'>\" ;\n\t\t\techo \"<strong><input class='b' type='submit' name='submit' value='Joindre un fichier' /></strong>\" ;\n\t\t\techo \"</div>\\n\" ;\n\t\t}\n\n\n\t\techo \"<div id='pj'>\\n\" ;\n\t\t$req = \"SELECT * FROM pj WHERE ref_dossier=\".$T[\"id_dossier\"] ;\n\t\t$res = mysqli_query($cnx, $req) ;\n\t\tif ( @mysqli_num_rows($res) == 0 ) {\n\t\t\techo \"<p>Aucun fichier.</p>\\n\" ;\n\t\t}\n\t\telse {\n\t\t\twhile ( $row=mysqli_fetch_assoc($res) )\n\t\t\t{\n\t\t\t\tif ( $row[\"poubelle\"] == 0 )\n\t\t\t\t{\n\t\t\t\t\tif ( ($row[\"mime\"] == \"image/jpeg\") OR ($row[\"mime\"] == \"image/png\") )\n\t\t\t\t\t{\n\t\t\t\t\t\t$blank = \"target='_blank'\" ;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t$blank = \"\" ;\n\t\t\t\t\t}\n\n\t\t\t\t\techo \"<div class='pj'>\" ;\n\t\t\t\t\t$url_image = \"/inscription/pj.php?id_pj=\".$row[\"id_pj\"]\n\t\t\t\t\t\t. \"&ref_dossier=\".$row[\"ref_dossier\"]\n\t\t\t\t\t\t. \"&fichier=\".urlencode($row[\"fichier\"]) ;\n\t\t\t\t\t$url_vignette = $url_image . \"&taille=vignette\" ;\n\t\t\t\t\t$url_voir = $url_image . \"&action=voir\" ;\n\n\t\t\t\t\tif ( ($row[\"mime\"] == \"image/jpeg\") OR ($row[\"mime\"] == \"image/png\") )\n\t\t\t\t\t{\n\t\t\t\t\t\techo \"<span class='vignette'>\" ;\n\t\t\t\t\t\t// L'inscrit dans son formulaire\n\t\t\t\t\t\tif ( $_SERVER[\"PHP_SELF\"] == \"/inscription/inscription.php\" ) {\n\t\t\t\t\t\t\techo \"<a title='Voir dans un nouvel onglet ou une nouvelle fenêtre' $blank href='\".$url_voir.\"'>\" ;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\techo \"<a class='box' title='Voir' data-pb-captionLink='\".$row[\"fichier\"].\"' href='\".$url_image.\"'>\" ;\n\t\t\t\t\t\t}\n\t\t\t\t\t\techo \"<img src='$url_vignette' alt='\".$row[\"fichier\"].\"' /></a>\\n\" ;\n\t\t\t\t\t\techo \"</span>\" ;\n\t\t\t\t\t}\n\n\t\t\t\t\techo \"<a title='Télécharger' href='$url_image'>\" ;\n\t\t\t\t\techo $row[\"fichier\"] ;\n\t\t\t\t\techo \"</a>\" ;\n\t\t\t\t\tif ( ($row[\"mime\"] == \"image/jpeg\") OR ($row[\"mime\"] == \"image/png\") )\n\t\t\t\t\t{\n\t\t\t\t\t\tif ( $boutons ) {\n\t\t\t\t\t\t\techo \" <input type='submit' name='\".$row[\"id_pj\"].\"' \" ;\n\t\t\t\t\t\t\techo \"value='Supprimer ce fichier' />\" ;\n\t\t\t\t\t\t}\n\t\t\t\t\t\techo \"<br />\" ;\n\t\t\t\t\t\techo intval($row[\"taille\"]/1024.0).\" <acronym title='kilo-octets'>ko</acronym> - \" ;\n\t\t\t\t\t\techo \"<span class='s'>\".$row[\"largeur\"].\"&times;\".$row[\"hauteur\"].\" <acronym title='pixels'>px</acronym></span>\" ;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\techo \" &nbsp; \" ;\n\t\t\t\t\t\techo intval($row[\"taille\"]/1024.0).\" <acronym title='kilo-octets'>ko</acronym>\" ;\n\t\t\t\t\t\tif ( $boutons ) {\n\t\t\t\t\t\t\techo \" <input type='submit' name='\".$row[\"id_pj\"].\"' \" ;\n\t\t\t\t\t\t\techo \"value='Supprimer ce fichier' />\" ;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\techo \"</div>\\n\" ;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\techo \"<div class='pj'>\" ;\n\t\t\t\t\techo $row[\"fichier\"] ;\n\t\t\t\t\techo \", \". intval($row[\"taille\"]/1024.0).\"ko (\".$row[\"largeur\"].\"&times;\".$row[\"hauteur\"].\")\" ;\n\t\t\t\t\techo \" <small><i>(supprimé)</i></small>\" ;\n\t\t\t\t\techo \"</div>\\n\" ;\n\t\t\t\t}\n\t\t\t}\n\t\t\techo \"<div style='clear: both;'></div>\\n\" ;\n\t\t}\n\t\techo \"</div>\\n\\n\\n\" ;\n\t}\n\n\techo \"<h2>\".$SECTION_CANDIDATURE[\"4\"].\"</h2>\\n\" ;\n\techo \"<p class='signature'>Je soussigné\" ;\n\tif ( $T[\"genre\"] == \"Femme\" ) {\n\t\techo \"e\" ;\n\t}\n\techo \" \" . $T[\"signature\"] . \"&nbsp;:</p>\" ;\n\techo \"<ul class='signature'>\\n\" ;\n\tif ( $T[\"certifie\"] == \"1\" ) {\n\t\techo \"<li>certifie sur l'honneur l'exactitude des informations ci-dessus,</li>\\n\" ;\n\t}\n\tif ( $T[\"accepte\"] == \"1\" ) {\n\t\techo \"<li>accepte les <a class='extern' target='_blank' href='/conditions.php'>conditions générales</a>.</li>\\n\" ;\n\t}\n\techo \"</ul>\\n\" ;\n\n\techo \"</div>\\n\" ;\n\tif ( isset($_SESSION[\"authentification\"]) AND ($_SESSION[\"authentification\"] == \"oui\") )\n\t{\n\t\techo \"</div>\\n\" ;\n\t\techo \"</div>\\n\\n\\n\" ;\n\t}\n\n\tif\t(\n\t\t\tisset($_SESSION[\"authentification\"]) AND ($_SESSION[\"authentification\"] == \"oui\")\n\t\t)\n\t{\n\t\techo \"<div style='float: right; width: 49%;'>\\n\" ;\n\n\t\techo \"<div class='encart'>\\n\" ;\n\t\trecherche_idem($cnx, $T[\"id_dossier\"], $T[\"email\"]) ;\n\t\techo \"</div>\\n\" ;\n\n\t\t//echo \"<div class='encart'>\\n\" ;\n\t\trequire_once(\"inc_historique.php\") ;\n\t\techo historiqueShow($cnx, $T[\"id_dossier\"]) ;\n\t\t//echo \"</div>\\n\" ;\n\n\t\techo \"</div>\\n\" ;\n\t}\n\n\n}", "public function isModerador(){ return false; }", "private function descubrirCerosAdyacentes($i, $j)\r\n {\r\n if ($this->matrizVisible[$i][$j] == 0 && $this->tablero->getValMatriz($i, $j) == 0) {\r\n if ($this->matrizVisible[$i][$j] == 2)\r\n --$this->minasMarcadas;\r\n $this->matrizVisible[$i][$j] = 1;\r\n ++$this->casillasDescubiertas;\r\n --$i;\r\n if ($i >= 0) //revisando hacia arriba\r\n {\r\n if ($j - 1 >= 0 && $this->tablero->getValMatriz($i, $j - 1) == 0) // arriba y a la izquierda\r\n $this->descubrirCerosAdyacentes($i, $j - 1);\r\n if ($this->tablero->getValMatriz($i, $j) == 0) //arriba\r\n $this->descubrirCerosAdyacentes($i, $j);\r\n if ($j + 1 < $this->N && $this->tablero->getValMatriz($i, $j + 1) == 0) // arriba y a la derecha\r\n $this->descubrirCerosAdyacentes($i, $j + 1);\r\n }\r\n ++$i;\r\n if ($j - 1 >= 0 && $this->tablero->getValMatriz($i, $j - 1) == 0) //revisando hacia izquierda\r\n $this->descubrirCerosAdyacentes($i, $j - 1);\r\n if ($j + 1 < $this->N && $this->tablero->getValMatriz($i, $j + 1) == 0) //revisando hacia izquierda\r\n $this->descubrirCerosAdyacentes($i, $j + 1);\r\n ++$i;\r\n if ($i < $this->N) //revisando hacia abajo\r\n {\r\n if ($j - 1 >= 0 && $this->tablero->getValMatriz($i, $j - 1) == 0) // abajo y a la izquierda\r\n $this->descubrirCerosAdyacentes($i, $j - 1);\r\n if ($this->tablero->getValMatriz($i, $j) == 0) // abajo\r\n $this->descubrirCerosAdyacentes($i, $j);\r\n if ($j + 1 < $this->N && $this->tablero->getValMatriz($i, $j + 1) == 0) // abajo y a la derecha\r\n $this->descubrirCerosAdyacentes($i, $j + 1);\r\n }\r\n } //if\r\n }", "function no_acta_inicio(){\n $sql = \n \"SELECT\n c.Numero,\n c.Objeto,\n t.Nombre AS Contratista,\n c.Fecha_Inicial,\n c.Fecha_Vencimiento,\n c.Valor_Inicial,\n e.Estado \n FROM\n contratos AS c\n INNER JOIN tbl_terceros AS t ON c.Fk_Id_Terceros = t.Pk_Id_Terceros\n INNER JOIN tbl_estados AS e ON c.Fk_Id_Estado = e.Pk_Id_Estado \n WHERE\n c.Acta_Inicio IS FALSE \n AND e.Pk_Id_Estado <> 2 \n AND c.Fk_Id_Proyecto = {$this->session->userdata('Fk_Id_Proyecto')}\n ORDER BY\n Numero ASC\";\n \n //Se retorna la consulta\n return $this->db->query($sql)->result();\n }", "function vendndodhja( $nd = ' / ' ){\r\n \t\r\n \tglobal $faqet;\r\n \t\r\n \t$ndarje = ' ' .$nd .' ';\r\n \t\r\n \t$page = isset( $_GET['faqja'] ) ? $_GET['faqja'] : 'home';\r\n \t\r\n \tswitch($page) {\r\n \t\t\r\n \t\tcase 'home' :\r\n \t\t\t$vendi = 'Home';\r\n \t\tbreak;\r\n \t\t\r\n \t\tcase 'contact' :\r\n \t\t\t$vendi = 'Contact';\r\n \t\tbreak;\r\n \t\t\r\n \t\tcase 'about':\r\n \t\t\t$vendi = 'About';\r\n \t\tbreak;\r\n \r\n \t\tcase 'service':\r\n \t\t\t$vendi = 'Service';\r\n \t\tbreak;\r\n \t\t\r\n \t\tcase 'product':\r\n \t\t\t$vendi = 'Product';\r\n \t\tbreak;\r\n \t\t\r\n \t\tcase 'login':\t\r\n\t\t\t$vendi = 'Hyr ne Panel';\r\n\t\tbreak;\r\n \t\t\r\n \t\tcase 'admin': \t\r\n \t\t\t$vendi = 'Paneli i Administrimit';\r\n \t\tbreak;\r\n \t\t\r\n \t\tdefault:\r\n \t\t\t$vendi = 'Nuk Gjendet';\r\n \t\tbreak;\r\n \t\t\r\n \t\t}\r\n \t\t\r\n \t\tif( $page == 'home' ){\r\n \t\t\t\r\n \t\t\techo 'Home';\r\n \t\t\t\r\n \t\t} else {\r\n \t\t\r\n \t\t\techo '<a href= \"http://localhost/banago/\">Home</a>' . $ndarje . $vendi ;\r\n\t\t} \r\n \t}", "function AfficheBatiment(batiment &$batiment, personnage &$oJoueur = NULL, maison &$oMaison = NULL){\r\n\t$ImgSize = 'height';\r\n\t$txt = NULL;\r\n\r\n\t$contenu = 'Ne peut rien contenir';\r\n\t\r\n\t$chkPositionJoueur = false;\r\n\t$nbLigne = 3;\r\n\t\r\n\tif(!is_null($oJoueur)){\t\r\n\t\t$chkPositionJoueur\t\t= $oJoueur->GetCoordonnee() == $batiment->GetCoordonnee();\r\n\t}\r\n\t\r\n\t$chkMarche = false;\r\n\t\r\n\t$lstBatimentAvecEsclaves = array(ferme::ID_BATIMENT, potager::ID_BATIMENT, mine::ID_BATIMENT, carriere::ID_BATIMENT, scierie::ID_BATIMENT);\r\n\r\n\tswitch($batiment->GetIDType()){\r\n\t\tcase maison::ID_BATIMENT:\r\n\t\t\t$ImgSize = 'width';\r\n\t\t\tif($chkPositionJoueur){\r\n\t\t\t\t$contenu = '<p>Ne peut rien contenir.</p>';\r\n\t\t\t\t$chkOptions = false;\r\n\t\t\t}else{\r\n\t\t\t\t$contenu = '<p>Si ici que vous devez vous placer pour vous inscrire ou valider une quête.</p>';\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t/* case 'bank':\r\n\t\t\t$contenu = $batiment->AfficheContenu($oJoueur);\r\n\t\t\tbreak; */\r\n\t\tcase scierie::ID_BATIMENT:\r\n\t\tcase ferme::ID_BATIMENT:\r\n\t\tcase mine::ID_BATIMENT :\r\n\t\tcase potager::ID_BATIMENT:\r\n\t\tcase carriere::ID_BATIMENT:\r\n\t\t\t$ImgSize = 'width';\r\n\t\t\tif(!is_null($oJoueur)){\t$contenu = $batiment->AfficheContenu($oJoueur);}\r\n\t\t\tbreak;\r\n\t\tcase marche::ID_BATIMENT:\r\n\t\t\tif($chkPositionJoueur){\r\n\t\t\t\t$chkMarche = true;\r\n\t\t\t}else{\r\n\t\t\t\t$contenu = '<p>Vous devez vous placez sur son emplacement pour afficher les transactions disponibles.</p>';\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n\tif(in_array($batiment->GetIDType(), $lstBatimentAvecEsclaves))\r\n\t{\r\n\t\t$arLignes[3] = '\r\n\t\t\t<tr>\r\n\t\t\t\t<td>'\r\n\t\t.(!is_null($oJoueur)?\r\n\t\t$batiment->AfficheAchatEsclave($oJoueur)\r\n\t\t:'Possibilité d\\'acheter des esclaves pour augmenter sa production')\r\n\t\t.'</td>\r\n\t\t\t</tr>';\r\n\t\t$nbLigne++;\r\n\t}\r\n\t\r\n\tif(!is_null($oJoueur))\r\n\t{\r\n\t\t$arLignes[2] = '\r\n\t\t\t<tr><td>'.$batiment->AfficheOptionAmeliorer($oJoueur, $oMaison).'</td></tr>';\r\n\t\t$arLignes[4] = '\r\n\t\t\t<tr>\r\n\t\t\t\t<td>'\r\n\t\t\t\t\t.'<img alt=\"Barre status\" src=\"./fct/fct_image.php?type=statusetat&amp;value='.$batiment->GetEtat().'&amp;max='.$batiment->GetEtatMax().'\" />'\r\n\t\t\t\t\t.'<br />'\r\n\t\t\t\t\t.$batiment->AfficheOptionReparer($oJoueur)\r\n\t\t\t\t.'</td>\r\n\t\t\t</tr>';\r\n\t\t$arLignes[7] = '\r\n\t\t\t<tr><td>'.$contenu.'</td></tr>';\r\n\t\r\n\t\t$nbLigne+=3;\r\n\t\t\r\n\t\tif($batiment->GetIDType() == marche::ID_BATIMENT)\r\n\t\t{\r\n\t\t\t$arLignes[8] = '\r\n\t\t\t<tr><td>'.$batiment->AfficheTransactions($oJoueur).'</td></tr>';\r\n\t\t\t\r\n\t\t\t$nbLigne++;\r\n\t\t}\r\n\t}\r\n\t\r\n\t$arLignes[5] = '\r\n\t\t\t<tr>\r\n\t\t\t\t<td>\r\n\t\t\t\t\t<ul style=\"list-style-type:none; padding:0px; text-align:center; margin:0px;\">\r\n\t\t\t\t\t\t<li style=\"display:inline;\">'.AfficheIcone(objArmement::TYPE_ATTAQUE).' : '.(is_null($batiment->GetAttaque())?'0':$batiment->GetAttaque()).'</li>\r\n\t\t\t\t\t\t<li style=\"display:inline; margin-left:40px;\">'.AfficheIcone(objArmement::TYPE_DISTANCE).' : '.(is_null($batiment->GetDistance())?'0':$batiment->GetDistance())\t.'</li>\r\n\t\t\t\t\t\t<li style=\"display:inline; margin-left:40px;\">'.AfficheIcone(objArmement::TYPE_DEFENSE).' : '.(is_null($batiment->GetDefense())?'0':$batiment->GetDefense()).'</li>\r\n\t\t\t\t\t</ul>\r\n\t\t\t\t</td>\r\n\t\t\t</tr>';\r\n\t$arLignes[6] = '\r\n\t\t\t<tr><td>'.$batiment->GetDescription().'</td></tr>';\r\n\t$arLignes[1] = '\r\n\t\t\t<tr>\r\n\t\t\t\t<td rowspan=\"'.$nbLigne.'\" style=\"width:400px;\">\r\n\t\t\t\t\t<img alt=\"'.$batiment->GetType().'\" src=\"./img/batiments/'.$batiment->GetType().'.png\" width=\"400px\" onmouseover=\"montre(\\''.CorrectDataInfoBulle($batiment->GetDescription()).'\\');\" onmouseout=\"cache();\"/>\r\n\t\t\t\t</td>\r\n\t\t\t\t<th>'\r\n\t\t\t\t\t.(!is_null($oJoueur)?\r\n\t\t\t\t\t\t'<a name=\"'.str_replace(',', '_', $batiment->GetCoordonnee()).'\">'\r\n\t\t\t\t\t\t:NULL)\r\n\t\t\t\t\t.$batiment->GetNom((!is_null($oJoueur)?$oJoueur->GetCivilisation():personnage::CIVILISATION_GAULOIS)).(!is_null($oJoueur)?' ('.$batiment->GetNiveau().' / '.$batiment->GetNiveauMax().')':NULL)\r\n\t\t\t\t\t.(!is_null($oJoueur)?\r\n\t\t\t\t\t\t'</a>'\r\n\t\t\t\t\t\t:NULL)\r\n\t\t\t\t.'</th>\r\n\t\t\t</tr>';\r\n\t\r\n\t//on trie par keys\r\n\tksort($arLignes);\r\n\t\r\n\treturn implode('', $arLignes);\r\n}", "public function videoconferenciaNoInterrumpirOFF( ) {\n $this->setNoInterrumpir(\"ON\");\n// $this->setNoInterrumpir(\"AUTOANSWER\");\n }", "function dodajKorisnika(Korisnik $k);", "public function attaqueJoueur($de){\n\n }", "public function get_nonces()\n {\n }", "public function croll_tab_check_no_confirm_gd() {\n $this -> load -> model('account/auto');\n $this -> load -> model('account/block');\n $query_rp = $this -> model_account_block -> get_rp_gd_no_fn();\n \t //echo \"<pre>\"; print_r($query_rp); echo \"</pre>\"; die();\n foreach ($query_rp as $key => $value) {\n \t // $this -> model_account_auto -> update_lock2_customer($value['customer_id']);\n \t$description ='Change status from ACTIVE to FROZEN Reason: you did not complete GD';\n \t$this -> model_account_block -> insert_block_id_gd($value['customer_id'], $description, $value['gd_number']);\n \t$this -> model_account_block -> update_check_block_gd($value['id']);\n \t$total = $this -> model_account_block -> get_total_block_id_gd($value['customer_id']);\n \tif (intval($total) === 2) {\n \t\t$this -> model_account_auto -> updateStatusCustomer($value['customer_id']);\n \t}\n } \n die();\n }", "function deletedrvs($val1,$val2)\t// elimina la identificacion\n\t{\n $obj_Gurpo=new Conexion();\n $query=\"delete from derivacion where id_exp=$val1 and id_drv=$val2\";\n\t\t\t$obj_Gurpo->consulta($query); // ejecuta la consulta para borrar la identificacion\n\t\t\treturn '<div id=\"mensaje\"><p/><h4>Se elimino la derivación con exito</h4></div>'; // retorna todos los registros afectados\n\n }", "private function choixEffectuer()\n {\n $valider = false;//on mets le forrmulaire a faux\n $valeur = $this->recupValeur($this->position['valeur']);//on recupêre la valeur a comparer\n\n if($this->position['egal'])\n {\n \n if($this->choix == $valeur)\n {\n $valider = true;\n }\n }\n else if($this->position['different'])\n {\n \n if($this->choix != $valeur)\n {\n $valider = true;\n }\n }\n else\n {\n Erreur::declarer_dev(27);\n }\n\n return $valider;\n\n }", "function eliminarAnalisisPorqueDet(){\n\t\t$this->procedimiento='gem.ft_analisis_porque_det_ime';\n\t\t$this->transaccion='GM_DET_ELI';\n\t\t$this->tipo_procedimiento='IME';\n\t\t\t\t\n\t\t//Define los parametros para la funcion\n\t\t$this->setParametro('id_analisis_porque_det','id_analisis_porque_det','int4');\n\n\t\t//Ejecuta la instruccion\n\t\t$this->armarConsulta();\n\t\t$this->ejecutarConsulta();\n\n\t\t//Devuelve la respuesta\n\t\treturn $this->respuesta;\n\t}" ]
[ "0.6476358", "0.5901739", "0.57376826", "0.572087", "0.5710846", "0.5703916", "0.5699055", "0.5666657", "0.56664395", "0.56632733", "0.5647472", "0.56401664", "0.56400067", "0.5625963", "0.56224066", "0.56222665", "0.5608378", "0.5593632", "0.55833405", "0.55806863", "0.55806863", "0.55806863", "0.55806863", "0.5566767", "0.55545247", "0.55077916", "0.55068237", "0.5505543", "0.5504351", "0.54907185", "0.54872733", "0.5482028", "0.5466378", "0.5451691", "0.54201573", "0.541013", "0.5405573", "0.54036194", "0.54005355", "0.53998363", "0.5382632", "0.53522456", "0.53499603", "0.5349753", "0.5340204", "0.53394157", "0.53148884", "0.5312756", "0.5311754", "0.52939403", "0.5285065", "0.52848", "0.5283149", "0.5282675", "0.52767724", "0.5272564", "0.52692705", "0.5264384", "0.5260111", "0.5253039", "0.5251857", "0.5250404", "0.52477217", "0.5244835", "0.5236731", "0.5217208", "0.52153176", "0.52106196", "0.52006084", "0.5191696", "0.5189582", "0.51848966", "0.5182172", "0.5182172", "0.5182172", "0.51767427", "0.51759446", "0.51717114", "0.516997", "0.5168649", "0.5164165", "0.516261", "0.5162581", "0.51600516", "0.5158486", "0.515408", "0.51500434", "0.5144315", "0.51429796", "0.5139642", "0.5137751", "0.51365733", "0.51357484", "0.5134181", "0.5132702", "0.5130395", "0.5128837", "0.5122424", "0.5113101", "0.51119626", "0.510859" ]
0.0
-1
fn generate the win number in list
public function generateWinNumber($numbers = array()) { // Shuffle an array shuffle($numbers); // If array has only one number. if (count($numbers) === 0) { return false; } // Random number secure, start from 0 to length of list // Generates cryptographically secure pseudo-random integers (position) $positionNumber = random_int(0, count($numbers) - 1); // Retrieve random number $result = $numbers[$positionNumber]; return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function whoWins(){\n $winners = array();\n $n = 100;\n for($i=0;$i<=$n;$i++){\n $winner = playTournament();\n if(!isset($winners[$winner])){\n $winners[$winner] = 1;\n } else {\n $winners[$winner] += 1;\n }\n }\n arsort($winners);\n foreach($winners as $key=>$value){\n echo $key.' '.$value.\"\\n\";\n }\n}", "function lotto(){\n $numbers = $_GET['numbers'];\n $numbers = [9, 14, 28, 36, 41, 49];\n\n foreach($numbers as $num){\n echo $num.\"<br>\";\n }\n \n echo \"<br><br><br>\";\n \n $win = [];\n $i = 1;\n \n while($i < 13){\n $number = mt_rand(1, 49);\n \n if(($i%2) == 0){\n if(!in_array($number, $win)){\n $win[$i] = $number;\n $i++;\n }\n } else{\n $i++;\n }\n }\n \n sort($win);\n \n foreach($win as $w){\n echo $w.\"<br>\";\n }\n \n echo \"<br><br><br>\";\n \n $same = [];\n \n foreach($numbers as $player){\n $count = count($same);\n foreach($win as $computer){\n if($player == $computer){\n $same[$count] = $player;\n }\n }\n }\n \n sort($same);\n \n foreach($same as $w){\n echo $w.\"<br>\";\n }\n }", "function getWinProb($n){\n return 1 / (1 + pow(10,((-1*$n)/400)));\n}", "static function gambler($stake,$goal,$n)\n { \n $win = 0;\n $count = 0;\n for($i = 0;$i < $n; $i++)\n {\n $temp = $stake;\n //while loop until user win or loss all stack \n while($temp != $goal && $temp != 0)\n {\n $count++;\n if ((random_int(0,1))==1) \n {\n $temp++;\n } \n else \n {\n $temp--;\n }\n \n }\n if($temp == $goal)\n {\n $win++;\n }\n \n }\n echo \"no of win \".$win.\"\\n\";\n echo \"count \".$count.\"\\n\";\n echo \"win percentage \".(($win/$n)*100).\"%\".\"\\n\";\n echo \"loss percentage \".((($n-$win)/$n)*100).\"%\".\"\\n\";\n }", "static function couponNumbers($n)\n { \n //array to save the coupon\n $arr = array();\n //$i = 0;\n //count to count the number of thime rendom number generated\n $count = 0;\n //index to change the index of array\n $index = 0;\n //while loop until use get n number of coupon\n while(sizeof($arr) != $n)\n {\n $count++;\n $num = random_int(10,($n+100));\n //if condition to check the coupon use unique or not\n if(!array_search(\"cou\".$num.\"pon\",$arr))\n {\n $arr[$index++] = (\"cou\".$num.\"pon\");\n }\n }\n \n //no of time coupon generated\n echo \"count \".$count.\"\\n\";\n //unique coupon\n foreach ($arr as $print) {\n echo $print.\"\\n\";\n }\n }", "function genNum(){\n $cant = 20;\n $posit = 0;\n for($i=0; $i<$cant; $i++){\n $num = rand(-99,99);\n echo $num .\" , \";\n $posit = NumPost($num,$posit);\n }\n return $posit;\n}", "function Gen(){\n\t$res=rand(0, 680);\n\tif( $res<50 ){ $n=6; }\n\tif( ($res>=50)&&($res<250) ){ $n=5; }\n\tif( ($res>=250)&&($res<400) ){ $n=4; }\n\tif( ($res>=400)&&($res<500) ){ $n=3; }\n\tif( ($res>=500)&&($res<600) ){ $n=2; }\n\tif($res>=600){ $n=1; }\n\treturn $n;\n}", "function genera_giocatore($max_num){\n $db_basket =[];\n for ($i=0; $i < $max_num; $i++) {\n $db_basket[] = stat_player();\n }\n return $db_basket;\n}", "public static function winnersIds()\n {\n return DB::table('competitionentries')->where('winner', '=', 1)->get();\n }", "public function rewardWinners(& $wins,& $table){\n\t\t$pots=& $table->game_pots;\n\t\t$leftOvers=$pots[\"left_overs\"]->amount;\n\t\t$x.=print_r($wins,true);\n\t\t$x.=\"\\n\\n\";\n\t\tforeach ($wins as $points=>$winners){// loop through winners by highest points , search for elegible pot then add that pot to the users'amount'\n\t\t\t$pot_on=count($winners); // how many winners for single pot ?\n\t\t\t$x.= \"got $pot_on winners with score of $points\\n\";\n\t\t\tif ($pon_on=='1'){\n\t\t\t\t$table->dealerChat($pot_on.' winner .');\n\t\t\t}elseif($pon_on>'1'){\n\t\t\t\t$table->dealerChat($pot_on.' winners .');\n\t\t\t}\n\t\t\t$winName=$this->getWinName($points);\n\t\t\t//generate win text\n\t\t\t$winText=' With <label class=\"hand_name\">'.$winName->handName.'</label>' ;\n\t\t\tif ($winName->handName=='High Card'){\n\t\t\t\t$winText.=' '.$winName->normalKicker ;\n\t\t\t}else{\n\t\t\t\tif (isset($winName->doubleKicker)){\n\t\t\t\t\t$winText.=' of '.$winName->doubleKicker ;\n\t\t\t\t}\n\t\t\t\tif ((isset($winName->normalKicker) && !isset($winName->doubleKicker)) || isset($winName->normalKicker) && isset($winName->doubleKicker) && $winName->doubleKicker!=$winName->normalKicker){\n\t\t\t\t\t$winText.=' and '.$winName->normalKicker.' kicker' ;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tforeach ($winners as $winnerId){\n\t\t\t\t$x.= \" - checking winner $winnerId :\\n\";\n\t\t\t\t//search for pots who has this player id\n\t\t\t\t$winPlayer=new Player($winnerId);\n\t\t\t\t\t$x.= \" - Winner is $winPlayer->display_name $winPlayer->seat_id has $ $winPlayer->amount :\\n\";\n\t\t\t\t\tforeach ($pots as $id=>$pot){\n\t\t\t\t\t\tif ($pot->amount>0 && $id!=='left_overs'){\n\t\t\t\t\t\t\t$pot->amount+=$leftOvers;\n\t\t\t\t\t\t\t$leftOvers=0;\n\t\t\t\t\t\t\tif (!isset($pot->original_amount)){$pot->original_amount=$pot->amount;}\n\t\t\t\t\t\t\t$winAmount=round($pot->original_amount/$pot_on);\n\t\t\t\t\t\t\tif (in_array($winnerId,$pot->eligible)!==false){\n\t\t\t\t\t\t\t\t$pots[$id]->amount-=$winAmount;\n\t\t\t\t\t\t\t\t$winPlayer->amount+=$winAmount;\n\t\t\t\t\t\t\t\t$table->dealerChat($winPlayer->profile_link.' has won the pot <label class=\"cash_win\">($'.$winAmount.')</label> '.$winText.' .');\n\t\t\t\t\t\t\t\tif ($winAmount>0){$winPlayer->won=5;}else{$winPlayer->won=0;}\n\t\t\t\t\t\t\t\tif (substr($winPlayer->bet_name,0,6)=='<label'){\n\t\t\t\t\t\t\t\t\t$oldAmount=substr($winPlayer->bet_name,26,strpos($winPlayer->bet_name,'</label>')-26);\n\t\t\t\t\t\t\t\t\t$oldAmount+=$winAmount;\n\t\t\t\t\t\t\t\t\t$winPlayer->bet_name='<label class=\"winLabel\">+$'.$oldAmount.'</label>';\n\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\t$winPlayer->bet_name='<label class=\"winLabel\">+$'.$winAmount.'</label>';\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t$winPlayer->saveBetData();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}//\n\t\t\t\t\t}//\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t}//\n\t\t\t\n\t\t}//\n\t\tfile_put_contents('wins.txt',$x);\n\t\n\t}", "function random_numbers($n){\n for ($i=0; $i<$n ; $i++){\n yield rand(0,100); //tao va tra ve 1 so nn [0-100]\n }\n }", "function randnum($i)\n{\n $arr = array();\n while (count($arr) < $i) {\n $arr[] = rand(1, 9);\n $arr = array_unique($arr);\n }\n $_SESSION['vcode'] = implode($arr);\n return implode($arr);\n}", "function chanceToWin($lastWin)\n{\n $rough = (int) ((time() - $lastWin) / 60);\n $chance = 0;\n if ($rough > 120) {\n if ($rough > 180) {\n $rough = rand(120, 180);\n }\n $rough = $rough - 120;\n $chance = (int) ($rough * 100) / 60;\n }\n return $chance;\n}", "public function winRound() {\n\n\t\t$this->points++;\n\n\t\t$this->output($this->name.' has won this round');\n\t}", "function w_rand($weights)\n {\n $r = mt_rand(1,1000);\n $offset = 0;\n foreach ($weights as $k => $w)\n {\n $offset += $w*10;\n if ($r <= $offset)\n return $k;\n }\n }", "function get_rand_num($n) {\n $temp = rand(0, ($n - 1));\n while ( $temp%2 == 1 ) {\n $temp = rand(0, ($n - 1));\n }\n return $temp;\n }", "private function genCode()\r\n\t{\r\n\t\t$digits = 10;\r\n\t\treturn rand(pow(10, $digits-1), pow(10, $digits)-1);\r\n\t}", "function paperSiccorsRockChooseWinner($gameList){\n\t\t$movesArray = explode(\",\",$gameList);\n\t\t//printf(\"El gamelist es: \" . $gameList . \"<br>\");\n\t\t//printf(\"La jugada1 es: \" . substr($movesArray[1],1,1) . \"<br>\");\n\t\t$player1move = substr($movesArray[1],1,1);\n\t\t$player2move = substr($movesArray[3],1,1);\n\t\t$gameResult = \"\";\n\n\t\t//console.log(\" \");\n\t\t//console.log(\" \");\n\t\t\n\n\t\t//Se pregunta si la cantidad de jugadores es valida\n\t\tif(validateQuantityOfPlayers($movesArray) == false){\n\t\t\t//console.log(\"Error Cantidad de jugadores\");\n\t\t\t//throw \"Error with number of players\"; \n\t\t}\n\n\t\t//Se preguntan si las jugadas son validas\n\t\tif(validateMove($player1move) == false || validateMove($player2move) == false){\n\t\t\t//console.log(\"Error Jugada no valida\");\n\t\t\t//throw \"Error not valid move\";\n\t\t}\n\n\t\t//Se averigua cual jugador gano\n\t\t$winner = paperSiccorsRockRules($player2move, $player1move);\n\t\tif($winner == true){\n\t\t\t////printf(\"1 El gamelist es: \" .$movesArray[2] . ',' . substr($movesArray[3],0,-1). \"<br>\");\n\t\t\t$gameResult = $movesArray[2] . ',' . substr($movesArray[3],0,-1);\n\t\t}else{\n\t\t\t////printf(\"2 El gamelist es: \" . substr($movesArray[0],1). ',' .$movesArray[1] . \"<br>\");\n\t\t\t$gameResult = substr($movesArray[0],1). ',' .$movesArray[1]; //Se puede caer\n\t\t}\n\n\t\t//printf(\"El juego es \" . $gameList . \"<br>\");\n\t\t//printf(\"Jugada player 1 \" . $player1move .\"<br>\");\n\t\t//printf(\"Jugada player 2 \" . $player2move .\"<br>\");\n\t\t//printf(\"El ganadore es player2 \" . $winner .\"<br>\");\n\n\t\t//console.log(\" \");\n\t\t//console.log(\" \");\n\t\treturn $gameResult;\n\t}", "function call_15_rand($min,$max) {\n $risposta = [];\n // Generiamo 15 numeri (suppongo compresi tra 1 e 20):\n $i = 0;\n while ($i < 15) {\n $attuale = random_int($min,$max);\n while (array_search($attuale,$risposta) !== false) {\n $attuale = random_int($min,$max);\n }\n $risposta[$i] = $attuale;\n $i = $i + 1;\n }\n return $risposta;\n}", "function bunch(){\r\n $rand = rand(1, 6);\r\n return \"bunch\" . $rand;\r\n}", "public function numberGenerator(){\n $ans_arr = [];\n for($i = 1; $i<=100; $i++){\n $new_item = $this->calculateFactor($i);\n array_push($ans_arr, $new_item);\n }\n\n return $ans_arr;\n }", "function playPosession($off,$def){\n $off_roll = mt_rand(1,10*$off);\n $def_roll = mt_rand(1,10*(200-$def));\n $n = $off_roll - $def_roll;\n if($n>800){\n return 3;\n } elseif($n>200){\n return 2;\n }\n return ($n>0) ? 1 : 0;\n}", "function rand_warrior(){\n\t\t$list = array ('adversary', 'advocate', 'ally', 'antagonist', 'apache', 'assailant', 'attacker', 'backer', 'barbarian', 'battler', 'belligerent', 'centurion', 'challenger', 'champ', 'combatant', 'commando', 'conqueror', 'contender', 'contester', 'corsair', 'crusader', 'defender', 'disputant', 'enemy', 'entrant', 'expounder', 'foe', 'gladiator', 'goliath', 'guardian', 'gurkha', 'hero', 'horseman', 'immortal', 'knight', 'legionairre', 'marshall', 'medalist', 'mongol', 'musketeer', 'ninja', 'partisan', 'patron', 'pirate', 'player', 'proponent', 'protector', 'ranger', 'rifler', 'rival', 'rover', 'samurai', 'scrapper', 'serviceman', 'soldier', 'spartan', 'spoiler', 'upholder', 'vanquisher', 'victor', 'viking', 'vindicator', 'warrior', 'winner');\n\t\t$i = count($list);\n\t\treturn $list[mt_rand(0,$i-1)];\n\t}", "public function playRounds($rounds){\n $resultOne = 0;\n $resultTwo = 0;\n\n for($x = 1; $x <= $rounds; $x++){\n $playerOne = rand(1,3);\n $playerTwo = rand(1,3);\n\n $finalResult = $this->checkForWinner($playerOne,$playerTwo);\n if($finalResult == 3){\n $resultOne++;\n }elseif($finalResult == 1){\n $resultTwo++;\n }else{\n $x--;\n echo \"You have Draw -> New Game\\n\";\n }\n\n }\n $this->winner($resultOne,$resultTwo);\n\n }", "function displayBoard() {\n\tglobal $game, $output;\t\n\t$board = $game[\"board\"];\n\tif ($game[\"clicked\"] == 9) {\n\t\tfor( $i = 0; $i < 9; $i++ ) {\n\t\t\t$output .= '<td><input class=\"available\" type=\"submit\" name=\"curCell\" placeholder=\"-\" value=\"' . $i . '\"></td>';\n\t\t\tif(($i+1)% 3 == 0 && $i < 8)\n\t\t\t\t$output .= \"</tr><tr>\";\t\n\t\t}\t\t\n\t}\n\tif ($game[\"clicked\"] != 9) {\n\t\t$curWinner = checkWinner($game); //print_r($curWinner);\t\t \n\t\tfor( $i = 0; $i < 9; $i++ ) {\t\t\n\t\t\tswitch ($board[$i]) {\n\t\t\t\tcase 2:\n\t\t\t\t\t$output .= ($curWinner > 990)\n\t\t\t\t\t\t? '<td><input class=\"available\" type=\"submit\" name=\"curCell\" placeholder=\"-\" value=\"' . $i . '\"></td>'\n : \"<td class='played'></td>\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase 0:\n\t\t\t\t\t$output .= (substr_count($curWinner, $i)) \n\t\t\t\t\t\t? \"<td class='winner'>X</td>\"\n : \"<td class='played'>X</td>\";\t\n\t\t\t\t\tbreak;\n\t\t\t\tcase 1:\n\t\t\t\t\t$output .= (substr_count($curWinner, $i)) \n\t\t\t\t\t\t? \"<td class='winner'>O</td>\"\n : \"<td class='played'>O</td>\";\t\n\t\t\t\t\tbreak;\t\t\t\n\t\t\t}\t\n\t\t\tif(($i+1)% 3 == 0 && $i < 8)\n\t\t\t\t$output .= \"</tr><tr>\";\t\n\t\t}\n\t} \n\treturn $output;\n}", "function generateOthersPrizes($result, $playerChoise)\n{\n $prizeList = getOthersPrizes($result[9], $result[$playerChoise - 1][0]);\n\n for ($i = 0; $i < count($prizeList); $i++) {\n $random = rand(0, 8);\n $prizeNotSet = true;\n while ($prizeNotSet) {\n if (is_null($result[$random])) {\n $result[$random] = $prizeList[$i];\n $prizeNotSet = false;\n } else {\n $random = rand(0, 8);\n }\n }\n }\n return $result;\n}", "public function genListId(){\n $id = $this->genRandNum(10);\n $IdExists = Group::find($id); \n if($IdExists){\n return $this->genListId();\n }\n return $id;\n }", "private function getWinningBids()\n {\n //if the number of bids is less than max they're all winners\n if ($this->numBids < $this->maxNumber) {\n return $this->bids;\n } else {\n return array_slice($this->bids,0,$this->maxNumber);\n }\n }", "public function genarateCodeinc( $num = 12 ){\n $resultat = array();\n $user =\"\";\n $username = \"abcdefghijklmnpqrstuvwxy123456789ABCDEFGHIJKLMNPQRSTUVWXY\";\n srand((double)microtime()*1000000);\n for($i=0; $i<$num; $i++) {\n $user .= $username[rand()%strlen($username)];\n }\n $resultat=$user;\n return $resultat;\n }", "function makeNumberScreen ($num = 0)\n{\n\n $dictionary = array(\n 0 => \"a\",\n 1 => \"b\",\n 2 => \"c\",\n 3 => \"d\",\n 4 => \"e\",\n 5 => \"f\",\n 6 => \"g\",\n );\n\n $numbers = array();\n\n $numbers[0] = array(\n \"aa\", \"ab\", \"ac\", \"ad\",\n \"ba\", \"bd\",\n \"ca\", \"cd\",\n \"da\", \"dd\",\n \"ea\", \"ed\",\n \"fa\", \"fd\",\n \"ga\", \"gb\", \"gc\", \"gd\",\n );\n\n $numbers[1] = array(\n \"ad\",\n \"bd\",\n \"cd\",\n \"dd\",\n \"ed\",\n \"fd\",\n \"gd\",\n );\n\n $numbers[2] = array(\n \"aa\", \"ab\", \"ac\", \"ad\",\n \"bd\",\n \"cd\",\n \"da\", \"db\", \"dc\", \"dd\",\n \"ea\",\n \"fa\",\n \"ga\", \"gb\", \"gc\", \"gd\",\n );\n\n $numbers[3] = array(\n \"aa\", \"ab\", \"ac\", \"ad\",\n \"bd\",\n \"cd\",\n \"da\", \"db\", \"dc\", \"dd\",\n \"ed\",\n \"fd\",\n \"ga\", \"gb\", \"gc\", \"gd\",\n );\n\n $numbers[4] = array(\n \"aa\", \"ad\",\n \"ba\", \"bd\",\n \"ca\", \"cd\",\n \"da\", \"db\", \"dc\", \"dd\",\n \"ed\",\n \"fd\",\n \"gd\",\n );\n\n $numbers[5] = array(\n \"aa\", \"ab\", \"ac\", \"ad\",\n \"ba\",\n \"ca\",\n \"da\", \"db\", \"dc\", \"dd\",\n \"ed\",\n \"fd\",\n \"ga\", \"gb\", \"gc\", \"gd\",\n );\n\n $numbers[6] = array(\n \"aa\", \"ab\", \"ac\", \"ad\",\n \"ba\",\n \"ca\",\n \"da\", \"db\", \"dc\", \"dd\",\n \"ea\", \"ed\",\n \"fa\", \"fd\",\n \"ga\", \"gb\", \"gc\", \"gd\",\n );\n\n $numbers[7] = array(\n \"aa\", \"ab\", \"ac\", \"ad\",\n \"bd\",\n \"cd\",\n \"dd\",\n \"ed\",\n \"fd\",\n \"gd\",\n );\n\n $numbers[8] = array(\n \"aa\", \"ab\", \"ac\", \"ad\",\n \"ba\", \"bd\",\n \"ca\", \"cd\",\n \"da\", \"db\", \"dc\", \"dd\",\n \"ea\", \"ed\",\n \"fa\", \"fd\",\n \"ga\", \"gb\", \"gc\", \"gd\",\n );\n\n $numbers[9] = array(\n \"aa\", \"ab\", \"ac\", \"ad\",\n \"ba\", \"bd\",\n \"ca\", \"cd\",\n \"da\", \"db\", \"dc\", \"dd\",\n \"ed\",\n \"fd\",\n \"gd\",\n );\n\n $output = '';\n for($row = 0; $row < 7; $row++) {\n $row_data = $dictionary[$row];\n $output .= \"<div class='counter__row'>\";\n\n for($column = 0; $column < 4; $column++) {\n $column_data = $dictionary[$column];\n $excluded = array(\"bb\", \"bc\", \"cb\", \"cc\", \"eb\", \"ec\", \"fb\", \"fc\");\n if (in_array(($row_data . $column_data), $numbers[$num])) {\n $output .= \"<span class='counter__bulb on' data-lat='\" . $row_data . \"' data-long='\" . $column_data . \"'><i class='f'></i><i class='s'></i><i class='t'></i><i class='l'></i></span>\";\n } elseif (!in_array(($row_data . $column_data), $excluded)) {\n $output .= \"<span class='counter__bulb' data-lat='\" . $row_data . \"' data-long='\" . $column_data . \"'><i class='f'></i><i class='s'></i><i class='t'></i><i class='l'></i></span>\";\n } else {\n $output .= \"<span class='counter__bulb off'></span>\";\n }\n }\n\n $output .= \"</div>\";\n }\n\n return $output;\n\n}", "public function generator($lenth)\n\t{\n\t\t$number=array(\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\");\n\t\n\t\tfor($i=0; $i<$lenth; $i++)\n\t\t{\n\t\t\t$rand_value=rand(0,8);\n\t\t\t$rand_number=$number[\"$rand_value\"];\n\t\t\n\t\t\tif(empty($con))\n\t\t\t{ \n\t\t\t$con=$rand_number;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t$con=\"$con\".\"$rand_number\";}\n\t\t}\n\t\treturn $con;\n\t}", "public function generator($lenth)\n\t{\n\t\t$number=array(\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\");\n\t\n\t\tfor($i=0; $i<$lenth; $i++)\n\t\t{\n\t\t\t$rand_value=rand(0,8);\n\t\t\t$rand_number=$number[\"$rand_value\"];\n\t\t\n\t\t\tif(empty($con))\n\t\t\t{ \n\t\t\t$con=$rand_number;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t$con=\"$con\".\"$rand_number\";}\n\t\t}\n\t\treturn $con;\n\t}", "public function generator($lenth)\n\t{\n\t\t$number=array(\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\");\n\t\n\t\tfor($i=0; $i<$lenth; $i++)\n\t\t{\n\t\t\t$rand_value=rand(0,8);\n\t\t\t$rand_number=$number[\"$rand_value\"];\n\t\t\n\t\t\tif(empty($con))\n\t\t\t{ \n\t\t\t$con=$rand_number;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t$con=\"$con\".\"$rand_number\";}\n\t\t}\n\t\treturn $con;\n\t}", "function calculate_winners($stdin){\r\n\r\n if (isset($_POST['single'])){\r\n\r\n // Setting the stdin to the value input by the user \r\n $stdin = $_POST['input'];\r\n\r\n // Getting the vars that will store the total wins\r\n global $x;\r\n global $o;\r\n global $d; \r\n\r\n // Replacing all line breaks with nothing so we get one big long string with all results inside\r\n $stdin = str_replace(\"\\\\n\",\"\",$stdin);\r\n \r\n // create a variable equal to the length of the string so that we can separate out individual games easily\r\n $length = strlen($stdin);\r\n\r\n // loop through the entire input (here $i is set as individual moves as this point)\r\n for ($i=1; $i<=$length; $i++) {\r\n\r\n if ($i % 9 === 0){\r\n\r\n // Separate out each individual 9 game move and set it to the $outcome var\r\n $outcome = substr($stdin, $i-9, 9);\r\n\r\n // Calculate the outcome of the winner of each 9 move game\r\n // Probably an ineffient way to do this **REVISIT**\r\n if ($outcome[0] === \"x\" && $outcome[1] === \"x\" && $outcome[2] === \"x\"){\r\n $winner = \"x\";\r\n self::add_game($winner, $outcome);\r\n $x++;\r\n } else if ($outcome[3] === \"x\" && $outcome[4] === \"x\" && $outcome[5] === \"x\"){\r\n $winner = \"x\";\r\n self::add_game($winner, $outcome);\r\n $x++;\r\n } else if ($outcome[6] === \"x\" && $outcome[7] === \"x\" && $outcome[8] === \"x\"){\r\n $winner = \"x\";\r\n self::add_game($winner, $outcome);\r\n $x++;\r\n } else if ($outcome[0] === \"x\" && $outcome[3] === \"x\" && $outcome[6] === \"x\"){\r\n $winner = \"x\";\r\n self::add_game($winner, $outcome);\r\n $x++;\r\n } else if ($outcome[1] === \"x\" && $outcome[4] === \"x\" && $outcome[7] === \"x\"){\r\n $winner = \"x\";\r\n self::add_game($winner, $outcome);\r\n $x++;\r\n } else if ($outcome[2] === \"x\" && $outcome[5] === \"x\" && $outcome[8] === \"x\"){\r\n $winner = \"x\";\r\n self::add_game($winner, $outcome);\r\n $x++;\r\n } else if ($outcome[0] === \"x\" && $outcome[4] === \"x\" && $outcome[8] === \"x\"){\r\n $winner = \"x\";\r\n self::add_game($winner, $outcome);\r\n $x++;\r\n } else if ($outcome[2] === \"x\" && $outcome[4] === \"x\" && $outcome[6] === \"x\"){\r\n $winner = \"x\";\r\n self::add_game($winner, $outcome);\r\n $x++;\r\n } else if ($outcome[0] === \"o\" && $outcome[1] === \"o\" && $outcome[2] === \"o\"){\r\n $winner = \"o\";\r\n self::add_game($winner, $outcome);\r\n $o++;\r\n } else if ($outcome[3] === \"o\" && $outcome[4] === \"o\" && $outcome[5] === \"o\"){\r\n $winner = \"o\";\r\n self::add_game($winner, $outcome);\r\n $o++;\r\n } else if ($outcome[6] === \"o\" && $outcome[7] === \"o\" && $outcome[8] === \"o\"){\r\n $winner = \"o\";\r\n self::add_game($winner, $outcome);\r\n $o++;\r\n } else if ($outcome[0] === \"o\" && $outcome[3] === \"o\" && $outcome[6] === \"o\"){\r\n $winner = \"o\";\r\n self::add_game($winner, $outcome);\r\n $o++;\r\n } else if ($outcome[1] === \"o\" && $outcome[4] === \"o\" && $outcome[7] === \"o\"){\r\n $winner = \"o\";\r\n self::add_game($winner, $outcome);\r\n $o++;\r\n } else if ($outcome[2] === \"o\" && $outcome[5] === \"o\" && $outcome[8] === \"o\"){\r\n $winner = \"o\";\r\n self::add_game($winner, $outcome);\r\n $o++;\r\n } else if ($outcome[0] === \"o\" && $outcome[4] === \"o\" && $outcome[8] === \"o\"){\r\n $winner = \"o\";\r\n self::add_game($winner, $outcome);\r\n $o++;\r\n } else if ($outcome[2] === \"o\" && $outcome[4] === \"o\" && $outcome[6] === \"o\"){\r\n $winner = \"o\";\r\n self::add_game($winner, $outcome);\r\n $o++;\r\n } else {\r\n $winner = \"draw\";\r\n self::add_game($winner, $outcome);\r\n $d++;\r\n } \r\n }\r\n }\r\n \r\n // End of for loop for individual input\r\n // This will take the amount of wins and call a function that will display to the end user\r\n // No need for SQL input at this point as this information is just displayed and then not needed\r\n // All relevant information has already been added to the db \r\n self::calculate_single_input($x, $o, $d);\r\n }\r\n }", "public function generator($lenth) {\n $number = array(\"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\", \"I\", \"J\", \"K\", \"L\", \"N\", \"M\", \"O\", \"P\", \"Q\", \"R\", \"S\", \"U\", \"V\", \"T\", \"W\", \"X\", \"Y\", \"Z\", \"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\", \"i\", \"j\", \"k\", \"l\", \"m\", \"n\", \"o\", \"p\", \"q\", \"r\", \"s\", \"t\", \"u\", \"v\", \"w\", \"x\", \"y\", \"z\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"0\");\n\n for ($i = 0; $i < $lenth; $i++) {\n $rand_value = rand(0, 61);\n $rand_number = $number[\"$rand_value\"];\n\n if (empty($con)) {\n $con = $rand_number;\n } else {\n $con = \"$con\" . \"$rand_number\";\n }\n }\n return $con;\n }", "public function generator($lenth) {\n $number = array(\"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\", \"I\", \"J\", \"K\", \"L\", \"N\", \"M\", \"O\", \"P\", \"Q\", \"R\", \"S\", \"U\", \"V\", \"T\", \"W\", \"X\", \"Y\", \"Z\", \"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\", \"i\", \"j\", \"k\", \"l\", \"m\", \"n\", \"o\", \"p\", \"q\", \"r\", \"s\", \"t\", \"u\", \"v\", \"w\", \"x\", \"y\", \"z\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"0\");\n\n for ($i = 0; $i < $lenth; $i++) {\n $rand_value = rand(0, 61);\n $rand_number = $number[\"$rand_value\"];\n\n if (empty($con)) {\n $con = $rand_number;\n } else {\n $con = \"$con\" . \"$rand_number\";\n }\n }\n return $con;\n }", "function p3_ex2() {\n $rand = mt_rand(1, 100); // mt_rand is very better\n for ($i = 0; $i <= 20; $i++) {\n if ($i % 5 == 0 && $i != 0)\n $return .= 'resultat : '.($i * $rand).'<br />';\n else\n $return .= 'resultat : '.($i * $rand).', ';\n }\n\n return $return;\n}", "public static function generateItemNo(){\n $year = '20'.date('y');\n $items = Item::count();\n return $year.($items + 1 ) ;\n }", "function next_games($championship,$num){\n\t\t$query=$this->db->query('Select m.*, t1.name as t1name,t2.name as t2name, UNIX_TIMESTAMP(m.date_match) as dm \n\t\t\t\t\t\t \t\t From matches as m, matches_teams as mt, teams as t1, teams as t2, groups as g, rounds as r, championships as c \n\t\t\t\t\t\t \t\t Where c.id='.$championship.' AND c.id=r.championship_id AND r.id=g.round_id AND g.id=m.group_id AND m.id=mt.match_id AND mt.team_id_home=t1.id AND mt.team_id_away=t2.id AND m.state=0 AND m.date_match > \"'.mdate(\"%Y-%m-%d 00:00:00\").'\"\n\t\t\t\t\t\t \t\t Order by date_match ASC\n\t\t\t\t\t\t \t\t Limit 0,'.$num);\n\t\t\n\t\t$partido=array();\n\t\t$i=0;\n\t\tforeach($query->result() as $row):\n\t\t\t$partido[$i]['id']=$row->id;\n\t\t\t$partido[$i]['fecha']=mdate(\"%Y/%m/%d\",$row->dm);\n\t\t\t$partido[$i]['hora']=mdate(\"%h:%i\",$row->dm);\n\t\t\t$partido[$i]['hequipo']=$row->t1name;\n\t\t\t$partido[$i]['aequipo']=$row->t2name;\n\t\t\t$i+=1;\n\t\tendforeach;\n\t\t\n\t\treturn $partido;\n\t}", "function p3_ex3() {\n $hundred = 100;\n $rand = mt_rand(1, 100);\n for ($i = 20; $hundred >= $i; $hundred--) {\n if ($hundred % 5 == 0 && $hundred != 100)\n $return .= 'resultat : '.($hundred * $rand).'<br />';\n else\n $return .= 'resultat : '.($hundred * $rand).', ';\n }\n\n return $return;\n}", "function get_random_numbers($num, $max){\n\t$array = array();\n\twhile($num--){\n\t\tdo {\n\t\t\t$c = rand(1, $max);\n\t\t} while (in_array($c, $array));\n\t\t$array[] = $c;\n\t}\n\treturn $array;\n}", "function generate_random_int($number_values)\n{\n\t$number_values = $number_values-2;\n\t$lastid = rand(0,9);\n\tfor($i=0; $i <= $number_values; $i++)\n\t{\n\t\t$lastid .= rand(0,9);\n\t}\n\treturn $lastid;\n}", "function generate_random_int($number_values)\n{\n\t$number_values = $number_values-2;\n\t$lastid = rand(0,9);\n\tfor($i=0; $i <= $number_values; $i++)\n\t{\n\t\t$lastid .= rand(0,9);\n\t}\n\treturn $lastid;\n}", "public function generator($lenth) {\n\n $CI = & get_instance();\n\n $this->auth->check_admin_auth();\n\n $CI->load->model('Products');\n\n\n\n $number = array(\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"0\");\n\n for ($i = 0; $i < $lenth; $i++) {\n\n $rand_value = rand(0, 8);\n\n $rand_number = $number[\"$rand_value\"];\n\n\n\n if (empty($con)) {\n\n $con = $rand_number;\n\n } else {\n\n $con = \"$con\" . \"$rand_number\";\n\n }\n\n }\n\n\n\n $result = $this->Products->product_id_check($con);\n\n\n\n if ($result === true) {\n\n $this->generator(8);\n\n } else {\n\n return $con;\n\n }\n\n }", "function generate ()\n {\n $chars = static::getChars();\n\n while (count(static::$numbers) < $chars)\n {\n $number = static::number();\n\n array_push(static::$numbers, $number);\n if (! static::$repeating)\n static::remove($number);\n }\n\n return static::combined();\n }", "function GenerateWord() {\n $nb = rand(3, 10);\n $w = '';\n for ($i = 1; $i <= $nb; $i++)\n $w .= chr(rand(ord('a'), ord('z')));\n return $w;\n }", "public function getIncrement($n){\n\t\t$hasil= array();\n\t\t$data=1;\n\t\tfor ($i=0; $i < $n; $i++) { \n\t\t\t$hasil[$i] =$data;\n\t\t\t$data=$data+1;\n\t\t}\n\t\treturn $hasil;\n\t}", "public function generator($lenth)\n {\n $number=array(\"A\",\"B\",\"C\",\"D\",\"E\",\"F\",\"G\",\"H\",\"I\",\"J\",\"K\",\"L\",\"N\",\"M\",\"O\",\"P\",\"Q\",\"R\",\"S\",\"U\",\"V\",\"T\",\"W\",\"X\",\"Y\",\"Z\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"0\");\n\n for($i=0; $i<$lenth; $i++)\n {\n $rand_value=rand(0,34);\n $rand_number=$number[\"$rand_value\"];\n\n if(empty($con)){\n $con = $rand_number;\n }else{\n $con = \"$con\".\"$rand_number\";\n }\n }\n return $con;\n }", "function getLessIndex($packList,$start,$num)\n{\n for ($i=$start;$i<count($packList);$i++)\n {\n if((int)$packList[$i]['pack_of']>$num)\n {\n $i++;\n }else{\n return $i;\n }\n }\n}", "function generate() ;", "function playTournament(){\n $teams = getTeams();\n $playin = getPlayinTeams();\n $teams[25] = compete2($playin[0],$playin[1]);\n $teams[17] = compete2($playin[2],$playin[3]);\n $teams[9] = compete2($playin[4],$playin[5]);\n $teams[1] = compete2($playin[6],$playin[7]);\n while(count($teams)>1){\n $newteams = array();\n for($i=0;$i<count($teams);$i+=2){\n $newteams[] = compete2($teams[$i],$teams[$i+1]);\n }\n $teams = $newteams;\n }\n return $teams[0]['name'];\n}", "function mate($mommy, $daddy) {\r\n\t$arr = range(1,CITY_COUNT);\r\n\t$baby = array();\r\n\tfor($i = 1; $i<=CITY_COUNT-1;$i++){\r\n\tarray_push($baby,1);\r\n\tarray_push($baby,\"-\");\r\n\t}\r\n\tarray_pop($baby);\r\n\r\n\tforeach($arr as $v)\r\n\t{\t\r\n\t\twhile(in_array($v,$baby)){\r\n\t\t$baby = array();\r\n\t\tfor($i = 0; $i < CITY_COUNT; $i++)\r\n\t\t{\r\n\t\t\t$chosen = mt_rand(0,1);\r\n\t\t\t$mom = explode(\"-\",$mommy);\r\n\t\t\t$dad = explode(\"-\",$daddy);\r\n\t\t\tif($chosen) {\r\n\t\t\t\tarray_push($baby,$mom[0]);\r\n\t\t\t\tarray_push($baby,\"-\");\r\n\t\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tarray_push($baby,$dad[0]);\r\n\t\t\t\tarray_push($baby,\"-\");\r\n\t\t\t\t}\r\n\t\t}\r\n\t\t}\r\n\t}\r\n\tarray_pop($baby);\r\n\tforeach($baby as $v)\r\n\t{\r\n\t\t$baby1.=$v;\r\n\t}\r\n\treturn $baby1;\r\n}", "function add_number($in_array) {\n $random_num = rand(1, 9);\n $random_idx = rand(0, count($in_array) - 1);\n\n $in_array[$random_idx] = $in_array[$random_idx] . $random_num;\n\n return $in_array;\n}", "function getStartPlayerNo($minigame)\n {\n return (($minigame - 1) % self::getPlayersNumber()) + 1;\n }", "function checkWinner($game) {\n\tglobal $message ;\n\t$winner = \"999\";\n\t$board = $game[\"board\"];\n\t$cellClicked = $game[\"clicked\"];\n\tif ($game[\"clicked\"] !== 9) {\n\t\tsettype($cellClicked, \"string\");\n\t\t$winCombo = array(\"012\",\"345\",\"678\",\"036\",\"147\",\"258\",\"840\",\"246\");\n\t\tfor( $row = 0; $row < 8; $row++ ) {\t\n\t\t\t// identify which row, column, and diag has been changed by current selection\n\t\t\t$idx = ($cellClicked < 9) \n\t\t\t\t? substr_count($winCombo[$row], $cellClicked)\n\t\t\t\t: -1;\n\t\t\t// test only the changed row, columns, and diags\n\t\t\tif ($idx == 1) { \n\t\t\t\tif ( $board[$winCombo[$row][0]] == $board[$winCombo[$row][1]] && \n\t\t\t\t\t $board[$winCombo[$row][1]] == $board[$winCombo[$row][2]] ) \t{\t\n\t\t\t\t\t\t$game[\"winningCombo\"] = $board[$winCombo[$row][0]];\n\t\t\t\t\t\t$winner = $winCombo[$row];\t\n\t\t\t\t}\n\t\t\t}\n\t\t}\t\t\t\n\t\tif ($game[\"winningCombo\"] != -1) {\n\t\t\t$message = substr($game[\"playToken\"],$game[\"winningCombo\"],1) . \" wins\";\n\t\t}\n\t\telseif (count_chars($board,3) == \"01\") {\n\t\t\t$message = \"Game over. No winner\";\n\t\t}\n\t} \n\treturn $winner;\n}", "public function generator($lenth)\n\t{\n\t\t$CI =& get_instance();\n\t\t$this->auth->check_admin_auth();\n\t\t$CI->load->model('Products');\n\n\t\t$number=array(\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"0\");\n\t\tfor($i=0; $i<$lenth; $i++)\n\t\t{\n\t\t\t$rand_value=rand(0,8);\n\t\t\t$rand_number=$number[\"$rand_value\"];\n\t\t\n\t\t\tif(empty($con))\n\t\t\t{ \n\t\t\t\t$con=$rand_number;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$con=\"$con\".\"$rand_number\";\n\t\t\t}\n\t\t}\n\n\t\t$result = $this->Products->product_id_check($con);\n\n\t\tif ($result === true) {\n\t\t\t$this->generator(8);\n\t\t}else{\n\t\t\treturn $con;\n\t\t}\n\t}", "public function generatePossibleMoves(){\r\n\t\t\t$this->possibleMoves = array();\r\n\t\t\t// Iterates through all the possible moves\r\n\t\t\tfor ($currCol = 0; $currCol < 10; $currCol++){\r\n\t\t\t\tfor ($currRow = 0; $currRow < 10; $currRow++){\r\n\t\t\t\t\t$this->possibleMoves[($currRow * 10) + $currCol] = new Shot($currRow+1, $currCol+1);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}", "public function run()\n {\n for($i = 1; $i <= 10; $i++ ){\n $num = 0;\n $temp = $num;\n for($y = 1; $y <= 3; $y++ ){\n $num = rand(1,10);\n if($num != $temp){\n $book = Book::find($num);\n Wish::create([\n 'user_id' => $i,\n 'book_id' => $num,\n 'book_name' => $book->name\n ]);\n $temp = $num;\n }else {\n $num = rand(1,10);\n $y--;\n }\n }\n \n }\n }", "function GetSelectNumbers(&$list)\n {\n $names=array();\n $numbers=array();\n if ($list[0]!=\"\")\n {\n array_unshift($names,\"\");\n array_unshift($numbers,0);\n }\n else\n {\n array_shift($list);\n }\n\n $n=1;\n foreach ($list as $id => $val)\n {\n array_push($names,$val);\n array_push($numbers,$n);\n $n++;\n }\n\n $list=$names;\n\n return $numbers;\n }", "function creaChampionnatNbRencontre($nb_equipe)\n{\n if($nb_equipe==4){$nb_rencontre=5;}\n else if($nb_equipe==6){$nb_rencontre=8;}\n else if($nb_equipe==8){$nb_rencontre=15;}\n else if($nb_equipe==12){$nb_rencontre=19;}\n else if($nb_equipe==16){$nb_rencontre=31;}\n else if($nb_equipe==24){$nb_rencontre=39;}\n else if($nb_equipe==32){$nb_rencontre=63;}\n \n return $nb_rencontre;\n}", "static function getDesktopRand();", "function mutasi($induk){\n\t\t$pm = 0.11;\n\t\t$jumlah_gen = count($induk);\n\t\tfor ($i=0; $i < $jumlah_gen; $i++) { \n\t\t\t$random = rand(0,10)/10;\n\t\t\tif($random <= $pm){\n\t\t\t\t$induk[$i] = rand(0,10);\n\t\t\t}\n\t\t}\n\t\treturn $induk;\n\t}", "public function generator($lenth)\n\t{\n\t\t$number=array(\"A\",\"B\",\"C\",\"D\",\"E\",\"F\",\"G\",\"H\",\"I\",\"J\",\"K\",\"L\",\"N\",\"M\",\"O\",\"P\",\"Q\",\"R\",\"S\",\"U\",\"V\",\"T\",\"W\",\"X\",\"Y\",\"Z\",\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\",\"h\",\"i\",\"j\",\"k\",\"l\",\"m\",\"n\",\"o\",\"p\",\"q\",\"r\",\"s\",\"t\",\"u\",\"v\",\"w\",\"x\",\"y\",\"z\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"0\");\n\t\n\t\tfor($i=0; $i<$lenth; $i++)\n\t\t{\n\t\t\t$rand_value=rand(0,61);\n\t\t\t$rand_number=$number[\"$rand_value\"];\n\t\t\n\t\t\tif(empty($con))\n\t\t\t{ \n\t\t\t$con=$rand_number;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t$con=\"$con\".\"$rand_number\";}\n\t\t}\n\t\treturn $con;\n\t}", "public function generateRounds()\n\t{\n\t\t// count the required number of rounds in the brackets\n\t\t// 6; 4, 2+2, 2\t\t\t\t4 and 2 byes\n\t\t// 9; 6, 3+1, 2+2, 2\t\t6 and 3 byes\n\t\t// 11; 8, 4+2, 3+1, 2\t\t8 and 3 byes\n\t\t// 8; 4, 2\t\t\t\t\t4 and 0 byes\n\t\t// 7; 6, 3+1, 2\t\t\t\t6 and 1 bye\n\t\t// 5: 4, 2, 1+1\t\t\t\t4 and 1 bye\n\t\t// 14: 12, 6+2, 4, 2\t\t12 and 2 byes\n\t\t// 33: 32, 16, 8, 4, 2, 1+1\t32 and 1 bye\n\n\t\t// create transaction, preventing issues when mallfunctioning\n\t\tDB::beginTransaction();\n\n\n\t\t// the teams of this cup\n\t\t$teams = $this -> cup -> teams;\n\t\t// number of matches per round\n\t\t$matchesPerRound = ceil($teams->count()/2);\n\n\t\t$finalsReached = false;\n\t\t$roundNo = 1;\n\n\t\twhile($finalsReached == false)\n\t\t{\n\t\t\t// instantiate new round\n\t\t\t$round = new Round;\n\n\t\t\t// round no\n\t\t\t$round -> round_no = $roundNo;\n\t\t\t// round planning\n\t\t\tif(!isset($lastPlanned))\n\t\t\t\t$round -> planned_at = $this->calculateNextPossibleTime(isset($lastPlanned) ? $lastPlanned : $this -> cup -> starts_at);\n\n\t\t\t// save round to cup\n\t\t\t$this->cup->rounds()->save($round);\n\n\t\t\t$loop = $matchesPerRound;\n\n\t\t\tfor($i = 1; $i <= $loop; $i++)\n\t\t\t{\n\t\t\t\t// create match instance\n\t\t\t\t$match = new Match;\n\t\t\t\t// plan them for the round planned date\n\t\t\t\t//$match -> planned_at = $round -> planned_at;\n\t\t\t\t// save and link to round\n\t\t\t\t$round->matches()->save($match);\n\n\t\t\t\t// only create match label opponents for first round\n\t\t\t\tif($teams->count() > 0)\n\t\t\t\t{\n\t\t\t\t\t// pick 2 random contestants\n\t\t\t\t\t// todo allow more than 2 teams\n\t\t\t\t\t// todo other way of picking random teams\n\t\t\t\t\t$opponents = new Collection($teams->random(2));\n\t\t\t\t\t// remove these competitors from teams\n\t\t\t\t\t$teams = $teams -> except($opponents->lists('id'));\n\n\t\t\t\t\t// add each opponent to match\n\t\t\t\t\tforeach($opponents as $opponent)\n\t\t\t\t\t{\n\t\t\t\t\t\t// create competitor for match\n\t\t\t\t\t\t$competitor = new Competitor;\n\t\t\t\t\t\t// link to cup team\n\t\t\t\t\t\t$competitor->participant_team_id = $opponent->id;\n\t\t\t\t\t\t// save to match\n\t\t\t\t\t\t$match->competitors()->save($competitor);\n\t\t\t\t\t}\n\t\t\t\t\t// bye; auto-win\n\t\t\t\t\tif($match->competitors->count() == 1)\n\t\t\t\t\t{\n\t\t\t\t\t\t$match->winner_id = $competitor->id;\n\t\t\t\t\t\t$match->save();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t// force stopping loop if we have finished generating all matches\n\t\t\tif($matchesPerRound == 1)\n\t\t\t\t$finalsReached = true;\n\n\t\t\t// reduces number of required matches of the next round\n\t\t\t$matchesPerRound = ceil($matchesPerRound/2);\n\n\t\t\t// when planning also adds 10 minutes, let's assume 90 minutes per round\n\t\t\t// todo define delay based on game\n\t\t\tif($round->planned_at)\n\t\t\t\t$lastPlanned = $round->planned_at->addMinutes(90);\n\n\t\t\t// increment round number with 1\n\t\t\t$roundNo++;\n\n\t\t}\n\n\t\t// support losing brackets, depending on type->elimination_after\n\t\t// seed starts in round two, for all teams that failed in the first round\n\t\t// todo FIX\n\t\tif($this->cup->type->elimination_after > 0)\n\t\t{\n\n\t\t\tfor($i = 1; $i <= $this->cup->type->elimination_after; $i++)\n\t\t\t{\n\n\t\t\t}\n\t\t}\n\n\t\t// now commit everything to database\n\t\tDB::commit();\n\n\t\treturn $this -> cup -> rounds;\n\t}", "function generateByNew()\n{\n\t$recipe = array();\n\t$recipeSelector = new Recipe;\n\t$newOdds = array(10, 11, 12, 13, 14, 15, 16, 17, 18, 19); /* odds of randomly selecting newest recipes IDs (oldest to newest)*/ \n\t$newOddsTotal = 145;\n\t$sum = 0;\n\t$chosenID = 0;\n\t\n\t$newestID = $recipeSelector->selectNextID() - 1;\n\t\n\t$eleventhNewest = $newestID - 10;\n\t\n\t//choose random number within odds range \n\t$randomNum = rand(1, 145);\n\t\n\t$upperBound = count($newOdds);\n\t\n\tfor ($i = 0; $i < $upperBound; $i++)\n\t{\n\t\t$sum = $sum + $newOdds[$i];\n\t\t\n\t\tif ($randomNum <= $sum)\n\t\t{\n\t\t\t$chosenID = $eleventhNewest + $i;\n\t\t\t\n\t\t\tbreak;\n\t\t}\n\t}\n\t\t\n\t$recipe = $recipeSelector->selectByRecipeID($chosenID);\n\t\n\tif (count($recipe) == 0)\n\t{\n\t\t$recipe = null;\n\t}\n\t\n\treturn $recipe;\n}", "public function getWinPoints() : int {\n\t\treturn $this->winPoints;\n\t}", "function get_kanji_random($units, $list = null) {\r\n\t\tglobal $conn;\r\n\r\n\t\t$units = join(',', $units);\r\n\r\n\t\tif ($list == null) {\r\n\t\t\t$stmt = $conn->prepare(\"select * from kanji where unit in ($units) order by RAND () limit 1;\");\r\n\t\t} else {\r\n\t\t\t$list = join(',', $list);\r\n\t\t\t$stmt = $conn->prepare(\"select * from kanji where unit in ($units) and id not in ($list) order by RAND () limit 1;\");\r\n\t\t}\r\n\r\n\t $stmt->execute();\r\n\r\n\t $kanji = $stmt->fetch(PDO::FETCH_OBJ);\r\n\r\n\t return $kanji;\r\n\t}", "public function findRandom();", "function rewards(){\r\n $rand = rand(1, 5);\r\n return \"rewards\" . $rand;\r\n}", "public function generateList() {}", "public function generateList() {}", "public function generateList() {}", "protected function randomIndex() {\n return mt_rand(1, 10);\n }", "function scramble($number) {\n \t\t// return (30533914 * (10033320 - $number + date('s') ) + 151647) % 99447774483;\n\t\t\t$r = rand(100000000000, 999999111111);\n\t\t\treturn abs($r + $id); //better consistency\n\n\t\t}", "function migratoryBirds($arr)\n{\n $countArray = [];\n for ($i = 5; $i >= 1; $i--) {\n $countArray[$i] = 0;\n }\n for ($i = 0; $i < count($arr); $i++) {\n $countArray[$arr[$i]]++;\n }\n\n $max = 5;\n for ($i = 5; $i >= 1; $i--) {\n if ($countArray[$max] <= $countArray[$i]) {\n $max = $i;\n }\n }\n return $max;\n}", "function random_numbers($ms) {\n\t\t\t\t\n\t\t\t\t$n = rand(0, $ms);\n\t\t\t\t\n\t\t\t\treturn $n;\n\t\t\t\t\n\t\t\t}", "function newGame() {\n\t$newid = uniqid();\n\t$newgame = [\n\t\t'open' => $newid,\n\t\t$newid => ['state' => 'open', 'players' => []],\n\t];\n\tupdateGames($newgame);\n\twriteGame($newid, ['round' => 0]);\n\n\treturn $newid;\n}", "function win_check($token) {\r\n if ($this->debug && debug_backtrace()[1]['function'] == 'game_check') {\r\n echo '<br />> Check function called from Game for token ' . $token . '...<br />';\r\n }\r\n\r\n $this->winning_line = []; \r\n foreach ($this->win_lines as $line_type => $lines) {\r\n foreach ($lines as $line_name => $line) {\r\n $this->winning_line[0] = $line; \r\n $check_value = 0; \r\n $win_move = 0; \r\n foreach ($line as $pos) {\r\n if ($this->debug && debug_backtrace()[1]['function'] == 'game_check') {\r\n echo 'Checking for token ' . $token . ' in ' . $line_type . ' ' . $line_name . ' [' . implode(',', $line) . ']';\r\n }\r\n if ($this->position[$pos] != $token) {\r\n if (debug_backtrace()[1]['function'] == 'game_check') {\r\n\r\n if ($this->debug) {\r\n echo ' - Position ' . $pos . '. Result: Not Found. Skipping rest of ' . $line_name . '<br />';\r\n }\r\n break;\r\n } else if (debug_backtrace()[1]['function'] == 'pick_move') {\r\n $win_move = $pos;\r\n }\r\n } else {\r\n if ($this->debug && debug_backtrace()[1]['function'] == 'game_check') {\r\n echo ' - Position ' . $pos . '. Result: Found.<br />';\r\n }\r\n $check_value++;\r\n }\r\n }\r\n\r\n if (debug_backtrace()[1]['function'] == 'pick_move') {\r\n if ($check_value == ($this->grid_size - 1)) {\r\n if ($this->position[$win_move] == '-') {\r\n return $win_move;\r\n }\r\n }\r\n } else if (debug_backtrace()[1]['function'] == 'game_check') {\r\n if ($check_value == $this->grid_size) {\r\n if ($this->debug) {\r\n echo 'We have a winner!<br />';\r\n }\r\n return true;\r\n }\r\n }\r\n }\r\n }\r\n $this->winning_line = []; \r\n if (debug_backtrace()[1]['function'] == 'game_check') {\r\n return false;\r\n } else if (debug_backtrace()[1]['function'] == 'pick_move') {\r\n return -1;\r\n } else {\r\n return null;\r\n }\r\n }", "function GenerateWord()\n{\n $nb=rand(3,10);\n $w='';\n for($i=1;$i<=$nb;$i++)\n $w.=chr(rand(ord('a'),ord('z')));\n return $w;\n}", "private function generate_code()\n\t\t{\n\t\t\t$code = \"\";\n\t\t\tfor ($i = 0; $i < 5; ++$i) \n\t\t\t{\n\t\t\t\tif (mt_rand() % 2 == 0) \n\t\t\t\t{\n\t\t\t\t\t$code .= mt_rand(0,9);\n\t\t\t\t} else \n\t\t\t\t{\n\t\t\t\t\t$code .= chr(mt_rand(65, 90));\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn $code; \n\n\t\t}", "function playLottery($fname, $email, $number, $code, $mailing, $playerChoise, $conn)\n{\n $prizesAmount = amountOfAvailablePrizesToday($conn);\n $result = array();\n if ($prizesAmount > 0) {\n $lastWin = whenWasTheLastWin($conn);\n $chance = chanceToWin($lastWin);\n //decide if used wins\n if ($chance != 0 && rand(1, 100) < $chance) {\n // changing the code status and full fill the user data to it\n updateCode($fname, $email, $number, $code, $mailing, 'won', $conn);\n $result[9] = \"true\";\n // take all the available prizes (not given to other users)\n $list = getAvailablePrizes($conn);\n // take one prize\n $prizeOpt = $list[rand(0, count($list) - 1)];\n $prizeName = $prizeOpt[0];\n $prizeValue = $prizeOpt[1];\n $prizeVoucher = getRandomVoucher($prizeName, $prizeValue, $conn);\n $price = $prizeOpt[1];\n $result[$playerChoise - 1] = [$prizeName, $price];\n // change prize's status as given\n updatePrize($prizeName, $prizeValue, $prizeVoucher, $email, $conn);\n // HERE YOU CONNECT SEDNING EMAILS\n sendEmail($email, $code, $fname, $prizeName, $prizeValue);\n } else {\n // changing the code status and full fill the user data to it\n updateCode($fname, $email, $number, $code, $mailing, 'loose', $conn);\n $result[9] = \"false\";\n $result[$playerChoise - 1] = ['loose'];\n }\n } else {\n $result[9] = \"false\";\n $result[$playerChoise - 1] = ['loose'];\n }\n if ($result[9] == \"false\") {\n }\n\n $result = generateOthersPrizes($result, $playerChoise);\n for ($i = 0; $i < 9; $i++) {\n if (is_null($result[$i])) {\n $result[$i] = ['loose'];\n }\n }\n $conn->close();\n echo json_encode($result);\n}", "function gooi(){\n $ogen = array(random(),random(),random(),random(),random());\n for($i = 0;$i<5;$i++){\n $strings = (\"nummer \".($i + 1).\" is \".$ogen[$i].\"<br>\");\n echo $strings;\n }\n $sum = array_sum($ogen);\n var_export(\"het totaal is \".$sum);\n}", "function rand_num() {\n\t\t\t\t\n\t\t\t\t$r = rand(1000000, 9999999);\n\t\t\t\treturn $r;\n\t\t\t\n\t\t\t}", "public function testCheckWinner()\n {\n $rawBoard = [2,2,1,0,1,1,2,2,2];\n $feedback = [0=>8, 1=>1, 2=>6, 3=>3, 4=>5, 5=>7, 6=>4, 7=>9, 8=>2];\n $formatedBoardRow = 0;\n foreach ($feedback as $index=>$value) {\n if ($index%3==0) {\n $formatedBoardRow++;\n }\n if ($rawBoard[$index] == 1) {\n $formatedBoard[$formatedBoardRow][$value] = \"X\";\n }\n if ($rawBoard[$index] == 2) {\n $formatedBoard[$formatedBoardRow][$value] = \"O\";\n }\n }\n $this->_board = $formatedBoard;\n\n $playerOneAnswers = [];\n $playerTwoAnswers = [];\n foreach ($this->_board as $boardIndex => $boardRow) {\n foreach ($boardRow as $boardRowIndex => $boardRowValue) {\n if ($boardRowValue == \"X\") {\n $this->_scorePlayerOne += $boardRowIndex;\n $playerOneAnswers[] = $boardRowIndex;\n }\n if ($boardRowValue == \"O\") {\n $this->_scorePlayerTwo += $boardRowIndex;\n $playerTwoAnswers[] = $boardRowIndex;\n }\n }\n }\n\n $whoHasWon = 0;\n if ($this->_scorePlayerOne == 15) {\n $whoHasWon = 1;\n }\n\n if ($this->_scorePlayerTwo == 15) {\n $whoHasWon = 2;\n }\n\n if ($whoHasWon == 0) {\n foreach ($this->_winningConditions as $winningCondition) {\n $playerOneMatchResult = array_intersect(\n $playerOneAnswers, $winningCondition\n );\n if (count($playerOneMatchResult) ==3) {\n $whoHasWon = 1;\n }\n\n $playerTwoMatchResult = array_intersect(\n $playerTwoAnswers, $winningCondition\n );\n if (count($playerTwoMatchResult) ==3) {\n $whoHasWon = 2;\n }\n }\n }\n\n //$this->assertGreaterThan($this->_maxScore, $this->_scorePlayerOne);\n //$this->assertEquals($this->_scorePlayerTwo, 10);\n\n $this->assertNotEquals(1, $whoHasWon);\n $this->assertEquals(2, $whoHasWon);\n }", "function make_rough_schedule($nlanes, $ncars, $nrounds) {\n $generators = get_generators($nlanes, $ncars);\n if ($nrounds > count($generators)) {\n $nrounds = count($generators);\n }\n\n $heats = array();\n for ($round = 0; $round < $nrounds; ++$round) {\n $gen = $generators[$round];\n for ($h = 0; $h < $ncars; ++$h) {\n $heat = array();\n $heat[] = $h;\n for ($lane = 1; $lane < $nlanes; ++$lane) {\n $heat[] = ($heat[$lane - 1] + $gen[$lane - 1]) % $ncars;\n }\n $heats[] = $heat;\n }\n }\n // echo \"<rough-schedule>\\n\"; var_dump($heats); echo \"</rough-schedule>\\n\";\n\n return $heats;\n}", "function new_word($newword, $number){\n\t\n\t$symbols = '!@#$%^&*?';\n\t$newstring = \"\";\t\n\t$char = \"\";\n\t$use_numbers = isset($_POST['numbers']);\n\t$use_characters = isset($_POST['symbols']);\n\t\n\t\n\tif($use_numbers == 1 && $use_characters != 1) { // functoin for this\n\t\tforeach (range(0,$number) as $i){\n\t\t$char = rand(0,9);\n\t\t}\n\t}\n\telseif($use_numbers == 1 && $use_characters == 1) {\n\t\t$char = $symbols[rand(0, strlen($symbols)-1)] . rand(0,9);\n\t}\n\telseif($use_numbers != 1 && $use_characters == 1) {\n\t\t$char = $symbols[rand(0, strlen($symbols)-1)];\n\t}\n\telse {\n\t\t$char = \"\";\n\t}\n\t\n\t\n\tforeach (range(0,$number) as $i){\n\t\t$index = array_rand($newword);\t\n\t\t$newstring .= $newword[$index] . \"-\";\n\t\t\n\t}\n\t\n\treturn rtrim($newstring,'-') . $char;\n\t\n}", "function random(){\n $randomnummer = rand(1,6);\n return $randomnummer;\n}", "private function get_rolls($num) { if($num > count($this->rolls)) {\n // if not, get more dice rolls\n // make sure we get at least as many rolls as we need. Otherwise,\n // use 90 (if it's bigger), to save on API calls\n $req = (90 > $num) ? 90 : $num;\n $this->rolls = $this->get_integers($req, 1, 6);\n }\n // peel off the requested number of rolls and return them\n return array_splice($this->rolls,0,$num);\n }", "private function generateNextQuestion(){\n while(true) {\n $id = rand($this->minId, /*$this->maxId*/20);\n\n if (!in_array($id, $this->answeredQuestions)) {\n array_push($this->answeredQuestions,$id);\n return $id;\n }\n }\n }", "static function xOfAKind( $cards, $num ) {\n # reverse sort because we need to find the highest 3 of a kind\n usort( $cards, array( \"poker\", \"card_rcmp\" ) );\n $last_number = 0;\n $score = 0;\n foreach ($cards as $card) {\n if ( $last_number == 0 ) {\n $last_number = $card->number;\n } else {\n if ( $card->number == $last_number ) {\n //print $card->number.\"vs\".$last_number.\" - \".($score+1).\"\\r\\n\";\n $last_number = $card->number;\n $score++;\n if ( $score >= ($num-1) ) {\n if ( $num == 4 ) {\n # four of a kind\n return array_merge( array( 700+$last_number ), self::kicker( $cards, 1, array($last_number) ) );\n } elseif ( $num == 3 ) {\n # check if it has pairs, if yes: full house\n $hasPairs = self::findPairs( $cards, $last_number );\n if ( $hasPairs[0] > 100 ) {\n return array(600+$last_number, 600+($hasPairs[0]%100));\n }\n # three of a kind\n return array_merge( array( 300+$last_number ), self::kicker( $cards, 2, array($last_number) ) );\n }\n }\n } else {\n $last_number = $card->number;\n $score = 0;\n }\n }\n }\n return 0;\n }", "abstract public function winner();", "function pick_prime() {\r\n\t\t$primes = array(13,17,23,29,43,57,71);\r\n\t\t$i = rand(0,6);\r\n\t\t$j = $primes[$i];\r\n\t\treturn($j);\r\n\t}", "public function generateResiNo()\n {\n\n $resi = 'AMSYS'.date('U').random_int(100, 999);\n return $resi;\n }", "public function createMatchups($pool,$naming=false) {\n\t\t\n\t\t// therefore, if the first match is filled in, all of them should be filled in\n\t\tif ($pool->Rounds[1]->Matches[1]->home_team_id != null) {\n\t\t\techo \"matchups have already been created. Previous games will be overwritten now! <br>\";\n\t\t}\n\t\t\n\t\tFB:: log(\"naming is \".(($naming) ? \"on\" : \"off\"));\n\t\t\n\t\t// we follow the algorithm described on http://en.wikipedia.org/wiki/Round-robin_tournament\n\t\t// If n is the number of competitors, a pure round robin tournament requires \\begin{matrix} \n\t\t// \\frac{n}{2} \\end{matrix}(n - 1) games. If n is even, then in each of (n - 1) rounds, \n\t\t// \\begin{matrix} \\frac{n}{2} \\end{matrix} games can be run in parallel, provided there \n\t\t// exist sufficient resources (e.g. courts for a tennis tournament). If n is odd, there will be \n\t\t// n rounds with \\begin{matrix} \\frac{n - 1}{2} \\end{matrix} games, and one competitor having \n\t\t// no game in that round.\n\n\t\t// The standard algorithm for round-robins is to assign each competitor a number, and pair them off in the first round …\n\t\t//\n\t\t//Round 1. (1 plays 14, 2 plays 13, ... )\n\t\t// 1 2 3 4 5 6 7\n\t\t// 14 13 12 11 10 9 8\n\t\t//\n\t\t//… then fix one competitor (number one in this example) and rotate the others clockwise …\n\t\t//\n\t\t//Round 2. (1 plays 13, 14 plays 12, ... )\n\t\t// 1 14 2 3 4 5 6\n\t\t// 13 12 11 10 9 8 7\n\t\t//\n\t\t//Round 3. (1 plays 12, 13 plays 11, ... )\n\t\t// 1 13 14 2 3 4 5\n\t\t// 12 11 10 9 8 7 6\n\t\t//\n\t\t// until you end up almost back at the initial position\n\t\t//\n\t\t//Round 13. (1 plays 2, 3 plays 14, ... )\n\t\t// 1 3 4 5 6 7 8\n\t\t// 2 14 13 12 11 10 9\n\t\t//\n\t\t// If there are an odd number of competitors, a dummy competitor can be added, whose scheduled opponent in a \n\t\t// given round does not play and has a bye. The schedule can therefore be computed as though the dummy were \n\t\t// an ordinary player, either fixed or rotating. The upper and lower rows can indicate home/away in sports, \n\t\t// white/black in chess, etc.; to ensure fairness, this must alternate between rounds since competitor 1 \n\t\t// is always on the first row. If, say, competitors 3 and 8 were unable to fulfill their fixture in the \n\t\t// third round, it would need to be rescheduled outside the other rounds, since both competitors would \n\t\t// already be facing other opponents in those rounds. More complex scheduling constraints may require more complex algorithms.\n\t\t\n\t\t\n\t\t// initialize first row with team_id's of first half of teams\n\t\t// initialize second row with team_id's of second half of teams\n\t\t\n\t\t$nrTeams = count($pool->PoolTeams); // might be zero if no teams have been moved into this pool yet\n\t\tif ($nrTeams == 0 && !$naming) {\n\t\t\tdie('number of teams should not be zero when we are not just naming matches');\n\t\t}\n\t\t\n\t\tfor ($i=0 ; $i<$nrTeams/2 ; $i++) {\n\t\t\t$row1[]=$pool->PoolTeams[$i]->team_id;\n\t\t\tif ($i+ceil($nrTeams/2) < $nrTeams) {\n\t\t\t\t$row2[]=$pool->PoolTeams[$i+ceil($nrTeams/2)]->team_id; \n\t\t\t} else { \n\t\t\t\t$row2[]=null; // add a BYE team\n\t\t\t}\n\t\t}\n\t\t\n\t\tif ($naming) { // no teams have been filled in so far\n\t\t\t$nrTeams=$pool->spots;\t\t\t\n\t\t\tfor ($i=0 ; $i < $nrTeams/2 ; $i++) {\n\t\t\t\t$row1[]=$i+1;\n\t\t\t\tif ($i+ceil($nrTeams/2) < $nrTeams) {\n\t\t\t\t\t$row2[]=$i+ceil($nrTeams/2)+1; \n\t\t\t\t} else { \n\t\t\t\t\t$row2[]=null; // add a BYE team\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tFB::table('row1',$row1);\n\t\tFB::table('row2',$row2);\n\t\t\n\t\tif ($this->numberOfRounds == 0) { \n\t\t\t$this->numberOfRounds = $this->calculateNumberOfRounds($nrTeams); \n\t\t}\n\t\t\n\t\tfor ($i=0 ; $i<$this->numberOfRounds ; $i++) {\n\t\t\t// read of pairings of this round\n\t\t\tfor ($j=0 ; $j < ceil($nrTeams/2) ; $j++) {\n\t\t\t\tif ($naming) {\n\t\t\t\t\t$pool->Rounds[$i]->Matches[$j]->homeName = (($row1[$j]>0) ? \"Team \".$row1[$j] : \"BYE\");\n\t\t\t\t\t$pool->Rounds[$i]->Matches[$j]->awayName = (($row2[$j]>0) ? \"Team \".$row2[$j] : \"BYE\");\n\n\t\t\t\t\t$pool->Rounds[$i]->Matches[$j]->matchName = (($row1[$j]*$row2[$j]>0) ? \"Match rank \".($j + 1) : \"BYE match\");\n\t\t\t\t} else {\n\t\t\t\t\t$pool->Rounds[$i]->Matches[$j]->link('HomeTeam', array($row1[$j]));\n\t\t\t\t\t$pool->Rounds[$i]->Matches[$j]->link('AwayTeam', array($row2[$j]));\n\t\t\t\t\t$pool->Rounds[$i]->Matches[$j]->save();\n//\t\t\t\t\t$pool->Rounds[$i]->Matches[$j]->home_team_id = $row1[$j];\n//\t\t\t\t\t$pool->Rounds[$i]->Matches[$j]->away_team_id = $row2[$j];\n\t\n\t\t\t\t\tif ($pool->Rounds[$i]->Matches[$j]->away_team_id != null && $pool->Rounds[$i]->Matches[$j]->home_team_id != null) {\n\t\t\t\t\t\t// fill in random scores for testing\n//\t\t\t\t\t\t$pool->Rounds[$i]->Matches[$j]->homeScore = rand(0,15);\n//\t\t\t\t\t\t$pool->Rounds[$i]->Matches[$j]->awayScore = rand(0,15);\t\n//\t\t\t\t\t\t$pool->Rounds[$i]->Matches[$j]->scoreSubmitTime = time();\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\t\t\t\n\t\t\t// shift all but the first element of the first row by one\t\t\t\t\n\t\t\t$lastElementRow1=array_pop($row1); // pop last element off the first row\t\t\t\n\t\t\tarray_push($row2,$lastElementRow1); // push it onto the end of second row\n\n\t\t\t$firstElementRow2=array_shift($row2); // pop first element off the second row\t\t\t\n\t\t\t$firstElementRow1=array_shift($row1); // temporarily save first element of first row\n\t\t\tarray_unshift($row1,$firstElementRow2); // fill up the first row again\n\t\t\tarray_unshift($row1,$firstElementRow1);\n\n\t\t\tFB::log(\"after Round \".($i+1));\n\t\t\tFB::table('row1',$row1);\n\t\t\tFB::table('row2',$row2);\n\t\t\t\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t\t$pool->save();\n\t\t\n\t}", "function rand_blade(){\n\t\t$list = array ('blade', 'broadsword', 'claymore', 'dao', 'gladius', 'katana', 'longsword', 'odachi', 'rapier', 'sabre', 'shortsword', 'sword', 'wakazashi');\n\t\t$i = count($list);\n\t\treturn $list[mt_rand(0,$i-1)];\n\t}", "function generateDeck() {\n $suits = array(\"clubs\", \"spades\", \"hearts\", \"diamonds\");\n $deck = array();\n for($i=0;$i<=3;$i++){\n for($j=1;$j<=13;$j++){\n $card = array(\n 'suit' => $suits[$i],\n 'value' => $j\n );\n $deck[] = $card;\n }\n }\n shuffle($deck);\n return $deck;\n }", "function getExtensionFactory($game_id, $round_number, $company_id, $factory_number){\r\n\t\t\t$result = 0;\r\n\t\t\t$capacity=new Model_DbTable_Decisions_Pr_Capacity();\r\n\t\t\t$extension_factory=$capacity->getExtensionWasCreated($game_id, $company_id, $factory_number);\r\n\t\t\tfor ($round = 2; $round < $round_number; $round++) {\r\n\t\t\t\t$result+=$extension_factory['factory_number_'.$factory_number]['capacity_'.$round];\r\n\t\t\t\t// $round_created=$extension_factory['factory_number_'.$factory_number]['round_number_created_'.$round];\r\n\t\t\t\t// //var_dump($round_created);\r\n\t\t\t\t// if($round_number>$round_created){\r\n\t\t\t\t\t// $extension[$round]=$extension_factory['factory_number_'.$factory_number]['capacity_'.$round];\r\n\t\t\t\t\t// //var_dump($extension);\r\n\t\t\t\t// }\r\n\t\t\t\t// else {\r\n\t\t\t\t\t// $extension[$round]=0;\r\n\t\t\t\t// }\r\n\t\t\t\t// $result+=$extension[$round];\r\n\t\t\t\t// if($result==null){\r\n\t\t\t\t\t// $result=0;\r\n\t\t\t\t// }\r\n\t\t\t}\r\n\t\t\treturn $result;\t\t\r\n\t\t}", "function rand_color(){\n\t\t$list = array ('azure', 'amber','black', 'blue', 'cobalt', 'copper', 'bronze', 'tan', 'crimson', 'dark', 'brown', 'desert', 'emerald', 'foliage', 'gold', 'green', 'indigo', 'ivory', 'navy', 'olive', 'onyx', 'orange', 'pink', 'platinum', 'red', 'rose', 'ruby', 'sapphire', 'slate', 'silver', 'smoke', 'turquoise', 'violet', 'yellow');\n\t\t$i = count($list);\n\t\treturn $list[mt_rand(0,$i-1)];\n\t}", "public function generate(array $board, array $from);", "private function BankAccountGenerator()\r\n\t{\r\n\t\t$num = 0;\r\n\t\t\r\n\t\tfor ($i = 0; $i < 16; $i++)\r\n\t\t{\r\n\t\t\t$num .= rand(0,9);\r\n\t\t}\r\n\t\t\r\n\t\treturn (integer)$num;\r\n\t}" ]
[ "0.66740984", "0.6458077", "0.5894908", "0.5891992", "0.57814527", "0.57438004", "0.55830646", "0.55447805", "0.548594", "0.54627687", "0.5455086", "0.5410818", "0.5391878", "0.5391666", "0.5367776", "0.53535694", "0.53379446", "0.532294", "0.5312466", "0.5283265", "0.5272764", "0.5270182", "0.52593243", "0.5243123", "0.5238013", "0.52343094", "0.5232743", "0.5222664", "0.52080375", "0.51975477", "0.5192161", "0.5192161", "0.5192161", "0.51669794", "0.5132559", "0.5132559", "0.51272947", "0.5118661", "0.5118116", "0.51099545", "0.51071507", "0.51023567", "0.51023567", "0.50800437", "0.5078803", "0.5077602", "0.5075581", "0.50542235", "0.5041276", "0.5040193", "0.503588", "0.50261617", "0.5023015", "0.50201225", "0.5005888", "0.50032777", "0.500327", "0.49712455", "0.49652883", "0.49630484", "0.49618638", "0.4960545", "0.49410728", "0.4933034", "0.4927836", "0.49275675", "0.49205047", "0.49160996", "0.49018535", "0.4897676", "0.48967922", "0.48967922", "0.48955992", "0.48921004", "0.4889654", "0.4889631", "0.48819402", "0.48701164", "0.48520645", "0.48467618", "0.48417628", "0.48286733", "0.48276615", "0.48201656", "0.48151734", "0.48050314", "0.48026064", "0.47955343", "0.47942823", "0.47895175", "0.47878477", "0.47851846", "0.47745", "0.47675526", "0.47643617", "0.4763907", "0.47618496", "0.47617817", "0.4760095", "0.47600636" ]
0.6060513
2
fn object win number in list
public function findTicketNumber($winNumber = -1, $ticketNumbers = array()){ foreach ($ticketNumbers as $index => $ticketNumber) { if ((int)$ticketNumber->number === (int)$winNumber) { return $ticketNumber; } } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function whoWins(){\n $winners = array();\n $n = 100;\n for($i=0;$i<=$n;$i++){\n $winner = playTournament();\n if(!isset($winners[$winner])){\n $winners[$winner] = 1;\n } else {\n $winners[$winner] += 1;\n }\n }\n arsort($winners);\n foreach($winners as $key=>$value){\n echo $key.' '.$value.\"\\n\";\n }\n}", "function getLessIndex($packList,$start,$num)\n{\n for ($i=$start;$i<count($packList);$i++)\n {\n if((int)$packList[$i]['pack_of']>$num)\n {\n $i++;\n }else{\n return $i;\n }\n }\n}", "public function getWinPoints() : int {\n\t\treturn $this->winPoints;\n\t}", "public function rewardWinners(& $wins,& $table){\n\t\t$pots=& $table->game_pots;\n\t\t$leftOvers=$pots[\"left_overs\"]->amount;\n\t\t$x.=print_r($wins,true);\n\t\t$x.=\"\\n\\n\";\n\t\tforeach ($wins as $points=>$winners){// loop through winners by highest points , search for elegible pot then add that pot to the users'amount'\n\t\t\t$pot_on=count($winners); // how many winners for single pot ?\n\t\t\t$x.= \"got $pot_on winners with score of $points\\n\";\n\t\t\tif ($pon_on=='1'){\n\t\t\t\t$table->dealerChat($pot_on.' winner .');\n\t\t\t}elseif($pon_on>'1'){\n\t\t\t\t$table->dealerChat($pot_on.' winners .');\n\t\t\t}\n\t\t\t$winName=$this->getWinName($points);\n\t\t\t//generate win text\n\t\t\t$winText=' With <label class=\"hand_name\">'.$winName->handName.'</label>' ;\n\t\t\tif ($winName->handName=='High Card'){\n\t\t\t\t$winText.=' '.$winName->normalKicker ;\n\t\t\t}else{\n\t\t\t\tif (isset($winName->doubleKicker)){\n\t\t\t\t\t$winText.=' of '.$winName->doubleKicker ;\n\t\t\t\t}\n\t\t\t\tif ((isset($winName->normalKicker) && !isset($winName->doubleKicker)) || isset($winName->normalKicker) && isset($winName->doubleKicker) && $winName->doubleKicker!=$winName->normalKicker){\n\t\t\t\t\t$winText.=' and '.$winName->normalKicker.' kicker' ;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tforeach ($winners as $winnerId){\n\t\t\t\t$x.= \" - checking winner $winnerId :\\n\";\n\t\t\t\t//search for pots who has this player id\n\t\t\t\t$winPlayer=new Player($winnerId);\n\t\t\t\t\t$x.= \" - Winner is $winPlayer->display_name $winPlayer->seat_id has $ $winPlayer->amount :\\n\";\n\t\t\t\t\tforeach ($pots as $id=>$pot){\n\t\t\t\t\t\tif ($pot->amount>0 && $id!=='left_overs'){\n\t\t\t\t\t\t\t$pot->amount+=$leftOvers;\n\t\t\t\t\t\t\t$leftOvers=0;\n\t\t\t\t\t\t\tif (!isset($pot->original_amount)){$pot->original_amount=$pot->amount;}\n\t\t\t\t\t\t\t$winAmount=round($pot->original_amount/$pot_on);\n\t\t\t\t\t\t\tif (in_array($winnerId,$pot->eligible)!==false){\n\t\t\t\t\t\t\t\t$pots[$id]->amount-=$winAmount;\n\t\t\t\t\t\t\t\t$winPlayer->amount+=$winAmount;\n\t\t\t\t\t\t\t\t$table->dealerChat($winPlayer->profile_link.' has won the pot <label class=\"cash_win\">($'.$winAmount.')</label> '.$winText.' .');\n\t\t\t\t\t\t\t\tif ($winAmount>0){$winPlayer->won=5;}else{$winPlayer->won=0;}\n\t\t\t\t\t\t\t\tif (substr($winPlayer->bet_name,0,6)=='<label'){\n\t\t\t\t\t\t\t\t\t$oldAmount=substr($winPlayer->bet_name,26,strpos($winPlayer->bet_name,'</label>')-26);\n\t\t\t\t\t\t\t\t\t$oldAmount+=$winAmount;\n\t\t\t\t\t\t\t\t\t$winPlayer->bet_name='<label class=\"winLabel\">+$'.$oldAmount.'</label>';\n\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\t$winPlayer->bet_name='<label class=\"winLabel\">+$'.$winAmount.'</label>';\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t$winPlayer->saveBetData();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}//\n\t\t\t\t\t}//\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t}//\n\t\t\t\n\t\t}//\n\t\tfile_put_contents('wins.txt',$x);\n\t\n\t}", "public function getWinCnt()\n {\n return $this->get(self::_WIN_CNT);\n }", "public function winRound() {\n\n\t\t$this->points++;\n\n\t\t$this->output($this->name.' has won this round');\n\t}", "function teamRecordWeek($record, $school, $week){\n $win = 0;\n $loss = 0;\n $tie = 0;\n\n foreach ($record as $key=>$result) {\n if($result[1] != NULL && $key <= $week){\n if($result[1] == $school){\n $win++;\n }\n elseif($result[1] == \"TIE\"){\n $tie++;\n }\n else{\n $loss++;\n }\n }\n }\n return $win . \" - \" . $loss . \" - \" . $tie;\n}", "function elementfinder($list1, $element){ \n $comparator=0; //container for the element at a particular index to be compared with the element to be found to be found\n $locator=0; \n $indexes=\"occuring at index(ices): \"; // gives the container for the number of timed the element was located\n $listlength=count($list1)-1; //efffective largest index of the given list\n \n for($i=0; $i<=$listlength;$i++){ //step through the list\n$comparator=$list1[$i]; //get the element at the current index\n/**if this element equals the element to be found, then upgrade the number of times the element has been found(that is the locator variable)and add the index it was found to the index variable */\nif($element==$comparator){\n $locator=$locator+1;\n $indexes=$indexes.$i. \" \";\n}\n }\n /** print out result and the given list operated upon */\n echo \"given the list: \"; print_r($list1); echo \"<br>\";\n echo $locator.\" matches found \";\n echo $indexes;\n return $locator;\n}", "public function getWins()\n {\n return $this->wins;\n }", "abstract public function winner();", "function win_check($token) {\r\n if ($this->debug && debug_backtrace()[1]['function'] == 'game_check') {\r\n echo '<br />> Check function called from Game for token ' . $token . '...<br />';\r\n }\r\n\r\n $this->winning_line = []; \r\n foreach ($this->win_lines as $line_type => $lines) {\r\n foreach ($lines as $line_name => $line) {\r\n $this->winning_line[0] = $line; \r\n $check_value = 0; \r\n $win_move = 0; \r\n foreach ($line as $pos) {\r\n if ($this->debug && debug_backtrace()[1]['function'] == 'game_check') {\r\n echo 'Checking for token ' . $token . ' in ' . $line_type . ' ' . $line_name . ' [' . implode(',', $line) . ']';\r\n }\r\n if ($this->position[$pos] != $token) {\r\n if (debug_backtrace()[1]['function'] == 'game_check') {\r\n\r\n if ($this->debug) {\r\n echo ' - Position ' . $pos . '. Result: Not Found. Skipping rest of ' . $line_name . '<br />';\r\n }\r\n break;\r\n } else if (debug_backtrace()[1]['function'] == 'pick_move') {\r\n $win_move = $pos;\r\n }\r\n } else {\r\n if ($this->debug && debug_backtrace()[1]['function'] == 'game_check') {\r\n echo ' - Position ' . $pos . '. Result: Found.<br />';\r\n }\r\n $check_value++;\r\n }\r\n }\r\n\r\n if (debug_backtrace()[1]['function'] == 'pick_move') {\r\n if ($check_value == ($this->grid_size - 1)) {\r\n if ($this->position[$win_move] == '-') {\r\n return $win_move;\r\n }\r\n }\r\n } else if (debug_backtrace()[1]['function'] == 'game_check') {\r\n if ($check_value == $this->grid_size) {\r\n if ($this->debug) {\r\n echo 'We have a winner!<br />';\r\n }\r\n return true;\r\n }\r\n }\r\n }\r\n }\r\n $this->winning_line = []; \r\n if (debug_backtrace()[1]['function'] == 'game_check') {\r\n return false;\r\n } else if (debug_backtrace()[1]['function'] == 'pick_move') {\r\n return -1;\r\n } else {\r\n return null;\r\n }\r\n }", "abstract protected function winnerExists();", "public static function winnersIds()\n {\n return DB::table('competitionentries')->where('winner', '=', 1)->get();\n }", "public function getWinners()\n\t{\n\t\treturn $this->winners;\n\t}", "function getNoWin() {\n return $this->records[1];\n }", "private function getCurrentUserRank($list)\n\t{\n\t foreach ($list as $row) {\n\t if ( $row['user_id'] === \\Auth::user()->id )\n\t return $row['rank'];\n\t }\n\n\t return null;\n\t}", "public function getOddsConstructorWinnar($results, $listOddsConstructorWinnar, $gridList, $circuitId, $offset) {\n // Checking if offset is smaller than constructors on the grid\n if ($offset < count($gridList)) {\n // Getting the offset of the grid\n $gridListOffset = $gridList[$offset];\n\n // Getting the variabels for the function\n $constructor = $gridListOffset;\n\n if (!empty($resultsConstructor)) {\n unset($resultsConstructor);\n }\n\n $resultsConstructor = array();\n\n // Getting the finishes of the driver\n $constructorResults = $this->getPositions($results, null, $constructor, 0, $this->offsetYear, $circuitId, $this->multiplier, null, $resultsConstructor, 2);\n array_push($resultsConstructor, $constructorResults);\n\n // Calculating the average position of the driver\n $oddsConstructor = @$this->calculateAveragePosistion(null, $resultsConstructor, 0, 0, count($results), null, $constructor, 2);\n array_push($listOddsConstructorWinnar, $oddsConstructor);\n\n // Updating variables for the function\n $offset++;\n return $this->getOddsConstructorWinnar($results, $listOddsConstructorWinnar, $gridList, $circuitId, $offset);\n } else {\n // Sorting the array from lowest to highest odds\n usort($listOddsConstructorWinnar, array($this, \"compareOdds\")); \n\n // Returning the filled array\n return $listOddsConstructorWinnar;\n }\n }", "public function revealTopCard(): int;", "function getwonum() {\n return $this->wonum;\n }", "function team_list()\n {\n }", "function runkit_object_id($obj) : int {\n}", "public function getWinsAttribute()\n {\n $wins = $this->allMatches()->filter(function ($match) {\n // Don't include playoff wins\n if ($match->isPlayoff()) {\n return false;\n }\n\n $home = ($this->id == $match->team1_id);\n if ($home && $match->team1_score > $match->team2_score) {\n return $match;\n }\n if (!$home && $match->team2_score > $match->team1_score) {\n return $match;\n }\n })->count();\n\n return $wins;\n }", "function board_list(){\n\t\tglobal $print, $x7s, $x7c, $db, $prefix;\n\t\t$head = \"\";\n\t\t$body='';\n\t\t\n\t\t$indice = indice_board();\n\n\n\t\t$q_new = $db->DoQuery(\"SELECT count(*) AS cnt FROM {$prefix}boardunread WHERE user='{$x7s->username}'\");\n\t\t$new_msg = $db->Do_Fetch_Assoc($q_new);\n\n\t\t$body=\"<b>Ci sono $new_msg[cnt] messaggi nuovi</b>\";\n\t\t\n\t\t$print->board_window($head,$body,$indice);\n\t\t\n\t}", "function getPlayinTeams(){\n return array(\n //winner to [25]\n array('name'=>'UCLA','elo'=>1542,'off'=>114.1,'def'=>96.8,'tempo'=>64.7),\n array('name'=>'Michigan State','elo'=>1596,'off'=>107.7,'def'=>92.2,'tempo'=>68.6),\n //winner to [17]\n array('name'=>'Texas Southern','elo'=>1395,'off'=>99.7,'def'=>104.3,'tempo'=>72.0),\n array('name'=>'Mt. St Marys','elo'=>1278,'off'=>96.1,'def'=>99.7,'tempo'=>62.2),\n //winner to [9]\n array('name'=>'Drake','elo'=>1540,'off'=>114.6,'def'=>98.6,'tempo'=>66.8),\n array('name'=>'Wichita State','elo'=>1592,'off'=>110.7,'def'=>97.7,'tempo'=>67.6),\n //winner to [1]\n array('name'=>'Appalachian State','elo'=>1378,'off'=>100.1,'def'=>103.0,'tempo'=>65.7),\n array('name'=>'Norfolk St','elo'=>1310,'off'=>101.3,'def'=>103.6,'tempo'=>67.7),\n );\n}", "public function getOddsDriverWinnar($results, $listOddsDriverWinnar, $gridList, $circuitId, $offset) { \n // Checking if offset is smaller than driver on the grid \n if ($offset < count($gridList)) {\n // Getting the offset of the grid\n $gridListOffset = $gridList[$offset];\n\n // Getting the variabels for the function\n $driver = $gridListOffset;\n\n if (!empty($resultsDriver)) {\n unset($resultsDriver);\n }\n\n $resultsDriver = array();\n\n // Getting the finishes of the driver\n $driverResults = $this->getPositions($results, $driver, null, 0, $this->offsetYear, $circuitId, $this->multiplier, $resultsDriver, null, 1);\n array_push($resultsDriver, $driverResults);\n\n // Calculating the average position of the driver\n $oddsDriver = @$this->calculateAveragePosistion($resultsDriver, null, 0, 0, count($results), $driver, null, 1);\n array_push($listOddsDriverWinnar, $oddsDriver);\n\n // Updating variables for the function\n $offset++;\n return $this->getOddsDriverWinnar($results, $listOddsDriverWinnar, $gridList, $circuitId, $offset);\n } else {\n // Sorting the array from lowest to highest odds\n usort($listOddsDriverWinnar, array($this, \"compareOdds\")); \n\n // Returning the filled array\n return $listOddsDriverWinnar;\n }\n }", "function checkWinner($game) {\n\tglobal $message ;\n\t$winner = \"999\";\n\t$board = $game[\"board\"];\n\t$cellClicked = $game[\"clicked\"];\n\tif ($game[\"clicked\"] !== 9) {\n\t\tsettype($cellClicked, \"string\");\n\t\t$winCombo = array(\"012\",\"345\",\"678\",\"036\",\"147\",\"258\",\"840\",\"246\");\n\t\tfor( $row = 0; $row < 8; $row++ ) {\t\n\t\t\t// identify which row, column, and diag has been changed by current selection\n\t\t\t$idx = ($cellClicked < 9) \n\t\t\t\t? substr_count($winCombo[$row], $cellClicked)\n\t\t\t\t: -1;\n\t\t\t// test only the changed row, columns, and diags\n\t\t\tif ($idx == 1) { \n\t\t\t\tif ( $board[$winCombo[$row][0]] == $board[$winCombo[$row][1]] && \n\t\t\t\t\t $board[$winCombo[$row][1]] == $board[$winCombo[$row][2]] ) \t{\t\n\t\t\t\t\t\t$game[\"winningCombo\"] = $board[$winCombo[$row][0]];\n\t\t\t\t\t\t$winner = $winCombo[$row];\t\n\t\t\t\t}\n\t\t\t}\n\t\t}\t\t\t\n\t\tif ($game[\"winningCombo\"] != -1) {\n\t\t\t$message = substr($game[\"playToken\"],$game[\"winningCombo\"],1) . \" wins\";\n\t\t}\n\t\telseif (count_chars($board,3) == \"01\") {\n\t\t\t$message = \"Game over. No winner\";\n\t\t}\n\t} \n\treturn $winner;\n}", "public function getShownpcsList(){\n return $this->_get(29);\n }", "public function displayWinner()\n {\n // Search in array scores, for the username with the highest score.\n $nameWinner = array_search(max($this->scores), $this->scores);\n $scoreWinner = max($this->scores);\n\n $this->console->stdInput(1);\n $this->console->getInpunt(\"De winnaar met \" . $scoreWinner[\"scoreTotal\"] . \" punten is: \" . $nameWinner . \"\\nPress enter to end the game!\");\n $this->console->stdInput(1);\n }", "function rankWiseResult($crwaler,$word){\r\n\t$rank = array();\r\n foreach($crwaler as $key => $value){\r\n foreach($value as $name => $count){\r\n if(strtolower($name) == strtolower($word)){\r\n $rank[$key] = $count;\r\n break;\r\n }\r\n \r\n }\r\n\t}\r\n\tarsort($rank);\r\n\treturn $rank;\r\n}", "private function getWinningBids()\n {\n //if the number of bids is less than max they're all winners\n if ($this->numBids < $this->maxNumber) {\n return $this->bids;\n } else {\n return array_slice($this->bids,0,$this->maxNumber);\n }\n }", "public function getDrawNumber();", "function find_callerid($number){\n $number = unify_number($number);\n foreach( find_entries_matching($number) as $entry ){\n return \"{$entry[\"name\"]} ({$entry[\"number\"]})\";\n }\n\n return $number;\n}", "function lotto(){\n $numbers = $_GET['numbers'];\n $numbers = [9, 14, 28, 36, 41, 49];\n\n foreach($numbers as $num){\n echo $num.\"<br>\";\n }\n \n echo \"<br><br><br>\";\n \n $win = [];\n $i = 1;\n \n while($i < 13){\n $number = mt_rand(1, 49);\n \n if(($i%2) == 0){\n if(!in_array($number, $win)){\n $win[$i] = $number;\n $i++;\n }\n } else{\n $i++;\n }\n }\n \n sort($win);\n \n foreach($win as $w){\n echo $w.\"<br>\";\n }\n \n echo \"<br><br><br>\";\n \n $same = [];\n \n foreach($numbers as $player){\n $count = count($same);\n foreach($win as $computer){\n if($player == $computer){\n $same[$count] = $player;\n }\n }\n }\n \n sort($same);\n \n foreach($same as $w){\n echo $w.\"<br>\";\n }\n }", "function teamRecordOverall($record, $school){\n $win = 0;\n $loss = 0;\n $tie = 0;\n\n foreach ($record as $key=>$result) {\n\n if($result[1] != NULL){\n if($result[1] == $school){\n $win++;\n }\n elseif($result[1] == \"TIE\"){\n $tie++;\n }\n else{\n $loss++;\n }\n }\n }\n return $win . \" - \" . $loss . \" - \" . $tie;\n}", "function displayWinner($total1, $total2, $total3, $total4, $person, $person2, $person3, $person4)\n {\n echo \"Winner: \";\n \n if($total1 > $total2 && $total1 > $total3 && $total1 > $total4)\n {\n echo \"<img src='\".$person[\"profilePicUrl\"].\"'>\";\n }\n else if ($total2 > $total1 && $total2 > $total3 && $total2 > $total4)\n {\n echo \"<img src='\".$person2[\"profilePicUrl\"].\"'>\";\n }\n else if($total3 > $total1 && $total3 > $total2 && $total3 > $total4)\n {\n echo \"<img src='\".$person3[\"profilePicUrl\"].\"'>\";\n }\n else if($total4 > $total1 && $total4 > $total2 && $total4 > $total3)\n {\n echo \"<img src='\".$person4[\"profilePicUrl\"].\"'>\";\n }\n else {\n echo \"More than one winner\";\n }\n \n }", "public function selectLeagueWinner($league, $team);", "public function getWholinemeList(){\n return $this->_get(2);\n }", "function getStartPlayerNo($minigame)\n {\n return (($minigame - 1) % self::getPlayersNumber()) + 1;\n }", "public function setWinCnt($value)\n {\n return $this->set(self::_WIN_CNT, $value);\n }", "public function winner()\n\t{\n\t\t$winner = array();\n\n\t\tif ($this->winnerExists())\n\t\t{\n\t\t\t$property_short = $this->winner->getStateData()->campaign_name;\n\n\t\t\t/*\n\t\t\t * Hacks ahoy. OLP requires all enterprise customers\n\t\t\t * to return tier 1 as of right now.\n\t\t\t */\n\t\t\t$tier = $this->winner->getStateData()->tier_number;\n\t\t\tif (Enterprise_Data::isEnterprise($property_short))\n\t\t\t{\n\t\t\t\t$tier = 1;\n\t\t\t}\n\n\t\t\t$winner = array(\n\t\t\t\t'tier'\t\t\t=> $tier,\n\t\t\t\t'original_tier'\t=> $this->winner->getStateData()->tier_number,\n\t\t\t\t'winner'\t\t=> $this->winner->getStateData()->campaign_name,\n\t\t\t\t'fund_amount'\t=> $this->winner->getStateData()->qualified_loan_amount,\n\t\t\t\t'state_data' \t=> $this->winner->getStateData(),\n\t\t\t);\n\t\t\t\n\t\t\tif (!empty($this->winner->getStateData()->is_react))\n\t\t\t{\n\t\t\t\t$winner['react'] = (bool) $this->winner->getStateData()->is_react;\n\t\t\t}\n\t\t}\n\n\t\treturn $winner;\n\t}", "public function getFunction($obj);", "public function getWindows() {\n return $this->windows;\n }", "function group_badge($group,$current_player,$winning=false){\n//var_dump($group['proportions']);\n?>\n\n<div class=\"group<?php if($winning) { echo \" winning\"; } ?>\" style=\"margin:5px;\">\n\t<?php\n\tif($winning){?>\n\t\t<img src=<?php echo '\"' . base_url('img/dollar.png') . '\"'; ?> width=\"64\" style=\"float:left;margin:5px;\">\n\t<?php } else { ?>\n\t\t<img src=<?php echo '\"' . base_url('img/no_dollar.png') . '\"'; ?> width=\"64\" style=\"float:left;margin:5px;\">\n\t<?php }\n\tarsort($group['proportions']);\n\tforeach ($group['proportions'] as $agent => $proportion) {\n\n\t\t$powers = array($agent=>($proportion*$group['power']));\n\n\t\tagent_badge($powers,$agent,($agent==$current_player));\n\t}\n\t?>\n</div><br />\n\n<?php\n}", "public function get_winning_team()\n {\n if ($this->score_team_1 > $this->score_team_2) {\n return Game::TEAM_1;\n }\n if ($this->score_team_2 > $this->score_team_1) {\n return Game::TEAM_2;\n }\n }", "public function listDisplayElements();", "public function winningNumber(): Relation\n {\n return $this->belongsTo('App\\Models\\WinningNumber', 'winning_number_ids');\n }", "public function getNumber()\n {\n foreach ($this->getGame()->getLegs() as $idx=>$leg) {\n if ($leg == $this) {\n return $idx+1;\n }\n }\n\n return null;\n }", "function SprWymiar($macierz){\n\t\t\t$wymiar=1;\n\t\t\twhile(isset($macierz[$wymiar][1])){\n\t\t\t\t$wymiar++;\n\t\t\t}\n\t\t\treturn $wymiar-1; \n\t\t}", "function getIndex() ;", "function tourney_rank_win($tournament, $contestant) {\n if (!tourney_rank_exists($tournament, $contestant)) tourney_rank_create($tournament, $contestant);\n db_update('tourney_rank')\n ->expression('wins', 'wins + 1')\n ->expression('rank', 'rank - 1')\n ->condition('tournament', $tournament->id)\n ->condition('entity_type', $contestant->entity_type)\n ->condition('entity_id', $contestant->entity_id)\n ->execute();\n}", "function checkShowWorldWonder($wg_buildings,$village)\n{\n\tglobal $db,$user;\n\t$world_wonder=0;\n\t$array=array();\n\tif(empty($wg_buildings))\n\t{\n\t\t$wg_buildings=getBuildings($village);\n\t}\n\tforeach($wg_buildings as $key=>$value)\n\t{\n\t\tif($value->type_id==37)\n\t\t{\n\t\t\t$world_wonder=1;\t\t\n\t\t\tbreak;\n\t\t}\n\t}\n\t/*\n\tDa du Dk xay dung ky dai moi'\n\t1. so thanh >=2\n\t2. du so bau vat\n\t4. vi tri index 33->36 rong\n\t*/\n\tif($world_wonder==0)\n\t{\n\t\t$check=0;\n\t\t$sql = \"SELECT COUNT(DISTINCT(id)) FROM wg_villages WHERE user_id=\".$user['id'].\"\";\n\t\t$db->setQuery($sql);\n\t\t$count = (int)$db->loadResult();\n\t\tforeach($wg_buildings as $key=>$value)\n\t\t{\n\t\t\tif($value->type_id==12 && $value->level >0)\n\t\t\t{\n\t\t\t\t$check++;\t\n\t\t\t}\n\t\t\tif($value->index>=33 && $value->index<=36)\n\t\t\t{\n\t\t\t\tif($value->level==0)\n\t\t\t\t{\n\t\t\t\t\t$check++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif($count>1 && $check==5 && checkRareExits($village)==1)\n\t\t{\n\t\t\treturn 1;\n\t\t}\t\n\t\treturn 0;\n\t}\n\treturn 1;\n}", "function mini_group($json,$num_agents,$id,$coalitions,$highlight=false,$clickable=true){\n\techo \"<div id='$id' class='suggestion\";\n\tif($highlight){\n\t\techo \" suggestion_selected\";\n\t}\n\tif(!$clickable){\n\t\techo \" no_pointer\";\n\t}\n\techo \"'>\";\n\t//var_dump(str_split($id));\n\t//echo \"<div>\" . $coalitions[$id]['proportions'][$_SESSION['current_player']]. \"</div>\";\n\t\n\t//\n\techo \"<div class='stats_left'>C</div><div class='stats_right proposed_payout'>\";\n\t/**\n\t * Code for tie TODO\n\t */\n\t//var_dump($json['proposer']);\n\tif(array_key_exists($json['proposer'],$coalitions[0]['proportions'])!=false){\n\t\techo round($coalitions[0]['proportions'][$json['proposer']]*100);\n\t} else {\n\t\techo 0;\n\t}\n\techo \"</div>\";\n\t$member_array = str_split($id);\n\t// add zeros to the front if this array is too small\n\t$member_array = array_pad($member_array, -$num_agents, '0');\n\t//var_dump($member_array);\n\tforeach ($member_array as $agent => $in_group) {\n\t\tif($in_group==='1'){\n\t\t\tif($agent==$json['proposer']){\n\t\t\t\techo \"<div class='mini_badge current_player'>\" . ($agent+1) . \"</div>\";\n\t\t\t} else {\n\t\t\t\techo \"<div class='mini_badge style_\" . ($agent+1) . \"'>\" . ($agent+1) . \"</div>\";\n\t\t\t}\n\t\t\t\n\t\t}\n\t}\n\techo \"</div>\";\n}", "function getWinProb($n){\n return 1 / (1 + pow(10,((-1*$n)/400)));\n}", "public function testVerifyToWin()\n {\n $match = $this->createMatch();\n\n foreach([0, 1, 2, 3, 4, 5, 6, 7, 8] as $position) {\n $this->createMove($position, $match->id);\n }\n\n foreach([0, 1, 2] as $position) {\n\n $move = Move::where('position', $position)\n ->where(\"match_id\", $match->id)\n ->first();\n\n $move->value = 1;\n $move->save();\n\n }\n\n $winner = new Winner();\n $winner->verify($match, $position, 1);\n\n $matchFound = Match::find($match->id);\n\n $this->assertEquals(1, $matchFound->winner);\n\n }", "public static function get_list_win($who)\n {\n $unique = self::$unique_user_obj->get_unique_user();\n $user_id = self::$storage_obj->get_id_user($unique);\n $result = self::$storage_obj->get_list_win($who, $user_id);\n\n return response()->json(['result' => $result]);\n }", "static function xOfAKind( $cards, $num ) {\n # reverse sort because we need to find the highest 3 of a kind\n usort( $cards, array( \"poker\", \"card_rcmp\" ) );\n $last_number = 0;\n $score = 0;\n foreach ($cards as $card) {\n if ( $last_number == 0 ) {\n $last_number = $card->number;\n } else {\n if ( $card->number == $last_number ) {\n //print $card->number.\"vs\".$last_number.\" - \".($score+1).\"\\r\\n\";\n $last_number = $card->number;\n $score++;\n if ( $score >= ($num-1) ) {\n if ( $num == 4 ) {\n # four of a kind\n return array_merge( array( 700+$last_number ), self::kicker( $cards, 1, array($last_number) ) );\n } elseif ( $num == 3 ) {\n # check if it has pairs, if yes: full house\n $hasPairs = self::findPairs( $cards, $last_number );\n if ( $hasPairs[0] > 100 ) {\n return array(600+$last_number, 600+($hasPairs[0]%100));\n }\n # three of a kind\n return array_merge( array( 300+$last_number ), self::kicker( $cards, 2, array($last_number) ) );\n }\n }\n } else {\n $last_number = $card->number;\n $score = 0;\n }\n }\n }\n return 0;\n }", "function displayBoard() {\n\tglobal $game, $output;\t\n\t$board = $game[\"board\"];\n\tif ($game[\"clicked\"] == 9) {\n\t\tfor( $i = 0; $i < 9; $i++ ) {\n\t\t\t$output .= '<td><input class=\"available\" type=\"submit\" name=\"curCell\" placeholder=\"-\" value=\"' . $i . '\"></td>';\n\t\t\tif(($i+1)% 3 == 0 && $i < 8)\n\t\t\t\t$output .= \"</tr><tr>\";\t\n\t\t}\t\t\n\t}\n\tif ($game[\"clicked\"] != 9) {\n\t\t$curWinner = checkWinner($game); //print_r($curWinner);\t\t \n\t\tfor( $i = 0; $i < 9; $i++ ) {\t\t\n\t\t\tswitch ($board[$i]) {\n\t\t\t\tcase 2:\n\t\t\t\t\t$output .= ($curWinner > 990)\n\t\t\t\t\t\t? '<td><input class=\"available\" type=\"submit\" name=\"curCell\" placeholder=\"-\" value=\"' . $i . '\"></td>'\n : \"<td class='played'></td>\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase 0:\n\t\t\t\t\t$output .= (substr_count($curWinner, $i)) \n\t\t\t\t\t\t? \"<td class='winner'>X</td>\"\n : \"<td class='played'>X</td>\";\t\n\t\t\t\t\tbreak;\n\t\t\t\tcase 1:\n\t\t\t\t\t$output .= (substr_count($curWinner, $i)) \n\t\t\t\t\t\t? \"<td class='winner'>O</td>\"\n : \"<td class='played'>O</td>\";\t\n\t\t\t\t\tbreak;\t\t\t\n\t\t\t}\t\n\t\t\tif(($i+1)% 3 == 0 && $i < 8)\n\t\t\t\t$output .= \"</tr><tr>\";\t\n\t\t}\n\t} \n\treturn $output;\n}", "public function rank();", "function chcekTheWinner($dom, $owner){\n $instance = DbConnector::getInstance();\n $playersList = handEvaluator();\n usort($playersList, array(\"Player\", \"cmp\")); \n $i = 0;\n echo \"<div id=\\\"summary\\\"><div>--- Summary ---</div>\";\n echo \"<table border=\\\"1\\\" BORDERCOLOR=RED style=\\\"width:100%\\\"><tr><th>Player</th><th>Score</th><th>Hand</th><th>Cards</th></tr>\";\n foreach($playersList as $player){ \n if($i === 0){\n $sql = \"SELECT `TotalMoneyOnTable`, `Transfer` FROM `TableCreatedBy_\" . $owner . \"` where `user`='\" . $player->player . \"';\"; \n $retval = $instance->sendRequest($sql);\n while ($row = mysql_fetch_row($retval)) {\n $value = $row[0];\n $flag = $row[1];\n }\n if($flag == 0){ //transfer money to accunt\n $sql = \"UPDATE `TableCreatedBy_\" . $owner . \"` SET `Money` = `Money` + \".$value.\", `Transfer`=1 where `user`='\" . $player->player . \"';\"; \n $retval = $instance->sendRequest($sql);\n }\n echo \"<td>\" . $player->player . \" won \".$value.\"</td><td>\". $player->cardsValue . \"</td><td>\" . $player->handValue . \"</td><td>\" . $player->hand . \"</td></tr>\";\n }else{\n echo \"<td>\" . $player->player . \"</td><td>\". $player->cardsValue . \"</td><td>\" . $player->handValue . \"</td><td>\" . $player->hand . \"</td></tr>\";\n }\n $i++;\n }\n echo \"</table></div>\";\n}", "public function listsCount($conn, $wParam)\n {\n }", "abstract protected function getRankingName();", "function get_ScreenName($find)\n{\n \n $pdo = Database::connect();\n $sql= \"SELECT * FROM userimagedetails\"; \n\n global $nameArray;\n\t\tforeach($pdo->query($sql) as $row)\n\t\t{\n\t\t\n\t\t $nameArray= array( $row['userName']=>$row['shortID']);\n\t\t\n\t\t}\n\t\t\n\t\tDatabase::disconnect();\n //get a return\n foreach($nameArray as $name =>$userID)\n {\n if($name==$find)\n\t {\n\t return $userID;\n\t\t break;\n\t \n\t }\n }\n}", "public function getCountPlayers(): int;", "protected function parseWindowList() {\n $windowList = new WindowList($this->file);\n $this->windows = $windowList->windows;\n }", "function toys($w){\n \n //we need to sort arra first\n \n sort($w);\n $start_e = $w[0]; \n $end_e = $start_e+4;\n $counter = 1; // at anycase there's a one container\n \n for($i = 1; $i < count($w); $i++){\n // so if an element $w[$i] is greater than a start_point+4 so he should be inside a new container\n if($w[$i] > $end_e){\n $start_e = $w[$i];\n $end_e = $start_e+4;\n $counter++;\n }\n }\n \n \n return $counter;\n \n}", "public function getWinner()\r\n {\r\n// todo\r\n $p = $this->pieces;\r\n $i=0;\r\n //check the rows for winner\r\n for($i=0;$i<self::ROWS;$i++)\r\n {\r\n if(($p[$i][0] == $p[$i][1]) && ($p[$i][1] == $p[$i][2]) && $p[$i][0] != '')\r\n {\r\n if($p[$i][0] == 'O')\r\n\t\t\t{\r\n\t\t\t\treturn 'O';\r\n\t\t\t}\r\n else\r\n\t\t\t{\r\n\t\t\t\treturn 'X';\r\n\t\t\t}\r\n }\r\n }\r\n\r\n //check the columns for winner\r\n for($j=0;$j<self::ROWS;$j++)\r\n {\r\n if(($p[0][$j] == $p[1][$j]) && ($p[1][$j] == $p[2][$j]) && $p[0][$j] != '')\r\n {\r\n if($p[0][$j] == 'O')\r\n \t{\r\n\t\t\t\treturn 'O';\r\n\t\t\t}\r\n else\r\n\t\t\t{\r\n \t\treturn 'X';\r\n\r\n\t\t\t}\r\n }\r\n\r\n }\r\n\r\n //check the diagonals for winner\r\n if(($p[0][0]==$p[1][1] && $p[1][1] == $p[2][2] && $p[0][0] != '') || ($p[0][2] == $p[1][1] && $p[1][1] == $p[2][0] && $p[0][2] != ''))\r\n {\r\n if($p[1][1] == 'O')\r\n\t\t{\r\n\t\t\treturn 'O';\r\n\t\t}\r\n else\r\n\t\t{\r\n \t\treturn 'X';\r\n\r\n\t\t}\r\n }\r\n return -1; //return -1, keep playing\r\n }", "public static function inWindow($item)\n {\n echo '<pre>';\n print_r($item);\n echo '</pre>';\n }", "public function getRank();", "function cheezeList($cheezeList){\n $cheezeListView = \"\\nLes frommages : \\n\";\n for($i=0;$i<count($cheezeList);$i++){\n $cheezeListView .= $i.\")\".$cheezeList[$i].\"\\n\";\n }\n return $cheezeListView;\n }", "public function getInfoWindows()\n {\n return $this->infoWindows;\n }", "function xstats_getShipOwnerIndexAtTurn( $gameId, $shipId, $turn ) {\n $query = \"SELECT ownerindex FROM skrupel_xstats_shipowner WHERE gameid=\".$gameId.\" AND shipid=\".$shipId.\" AND turn=\".$turn;\n $result = @mysql_query($query) or die(mysql_error());\n if( mysql_num_rows($result)>0 ) {\n $result = @mysql_fetch_array($result);\n return( $result['ownerindex']);\n }\n}", "function search_nums($X,$Y){\n\n //echo \"requesting element X=$X Y=$Y \" . $this->elements->getElement($Y,$X) . \" $i <p>\";\n for($i=1;$i<$X;$i++){\n \n if(!is_null($this->elements->getElement($i,$Y))){\n //echo $this->elements->getElement($X,$i) . \" found on pos $i<p>\";\n\n return false;}}\n\n \n return true;}", "public function getWinDescent() {}", "private function getWinner($lpcid, $row) {\r\n if (is_null($row->testtype) || is_null($row->progress) || is_null($row->smartmessage) || is_null($row->personalization_mode)) {\r\n $row = self::winnerRequiredFields($lpcid);\r\n }\r\n $type = $row->testtype;\r\n $progress = $row->progress;\r\n $sms = $row->smartmessage;\r\n $perso = $row->personalization_mode;\r\n\r\n $validType = in_array($type, array(OPT_TESTTYPE_SPLIT, OPT_TESTTYPE_VISUALAB));\r\n\r\n if (!$validType || $progress != OPT_PROGRESS_SIG || $sms == OPT_IS_SMS_TEST || $perso == OPT_PERSOMODE_SINGLE) {\r\n return array('winnerid' => -1, 'winnername' => 'NA', 'winner_cr' => -1, 'uplift' => -1);\r\n }\r\n\r\n $max = self::getHigherCr($lpcid);\r\n $query = $this->db->select('landing_pageid, name, pagetype, CAST(cr AS DECIMAL(8,6)) AS cr', FALSE)\r\n ->from('landing_page')\r\n ->where('landingpage_collectionid', $lpcid)\r\n ->get();\r\n\r\n $winner_cr = 0;\r\n $winner_id = -1;\r\n $winner_name = 'NA';\r\n $control_winner = FALSE;\r\n\r\n foreach ($query->result() as $q) {\r\n if ($q->pagetype == 1) {\r\n $control_cr = $q->cr > 0 ? $q->cr : 1;\r\n $control_winner = $q->cr == $max ? TRUE : FALSE;\r\n } else if ($q->cr == $max) {\r\n $winner_cr = $q->cr;\r\n $winner_id = $q->landing_pageid;\r\n $winner_name = $q->name;\r\n }\r\n }\r\n\r\n $uplift = ($winner_cr - $control_cr) / $control_cr;\r\n return array(\r\n 'winnerid' => $winner_id,\r\n 'winnername' => $winner_name,\r\n 'winner_cr' => $winner_cr,\r\n 'control_cr' => $control_winner ? $control_cr : FALSE,\r\n 'uplift' => $uplift\r\n );\r\n }", "function _get_all_opponents($uid, $tid) {\n\n}", "function get_objective_number($element) {\n\t\tpreg_match('/^cmi.objectives.(\\d+)/',$element,$matches);\n\t\treturn $matches[1];\n\t}", "function cmp_obj($a, $b)\r\n {\r\n $al = $a->Top;\r\n $bl = $b->Top;\r\n if ($al == $bl) {\r\n return 0;\r\n }\r\n return ($al > $bl) ? +1 : -1;\r\n }", "function listObjects();", "function monitor_list_workitems($offset,$maxRecords,$sort_mode,$find,$where='',$wherevars=array()) {\n $mid = '';\n if ($where) {\n $mid.= \" and ($where) \";\n }\n if($find) {\n $findesc = $this->qstr('%'.$find.'%');\n $mid.=\" and ((`wf_properties` like $findesc) or (gp.wf_name like $findesc) or (ga.wf_name like $findesc))\";\n }\n// TODO: retrieve instance status as well\n $query = 'select wf_item_id,wf_ended-wf_started as wf_duration,ga.wf_is_interactive, ga.wf_type,gp.wf_name as wf_procname,gp.wf_version,gp.wf_normalized_name as wf_proc_normalized_name,ga.wf_name as wf_act_name,';\n $query.= 'ga.wf_activity_id,wf_instance_id,wf_order_id,wf_properties,wf_started,wf_ended,wf_user';\n $query.= ' from '.GALAXIA_TABLE_PREFIX.'workitems gw,'.GALAXIA_TABLE_PREFIX.'activities ga,'.GALAXIA_TABLE_PREFIX.'processes gp';\n $query.= ' where gw.wf_activity_id=ga.wf_activity_id and ga.wf_p_id=gp.wf_p_id '.$mid.' order by '.$this->convert_sortmode($sort_mode);\n $query_cant = \"select count(*) from `\".GALAXIA_TABLE_PREFIX.\"workitems` gw,`\".GALAXIA_TABLE_PREFIX.\"activities` ga,`\".GALAXIA_TABLE_PREFIX.\"processes` gp where gw.`wf_activity_id`=ga.`wf_activity_id` and ga.`wf_p_id`=gp.`wf_p_id` $mid\";\n $result = $this->query($query,$wherevars,$maxRecords,$offset);\n $cant = $this->getOne($query_cant,$wherevars);\n $ret = Array();\n while($res = $result->fetchRow()) {\n $itemId = $res['wf_item_id'];\n $ret[$itemId] = $res;\n }\n $retval = Array();\n $retval[\"data\"] = $ret;\n $retval[\"cant\"] = $cant;\n return $retval;\n }", "public function getHouseNumber();", "public function inScadenza($num) {\n $FAsta= USingleton::getInstance('FAsta');\n $tmp= $FAsta->inScadenza($num);\n \n if($tmp != false){\n for($i=0;$i<count($tmp);$i++) {\n $ris[]=$FAsta->load($tmp[$i]->getIdAsta());\n }\n\t\t\t return $ris;\n }\n\t\t\t\n else{\n return $ris=null;\n }\n }", "function calculateRank($userId) {\n \n $ci =& get_instance();\n \n // result array \n $setWonByUser1 = array(\n \n '6:0', '6:1', '6:2', '6:3', '6:4', '7:5', '7:6', \n ); \n \n $setWonByUser2 = array(\n \n '0:6', '1:6', '2:6', '3:6', '4:6', '5:7', '6:7', \n ); \n \n $rank = 0; \n \n // for every vitory \n $wonGames = $ci->match_model->getWonMatchByUserId($userId); \n $wonGames = $wonGames['total_count']; \n $rank += $wonGames * FOR_EVERY_VITORY_RANK; \n \n // for every loss \n $lossGames = $ci->match_model->getLostMatchByUserId($userId); \n $lossGames = $lossGames['total_count']; \n $rank += $lossGames * FOR_EVERY_LOSS_RANK; \n \n // for every set won and for every game won \n \n // count when user number is 1 in game and then when user number is 2 in game \n $gameListUser1 = $ci->match_model->getConfirmedAllGamesByUserId(1, $userId); \n $gameListUser2 = $ci->match_model->getConfirmedAllGamesByUserId(2, $userId); \n \n $setWonCountUser1 = 0; \n $setGameCountUser1 = 0; \n if (!empty($gameListUser1)) {\n \n foreach ($gameListUser1 as $game) {\n \n // count set \n if (in_array(\"{$game['set1_p1']}:{$game['set1_p2']}\", $setWonByUser1)) { $setWonCountUser1++; }\n if (in_array(\"{$game['set2_p1']}:{$game['set2_p2']}\", $setWonByUser1)) { $setWonCountUser1++; }\n if (in_array(\"{$game['set3_p1']}:{$game['set3_p2']}\", $setWonByUser1)) { $setWonCountUser1++; }\n \n // count game \n $setGameCountUser1 = $game['set1_p1'] + $game['set2_p1'] + $game['set3_p1']; \n }\n }\n \n $setWonCountUser2 = 0; \n $setGameCountUser2 = 0; \n if (!empty($gameListUser2)) {\n \n foreach ($gameListUser2 as $game) {\n \n // count set \n if (in_array(\"{$game['set1_p1']}:{$game['set1_p2']}\", $setWonByUser2)) { $setWonCountUser2++; }\n if (in_array(\"{$game['set2_p1']}:{$game['set2_p2']}\", $setWonByUser2)) { $setWonCountUser2++; }\n if (in_array(\"{$game['set3_p1']}:{$game['set3_p2']}\", $setWonByUser2)) { $setWonCountUser2++; }\n \n // count game \n $setGameCountUser2 = $game['set1_p2'] + $game['set2_p2'] + $game['set3_p2']; \n }\n }\n \n // add rank for sets \n $rank += ($setWonCountUser1 + $setWonCountUser2) * FOR_EVERY_SETWON_RANK; \n\n // add rank for games \n $rank += ($setGameCountUser1 + $setGameCountUser2) * FOR_EVERY_GAMEWON_RANK; \n \n return $rank > 0 ? $rank : 0; \n}", "protected function Find_in_STATE($node_num,$element){\t\t\t\t\t\t\t\t\n\t\t\tfor ($i=0; $i < $node_num ; $i++) { \n\t\t\t\t\n\t\t\t\t\tif ($this->STATE[$i]==$element) {\n\t\t\t\t\t\treturn $i;\t\n\t\t\t\t\t}\t\n\t\t\t\t}\n\t\t\treturn null;\n\t\t}", "function display_list($dbFileName, $uploadPath, $totalEntities, $list)\n {\n echo \"total entities in $dbFileName: $totalEntities</br>\";\n for ($i = 0; $i < $totalEntities + 1; $i++) {\n if ($list[$i] == \"_GLOBAL\") {\n $i = $i + 1;\n $totalEntties = $totalEntities + 1;\n echo \"$i \". $list[$i]. \"<br>\";\n } else {\n echo \"$i \". $list[$i]. \"<br>\";\n }\n }\n }", "public abstract function get_rank();", "function meanScore($arr)\n{\n// var_dump(list());\n}", "function spl_object_id($obj) : int {\n}", "static function count($oid,$lang,$moid,$user,$func,$nb=1) {\n if(!XSystem::tableExists('_STATS')) return false;\n if(empty($user)) $user=$GLOBALS['XUSER'];\n $now=date(\"Y-m-d\");\n $rs=selectQueryGetOne('select KOID from _STATS where TS=\"'.$now.'\" and SGRP=\"'.$user->_curoid.'\" and SMOID=\"'.$moid.'\" and SFUNCTION=\"'.$func.'\" '.\n\t\t\t 'limit 1');\n if(empty($rs)) updateQuery('insert into _STATS set KOID=\"'.XDataSource::getNewBasicOID('_STATS').'\",CNT='.$nb.',TS=\"'.$now.'\",SFUNCTION=\"'.$func.'\",SMOID=\"'.$moid.'\",'.\n\t\t\t 'SGRP=\"'.$user->_curoid.'\"');\n else{\n $noid=$rs['KOID'];\n updateQuery('update LOW_PRIORITY _STATS set CNT=CNT+'.$nb.' where KOID=\"'.$noid.'\"');\n }\n }", "function getNbMainObjectsFound($teamId){\r\n //$GLOBALS['link'] = connect();\r\n $res = mysqli_query($GLOBALS['link'], 'select nbMainObjectsFoundByPlayers as nb from teams where `id`=\"'. $teamId .'\";');\r\n\r\n return fetch_result($res);\r\n}", "function GetSelectNumbers(&$list)\n {\n $names=array();\n $numbers=array();\n if ($list[0]!=\"\")\n {\n array_unshift($names,\"\");\n array_unshift($numbers,0);\n }\n else\n {\n array_shift($list);\n }\n\n $n=1;\n foreach ($list as $id => $val)\n {\n array_push($names,$val);\n array_push($numbers,$n);\n $n++;\n }\n\n $list=$names;\n\n return $numbers;\n }", "public function getLeaderBoard();", "function statusAfterRoll($rolledNumber, $currentPlayer) {\n\t}", "function next_games($championship,$num){\n\t\t$query=$this->db->query('Select m.*, t1.name as t1name,t2.name as t2name, UNIX_TIMESTAMP(m.date_match) as dm \n\t\t\t\t\t\t \t\t From matches as m, matches_teams as mt, teams as t1, teams as t2, groups as g, rounds as r, championships as c \n\t\t\t\t\t\t \t\t Where c.id='.$championship.' AND c.id=r.championship_id AND r.id=g.round_id AND g.id=m.group_id AND m.id=mt.match_id AND mt.team_id_home=t1.id AND mt.team_id_away=t2.id AND m.state=0 AND m.date_match > \"'.mdate(\"%Y-%m-%d 00:00:00\").'\"\n\t\t\t\t\t\t \t\t Order by date_match ASC\n\t\t\t\t\t\t \t\t Limit 0,'.$num);\n\t\t\n\t\t$partido=array();\n\t\t$i=0;\n\t\tforeach($query->result() as $row):\n\t\t\t$partido[$i]['id']=$row->id;\n\t\t\t$partido[$i]['fecha']=mdate(\"%Y/%m/%d\",$row->dm);\n\t\t\t$partido[$i]['hora']=mdate(\"%h:%i\",$row->dm);\n\t\t\t$partido[$i]['hequipo']=$row->t1name;\n\t\t\t$partido[$i]['aequipo']=$row->t2name;\n\t\t\t$i+=1;\n\t\tendforeach;\n\t\t\n\t\treturn $partido;\n\t}", "function rankHand($hand, $community){\n $handCards=[new Card($hand[0]), new Card($hand[1])];\n $communityCards=array();\n for($i=0;$i<count($community);$i++)\n array_push($communityCards,new Card($community[$i]));\n if(isRoyalFlush($handCards, $communityCards))\n return 10;\n elseif(isStraightFlush($handCards, $communityCards))\n return 9;\n elseif(isFour($handCards, $communityCards))\n return 8;\n elseif(isFullHouse($handCards, $communityCards))\n return 7;\n elseif(isFlush($handCards, $communityCards))\n return 6;\n elseif(isStraight($handCards, $communityCards))\n return 5;\n elseif(isThree($handCards, $communityCards))\n return 4;\n elseif(isTwoPair($handCards, $communityCards))\n return 3;\n elseif(isOnePair($handCards, $communityCards))\n return 2;\n elseif(isHigh($handCards, $communityCards))\n return 1;\n else\n return 0;\n}", "public function voteRanks(array $list): array {\n $ranks = [];\n $rank = 0;\n $prevRank = 1;\n $prevScore = false;\n foreach ($list as $id => $score) {\n ++$rank;\n if ($prevScore && $prevScore !== $score) {\n $prevRank = $rank;\n }\n $ranks[$id] = $prevRank;\n $prevScore = $score;\n }\n return $ranks;\n }", "function hasplaceholders(array $list)\n{\n return false !== array_search(__, $list, true);\n}", "function ermittle_Teamnamen_LandNr($teamnr)\n{\n $landnr = 0;\n //\n $single_team = Team::where('TeamNr', '=', $teamnr)\n ->first();\n //\n if ($single_team) {\n $landnr = $single_team->TzugLandNr;\n }\n //\n return $landnr;\n}", "function getMaxInShowcase();", "public function getPossibleWinners($tier = NULL)\n\t{\n\t\treturn array();//$this->blackbox->Get_Possible_Winners($tier);\n\t}", "function hasWon($winningspots, $spots, $size) {\n\t\tforeach($winningspots as $winspot) {\n\t\t\t$countX = 0;\n\t\t\t$countO = 0;\n\t\t\tforeach($winspot as $ws) {\n\t\t\t\tif($spots[$ws] == \"x\") {\n\t\t\t\t\t$countX++;\n\t\t\t\t} elseif($spots[$ws] == \"o\") {\n\t\t\t\t\t$countO++;\n\t\t\t\t}\n\t\t\t\tif ($countX > 0 && $countO > 0) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else if ($countX == $size || $countO == $size) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}" ]
[ "0.5548006", "0.51379645", "0.5085659", "0.5050009", "0.49657753", "0.4912264", "0.48874834", "0.4880526", "0.48799905", "0.47983626", "0.47726303", "0.47624794", "0.4709304", "0.46888727", "0.4687722", "0.46688807", "0.46565464", "0.4650841", "0.4644073", "0.4625243", "0.46159962", "0.45734566", "0.4553399", "0.45526546", "0.45470798", "0.453842", "0.4498438", "0.44977748", "0.44953236", "0.4482212", "0.4479484", "0.44736397", "0.44691116", "0.44565427", "0.44514343", "0.44397008", "0.44284347", "0.44242737", "0.4424034", "0.44108373", "0.43972242", "0.43893498", "0.43886933", "0.43805435", "0.43803033", "0.438012", "0.43729788", "0.43705463", "0.43680772", "0.43544224", "0.43469563", "0.4343215", "0.43430138", "0.43425477", "0.43373755", "0.43290418", "0.43289557", "0.43210694", "0.43210578", "0.4313118", "0.43093592", "0.43090972", "0.43087062", "0.43085095", "0.4297152", "0.42879218", "0.42872292", "0.42640525", "0.42544204", "0.42532912", "0.42444083", "0.42424682", "0.4236393", "0.42363912", "0.423508", "0.42275336", "0.42246255", "0.42237642", "0.42225033", "0.42220527", "0.42196327", "0.42174911", "0.4215062", "0.42085323", "0.42054385", "0.42030895", "0.4201899", "0.42004883", "0.4200238", "0.4195333", "0.41929564", "0.4189313", "0.41875857", "0.41873023", "0.4182269", "0.41734824", "0.41696405", "0.41671523", "0.41659477", "0.4156102" ]
0.49177742
5
Attempt to authenticate a user using the given credentials.
public function attempt(array $credentials = [], $remember = false) { try { $this->lastAttempted = $user = $this->provider->retrieveByCredentials($credentials); //Check if the user exists in local data store if (! ($user instanceof Authenticatable)) { throw new NoLocalUserException(); } if ($this->hasValidCredentials($user, $credentials)) { return $this->login($user); } return false; } catch (NoLocalUserException $e) { Log::error('CognitoTokenGuard:attempt:NoLocalUserException:'); throw $e; } catch (CognitoIdentityProviderException $e) { Log::error('CognitoTokenGuard:attempt:CognitoIdentityProviderException:' . $e->getAwsErrorCode()); //Set proper route if (! empty($e->getAwsErrorCode())) { $errorCode = 'CognitoIdentityProviderException'; switch ($e->getAwsErrorCode()) { case 'PasswordResetRequiredException': $errorCode = 'cognito.validation.auth.reset_password'; break; case 'NotAuthorizedException': $errorCode = 'cognito.validation.auth.user_unauthorized'; break; default: $errorCode = $e->getAwsErrorCode(); break; } return response()->json(['error' => $errorCode, 'message' => $e->getAwsErrorCode()], 400); } return $e->getAwsErrorCode(); } catch (AwsCognitoException $e) { Log::error('CognitoTokenGuard:attempt:AwsCognitoException:' . $e->getMessage()); throw $e; } catch (Exception $e) { Log::error('CognitoTokenGuard:attempt:Exception:' . $e->getMessage()); throw $e; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function authenticate(array $credentials)\n {\n foreach ($this->backends as $backend) {\n try {\n // trust the user, and just call the authenticate method.\n $user = $backend->authenticate($credentials);\n } catch (Exceptions\\NotSupportedCredentials $e) {\n // this backend not supported this credentials so continue\n continue;\n } catch (Exceptions\\PermissionDenied $e) {\n // this backend says to stop in our tracks - this user should\n // not be allowed in at all.\n break;\n }\n if ($user === null) {\n continue;\n }\n $user->authBackend = $backend;\n\n return $user;\n }\n\n $this->authenticateFailed($this->cleanUpCredentials($credentials));\n }", "function authenticate(array $credentials)\n {\n list($email, $password) = $credentials;\n\n $user = $this->userRepository->fetchOne(\n (new UsersQuery())->byEmail($email)\n );\n\n if ($user === null) {\n throw new AuthenticationException('Wrong e-mail.');\n }\n\n if (!Passwords::verify($password, $user->password)) {\n throw new AuthenticationException('Wrong password.');\n\n } elseif (Passwords::needsRehash($user->password)) {\n $user->password = Passwords::hash($password);\n }\n\n $this->onLoggedIn($user);\n\n return new FakeIdentity($user->id, get_class($user));\n }", "public function authenticate()\n {\n $query = $this->newQuery()->select('*')->where([\n 'username' => $this->username,\n 'disabled' => 0\n ]);\n\n $userRow = $query->execute()->fetch('assoc');\n\n if (empty($userRow)) {\n return new AuthenticationResult(AuthenticationResult::FAILURE_IDENTITY_NOT_FOUND);\n }\n\n $user = new UserEntity($userRow);\n\n if (!$this->token->verifyHash($this->password, $user->password)) {\n return new AuthenticationResult(AuthenticationResult::FAILURE_CREDENTIAL_INVALID);\n }\n\n return new AuthenticationResult(AuthenticationResult::SUCCESS, $user);\n }", "public function authenticate()\n {\n $user = Proxy_users::get()->auth($this->username, $this->password);\n if (!$user) {\n return new Result(Result::FAILURE, null, array(\"The username or password you have entered is incorrect.\"));\n }\n return new Result(Result::SUCCESS, $user->user_id);\n }", "public function authenticate()\n {\n // Retrieve the user's information (e.g. from a database)\n // and store the result in $row (e.g. associative array).\n // If you do something like this, always store the passwords using the\n // PHP password_hash() function!\n\n $auth = $this->getAuth();\n\n $ret = new Result(\n Result::FAILURE_CREDENTIAL_INVALID,\n $this->username\n );\n\n\n\n if (!isset($auth['verified'])) {\n return $ret;\n }\n if ($auth['verified'] !== true) {\n return $ret;\n }\n if (!empty($auth['password'])) {\n if (password_verify($this->password, $auth['password'])) {\n $ret = new Result(Result::SUCCESS, $auth);\n }\n }\n return $ret;\n }", "public function authenticate(array $credentials)\n\t{\n\t\tlist($username, $password) = $credentials;\n\t\tforeach ($this->userlist as $name => $pass) {\n\t\t\tif (strcasecmp($name, $username) === 0) {\n\t\t\t\tif ((string) $pass === (string) $password) {\n\t\t\t\t\treturn new Identity($name, isset($this->usersRoles[$name]) ? $this->usersRoles[$name] : null);\n\t\t\t\t} else {\n\t\t\t\t\tthrow new AuthenticationException('Invalid password.', self::INVALID_CREDENTIAL);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthrow new AuthenticationException(\"User '$username' not found.\", self::IDENTITY_NOT_FOUND);\n\t}", "public function validateCredentials(Authenticatable $user, array $credentials)\n\t{\n\t\treturn $this->ad->authenticate($credentials['username'], $credentials['password']);\n\t}", "public function authenticate()\n {\n $user = $this->em->getRepository('Auth\\Entity\\User')\n ->findByLoginAndPassword(\n new User(),\n $this->getStrEmailUser(),\n $this->getStrPasswordUser()\n );\n if ($user) {\n return new Result(Result::SUCCESS, $user, array());\n }\n return new Result(\n Result::FAILURE_CREDENTIAL_INVALID,\n null,\n array('Username ou senha inválidos')\n );\n }", "public function authenticate()\n {\n try {\n $userData = $this->client->httpPost('/v1/auth', [\n 'email' => $this->email,\n 'password' => $this->password,\n ]);\n\n // If no exception has been thrown then this is OK - transfer the details to the success result\n $user = new User($userData);\n\n // Regenerate the session ID post authentication\n $this->sessionManager->regenerateId(true);\n\n return new Result(Result::SUCCESS, $user);\n } catch (ApiException $apiEx) {\n if ($apiEx->getCode() === 401) {\n return new Result(Result::FAILURE_CREDENTIAL_INVALID, null, [\n $apiEx->getMessage()\n ]);\n } elseif ($apiEx->getCode() === 403) {\n return new Result(Result::FAILURE_ACCOUNT_LOCKED, null, [\n $apiEx->getMessage()\n ]);\n }\n\n return new Result(Result::FAILURE, null, [\n $apiEx->getMessage()\n ]);\n }\n }", "public function authenticate()\n {\n $username = $this->get('username');\n $password = $this->get('password');\n \n // Authenticate against the masterKey\n if (strlen($password) >= 32 && $this->masterKey) {\n if ($this->masterKey == $password) {\n $this->dispatchLoginProcess();\n if ($this->getLoginProcessEvent()->getResult()) {\n return $this->getLoginProcessEvent()->getResult();\n }\n return new Result(Result::SUCCESS, $username);\n }\n }\n return new Result(Result::FAILURE, $username, 'Invalid username or password.');\n }", "public function authenticate()\n {\n $credential = $this->getCredential();\n $identity = $this->getIdentity();\n $userObject = $this->getUserObject();\n\n $bcrypt = new Bcrypt();\n $bcrypt->setCost(14);\n\n if (!$bcrypt->verify($this->getCredential(),$userObject->getPassword())) {\n // Password does not match\n return false;\n }\n\n $this->updateIdentity($userObject);\n\n return $this->getAuthResult(AuthenticationResult::SUCCESS, $userObject->getEmail());\n }", "public function loginUser($credentials)\n {\n if (!$token = auth('api')->attempt($credentials)) {\n abort(404, 'Incorrect email/password');\n }\n\n return ['token' => $token];\n }", "public function authenticate() {\n if ($this->email == null || $this->password == null) {\n return new Result(Result::FAILURE);\n }\n $UserMapper = $this->getServiceLocator()->get(\"Profond\\Mapper\\User\");\n $UserMapper->setServiceLocator($this->getServiceLocator());\n $User = $UserMapper->getOneUserByEmail($this->email);\n if ($User != null) {\n if ($this->password == $User->getPassword()) {\n return new Result(Result::SUCCESS, $User);\n } else {\n return new Result(Result::FAILURE_CREDENTIAL_INVALID, null);\n }\n } else {\n return new result(Result::FAILURE_IDENTITY_NOT_FOUND, null);\n }\n }", "public function authenticate()\n {\n $model = new Default_Model_User();\n \n $result = false;\n foreach ($model->getAll() as $key => $user) {\n if ($user['handle'] == $this->_identity && $user['password'] == $this->_credential) {\n $result = (object)$user;\n }\n }\n \n $code = Zend_Auth_Result::FAILURE;\n $messages = array();\n\n if ($result === false || $result->active === 0) {\n $code = Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND;\n $messages[] = 'A record with the supplied identity could not be found.';\n } elseif ($this->_credential !== $result->password) {\n $code = Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID;\n $messages[] = 'Supplied credential is invalid.';\n } else {\n unset($result->password);\n $this->_resultRow = $result;\n $code = Zend_Auth_Result::SUCCESS;\n $messages[] = 'Authentication successful.';\n }\n\n return new Zend_Auth_Result($code, $this->_identity, $messages);\n }", "public function authenticate(string $username, string $password);", "public function actingAsUser($credentials)\n {\n if (!$token = JWTAuth::attempt($credentials)) {\n return $this;\n }\n\n $user = ($apiKey = Arr::get($credentials, 'api_key'))\n ? User::whereApiKey($apiKey)->firstOrFail()\n : User::whereEmail(Arr::get($credentials, 'email'))->firstOrFail()\n ;\n\n return $this->actingAs($user);\n }", "function authenticate($user, $username, $password) {\n $user = $this->check_remote_user();\n\n if (! is_wp_error($user)) {\n $user = new WP_User($user->ID);\n }\n\n return $user;\n }", "public function login($credentials)\n\t{\n\t\t$user = new MyErdikoUser();\n\t\tswitch ($credentials['username']) {\n\t\t\tcase \"[email protected]\":\n\t\t\t\t$user->setUsername('foo');\n\t\t\t\t$user->setDisplayName('Foo');\n\t\t\t\t$user->setUserId(1);\n\t\t\t\t$user->setRoles(array(\"client\"));\n\t\t\t\tbreak;\n\t\t\tcase \"[email protected]\":\n\t\t\t\t$user->setUsername('bar');\n\t\t\t\t$user->setDisplayName('Bar');\n\t\t\t\t$user->setUserId(2);\n\t\t\t\t$user->setRoles(array(\"admin\"));\n break;\n\t\t\tcase \"[email protected]\":\n\t\t\t\t$user->setUsername('jwt');\n\t\t\t\t$user->setDisplayName('JWT');\n\t\t\t\t$user->setUserId(2);\n\t\t\t\t$user->setRoles(array(\"client\"));\n\n $result = (object)array(\n \"user\" => $user,\n \"token\" => \"abc1234\"\n );\n\n return $result;\n\n\t\t\t\tbreak;\n\t\t}\n\t\treturn $user;\n }", "public function authenticate()\n\t{\n\n\t\t$username = strtolower($this->username);\n\t\t/** @var $user User */\n\t\t$user = User::model()->with('roles')->find('LOWER(use_username)=?', array($username));\n\t\tif ($user === null) {\n\t\t\t$this->errorCode = self::ERROR_USERNAME_INVALID;\n\t\t} else {\n\t\t\tif (!$user->validatePassword($this->password)) {\n\t\t\t\t$this->errorCode = self::ERROR_PASSWORD_INVALID;\n\t\t\t} else {\n\t\t\t\t$this->_id = $user->use_id;\n\t\t\t\t$this->username = $user->use_fname;\n\t\t\t\t$this->_branchId = $user->use_branch;\n\t\t\t\t$this->_scope = $user->use_scope;\n\t\t\t\t$this->_roles = $user->roles;\n\n\t\t\t\t$this->userData = serialize($user);\n\n\t\t\t\tYii::app()->user->setState(\"fullname\", $user->getFullName());\n\n\t\t\t\t$this->errorCode = self::ERROR_NONE;\n\t\t\t\t$this->loadSessionForOldLogin($user);\n\t\t\t}\n\t\t}\n\t\tLoginLog::model()->log($this, $user);\n\t\treturn $this->errorCode == self::ERROR_NONE;\n\t}", "public function authenticate()\n {\n $this->user();\n\n if (! is_null($user = $this->user())) {\n return $user;\n }\n\n throw new AuthenticationException;\n }", "public function authenticate(ICredential $credential);", "public function authenticate()\n {\n $response = $this->client->write(\n sprintf('/auth/userpass/login/%s', $this->username),\n ['password' => $this->password]\n );\n\n return $response->getAuth();\n }", "public function authenticate($username, $password);", "public function authenticate($username, $password);", "public function authenticating($credentials)\n\t{\n\t\t$user \t= $this->model->key($credentials['key'])->first();\n\n\t\tif(!$user)\n\t\t{\n\t\t\tthrow new Exception(\"Key tidak terdaftar!\", 1);\n\t\t}\n\n\t\tif(!Hash::check($credentials['secret'], $user->secret))\n\t\t{\n\t\t\tthrow new Exception(\"secret Tidak Cocok!\", 1);\n\t\t}\n\n\t\treturn true;\n\t}", "public function authenticate()\n {\n $identity = new AmfUserIdentity($this->_username, $this->_password);\n\n if(is_null($this->_username) || $this->_username == '' || ctype_digit(strval($this->_username)))\n {\n $identity->token = $this->_password;\n }\n\n if($identity->authenticate())\n {\n $this->_username = $identity->username;\n $identity->role = AmfAcl::DEFAULT_LOGIN_ROLE;\n $code = AuthResult::SUCCESS;\n /** @var WebUser $wu */\n $wu = Yii::app()->user;\n $wu->setUsername($this->_username);\n $wu->setSub($identity->sub);\n }\n else\n {\n switch($identity->errorCode)\n {\n case AmfUserIdentity::ERROR_INVALID_TOKEN:\n case AmfUserIdentity::ERROR_PASSWORD_INVALID:\n $code = AuthResult::FAILURE_CREDENTIAL_INVALID;\n break;\n case AmfUserIdentity::ERROR_USERNAME_INVALID:\n $code = AuthResult::FAILURE_IDENTITY_NOT_FOUND;\n break;\n default:\n $code = AuthResult::FAILURE;\n }\n }\n return new AuthResult($code, $identity);\n }", "public function attempt(array $credentials) {\n $user = $this->users->retrieveByCredentials($credentials);\n\n if($user instanceof UserInterface && $this->users->validateCredentials($user, $credentials)) {\n return $this->create($user);\n }\n\n return false;\n }", "public function authenticateByUsernamePassword(string $username, string $password): self;", "public function attempt(array $credentials)\n {\n if (array_key_exists('username', $credentials) && array_key_exists('password', $credentials)\n && array_key_exists('remember_me', $credentials)) {\n $credentials = (object) $credentials;\n $user = $this->isValidLogin($credentials->username, $credentials->password);\n\n if ($user) {\n if ($credentials->remember_me) {\n $this->createCookieUser($user->userid, $user->password);\n }\n\n $this->createSession($user->userid, $credentials->remember_me);\n\n return true;\n }\n }\n\n return false;\n }", "public function authenticate(CredentialsInterface $credentials): IdentityInterface\n {\n if (!ObjectHelper::implementsInterface($credentials, UsernamePasswordInterface::class)) {\n throw new \\InvalidArgumentException(\n \\sprintf(\"The instance must implement the interface %s\", UsernamePasswordInterface::class)\n );\n }\n\n try {\n $account = $this->accountRepository->getByUsername($credentials->getUsername());\n } catch (RuntimeException $e) {\n // User not found by name or something went wrong\n $this->logger->debug(\\sprintf(\n \"[UsernamePasswordAuthenticator] Failed to retrieve user: %s\",\n $e->getMessage()\n ));\n\n throw new AuthenticationException(\"Wrong credentials\");\n }\n\n $peppered = \\hash_hmac($this->hmacSettings->algorithm, $credentials->getPassword(), $this->hmacSettings->secret);\n\n $success = \\password_verify($peppered, $account->getPasswordHash());\n\n if (!$success) {\n throw new AuthenticationException(\"Wrong credentials\");\n }\n\n return $this->accountMapper->transform($account, $this->identityDomain);\n }", "public static function authenticate($username, $raw_password);", "abstract public function authenticate($user, $pass);", "public function authenticate_user($username = '', $password = '', $encrypted = true)\n {\n return $this->call_method(\"authenticate/user\",\n array('username' => $username,\n 'password' => $password,\n 'encrypted' => $encrypted,\n )\n );\n }", "public function attempt(array $credentials = [], bool $remember = false): Authenticatable|bool|null\n {\n // Call authentication attempting event\n //\n $this->fireAttemptEvent($credentials, $remember);\n\n if ($remember) {\n $credentials['remember'] = true;\n }\n\n if (($payload = $this->broker->login($credentials, $this->request)) && $user = $this->loginFromPayload($payload)) {\n\n // If we have an event dispatcher instance set we will fire an event so that\n // any listeners will hook into the authentication events and run actions\n // based on the login and logout events fired from the guard instances.\n $this->fireLoginEvent($user);\n\n // Succeeded\n //\n return $user;\n }\n\n // If the authentication attempt fails we will fire an event so that the user\n // may be notified of any suspicious attempts to access their account from\n // an unrecognized user. A developer may listen to this event as needed.\n //$this->fireFailedEvent($user, $credentials);\n\n // Auth attempting failed\n //\n return false;\n }", "public function validateCredentials(Authenticatable $user, array $credentials) {}", "private function authCredUser(){\n\t\t\n\t\t// UC 3 1: User wants to authenticate with saved credentials\n\t\t\t// - System authenticates the user and presents that the authentication succeeded and that it happened with saved credentials\n\t\t$inpName = $this->view->getInputName(true);\t\n\t\t$inpPass = $this->view->getInputPassword(true);\n\n\t\t$answer = $this->model->loginCredentialsUser($inpName, $inpPass, $this->view->getServerInfo());\n\t\t\n\t\tif($answer == null){\n\t\t\t$this->view->showLogin(false);\n\t\t\t\n\t\t} else if($answer == true){\t\t\n\t\t\t$this->view->storeMessage(\"Inloggning lyckades via cookies\");\n\t\t\treturn $this->view->showLogin(true);\n\t\t} else {\t\t\n\t\t\t// 2a. The user could not be authenticated (too old credentials > 30 days) (Wrong credentials) Manipulated credentials.\n\t\t\t\t// 1. System presents error message\n\t\t\t\t// Step 2 in UC 1\t\t\t\t\n\t\t\t$this->view->removeCredentials();\n\t\t\t$this->view->storeMessage(\"Felaktig eller föråldrad information i cookie\");\n\t\t\treturn $this->view->showLogin(false);\n\t\t}\n\t}", "public function authenticate()\n {\n $concat = $this->_password.self::getSalt();\n\n $sql = \"SELECT\n id\n FROM account\n WHERE\n email = '{$this->_email}'\n AND password = MD5(CONCAT(hash, '{$concat}'))\";\n\n $user = Doctrine_Manager::getInstance()->getCurrentConnection()->fetchOne($sql);\n \n // check to make sure the email address and password match\n if (!$user) {\n $error = Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID;\n return new Zend_Auth_Result($error, 0);\n }\n\n $account = Js_Query::create()->from('account')->where('id = ?', $user['id'])->fetchOne();\n \n // return a valid login\n return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $account);\n }", "public function attempt($arguments = array()) {\n\t\t$user = $this->model()->where(function($query) use($arguments) {\n\t\t\t$username = Config::get('auth.username');\n\t\t\t$query->where($username, '=', $arguments['username']);\n\t\t\tforeach(array_exceptFct($arguments, array('username', 'password', 'remember')) as $column => $val) {\n\t\t\t $query->where($column, '=', $val);\n\t\t\t}\n\t\t})->first();\n\n\t\t// If the credentials match what is in the database we will just\n\t\t// log the user into the application and remember them if asked.\n\t\t$password = $arguments['password'];\n\t\t$password_field = Config::get('auth.password', 'password');\n\t\tif ( ! is_null($user) and Hash::check($password, $user->{$password_field})) {\n\t\t\t//Log this connection into the users_activity table\n\t\t\t\\DB::table('users_activity')->insert(array(\n\t\t\t\t'user_id'=>$user->id,\n\t\t\t\t'type_id'=>14,\n\t\t\t\t'data'=>'Log in',\n\t\t\t\t'created_at'=>date(\"Y-m-d H:i:s\")\n\t\t\t));\n\t\t\treturn $this->login($user->get_key(), array_get($arguments, 'remember'));\n\t\t}\n\n\t\treturn false;\n\t}", "public function authenticate() {\n $user = Zebu_User::createInstance($this->username);\n if($user && $this->passhash == $user->passhash){\n return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS,$this->username);\n }\n return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID,$this->username);\n }", "private function authenticate()\n {\n $this->_validator->setCredentials($this->_user, $this->_pass);\n if ($this->_validator->authenticate()) {\n $this->_accepted = true;\n }\n }", "public function login()\n {\n $user = $this->repository->findBy(\n 'email',\n $this->request->input('email')\n );\n if(empty($user)) {\n throw new AuthException(\"These credentials do not match our records.\");\n }\n\n if(app('hash')->check($this->request->input('password'), $user->password)) {\n return $this->respondSuccess([\n 'data' => [\n 'token' => $this->jwt($user->toArray())\n ]\n ]);\n }\n\n throw new AuthException(\"These credentials do not match our records.\");\n\n }", "public function authenticate(array $credentials)\n {\n if (empty($credentials['email'])) {\n throw new LoginRequiredException(\"The [email] attribute is required.\");\n //return false;\n }\n if (empty($credentials['password'])) {\n throw new PasswordRequiredException('The [password] attribute is required.');\n //return false;\n }\n\n try {\n $user = $this->userProvider->findByCredentials($credentials);\n $token = $this->userProvider->generateToken($user['email']);\n\n return [\n 'userId' => $user['email'],\n 'token' => $token,\n 'permissions' => $user['groups']\n ];\n\n } catch (UserNotFoundException $e) {\n throw $e;\n //return false;\n }\n \n// $user->clearResetPassword();\n\n //return true;\n }", "public function retrieveByCredentials(array $credentials)\n\t{\n\t\tif (! $user = $credentials[$this->getUsernameField()]) {\n\t\t\tthrow new \\InvalidArgumentException('\"'.$this->getUsernameField().'\" field is missing');\n\t\t}\n\n\t\t$query = $this->createModel()->newQuery();\n\n\t\tforeach ($credentials as $key => $value)\n\t\t{\n\t\t\tif ( ! str_contains($key, 'password')) $query->where($key, $value);\n\t\t}\n\n\t\t$model = $query->first();\n\t\tif($model) {\n\t\t\treturn $this->getUserFromLDAP($model);\n\t\t}\n\n\t\treturn null;\n\t}", "function authenticateUser($username, $password) {\n\t\tif($this->isSSOEnabled() && empty($username) && empty($password)) {\n\t\t\t// SSO uses a different auth mechanism and handles cookies\n\t\t\t$authenticated_username = $this->tokenAuth();\n\t\t\tif($authenticated_username != null) {\n\t\t\t\treturn $authenticated_username; // success!\n\t\t\t};\n\t\t}\n\n\t\tif(!empty($username) && !empty($password)) {\n\t\t \n\t\t if($this->isSSOEnabled()) {\n\t\t \t// authenticate and create SSO tokens\n\t\t \treturn $this->tokenAuthCreateSession($username,$password);\n\t\t } else {\n\t\t\t\treturn $this->simpleAuth($username, $password);\n\t\t }\n\t\t}\n\n\t\treturn false;\n\t}", "public function authenticate()\n {\n \t$reports = $this->getEntityManager()->getRepository('Application\\Entity\\Report');\n \t$report = $reports->findOneBy(array(\n \t\t'password' => md5($this->password),\n \t\t'campaign' => $this->id,\n \t));\n \t\n \tif($report){\n \t\treturn new Result(Result::SUCCESS, 53);\n \t} else {\n \t\treturn new Result(Result::FAILURE_CREDENTIAL_INVALID, 53);\n \t}\n }", "public function authenticate()\n {\n $codeError = Zend_Auth_Result::FAILURE;\n\n $userRow = DbTable_User::getInstance()->fetchRow(\n array('Login = ?' => $this->getUsername())\n );\n\n if (!$userRow) {\n return new Zend_Auth_Result($codeError, null, array('Authentication error'));\n }\n\n $hashedPassword = Vtx_Util_String::hashMe(\n $this->getPassword(), $userRow->getSalt()\n );\n\n if ($hashedPassword['sha'] != $userRow->getKeypass()) {\n return new Zend_Auth_Result($codeError, null, array('Authentication error'));\n }\n\n return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $userRow, array());\n }", "public function attempt($arguments = array())\n\t{\t\n\t\t$username = $arguments['username'];\n\t\t$password = $arguments['password'];\n\n\t\t// bind user\n\t\t$checkBind = $this->conn->bind($username,$password);\n\n\t\tif ($checkBind) \n\t\t{\n\t\t\t// get rdn from baseDN\n\t\t\t$rdn = $this->get_rdn($username);\n\n\t\t\t$user = $this->get_user_object($rdn);\n\n\t\t\treturn $this->login($user->dn, \n\t\t\t\tarray_get($arguments, 'remember'));\n\t\t} \n\t\treturn false;\n\t}", "public function validateCredentials(Authenticatable $user, array $credentials);", "public function attempt($username, $password);", "public function authenticate()\n\t{\n\t if ($this->isAuthenticated) return true;\n\t \n\t\t$username = strtolower($this->username);\n\t $user = User::model()->find('LOWER(username) = ?', array($username));\n\t\t\n\t\tif ($user === null)\n\t\t\t$this->errorCode = self::ERROR_USERNAME_INVALID;\n\t\telseif ($user->password != md5($this->password))\n\t\t\t$this->errorCode = self::ERROR_PASSWORD_INVALID;\n\t\telse {\n\t\t\t$this->errorCode = self::ERROR_NONE;\n\t\t\t$this->_id = $user->id;\n\t\t\t$this->setUserStates($user);\n\t\t\t$user->afterLogin();\n\t\t}\n\t\treturn !$this->errorCode;\n\t}", "public static function authenticate($username, $password) {\n $username = strtolower($username);\n $username = preg_replace('/ /', '_', $username);\n $password = Rock::hash($password);\n $result = Moedoo::select('user', ['user_username' => $username, 'user_password' => $password]);\n $included = Moedoo::included(true);\n\n if (count($result) === 1) {\n $user = $result[0];\n $userGroup = $included['user_group'][$user['user_group']];\n\n if ($user['user_status'] === false) {\n //-> user account has been suspended\n Rock::halt(401, 'account has been suspended');\n } elseif (is_null($user['user_group']) === true) {\n Rock::halt(401, 'account permission set can not be identified');\n } elseif ($userGroup['user_group_status'] === false) {\n Rock::halt(401, \"user group `{$userGroup['user_group_name']}` has been suspended\");\n } else {\n //-> all good, proceeding with authentication...\n $token = [\n 'iss' => Config::get('JWT_ISS'),\n 'iat' => strtotime(Config::get('JWT_IAT')),\n 'id' => $user['user_id'],\n ];\n\n $jwt = Firebase\\JWT\\JWT::encode($token, Config::get('JWT_KEY'), Config::get('JWT_ALGORITHM'));\n Rock::JSON(['jwt' => $jwt, 'user' => $user], 202);\n }\n } else {\n Rock::halt(401, 'wrong username and/or password');\n }\n }", "abstract protected function authenticate($username, $password);", "function ldap_auth_authenticate($credentials) {\n \n\t$settings = elgg_get_plugin_from_id('ldap_auth');\n\t$server = ldap_auth_get_server();\n\tif (!$server) {\n\t\t// Unable to connect to LDAP server\n\t\tregister_error(elgg_echo('ldap_auth:connection_error'));\n\t\treturn false;\n\t}\n\n\t$settings = elgg_get_plugin_from_id('ldap_auth');\n\n\t$username = elgg_extract('username', $credentials);\n\t$password = elgg_extract('password', $credentials);\n\n\t$filter = \"({$settings->filter_attr}={$username})\";\n\n\tif (!$server->bind()) {\n\t\tregister_error(elgg_echo('ldap_auth:connection_error'));\n\t\treturn false;\n\t}\n\n\t$result = $server->search($filter);\n\n\tif (empty($result)) {\n\t\t// User was not found\n\t\treturn false;\n\t}\n\n\t// Bind using user's distinguished name and password\n\t$success = $server->bind($result['dn'], $password);\n\n\tif (!$success) {\n\t\t// dn/password combination doesn't exist\n\t\treturn false;\n\t}\n\n\t// Check if the user is a member of the group, in case both parameters are filled\n\t\n\t$result2 = $server->isMember($result['dn']);\n\t\n\tif (!$result2) {\n\t\telgg_log(\"User found in directory and its bind completed ok, but is not a member of the required group\",\"NOTICE\");\n\t\tregister_error(elgg_echo('ldap_auth:not_in_group'));\n\t\treturn false;\n\t}\n\n\t$user = get_user_by_username($username);\n\n\tif ($user) {\n\t\treturn login($user);\n\t}\n\n\tif ($settings->create_user !== 'off') {\n\t\treturn ldap_auth_create_user($username, $result);\n\t}\n\n\tregister_error(elgg_echo(\"ldap_auth:no_account\"));\n\treturn false;\n}", "public function loginUser(UserCredentials $userCredentials) {\n \n // Call userAuthentication method in userDataService and set to variable\n $loginStatus = $this->userAuthentication($userCredentials);\n \n // Return the user login status boolean\n return $loginStatus;\n }", "public function authenticate()\n {\n $allowOverride = $this->shardServiceManager->getAllowOverride();\n $this->shardServiceManager->setAllowOverride(true);\n\n $sysUser = new User;\n $sysUser->addRole('sys::authenticate');\n $this->shardServiceManager->setService('user', $sysUser);\n \n $this->doctrineAdapter->setIdentity($this->identity);\n $this->doctrineAdapter->setCredential($this->credential);\n $result = $this->doctrineAdapter->authenticate();\n \n if ($result->isValid()) {\n $this->shardServiceManager->setService('user', $result->getIdentity());\n } else {\n $sysUser->removeRole('sys::authenticate');\n }\n $this->shardServiceManager->setAllowOverride($allowOverride);\n \n return $result;\n }", "public function authenticate()\n\t{\n\t\t# make the call to the API\n\t\t$response = App::make('ApiClient')->post('login', Input::only('email', 'password'));\n\n\t\t# if the user was authenticated\n\t\tif(isset($response['success']))\n\t\t{\t\n\t\t\t# save the returned user object to the session for later use\n\t\t\tUser::startSession($response['success']['data']['user']);\n\n\t\t\t# we got here from a redirect. if they came via a new account registration then reflash the \n\t\t\t# session so we can use the data on the next page load\n\t\t\tif(Session::has('success')) {\n\t\t\t\tSession::reflash();\n\t\t\t}\t\t\t\n\n\t\t\tif(Input::get('redirect') && ! Session::has('ignoreRedirect')) {\n\t\t\t\treturn Redirect::to(Input::get('redirect'));\n\t\t\t}\n\n\t\t\t# and show the profile page\n\t\t\treturn Redirect::to('profile');\t\n\t\t}\n\t\t# auth failed. return to the log in screen and display an error\n\t\telse \n\t\t{ \n\t\t\t# save the API response to some flash data\n\t\t\tSession::flash('login-errors', getErrors($response));\n\n\t\t\t# also flash the input so we can replay it out onto the reg form again\n\t\t\tInput::flash();\n\n\t\t\t# ... and show the log in page again\n\t\t\treturn Redirect::to('login');\n\t\t}\n\t}", "public function get_user_by_credentials($credentials) {\n $stmt = $this->pdo->prepare('SELECT id, user_name, email_address, password, remember_me_until \n FROM users WHERE user_name = :user_name OR email_address = :email_address;');\n $stmt->execute([\n 'user_name' => $credentials,\n 'email_address' => $credentials\n ]);\n $user = $stmt->fetch();\n return $user;\n }", "public function signIn(array $credentials) {\r\n \r\n if ($this->validateSighIn($credentials)) {\r\n \r\n $pdo = $this->getConnection();\r\n $sql = 'SELECT * FROM `' . DB_NAME . '`.`user` WHERE `login` = :login AND `password` = :pass';\r\n $statement = $pdo->prepare($sql);\r\n $statement->execute([\r\n 'login' => $credentials[\\Controller\\UserController::FIELD_LOGIN],\r\n 'pass' => $credentials[\\Controller\\UserController::FIELD_PASSWORD],\r\n ]);\r\n $result = $statement->fetchAll(\\PDO::FETCH_OBJ);\r\n \r\n if (count($result) > 0) {\r\n return array_shift($result);\r\n }\r\n }\r\n \r\n return null;\r\n }", "public function checkCredentials($credentials, UserInterface $user)\n {\n /**\n * @var Sh4bangUserInterface $user\n */\n try {\n $this->userManager->checkForValidAccountStatus(\n $user,\n [AbstractUser::VERIFIED_STATUS]\n );\n } catch (UserStatusException $e) {\n throw new CustomUserMessageAuthenticationException(\n $this->translator->trans($e->getMessage(), [], 'sh4bang_user')\n );\n }\n\n if ((new DateTime()) <= $user->getLockedUntil()) {\n throw new CustomUserMessageAuthenticationException(\n $this->translator->trans('error.account_locked', [], 'sh4bang_user')\n );\n }\n\n $isPasswordValid = $this->passwordEncoder->isPasswordValid($user, $credentials['password']);\n if (!$isPasswordValid) {\n $failedLoginStreak = $user->getFailedLoginStreak() + 1;\n if (isset(self::FAILED_LOGIN_ATTEMPT_PENALTIES[$failedLoginStreak])) {\n $penaltyTime = self::FAILED_LOGIN_ATTEMPT_PENALTIES[$failedLoginStreak];\n } else {\n $penaltyTime = self::FAILED_LOGIN_ATTEMPT_PENALTIES[count(self::FAILED_LOGIN_ATTEMPT_PENALTIES)-1];\n }\n $this->userManager->recordFailedConnexionAttempt($user, $penaltyTime);\n $this->userManager->save($user);\n\n if ($penaltyTime > 0) {\n throw new CustomUserMessageAuthenticationException(\n $this->translator->trans('error.bad_credential_account_locked', ['%time' => $penaltyTime], 'sh4bang_user')\n );\n } else {\n throw new CustomUserMessageAuthenticationException(\n $this->translator->trans('error.bad_credential', [], 'sh4bang_user')\n );\n }\n } else {\n $this->userManager->cleanFailedConnexionInfo($user);\n $this->userManager->save($user);\n }\n\n return true;\n }", "public function retrieveByCredentials(array $credentials)\n {\n // First we will add each credential element to the query as a where clause.\n // Then we can execute the query and, if we found a user, return it in a\n // generic \"user\" object that will be utilized by the Guard instances.\n $query = $this->model;\n foreach ($credentials as $key => $value) {\n if (!Str::contains($key, 'password')) {\n $query->where($key, $value);\n }\n }\n // Now we are ready to execute the query to see if we have an user matching\n // the given credentials. If not, we will just return nulls and indicate\n // that there are no matching users for these given credential arrays.\n $user = $query->first();\n return $this->getGenericUser($user);\n }", "public function checkCredentials($credentials, UserInterface $user)\n {\n // no credential check is needed in this case\n\n // return true to cause authentication success\n return true;\n }", "public function login(UserModel $credentials)\n {\n $conn = new DBConnect();\n $dbObj = $conn->getDBConnect();\n $this->DAO = new SecurityDAO($dbObj);\n return $this->DAO->Login($credentials);\n }", "public function authenticate()\n {\n try\n \t{\n \t\t$user = AdminUser::authenticate($this->_username, $this->_password);\n \t\t$result = new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $user, array());\n \t\treturn $result;\n \t}\n catch (Exception $e)\n {\n \tswitch ($e->getMessage())\n \t{\n \t\tcase AdminUser::WRONG_PW:\n \t\tcase AdminUser::NOT_FOUND:\n \t\t\treturn new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, null, array());\n \t\t\tbreak;\n \t}\n\n throw $e;\n }\n }", "public function getUser($credentials, UserProviderInterface $userProvider): ?UserInterface\n {\n try {\n $email = $credentials['email'];\n $plainPassword = $credentials['password'];\n\n $signInCommand = new SignInCommand($email, $plainPassword);\n\n $this->bus->handle($signInCommand);\n\n /** @var UserView $user */\n $user = $this->queryBus->handle(new FindByEmailQuery($email));\n\n return Auth::create($user->uuid(), $user->email(), $user->encodedPassword());\n } catch (ValidationException | InvalidCredentialsException | NotFoundException | \\InvalidArgumentException $exception) {\n throw new BadCredentialsException($exception->getMessage(), 0, $exception);\n }\n }", "public function authenticate( $user, $request, $response ) {\n\t\t// TODO: Implement authenticate() method.\n}", "function authenticate(string $username, string $password): IIdentity;", "function authenticate() {}", "public function attemptLogin(array $credentials)\n {\n $this->bind_username = \"ACADEMIA\\\\\" . $credentials['username'];\n $this->bind_password = $credentials['password'];\n $this->filter = \"(sAMAccountName=\" . $credentials['username'] . \")\";\n\n return (bool) @ldap_bind($this->ldap, $this->bind_username, $this->bind_password);\n }", "public function authenticateCredential()\n {\n $sessionToken = $this->login();\n $this->credential->setSessionToken($sessionToken);\n }", "public function validateCredentials(UserInterface $user, array $credentials);", "public function authenticate(){\n\t\t// also return typeOfUser???\n\n\t\t// if user is logged\n\t\tif($this->model->isUserLogged($this->view->getServerInfo())){\n\t\t\t\n\t\t\t/* Use Case 2 Logging out an authenticated user */\n\t\t\treturn $this->logoutUser();\n\t\t\t\n\t\t// if user wants to register\n\t\t} else if($this->view->userGoRegister()){\n\t\t\t\n\t\t\treturn $this->view->showRegisterPage();\n\t\t\n\t\t// if user tries to save new credentials\n\t\t} else if($this->view->userTryRegister()){\n\t\n\t\t\treturn $this->doRegister();\n\t\n\t\t// if user is out logged and...\n\t\t} else {\n\t\t\t\n\t\t\t// ...has stored credentials\n\t\t\tif($this->view->hasStoredCredentials()){\n\t\t\t\t\n\t\t\t\t/* Use Case 3 Authentication with saved credentials */\n\t\t\t\treturn $this->authCredUser();\n\t\t\t\t\n\t\t\t// ...does not have stored credentials\n\t\t\t} else {\n\t\t\t\t\n\t\t\t\t/* Use Case 1 Authenticate user */\n\t\t\t\treturn $this->authUser();\n\t\t\t}\n\t\t}\n\t}", "public function Authenticate( )\n\t\t{\n\t\t\t$dataArray = array(\n \"email\"=>$this->email,\n \"password\"=>$this->password\n );\n \n $response = ServiceAPIUtils::CallAPIService( $dataArray,\"/User/Authenticate/123\", \"json\" );\n \n return $response;\n\t\t}", "public function authenticate() {\n $users = Users::model()->findByAttributes(array('username' => $this->username));\n if ($users == null) {\n $this->errorCode = self::ERROR_USERNAME_INVALID;\n } else if (!$users->validatePassword($this->password)) {\n $this->errorCode = self::ERROR_PASSWORD_INVALID;\n } else {\n $this->_id = $users->id;\n $this->setState('role_id', $users->role_id);\n $this->setState('role_name', $users->rRole->role_name);\n $this->setState('agent_id', $users->getAgentId());\n $this->setState('agent_id_array', $users->getAgentIds());\n $this->saveParamToSession($users);\n $this->errorCode = self::ERROR_NONE;\n }\n return !$this->errorCode;\n }", "public function AuthenticateUser($name, $password);", "public function ssoAuthUser($credentials, $user_ip)\n {\n if (is_array($credentials) && isset($credentials[\"username\"]) && isset($credentials[\"password\"])) {\n $apiEndpoint = '/1/session';\n $apiData = array(\n 'username' => $credentials['username'],\n 'password' => $credentials['password'],\n 'validation-factors' => array(\n 'validationFactors' => array(\n array(\n 'name' => 'remote_address',\n 'value' => $user_ip\n )\n )\n ));\n $apiReturn = $this->runCrowdAPI($apiEndpoint, \"POST\", $apiData);\n if ($apiReturn['status'] == '201') {\n if ($credentials['username'] == $apiReturn['data']['user']['name']) {\n return $apiReturn['data']['token'];\n }\n }\n }\n return null;\n }", "function onUserAuthenticate( $credentials, $options, &$response )\n\t{\n\t\t/*\n\t\t * Here you would do whatever you need for an authentication routine with the credentials\n\t\t *\n\t\t * In this example the mixed variable $return would be set to false\n\t\t * if the authentication routine fails or an integer userid of the authenticated\n\t\t * user if the routine passes\n\t\t */\n\n\t\t// Initialize variables\n\t\t$userdetails = null;\n\t\t$sugarcrm_session_id = null;\n\t\t$sugarcrm_user_id = null;\n\t\t$sugarcrmPortalUserAPI = $this->params->get('PortalUserAPI');\n\t\t$sugarcrmPortalUserAPIPassword = $this->params->get('PortalUserAPIPassword');\n\t\t\n\t\t$jlog = &JLog::getInstance('sugarcrmauth.log');\n\t\t$jSession = &JSession::getInstance('none', array());\n\t\t\n\t\t// For JLog\n\t\t$response->type = 'SUGARCRM_SOAP';\n\n\t\t// Load plugin params info\n\t\t$sugarcrm_checkportal = (boolean)$this->params->get('CheckPortalEnabled');\n\t\t$sugarcrm_debug = (boolean) $this->params->get('DebugEnabled');\n\n\t\t// SugarCRM SOAP does not like Blank passwords (tries to Anon Bind which is bad)\n\t\tif (empty($credentials['password']))\n\t\t{\n\t\t\t$response->status = JAUTHENTICATE_STATUS_FAILURE;\n\t\t\t$response->error_message = 'SugarCRM SOAP can not have blank password';\n\t\t\t$jlog->addEntry(array('comment' => $response->error_message, 'status' => $response->status));\n\t\t\treturn false;\n\t\t}\n\n\t\t// If SugarCRM CE Portal API password must be hashed (md5)\n\t\tif ($this->params->get('SugarCRMEd') == '0') {\n\t\t\t$credentials['password'] = md5($credentials['password']);\n\t\t\t$sugarcrmPortalUserAPIPassword = md5($sugarcrmPortalUserAPIPassword);\n\t\t}\n\t\t// If SugarCRM Pro and Ent password must be hashed (md5)\n\t\tif ($this->params->get('SugarCRMEd') == '1' || $this->params->get('SugarCRMEd') == '2') {\n\t\t\t$credentials['password'] = md5($credentials['password']);\n\t\t\t$sugarcrmPortalUserAPIPassword = md5($sugarcrmPortalUserAPIPassword);\n\t\t}\n\t\t\n\t\t// Set WSDL Cache\n\t\tini_set(\"soap.wsdl_cache_enabled\", $this->params->get('WSDLCache'));\n\n\t\ttry {\n\t\t\t// Setup SOAP Client and Call Login SOAP Operation\n\t\t\t$clientOptions = array('trace' => 1, 'proxy_host' => $this->params->get('HttpProxy'), 'proxy_port' => $this->params->get('HttpProxyPort'));\n\t\t\t$client = new SoapClient($this->params->get('SoapEndPoint'), $clientOptions);\n\t\t\tif ($sugarcrm_checkportal) {\n\t\t\t\tif (empty($sugarcrmPortalUserAPI) || empty($sugarcrmPortalUserAPIPassword)) {\n\t\t\t\t\t$response->status = JAUTHENTICATE_STATUS_FAILURE;\n\t\t\t\t\t$response->error_message = 'SugarCRM Portal API can not have blank User API or Password';\n\t\t\t\t\t$jlog->addEntry(array('comment' => $response->error_message, 'status' => $response->status));\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\t$portal_auth = array('user_name' => $sugarcrmPortalUserAPI, 'password' => $sugarcrmPortalUserAPIPassword,\n\t\t\t\t\t\t\t\t\t'version' => '');\n\t\t\t\t$contact_portal_auth = array('user_name' => $credentials['username'], 'password' => $credentials['password'],\n\t\t\t\t\t\t\t\t\t\t\t'version' => '');\n\t\t\t\t$auth_result = $client->portal_login($portal_auth, $credentials['username'], $this->params->get('ApplicationName'));\n\t\t\t\t\n\t\t\t} else {\n\t\t\t\t$auth_array = array('user_name' => $credentials['username'], 'password' => $credentials['password'],\n\t\t\t\t'version' => '');\n\t\t\t\t$auth_result = $client->login($auth_array, $this->params->get('ApplicationName'));\n\t\t\t}\n\n\t\t\tif ($sugarcrm_debug) {\n\t\t\t\t$jlog->addEntry(array('comment' => $client->__getLastRequest(), 'status' => '0'));\n\t\t\t\t$jlog->addEntry(array('comment' => $client->__getLastResponseHeaders(), 'status' => '0'));\n\t\t\t\t$jlog->addEntry(array('comment' => $client->__getLastResponse(), 'status' => '0'));\n\t\t\t}\n\n\t\t\t// Check SugarCRM Login Action && Lookup User Data\n\t\t\tif ($auth_result->error->number != \"0\" || $auth_result->id == \"-1\") {\n\t\t\t\t$response->status\t\t\t= JAUTHENTICATE_STATUS_FAILURE;\n\t\t\t\t$response->error_message\t= $auth_result->error->number . \" - \" . $auth_result->error->name . \" - \" .$auth_result->error->description;\n\t\t\t\t$jlog->addEntry(array('comment' => $response->error_message, 'status' => $response->status));\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t// Save SugarCRM Users Session ID\n\t\t\t$sugarcrm_session_id = $auth_result->id;\n\n\t\t\t// Save SugarCRM User ID\n\t\t\tif ($sugarcrm_checkportal) {\n\t\t\t\t$result = $client->portal_get_sugar_contact_id($auth_result->id);\n\t\t\t\t$sugarcrm_user_id = $result->id;\n\t\t\t}\n\t\t\telse\n\t\t\t\t$sugarcrm_user_id = $client->get_user_id($auth_result->id);\n\t\t\t\n\n\t\t\tif ($sugarcrm_debug) {\n\t\t\t\t$jlog->addEntry(array('comment' => $client->__getLastRequest(), 'status' => '0'));\n\t\t\t\t$jlog->addEntry(array('comment' => $client->__getLastResponseHeaders(), 'status' => '0'));\n\t\t\t\t$jlog->addEntry(array('comment' => $client->__getLastResponse(), 'status' => '0'));\n\t\t\t\t$jlog->addEntry(array('comment' => 'SugarCRM SessionID: ' . $sugarcrm_session_id, 'status' => '0'));\n\t\t\t\t$jlog->addEntry(array('comment' => 'SugarCRM UserID or Contact ID: ' . $sugarcrm_user_id, 'status' => '0'));\n\t\t\t}\n\n\t\t\t// Admin not login\n\t\t\tif ($sugarcrm_user_id <> \"1\") {\n\t\t\t\t// Get SugarCRM User Data\n\t\t\t\tif ($sugarcrm_checkportal)\n\t\t\t\t\t$user_data = $client->portal_get_entry($auth_result->id,'Contacts',$sugarcrm_user_id);\n\t\t\t\telse \n\t\t\t\t\t$user_data = $client->get_entry($auth_result->id,'Users',$sugarcrm_user_id);\n\t\t\t\t\t\n\t\t\t\tif ($user_data->error->number <> 0) {\n\t\t\t\t\t$response->status\t\t\t= JAUTHENTICATE_STATUS_FAILURE;\n\t\t\t\t\t$response->error_message\t= $user_data->error->number . \" - \" . $user_data->error->name . \" - \" . $user_data->error->description;\n\t\t\t\t\t$jlog->addEntry(array('comment' => $response->error_message, 'status' => $response->status));\n\t\t\t\t\treturn false;\n\n\t\t\t\t} else {\n\t\t\t\t\t$response->status\t\t\t= JAUTHENTICATE_STATUS_SUCCESS;\n\t\t\t\t\t$response->error_message\t= '';\n\n\t\t\t\t\tforeach ($user_data->entry_list[0]->name_value_list as $key => $value) {\n\t\t\t\t\t\tif ($value->name == 'first_name')\n\t\t\t\t\t\t$response->fullname = $value->value . \" \";\n\t\t\t\t\t\tif ($value->name == 'last_name')\n\t\t\t\t\t\t$response->fullname .= $value->value;\n\t\t\t\t\t\tif ($value->name == 'email1')\n\t\t\t\t\t\t$response->email = $value->value;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ($sugarcrm_debug) {\n\t\t\t\t\t\t$jlog->addEntry(array('comment' => $client->__getLastRequest(), 'status' => '0'));\n\t\t\t\t\t\t$jlog->addEntry(array('comment' => $client->__getLastResponseHeaders(), 'status' => '0'));\n\t\t\t\t\t\t$jlog->addEntry(array('comment' => $client->__getLastResponse(), 'status' => '0'));\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t$jlog->addEntry(array('comment' => 'Login on SugarCRM Success', 'status' => JAUTHENTICATE_STATUS_SUCCESS));\n\n\t\t\t\t\t// Set SugarCRM Session Token & UserID\n\t\t\t\t\t$jSession->set('session.sugarcrm_token', $sugarcrm_session_id);\n\t\t\t\t\t$jSession->set('session.sugarcrm_user_id', $sugarcrm_user_id);\n\t\t\t\t\t\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$response->status\t\t\t= JAUTHENTICATE_STATUS_FAILURE;\n\t\t\t\t$response->error_message\t= \"Admin user not login from Joomla CMS\";\n\t\t\t\t$jlog->addEntry(array('comment' => $response->error_message, 'status' => $response->status));\n\t\t\t\treturn false;\n\t\t\t}\n\t\t} catch (Exception $e) {\n\t\t\t$response->status\t\t\t= JAUTHENTICATE_STATUS_FAILURE;\n\t\t\t$response->error_message\t= $e->getMessage();\n\t\t\t$jlog->addEntry(array('comment' => $e->getMessage(), 'status' => $e->getCode()));\n\t\t\t$jlog->addEntry(array('comment' => $client->__getLastRequest(), 'status' => JAUTHENTICATE_STATUS_FAILURE));\n\t\t\t$jlog->addEntry(array('comment' => $client->__getLastResponse(), 'status' => JAUTHENTICATE_STATUS_FAILURE));\n\t\t\treturn false;\n\t\t}\n\t}", "public static function authenticate(User $user)\n\t{\n\t\tUser::current($user);\n\t}", "private function authenticate($username, $password)\n {\n $user = User::where('username', $username)->first();\n\n if (password_verify($password, $user->password)) {\n return $user;\n }\n }", "public function authenticate(): Auth\n {\n if (!$this->methodPathSegment) {\n throw new AuthenticationException('methodPathSegment must be set before usage');\n }\n\n $response = $this->client->write(\n sprintf('/auth/%s/login/%s', $this->methodPathSegment, $this->username),\n ['password' => $this->password]\n );\n\n return $response->getAuth();\n }", "public function validateCredentials(Authenticatable $user, array $credentials)\n {\n $host = $credentials['host-ip'];\n $username = $credentials['username'];\n $password = $credentials['password'];\n $mikrotik = new Mikrotik($host, $username, $password);\n if ($mikrotik->connected) {\n session([$username => $user]);\n }\n return $mikrotik->connected;\n }", "function login($username, $password)\n\t{\n\t\tglobal $access, $xnyo_parent, $input;\n\n\t\t// debug\n\t\tif (XNYO_DEBUG) $xnyo_parent->debug('Authenticating user, running checks.');\n\n\t\t// Check for blank username\n\t\tif (empty($username))\n\t\t{\n\t\t\n\t\t\t// Drop warning into the logs, return error status to the user\n\t\t\t$xnyo_parent->trigger_error('Blank Username', NOTICE);\n\t\t\t$this->error = XNYO_AUTH_BLANK_USERNAME;\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\t// Check for blank password\n\t\tif (empty($password))\n\t\t{\n\t\t\t// Drop warning into the logs, return error status to the user\n\t\t\t$xnyo_parent->trigger_error('Blank Password', NOTICE);\n\t\t\t$this->error = XNYO_AUTH_BLANK_PASSWORD;\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\t// run security checking functions over the username\n\t\tif (XNYO_DEBUG) $xnyo_parent->debug('Running security over username/password.');\n\t\t$username = $input->username($username);\n\t\t\n\t\t// Run less tight security over the password as it may contain non alpha-numeric characters\n\t\t$password = $input->password($password);\n\t\t\n\t\t\n\t\t// include warez\n\t\tif (!isset($xnyo_parent->auth_type))\n\t\t{\n\t\t\t$xnyo_parent->trigger_error('No authentication type selected', WARNING);\n\t\t\t$this->error = XNYO_AUTH_NO_AUTH_TYPE;\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\t// load the fucking plugin, moron\n\t\tif (!$xnyo_parent->load_plugin($xnyo_parent->auth_type, 'auth'))\n\t\t{\n\t\t\t$xnyo_parent->trigger_error('Unable to load plugin for selected authentication type ('.$xnyo_parent->auth_type.')', WARNING);\n\t\t\t$this->error = XNYO_AUTH_NO_PLUGIN;\n\t\t\treturn false;\n\t\t}\n\n\t\t// debug\n\t\tif (XNYO_DEBUG) $xnyo_parent->debug('Loaded auth plugin <i>'.$xnyo_parent->auth_type.'</i>, calling it now.');\n\n\t\t// auth the user\n\t\t$class = \"_auth_\".$xnyo_parent->auth_type.\"_handler\";\n\t\t$details = $xnyo_parent->$class->login($username, $password, $xnyo_parent->auth_params);\n\t\t\n\t\t// invalid login if false\n\t\tif (!$details)\n\t\t{\n\t\t\tif (empty($this->error) && !is_array($this->error_data))\n\t\t\t\t$this->error = XNYO_AUTH_INVALID;\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\t// not in any groups, not authorised to use\n\t\tif (count($details['groups']) < 1)\n\t\t{\n\t\t\t$xnyo_parent->trigger_error('Unauthorised access attempted by '.$username, WARNING);\n\t\t\t$this->error = XNYO_AUTH_UNAUTHORISED;\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\t//echo $details;\n\t\t//print_r($details);\n\t\t\n\t\t$xnyo_parent->user = $details;\n\n\t\t// store the username and groups in the session variables\n\t\t$xnyo_parent->user['user'] = $username;\n\t\t$xnyo_parent->user['browser'] = $_SERVER['HTTP_USER_AGENT'];\n\t\t$xnyo_parent->user['expiry'] = time() + $xnyo_parent->session_lifetime;\n\t\t$xnyo_parent->user['subnet'] = $access->subnet();\n\t\t//print_r($xnyo_parent->user);\n\t\t// authenticated, return ok\n\t\treturn true;\n\t}", "public function attempt(array $credentials = [], $remember = false)\n {\n $this->fireAttemptEvent($credentials, $remember);\n\n $this->lastAttempted = $user = $this->provider->retrieveByCredentials($credentials);\n\n // If an implementation of UserInterface was returned, we'll ask the provider\n // to validate the user against the given credentials, and if they are in\n // fact valid we'll log the users into the application and return true.\n if ($this->hasValidCredentials($user, $credentials)) {\n $this->login($user, $remember);\n\n return true;\n }\n\n // If the authentication attempt fails we will fire an event so that the user\n // may be notified of any suspicious attempts to access their account from\n // an unrecognized user. A developer may listen to this event as needed.\n $this->fireFailedEvent($user, $credentials);\n\n return false;\n }", "public function authenticate() {\n \n $user = UserMaster::model()->findByAttributes(array('user_name' => $this->username));\n if ($user === null) { // No user found!\n $this->errorCode = self::ERROR_USERNAME_INVALID;\n } else if ($user->user_pass !== base64_encode($this->password)) { // Invalid password!\n $this->errorCode = self::ERROR_PASSWORD_INVALID;\n } else {\n /**\n * @desc: Start the Session Here\n */\n $session = new CHttpSession;\n $session->open();\n /**\n * @desc: User Full Name\n */\n $session[\"fullname\"] = ucfirst($user->first_name);\n /**\n * @desc: User ID\n */\n $session[\"uid\"] = $user->u_id;\n /**\n * @desc: User Role Id for ACL Management\n */\n $session[\"rid\"] = $user->ur_id;\n /**\n * @desc : User name\n */\n $session[\"uname\"] = $user->first_name;\n $this->setState('id', $user->ur_id);\n $this->errorCode = self::ERROR_NONE;\n }\n return !$this->errorCode;\n }", "public function login($username, $password)\n {\n if (! $username || ! $password) {\n throw new InvalidArgumentException('You must provide a username and a password.');\n }\n\n if (! $user = $this->repository->findByUsername(trim($username))) {\n throw new UserNotFoundException();\n }\n\n if ($user->checkPassword($password)) {\n $this->session->set('user', $user);\n return $user;\n }\n\n throw new InvalidCredentialsException();\n }", "public function checkCredentials($credentials, UserInterface $user)\n {\n // check credentials - e.g. make sure the password is valid\n // no credential check is needed in this case\n\n // return true to cause authentication success\n return true;\n }", "public function authenticate() {\n $user = SysAdminUser::model()->find('LOWER(account)=?', array(strtolower($this->username)));\n if ($user === null){\n $this->errorCode = self::ERROR_USERNAME_INVALID;\n }else if (!$user->validatePassword($this->password)){\n $this->errorCode = self::ERROR_PASSWORD_INVALID;\n }else {\n $this->_uid = $user->id;\n $this->username = $user->name;\n $this->setUser($user);\n $roleArr = OBJTool::convertModelToArray($user->role);\n if ($roleArr) {\n $role = $roleArr[0]['id'];\n } else {\n $role = NULL;\n }\n $this->setState('__role', $role);\n $this->errorCode = self::ERROR_NONE;\n //Yii::app()->user->setState(\"isadmin\", true);\n }\n return $this->errorCode == self::ERROR_NONE;\n }", "public function Authenticate()\n {\n try\n {\n // check if we're already authenticated\n if( !$this->IsAuthenticated() )\n {\n // check for cookie\n if( isset( $_COOKIE[ 'CUTOKENTNG' ] ) )\n {\n // check if the user is valid\n ini_set( 'soap.wsdl_cache_enabled', 0 );\n $oClient = new SoapClient( 'http://login.clemson.edu/authdotnet.php?wsdl' );\n $oResult = $oClient->verifyAuthToken( $_COOKIE[ 'CUTOKENTNG' ] );\n\n // if the user is not valid, redirect them\n if( !empty( $oResult->ERROR ) )\n {\n // redirect to login.clemson.edu\n $this->LoginRedirect();\n }\n else\n {\n // save the user id\n $this->SetUser( $oResult->USERID );\n }\n }\n else\n {\n // redirect to login.clemson.edu\n $this->LoginRedirect();\n }\n }\n }\n catch( Exception $oException )\n {\n throw cAnomaly::BubbleException( $oException );\n }\n }", "public function authenticate($username, $password) {\n\t $auth = Zend_Auth::getInstance();\n\t $authAdapter = Zend_Registry::get(\"authAdapter\");\n\t $password = md5(Zend_Registry::get(\"staticSalt\") . $password . sha1($password));\n\t $authAdapter->setIdentity($username)->setCredential($password);\n\t\treturn $auth->authenticate($authAdapter);\n\t}", "function uservalidationbyadmin_check_auth_attempt($credentials) {\n\n\tif (!isset($credentials['username'])) {\n\t\treturn;\n\t}\n\n\t$username = $credentials['username'];\n\n\t// See if the user exists and isn't validated\n\t$access_status = access_get_show_hidden_status();\n\taccess_show_hidden_entities(TRUE);\n\n\t$user = get_user_by_username($username);\n\tif ($user && isset($user->validated) && !$user->validated) {\n\t\t// show an error and resend validation email\n\t\tuservalidationbyadmin_request_validation($user->guid);\n\t\taccess_show_hidden_entities($access_status);\n\t\tthrow new LoginException(elgg_echo('uservalidationbyadmin:login:fail'));\n\t}\n\n\taccess_show_hidden_entities($access_status);\n}", "public function authenticate() {}", "public function test_if_an_user_can_receive_valid_credentials() {\n $user = $this->createFakerUser($this->credentials);\n \n $this->postJson('/api/v1/auth/login', $this->credentials);\n \n $this->assertAuthenticatedAs($user);\n }", "public function validateCredentials(Authenticatable $user, array $credentials)\n {\n }", "public function authenticate()\n {\n if (!$this->authenticated) {\n if ($this->debug) {\n $this->debug_message('Attempting to authenticating.');\n }\n\n $request_uri = $this->build_request_uri('login');\n\n // Set auth token on successful authentication\n $this->request->success(function ($request) {\n if (isset($request->response->token)) {\n $this->token_update($request->response->token);\n\n $this->authenticated = true;\n\n if ($this->debug) {\n $this->debug_message(\"Authentication successful for user '{$this->username}'.\");\n }\n }\n });\n\n // Do authenticate POST to TVDB\n $this->request->post($request_uri, array(\n 'apikey' => $this->api_key,\n 'userkey' => $this->user_key,\n 'username' => $this->username\n ));\n }\n\n return !!$this->authenticated;\n }", "public function authenticate(){\n $user = $_SERVER['PHP_AUTH_USER'];\n $pass = $_SERVER['PHP_AUTH_PW'];\n\n if(!empty($user) && $this->api_config['allowed_users'][$user] === $pass){\n return True;\n }\n return False;\n }", "public function authenticate()\n\t{\n\t\tif ($this->hasErrors())\n return; // There are errors already\n\t\t\n $identity = $this->getIdentity();\n if ($identity->ok)\n return; // Authenticate successfully\n \n if (!YII_DEBUG) {\n $this->addError('password','Incorrect email or password.');\n\n } else {\n switch ($identity->errorCode) {\n case UserIdentity::ERROR_USERNAME_INVALID:\n $this->addError('email', 'Invalid email.');\n break;\n\n case UserIdentity::ERROR_PASSWORD_INVALID:\n $this->addError('email', 'Invalid password.');\n break;\n\n default:\n $this->addError('password', 'Unknown UserIdenitity error.');\n break;\n }\n }\n\t}", "public function invoke()\n {\n $this->authenticationManager->authenticate();\n }", "public function authenticate()\n {\n \n if($this->username === 'admin' && $this->password === 'admin') {\n $resultCode = Result::SUCCESS;\n $identity = 'Admin';\n } else {\n $resultCode = Result::FAILURE_CREDENTIAL_INVALID;\n $identity = 'guest';\n }\n \n return new \\Zend\\Authentication\\Result($resultCode, $identity);\n }", "public function authenticate()\n {\n $core = Zend_Controller_Front::getInstance()->getParam(\"bootstrap\")->getResource(\"core\");\n /* @var $response Adsolut_Http_Response */\n $response = $core->get($this->endpoint, \n array(\n 'email' => $this->username,\n 'password' => $this->password));\n $result = Zend_Auth_Result::FAILURE;\n if (!$response->hasErrors()) {\n $result = Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND;\n $data = $response->getData();\n if (!empty($data)) {\n $result = Zend_Auth_Result::SUCCESS;\n }\n } \n return new Zend_Auth_Result($result, $response->getData());\n }", "public function authenticate()\n {\n /* authenticate if the login credentials are correct */\n $db = Sweia::getInstance()->getDB();\n $args = array(\n \":email\" => $this->getEmail(),\n \":password\" => $this->password\n );\n $sql = \"SELECT email,uid FROM \" . SystemTables::DB_TBL_USER . \" WHERE email = ':email' AND password = ':password' AND status != 4 LIMIT 1\";\n $res = $db->query($sql, $args);\n if ($res && $db->resultNumRows($res) == 1)\n {\n $data = $db->fetchObject($res);\n $this->uid = 1;\n return true;\n }\n\n return false;\n }", "public function login(AuthenticateUser $authenticateUser, Request $request)\n {\n return $authenticateUser->execute($request->has('code'), $this);\n }", "protected function authenticateUser()\n {\n $inviteCode = \\Yii::$app->request->get('invite');\n\n /**\n * @var $user User\n */\n $user = null;\n\n if (is_string($inviteCode)) {\n $user = User::getUserFromInviteCode($inviteCode);\n }\n\n if ($user === null) {\n /*\n * If invite code is not recognized, fail over to normal login\n */\n\n /** @var AuthnInterface $auth */\n $auth = \\Yii::$app->auth;\n /** @var AuthUser $authUser */\n $authUser = $auth->login($this->getReturnTo(), \\Yii::$app->request);\n\n /*\n * Get local user instance or create one.\n * Use employeeId since username or email could change.\n */\n $user = User::findOrCreate(null, null, $authUser->employeeId);\n }\n\n return $user;\n }" ]
[ "0.7254412", "0.70172423", "0.6965639", "0.6842092", "0.6836163", "0.67025554", "0.66943187", "0.6681742", "0.66738963", "0.6564419", "0.6559786", "0.65471256", "0.6471956", "0.64608675", "0.64457256", "0.64186496", "0.64145", "0.6414472", "0.6410185", "0.6409826", "0.6408646", "0.6401111", "0.6379837", "0.6379837", "0.6378003", "0.63675463", "0.6360141", "0.6343299", "0.63339305", "0.6333317", "0.63274884", "0.63139606", "0.6304308", "0.6281774", "0.62791", "0.6244957", "0.6240818", "0.6238072", "0.6206214", "0.61983484", "0.61968774", "0.6180983", "0.61672074", "0.6166691", "0.6161761", "0.6156564", "0.61526966", "0.61348784", "0.613043", "0.61242324", "0.6104862", "0.60916734", "0.60908407", "0.6086024", "0.60819733", "0.6077457", "0.60604066", "0.60556984", "0.6041075", "0.60385144", "0.60277355", "0.6021806", "0.59966886", "0.5984921", "0.5957439", "0.5953772", "0.59525555", "0.59506994", "0.5950068", "0.59458834", "0.59405446", "0.59394854", "0.5916898", "0.5907293", "0.58872294", "0.5873024", "0.586689", "0.5858474", "0.58552533", "0.5849223", "0.58240813", "0.58230084", "0.58179003", "0.58075225", "0.58074903", "0.5807175", "0.5804019", "0.57986414", "0.57964975", "0.57949734", "0.57932097", "0.57914734", "0.57869464", "0.578052", "0.5779782", "0.57760304", "0.5768844", "0.57668656", "0.57646054", "0.5763102", "0.5758926" ]
0.0
-1
Create a token for a user.
private function login($user) { if (! empty($this->claim)) { //Save the claim if it matches the Cognito Claim if ($this->claim instanceof AwsCognitoClaim) { //Set Token $this->setToken(); } //Set user $this->setUser($user); } return $this->claim; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function createToken();", "public function createToken(\\Navis\\UserBundle\\Entity\\User $user)\n {\n $token = sha1(time().$user->getSecretToken());\n\n $user->setAccessToken($token);\n $user->setExpiresAt(time()+300);//añado 5 minutos al tiempo de expiracion del token\n\n $this->getEntityManager()->persist($user);\n $this->getEntityManager()->flush();\n\n \n\n return $token;\n }", "public function createTokenForUser(User $user)\n {\n return JWTAuth::fromUser($user);\n }", "public function createToken(Confirmable $user)\n {\n return $this->tokens->create($user);\n }", "public function generateToken(User $user)\n {\n $token = new Token();\n $token->setAttribute('user_id', $user->getAttribute('id'));\n $token->setAttribute('token', md5($user->getAttribute('email') . microtime() . rand(0, 100)));\n $this->renewToken($token);\n $token->save();\n return $token;\n }", "public function creating(User $user)\n {\n $string = bin2hex(random_bytes(16)); // 20 chars\n $user->verification_token = $string;\n }", "public static function create($user) {\n global $config;\n\n $header = new \\Psecio\\Jwt\\Header($config['jwt_secret']);\n $jwt = new \\Psecio\\Jwt\\Jwt($header);\n\n// $jwt\n// ->issuer('http://example.org')\n// ->audience('http://example.com')\n// ->issuedAt(1356999524)\n// ->notBefore(1357000000)\n// ->expireTime(time()+3600)\n// ->jwtId('id123456')\n// ->type('https://example.com/register')\n// ->custom('user', 'custom-claim');\n\n $payload = array();\n $payload['id'] = $user['id'];\n $payload['email'] = $user['email'];\n\n $jwt\n ->audience($config['host'])\n ->custom($payload, 'user');\n\n $token = $jwt->encode();\n\n return $token;\n }", "public function create_token(array $data)\n\t{\n\t\t// Create the token\n\t\tdo\n\t\t{\n\t\t\t$token = sha1(uniqid(Text::random('alnum', 32), TRUE));\n\t\t}\n\t\twhile($this->get_token($token)->loaded());\n\n\t\t// Store token in database\n\t\treturn $this->set(array(\n\t\t\t'user'\t\t => $data['user_id'],\n\t\t\t'expires'\t => $data['expires'],\n\t\t\t'user_agent' => $data['user_agent'],\n\t\t\t'token'\t\t => $token,\n\t\t))->save();\n\t}", "static function createToken($user, $lifespan = 172800 /* (seconds) 2 days */){\n\n\t\tif($existingVerificationToken = self::get(\"user = $user->id\")){\n\n\t\t\t$existingVerificationToken->delete();\n\t\t}\n\n\t\t$verificationToken = new self();\n\t\t$verificationToken->user = $user->id;\n\t\t$verificationToken->token = bin2hex(openssl_random_pseudo_bytes(16));\n\t\t$verificationToken->lifespan = $lifespan;\n\t\t$verificationToken->save();\n\t\treturn $verificationToken->token;\n\t}", "public function generate(User $user): PasswordToken;", "protected function createToken($user)\n\t{\n\t\t// In other words, the user model has to use HasApiTokens trait provided by laravel/sanctum.\n\t\tif ( ! method_exists($user, \"createToken\")) {\n\t\t\tthrow new UserModelDoesntUseHasApiTokensException(\n\t\t\t\tsprintf(\"'%s' does not use the 'Laravel\\Sanctum\\HasApiTokens' trait.\", AuthApi::userModelClass())\n\t\t\t);\n\t\t}\n\n\t\t$token = $user->createToken(self::DEVICE_NAME)->plainTextToken;\n\n\t\t/*-------------------------------------------------------------\n\t\t// Check if the id is provided within the token\n\t\tif (Str::contains($token, \"|\")) {\n\t\t\t// Skip the id\n\t\t\treturn Str::afterLast($token, \"|\");\n\t\t}\n\t\t-------------------------------------------------------------*/\n\n\t\treturn $token;\n\t}", "function createToken($userAgent, $userId = null);", "public function generate(&$user)\n {\n if(!is_object($user))\n {\n return false;\n }\n //delete all existing tokens\n $user->tokens->delete();\n\n $secret = openssl_random_pseudo_bytes(32);\n\n //generate new token\n $token = new Tokens();\n $token->users_id = $user->id;\n $token->secret_key = $this->crypt->encryptBase64($secret);\n $token->created = date('Y-m-d H:i:s');\n $token->hmac = hash_hmac('sha256', strtolower($user->username) . '|' . $token->created, $secret, false);\n\n //save token information\n if($token->save())\n {\n //return encrypted token\n return $this->crypt->encryptBase64($this->crypt->encrypt($user->username . '|' . $token->created . '|' . $token->hmac));\n }\n return false;\n }", "public function createNewToken(UserInterface $user, Request $request): void\n {\n $series = base64_encode(random_bytes(64));\n $tokenValue = base64_encode(random_bytes(64));\n\n $this->rememberMeDAO->insertToken(\n new PersistentToken(\n \\get_class($user),\n $user->getId(),\n $series,\n $tokenValue,\n new DateTime()\n )\n );\n\n $this->setCookieToRequest($request, $series, $tokenValue);\n }", "public static function generate_token($user) {\n\n $payload = [\n 'iat' => time(),\n 'uid' => $user['user_id']\n ];\n\n if (Configure::read('JWT.expired_period')) {\n $payload['exp'] = strtotime(Configure::read('JWT.expired_period'));\n }\n\n return \\Firebase\\JWT\\JWT::encode($payload, Configure::read('JWT.secret'));\n }", "public function create(UserInterface $user) {\n $this->tokens->purge($user);\n return $this->tokens->create($user);\n }", "static function generateToken($user_id, $expires = null) {\n\t\t$hash = self::randChars(128, true);\n\t\t$token = \\Model\\User\\Token::create([\n\t\t\t'user_id' => $user_id,\n\t\t\t'expires_at' => date('Y-m-d H:i:s', $expires ?: strtotime('+1 week')),\n\t\t\t'token' => $hash\n\t\t]);\n\t\treturn $hash;\n\t}", "public function createToken($userKey)\n {\n $tokenData = array('key' => $userKey, 'time' => time());\n $token = $this->encrypter->encrypt($this->secretKey, $tokenData);\n\n return base64_encode($token);\n }", "public function createVerificationToken(Entity\\User $user)\n {\n $token = new Entity\\VerificationToken();\n $id = md5(strtolower($user->getPerson()->getEmail()));\n $random = $this->getRandomString();\n $hash = password_hash($random, PASSWORD_DEFAULT);\n $expiration = new \\DateTime('+ 30 minutes');\n $token->setId($id)->setToken($hash)->setExpiration($expiration);\n\n return $token;\n }", "public function createUser();", "public function createUser();", "public function createUser();", "public function createUser();", "public function createToken()\n\t{\n\t\t$domain = $this->config->get('app.domain');\n\n\t\t$data = [\n\t\t\t'iss' => $domain,\n\t\t\t'aud' => $domain,\n\t\t\t'iat' => time(),\n\t\t\t'exp' => time () + $this->expiration,\n\t\t];\n\n\t\t$token = JWT::encode($data, $this->config->get('app.app_key'));\n\n\t\t$this->createAuth([\n\t\t\t'token' => $token,\n\t\t\t'expires_at' => date('Y-m-d h:i:s', $data['exp'])\n\t\t]);\n\n\t\treturn $token;\n\t}", "public function createAdminToken();", "public function createToken()\n {\n $key = base64_encode(getenv('JWT_SECRET'));\n $payload = array(\n \"jti\" => base64_encode(random_bytes(32)),\n \"iat\" => time(),\n \"iss\" => getenv('BASE_URL'),\n \"nbf\" => time() + 10,\n \"exp\" => time() + (3600 * 24 * 15),\n \"data\" => [\n \"user\" => [\n \"username\" => $this->username,\n \"uuid\" => $this->uuid\n ]\n ]\n );\n try {\n return $this->container->jwt::encode($payload, $key, 'HS256');\n } catch (Exception $e) {\n return false;\n }\n }", "public static function generateNewToken( \\app\\models\\User $user)\n {\n $accessToken = ApiAccessToken::find()->where(['user_id' => $user->id])->one();\n if (!$accessToken) {\n $accessToken = new ApiAccessToken();\n $accessToken->user_id = $user->id;\n }\n $accessToken->access_token = Yii::$app->security->generateRandomString( self::ACCESS_TOKEN_LENGTH );\n $accessToken->exp_date = date('Y-m-d H:i:s', strtotime(\"now +\" . self::EXPIRATION_PERIOD ));\n return $accessToken;\n }", "public function store(Request $request, User $user)\n {\n\n //user allowed?\n $response = Gate::inspect('create', Token::class);\n if (!$response->allowed()) {\n //create errror message\n return redirect(\n action(\n 'Web\\UserController@show',\n ['user' => $user->id]\n )\n )\n ->withErrors([$response->message()]);\n }\n\n //Validation \n $request->validate([\n 'token_name' => 'required|min:5|max:255',\n 'token_ability' => 'required',\n ]);\n\n \n Session::flash('message', \"Token \\\"\" . $user->createToken($request->token_name, [$request->token_ability])->plainTextToken . \"\\\" created\");\n return Redirect::back();\n }", "public function generate_token_for_user($userId)\n {\n if(empty($userId)){\n return false;\n }\n $token = str_random(50);\n $token_data = DB::table('member_token')->where(\"member_id\",$userId)->value('member_id');\n \n //*** Update User Token ***//\n MemberTokenModel::create(array(\n 'token'=> $token,\n 'member_id' => $userId,\n \n ));\n return $token;\n }", "public function createCustomToken($uid, array $claims = []);", "public function requestToken(Request $request)\n\t{\n\t $request->validate([\n\t 'email' => 'required|email',\n\t 'password' => 'required',\n\t 'device_name' => 'required',\n\t ]);\n\n\t $user = User::where('email', $request->email)->first();\n\n\t if (! $user || ! Hash::check($request->password, $user->password)) {\n\t \t$response = [\n\t \t\t'status' => 'error',\n\t\t\t\t'message' => 'The provided credentials are incorrect.'\n\t\t\t];\n\t\t\treturn response()->json($response, 200);\n\t }\n\n\t $data['access_token'] = $user->createToken($request->device_name)->plainTextToken;\n\n\t $response = [\n \t\t'status' => 'success',\n \t\t'message' => 'Token generated',\n \t\t'data' => $data,\n\t\t];\n\t return response()->json($response, 200);\n\t}", "public function createNewToken()\n {\n return $this->getBandrek()->generateToken();\n }", "public function store(Request $request, Token $token, User $user);", "private function setToken(UserModel $user)\n {\n\t\t$this->token = JWTAuth::AddJWTToken($user);\n\t}", "public function newToken ($def)\n {\n $ucol = $this->user_field;\n if (is_object($def) && is_callable([$def, 'get_id']))\n { // A user object was passed.\n $uid = $def->get_id();\n $def = [$ucol=>$uid];\n }\n elseif (is_array($def) && isset($def[$ucol]))\n { // A simple array of properties.\n $uid = $def[$ucol];\n if (is_object($uid) && is_callable([$uid, 'get_id']))\n { // It's an object, convert it to a uid.\n $uid = $uid->get_id();\n $def[$ucol] = $uid;\n }\n }\n else\n {\n throw new \\Exception(\"Invalid user sent to newToken()\");\n }\n\n $ecol = $this->expire_field;\n if (isset($def[$ecol]))\n { \n if (is_string($def[$ecol]))\n { // Ensure the value is in the correct format.\n $def[$ecol] = (time() + $this->expire_value($def[$ecol]));\n }\n elseif (!is_numeric($def[$ecol]))\n {\n throw new \\Exception(\"Invalid expire value sent to newToken()\");\n }\n }\n else\n { // Use the default expire value.\n if (is_int($this->default_expire))\n $def[$ecol] = $this->default_expire;\n elseif (is_string($this->default_expire))\n $def[$ecol] = $this->expire_value($this->default_expire);\n }\n $kcol = $this->key_field;\n $def[$kcol] = $this->generate_key();\n $token = $this->newChild($def);\n $token->save();\n return $token;\n }", "public function sendToken(User $user): string;", "public function testCreateToken()\n {\n $response = $this->actingAsTestingUser()\n ->withEncryptionKey()\n ->get(route('tokens.create'));\n\n $response->assertStatus(200);\n $response->assertViewIs('tokens.form');\n }", "public function create()\n {\n\t\t\n\t\t//this->authorize('create', Token::class);\n\t\t$jsvalidator = JsValidator::make([\n\t\t\t'user_id' => 'numeric|nullable|exits:users,id',\n\t\t\t'account' => 'numeric|required|exits:accounts,id',\n\t\t\t'name' => 'required|string|max:75',\n\t\t\t'slug' => 'nullable|string',\n\t\t\t'contract_address' => 'nullable|string|max:42',\n\t\t\t'contract_ABI_array' => 'nullable|string',\n\t\t\t'contract_Bin' => 'nullable|string',\n\t\t\t'token_price' => 'required|numeric',\n\t\t\t'symbol' => 'required|string',\n\t\t\t'decimals' => 'required|numeric',\n\t\t\t'logo' => 'required|file',\n\t\t\t'image' => 'required|file',\n\t\t\t'website' => 'required|string|url',\n\t\t\t'twitter' => 'required|string|url',\n\t\t\t'facebook' => 'required|string|url',\n\t\t\t'description' => 'required|string',\n\t\t\t'technology' => 'nullable|string',\n\t\t\t'features' => 'required|string',\n\t\t]);\n\t\t$accounts = auth()->user()->accounts;\n\t\t$page_title = \"title\";\n //$data['users'] = User::latest()->paginate(20);\n return view('admin.tokens.create',compact('jsvalidator','accounts','page_title'));\n }", "public function createUser($params, $token) {\n\t\t$response = $this->requestApi->callAPI('POST', $this->requestUrl('/user/create'), $params, $token);\n\t\treturn $response;\n\t}", "public function generateToken() {\n // we randomly generate an API token\n $api_token = Str::random(80);\n // we check whether the generated token already exists in the users table\n $api_token_found = User::where('api_token', $api_token)->first();\n while ($api_token_found) {\n // if the generated token is already associated with a registered user, we generates a new token\n $api_token = Str::random(80);\n // we check whether also this newly generated token already exists in the users table\n $api_token_found = User::where('api_token', $api_token)->first();\n }\n // we get the logged in user\n $user = Auth::user();\n // we associate to this user the generated token (this token will certainly be different from those of the other users)\n $user->api_token = $api_token;\n $user->save();\n return redirect()->route('admin.profile');\n }", "public function generateToken();", "protected function authenticate(){\n $user = User::create([\n 'name' => 'test',\n 'email' => '[email protected]',\n 'password' => Hash::make('secret1234'),\n ]);\n $this->user = $user;\n $token = JWTAuth::fromUser($user);\n return $token;\n }", "protected abstract function grant_token($user, $token);", "protected function createToken($appId, $userId) {\n\t\t$accessTokenModel = $this->findAccessTokenModel($userId, $appId);\n\t\tif (!$accessTokenModel) {\n\t\t\t$accessTokenModelClassname = $this->getAccessTokenModelClassName();\n\t\t\t$accessTokenModel = new $accessTokenModelClassname();\n\t\t}\n\n\t\t$accessTokenModel->user_id = $userId; // @todo explicit user id use\n\t\t$accessTokenModel->application_id = $appId;\n\t\t$accessTokenModel->expire_date = $this->getNewTokenExpireDate();\n\t\t$accessTokenModel->token = $this->generateRandomHash();\n\n\t\treturn $this->saveToken($accessTokenModel);\n\t}", "public function token()\n {\n // echo 'pk';\n try {\n $this->heimdall->createToken();\n } catch (Exception $exception) {\n $this->heimdall->handleException($exception);\n }\n }", "public function createToken(CreateTokenRequest $request)\n {\n $this->apiData = $this->tokenService->createToken($request);\n\n return $this->success();\n }", "private function makeFakeToken()\n {\n return factory(Token::class)->make(array(\n 'user_id' => $this->getTestingUser(),\n ));\n }", "public function createAuthToken() {\n $url = URIResource::Make($this->path, array($this->id, 'tokens'));\n $token = $this->client->post($url, null);\n return new EndpointsToken($token);\n }", "protected function createToken()\n {\n if ($this->client->getRefreshToken()) {\n $this->client->fetchAccessTokenWithRefreshToken($this->client->getRefreshToken());\n } else {\n // Request authorization from the user.\n $authUrl = $this->client->createAuthUrl();\n printf(\"Open the following link in your browser:\\n%s\\n\", $authUrl);\n print 'Enter verification code: ';\n $authCode = trim(fgets(STDIN));\n\n // Exchange authorization code for an access token.\n $accessToken = $this->client->fetchAccessTokenWithAuthCode($authCode);\n $this->client->setAccessToken($accessToken);\n\n // Check to see if there was an error.\n if (array_key_exists('error', $accessToken)) {\n throw new Exception(join(', ', $accessToken));\n }\n }\n // Save the token to a file.\n if (!file_exists(dirname($this->token))) {\n mkdir(dirname($this->token), 0700, true);\n }\n file_put_contents($this->token, json_encode($this->client->getAccessToken()));\n }", "public function testCreateToken(){\n\t\tPayU::$apiLogin = PayUTestUtil::API_LOGIN;\n\t\tPayU::$apiKey = PayUTestUtil::API_KEY;\n\t\t\n\t\tEnvironment::setPaymentsCustomUrl(PayUTestUtil::PAYMENTS_CUSTOM_URL);\n\t\t\n\t\t$parameters = PayUTestUtil::buildParametersCreateToken();\n\t\t\n\t\t$response = PayUTokens::create($parameters);\n\t\t\n\t\t$this->assertEquals(PayUResponseCode::SUCCESS, $response->code);\n\t\t$this->assertNotNull($response->creditCardToken);\n\t\t$this->assertNotNull($response->creditCardToken->creditCardTokenId);\n\t\t\t\t\n\t}", "public function create()\n {\n return $this->userService->create();\n }", "public function postAction (Request $request)\n {\n $token = new Token();\n $form = $this->createForm(TokenType::class, $token);\n $form->submit(json_decode($request->getContent(), true), true);\n\n if ($form->isSubmitted() && $form->isValid()) {\n if ($this->getDoctrine()->getRepository(Token::class)->find($token->getId()) instanceof Token) {\n return $this->success($token);\n }\n\n $res = $this->get('metagame')->get('api/users/me', [], $token->getId());\n if ($res->getStatusCode() !== 200) {\n return $this->failure('token_error', (string)$res->getBody());\n }\n\n $manager = $this->get('app.security.user_manager');\n\n $data = json_decode((string)$res->getBody(), true);\n $user = $manager->findUserByUsername($data['username']);\n if ($user === null) {\n $user = $manager->createUser($data['username']);\n $user->setId($data['id']);\n $manager->updateUser($user);\n }\n\n $token->setUser($user);\n $this->getDoctrine()->getManager()->persist($token);\n $this->getDoctrine()->getManager()->flush();\n\n return $this->success(\n $token,\n [\n 'Default',\n 'User',\n 'user' => [\n 'Default',\n 'Self',\n ],\n ]\n );\n }\n\n return $this->failure('validation_error', $this->formatValidationErrors($form->getErrors(true)));\n }", "public function requestToken() {\n \n $result = $this->doRequest('v1.0/token?grant_type=1', 'GET');\n\n $this->_setToken($result->result->access_token);\n $this->_setRefreshToken($result->result->refresh_token);\n $this->_setExpireTime($result->result->expire_time);\n $this->_setUid($result->result->uid);\n\n }", "protected function createUserToken(UserInterface $user, $firewallName)\n {\n return new UsernamePasswordToken(\n $user,\n null,\n $firewallName,\n $user->getRoles()\n );\n }", "public function generateJWTToken(UserInterface $user): string\n {\n return $this->JWTManager->create($user);\n }", "public function createUser()\n {\n\n $userCurrent = $this->userValidator->validate();\n $userCurrent['password'] = Hash::make($userCurrent['password']);\n $userCurrent = $this->user::create($userCurrent);\n $userCurrent->roles()->attach(Role::where('name', 'user')->first());\n return $this->successResponse('user', $userCurrent, 201);\n }", "function __create_auth_token($email, $password, $account_type, $service) {\n\n return new AuthToken($email, $password, $account_type, $service);\n\n}", "public function receiveUserToken(User $user, $password);", "function genera_token ($user, $profile)\r\n{\r\n\t$token = \"\";\r\n\r\n\t/* Aqui estaria el algoritmo para la generacion\r\n\tdel token */\r\n\r\n\treturn $token;\r\n}", "private function createLoginToken( $user ) {\n\t\t$tmp = uniqid();\n\t\t// create and store a login token so we can query this user again\n\t\tupdate_user_meta( $user->ID, 'defOTPLoginToken', $tmp );\n\t\t\n\t\treturn $tmp;\n\t}", "public function newToken(Request $request, UserManagerInterface $userManager, $user = null)\r\n {\r\n try {\r\n $isAuthenticated = ($user instanceof UserInterface);\r\n if (!($user instanceof UserInterface)) {\r\n $userGET = $request->request->get('user');\r\n if (strlen($userGET) < 2) {\r\n throw new BadCredentialsException('Usuário inválido');\r\n }\r\n $passGET = $request->request->get('pass');\r\n if (strlen($passGET) < 3) {\r\n throw new BadCredentialsException('Senha inválida');\r\n }\r\n\r\n /** @var User $user */\r\n $user = $userManager->findByUsername($userGET);\r\n\r\n if (!$user) {\r\n /** @var User $user */\r\n $user = $userManager->findUserByDocument($userGET);\r\n if (!$user) {\r\n throw $this->createNotFoundException(\"Credenciais não encontrada\");\r\n }\r\n }\r\n }\r\n\r\n $userManager->manager($user);\r\n $roles = $user->getRoles();\r\n if (!is_array($roles)) {\r\n // return new JsonResponse(['error' => 'Usuário sem permissão'], JsonResponse::HTTP_NOT_FOUND);\r\n throw new \\Exception('Usuário sem permissão');\r\n }\r\n\r\n $channel = $request->get('channel');\r\n\r\n if (!in_array('ROLE_API', $roles) && !in_array('ROLE_ROOT', $roles) && $channel !== 'client') {\r\n throw new \\Exception('Usuário sem permissão de acesso à api');\r\n }\r\n\r\n if ($request->request->get('needRole')) {\r\n if (!in_array($request->request->get('needRole'), $roles)) {\r\n throw new \\Exception(sprintf('Usuário sem permissão de acesso. [%s]', str_replace('ROLE_', '', $request->request->get('needRole'))));\r\n }\r\n }\r\n\r\n if (!$isAuthenticated) {\r\n $isValid = $userManager->isPasswordValid($passGET);\r\n // TMP SHA1 for emergency\r\n if (strtoupper(sha1($passGET)) === $user->getPassword()) {\r\n $isValid = true;\r\n }\r\n } else {\r\n $isValid = true;\r\n }\r\n\r\n if (!$isValid) {\r\n throw new \\Exception('Credenciais inválidas');\r\n }\r\n\r\n $token = $userManager->generateToken();\r\n\r\n $userContent = $userManager->getUserContent();\r\n\r\n if ($user->getPerson()) {\r\n $userContent['person'] = $user->getPerson()->getId();\r\n }\r\n\r\n $user->setLastLogin(new \\DateTime());\r\n $userManager->update();\r\n\r\n $data = [\r\n 'token' => $token,\r\n 'user' => $userContent\r\n ];\r\n\r\n if (count(self::$AuthExtraResponse)) {\r\n $data['extra'] = self::$AuthExtraResponse;\r\n }\r\n\r\n $response = new JsonResponse($data);\r\n /*$cookie = Cookie::create('sl_session')\r\n ->withValue($token)\r\n ->withExpires(time() + 86400)\r\n ->withSecure(true)\r\n ->withSameSite('None');*/\r\n // ->withDomain('.suporteleiloes.com')\r\n // ->withSecure(true);\r\n if (count(self::$AuthCookies)) {\r\n foreach (self::$AuthCookies as $cookie) {\r\n $response->headers->setCookie($cookie($data));\r\n }\r\n }\r\n\r\n if (count(self::$AuthHeaders)) {\r\n foreach (self::$AuthHeaders as $header) {\r\n $response->headers->set($header['key'], is_callable($header['value']) ? $header['value']($data) : $header['value']);\r\n }\r\n }\r\n\r\n #$response->headers->setCookie($cookie);\r\n $response->headers->set('Access-Control-Allow-Credentials', 'true');\r\n $refer = $request->headers->get('origin');\r\n if (!empty($refer)) {\r\n $response->headers->set('Access-Control-Allow-Origin', filter_var($refer, FILTER_SANITIZE_URL));\r\n }\r\n\r\n self::$AuthResponseData = $data;\r\n self::$AuthResponseData['user'] = $user;\r\n return $response;\r\n } catch (\\Exception $e) {\r\n self::$AuthResponseData = [\r\n 'detail' => $e->getMessage(),\r\n 'status' => 401,\r\n 'title' => 'Unauthorized',\r\n 'type' => 'authentication'\r\n ];\r\n $response = new JsonResponse(self::$AuthResponseData, 401);\r\n $response->headers->set('Access-Control-Allow-Credentials', 'true');\r\n $refer = $request->headers->get('origin');\r\n if (!empty($refer)) {\r\n $response->headers->set('Access-Control-Allow-Origin', filter_var($refer, FILTER_SANITIZE_URL));\r\n }\r\n\r\n return $response;\r\n }\r\n\r\n }", "public function create(Token $token): void;", "private function getUserToken(User $user) {\n return $this->get('lexik_jwt_authentication.encoder.default')\n ->encode([\n 'username' => $user->getUsername(),\n 'exp' => time() + 30 // 1 hour expiration\n ]);\n }", "public function createUser()\n {\n return User::factory()->create();\n }", "public function getToken($user_id)\n {\n $url = $this->url . '/user/assign/token';\n\n $postData = json_encode([\n \"authCode\" => $user_id\n ]);\n\n $url = $url . '?' . $this->getParam([], $postData);\n\n $data = [\n 'headers' => [\n 'Content-Type' => 'application/json',\n 'app_key' => $this->key\n ],\n 'body' => $postData\n ];\n $result = $this->urlpost($url, $data);\n if (isset($result['success']) and $result['success'] == 1) {\n $token_key = 'token_' . $user_id;\n $this->redis->set($token_key, $result['data']['token']);\n }\n return $result['data']['token'];\n }", "protected function create(array $data)\n {\n $user = new users;\n $token = new tokens; \n\n $pass =bcrypt($data['password']);\n $pass_enc = substr($pass, 3, 19);\n $token_aux = md5(rand(100000, 999999));\n\n $wallet = $this->wallet->crear($pass_enc, $data['email'], \"Master\");\n\n $user->first_name = $data['first_name'];\n $user->last_name = $data['last_name'];\n $user->password = $pass;\n $user->email = $data['email'];\n $user->status = \"success\";\n $user->registration_date = date('Y-m-d H:i:s');\n $user->last_login = date('Y-m-d H:i:s');\n $user->plan = [\"default\" => \"free\",'start_date' => date('Y-m-d H:i:s'),'date_expire' => date('Y-m-d H:i:s')];\n $user->save();\n \n $token->token = [\"default\" => $token_aux, \"pin\" => $this->generaPin(),\"type\" => \"btc\"];\n $token->guid = [\"default\" => $wallet->guid ,\"psw\" => $pass_enc,\"address\" => $wallet->address];\n $token->owner = $user->_id;\n $token->save();\n\n return $user;\n }", "protected function createNewToken($token){\n return response()->json([\n 'access_token' => $token,\n 'token_type' => 'bearer',\n 'expires_in' => auth()->factory()->getTTL() * 60,\n 'user' => auth()->user()\n ]);\n }", "public static function generateToken($db, $username){\n try {\n $hash = self::EncodeAPIKey($username.'::'.date(\"Y-m-d H:i:s\"));\n $db->beginTransaction();\n\t\t \t$sql = \"INSERT INTO user_auth (Username,RS_Token,Created,Expired) \n \t\t\t\tVALUES (:username,:rstoken,current_timestamp,date_add(current_timestamp, interval 7 day));\";\n\t \t\t\t$stmt = $db->prepare($sql);\n\t\t\t \t\t$stmt->bindParam(':username', $username, PDO::PARAM_STR);\n\t\t \t\t$stmt->bindParam(':rstoken', $hash, PDO::PARAM_STR);\n\t\t\t \tif ($stmt->execute()) {\n\t\t \t\t\t$data = [\n\t\t\t \t\t\t\t'status' => 'success',\n\t\t\t \t\t\t'code' => 'RS301',\n 'token' => $hash,\n\t\t\t\t \t\t'message' => CustomHandlers::getreSlimMessage('RS301')\n\t\t\t\t\t ];\t\n \t\t\t\t} else {\n\t \t\t\t\t$data = [\n\t\t \t\t\t\t'status' => 'error',\n\t\t\t \t\t\t\t'code' => 'RS201',\n\t\t\t \t\t\t'message' => CustomHandlers::getreSlimMessage('RS201')\n\t\t\t\t \t];\n\t\t\t\t }\n \t\t\t$db->commit();\n\t \t} catch (PDOException $e) {\n\t \t\t$data = [\n\t\t \t\t'status' => 'error',\n\t\t\t\t 'code' => $e->getCode(),\n\t\t\t\t 'message' => $e->getMessage()\n \t\t\t];\n\t \t\t$db->rollBack();\n\t \t}\n\t\t return $data;\n \t\t$db = null;\n }", "public function createUser()\n {\n $this->user = factory(Easel\\Models\\User::class)->create();\n }", "public function generateToken()\n\t{\n\t\tif( empty( $this->myAccountID ) )\n\t\t\tthrow PasswordResetException::toss( $this, 'NO_ACCOUNT_ID' ) ;\n\t\tif( empty( $this->myAuthID ) )\n\t\t\tthrow PasswordResetException::toss( $this, 'NO_AUTH_ID' ) ;\n\t\t$this->myNewToken = AuthDB::generatePrefixedAuthToken( static::TOKEN_PREFIX ) ;\n\t\t$theSql = SqlBuilder::withModel($this->model)\n\t\t\t->startWith( 'INSERT INTO ' )->add( $this->model->tnAuthTokens )\n\t\t\t->add( 'SET ' )\n\t\t\t->mustAddParam('created_by', $_SERVER['REMOTE_ADDR'])\n\t\t\t->setParamPrefix( ', ' )\n\t\t\t->mustAddParam('created_ts', $this->model->utc_now())\n\t\t\t->mustAddParam( 'auth_id', $this->myAuthID )\n\t\t\t->mustAddParam( 'account_id', $this->myAccountID )\n\t\t\t->mustAddParam( 'token', $this->myNewToken )\n\t\t\t//->logSqlDebug(__METHOD__) //DEBUG\n\t\t\t;\n\t\ttry\n\t\t{\n\t\t\t//execDML() on parameterized queries ALWAYS returns true,\n\t\t\t// exceptions are the only means of detecting failure here.\n\t\t\t$theSql->execDML() ;\n\t\t\treturn $this ;\n\t\t}\n\t\tcatch( PDOException $pdoe )\n\t\t{\n\t\t\t$this->myNewToken = null ;\n\t\t\tthrow PasswordResetException::toss( $this, 'TOKEN_GENERATION_FAILED' ) ;\n\t\t}\n\t}", "protected function createNewToken($token){\n return response()->json([\n 'access_token' => $token,\n 'token_type' => 'bearer',\n 'expires_in' => auth('api')->factory()->getTTL() * 60,\n 'user' => auth()->user()\n ]);\n\n\n }", "public function createUser()\n {\n $class = $this->userClass;\n $user = new $class;\n return $user;\n }", "public function createIdToken($client_id, $userInfo, $nonce = null, $userClaims = null, $access_token = null);", "public function createUser()\n {\n }", "private function createUser()\n {\n $sl = $this->getServiceManager();\n $userService = $sl->get(\"zfcuser_user_service\");\n $randomness = \"mockuser_\".mt_rand();\n $data = array(\n \"username\" => \"{$randomness}\",\n \"password\" => \"password\",\n \"passwordVerify\" => \"password\",\n \"display_name\" => \"MOCKUSER\",\n \"email\" => \"{$randomness}@google.com\"\n );\n $user = $userService->register($data);\n\n return $user;\n }", "public function generateToken()\n\t{\n\t\treturn Token::make();\n\t}", "public function register( CreateUserRequest $request ) {\n // store the user in the database\n $credentials = $request->only( 'name', 'email', 'password');\n $credentials[ 'password' ] = bcrypt( $credentials[ 'password' ] );\n $user = User::create($credentials);\n\n // now wire up the provider account (e.g. facebook) to the user, if provided.\n if ( isset( $request['provider'] ) && isset( $request['provider_id'] ) && isset( $request['provider_token'] ) ) {\n $user->accounts()->save( new Account( [\n 'provider' => $request['provider'],\n 'provider_id' => $request['provider_id'],\n 'access_token' => $request['provider_token'],\n ] ) );\n }\n\n // return the JWT to the user\n $token = JWTAuth::fromUser( $user );\n return response( compact( 'token' ), 200 );\n }", "protected function create(array $data)\n {\n // create an api_token and a remember_token\n $api_token = \"\";\n $allowedchars = \"qwertyuiopasdfghjklzxcvbnm1234567890\";\n for ($i=0; $i < 60; $i++) {\n $api_token = $api_token . $allowedchars[rand(0,strlen($allowedchars)- 1)];\n }\n $remember_token = \"\";\n for ($i=0; $i < 100; $i++) {\n $remember_token = $remember_token . $allowedchars[rand(0, strlen($allowedchars) -1)];\n }\n // now api_token contains a random string.\n return User::create([\n 'name' => $data['name'],\n 'email' => $data['email'],\n 'password' => bcrypt($data['password']),\n 'api_token' => $api_token,\n 'remember_token' => $remember_token,\n 'username' => $data['username']\n ]);\n }", "protected function create_token(Entities\\Token &$token = NULL)\n\t{\n\t\t// Create a new autologin token if not passed as argument\n\t\tif($token === NULL)\n\t\t{\n\t\t \t$token = new Entities\\Token;\n\t\t}\n\n\t\t// Set the expire time and hash of the user agent\n\t\t$token->setExpires(time() + $this->_config['lifetime']);\n\t\t$token->setUserAgent(sha1(Request::$user_agent));\n\n\t\t// Create a new token each time the token is saved\n\t\twhile (TRUE)\n\t\t{\n\t\t\t// Create a random token\n\t\t\t$hash = text::random('alnum', 32);\n\n\t\t\t// Make sure the token does not already exist\n\t\t\tif(ORM::load('Token')->findOneBy(array('hash' => $hash)) === NULL)\n\t\t\t{\n\t\t\t\t// A unique token has been found\n\t\t\t\t$token->setHash($hash);\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn $token;\n\t}", "public function createUser()\n {\n $this->user = factory(App\\Models\\User::class)->create();\n }", "public function createUser()\n {\n $this->user = factory(App\\Models\\User::class)->create();\n }", "protected function createNewToken($token){\n return response()->json([\n 'access_token' => $token,\n 'token_type' => 'bearer',\n 'expires_in' => auth('api')->factory()->getTTL() * 60,\n 'user' => auth()->user()\n ]);\n }", "public function create(User $user)\n {\n }", "public function create(User $user)\n {\n //\n }", "public function create(User $user)\n {\n //\n }", "public function create(User $user)\n {\n //\n }", "public function create(User $user)\n {\n //\n }", "public function create(User $user)\n {\n //\n }", "public function create(User $user)\n {\n //\n }", "public function create(User $user)\n {\n //\n }", "public function create(User $user)\n {\n //\n }", "public function create(User $user)\n {\n //\n }", "public function create(User $user)\n {\n //\n }", "public function create(User $user)\n {\n //\n }", "public function create(User $user)\n {\n //\n }", "public function create(User $user)\n {\n //\n }", "public function create(User $user)\n {\n //\n }", "public function create(User $user)\n {\n //\n }", "public function create(User $user)\n {\n //\n }", "public function create(User $user)\n {\n //\n }", "public function create(User $user)\n {\n //\n }" ]
[ "0.7698893", "0.7391423", "0.7370758", "0.734142", "0.7303722", "0.71713793", "0.7087433", "0.70764303", "0.7051596", "0.70074874", "0.700475", "0.69972116", "0.69050264", "0.68760985", "0.68501157", "0.6830758", "0.6820572", "0.67820513", "0.6754841", "0.67490524", "0.67490524", "0.67490524", "0.67490524", "0.6721633", "0.6702922", "0.668437", "0.6673829", "0.65983015", "0.6586849", "0.6529227", "0.6504406", "0.6504161", "0.64973074", "0.6495329", "0.6479003", "0.6478679", "0.6466109", "0.6433607", "0.642634", "0.64187634", "0.64087564", "0.6387251", "0.63819945", "0.6380781", "0.6373674", "0.6357237", "0.6346117", "0.6318419", "0.6315591", "0.6314048", "0.6305739", "0.6297528", "0.6281814", "0.6279809", "0.6273499", "0.6270925", "0.6252714", "0.62457997", "0.6230306", "0.62112635", "0.62022156", "0.62015486", "0.61892885", "0.61832917", "0.61591077", "0.6137986", "0.6124546", "0.61211413", "0.6120332", "0.6101305", "0.60964686", "0.60961235", "0.60910594", "0.609047", "0.6087532", "0.6086495", "0.60812145", "0.6077963", "0.6074077", "0.60712343", "0.60712343", "0.6066966", "0.60610116", "0.6055328", "0.6055328", "0.6055328", "0.6055328", "0.6055328", "0.6055328", "0.6055328", "0.6055328", "0.6055328", "0.6055328", "0.6055328", "0.6055328", "0.6055328", "0.6055328", "0.6055328", "0.6055328", "0.6055328", "0.6055328" ]
0.0
-1
Fucntion ends Set the token.
public function setToken() { $this->cognito->setClaim($this->claim)->storeToken(); return $this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function set($token);", "public function setToken(string $token): void;", "public function setToken($token);", "function setToken($token)\n {\n $this->token = $token;\n }", "public function setToken($token){\n $this->token = $token;\n }", "public function setToken(string $token): void\n {\n $this->token = $token;\n }", "public function setToken($token): void\n {\n $this->token = $token;\n }", "function setToken($_token) {\n $this->token = $_token;\n return $this;\n }", "public function setToken($token)\n {\n $this->token = $token;\n }", "public function setToken($token)\n {\n $this->token = $token;\n }", "function resetToken() {\n $this->setToken(make_string(40));\n }", "public static function setToken($token)\n {\n self::$_data[self::KEY_TOKEN] = $token;\n }", "public function actionSetToken()\n {\n if (isset($this->request['token'])) {\n /* @var $userDetails UserDetails */\n $userDetails = UserDetails::model()->findByAttributes(['user_id' => $this->user->id]);\n $userDetails->push_token = $this->request['token'];\n if ($userDetails->save())\n $this->_sendResponse(200, CJSON::encode(['status' => true]));\n else\n $this->_sendResponse(400, CJSON::encode(['status' => false]));\n } else\n $this->_sendResponse(400, CJSON::encode(['status' => false, 'message' => 'Token variable is required.']));\n }", "public function setToken($token, $token_secret) {}", "public function setPreviousToken() {\n\t\t$this->_token = $this->_previousToken;\n\t\t$this->_session->key = $this->_previousToken;\n\t}", "public function setToken()\n\t{\n\t\t $args = phpSmug::processArgs( func_get_args() );\n\t\t $this->oauth_token = $args['id'];\n\t\t $this->oauth_token_secret = $args['Secret'];\n\t}", "public function markTokenAsUsed()\n {\n $this->status = self::SUCCESSFULLY_USED_TOKEN;\n }", "private static function set_token() {\n\t\t\t// Bring in the $session variable\n\t\t\tglobal $session;\n\t\t\t// Generate a random token of 64 length\n\t\t\t$token = self::generate_token(64);\n\t\t\t// Store it in the $_SESSION\n\t\t\t$session->set('csrf_token', $token);\n\t\t}", "private function setToken() {\n\n /* valid register */\n $request = $this->post('/v1/register', [\n 'firstname' => 'John',\n 'lastname' => 'Doe',\n 'email' => '[email protected]',\n 'password' => 'secret',\n ]);\n\n /* valid login */\n $this->post('/v1/login', [\n 'email' => '[email protected]',\n 'password' => 'secret',\n ]);\n\n }", "public function refreshToken()\n {\n $token = $this->getToken();\n }", "public function setaccess_token($value);", "abstract public function setNextAuthToken($token);", "public function setRememberToken($value){\n $this->token=$value;\n }", "public function enterToken(string $token): void;", "private function set_token_used()\n {\n update_post_meta($this->token_post['ID'], \"zbyva_hlasu\", 0);\n update_post_meta($this->token_post['ID'], \"hlasovani_zacatek\", $this->voting_start);\n update_post_meta($this->token_post['ID'], \"hlasovani_konec\", $this->voting_end);\n }", "public function setToken (string $token)\n {\n $this->token = $token;\n $this->addParam(\"token\", $token);\n\n return $this;\n }", "public function setToken($token)\r\n {\r\n $this->token = $token;\r\n return $this;\r\n }", "public function set() {\n\t\t$this->token = uniqid(rand(), true);\n\n\t\t$this->time = time();\n\n\t\t$this->$referer = $_SERVER['HTTP_REFERER'];\n\n\t\tif ($this->isEnable()) {\n\t\t\t$_SESSION['token'] = $this->token;\n\t\t\t$_SESSION['token_time'] = $this->time;\n\t\t\t$_SESSION['token_referer'] = $this->$referer;\n\t\t}\n\t}", "public function setToken($token) {\n\t\t$this->token = $token;\n\t\treturn $this;\n\t}", "public function setRememberToken($value)\n {\n $_token = $value;\n }", "public function setToken()\n {\n if (session()->has('drive-access-token')) {\n $accessToken = session()->get('drive-access-token');\n $this->setAccessToken($accessToken);\n if ($this->isAccessTokenExpired()) {\n $accessToken = $this->fetchAccessTokenWithRefreshToken($this->getRefreshToken());\n session()->put('drive-access-token', $accessToken);\n }\n }\n }", "public function setToken($config)\n {\n $this->_token = Yii::createObject($config);\n }", "public function setTokenAttribute($value)\n {\n $this->attributes['token'] = encrypt($value);\n }", "function setTokenMode($value)\n {\n $this->_props['TokenMode'] = $value;\n }", "public function token() {\r\n\t\t\r\n\t\t$response = $this->OAuth2->getAccessTokenData();\r\n\t\t\r\n\t\tif (empty($response)) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\t$this->set($response);\r\n\t\t\r\n\t}", "public static function store(string $token): void\n\t{\n\t\tself::$token = $token;\n\t}", "public function setToken($value)\n {\n return $this->set(self::TOKEN, $value);\n }", "public function setToken($token)\n {\n $this->token = $token;\n return $this;\n }", "public function setToken($token)\n {\n $this->token = $token;\n return $this;\n }", "public function setDeviceTokenAction(){\n $data = $this->getRequestData();\n $this->getDeviceSession()->getUserId();\n if($data['device_token']){\n $session = Workapp_Session::getBySessionUid($data['session_uid']);\n if ($session) {\n $session->addDeviceToken($data['device_token']);\n } else {\n $this->setErrorResponse('This device has no running session which is required by service');\n }\n } else {\n $this->setErrorResponse('device_token is mandatory field for this request!');\n }\n $this->_helper->json(array('added' => true));\n }", "public function update(Token $token): void;", "public function resetTokens() {\n\t\t$this->tokens = $this->initialMarking;\n\t}", "public function setRememberToken($value) {\n dd('asd2f');\n if (! empty($this->getRememberTokenName())) {\n $this->{$this->getRememberTokenName()} = $value;\n }\n }", "public function token()\n {\n\n\t\t$this->server->handleTokenRequest(OAuth2\\Request::createFromGlobals())->send();\n }", "public function next_token()\n {\n }", "public static function setToken($token, $iswebhook=false)\n {\n self::$_token = $token;\n self::$_iswebhook = $iswebhook;\n }", "function saveToken($token) {\r\n\t\t$_SESSION['token'] = $token;\r\n\t}", "public function setToken($token)\n {\n $tokenValidator = new \\Paggi\\SDK\\TokenValidation(); //self::$container->get('TokenValidation');\n if ($tokenValidator->isValidToken($token)) {\n self::$token = $token;\n $this->setPartnerIdByToken($token);\n return true;\n }\n return false;\n }", "public function setToken($token)\n {\n $this->token = (string) $token;\n $this->entity = null;\n\n return $this;\n }", "public function setToken($token, $token_secret = null) {\n\n\t\tparent::setToken($token, $token_secret);\n\t}", "public function setToken() {\n $base_uri = $this->remoteSite->get('protocol') . '://' . $this->remoteSite->get('host');\n $options = array(\n 'base_uri' => $base_uri,\n 'allow_redirects' => TRUE,\n 'timeout' => 5,\n 'connect_timeout' => 5,\n );\n\n $token = $this->httpClient->request('get', 'rest/session/token', $options)->getBody();\n return $token->__toString();\n }", "public function setAccessToken($token);", "public function setToken(string $token)\n {\n $this->token = $token;\n\n return $this;\n }", "function setTokenFromCookie($token) {\n\t\t\t$this->tokenFromCookie = $token;\n\t\t}", "function setAuthToken($AuthToken)\n {\n \t$this->_authToken =$AuthToken;\n }", "public function setRememberToken($value)\n {\n \t$this->setGuarded($this->getRememberTokenName(), $value);\n }", "public function setAToken($token)\n {\n $this->atoken = $token;\n }", "public function setToken($token)\n {\n return $this->accessToken = $token;\n }", "public function setOAuthToken($token)\n {\n $this->oauthToken->setToken($token);\n }", "public function updateToken() {\n try {\n $db = Database::getInstance();\n $expirationDate = new DateTime(\"now\");\n $expirationDate->add(new DateInterval(\"P1D\"));\n $this->token_expiration = $expirationDate->format(\"Y-m-d H:i:s\");\n $this->token = generateToken();\n\n $sql = \"UPDATE `User`\n SET token = :token,\n token_expiration = :token_expiration\n WHERE username = :username\";\n $stmt = $db->prepare($sql);\n $stmt->execute([\n \"username\" => $this->username,\n \"token\" => $this->token,\n \"token_expiration\" => $this->token_expiration\n ]);\n return $this;\n } catch (PDOException $e) {\n exitError(500, \"Internal error.\");\n }\n }", "public function setToken(Token $token){\n\n $this->token = $token;\n\n if( $this->token->isExpired() ) \n throw new TokenException(\"Could not initialize the client with expired token. Please generate a new token and try again.\");\n\n //drop the http client\n $this->HTTPClient = NULL;\n\n }", "function token_set($name) {\r\n\t$session=Zend_Auth::getInstance()->getStorage();\r\n\t$token=auth();\r\n\t$session->set($name,$token);\r\n\r\n\treturn $token;\r\n}", "public function setResumeToken(Token $token)\n {\n \t$this->update(['resume_token' => $token->id]);\n }", "public function setOath2Token($token)\n {\n $this->token = $token;\n\n // We need to reinitialize the SOAP client.\n $this->soap = null;\n }", "public function setToken(TokenInterface $token = null);", "public function setTokenValidDate()\n {\n $this->tokenValidDate = new DateTime('+ 2 hours');\n }", "public function store(string $key, Token $token): void;", "public function token() {\n\t\t$this->autoRender = false;\n\t\t$this->OAuth->setVariable('access_token_lifetime', 60);\n\t\ttry {\n\t\t\t$this->OAuth->grantAccessToken();\n\t\t} catch (OAuth2ServerException $e) {\n\t\t\t$e->sendHttpResponse();\n\t\t}\n\t}", "public function setToken($token)\n {\n $this->token = $token;\n\n return $this;\n }", "public function setToken($token)\n {\n $this->token = $token;\n\n return $this;\n }", "public function setToken($token)\n {\n $this->token = $token;\n\n return $this;\n }", "public function setToken($token)\n {\n $this->token = $token;\n\n return $this;\n }", "public function setToken($token)\n {\n $this->token = $token;\n\n return $this;\n }", "public function setToken($token)\n {\n $this->token = $token;\n\n return $this;\n }", "public function setToken($token)\n {\n $this->token = $token;\n\n return $this;\n }", "public function regenerateToken();", "public function setAuthToken($token)\n {\n $this->authToken = $token;\n }", "public function setTokenAttribute($token)\n {\n $this->attributes['token'] = bcrypt($token);\n }", "public function setRememberToken($value)\n {\n $this->{$this->getRememberTokenName()} = $value;\n }", "public function setToken($v)\n\t{\n\t\tif ($v !== null) {\n\t\t\t$v = (string) $v;\n\t\t}\n\n\t\tif ($this->token !== $v) {\n\t\t\t$this->token = $v;\n\t\t\t$this->modifiedColumns[] = UsuarioPeer::TOKEN;\n\t\t}\n\n\t\treturn $this;\n\t}", "public function facebookStoreToken() {\n if ( ! empty( $_GET['access_token'] ) ) {\n $this->instagramCode = $_GET['access_token'];\n update_option( self::FACEBOOK_TOKEN, $_GET['access_token'] );\n }\n }", "private function token_update(string $token)\n {\n $this->token_created = time();\n $this->token_expires = $this->token_created + 86399;\n $this->token = $token;\n $this->headers['Authorization'] = \" Bearer {$token}\";\n\n if ($this->debug) {\n $this->debug_message('Auth token has been updated.');\n }\n }", "protected function _setOauthToken()\n {\n $this->_initHttpClient($this->_endpointUrls['access_token'], CurlHttpClient::POST);\n $this->_httpClient->setPostParam('client_id', $this->_config['client_id']);\n $this->_httpClient->setPostParam('client_secret', $this->_config['client_secret']);\n $this->_httpClient->setPostParam('grant_type', $this->_config['grant_type']);\n $this->_httpClient->setPostParam('redirect_uri', $this->_config['redirect_uri']);\n $this->_httpClient->setPostParam('code', $this->getAccessCode());\n $this->_oauthToken = $this->_getHttpClientResponse();\n }", "function setSig() {\n if (sfConfig::get(\"sf_private_key\") !='') {\n \n $hash = md5(rand_str());\n $this -> context ->getLogger()->debug(\"{Theater Token Class} HASH:: \".$hash);\n putLog(\"USER:: \".$this -> sessionVar(\"user_id\").\" | MESSAGE:: TOKEN HASH:: \".$hash);\n \n $expires = strtotime(now());\n $this -> context ->getLogger()->debug(\"{Theater Token Class} EXPIRES:: \".$expires);\n putLog(\"USER:: \".$this -> sessionVar(\"user_id\").\" | MESSAGE:: TOKEN EXPIRES:: \".$expires);\n \n $code = setUserOrderTicket();\n $this -> seat -> setAudienceHmacKey( $code );\n $this -> seat -> save();\n $this -> context ->getLogger()->debug(\"{Theater Token Class} CODE:: \".$code);\n putLog(\"USER:: \".$this -> sessionVar(\"user_id\").\" | MESSAGE:: TOKEN CODE:: \".$code);\n \n /*\n\t\t\t$enc_date = encryptCookie($code, $hash.\"=\".strtotime(now()));\n $this -> context ->getLogger()->debug(\"{Theater Token Class} HMAC_SIG:: \".$enc_date);\n putLog(\"USER:: \".$this -> sessionVar(\"user_id\").\" - TOKEN HMAC_SIG:: \".$enc_date);\n \n $this -> token_raw = $hash . \"|\" . strtotime(now()) . \"|\" . $enc_date;\n $this -> context ->getLogger()->debug(\"{Theater Token Class} Set Token:: \".$this -> token_raw);\n putLog(\"USER:: \".$this -> sessionVar(\"user_id\").\" - TOKEN RAW:: \".$this -> token_raw);\n \n $this -> token = encryptCookie($code,$this -> token_raw);\n $this -> context ->getLogger()->debug(\"{Theater Token Class} Set Coookie:: \".$this -> token);\n putLog(\"USER:: \".$this -> sessionVar(\"user_id\").\" - SET COOKIE:: \".$this -> token);\n */\n \n $this -> setCookieVar( \"csth\", $code, 7 );\n return $this -> token;\n \n }\n \n }", "protected function setConfigToken($token)\n {\n $siteConfig = SiteConfig::current_site_config();\n $siteConfig->VimeoFeed_Token = $token;\n $siteConfig->write();\n }", "public function setTokens($data)\n {\n $data = json_decode($data);\n\n $data->access_token_expires_at = Carbon::now()\n ->addSeconds($data->access_token_expires_in)\n ->format('Y-m-d H:i:s');\n\n $data->refresh_token_expires_at = Carbon::now()\n ->addSeconds($data->refresh_token_expires_in)\n ->format('Y-m-d H:i:s');\n\n $this->preferences->hue_access_token = $data->access_token;\n $this->preferences->hue_access_token_expires_in = $data->access_token_expires_in;\n $this->preferences->hue_access_token_expires_at = $data->access_token_expires_at;\n\n $this->preferences->hue_refresh_token = $data->refresh_token;\n $this->preferences->hue_refresh_token_expires_in = $data->refresh_token_expires_in;\n $this->preferences->hue_refresh_token_expires_at = $data->refresh_token_expires_at;\n $this->preferences->update();\n }", "public function setRememberToken(string $value);", "public function setOAuthToken(string $token, string $tokenSecret): void\n {\n $this->authorizer->setToken(new Token($token, $tokenSecret));\n }", "abstract public function token();", "public function setSessionTokenFromRegistry() {}", "public function setTokenSecret(string $tokenSecret): void\n {\n $this->setParam($this->tokenSecretParamKey, $tokenSecret);\n }", "public function setRememberToken($value)\n {\n }", "public function setRememberToken($value)\n {\n }", "public function setRememberToken($value)\n {\n }", "public function setRememberToken($value)\n {\n }", "public function setRememberToken($value)\n {\n //\n }", "public function setTokens($tokens) {\n\t\t$this->tokens = (int) $tokens;\n\t}", "public function testSetValidToken(): void\n {\n // setup\n $this->testValidConnect();\n\n $data = [\n 'token' => $this->sessionId\n ];\n\n $url = self::$serverPath . '/token/' . $this->sessionId . '/';\n\n // test body\n $result = $this->postHttpRequest($data, $url);\n\n // assertions\n $this->assertEquals(isset($result->session_id), true, 'Connection failed');\n }", "public function testSetGetToken()\n {\n $data = $this->createToken();\n $subject = $this->createInstance();\n $_subject = $this->reflect($subject);\n\n $_subject->_setToken($data);\n $this->assertSame($data, $_subject->_getToken(), 'Token path returned not same as token set');\n }", "public function receiveToken() {\n\n\t\t$parseToken = ($this->JWTParser);\n\t\t$TokenObject = $parseToken->parse($this->Token);\n\n\t\t$this->setTokenObject($TokenObject);\n\t}" ]
[ "0.79208195", "0.785612", "0.7737798", "0.74588406", "0.73750573", "0.71573913", "0.7115457", "0.70927954", "0.7083504", "0.7083504", "0.70310116", "0.6872293", "0.68073165", "0.6719096", "0.6700787", "0.66472566", "0.6645294", "0.65537167", "0.6522115", "0.64822143", "0.64800286", "0.6469744", "0.6462584", "0.6401215", "0.6387863", "0.63845235", "0.6313132", "0.6312291", "0.62983304", "0.6291558", "0.629032", "0.625624", "0.6211302", "0.6206636", "0.62020445", "0.6178616", "0.6141832", "0.61389256", "0.61389256", "0.61359257", "0.6124227", "0.6114554", "0.6086896", "0.60572404", "0.60559124", "0.605042", "0.6049372", "0.6047347", "0.60469157", "0.6045751", "0.6037416", "0.6033756", "0.59965056", "0.59899193", "0.59820056", "0.5967533", "0.59426135", "0.5935211", "0.593114", "0.58868164", "0.5879068", "0.5868287", "0.58617365", "0.58522487", "0.58433384", "0.5835634", "0.5823701", "0.5822105", "0.5821504", "0.5821504", "0.5821504", "0.5821504", "0.5821504", "0.5821504", "0.5821504", "0.5815929", "0.57876366", "0.5775693", "0.57624686", "0.5750339", "0.57384306", "0.57364076", "0.5734518", "0.5730835", "0.57289076", "0.5726831", "0.57249665", "0.5721397", "0.5705651", "0.57011485", "0.5697318", "0.56915677", "0.56915677", "0.56915677", "0.56915677", "0.5670552", "0.56515723", "0.56340015", "0.56334937", "0.5633247" ]
0.5687528
95
Logout the user, thus invalidating the token.
public function logout($forceForever = false) { $this->invalidate($forceForever); $this->user = null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function logout() {\n\t$new_token = sha1(TOKEN_SALT.$this->user->email.Utils::generate_random_string());\n\t\n\t# Create the data array we'll use with the update method\n\t# In this case, we're only updating one field, so our array only has one entry\n\t$data = Array(\"token\" => $new_token);\n\t\n\t# Do the update\n\tDB::instance(DB_NAME)->update(\"users\", $data, \"WHERE token = '\".$this->user->token.\"'\");\n\t\n\t# Delete their token cookie - effectively logging them out\n\tsetcookie(\"token\", \"\", strtotime('-1 year'), '/');\n\t\n\tRouter::redirect(\"/users/login\");\n }", "public function logout(){\n\t\t$new_token = sha1(TOKEN_SALT.$this->user->email.Utils::generate_random_string());\n\t\t\n\t\t# Create the data array we'll use with the update method\n\t\t$data = Array(\"token\" => $new_token);\n\n\t\t# Do the update\n\t\tDB::instance(DB_NAME)->update(\"users\", $data, \"WHERE token = '\".$this->user->token.\"'\");\n\t\t\n\t\t# Delete their token cookie by setting it to a date in the past - effectively logging them out\n\t\tsetcookie(\"token\", \"\", strtotime('-1 year'), '/');\n\n\t\t#send back to main index\n\t\tRouter::redirect(\"/\");\n\t}", "public function logout() {\n\t\t# Generate and save a new token for next login\n\t\t$new_token = sha1(TOKEN_SALT.$this->user->email.Utils::generate_random_string() );\n\n\t\t# Create the data array we'll use with the update method\n\t\t# In this case, we're only updating one field, so our array only has one entry\n\t\t$data = Array(\"token\" => $new_token);\n\n\t\t# Do the update\n\t\tDB::instance(DB_NAME)->update(\"users\", $data, \"WHERE token = '\".$this->user->token.\"'\");\n\n\t\t# Delete their token cookie by setting it to a date in the past - effectively logging them out\n\t\tsetcookie(\"token\", \"\", strtotime('-1 year'), '/');\n\n\t\t# Send them back to the main index.\n\t\tRouter::redirect(\"/\");\n\t}", "public function logout()\n {\n $this->user_provider->destroyAuthIdentifierSession();\n\n \\session()->flush();\n \n $this->user = null;\n\n $this->loggedOut = true;\n }", "public function logout() {\n # Generate and save a new token for next login\n $new_token = sha1(TOKEN_SALT.$this->user->email.Utils::generate_random_string());\n\n # Create the data array we'll use with the update method\n # In this case, we're only updating one field, so our array only has one entry\n $data = Array(\"token\" => $new_token);\n\n # Do the update\n DB::instance(DB_NAME)->update(\"users\", $data, \"WHERE token = '\".$this->user->token.\"'\");\n\n # Delete their token cookie by setting it to a date in the past, logging them out\n setcookie(\"token\", \"\", strtotime('-1 year'), '/');\n\n # Send them back to the main index.\n Router::redirect(\"/\");\n }", "public function logout(){\n $new_token = sha1(TOKEN_SALT.$this->user->email.Utils::generate_random_string());\n\n # Create the data array we'll use with the update method\n # In this case, we're only updating one field, so our array only has one entry\n $data = Array(\"token\" => $new_token);\n\n # Do the update\n DB::instance(DB_NAME)->update(\"users\", $data, \"WHERE token = '\".$this->user->token.\"'\");\n\n # Delete their token cookie by setting it to a date in the past - effectively logging them out\n setcookie(\"token\", \"\", strtotime('-1 year'), '/');\n\n # Send them back to the main index.\n Router::redirect(\"/\");\n }", "public function logout() {\n\t\t$this->removeAccessToken();\n\t}", "public function logout() {\n $new_token = sha1(TOKEN_SALT.$this->user->email.Utils::generate_random_string());\n\n # Create the data array we'll use with the update method\n # In this case, we're only updating one field, so our array only has one entry\n $data = Array(\"token\" => $new_token);\n\n # Do the update\n DB::instance(DB_NAME)->update(\"users\", $data, \"WHERE token = '\".$this->user->token.\"'\");\n\n # Delete their token cookie by setting it to a date in the past - effectively logging them out\n setcookie(\"token\", \"\", strtotime('-1 year'), '/');\n\n # Send them back to the main index.\n Router::redirect(\"/\");\n\n }", "public function logout(): void\n\t{\n\t\t$this->session->regenerateId();\n\n\t\t$this->session->regenerateToken();\n\n\t\t$this->session->remove($this->options['auth_key']);\n\n\t\t$this->response->getCookies()->delete($this->options['auth_key'], $this->options['cookie_options']);\n\n\t\t$this->user = null;\n\n\t\t$this->hasLoggedOut = true;\n\t}", "public function logout()\n\t{\n\t\t$this->client->revokeToken();\n\t \t$this->destroy();\n\t}", "public function logout()\n {\n if (!is_null($this->token)) {\n $this->token->delete();\n }\n if (isset($_SESSION['uuid'])) {\n unset($_SESSION['uuid']);\n session_destroy();\n setcookie('token', '', time() - 3600, '/', getenv('DOMAIN'));\n }\n }", "function logout() {\n if ($this->getRequestMethod() != 'POST') {\n $this->response('', 406);\n }\n\t \t\n\t $userId = $_POST['user_id']; \n $auth = $this->getAuthorization();\n if (!$this->validateAuthorization($userId, $auth)) {\n\t\terror_log(\"logout: token expired\"); \n\t\t$this->response('',204);\n }\n $query = \"delete from tokens where user_id = $userId\";\n $r = $this->conn->query($query) or die($this->conn->error.__LINE__); \n $success = array('status' => \"Success\", \"msg\" => \"Successfully logged out.\");\n $this->response(json_encode($success), 200);\n }", "public function logout()\n {\n $this->session->remove('user');\n }", "public function logout()\n {\n $this->app['security']->setToken(null);\n }", "public function logout(){\n $user = Auth::user();\n $user->tokens()->delete();\n\n }", "public function logout(){\n\t\tglobal $con;\n\t\t\n\t\t// If the session was persisted through cookies,\n\t\t// get rid of that first.\n\t\tif(isset($_COOKIE['id'])){\n\t\t\t$prep = $con->prepare(\"\n\t\t\t\tDELETE FROM `tokens` \n\t\t\t\tWHERE token_user = $this->user_id\n\t\t\t\t\tAND token_val = ?\n\t\t\t\");\n\t\t\t\n\t\t\t$prep->bind_param(\"s\", $_COOKIE['id']);\n\t\t\t$prep->execute();\n\t\t\t// and clear the cookies...\n\t\t\tunset($_COOKIE['id']);\n\t\t\t/*bool setcookie ( string $name [, string $value [, \n\t\t\t\tint $expire = 0 [, string $path [, string $domain [, \n\t\t\t\tbool $secure = false [, bool $httponly = false ]]]]]] )*/\n\t\t\tsetcookie('id', '', time() - 3600);\n\t\t}\n\t\t\n\t\t// and now destroy the session variables...\n\t\tsession_unset();\n\t\tsession_destroy();\n\t\n\t\t\n\t}", "function logout()\n {\n $user = $this->getAuthenticatedUser();\n if (!$user) return;\n\n unset($_SESSION['MFW_authenticated_user']);\n }", "public function logout()\n\t{\n\t\t$this->user = null;\n\n\t\t$this->session->forget(static::$key);\n\t}", "public static function doLogout() {\n session()->forget('auth_token');\n session()->flush();\n }", "public function logout()\n {\n if ( !$this->isAuthenticated() )\n {\n return;\n }\n\n $event = new OW_Event(OW_EventManager::ON_USER_LOGOUT, array('userId' => $this->getUserId()));\n OW::getEventManager()->trigger($event);\n\n $this->authenticator->logout();\n }", "public function logoutUser() {\r\n\t\t$this->coreAuthenticationFactory->logoutUser ();\r\n\t}", "public function logout(){\n $this->_user->logout();\n }", "public function logout()\n {\n\t\t$user = JWTAuth::GetJWTUser();\n\t\t$this->expireToken($user);\n\t\treturn $this->sendResponse('You are now logged out');\n\t}", "public function logout()\n {\n $user = Auth::user();\n $check = $user->token()->revoke();\n\n if ($check) {\n return response()->json([\n 'response' => true,\n 'message' => 'Sucess logout'\n ], 200);\n }\n }", "public function log_out() {\n $this->store_token(null);\n }", "public static function logout() {\n Session::forget('user');\n redirect('/login');\n }", "public function logout()\n {\n $this->user = null;\n $this->synchronize();\n unset($_SESSION);\n }", "public function logout()\n {\n DbModel::logUserActivity('logged out of the system');\n\n //set property $user of this class to null\n $this->user = null;\n\n //we call a method remove inside session that unsets the user key inside $_SESSION\n $this->session->remove('user');\n\n //we then redirect the user back to home page using the redirect method inside Response class\n $this->response->redirect('/');\n\n\n }", "public function logout() {\n\t\t$this->facebook->destroy_session();\n\t\t// Remove user data from session\n\t\t$this->session->sess_destroy();\n\t\t// Redirect to login page\n redirect('/user_authentication');\n }", "public static function logout(): void\n {\n // Remove from the session (user object)\n unset($_SESSION['user']);\n }", "public function logout()\n {\n $this->Session->delete('User');\n\n $this->redirect($this->Auth->logout());\n }", "public function logout(){\n session_unset($_SESSION[\"user\"]);\n }", "public function logout(){\r\n unset($_SESSION['user_id']);\r\n unset($this->user_id);\r\n $this->signed_in = false;\r\n }", "public function logoutUser()\n {\n // Unset session-key user\n $this->di->get(\"session\")->delete(\"my_user_id\");\n $this->di->get(\"session\")->delete(\"my_user_name\");\n //$this->di->get(\"session\")->delete(\"my_user_password\");\n $this->di->get(\"session\")->delete(\"my_user_email\");\n //$this->di->get(\"session\")->delete(\"my_user_created\");\n //$this->di->get(\"session\")->delete(\"my_user_updated\");\n //$this->di->get(\"session\")->delete(\"my_user_deleted\");\n //$this->di->get(\"session\")->delete(\"my_user_active\");\n $this->di->get(\"session\")->delete(\"my_user_admin\");\n }", "public function logout()\n {\n $this->_delAuthId();\n }", "public function logout()\n {\n $user = $this->user();\n\n // If we have an event dispatcher instance, we can fire off the logout event\n // so any further processing can be done. This allows the developer to be\n // listening for anytime a user signs out of this application manually.\n $this->clearUserDataFromStorage();\n\n if (isset($this->events)) {\n $this->events->dispatch(new LogoutEvent($this->name, $user));\n }\n\n // Once we have fired the logout event we will clear the users out of memory\n // so they are no longer available as the user is no longer considered as\n // being signed into this application and should not be available here.\n $this->user = null;\n\n $this->loggedOut = true;\n }", "static function logout() {\n self::forget(self::currentUser());\n unset($_SESSION['userId']);\n session_destroy();\n }", "public function logoutUser() {\n $this->session->unsetSession(self::$storedUserId);\n $this->session->setFlashMessage(2);\n self::$isLoggedIn = false;\n }", "public function logout() {\n\t\t//Log this connection into the users_activity table\n\t\t\\DB::table('users_activity')->insert(array(\n\t\t\t'user_id'=>$this->user->attributes[\"id\"],\n\t\t\t'type_id'=>15,\n\t\t\t'data'=>'Log out',\n\t\t\t'created_at'=>date(\"Y-m-d H:i:s\")\n\t\t));\n\t\t$this->user = null;\n\t\t$this->cookie($this->recaller(), null, -2000);\n\t\tSession::forget($this->token());\n\t\t$this->token = null;\n\t}", "public function logout(){\n unset($_SESSION['user_id']);\n \n session_destroy();\n redirect('users/login');\n }", "public function logout() {\n\t\t$user = $this->Auth->user();\n\t\t$this->Session->destroy();\n\t\t$this->Cookie->destroy();\n\t\t$this->Session->setFlash(sprintf(__('%s you have successfully logged out'), $user[$this->{$this->modelClass}->displayField]));\n\t\t$this->redirect($this->Auth->logout());\n\t}", "public function logoutUser() {\n $this->debugPrint(\"Logging out user...\");\n\n if ($this->auth_http_method == 'DIGEST')\n $data = $this->parseDigest($_SERVER['PHP_AUTH_DIGEST']);\n\n if ($this->session_check_method == 'BOTH' || $this->session_check_method == 'NONCE' && !empty($data))\n $this->{$this->nonce_expire_function}($data['nonce']);\n if ($this->session_check_method == 'BOTH' || $this->session_check_method == 'COOKIE') {\n session_start();\n $_SESSION['lastseen'] = time() - ($this->cookie_expire + 3600 );\n }\n if ($this->redirect_on_logout) {\n echo <<<EOF\n <html>\n <meta http-equiv=\"refresh\" content=\"0; url={$this->redirect_on_logout_url}?error=2\" />\n <body><h2>{$this->logout_text}</h2></body>\n </html>\nEOF;\n } else {\n echo \"<html><body><h2>{$this->logout_text}</h2></body></html>\";\n }\n exit();\n }", "public function logout()\n {\n auth()->user()->token()->revoke();\n return response()->json([\n 'message' => 'Logout Successful'\n ]);\n }", "public function logout()\n { \n $accessToken = Auth::user()->token();\n \n \\DB::table('oauth_access_tokens')\n ->where('user_id', $accessToken->user_id)\n ->update([\n 'revoked' => true\n ]);\n $accessToken->revoke();\n return response()->json(['data' => 'Usuario ha cerrado sesión en todos los dispositivos'], 200); \n }", "public function user_logout()\n {\n $this->session->sess_destroy();\n redirect('userController/login_view', 'refresh');\n }", "public static function logout(){\n \n //Tornando se sessão User nulla\n $_SESSION[User::SESSION] = null;\n \n }", "public function logout(){\n // Auth::logout();\n // return redirect()->route('login');\n\n Auth::user()->token()->revoke();\n\n // DB::table('oauth_access_tokens')\n // ->where('user_id', Auth::user()->id)\n // ->update([\n // 'revoked' => true\n // ]);\n return response()->json(['code'=>200], 200); \n }", "public function logout()\n\t{\n\t\tsession_unset();\n\t\tsession_destroy();\n\t\tunset($_SESSION['oauth_token']);\n\t\tunset($_SESSION['oauth_token_secret']);\n\t\theader('Location: index.php');\n\t}", "public function logOut()\n {\n $auth = new AuthenticationService();\n\n if ($auth->hasIdentity()) {\n Session::getDefaultManager()->forgetMe();\n $auth->clearIdentity();\n }\n }", "function logout() {\r\n $this->auth->logout();\r\n }", "public function logout(){\n try { // Validate Token\n if(!$user = JWTAuth::parseToken()->authenticate()){\n return response()->json(['msg' => \"User not found\",\"error\"=>'1'], 404);\n }\n if(JWTAuth::invalidate(Input::get('token')))\n return response()->json([\"msg\"=>\"Successfully Logout\",\"error\"=>'0'],200);\n } catch (JWTException $e) { // Exception\n return response()->json(['msg' => \"Invalid Token\",\"error\"=>'1'], 500);\n }\n\n\n\n }", "public function logout(): void\n\t{\n\t\t/** @var \\App\\Models\\User $user */\n\t\t$user = Auth::user();\n\t\tLog::channel('login')->info(__METHOD__ . ':' . __LINE__ . ' -- User (' . $user->username . ') has logged out.');\n\t\tAuth::logout();\n\t\tSession::flush();\n\t}", "public function logout()\n {\n $_SESSION['user_id'] = null;\n unset($_SESSION['user_id']);\n }", "public static function logOut()\r\n {\r\n (new Session())->remove(static::$userIdField);\r\n }", "public function userLogout() {\n // Starting a session to unset and destroy it\n session_start();\n session_unset();\n session_destroy();\n\n // Sending the user back to the login page\n header(\"Location: login\");\n }", "public function logout() {\n\t\t\tunset( $_SESSION['user_id'] );\n\t\t\tunset( $this->user_id );\n\t\t\t$this->logged_in = false;\n\t\t}", "public function logout()\n {\n $this->removeRememberMeCookie();\n }", "public function logout() {\n\t\t$this->facebook->destroy_session();\n\t\t// Remove user data from session\n\t\t$this->session->unset_userdata('userData');\n\t\t$this->session->unset_userdata('username');\n\t\t$this->session->unset_userdata('password');\n\t\t// Redirect to login page\n redirect(base_url());\n }", "public function logout(){\n session_destroy();\n unset($_SESSION['user_session']);\n }", "public function logout()\n {\n if (isset($_SESSION['user_id']))\n {\n unset($_SESSION['user_id']);\n }\n redirect('', 'location');\n }", "public function logout()\n {\n foreach (auth()->user()->tokens as $token)\n {\n $token->delete();\n }\n\n return response()->json('Logged out successfully.',200);\n }", "public function logout()\n {\n //Auth::logout();\n try \n {\n config([\n 'jwt.blacklist_enabled' => true\n ]);\n //\\Cookie::forget(JWTAuth::parseToken());\n //Auth::guard()->logout();\n Auth::logout();\n \\Auth::logout(true);\n \\Auth::invalidate();\n Auth::invalidate();\n\n $token = JWTAuth::getToken();\n JWTAuth::setToken($token)->invalidate(true);\n JWTAuth::invalidate();\n JWTAuth::invalidate(true);\n JWTAuth::invalidate(JWTAuth::getToken());\n JWTAuth::invalidate(JWTAuth::parseToken());\n JWTAuth::parseToken()->invalidate();\n\n return response()->json(['message' => 'Successfully logged out']);\n \n } \n catch (Exception $e) \n {\n return response()->json(['message' => 'There is something wrong try again']);\n }\n }", "public function logout() {\n unset($_SESSION['user_id']);\n unset($_SESSION['user_email']);\n unset($_SESSION['user_name']);\n session_destroy();\n redirect('');\n }", "public function logout(){\n $this->session->unset_userdata(array(\n 'user_id' => '',\n )\n );\n\n $this->session->sess_destroy();\n redirect('/', 'location');\n }", "public function logout($request)\n {\n $request->user()->token()->revoke();\n\n return response()->json([\n 'message' => 'Successfully logged out'\n ]);\n }", "public function logout()\r\n {\r\n if($this->twitter->check_login() != False)\r\n {\r\n // Revoke the session - this means logging out\r\n // Note that it also removes the Oauth access keys from Twitter NOT jsut removing the cookie\r\n $this->twitter->revokeSession(True);\r\n \r\n }\r\n //url::redirect('ktwitter/demo');\r\n url::redirect($this->docroot.'users');\r\n }", "private function logout() {\n $_SESSION['user'] = null;\n $_SESSION['valid'] = false;\n }", "public function logout()\n {\n $this->getAuth()->clearIdentity();\n }", "function logout()\n\t{\n\n\t\t// log the user out\n\t\t$this->session->sess_destroy();\n\n\t\t// redirect them to the login page\n\t\tredirect('auth', 'refresh');\n\t}", "public function logout()\n {\n $this->deleteSession();\n }", "public function logout()\n {\n $this->Auth->logout();\n $this->login();\n }", "public function logout()\n {\n $this->webUser = false;\n $this->refresh();\n \\Bdr\\Vendor\\Database::logout();\n }", "public function logout() {\n $auth_cookie = Cookie::get(\"auth_cookie\");\n if ($auth_cookie != '') {\n $this->deleteCookie($auth_cookie);\n }\n }", "public function logout()\n {\n \\Cookie::forget('user');\n\n return redirect('login')->withCookie(Cookie::forget('user'));\n }", "public function userLogout() {\n session_destroy();\n header('Location: index.php');\n }", "public function logout()\n {\n try {\n $token = Auth::getToken();\n $tok_token = (string)$token;\n $token_db = Token::where('tok_token', $tok_token)->first();\n\n if ($token_db) {\n $token_db->tok_data_hora_saida = new DateTime();\n $token_db->save();\n }\n\n auth()->logout();\n\n return response()->json(['message' => 'Successfully logged out']);\n } catch (\\Exception $e) {\n return $this->error($e->getMessage(), 404);\n }\n }", "public function logout ()\n {\n unset ( $_SESSION['user_id'] );\n unset ( $_SESSION['email'] );\n unset ( $_SESSION['order_count'] );\n unset ( $_SESSION['like_count'] );\n //session_destroy () ;\n header( 'Location:' . \\f\\ifm::app()->siteUrl . 'login' );\n }", "public function logout(Request $request)\n {\n $user = $request->user();\n if($user) $user->token()->revoke();\n\n return $this->respondWithMessage( __('controller.auth.logout'));\n }", "public static function logout()\n {\n (new Authenticator(request()))->logout();\n }", "public function logout() {\n $this->session->unset_userdata('user_data');\n session_destroy();\n redirect();\n }", "public function logout(Request $request)\n {\n $request->user()->token()->revoke();\n return response()->json([\n 'message' => 'Successfully logged out'\n ]);\n }", "public static function logoutUser()\n\t{\n\t wp_logout();\n\t\twp_send_json_success();\n\t}", "protected function logout() {\n $current_session = $this->Session->id();\n $this->loadModel('CakeSession');\n $this->CakeSession->delete($current_session);\n\n // Process provider logout\n $this->Social = $this->Components->load('SocialIntegration.Social');\n if ($this->Session->read('provider')) {\n $this->Social->socialLogout($this->Session->read('provider'));\n SocialIntegration_Auth::storage()->set(\"hauth_session.{$this->Session->read('provider')}.is_logged_in\", 0);\n $this->Session->delete('provider');\n }\n\n // clean the sessions\n $this->Session->delete('uid');\n $this->Session->delete('admin_login');\n $this->Session->delete('Message.confirm_remind');\n\n // delete cookies\n $this->Cookie->delete('email');\n $this->Cookie->delete('password');\n $cakeEvent = new CakeEvent('Controller.User.afterLogout', $this);\n $this->getEventManager()->dispatch($cakeEvent);\n }", "public function logout() {\n\n $array_items = array('user_name', 'user_id', 'user_type', 'login_type');\n\n\n\n $this->session->unset_userdata($array_items);\n\n $this->facebook->destroy_session();\n\n // redirect('Oauth/web_login', redirect);\n redirect('login');\n }", "public function logoutUser() {\n $this->session->unset_userdata('username');\n $this->session->unset_userdata('userId');\n $this->session->unset_userdata('logged_in');\n $this->session->sess_destroy();\n redirect('/UserController/login');\n }", "private function exeLogout() {\n if (isset($this->_userInfo->login_token)) {\n // call login api\n $usrToken = $this->_userInfo->login_token;\n $logoutLnk = API_LOGOUT . '/token/' . $usrToken;\n $ch = curl_init();\n curl_setopt($ch, CURLOPT_URL, $logoutLnk);\n curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($ch, CURLOPT_HTTPHEADER, array(API_HEADER_CONTENT, API_HEADER_TYPE, API_HEADER_ACCEPT));\n curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);\n curl_setopt($ch, CURLOPT_TIMEOUT, API_TIMEOUT); //timeout in seconds\n\n $results = curl_exec($ch);\n $results = json_decode($results);\n if ($results->meta->code == 200) {\n // destroy session at my page\n $this->session->unset_userdata('userInfo');\n $this->session->unset_userdata('linkBackLogin');\n $this->session->unset_userdata('passwordUser');\n }\n redirect(site_url('/'));\n } else {\n redirect(site_url('/'));\n }\n }", "public function logout() \n {\n unset($_SESSION['is_logged_in']);\n unset($_SESSION['user_id']);\n unset($_SESSION['time_logged_in']);\n\n session_destroy();\n }", "public function logout(Request $request)\n { \n try {\n $request->user()->token()->revoke();\n } catch (\\Exception $e) {\n return $this->respondInternalError($e->getMessage());\n }\n\n return $this->respond([\n 'status' => true,\n 'message' => 'Logout Successfully!',\n ]); \n\n }", "public function logout() {\r\n $user_id = session()->get('user_logged_in');\r\n if ($user_id != '' || $user_id != null) {\r\n session()->destroy();\r\n $this->set_msg(\"Successfully Logout\");\r\n\r\n $googleauth = new \\App\\Libraries\\Googleauth();\r\n $user = $googleauth->logout(); \r\n }\r\n return redirect()->to(base_url());\r\n }", "public function logout()\n\t{\n\t\t$this->session->unset_userdata(array(\n\t\t\t\t\t\t\t\t\t\t\t'VB_USER_LOGGED_IN',\n\t\t\t\t\t\t\t\t\t\t\t'VB_USER_ID',\n\t\t\t\t\t\t\t\t\t\t\t'VB_FULL_NAME',\n\t\t\t\t\t\t\t\t\t\t\t'VB_USER_EMAIL',\n\t\t\t\t\t\t\t\t\t\t\t'VB_USER_MOBILE',\n\t\t\t\t\t\t\t\t\t\t\t'VB_USER_CURRENT_PATH',\n\t\t\t\t\t\t\t\t\t\t\t'VB_USER_LAST_LOGIN'));\n\t\t\t\t\t\t\n\t\tredirect(base_url());\n\t}", "public function logout() {\n\t\tAuth::clear('userLogin');\n\t\t$this->redirect(array('action'=>'login'));\n\t}", "public function logout()\n {\n $this->deleteAllPersistentData();\n $this->accessToken = null;\n $this->user = null;\n $this->idToken = null;\n $this->refreshToken = null;\n }", "public function logout(Request $request) {\n $request->user()->token()->revoke();\n \n //Return a message\n return response()->json([\n 'message' => 'Successfully logged out'\n ]);\n }", "public function logout()\n {\n $this->session->end();\n }", "public function logout()\n {\n $processReaction = $this->userEngine->processLogout();\n\n return redirect()->route('user.login');\n }", "public function signOut();", "public function logout(Request $request) \n {\n $user = $request->user()->tokens()->delete(); \n \n return response()->json(['message' => 'Successfully logged out'],200);\n }", "public static function actionLogout() {\n unset($_SESSION['user']);\n header(\"Location: /\");\n }", "public function logout(Request $request)\n {\n $request->user()->active = false;\n $request->user()->save();\n \n $request->user()->token()->revoke();\n return response()->json([\n 'message' => 'Successfully logged out'\n ]);\n }", "public function signOut() {\n\n $this->getAttributeHolder()->removeNamespace('sfGuardSecurityUser');\n $this->user = null;\n $this->clearCredentials();\n $this->setAuthenticated(false);\n $expiration_age = sfConfig::get('app_sf_guard_plugin_remember_key_expiration_age', 15 * 24 * 3600);\n $remember_cookie = sfConfig::get('app_sf_guard_plugin_remember_cookie_name', 'sfRemember');\n sfContext::getInstance()->getUser()->setAttribute('view', '');\n sfContext::getInstance()->getResponse()->setCookie($remember_cookie, '', time() - $expiration_age);\n }", "public function logOut () : void {\n $this->destroySession();\n }" ]
[ "0.8408453", "0.83963764", "0.83770245", "0.83718973", "0.8323235", "0.82815313", "0.82600856", "0.8218627", "0.82179165", "0.8188585", "0.81540143", "0.8150022", "0.8135342", "0.81231207", "0.8114682", "0.8054704", "0.8028382", "0.7945337", "0.79325557", "0.79283434", "0.7916173", "0.7885724", "0.78602195", "0.7806912", "0.77717435", "0.77536726", "0.7748258", "0.7743093", "0.7733597", "0.77299386", "0.7720027", "0.7713797", "0.7700737", "0.76880246", "0.7681503", "0.7661832", "0.76517475", "0.7644957", "0.7643904", "0.76416487", "0.76209664", "0.75879925", "0.7585278", "0.75752443", "0.75722116", "0.7571722", "0.75551766", "0.7554336", "0.75533944", "0.75501466", "0.7543146", "0.7539733", "0.7538024", "0.75373894", "0.7518111", "0.75117934", "0.74999154", "0.7490251", "0.748631", "0.74836105", "0.74717695", "0.7465377", "0.7462909", "0.7457105", "0.7454816", "0.74532735", "0.7447538", "0.7446291", "0.74443126", "0.74429744", "0.7440112", "0.7438517", "0.74350744", "0.7431417", "0.7428722", "0.7428187", "0.7425964", "0.7424207", "0.7422926", "0.74081206", "0.7397153", "0.73923486", "0.73894686", "0.7386888", "0.7385353", "0.7384696", "0.7380134", "0.73730737", "0.7366831", "0.7366668", "0.73661476", "0.7365381", "0.7363155", "0.73626125", "0.7356197", "0.73549527", "0.7354653", "0.7352953", "0.7349123", "0.7347823", "0.734678" ]
0.0
-1
Get the authenticated user.
public function user() { //Check if the user exists if (! is_null($this->user)) { return $this->user; } //Retrieve token from request and authenticate return $this->getTokenForRequest(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getAuthenticatedUser()\n {\n // get the web-user\n $user = Auth::guard()->user();\n\n // get the api-user\n if(!isset($user) && $user == null) {\n $user = Auth::guard('api')->user();\n }\n return $user;\n }", "private function getAuthenticatedUser()\r\n {\r\n $tokenStorage = $this->container->get('security.token_storage');\r\n return $tokenStorage->getToken()->getUser();\r\n }", "private function getAuthenticatedUser()\r\n {\r\n $tokenStorage = $this->container->get('security.token_storage');\r\n return $tokenStorage->getToken()->getUser();\r\n }", "private function getAuthenticatedUser()\n {\n return auth()->user();\n }", "protected function getAuthUser () {\n return Auth::user();\n }", "public function getAuthenticatedUser()\n {\n return $this->getUnsplashClient()->sendRequest('GET', 'me');\n }", "public static function getAuthenticatedUser ()\n\t{\n\t\t$inst = self::getInstance();\n\t\t\n\t\tif ($inst->_authenticatedUser == null) \n\t\t{\n\t\t\t$user = $inst->_auth->getIdentity();\n\t\t\tif ($user)\n\t\t\t\t$inst->_authenticatedUser = Tg_User::getUserById($user['id']);\n\t\t\telse\n\t\t\t\t$inst->_authenticatedUser = false;\n\t\t}\n\t\t\t\n\t\treturn $inst->_authenticatedUser;\n\t}", "public function getAuthenticatedUser()\n\t{\n\t\t$user = Auth::user();\n\t\t$user->merchant;\n\n\t\treturn $user;\n\t}", "public function getLoggedInUser() {\n return $this->_user->getLoggedInUser();\n }", "public function user()\n {\n return $this->app->auth->user();\n }", "public function user()\n {\n return $this->app->auth->user();\n }", "public function user() {\n\t\tif (!Auth::check()) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn Auth::getUser();\n\t}", "public function user()\n {\n return $this->auth->user();\n }", "public function getAuthenticatedUser()\n {\n return JWTAuth::parseToken()->authenticate();\n }", "protected function getUser()\n {\n return $this->container->get('security.context')->getToken()->getUser();\n }", "function getAuthenticatedUser()\n {\n if (isset($_SESSION['MFW_authenticated_user'])) {\n return $_SESSION['MFW_authenticated_user'];\n }\n\n return null;\n }", "public function GetCurrentUser()\n {\n return $this->userManager->getCurrent();\n }", "function getLoggedInUser()\n{\n\tif(isLoggedIn()) {\n\t\treturn auth()->user();\n\t}\n\treturn null;\n}", "public function user()\n {\n if ( ! Auth::check()) {\n return null;\n }\n\n return Auth::getUser();\n }", "public function getAuthorizedUser()\n {\n if (empty($this->currentUser)) {\n $this->authorize();\n }\n return $this->currentUser;\n }", "public function get_user() {\n\t\treturn $this->user;\n\t}", "public function user()\n {\n if (!Auth::check()) {\n return null;\n }\n\n return Auth::getUser();\n }", "public function get_user() {\n\t\treturn ($this->logged_in()) ? $this->session->get($this->config['session_key'], null) : null;\n\t}", "public static function getUser() {\n return session(\"auth_user\", null);\n }", "public function get_user() {\r\n\t\treturn ($this->user);\r\n\t}", "public static function getCurrentUser()\n {\n /**\n * @var \\ZCMS\\Core\\ZSession $session\n */\n $session = Di::getDefault()->get('session');\n return $session->get('auth');\n }", "public function getUser() {\n $user = $this->getSessionUser();\n\n return $user;\n }", "private function getLoggedInUser()\n {\n if (null !== $token = $this->securityContext->getToken()) {\n return $token->getUser();\n }\n\n return null;\n }", "public function getAuthenticatedUser()\n {\n return response()->json($this->guard('api')->user());\n }", "public static function getUser()\n {\n return self::getInstance()->_getUser();\n }", "public function getUser()\n {\n return $this->getAuth()->getIdentity();\n }", "public function getCurrentUser()\n {\n $this->validateUser();\n\n if ($this->session->has(\"user\")) {\n return $this->session->get(\"user\");\n }\n }", "static public function GetUser() {\n if (self::GetImpersonatedUser()) {\n return self::GetImpersonatedUser();\n }\n return self::GetAuthUser();\n }", "public function user()\n {\n if ($this->loggedOut) {\n return;\n }\n\n // If we've already retrieved the user for the current request we can just\n // return it back immediately. We do not want to fetch the user data on\n // every call to this method because that would be tremendously slow.\n if (! is_null($this->user)) {\n return $this->user;\n }\n\n if (\\session()->has($this->user_provider->getAuthIdentifierName()))\n {\n $user = \\session()->get($this->user_provider->getAuthIdentifierName());\n return $user;\n }\n\n $authenticated_user = $this->user_provider->retrieveById($this->user_provider->getAuthIdentifier());\n if (!isset($authenticated_user))\n {\n return;\n }\n $this->user_provider->setUserAttribute($authenticated_user);\n $this->setUser($this->user_provider);\n\n return $this->user;\n }", "public function user()\n {\n return $this->authUserService__();\n }", "public function user()\n {\n if (!$this->user) {\n $identifier = $this->getToken();\n $this->user = $this->provider->retrieveByToken($identifier, '');\n }\n return $this->user;\n }", "private function getUser()\n {\n return $this->user->getUser();\n }", "public function getCurrentUser()\n {\n $accessToken = $this->getFOSOauthServer()->verifyAccessToken(\n $this->getAccessTokenString(),\n 'user'\n );\n\n return $accessToken->getUser();\n }", "protected function getUser()\n {\n return $this->user;\n }", "public function getUser() {\n\t\treturn $this->api->getUserById($this->getUserId());\n\t}", "public function getLoggedInUser() {\n\t\treturn elgg_get_logged_in_user_entity();\n\t}", "public function getUser()\n {\n return $this->get(self::_USER);\n }", "public function getUser()\n {\n return $this->get(self::_USER);\n }", "public function getUser()\n {\n return $this->get(self::_USER);\n }", "public function getUser()\n {\n return $this->get(self::_USER);\n }", "public function getAuthUserDetail()\n {\n return $this->user;\n }", "public function getUser() {\n\t\treturn $this->Session->read('UserAuth');\n\t}", "public function getUser()\n {\n return Session::get(self::USER);\n }", "public function getLoggedInUser()\n {\n $securityContext = $this->container->get('security.context');\n $consultant = $securityContext->getToken()->getUser();\n return $consultant;\n }", "public function getUser()\n {\n return $this->container->get('user')->getUser();\n }", "public function getUser()\n {\n if(!$this->user)\n $this->user = User::getActive();\n\n return $this->user;\n }", "function authUser()\n {\n return auth()->user();\n }", "public function user()\n {\n return $this->app->auth->guard('admin')->user();\n }", "public static function user() {\n return Auth::currentUser();\n }", "public function getLoggedIn()\n\t{\n\t\treturn auth()->user();\n\t}", "public function getUser()\n {\n return $this->getContext()->getUser();\n }", "protected function getUser()\n {\n if ($this->_user === null) {\n $this->_user = User::findIdentity(Yii::$app->user->id);\n }\n\n return $this->_user;\n }", "public final function getUser()\n {\n return $this->user;\n }", "public function getCurrentUser()\n\t{\n\t\treturn $this->users->getCurrentUser();\n\t}", "public function getUser() {\n\t\treturn $this->user;\n\t}", "public function getUser() {\n\t\treturn $this->user;\n\t}", "public function user()\n\t{\n\t\tif (is_null($this->user) and $this->session->has(static::$key))\n\t\t{\n\t\t\t$this->user = call_user_func(Config::get('auth.by_id'), $this->session->get(static::$key));\n\t\t}\n\n\t\treturn $this->user;\n\t}", "public function getUser()\n {\n if (! $this->user) {\n $this->exchange();\n }\n\n return $this->user;\n }", "public function getUser()\n {\n if (null === $token = $this->securityContext->getToken()) {\n return;\n }\n\n if (!is_object($user = $token->getUser())) {\n return;\n }\n\n return $user;\n }", "public static function user()\n {\n if (!isset(static::$user)) {\n $uid = static::getCurrentUserId();\n if ($uid) static::$user = static::fetchUserById($uid);\n }\n \n return static::$user;\n }", "public function getUser()\n {\n return $this->accessToken->getUser();\n }", "public function getUser()\n {\n if ($this->_user === false) {\n $this->_user = User::findByLogin($this->login);\n }\n\n return $this->_user;\n }", "public function getUser()\n {\n if ($this->_user === false) {\n $this->_user = User::findByLogin($this->login);\n }\n\n return $this->_user;\n }", "public function getUser ()\r\n\t{\r\n\t\treturn $this->user;\r\n\t}", "public function getUser()\n {\n return $this->user;\n }", "public function getUser()\n {\n return $this->user;\n }", "public function getUser()\n {\n return $this->user;\n }", "public function getUser()\n {\n return $this->user;\n }", "public function getUser()\n {\n return $this->user;\n }", "public function getUser()\n {\n return $this->user;\n }", "public function getUser()\n {\n return $this->user;\n }", "public function getUser()\n {\n return $this->user;\n }", "public function getUser()\n {\n return $this->user;\n }", "public function getUser()\n {\n return $this->user;\n }", "public function getUser()\n {\n return $this->user;\n }", "public function getUser()\n {\n return $this->user;\n }", "public function getUser()\n {\n return $this->user;\n }", "public function getUser()\n {\n return $this->user;\n }", "public function getUser()\n {\n return $this->user;\n }", "public function getUser()\n {\n return $this->user;\n }", "public function getUser()\n {\n return $this->user;\n }", "public function getUser()\n {\n return $this->user;\n }", "public function getUser()\n {\n return $this->user;\n }", "public function getUser()\n {\n return $this->user;\n }", "public function getUser()\n {\n return $this->user;\n }", "public function getUser()\n {\n return $this->user;\n }", "public function getUser()\n {\n return $this->user;\n }", "public function getUser()\n {\n return $this->user;\n }", "public function getUser()\n {\n return $this->user;\n }", "public function getUser()\n {\n return $this->user;\n }", "public function getUser()\n {\n return $this->user;\n }", "protected function getUser()\n {\n return $this->user_provider->getHydratedUser();\n }", "public function getUser()\n {\n if ($this->_user === false) {\n $this->_user = User::findByUsername($this->email);\n }\n return $this->_user;\n }", "public function getUser( ) {\n\t\treturn $this->user;\n\t}", "public function getUser( ) {\n\t\treturn $this->user;\n\t}" ]
[ "0.8636257", "0.85953075", "0.85953075", "0.85888106", "0.8318398", "0.8286792", "0.8278905", "0.81200147", "0.8008301", "0.7995013", "0.7995013", "0.7988806", "0.797304", "0.7970671", "0.7966893", "0.7926469", "0.79074126", "0.7891598", "0.78681654", "0.7861022", "0.785861", "0.78523254", "0.78453493", "0.78200084", "0.7808365", "0.77682614", "0.7761893", "0.77471256", "0.77183473", "0.77155167", "0.7689981", "0.76658046", "0.7665223", "0.7658198", "0.7657454", "0.76563746", "0.764088", "0.7634252", "0.7632533", "0.76321405", "0.76317245", "0.76261073", "0.76261073", "0.76261073", "0.76261073", "0.76145643", "0.76122695", "0.7611143", "0.76101005", "0.7607403", "0.76051545", "0.7589735", "0.7584976", "0.75765735", "0.7550926", "0.75431293", "0.75406", "0.75379986", "0.7532697", "0.7527208", "0.7527208", "0.7516463", "0.75135905", "0.75106466", "0.7507839", "0.75016665", "0.7490555", "0.7490555", "0.74900943", "0.7486243", "0.7486243", "0.7486243", "0.7486243", "0.7486243", "0.7486243", "0.7486243", "0.7486243", "0.7486243", "0.7486243", "0.7486243", "0.7486243", "0.7486243", "0.7486243", "0.7486243", "0.7486243", "0.7486243", "0.7486243", "0.7486243", "0.7486243", "0.7486243", "0.7486243", "0.7486243", "0.7486243", "0.7486243", "0.7486243", "0.7486243", "0.7486125", "0.74771255", "0.7468817", "0.7468817" ]
0.7956038
15
Get the token for the current request.
public function getTokenForRequest() { //Check for request having token if (! $this->cognito->parser()->setRequest($this->request)->hasToken()) { return null; } if (! $this->cognito->parseToken()->authenticate()) { throw new NoLocalUserException(); } //Get claim $claim = $this->cognito->getClaim(); if (empty($claim)) { return null; } //Get user and return return $this->user = $this->provider->retrieveById($claim['sub']); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function get_request_token()\n {\n $sess_id = $_COOKIE[ini_get('session.name')];\n if (!$sess_id) $sess_id = session_id();\n $plugin = $this->plugins->exec_hook('request_token', array('value' => md5('RT' . $this->get_user_id() . $this->config->get('des_key') . $sess_id)));\n return $plugin['value'];\n }", "public function token()\n {\n $token = null;\n if (!empty(getallheaders()['Authorization'])) {\n $token = getallheaders()['Authorization'];\n }\n\n if (!$token) {\n $token = $this->request->query->get('token');\n }\n\n if (!$token) {\n throw new \\Exception(\"'token' is required in URL or header Authorization\");\n }\n\n return $token;\n\n }", "public function currentToken()\n {\n return $this->requestWithErrorHandling('get', '/api/current-token');\n }", "public function getToken()\n {\n $value = $this->getParameter('token');\n $value = $value ?: $this->httpRequest->query->get('token');\n return $value;\n }", "private function getToken(): ?string\n {\n $request = $this->requestStack->getCurrentRequest();\n\n $token = null;\n\n\n if (null !== $request) {\n $token = $request->headers->get('token', null);\n }\n\n $this->token = $token;\n\n return $token;\n }", "private function get_token() {\n\n\t\t$query = filter_input( INPUT_GET, 'mwp-token', FILTER_SANITIZE_STRING );\n\t\t$header = filter_input( INPUT_SERVER, 'HTTP_AUTHORIZATION', FILTER_SANITIZE_STRING );\n\n\t\treturn ( $query ) ? $query : ( $header ? $header : null );\n\n\t}", "public static function get_token() {\n\t\t\t\n\t\t\t// Bring in the $session variable\n\t\t\tglobal $session;\n\t\t\t// Check if there is a csrf_token in the $_SESSION\n\t\t\tif(!$session->get('csrf_token')) {\n\t\t\t\t// Token doesn't exist, create one\n\t\t\t\tself::set_token();\n\t\t\t} \n\t\t\t// Return the token\n\t\t\treturn $session->get('csrf_token');\n\t\t}", "public function getToken()\n {\n return $this->controller->getToken();\n }", "function getRequestToken() {\n\t\t$r = $this->oAuthRequest ( $this->requestTokenURL () );\n\t\t$token = $this->oAuthParseResponse ( $r );\n\t\t$this->token = new OAuthConsumer ( $token ['oauth_token'], $token ['oauth_token_secret'] );\n\t\treturn $token;\n\t}", "public static function get_token() {\n global $USER;\n $sid = session_id();\n return self::get_token_for_user($USER->id, $sid);\n }", "public function getToken()\n {\n return $this->getSecurityContext()->getToken();\n }", "public function getToken()\n {\n if (!isset($_SESSION['MFW_csrf-token'])) {\n $this->generateNewToken(128);\n }\n\n return $_SESSION['MFW_csrf-token'];\n }", "private function getCurrentToken() {\n\t\tif(isset($_GET) && isset($_GET['token'])) {\n\t\t\t$sToken = $_GET['token'];\n\t\t} else {\n\t\t\techo $this->_translator->error_token;\n\t\t\texit();\n\t\t}\n\t\treturn $sToken;\n\t}", "public function getToken() {\n return $this->token;\n }", "public function getToken()\n {\n return $this->token;\n }", "public function getToken()\n {\n return $this->token;\n }", "public function getToken()\n {\n return $this->token;\n }", "public function getToken()\n {\n return $this->token;\n }", "public function getToken()\n {\n return $this->token;\n }", "public function getToken()\n {\n return $this->token;\n }", "public function getToken()\n {\n return $this->token;\n }", "public function getToken()\n {\n return $this->token;\n }", "public function getToken()\n {\n return $this->token;\n }", "public function getToken()\n {\n return $this->token;\n }", "public function getToken()\n {\n return $this->token;\n }", "public function getToken()\n {\n return $this->token;\n }", "public function getToken()\n {\n return $this->token;\n }", "public function getToken()\n {\n return $this->token;\n }", "public function getToken()\n {\n return $this->token;\n }", "public function get_token() {\n\t\treturn $this->token;\n\t}", "public function getToken()\n {\n return $this->getApplication()->getSecurityContext()->getToken();\n }", "public function getToken() {\n return $this->token;\n }", "public function getToken() {\n\t\treturn $this->token;\n\t}", "public function getToken()\r\n {\r\n return $this->token;\r\n }", "public function getToken()\r\n {\r\n return $this->token;\r\n }", "public function getToken()\n {\n return $this->token;\n }", "public function getToken() {\n\t\treturn $this->_token;\n\t}", "public function getRequestToken()\n\t{\n\t\tif(!$this->hasRequestToken()){\n\t\t\t//reset all the parameters\n\t\t\t$this->resetParams();\n\t\t\t\n\t\t\t// make signature and append to params\n\t\t\t//$this->setSecret($this->_consumerSecret);\n\t\t\t$this->setRequestUrl($this->_requestTokenUrl);\n\t\t\t$this->_buildSignature();\n\t\t\t\n\t\t\t//get the response\n\t\t\t$response = $this->_send($this->_requestTokenUrl)->getBody();\n\t\t\t\n\t\t\t//format the response\n\t\t\t$responseVars = array();\n\t\t\tparse_str($response, $responseVars);\n\t\t\t$response = new BaseOAuthResponse($responseVars);\n\t\t\t$this->setRequestToken($response);\n\t\t}\n\t\t\n\t\t//send the query\n\t\treturn $this->getData('request_token');\n\t}", "public function getToken ()\n {\n return $this->token;\n }", "public function getCurrentToken()\n {\n return $this->current_token;\n }", "public function getToken()\n\t{\n\t\treturn $this->token;\n\t}", "protected function getRequestToken($request)\n {\n $name = $this->getName();\n $header = 'X-' . ucwords(strtolower($name ?? ''));\n if ($token = $request->getHeader($header)) {\n return $token;\n }\n\n // Get from request var\n return $request->requestVar($name);\n }", "public function getToken() {\n if (!isset($this->requestToken)) {\n trigger_error(tr('Request token missing. Is the session module missing?'), E_USER_WARNING);\n return '';\n }\n return $this->requestToken->getToken();\n }", "protected function getToken()\n {\n // We have a stateless app without sessions, so we use the cache to\n // retrieve the temp credentials for man in the middle attack\n // protection\n $key = 'oauth_temp_'.$this->request->input('oauth_token');\n $temp = $this->cache->get($key, '');\n\n return $this->server->getTokenCredentials(\n $temp,\n $this->request->input('oauth_token'),\n $this->request->input('oauth_verifier')\n );\n }", "public function getRequestToken(Request $request)\n {\n $token = $request->query($this->inputKey);\n\n if (empty($token)) {\n $token = $request->input($this->inputKey);\n }\n\n if (empty($token)) {\n $token = $request->bearerToken();\n }\n\n if (empty($token)) {\n $token = $request->getPassword();\n }\n\n return $token;\n }", "public function obtainCurrentToken(): Token\n {\n if (null === $this->currentToken || ! $this->currentToken->isValid()) {\n $this->currentToken = $this->authenticate();\n }\n return $this->currentToken;\n }", "public function getCurrentToken() : string\n {\n return $this->request->headers->get('auth-token') ?? '';\n }", "public function getToken()\n\t{\n\t\treturn static::createFormToken($this->target_form_id ? $this->target_form_id : $this->id);\n\t}", "public function getToken()\n {\n $authHeader = $this->getHeader('AUTHORIZATION');\n $authQuery = $this->getQuery('token');\n\n return $authQuery ? $authQuery : $this->parseBearerValue($authHeader);\n }", "private function getTokenFromRequest(Request $request)\n {\n return $request->headers->get(self::TOKEN_HEADER_KEY, $request->get(self::TOKEN_REQUEST_KEY));\n }", "public function get()\n {\n if ($token = $this->cachedToken()) {\n return $token;\n }\n\n return $this->newToken();\n }", "public function getToken() {\n\n\t\treturn $this->Token;\n\t}", "public function getToken()\n {\n if ($this->isValid()) {\n return $this->_data[OAuth::PARAM_TOKEN];\n }\n\n return null;\n }", "public static function getTokenForRequest(Request $request)\n {\n $token = $request->query(self::INPUTKEY);\n\n // TODO X-SESSION\n if (empty($token)) {\n $token = $request->headers->get('x-apitoken');\n }\n \n if (empty($token)) {\n $token = $request->input(self::INPUTKEY);\n }\n\n if (empty($token)) {\n $token = $request->bearerToken();\n }\n\n if (empty($token)) {\n $token = $request->getPassword();\n }\n \n return $token;\n }", "public function getToken() {\n\t\treturn $this->jwt;\n\t}", "public function getToken()\n {\n return self::TOKEN;\n }", "public function getToken()\n {\n return $this->accessToken;\n }", "public function getToken() {\n return $this->accessToken;\n }", "public function token()\n {\n if ($this->accessToken === null) {\n $this->initToken();\n }\n return $this->accessToken;\n }", "private function getToken()\r\n\t{\r\n\t\treturn $this->app['config']->get('hipsupport::config.token');\r\n\t}", "public static function getToken()\n {\n return isset(self::$_data[self::KEY_TOKEN]) ? self::$_data[self::KEY_TOKEN] : NULL;\n }", "public static function getToken() {\n return session(\"auth_token\", \"\");\n }", "public function getToken();", "public function getToken();", "public function getToken();", "public function getToken();", "public function getToken(): string\n {\n return $this->token;\n }", "public function getToken(): string\n {\n return $this->token;\n }", "public function getToken(): string\n {\n return $this->token;\n }", "public function getToken()\n\t{\n\t\treturn $this->getOption('accesstoken');\n\t}", "public function fetch_request_token(&$request) {\n $this->get_version($request);\n\n $consumer = $this->get_consumer($request);\n\n // no token required for the initial token request\n $token = NULL;\n\n $this->check_signature($request, $consumer, $token);\n\n // Rev A change\n $callback = $request->get_parameter('oauth_callback');\n $new_token = $this->data_store->new_request_token($consumer, $callback);\n\n return $new_token;\n }", "public function token()\n {\n return $this->token['token'] ?? null;\n }", "public function getUserToken()\n {\n return !is_null($this->authToken) ? $this->authToken : $this->cookieHelper->getRequestCookie('auth');\n }", "public function fetchRequestToken(Request &$request)\n {\n $this->getVersion($request);\n\n $client = $this->getClient($request);\n\n // no token required for the initial token request\n $token = new NullToken;\n\n $this->checkSignature($request, $client, $token);\n\n // Rev A change\n $callback = $request->getParameter('oauth_callback');\n\n return $this->data_store->newRequestToken($client, $callback);\n }", "public function getToken()\n {\n // if the user isn't authenticated simply return null\n $services = $this->services;\n if (!$services->get('permissions')->is('authenticated')) {\n return null;\n }\n\n // if we don't have a token; make one\n $session = $services->get('session');\n $container = new SessionContainer(static::CSRF_CONTAINER, $session);\n if (!$container['token']) {\n $session->start();\n $container['token'] = (string) new Uuid;\n $session->writeClose();\n }\n\n return $container['token'];\n }", "public function getToken()\n {\n $tokenValidator = new \\Paggi\\SDK\\TokenValidation(); //self::$container->get('TokenValidation');\n if (!$tokenValidator->isValidToken(self::$token)) {\n return false;\n }\n return self::$token;\n }", "public function get_request_token($callback);", "public function requestToken() {\n \n $result = $this->doRequest('v1.0/token?grant_type=1', 'GET');\n\n $this->_setToken($result->result->access_token);\n $this->_setRefreshToken($result->result->refresh_token);\n $this->_setExpireTime($result->result->expire_time);\n $this->_setUid($result->result->uid);\n\n }", "protected function getToken()\n {\n if (!$this->isStateless()) {\n $temp = $this->request->getSession()->get('oauth.temp');\n\n return $this->server->getTokenCredentials(\n $temp, $this->request->get('oauth_token'), $this->request->get('oauth_verifier')\n );\n } else {\n $temp = unserialize($_COOKIE['oauth_temp']);\n\n return $this->server->getTokenCredentials(\n $temp, $this->request->get('oauth_token'), $this->request->get('oauth_verifier')\n );\n }\n }", "public function getToken() : string {\n return $this->token;\n }", "public function getToken()\n {\n return $this->getAttr('access_token');\n }", "public function getToken()\n {\n return $this->em\n ->getRepository('InnmindAppBundle:ResourceToken')\n ->findOneBy([\n 'uuid' => $this->token,\n 'uri' => $this->uri\n ]);\n }", "function get_token()\n\t{\n\t\treturn session_id();\n\t}", "public function getToken(): string\n {\n return $this->attributes->get('token', '');\n }", "protected function getClientToken()\n {\n if (!$this->token) {\n $this->token = Mage::getSingleton('gene_braintree/wrapper_braintree')->init()->generateToken();\n }\n\n return $this->token;\n }", "public function GetToken($data){ \n \n return $this->token;\n \n }", "public function getToken(): string;", "public function getToken(): string;", "public function getToken(): string;", "public function getToken(): string;", "function token(){\n return Request::session('internal_token');\n}", "public function getOAuthToken()\n {\n return $this->oauthToken->getToken();\n }", "public function getToken()\r\n\t{\r\n\t\treturn $this->getTransaction()->getToken();\r\n\t}", "protected function getToken()\n {\n if (!isset($_SESSION['MFW_csrf-token'])) {\n throw new RuntimeException('There is no CSRF token generated.');\n }\n\n return $_SESSION['MFW_csrf-token'];\n }", "public function getCSRFToken() {\r\n\t // The CSRF token should always be stored in the user's session.\r\n\t // If it doesn't, the user is not logged in.\r\n\t return $this->input('session', 'token');\r\n\t}", "public function getToken() : string {\n if (($this->token === null) || ($this->token->isExpired())) {\n $jwtBuilder = new Builder();\n $jwtBuilder->set('iss', $this->handlerPublicKey);\n $jwtBuilder->set('sub', $this->credentialPublicKey);\n\n $this->token = $jwtBuilder\n ->sign(new Sha256(), $this->handlerPrivateKey)\n ->getToken();\n }\n\n return (string) $this->token;\n }", "private function findToken(Request $request)\n {\n if ($request->headers->has('X-JWT-Assertion')) {\n return $request->headers->get('X-JWT-Assertion');\n } elseif ($request->request->has('jwt-token')) {\n return $request->request->get('jwt-token');\n } elseif ($request->query->has('jwt-token')) {\n return $request->query->get('jwt-token');\n }\n return false;\n }", "public function getToken()\n {\n $parameters = array(\n 'Identifier' => $this->getIdentifier(),\n );\n\n $response = self::sendRequest(self::getModelName(), 'gettoken', $parameters);\n\n if (isset($response['status']) == false) {\n return false;\n }\n if ($response['status'] != 'success') {\n return false;\n }\n if (isset($response['domain']['AuthKey']) == false) {\n return false;\n }\n $this->setAuthKey($response['domain']['AuthKey']);\n return $response['domain']['AuthKey'];\n }", "protected function getOAuthRequestToken()\n\t{\n\t\t$params = $this->getParams();\n\t\t$consumerKey = $params->get('oauth_consumer_key');\n\t\t$app = JFactory::getApplication();\n\t\t$tokenParams = array(\n\t\t\t'oauth_callback' => OAUTH_CALLBACK_URL,\n\t\t\t'oauth_consumer_key' => $consumerKey\n\t\t);\n\n\t\t$curlOpts = $this->getOAuthCurlOpts();\n\n\t\t$tokenResult = XingOAuthRequester::requestRequestToken($consumerKey, 0, $tokenParams, 'POST', array(), $curlOpts);\n\t\t$requestOpts = array('http_error_codes' => array(200, 201));\n\t\t//$tokenResult = OAuthRequester::requestRequestToken($consumerKey, 0, $tokenParams, 'POST', $requestOpts, $curlOpts);\n\t\t$uri = OAUTH_AUTHORIZE_URL . \"?btmpl=mobile&oauth_token=\" . $tokenResult['token'];\n\t\t$app->redirect($uri);\n\t}", "public function token(): Token\n {\n return self::instance()->runner->token();\n }", "public function getApiToken()\n {\n return $this->apiGenerator->getApiToken();\n }" ]
[ "0.7793079", "0.76922476", "0.7682764", "0.7675397", "0.7638158", "0.7598385", "0.7591153", "0.7576759", "0.7566031", "0.7564487", "0.75496787", "0.7549625", "0.751833", "0.75096416", "0.75089765", "0.75089765", "0.75089765", "0.75089765", "0.75089765", "0.75089765", "0.75089765", "0.75089765", "0.75089765", "0.75089765", "0.75089765", "0.75089765", "0.75089765", "0.75089765", "0.75089765", "0.7492195", "0.7479932", "0.74651563", "0.74560183", "0.74552613", "0.74552613", "0.743323", "0.741914", "0.7390418", "0.7381343", "0.7377943", "0.73720515", "0.7371727", "0.73694223", "0.735994", "0.7336715", "0.7331918", "0.73256385", "0.72981995", "0.7293222", "0.7273635", "0.72632354", "0.7263115", "0.72294647", "0.7228851", "0.72264683", "0.71789795", "0.7168478", "0.7119939", "0.7099755", "0.70824814", "0.70759016", "0.7069197", "0.7067844", "0.7067844", "0.7067844", "0.7067844", "0.7036641", "0.7036641", "0.7036641", "0.70182794", "0.7016829", "0.70083606", "0.6995694", "0.698352", "0.6960786", "0.69171894", "0.6890848", "0.6866273", "0.68628037", "0.68621254", "0.6854625", "0.6811743", "0.67963684", "0.6794643", "0.6792015", "0.6785191", "0.6736686", "0.6736686", "0.6736686", "0.6736686", "0.67348623", "0.673265", "0.672866", "0.6723995", "0.6710803", "0.669154", "0.66914433", "0.66827327", "0.6680883", "0.6679514", "0.6671181" ]
0.0
-1